blob: 378472fe61e78276a3ce9778edbcf221d318e48e [file] [log] [blame]
Harald Welte84ec50f2016-12-24 10:16:00 +01001#pragma once
2
3#include <stdint.h>
4
5#define GSM(x) (0x5000 + x)
6
7enum diag_log_code_gsm {
8 LOG_GSM_POWER_SCAN_C = 0x64,
9 LOG_GSM_FCCH_DECODE_C = 0x65,
10 LOG_GSM_NCELL_ACQ_C = 0x75,
11 LOG_GSM_AFC_ADJUST_C = 0x7c,
12 LOG_GSM_MON_BURST_C = 0x82,
13 LOG_GSM_BCCH_BURST_METRICS_C = 0x85,
Harald Welte0512d9d2017-01-21 11:01:45 +010014 LOG_GSM_MDSP_CMD_C = 0x8c,
Harald Welte84ec50f2016-12-24 10:16:00 +010015 LOG_GSM_GL1_HW_CMD_C = 0x8d,
Harald Welte84ec50f2016-12-24 10:16:00 +010016 LOG_GSM_RR_SIGNALING_MESSAGE_C = 0x12f,
17
Harald Welte0512d9d2017-01-21 11:01:45 +010018 /* Layer2 (LAPDm) */
19 LOG_GSM_L2_STATE_C = 200,
20 LOG_GSM_L2_TRANSMISSION_STATUS_C = 201,
21 LOG_GSM_L2_OUTSTANDING_FRAME_C = 202,
Harald Welte84ec50f2016-12-24 10:16:00 +010022
Harald Welte0512d9d2017-01-21 11:01:45 +010023
24 LOG_GSM_RR_STATE_C = 300,
Harald Weltece2f3962016-12-30 15:48:22 +010025 //= 303,
Harald Welte84ec50f2016-12-24 10:16:00 +010026 LOG_GSM_RR_CONTROL_CHANNEL_PARAMS_C = 306,
27
28 LOG_GPRS_INDICATORS_C = 500,
29 LOG_GPRS_GENERAL_PARAMS_C = 501,
30 LOG_GPRS_CELL_OPTIONS_C = 502,
31 LOG_GPRS_POWER_CONTROL_PARAMS_C = 503,
32 LOG_GPRS_MOBILE_ALLOCATION_C = 504,
33 LOG_GPRS_PBCCH_DESCRIPTION_C = 505,
34 LOG_GPRS_GRR_STATE_C = 506,
35 LOG_GPRS_RR_CELL_RESELECTION_PARAMS_C = 507,
36 LOG_GPRS_RR_CELL_RESELECTION_MEASMNTS_C = 508,
37 LOG_GPRS_RR_PSI1_C = 509,
38 LOG_GPRS_RR_PSI2_C = 510,
39 LOG_GPRS_RR_PSI3_C = 511,
40 LOG_GPRS_RLC_UL_ABNRML_RLS_COUNTS_C = 512,
41 LOG_GPRS_RLC_UL_EVENT_COUNTS_C = 513,
42 LOG_GPRS_RLC_UL_STATS_C = 514,
43 LOG_EGPRS_RLC_UL_HEADER_C = 517,
44 LOG_EGPRS_RLC_DL_HEADER_C = 518,
45 LOG_EGPRS_RLC_UL_STATS_C = 519,
46 LOG_EGPRS_RLC_DL_STATS_C = 520,
47 LOG_EGPRS_RLC_EPUAN_C = 521,
48 LOG_GPRS_RLC_DL_STATS_C = 522,
49 LOG_GPRS_RLC_UL_ACKNACK_PARAMS_C = 523,
50 LOG_GPRS_RLC_DL_ACKNACK_PARAMS_C = 524,
51 LOG_GPRS_RLC_UL_RELEASE_IND_C = 525,
52 LOG_GPRS_RLC_DL_RELEASE_IND_C = 526,
53 LOG_GPRS_RLC_UL_ACKNACK_PARAMS_VER2_C = 527,
54 LOG_GPRS_RLC_DL_ACKNACK_PARAMS_VER2_C = 528,
55 LOG_EGPRS_RLC_EPDAN_C = 529,
56 LOG_GPRS_LLC_ME_INFO_C = 530,
57 LOG_GPRS_LLC_SAPI_STATES_C = 531,
58 LOG_GPRS_LLC_XID_INFO_C = 532,
59 LOG_GPRS_LLC_PDU_STATS_C = 533,
60 LOG_GPRS_LLC_PERIODIC_STATS_C = 534,
61 LOG_GPRS_LLC_READY_TIMER_STATUS_C = 535,
62 LOG_GPRS_LLC_SEND_UI_FRAME_C = 536,
63 LOG_GPRS_LLC_RECV_UI_FRAME_C = 537,
64 LOG_GPRS_LLC_READY_TIMER_STATUS_VER2_C = 538,
65 LOG_GPRS_SNDCP_ACTIVE_PDP_CONTEXTS_C = 540,
66 LOG_GPRS_SNDCP_PDP_CONTEXT_INFO_C = 541,
67 LOG_GPRS_SNDCP_STATES_C = 542,
68 LOG_GPRS_SNDCP_PDU_STATS_C = 543,
69 LOG_GPRS_SNDCP_UL_TCP_HDR_C = 544,
70 LOG_GPRS_SNDCP_DL_TCP_HDR_C = 545,
71 LOG_GPRS_MAC_SIGNALLING_MESSAGE_C = 550,
72 LOG_GPRS_MAC_STATE_C = 551,
73 LOG_GPRS_MAC_UL_TBF_ESTABLISH_C = 552,
74 LOG_GPRS_MAC_UL_TBF_RELEASE_C = 553,
75 LOG_GPRS_MAC_DL_TBF_ESTABLISH_C = 554,
76 LOG_GPRS_MAC_DL_TBF_RELEASE_C = 555,
77 LOG_EGPRS_MAC_UL_ACKNACK_C = 556,
78 LOG_EGPRS_MAC_DL_ACKNACK_C = 557,
79 LOG_EGPRS_SRB_HARD_DECISIONS_C = 558,
80 LOG_GPRS_SM_GMM_OTA_MESSAGE_C = 560,
81 LOG_GPRS_AIR_INTERFACE_SUMMARY_C = 561,
82 LOG_GPRS_AGC_C = 562,
83 LOG_GPRS_TIMING_ADVANCE_C = 563,
84 LOG_GPRS_POWER_CONTROL_C = 564,
85 LOG_GPRS_TRANSFER_SUMMARY_C = 565,
86 LOG_GPRS_TX_SCHEDULED_RESULTS_C = 567,
87 LOG_GPRS_HW_SCHEDULE_C = 570,
88 LOG_UPLINK_TBF_DATA_BLOCK_COUNT_C = 575,
89 LOG_GPRS_RECEIVE_BURST_METRICS_A_C = 581,
90 LOG_GPRS_RECEIVE_BURST_METRICS_B_C = 582,
91 LOG_GPRS_RECEIVE_BURST_METRICS_C_C = 583,
92 LOG_GPRS_RECEIVE_BURST_METRICS_D_C = 584,
93 LOG_GPRS_RECEIVE_MSG_METRICS_A_C = 585,
94 LOG_GPRS_RECEIVE_MSG_METRICS_B_C = 586,
95 LOG_GPRS_RECEIVE_MSG_METRICS_C_C = 587,
96 LOG_GPRS_RECEIVE_MSG_METRICS_D_C = 588,
97 LOG_GPRS_RECEIVE_MSG_METRICS_A_VER2_C = 589,
98 LOG_GPRS_RECEIVE_MSG_METRICS_B_VER2_C = 590,
99 LOG_GPRS_RECEIVE_MSG_METRICS_C_VER2_C = 591,
100 LOG_GPRS_RECEIVE_MSG_METRICS_D_VER2_C = 592,
101 LOG_GPRS_DLPTCCH_BURST_METRICS_C = 593,
102 LOG_GPRS_DLPTCCH_MSG_METRICS_C = 594,
103};
104
105enum diag_gsm_cmd {
106 GSM_DIAG_VERNO_F = 0,
107 GSM_STATUS_F = 1,
108 GSM_TMC_STATE_RETRIEVAL_F = 2,
109 GSM_DIAG_CALL_ORIG_F = 3,
110 GSM_DIAG_CALL_END_F = 4,
111 GSM_GPRS_LOG_PACKET_REQ_F = 5,
112 DIAG_GSM_MAX_F = 6,
113};
114
Harald Weltece2f3962016-12-30 15:48:22 +0100115/* channel_type | 0x80 == downlink */
116enum diag_gsm_rr_chan_type {
117 DIAG_GSM_L2_CHAN_TYPE_DCCH = 0,
118 DIAG_GSM_L2_CHAN_TYPE_BCCH = 1,
119 DIAG_GSM_L2_CHAN_TYPE_RACH = 2,
120 DIAG_GSM_L2_CHAN_TYPE_CCCH = 3,
121 DIAG_GSM_L2_CHAN_TYPE_SACCH = 4,
122 DIAG_GSM_L2_CHAN_TYPE_SDCCH = 5,
123 DIAG_GSM_L2_CHAN_TYPE_FACCH_F = 6,
124 DIAG_GSM_L2_CHAN_TYPE_FACCH_H = 7,
125};
126
Harald Welte84ec50f2016-12-24 10:16:00 +0100127/* LOG_GSM_RR_SIGNALING_MESSAGE_C */
128struct diag_gsm_rr_msg {
129 uint8_t chan_type;
130 uint8_t msg_type;
131 uint8_t length;
132 uint8_t data[0];
133} __attribute__((packed));
134
135enum diag_gsm_rr_st {
136 DIAG_RR_ST_INACTIVE = 0,
137 DIAG_RR_ST_GOING_ACTIVE = 1,
138 DIAG_RR_ST_GOING_INACTIVE = 2,
139 DIAG_RR_ST_CELL_SELECTION = 3,
140 DIAG_RR_ST_PLMN_LIST_CONSTRUCTION = 4,
141 DIAG_RR_ST_IDLE = 5,
142 DIAG_RR_ST_CELL_RESELECTION = 6,
143 DIAG_RR_ST_CONNECTION_PENDING = 7,
144 DIAG_RR_ST_CHOOSE_CELL = 8,
145 DIAG_RR_ST_DATA_TRANSFER = 9,
146 DIAG_RR_ST_NO_CHANNELS = 10,
147 DIAG_RR_ST_CONNECTION_RELEASE = 11,
148 DIAG_RR_ST_EARLY_CAMPED_WAIT_FOR_SI= 12,
149 DIAG_RR_ST_W2G_INTERRAT_HO_PROGRESS= 13,
150 DIAG_RR_ST_W2G_INTERRAT_RESELECTION_PROGRESS = 14,
151 DIAG_RR_ST_W2G_INTERRAT_CC_ORDER_PROGRESS = 15,
152 DIAG_RR_ST_G2W_INTERRAT_RESELECTION_PROGRESS = 16,
153 DIAG_RR_ST_WAIT_FOR_EARLY_PSCAN = 17,
154 DIAG_RR_ST_GRR = 18,
155 DIAG_RR_ST_G2W_INTERRAT_HO_PROGRESS = 20,
156 DIAG_RR_ST_BACKGROUND_PLMN_SEARCH = 21,
157 DIAG_RR_ST_W2G_SERVICE_REDIR_IN_PROGRESS = 22,
158 DIAG_RR_ST_RESET = 23,
159 DIAG_RR_ST_W2G_BACKGROUND_PLN_SEARCH = 24,
160};
161extern const struct value_string diag_gsm_rr_st_vals[25];
162
163/* LOG_GSM_RR_STATE_C */
164struct diag_gsm_rr_state {
165 uint8_t state;
166 uint8_t substate;
167 uint8_t status;
168 uint8_t mode;
169} __attribute__((packed));
170
171enum diag_gprs_grr_st {
172 DIAG_GRR_ST_NULL = 0,
173 DIAG_GRR_ST_ACQUIRE = 1,
174 DIAG_GRR_ST_CAMPED = 2,
175 DIAG_GRR_ST_CONN_PEND = 3,
176 DIAG_GRR_ST_CELL_RESEL = 4,
177 DIAG_GRR_ST_CELL_RESEL_G2W = 6,
178 DIAG_GRR_ST_BG_PLMN_SEARCH = 7,
179 DIAG_GRR_ST_PCCO = 8,
180};
181extern const struct value_string diag_gprs_grr_st_vals[9];
182
183/* LOG_GPRS_GRR_STATE_C */
184struct diag_gprs_grr_state {
185 uint8_t active_state;
186 uint8_t grr_state;
187} __attribute__((packed));
188
189
190enum diag_gprs_llme_state {
191 DIAG_GPRS_LLMES_TLLI_UNASS = 0,
192 DIAG_GPRS_LLMES_TLLI_ASS = 1,
193 DIAG_GPRS_LLMES_TEST_MODE = 2,
194};
195const struct value_string diag_gprs_llme_st_vals[4];
196
197/* LOG_GPRS_LLC_ME_INFO_C */
198struct diag_gprs_llme_info {
199 uint8_t state;
200 uint8_t xid_version;
201 uint32_t tlli_new;
202 uint32_t tlli_old;
203 uint8_t enc_alg;
204 uint8_t enc_key[8];
205 uint32_t input_offset_iov_ui;
206} __attribute__((packed));
207
208/* LOG_GPRS_LLC_PDU_STATS_C */
209struct diag_gprs_llc_stats {
210 uint8_t sapi;
211 uint32_t ack_l3pdu_tx;
212 uint32_t ack_octet_tx;
213 uint32_t ack_l3pdu_retrans;
214 uint32_t ack_octet_retrans;
215 uint32_t ack_l3pdu_rx;
216 uint32_t ack_octet_rx;
217 uint32_t unack_l3pdu_tx;
218 uint32_t unack_octet_tx;
219 uint32_t unack_l3pdu_rx;
220 uint32_t unack_octet_rx;
221 uint32_t llpdu_tx;
222 uint32_t llpdu_rx;
223 uint32_t llpdu_fcs_err;
224 uint32_t llpdu_frm_rej;
225 uint32_t llpdu_tlli_err;
226 uint32_t llpdu_addr_err;
227 uint32_t llpdu_short_err;
228} __attribute__((packed));
229
Harald Welte00749512017-01-09 14:58:41 +0100230struct diag_xid_tuple32 {
231 uint32_t current;
232 uint32_t preferred;
233} __attribute__ ((packed));
234
235struct diag_xid_tuple16 {
236 uint16_t current;
237 uint16_t preferred;
238} __attribute__ ((packed));
239
240struct diag_xid_tuple8 {
241 uint8_t current;
242 uint8_t preferred;
243} __attribute__ ((packed));
244
245/* LOG_GPRS_LLC_XID_INFO_C */
246struct diag_gprs_llc_xid_info {
247 uint8_t gllc_sapi;
248 uint16_t pending_xid_bitmap;
249 uint32_t cur_iov_i;
250 struct diag_xid_tuple32 t200;
251 struct diag_xid_tuple8 n200;
252 struct diag_xid_tuple16 n201_u;
253 struct diag_xid_tuple16 n201_i;
254 struct diag_xid_tuple16 md;
255 struct diag_xid_tuple16 mu;
256 struct diag_xid_tuple8 kd;
257 struct diag_xid_tuple8 ku;
258} __attribute__ ((packed));
259
Harald Welte0512d9d2017-01-21 11:01:45 +0100260struct diag_mdsp_log_cmd {
261 uint32_t fn;
262 uint16_t cnt;
263 uint16_t seq;
264 uint16_t cmd;
265 uint16_t params[5];
266} __attribute__ ((packed));
267
268struct diag_mdsp_log_cmds {
269 uint32_t num_cmds;
270 struct diag_mdsp_log_cmd cmds[16];
271} __attribute__ ((packed));
272
273
274enum diag_gsm_sapi0_state {
275 DIAG_SAPI0_ST_NULL,
276 DIAG_SAPI0_ST_CON_PEND,
277 DIAG_SAPI0_ST_IDLE,
278 DIAG_SAPI0_ST_EST_PEND,
279 DIAG_SAPI0_ST_REL_PEND,
280 DIAG_SAPI0_ST_LINK_EST,
281 DIAG_SAPI0_ST_TMR_RECOV,
282 DIAG_SAPI0_ST_LINK_SUSP,
283 DIAG_SAPI0_ST_UA_PEND,
284};
285const struct value_string diag_gsm_l2_sapi0_st_vals[10];
286
287enum diag_gsm_sapi3_state {
288 DIAG_SAPI3_ST_NULL,
289 DIAG_SAPI3_ST_CON_PEND,
290 DIAG_SAPI3_ST_IDLE,
291 DIAG_SAPI3_ST_EST_PEND,
292 DIAG_SAPI3_ST_REL_PEND,
293 DIAG_SAPI3_ST_LINK_EST,
294 DIAG_SAPI3_ST_TMR_RECOV,
295 DIAG_SAPI3_ST_UA_PEND,
296};
297const struct value_string diag_gsm_l2_sapi3_st_vals[9];
298
299enum diag_gsm_l2_event {
300 DIAG_L2_EV_NO_EVENT,
301 DIAG_L2_EV_CONNECT_RECEIVED,
302 DIAG_L2_EV_ESTABLISH_REQUEST,
303 DIAG_L2_EV_RELEASE_REQUEST,
304 DIAG_L2_EV_SUSPEND_REQUEST,
305 DIAG_L2_EV_RESUME_REQUEST,
306 DIAG_L2_EV_RECONNECT_REQUEST,
307 DIAG_L2_EV_DATA_REQUEST,
308 DIAG_L2_EV_MDL_RELEASE_REQUEST,
309 DIAG_L2_EV_UA_RECEIVED,
310 DIAG_L2_EV_DM_RECEIVED,
311 DIAG_L2_EV_DISC_RECEIVED,
312 DIAG_L2_EV_SABM_RECEIVED,
313 DIAG_L2_EV_I_RECEIVED,
314 DIAG_L2_EV_UI_RECEIVED,
315 DIAG_L2_EV_RR_RECEIVED,
316 DIAG_L2_EV_REJ_RECEIVED,
317 DIAG_L2_EV_T200_TIMEOUT,
318 DIAG_L2_EV_CONTENTION_FAILED,
319 DIAG_L2_EV_ABORT_ESTABLISHMENT,
320 DIAG_L2_EV_LINK_ESTABLISHED,
321 DIAG_L2_EV_RELEASE_CONFIRMED,
322 DIAG_L2_EV_CLEAR_RECOVERY_CONDITION,
323 DIAG_L2_EV_OPTIONAL_SEND,
324 DIAG_L2_EV_RESET_L2,
325 DIAG_L2_EV_UA_SENT,
326 DIAG_L2_EV_FORCED_SUSPEND_REQ,
327};
Harald Welte70ff72d2017-01-21 11:20:07 +0100328const struct value_string diag_gsm_l2_event_vals[28];
Harald Welte0512d9d2017-01-21 11:01:45 +0100329
330struct diag_gsm_l2_state {
331 uint8_t sapi;
332 uint8_t l2_state;
333 uint8_t l2_event;
334} __attribute__ ((packed));
335
Harald Welte1570b9f2017-01-21 11:15:50 +0100336enum diag_gsm_l2_chantype {
337 DIAG_L2_CHT_DCCH = 0,
338 DIAG_L2_CHT_BCCH = 1,
339 DIAG_L2_CHT_L2_RACH = 2,
340 DIAG_L2_CHT_CCCH = 3,
341 DIAG_L2_CHT_SACCH = 4,
342 DIAG_L2_CHT_SDCCH = 5,
343 DIAG_L2_CHT_FACCH_F = 6,
344 DIAG_L2_CHT_FACCH_H = 7,
345};
346const struct value_string diag_gsm_l2_chantype_vals[9];
347
Harald Welte0512d9d2017-01-21 11:01:45 +0100348struct diag_gsm_l2_transm_status {
349 uint8_t sapi;
350 uint8_t channel_type;
351 uint8_t vs;
352 uint8_t va;
353 uint8_t vr;
354 uint8_t retrans_ctr;
355 uint8_t seq_err;
356 uint8_t frame_type;
357 uint8_t msg_entries;
358 uint8_t seg_entries;
359} __attribute__ ((packed));
360
Harald Welte84ec50f2016-12-24 10:16:00 +0100361struct msgb *diag_gsm_make_log_pack_req(uint16_t log_code, uint8_t zero_stats, uint8_t addl_info);