Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-mac-nr.c
blob8e98468129d16cf3d2f956d3bc5c700f8cce066a
1 /* Routines for 5G/NR MAC disassembly
3 * Based on packet-mac-lte.c
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include "config.h"
14 #include <epan/packet.h>
15 #include <epan/exceptions.h>
16 #include <epan/expert.h>
17 #include <epan/proto_data.h>
18 #include <epan/tap.h>
19 #include <epan/uat.h>
20 #include <epan/tfs.h>
21 #include <wsutil/array.h>
23 #include "packet-mac-nr.h"
24 #include "packet-mac-3gpp-common.h"
25 #include "packet-rlc-nr.h"
27 void proto_register_mac_nr(void);
28 void proto_reg_handoff_mac_nr(void);
30 /* Described in:
31 * 3GPP TS 38.321 NR; Medium Access Control (MAC) protocol specification v15.6.0
34 /* Initialize the protocol and registered fields. */
35 int proto_mac_nr;
37 static int mac_nr_tap = -1;
39 static dissector_handle_t rlc_nr_handle;
41 /* Decoding context */
42 static int hf_mac_nr_context;
43 static int hf_mac_nr_context_radio_type;
44 static int hf_mac_nr_context_direction;
45 static int hf_mac_nr_context_rnti;
46 static int hf_mac_nr_context_rnti_type;
47 static int hf_mac_nr_context_ueid;
48 static int hf_mac_nr_context_sysframe_number;
49 static int hf_mac_nr_context_slot_number;
50 static int hf_mac_nr_context_harqid;
51 static int hf_mac_nr_context_bcch_transport_channel;
52 static int hf_mac_nr_context_phr_type2_othercell;
55 static int hf_mac_nr_subheader;
56 static int hf_mac_nr_subheader_reserved;
57 static int hf_mac_nr_subheader_f;
58 static int hf_mac_nr_subheader_length_1_byte;
59 static int hf_mac_nr_subheader_length_2_bytes;
60 static int hf_mac_nr_lcid;
61 static int hf_mac_nr_ulsch_lcid;
62 static int hf_mac_nr_dlsch_lcid;
63 static int hf_mac_nr_dlsch_elcid_2oct;
64 static int hf_mac_nr_ulsch_elcid_2oct;
65 static int hf_mac_nr_dlsch_elcid_1oct;
66 static int hf_mac_nr_ulsch_elcid_1oct;
67 static int hf_mac_nr_dlsch_sdu;
68 static int hf_mac_nr_ulsch_sdu;
69 static int hf_mac_nr_bcch_pdu;
70 static int hf_mac_nr_pcch_pdu;
72 static int hf_mac_nr_control_crnti;
73 static int hf_mac_nr_control_ue_contention_resolution_identity;
74 static int hf_mac_nr_control_timing_advance_tagid;
75 static int hf_mac_nr_control_timing_advance_command;
76 static int hf_mac_nr_control_se_phr_reserved;
77 static int hf_mac_nr_control_se_phr_ph;
78 static int hf_mac_nr_control_se_phr_pcmax_f_c;
79 static int hf_mac_nr_control_recommended_bit_rate_query_lcid;
80 static int hf_mac_nr_control_recommended_bit_rate_query_dir;
81 static int hf_mac_nr_control_recommended_bit_rate_query_bit_rate;
82 static int hf_mac_nr_control_recommended_bit_rate_query_reserved;
83 static int hf_mac_nr_control_me_phr_c7_flag;
84 static int hf_mac_nr_control_me_phr_c6_flag;
85 static int hf_mac_nr_control_me_phr_c5_flag;
86 static int hf_mac_nr_control_me_phr_c4_flag;
87 static int hf_mac_nr_control_me_phr_c3_flag;
88 static int hf_mac_nr_control_me_phr_c2_flag;
89 static int hf_mac_nr_control_me_phr_c1_flag;
90 static int hf_mac_nr_control_me_phr_c15_flag;
91 static int hf_mac_nr_control_me_phr_c14_flag;
92 static int hf_mac_nr_control_me_phr_c13_flag;
93 static int hf_mac_nr_control_me_phr_c12_flag;
94 static int hf_mac_nr_control_me_phr_c11_flag;
95 static int hf_mac_nr_control_me_phr_c10_flag;
96 static int hf_mac_nr_control_me_phr_c9_flag;
97 static int hf_mac_nr_control_me_phr_c8_flag;
98 static int hf_mac_nr_control_me_phr_c23_flag;
99 static int hf_mac_nr_control_me_phr_c22_flag;
100 static int hf_mac_nr_control_me_phr_c21_flag;
101 static int hf_mac_nr_control_me_phr_c20_flag;
102 static int hf_mac_nr_control_me_phr_c19_flag;
103 static int hf_mac_nr_control_me_phr_c18_flag;
104 static int hf_mac_nr_control_me_phr_c17_flag;
105 static int hf_mac_nr_control_me_phr_c16_flag;
106 static int hf_mac_nr_control_me_phr_c31_flag;
107 static int hf_mac_nr_control_me_phr_c30_flag;
108 static int hf_mac_nr_control_me_phr_c29_flag;
109 static int hf_mac_nr_control_me_phr_c28_flag;
110 static int hf_mac_nr_control_me_phr_c27_flag;
111 static int hf_mac_nr_control_me_phr_c26_flag;
112 static int hf_mac_nr_control_me_phr_c25_flag;
113 static int hf_mac_nr_control_me_phr_c24_flag;
114 static int hf_mac_nr_control_me_phr_entry;
115 static int hf_mac_nr_control_me_phr_p;
116 static int hf_mac_nr_control_me_phr_v;
117 static int hf_mac_nr_control_me_phr_reserved_2;
118 static int hf_mac_nr_control_me_phr_ph_type2_spcell;
119 static int hf_mac_nr_control_me_phr_ph_type1_pcell;
120 static int hf_mac_nr_control_me_phr_ph_c31;
121 static int hf_mac_nr_control_me_phr_ph_c30;
122 static int hf_mac_nr_control_me_phr_ph_c29;
123 static int hf_mac_nr_control_me_phr_ph_c28;
124 static int hf_mac_nr_control_me_phr_ph_c27;
125 static int hf_mac_nr_control_me_phr_ph_c26;
126 static int hf_mac_nr_control_me_phr_ph_c25;
127 static int hf_mac_nr_control_me_phr_ph_c24;
128 static int hf_mac_nr_control_me_phr_ph_c23;
129 static int hf_mac_nr_control_me_phr_ph_c22;
130 static int hf_mac_nr_control_me_phr_ph_c21;
131 static int hf_mac_nr_control_me_phr_ph_c20;
132 static int hf_mac_nr_control_me_phr_ph_c19;
133 static int hf_mac_nr_control_me_phr_ph_c18;
134 static int hf_mac_nr_control_me_phr_ph_c17;
135 static int hf_mac_nr_control_me_phr_ph_c16;
136 static int hf_mac_nr_control_me_phr_ph_c15;
137 static int hf_mac_nr_control_me_phr_ph_c14;
138 static int hf_mac_nr_control_me_phr_ph_c13;
139 static int hf_mac_nr_control_me_phr_ph_c12;
140 static int hf_mac_nr_control_me_phr_ph_c11;
141 static int hf_mac_nr_control_me_phr_ph_c10;
142 static int hf_mac_nr_control_me_phr_ph_c9;
143 static int hf_mac_nr_control_me_phr_ph_c8;
144 static int hf_mac_nr_control_me_phr_ph_c7;
145 static int hf_mac_nr_control_me_phr_ph_c6;
146 static int hf_mac_nr_control_me_phr_ph_c5;
147 static int hf_mac_nr_control_me_phr_ph_c4;
148 static int hf_mac_nr_control_me_phr_ph_c3;
149 static int hf_mac_nr_control_me_phr_ph_c2;
150 static int hf_mac_nr_control_me_phr_ph_c1;
151 static int hf_mac_nr_control_me_phr_reserved;
152 static int hf_mac_nr_control_me_phr_pcmax_f_c_type2_spcell;
153 static int hf_mac_nr_control_me_phr_pcmax_f_c_type1_pcell;
154 /* TODO: is it worth having separate fields for each SCellIndex for this field too? */
155 static int hf_mac_nr_control_me_phr_pcmax_f_c_typeX;
156 static int hf_mac_nr_control_recommended_bit_rate_lcid;
157 static int hf_mac_nr_control_recommended_bit_rate_dir;
158 static int hf_mac_nr_control_recommended_bit_rate_bit_rate;
159 static int hf_mac_nr_control_recommended_bit_rate_reserved;
160 static int hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_ad;
161 static int hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_serving_cell_id;
162 static int hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_bwp_id;
163 static int hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_reserved_2;
164 static int hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_sp_zp_rs_resource_set_id;
165 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_reserved;
166 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_serving_cell_id;
167 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_bwp_id;
168 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_pucch_resource_id;
169 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_s8;
170 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_s7;
171 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_s6;
172 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_s5;
173 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_s4;
174 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_s3;
175 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_s2;
176 static int hf_mac_nr_control_pucch_spatial_rel_act_deact_s1;
177 static int hf_mac_nr_control_sp_srs_act_deact_ad;
178 static int hf_mac_nr_control_sp_srs_act_deact_srs_resource_set_cell_id;
179 static int hf_mac_nr_control_sp_srs_act_deact_srs_resource_set_bwp_id;
180 static int hf_mac_nr_control_sp_srs_act_deact_reserved;
181 static int hf_mac_nr_control_sp_srs_act_deact_c;
182 static int hf_mac_nr_control_sp_srs_act_deact_sul;
183 static int hf_mac_nr_control_sp_srs_act_deact_sp_srs_resource_set_id;
184 static int hf_mac_nr_control_sp_srs_act_deact_f;
185 static int hf_mac_nr_control_sp_srs_act_deact_resource_id;
186 static int hf_mac_nr_control_sp_srs_act_deact_resource_id_ssb;
187 static int hf_mac_nr_control_sp_srs_act_deact_resource_serving_cell_id;
188 static int hf_mac_nr_control_sp_srs_act_deact_resource_bwp_id;
189 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_reserved;
190 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_serving_cell_id;
191 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_bwp_id;
192 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s7;
193 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s6;
194 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s5;
195 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s4;
196 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s3;
197 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s2;
198 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s1;
199 static int hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s0;
200 static int hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_serving_cell_id;
201 static int hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_coreset_id;
202 static int hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_tci_state_id;
203 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_reserved;
204 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_serving_cell_id;
205 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_bwp_id;
206 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t7;
207 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t6;
208 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t5;
209 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t4;
210 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t3;
211 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t2;
212 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t1;
213 static int hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t0;
214 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_reserved;
215 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_serving_cell_id;
216 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_bwp_id;
217 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_t7;
218 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_t6;
219 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_t5;
220 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_t4;
221 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_t3;
222 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_t2;
223 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_t1;
224 static int hf_mac_nr_control_aper_csi_trigger_state_subselect_t0;
225 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_ad;
226 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_serving_cell_id;
227 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_bwp_id;
228 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved;
229 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_im;
230 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_sp_csi_rs_res_set_id;
231 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved2;
232 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_sp_csi_im_res_set_id;
233 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved3;
234 static int hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_tci_state_id;
235 static int hf_mac_nr_control_dupl_act_deact_drb7;
236 static int hf_mac_nr_control_dupl_act_deact_drb6;
237 static int hf_mac_nr_control_dupl_act_deact_drb5;
238 static int hf_mac_nr_control_dupl_act_deact_drb4;
239 static int hf_mac_nr_control_dupl_act_deact_drb3;
240 static int hf_mac_nr_control_dupl_act_deact_drb2;
241 static int hf_mac_nr_control_dupl_act_deact_drb1;
242 static int hf_mac_nr_control_dupl_act_deact_reserved;
243 static int hf_mac_nr_control_scell_act_deact_cell7;
244 static int hf_mac_nr_control_scell_act_deact_cell6;
245 static int hf_mac_nr_control_scell_act_deact_cell5;
246 static int hf_mac_nr_control_scell_act_deact_cell4;
247 static int hf_mac_nr_control_scell_act_deact_cell3;
248 static int hf_mac_nr_control_scell_act_deact_cell2;
249 static int hf_mac_nr_control_scell_act_deact_cell1;
250 static int hf_mac_nr_control_scell_act_deact_reserved;
251 static int hf_mac_nr_control_scell_act_deact_cell15;
252 static int hf_mac_nr_control_scell_act_deact_cell14;
253 static int hf_mac_nr_control_scell_act_deact_cell13;
254 static int hf_mac_nr_control_scell_act_deact_cell12;
255 static int hf_mac_nr_control_scell_act_deact_cell11;
256 static int hf_mac_nr_control_scell_act_deact_cell10;
257 static int hf_mac_nr_control_scell_act_deact_cell9;
258 static int hf_mac_nr_control_scell_act_deact_cell8;
259 static int hf_mac_nr_control_scell_act_deact_cell23;
260 static int hf_mac_nr_control_scell_act_deact_cell22;
261 static int hf_mac_nr_control_scell_act_deact_cell21;
262 static int hf_mac_nr_control_scell_act_deact_cell20;
263 static int hf_mac_nr_control_scell_act_deact_cell19;
264 static int hf_mac_nr_control_scell_act_deact_cell18;
265 static int hf_mac_nr_control_scell_act_deact_cell17;
266 static int hf_mac_nr_control_scell_act_deact_cell16;
267 static int hf_mac_nr_control_scell_act_deact_cell31;
268 static int hf_mac_nr_control_scell_act_deact_cell30;
269 static int hf_mac_nr_control_scell_act_deact_cell29;
270 static int hf_mac_nr_control_scell_act_deact_cell28;
271 static int hf_mac_nr_control_scell_act_deact_cell27;
272 static int hf_mac_nr_control_scell_act_deact_cell26;
273 static int hf_mac_nr_control_scell_act_deact_cell25;
274 static int hf_mac_nr_control_scell_act_deact_cell24;
275 static int hf_mac_nr_control_bsr_short_lcg;
276 static int hf_mac_nr_control_bsr_short_bs_lcg0;
277 static int hf_mac_nr_control_bsr_short_bs_lcg1;
278 static int hf_mac_nr_control_bsr_short_bs_lcg2;
279 static int hf_mac_nr_control_bsr_short_bs_lcg3;
280 static int hf_mac_nr_control_bsr_short_bs_lcg4;
281 static int hf_mac_nr_control_bsr_short_bs_lcg5;
282 static int hf_mac_nr_control_bsr_short_bs_lcg6;
283 static int hf_mac_nr_control_bsr_short_bs_lcg7;
284 static int hf_mac_nr_control_bsr_long_lcg7;
285 static int hf_mac_nr_control_bsr_long_lcg6;
286 static int hf_mac_nr_control_bsr_long_lcg5;
287 static int hf_mac_nr_control_bsr_long_lcg4;
288 static int hf_mac_nr_control_bsr_long_lcg3;
289 static int hf_mac_nr_control_bsr_long_lcg2;
290 static int hf_mac_nr_control_bsr_long_lcg1;
291 static int hf_mac_nr_control_bsr_long_lcg0;
292 static int hf_mac_nr_control_bsr_trunc_long_bs;
293 static int hf_mac_nr_control_bsr_long_bs_lcg0;
294 static int hf_mac_nr_control_bsr_long_bs_lcg1;
295 static int hf_mac_nr_control_bsr_long_bs_lcg2;
296 static int hf_mac_nr_control_bsr_long_bs_lcg3;
297 static int hf_mac_nr_control_bsr_long_bs_lcg4;
298 static int hf_mac_nr_control_bsr_long_bs_lcg5;
299 static int hf_mac_nr_control_bsr_long_bs_lcg6;
300 static int hf_mac_nr_control_bsr_long_bs_lcg7;
301 static int hf_mac_nr_control_timing_advance_report_reserved;
302 static int hf_mac_nr_control_timing_advance_report_ta;
304 static int hf_mac_nr_rar;
305 static int hf_mac_nr_rar_subheader;
306 static int hf_mac_nr_rar_e;
307 static int hf_mac_nr_rar_t;
308 static int hf_mac_nr_rar_reserved;
309 static int hf_mac_nr_rar_reserved1;
311 static int hf_mac_nr_rar_bi;
312 static int hf_mac_nr_rar_rapid;
313 static int hf_mac_nr_rar_ta;
314 static int hf_mac_nr_rar_grant;
315 static int hf_mac_nr_rar_grant_hopping;
316 static int hf_mac_nr_rar_grant_fra;
317 static int hf_mac_nr_rar_grant_tsa;
318 static int hf_mac_nr_rar_grant_mcs;
319 static int hf_mac_nr_rar_grant_tcsp;
320 static int hf_mac_nr_rar_grant_csi;
322 static int hf_mac_nr_rar_temp_crnti;
324 static int hf_mac_nr_msgb;
325 static int hf_mac_nr_msgb_subheader;
326 static int hf_mac_nr_msgb_e;
327 static int hf_mac_nr_msgb_t1;
328 static int hf_mac_nr_msgb_t2;
329 static int hf_mac_nr_msgb_s;
330 static int hf_mac_nr_msgb_reserved;
331 static int hf_mac_nr_msgb_reserved2;
332 static int hf_mac_nr_msgb_reserved3;
333 static int hf_mac_nr_msgb_ta_command;
334 static int hf_mac_nr_msgb_channelaccess_cpext;
335 static int hf_mac_nr_msgb_tpc;
336 static int hf_mac_nr_msgb_harq_feedback_timing_indicator;
337 static int hf_mac_nr_msgb_pucch_resource_indicator;
339 static int hf_mac_nr_padding;
341 static int hf_mac_nr_differential_koffset;
342 static int hf_mac_nr_differential_koffset_reserved;
343 /* Subtrees. */
344 static int ett_mac_nr;
345 static int ett_mac_nr_context;
346 static int ett_mac_nr_subheader;
347 static int ett_mac_nr_rar_subheader;
348 static int ett_mac_nr_rar_grant;
349 static int ett_mac_nr_me_phr_entry;
351 static expert_field ei_mac_nr_no_per_frame_data;
352 static expert_field ei_mac_nr_sdu_length_different_from_dissected;
353 static expert_field ei_mac_nr_unknown_udp_framing_tag;
354 static expert_field ei_mac_nr_dl_sch_control_subheader_after_data_subheader;
355 static expert_field ei_mac_nr_ul_sch_control_subheader_before_data_subheader;
358 static dissector_handle_t nr_rrc_bcch_bch_handle;
359 static dissector_handle_t nr_rrc_bcch_dl_sch_handle;
360 static dissector_handle_t nr_rrc_pcch_handle;
361 static dissector_handle_t nr_rrc_dl_ccch_handle;
362 static dissector_handle_t nr_rrc_ul_ccch_handle;
363 static dissector_handle_t nr_rrc_ul_ccch1_handle;
366 /**************************************************************************/
367 /* Preferences state */
368 /**************************************************************************/
370 /* By default try to decode transparent data (BCCH, PCCH and CCCH) data using NR RRC dissector */
371 static bool global_mac_nr_attempt_rrc_decode = true;
373 /* Whether should attempt to decode lcid 1-3 SDUs as srb1-3 (i.e. AM RLC) */
374 static bool global_mac_nr_attempt_srb_decode = true;
376 /* Which layer info to show in the info column */
377 enum layer_to_show {
378 ShowPHYLayer, ShowMACLayer, ShowRLCLayer
381 /* Which layer's details to show in Info column */
382 static int global_mac_nr_layer_to_show = (int)ShowRLCLayer;
385 /***********************************************************************/
386 /* How to dissect lcid 3-32 (presume drb logical channels) */
388 /* Where to take LCID -> DRB mappings from */
389 enum lcid_drb_source {
390 FromStaticTable, FromConfigurationProtocol
392 static int global_mac_nr_lcid_drb_source = (int)FromStaticTable;
395 static const value_string drb_lcid_vals[] = {
396 { 3, "LCID 3"},
397 { 4, "LCID 4"},
398 { 5, "LCID 5"},
399 { 6, "LCID 6"},
400 { 7, "LCID 7"},
401 { 8, "LCID 8"},
402 { 9, "LCID 9"},
403 { 10, "LCID 10"},
404 { 11, "LCID 11"},
405 { 12, "LCID 12"},
406 { 13, "LCID 13"},
407 { 14, "LCID 14"},
408 { 15, "LCID 15"},
409 { 16, "LCID 16"},
410 { 17, "LCID 17"},
411 { 18, "LCID 18"},
412 { 19, "LCID 19"},
413 { 20, "LCID 20"},
414 { 21, "LCID 21"},
415 { 22, "LCID 22"},
416 { 23, "LCID 23"},
417 { 24, "LCID 24"},
418 { 25, "LCID 25"},
419 { 26, "LCID 26"},
420 { 27, "LCID 27"},
421 { 28, "LCID 28"},
422 { 29, "LCID 29"},
423 { 30, "LCID 30"},
424 { 31, "LCID 31"},
425 { 32, "LCID 32"},
426 { 0, NULL }
429 /* N.B. for now, only doing static config, and assume channel has same SN length in both directions */
430 typedef enum rlc_bearer_type_t {
431 rlcRaw,
432 rlcTM,
433 rlcUM6,
434 rlcUM12,
435 rlcAM12,
436 rlcAM18
437 } rlc_bearer_type_t;
439 static const value_string rlc_bearer_type_vals[] = {
440 { rlcTM , "TM"},
441 { rlcUM6 , "UM, SN Len=6"},
442 { rlcUM12 , "UM, SN Len=12"},
443 { rlcAM12 , "AM, SN Len=12"},
444 { rlcAM18 , "AM, SN Len=18"},
445 { 0, NULL }
449 /* Mapping type */
450 typedef struct lcid_drb_mapping_t {
451 uint32_t lcid;
452 uint32_t drbid;
453 rlc_bearer_type_t bearer_type_ul;
454 rlc_bearer_type_t bearer_type_dl;
455 } lcid_drb_mapping_t;
457 /* Mapping entity */
458 static lcid_drb_mapping_t *lcid_drb_mappings;
459 static unsigned num_lcid_drb_mappings;
461 UAT_VS_DEF(lcid_drb_mappings, lcid, lcid_drb_mapping_t, uint8_t, 3, "LCID 3")
462 UAT_DEC_CB_DEF(lcid_drb_mappings, drbid, lcid_drb_mapping_t)
463 UAT_VS_DEF(lcid_drb_mappings, bearer_type_ul, lcid_drb_mapping_t, rlc_bearer_type_t, rlcAM12, "AM")
464 UAT_VS_DEF(lcid_drb_mappings, bearer_type_dl, lcid_drb_mapping_t, rlc_bearer_type_t, rlcAM12, "AM")
466 /* UAT object */
467 static uat_t* lcid_drb_mappings_uat;
469 /* Dynamic mappings (set by configuration protocol)
470 LCID is the index into the array of these */
471 typedef struct dynamic_lcid_drb_mapping_t {
472 bool valid;
473 int drbid;
474 rlc_bearer_type_t bearer_type_ul;
475 rlc_bearer_type_t bearer_type_dl;
476 uint8_t ul_priority; // N.B. not yet in rlc_nr_info
477 } dynamic_lcid_drb_mapping_t;
479 typedef struct ue_dynamic_drb_mappings_t {
480 bool srb3_set;
481 bool srb4_set;
482 dynamic_lcid_drb_mapping_t mapping[33]; /* Index is LCID (3-32) */
483 uint8_t drb_to_lcid_mappings[33]; /* Also map drbid -> lcid (1-32) */
484 } ue_dynamic_drb_mappings_t;
486 /* ueId -> ue_dynamic_drb_mappings_t* */
487 static GHashTable *mac_nr_ue_bearers_hash;
492 /* When showing RLC info, count PDUs so can append info column properly */
493 static uint8_t s_number_of_rlc_pdus_shown;
496 extern int proto_rlc_nr;
499 /* Constants and value strings */
501 static const value_string radio_type_vals[] =
503 { FDD_RADIO, "FDD"},
504 { TDD_RADIO, "TDD"},
505 { 0, NULL }
508 static const value_string direction_vals[] =
510 { DIRECTION_UPLINK, "Uplink"},
511 { DIRECTION_DOWNLINK, "Downlink"},
512 { 0, NULL }
515 static const value_string rnti_type_vals[] =
517 { NO_RNTI, "NO-RNTI"},
518 { P_RNTI, "P-RNTI"},
519 { RA_RNTI, "RA-RNTI"},
520 { C_RNTI, "C-RNTI"},
521 { SI_RNTI, "SI-RNTI"},
522 { CS_RNTI, "CS-RNTI"},
523 { MSGB_RNTI, "MSGB-RNTI"},
524 { 0, NULL }
527 static const value_string bcch_transport_channel_vals[] =
529 { SI_RNTI, "DL-SCH"},
530 { NO_RNTI, "BCH"},
531 { 0, NULL }
534 #define CCCH_LCID 0
535 #define TWO_OCTET_ELCID_FIELD 33
536 #define ONE_OCTET_ELCID_FIELD 34
537 #define RECOMMENDED_BIT_RATE_LCID 47
538 #define SP_ZP_CSI_RS_RESOURCE_SET_ACT_DEACT_LCID 48
539 #define PUCCH_SPATIAL_REL_ACT_DEACT_LCID 49
540 #define SP_SRS_ACT_DEACT_LCID 50
541 #define SP_CSI_REPORT_ON_PUCCH_ACT_DEACT_LCID 51
542 #define TCI_STATE_IND_FOR_UE_SPEC_PDCCH_LCID 52
543 #define TCI_STATES_ACT_DEACT_FOR_UE_SPEC_PDSCH_LCID 53
544 #define APER_CSI_TRIGGER_STATE_SUBSELECT_LCID 54
545 #define SP_CSI_RS_CSI_IM_RES_SET_ACT_DEACT_LCID 55
546 #define DUPLICATION_ACTIVATION_DEACTIVATION_LCID 56
547 #define SCELL_ACTIVATION_DEACTIVATION_4_LCID 57
548 #define SCELL_ACTIVATION_DEACTIVATION_1_LCID 58
549 #define LONG_DRX_COMMAND_LCID 59
550 #define DRX_COMMAND_LCID 60
551 #define TIMING_ADVANCE_COMMAND_LCID 61
552 #define UE_CONTENTION_RESOLUTION_IDENTITY_LCID 62
553 #define PADDING_LCID 63
555 static const value_string dlsch_lcid_vals[] =
557 { CCCH_LCID, "CCCH"},
558 { 1, "1"},
559 { 2, "2"},
560 { 3, "3"},
561 { 4, "4"},
562 { 5, "5"},
563 { 6, "6"},
564 { 7, "7"},
565 { 8, "8"},
566 { 9, "9"},
567 { 10, "10"},
568 { 11, "11"},
569 { 12, "12"},
570 { 13, "13"},
571 { 14, "14"},
572 { 15, "15"},
573 { 16, "16"},
574 { 17, "17"},
575 { 18, "18"},
576 { 19, "19"},
577 { 20, "20"},
578 { 21, "21"},
579 { 22, "22"},
580 { 23, "23"},
581 { 24, "24"},
582 { 25, "25"},
583 { 26, "26"},
584 { 27, "27"},
585 { 28, "28"},
586 { 29, "29"},
587 { 30, "30"},
588 { 31, "31"},
589 { 32, "32"},
590 { 33, "Extended logical channel ID field(two octet eLCID field)"},
591 { 34, "Extended logical channel ID field(one octet eLCID field)"},
592 { 35, "Reserved"},
593 { 36, "Reserved"},
594 { 37, "Reserved"},
595 { 38, "Reserved"},
596 { 39, "Reserved"},
597 { 40, "Reserved"},
598 { 41, "Reserved"},
599 { 42, "Reserved"},
600 { 43, "Reserved"},
601 { 44, "Reserved"},
602 { 45, "Reserved"},
603 { 46, "Reserved"},
604 { RECOMMENDED_BIT_RATE_LCID, "Recommended Bit Rate"},
605 { SP_ZP_CSI_RS_RESOURCE_SET_ACT_DEACT_LCID, "SP ZP CSI-RS Resource Set Activation/Deactivation"},
606 { PUCCH_SPATIAL_REL_ACT_DEACT_LCID, "PUCCH spatial relation Activation/Deactivation"},
607 { SP_SRS_ACT_DEACT_LCID, "SP SRS Activation/Deactivation"},
608 { SP_CSI_REPORT_ON_PUCCH_ACT_DEACT_LCID, "SP CSI reporting on PUCCH Activation/Deactivation"},
609 { TCI_STATE_IND_FOR_UE_SPEC_PDCCH_LCID, "TCI State Indication for UE-specific PDCCH"},
610 { TCI_STATES_ACT_DEACT_FOR_UE_SPEC_PDSCH_LCID, "TCI States Activation/Deactivation for UE-specific PDSCH"},
611 { APER_CSI_TRIGGER_STATE_SUBSELECT_LCID, "Aperiodic CSI Trigger State Subselection"},
612 { SP_CSI_RS_CSI_IM_RES_SET_ACT_DEACT_LCID, "SP CSI-RS / CSI-IM Resource Set Activation/Deactivation"},
613 { DUPLICATION_ACTIVATION_DEACTIVATION_LCID, "Duplication Activation/Deactivation"},
614 { SCELL_ACTIVATION_DEACTIVATION_4_LCID, "SCell Activation/Deactivation (4 octet)"},
615 { SCELL_ACTIVATION_DEACTIVATION_1_LCID, "SCell Activation/Deactivation (1 octet)"},
616 { LONG_DRX_COMMAND_LCID, "Long DRX Command"},
617 { DRX_COMMAND_LCID, "DRX Command"},
618 { TIMING_ADVANCE_COMMAND_LCID, "Timing Advance Command"},
619 { UE_CONTENTION_RESOLUTION_IDENTITY_LCID, "UE Contention Resolution Identity"},
620 { PADDING_LCID, "Padding"},
621 { 0, NULL }
623 static value_string_ext dlsch_lcid_vals_ext = VALUE_STRING_EXT_INIT(dlsch_lcid_vals);
625 /* TODO: not all LCIDs handled yet */
626 #define TRUNCATED_ENHANCED_BFR_LCID 43
627 #define TIMING_ADVANCE_REPORT_LCID 44
628 #define TRUNCATED_SIDELINK_BSR_LCID 45
629 #define SIDELINK_BSR_LCID 46
630 #define RESERVED_47_LCID 47
631 #define LBT_FAILURE_4_OCTETS_LCID 48
632 #define LBT_FAILURE_1_OCTET_LCID 49
633 #define BFR_LCID 50
634 #define TRUNCATED_BFR_LCID 51
635 #define CCCH_48_BITS_LCID 52
636 #define RECOMMENDED_BIT_RATE_QUERY_LCID 53
637 #define MULTIPLE_ENTRY_PHR_4_LCID 54
638 #define CONFIGURED_GRANT_CONFIGURATION_LCID 55
639 #define MULTIPLE_ENTRY_PHR_1_LCID 56
640 #define SINGLE_ENTRY_PHR_LCID 57
641 #define C_RNTI_LCID 58
642 #define SHORT_TRUNCATED_BSR_LCID 59
643 #define LONG_TRUNCATED_BSR_LCID 60
644 #define SHORT_BSR_LCID 61
645 #define LONG_BSR_LCID 62
647 /* Table 6.2.1-1b Values of one-octet eLCID for DL-SCH */
649 #define SERVING_CELL_SET_BASED_SRS_TCI_STATE_INDICATIONS_ELCD 227
650 #define SP_AP_SRS_TCI_STATE_INDICATION_ELCD 228
651 #define BFD_RS_INDICATION_ELCD 229
652 #define DIFFERENTIAL_KOFFSET_ELCD 230
653 #define ENHANCED_SCELL_ACTIVATION_DEACTIVATION_MAC_CE_WITH_ONE_OCTET_CI_FIELD_ELCD 231
654 #define ENHANCED_SCELL_ACTIVATION_DEACTIVATION_MAC_CE_WITH_FOUR_OCTET_CI_FIELD_ELCD 232
655 #define UNIFIED_TCI_STATES_ACTIVATION_DEACTIVATION_ELCD 233
656 #define PUCCH_POWER_CONTROL_SET_UPDATE_FOR_MULTIPLE_TRP_PUCCH_REPETITION__ELCD 234
657 #define PUCCH_SPATIAL_RELATION_ACTIVATION_DEACTIVATION_FOR_MULTIPLE_TRP_PUCCH_REPETITION_ELCD 235
658 #define ENHANCED_TCI_STATES_INDICATION_FOR_UE_SPECIFIC_PDCCH_ELCD 236
659 #define POSITIONING_MEASUREMENT_GAP_ACTIVATION_DEACTIVATION_COMMAND_ELCD 237
660 #define PPW_ACTIVATION_DEACTIVATION_COMMAND_ELCD 238
661 #define DL_TX_POWER_ADJUSTMENT_ELCD 239
662 #define TIMING_CASE_INDICATION_ELCD 240
663 #define CHILD_IAB_DU_RESTRICTED_BEAM_INDICATION_ELCD 241
664 #define CASE_7_TIMING_ADVANCE_OFFSET_ELCD 242
665 #define PROVIDED_GUARD_SYMBOLS_FOR_CASE_6_TIMING_ELCD 243
666 #define PROVIDED_GUARD_SYMBOLS_FOR_CASE_7_TIMING_ELCD 244
667 #define SERVING_CELL_SET_BASED_SRS_SPATIAL_RELATION_INDICATION_ELCD 245
668 #define PUSCH_PATHLOSS_REFERENCE_RS_UPDATE_ELCD 246
669 #define SRS_PATHLOSS_REFERENCE_RS_UPDATE_ELCD 247
670 #define ENHANCED_SP_AP_SRS_SPATIAL_RELATION_INDICATION_ELCD 248
671 #define ENHANCED_PUCCH_SPATIAL_RELATION_ACTIVATION_DEACTIVATION_ELCD 249
672 #define ENHANCED_TCI_STATES_ACTIVATION_DEACTIVATION_FOR_UE_SPECIFIC_PDSCH_ELCD 250
673 #define DUPLICATION_RLC_ACTIVATION_DEACTIVATION_ELCD 251
674 #define ABSOLUTE_TIMING_ADVANCE_COMMAND_ELCD 252
675 #define SP_POSITIONING_SRS_ACTIVATION_DEACTIVATION_ELCD 253
676 #define PROVIDED_GUARD_SYMBOLS_ELCD 254
677 #define TIMING_DELTA_ELCD 255
679 static const value_string dlsch_elcid_vals[] =
681 //0 to 226 64 to 290 Reserved
682 { 227, "Serving Cell Set based SRS TCI State Indication"},
683 { 228, "SP/AP SRS TCI State Indication"},
684 { 229, "BFD-RS Indication"},
685 { 230, "Differential Koffset"},
686 { 231, "Enhanced SCell Activation/Deactivation with one octet Ci field"},
687 { 232, "Enhanced SCell Activation/Deactivation with four octet Ci field"},
688 { 233, "Unified TCI States Activation/Deactivation"},
689 { 234, "PUCCH Power Control Set Update for multiple TRP PUCCH repetition"},
690 { 235, "PUCCH spatial relation Activation/Deactivation for multiple TRP PUCCH repetition"},
691 { 236, "Enhanced TCI States Indication for UE-specific PDCCH"},
692 { 237, "Positioning Measurement Gap Activation/Deactivation Command"},
693 { 238, "PPW Activation/Deactivation Command"},
694 { 239, "DL Tx Power Adjustment"},
695 { 240, "Timing Case Indication"},
696 { 241, "Child IAB-DU Restricted Beam Indication"},
697 { 242, "Case-7 Timing advance offset"},
698 { 243, "Provided Guard Symbols for Case-6 timing"},
699 { 244, "Provided Guard Symbols for Case-7 timing"},
700 { 245, "Serving Cell Set based SRS Spatial Relation Indication"},
701 { 246, "PUSCH Pathloss Reference RS Update"},
702 { 247, "SRS Pathloss Reference RS Update"},
703 { 248, "Enhanced SP/AP SRS Spatial Relation Indication"},
704 { 249, "Enhanced PUCCH Spatial Relation Activation/Deactivation"},
705 { 250, "Enhanced TCI States Activation/Deactivation for UE-specific PDSCH"},
706 { 251, "Duplication RLC Activation/Deactivation"},
707 { 252, "Absolute Timing Advance Command"},
708 { 253, "SP Positioning SRS Activation/Deactivation"},
709 { 254, "Provided Guard Symbols"},
710 { 255, "Timing Delta"},
711 { 0, NULL }
713 static value_string_ext dlsch_elcid_vals_ext = VALUE_STRING_EXT_INIT(dlsch_elcid_vals);
715 static const value_string ulsch_lcid_vals[] =
717 { CCCH_LCID, "CCCH (64 bits)"},
718 { 1, "1"},
719 { 2, "2"},
720 { 3, "3"},
721 { 4, "4"},
722 { 5, "5"},
723 { 6, "6"},
724 { 7, "7"},
725 { 8, "8"},
726 { 9, "9"},
727 { 10, "10"},
728 { 11, "11"},
729 { 12, "12"},
730 { 13, "13"},
731 { 14, "14"},
732 { 15, "15"},
733 { 16, "16"},
734 { 17, "17"},
735 { 18, "18"},
736 { 19, "19"},
737 { 20, "20"},
738 { 21, "21"},
739 { 22, "22"},
740 { 23, "23"},
741 { 24, "24"},
742 { 25, "25"},
743 { 26, "26"},
744 { 27, "27"},
745 { 28, "28"},
746 { 29, "29"},
747 { 30, "30"},
748 { 31, "31"},
749 { 32, "32"},
750 { 33, "Extended logical channel ID field(two-octet eLCID field)"},
751 { 34, "Extended logical channel ID field(one-octet eLCID field)"},
752 { 35, "CCCH of size 48 bits(referred to as 'CCCH' in TS 38.331[5]) for a RedCap UE"},
753 { 36, "CCCH of size 64 bits(referred to as 'CCCH1' in TS 38.331[5]) for a RedCap UE"},
754 { 37, "Reserved"},
755 { 38, "Reserved"},
756 { 39, "Reserved"},
757 { 40, "Reserved"},
758 { 41, "Reserved"},
759 { 42, "Reserved"},
760 { TRUNCATED_ENHANCED_BFR_LCID, "Truncated Enhanced BFR"}, // 43
761 { TIMING_ADVANCE_REPORT_LCID, "Timing Advance Report"}, // 44
762 { TRUNCATED_SIDELINK_BSR_LCID, "Truncated Sidelink BSR"}, // 45
763 { SIDELINK_BSR_LCID, "Sidelink BSR"}, // 46
764 { RESERVED_47_LCID, "Reserved"}, // 47
765 { LBT_FAILURE_4_OCTETS_LCID, "LBT Failure 4 octets"}, // 48
766 { LBT_FAILURE_1_OCTET_LCID, "LBT Failure 1 octet"}, // 49
767 { BFR_LCID, "BFR"}, // 50
768 { TRUNCATED_BFR_LCID, "Truncated BFR"}, // 51
769 { CCCH_48_BITS_LCID, "CCCH (48 bits)"}, // 52
770 { RECOMMENDED_BIT_RATE_QUERY_LCID, "Recommended Bit Rate Query"}, // 53
771 { MULTIPLE_ENTRY_PHR_4_LCID, "Multiple Entry PHR (4 octet C)"}, // 54
772 { CONFIGURED_GRANT_CONFIGURATION_LCID, "Configured Grant Confirmation"}, // 55
773 { MULTIPLE_ENTRY_PHR_1_LCID, "Multiple Entry PHR (1 octet C)"}, // 56
774 { SINGLE_ENTRY_PHR_LCID, "Single Entry PHR"}, // 57
775 { C_RNTI_LCID, "C-RNTI"}, // 58
776 { SHORT_TRUNCATED_BSR_LCID, "Short Truncated BSR"}, // 59
777 { LONG_TRUNCATED_BSR_LCID, "Long Truncated BSR"}, // 60
778 { SHORT_BSR_LCID, "Short BSR"}, // 61
779 { LONG_BSR_LCID, "Long BSR"}, // 62
780 { PADDING_LCID, "Padding"}, // 63
781 { 0, NULL }
783 static value_string_ext ulsch_lcid_vals_ext = VALUE_STRING_EXT_INIT(ulsch_lcid_vals);
785 #define ENHANCED_MULTIPLE_ENTRY_PHR_FOR_MULTIPLE_TRP_FOUR_OCTETS_CI 229
786 #define ENHANCED_MULTIPLE_ENTRY_PHR_FOR_MULTIPLE_TRP_ONE_OCTETS_CI 230
787 #define ENHANCED_SINGLE_ENTRY_PHR_FOR_MULTIPLE_TRP 231
788 #define ENHANCED_MULTIPLE_ENTRY_PHR_FOUR_OCTETS_CI 232
789 #define ENHANCED_MULTIPLE_ENTRY_PHR_ONE_OCTETS_CI 233
790 #define ENHANCED_SINGLE_ENTRY_PHR 234
791 #define ENHANCED_BFR_ONE_OCTET_CI 235
792 #define ENHANCED_BFR_FOUR_OCTET_CI 236
793 #define TRUNCATED_ENHANCED_BFR_FOUR_OCTET_CI 237
794 #define POSITIONING_MEASUREMENT_GAP_ACTIVATION_DEACTIVATION_REQUEST 238
795 #define IAB_MT_RECOMMENDED_BEAM_INDICATION 239
796 #define DESIRED_IAB_MT_PSD_RANGE 240
797 #define DESIRED_DL_TX_POWER_ADJUSTMENT 241
798 #define CASE_6_TIMING_REQUEST 242
799 #define DESIRED_GUARD_SYMBOLS_FOR_CASE_6_TIMING 243
800 #define DESIRED_GUARD_SYMBOLS_FOR_CASE_7_TIMING 244
801 #define EXTENDED_SHORT_TRUNCATED_BSR 245
802 #define EXTENDED_LONG_TRUNCATED_BSR 246
803 #define EXTENDED_SHORT_BSR 247
804 #define EXTENDED_LONG_BSR 248
805 #define EXTENDED_PRE_EMPTIVE_BSR 249
806 #define BFR_FOUR_OCTETS_CI 250
807 #define TRUNCATED_BFR_FOUR_OCTETS_CI 251
808 #define MULTIPLE_ENTRY_CONFIGURED_GRANT_CONFIRMATION 252
809 #define SIDELINK_CONFIGURED_GRANT_CONFIRMATION 253
810 #define DESIRED_GUARD_SYMBOLS 254
811 #define PRE_EMPTIVE_BSR 255
813 static const value_string ulsch_elcid_vals[] =
815 //Table 6.2.1-2b Values of one-octet eLCID for UL-SCH
816 //Codepoint Index LCID values
817 //0 to 228 64 to 292 Reserved
818 { 229, "Enhanced Multiple Entry PHR for multiple TRP(four octets Ci)"},
819 { 230, "Enhanced Multiple Entry PHR for multiple TRP(one octets Ci)"},
820 { 231, "Enhanced Single Entry PHR for multiple TRP"},
821 { 232, "Enhanced Multiple Entry PHR(four octets Ci)"},
822 { 233, "Enhanced Multiple Entry PHR(one octets Ci)"},
823 { 234, "Enhanced Single Entry PHR"},
824 { 235, "Enhanced BFR(one octet Ci)"},
825 { 236, "Enhanced BFR(four octet Ci)"},
826 { 237, "Truncated Enhanced BFR(four octet Ci)"},
827 { 238, "Positioning Measurement Gap Activation/Deactivation Request"},
828 { 239, "IAB-MT Recommended Beam Indication"},
829 { 240, "Desired IAB-MT PSD range"},
830 { 241, "Desired DL Tx Power Adjustment"},
831 { 242, "Case-6 Timing Request"},
832 { 243, "Desired Guard Symbols for Case 6 timing"},
833 { 244, "Desired Guard Symbols for Case 7 timing"},
834 { 245, "Extended Short Truncated BSR"},
835 { 246, "Extended Long Truncated BSR"},
836 { 247, "Extended Short BSR"},
837 { 248, "Extended Long BSR"},
838 { 249, "Extended Pre-emptive BSR"},
839 { 250, "BFR(four octets Ci)"},
840 { 251, "Truncated BFR(four octets Ci)"},
841 { 252, "Multiple Entry Configured Grant Confirmation"},
842 { 253, "Sidelink Configured Grant Confirmation"},
843 { 254, "Desired Guard Symbols"},
844 { 255, "Pre-emptive BSR"},
845 { 0, NULL }
847 static value_string_ext ulsch_elcid_vals_ext = VALUE_STRING_EXT_INIT(ulsch_elcid_vals);
849 static const true_false_string rar_ext_vals =
851 "Another MAC subPDU follows",
852 "Last MAC subPDU"
855 static const true_false_string rar_type_vals =
857 "RAPID present",
858 "Backoff Indicator present"
861 static const value_string rar_bi_vals[] =
863 { 0, "5ms"},
864 { 1, "10ms"},
865 { 2, "20ms"},
866 { 3, "30ms"},
867 { 4, "40ms"},
868 { 5, "60ms"},
869 { 6, "80ms"},
870 { 7, "120ms"},
871 { 8, "160ms"},
872 { 9, "240ms"},
873 { 10, "320ms"},
874 { 11, "480ms"},
875 { 12, "960ms"},
876 { 13, "1920ms"},
877 { 14, "Reserved"},
878 { 15, "Reserved"},
879 { 0, NULL }
882 static const value_string buffer_size_5bits_vals[] =
884 { 0, "BS = 0"},
885 { 1, "0 < BS <= 10"},
886 { 2, "10 < BS <= 14"},
887 { 3, "14 < BS <= 20"},
888 { 4, "20 < BS <= 28"},
889 { 5, "28 < BS <= 38"},
890 { 6, "38 < BS <= 53"},
891 { 7, "53 < BS <= 74"},
892 { 8, "74 < BS <= 102"},
893 { 9, "102 < BS <= 142"},
894 { 10, "142 < BS <= 198"},
895 { 11, "198 < BS <= 276"},
896 { 12, "276 < BS <= 384"},
897 { 13, "384 < BS <= 535"},
898 { 14, "535 < BS <= 745"},
899 { 15, "745 < BS <= 1038"},
900 { 16, "1038 < BS <= 1446"},
901 { 17, "1446 < BS <= 2014"},
902 { 18, "2014 < BS <= 2806"},
903 { 19, "2806 < BS <= 3909"},
904 { 20, "3909 < BS <= 5446"},
905 { 21, "5446 < BS <= 7587"},
906 { 22, "7587 < BS <= 10570"},
907 { 23, "10570 < BS <= 14726"},
908 { 24, "14726 < BS <= 20516"},
909 { 25, "20516 < BS <= 28581"},
910 { 26, "28581 < BS <= 39818"},
911 { 27, "39818 < BS <= 55474"},
912 { 28, "55474 < BS <= 77284"},
913 { 29, "77284 < BS <= 107669"},
914 { 30, "107669 < BS <= 150000"},
915 { 31, "BS > 150000"},
916 { 0, NULL }
918 static value_string_ext buffer_size_5bits_vals_ext = VALUE_STRING_EXT_INIT(buffer_size_5bits_vals);
921 static const value_string buffer_size_8bits_vals[] =
923 { 0, "BS = 0"},
924 { 1, "0 < BS <= 10"},
925 { 2, "10 < BS <= 11"},
926 { 3, "11 < BS <= 12"},
927 { 4, "12 < BS <= 13"},
928 { 5, "13 < BS <= 14"},
929 { 6, "14 < BS <= 15"},
930 { 7, "15 < BS <= 16"},
931 { 8, "16 < BS <= 17"},
932 { 9, "17 < BS <= 18"},
933 { 10, "18 < BS <= 19"},
934 { 11, "19 < BS <= 20"},
935 { 12, "20 < BS <= 22"},
936 { 13, "22 < BS <= 23"},
937 { 14, "23 < BS <= 25"},
938 { 15, "25 < BS <= 26"},
939 { 16, "26 < BS <= 28"},
940 { 17, "28 < BS <= 30"},
941 { 18, "30 < BS <= 32"},
942 { 19, "32 < BS <= 34"},
943 { 20, "34 < BS <= 36"},
944 { 21, "36 < BS <= 38"},
945 { 22, "38 < BS <= 40"},
946 { 23, "40 < BS <= 43"},
947 { 24, "43 < BS <= 46"},
948 { 25, "46 < BS <= 49"},
949 { 26, "49 < BS <= 52"},
950 { 27, "52 < BS <= 55"},
951 { 28, "52 < BS <= 59"},
952 { 29, "59 < BS <= 62"},
953 { 30, "62 < BS <= 66"},
954 { 31, "66 < BS <= 71"},
955 { 32, "71 < BS <= 75"},
956 { 33, "75 < BS <= 80"},
957 { 34, "80 < BS <= 85"},
958 { 35, "85 < BS <= 91"},
959 { 36, "91 < BS <= 97"},
960 { 37, "97 < BS <= 103"},
961 { 38, "103 < BS <= 110"},
962 { 39, "110 < BS <= 117"},
963 { 40, "117 < BS <= 124"},
964 { 41, "124 < BS <= 132"},
965 { 42, "132 < BS <= 141"},
966 { 43, "141 < BS <= 150"},
967 { 44, "150 < BS <= 160"},
968 { 45, "160 < BS <= 170"},
969 { 46, "170 < BS <= 181"},
970 { 47, "181 < BS <= 193"},
971 { 48, "193 < BS <= 205"},
972 { 49, "205 < BS <= 218"},
973 { 50, "218 < BS <= 233"},
974 { 51, "233 < BS <= 248"},
975 { 52, "248 < BS <= 264"},
976 { 53, "264 < BS <= 281"},
977 { 54, "281 < BS <= 299"},
978 { 55, "299 < BS <= 318"},
979 { 56, "318 < BS <= 339"},
980 { 57, "339 < BS <= 361"},
981 { 58, "361 < BS <= 384"},
982 { 59, "384 < BS <= 409"},
983 { 60, "409 < BS <= 436"},
984 { 61, "436 < BS <= 464"},
985 { 62, "464 < BS <= 494"},
986 { 63, "494 < BS <= 526"},
987 { 64, "526 < BS <= 560"},
988 { 65, "560 < BS <= 597"},
989 { 66, "597 < BS <= 635"},
990 { 67, "635 < BS <= 677"},
991 { 68, "677 < BS <= 720"},
992 { 69, "720 < BS <= 767"},
993 { 70, "767 < BS <= 817"},
994 { 71, "817 < BS <= 870"},
995 { 72, "870 < BS <= 926"},
996 { 73, "926 < BS <= 987"},
997 { 74, "987 < BS <= 1051"},
998 { 75, "1051 < BS <= 1119"},
999 { 76, "1119 < BS <= 1191"},
1000 { 77, "1191 < BS <= 1269"},
1001 { 78, "1269 < BS <= 1351"},
1002 { 79, "1351 < BS <= 1439"},
1003 { 80, "1439 < BS <= 1532"},
1004 { 81, "1532 < BS <= 1631"},
1005 { 82, "1631 < BS <= 1737"},
1006 { 83, "1737 < BS <= 1850"},
1007 { 84, "1850 < BS <= 1970"},
1008 { 85, "1970 < BS <= 2098"},
1009 { 86, "2098 < BS <= 2234"},
1010 { 87, "2234 < BS <= 2379"},
1011 { 88, "2379 < BS <= 2533"},
1012 { 89, "2533 < BS <= 2698"},
1013 { 90, "2698 < BS <= 2873"},
1014 { 91, "2873 < BS <= 3059"},
1015 { 92, "3059 < BS <= 3258"},
1016 { 93, "3258 < BS <= 3469"},
1017 { 94, "3469 < BS <= 3694"},
1018 { 95, "3694 < BS <= 3934"},
1019 { 96, "3934 < BS <= 4189"},
1020 { 97, "4189 < BS <= 4461"},
1021 { 98, "4461 < BS <= 4751"},
1022 { 99, "4751 < BS <= 5059"},
1023 { 100, "5059 < BS <= 5387"},
1024 { 101, "5387 < BS <= 5737"},
1025 { 102, "5737 < BS <= 6109"},
1026 { 103, "6109 < BS <= 6506"},
1027 { 104, "6506 < BS <= 6928"},
1028 { 105, "6928 < BS <= 7378"},
1029 { 106, "7378 < BS <= 7857"},
1030 { 107, "7857 < BS <= 8367"},
1031 { 108, "8367 < BS <= 8910"},
1032 { 109, "8910 < BS <= 9488"},
1033 { 110, "9488 < BS <= 10104"},
1034 { 111, "10104 < BS <= 10760"},
1035 { 112, "10760 < BS <= 11458"},
1036 { 113, "11458 < BS <= 12202"},
1037 { 114, "12202 < BS <= 12994"},
1038 { 115, "12994 < BS <= 13838"},
1039 { 116, "13838 < BS <= 14736"},
1040 { 117, "14736 < BS <= 15692"},
1041 { 118, "15692 < BS <= 16711"},
1042 { 119, "16711 < BS <= 17795"},
1043 { 120, "17795 < BS <= 18951"},
1044 { 121, "18951 < BS <= 20181"},
1045 { 122, "20181 < BS <= 21491"},
1046 { 123, "21491 < BS <= 22885"},
1047 { 124, "22885 < BS <= 24371"},
1048 { 125, "24371 < BS <= 25953"},
1049 { 126, "25953 < BS <= 27638"},
1050 { 127, "27638 < BS <= 29431"},
1051 { 128, "29431 < BS <= 31342"},
1052 { 129, "31342 < BS <= 33376"},
1053 { 130, "33376 < BS <= 35543"},
1054 { 131, "35543 < BS <= 37850"},
1055 { 132, "37850 < BS <= 40307"},
1056 { 133, "40307 < BS <= 42923"},
1057 { 134, "42923 < BS <= 45709"},
1058 { 135, "45709 < BS <= 48676"},
1059 { 136, "48676 < BS <= 51836"},
1060 { 137, "51836 < BS <= 55200"},
1061 { 138, "55200 < BS <= 58784"},
1062 { 139, "58784 < BS <= 62599"},
1063 { 140, "62599 < BS <= 66663"},
1064 { 141, "66663 < BS <= 70990"},
1065 { 142, "70990 < BS <= 75598"},
1066 { 143, "75598 < BS <= 80505"},
1067 { 144, "80505 < BS <= 85730"},
1068 { 145, "85730 < BS <= 91295"},
1069 { 146, "91295 < BS <= 97221"},
1070 { 147, "97221 < BS <= 103532"},
1071 { 148, "103532 < BS <= 110252"},
1072 { 149, "110252 < BS <= 117409"},
1073 { 150, "117409 < BS <= 125030"},
1074 { 151, "125030 < BS <= 133146"},
1075 { 152, "133146 < BS <= 141789"},
1076 { 153, "141789 < BS <= 150992"},
1077 { 154, "150992 < BS <= 160793"},
1078 { 155, "160793 < BS <= 171231"},
1079 { 156, "171231 < BS <= 182345"},
1080 { 157, "182345 < BS <= 194182"},
1081 { 158, "194182 < BS <= 206786"},
1082 { 159, "206786 < BS <= 220209"},
1083 { 160, "220209 < BS <= 234503"},
1084 { 161, "234503 < BS <= 249725"},
1085 { 162, "249725 < BS <= 265935"},
1086 { 163, "265935 < BS <= 283197"},
1087 { 164, "283197 < BS <= 301579"},
1088 { 165, "301579 < BS <= 321155"},
1089 { 166, "321155 < BS <= 342002"},
1090 { 167, "342002 < BS <= 364202"},
1091 { 168, "364202 < BS <= 387842"},
1092 { 169, "387842 < BS <= 413018"},
1093 { 170, "413018 < BS <= 439827"},
1094 { 171, "439827 < BS <= 468377"},
1095 { 172, "468377 < BS <= 498780"},
1096 { 173, "498780 < BS <= 531156"},
1097 { 174, "531156 < BS <= 565634"},
1098 { 175, "565634 < BS <= 602350"},
1099 { 176, "602350 < BS <= 641449"},
1100 { 177, "641449 < BS <= 683087"},
1101 { 178, "683087 < BS <= 727427"},
1102 { 179, "727427 < BS <= 774645"},
1103 { 180, "774645 < BS <= 824928"},
1104 { 181, "824928 < BS <= 878475"},
1105 { 182, "878475 < BS <= 935498"},
1106 { 183, "935498 < BS <= 996222"},
1107 { 184, "996222 < BS <= 1060888"},
1108 { 185, "1060888 < BS <= 1129752"},
1109 { 186, "1129752 < BS <= 1203085"},
1110 { 187, "1203085 < BS <= 1281179"},
1111 { 188, "1281179 < BS <= 1364342"},
1112 { 189, "1364342 < BS <= 1452903"},
1113 { 190, "1452903 < BS <= 1547213"},
1114 { 191, "1547213 < BS <= 1647644"},
1115 { 192, "1647644 < BS <= 1754595"},
1116 { 193, "1754595 < BS <= 1868488"},
1117 { 194, "1868488 < BS <= 1989774"},
1118 { 195, "1989774 < BS <= 2118933"},
1119 { 196, "2118933 < BS <= 2256475"},
1120 { 197, "2256475 < BS <= 2402946"},
1121 { 198, "2402946 < BS <= 2558924"},
1122 { 199, "2558924 < BS <= 2725027"},
1123 { 200, "2725027 < BS <= 2901912"},
1124 { 201, "2901912 < BS <= 3090279"},
1125 { 202, "3090279 < BS <= 3290873"},
1126 { 203, "3290873 < BS <= 3504487"},
1127 { 204, "3504487 < BS <= 3731968"},
1128 { 205, "3731968 < BS <= 3974215"},
1129 { 206, "3974215 < BS <= 4232186"},
1130 { 207, "4232186 < BS <= 4506902"},
1131 { 208, "4506902 < BS <= 4799451"},
1132 { 209, "4799451 < BS <= 5110989"},
1133 { 210, "5110989 < BS <= 5442750"},
1134 { 211, "5442750 < BS <= 5796046"},
1135 { 212, "5796046 < BS <= 6172275"},
1136 { 213, "6172275 < BS <= 6572925"},
1137 { 214, "6572925 < BS <= 6999582"},
1138 { 215, "6999582 < BS <= 7453933"},
1139 { 216, "7453933 < BS <= 7937777"},
1140 { 217, "7937777 < BS <= 8453028"},
1141 { 218, "8453028 < BS <= 9001725"},
1142 { 219, "9001725 < BS <= 9586039"},
1143 { 220, "9586039 < BS <= 10208280"},
1144 { 221, "10208280 < BS <= 10870913"},
1145 { 222, "10870913 < BS <= 11576557"},
1146 { 223, "11576557 < BS <= 12328006"},
1147 { 224, "12328006 < BS <= 13128233"},
1148 { 225, "13128233 < BS <= 13980403"},
1149 { 226, "13980403 < BS <= 14887889"},
1150 { 227, "14887889 < BS <= 15854280"},
1151 { 228, "15854280 < BS <= 16883401"},
1152 { 229, "16883401 < BS <= 17979324"},
1153 { 230, "17979324 < BS <= 19146385"},
1154 { 231, "19146385 < BS <= 20389201"},
1155 { 232, "20389201 < BS <= 21712690"},
1156 { 233, "21712690 < BS <= 23122088"},
1157 { 234, "23122088 < BS <= 24622972"},
1158 { 235, "24622972 < BS <= 26221280"},
1159 { 236, "26221280 < BS <= 27923336"},
1160 { 237, "27923336 < BS <= 29735875"},
1161 { 238, "29735875 < BS <= 31666069"},
1162 { 239, "31666069 < BS <= 33721553"},
1163 { 240, "33721553 < BS <= 35910462"},
1164 { 241, "35910462 < BS <= 38241455"},
1165 { 242, "38241455 < BS <= 40723756"},
1166 { 243, "40723756 < BS <= 43367187"},
1167 { 244, "43367187 < BS <= 46182206"},
1168 { 245, "46182206 < BS <= 49179951"},
1169 { 246, "49179951 < BS <= 52372284"},
1170 { 247, "52372284 < BS <= 55771835"},
1171 { 248, "55771835 < BS <= 59392055"},
1172 { 249, "59392055 < BS <= 63247269"},
1173 { 250, "63247269 < BS <= 67352729"},
1174 { 251, "67352729 < BS <= 71724679"},
1175 { 252, "71724679 < BS <= 76380419"},
1176 { 253, "76380419 < BS <= 81338368"},
1177 { 254, "BS > 81338368"},
1178 { 255, "Reserved"},
1179 { 0, NULL }
1181 static value_string_ext buffer_size_8bits_vals_ext = VALUE_STRING_EXT_INIT(buffer_size_8bits_vals);
1183 static const value_string tpc_command_vals[] =
1185 { 0, "-6dB"},
1186 { 1, "-4dB"},
1187 { 2, "-2dB"},
1188 { 3, "0dB"},
1189 { 4, "2dB"},
1190 { 5, "4dB"},
1191 { 6, "6dB"},
1192 { 7, "8dB"},
1193 { 0, NULL }
1198 static const true_false_string power_backoff_affects_power_management_vals =
1200 "Power backoff is applied to power management",
1201 "Power backoff not applied to power management"
1204 static const true_false_string phr_source_vals =
1206 "PH based on reference format",
1207 "PH based on real transmission",
1210 static const true_false_string activation_deactivation_vals =
1212 "Activation",
1213 "Deactivation"
1216 static const true_false_string c_vals =
1218 "Octets containing Resource Serving Cell ID field(s) and Resource BWP ID field(s) are present",
1219 "Octets containing Resource Serving Cell ID field(s) and Resource BWP ID field(s) are not present"
1222 static const true_false_string sul_vals =
1224 "Applies to the SUL carrier configuration",
1225 "Applies to the NUL carrier configuration"
1228 static const true_false_string sp_srs_act_deact_f_vals =
1230 "NZP CSI-RS resource index is used",
1231 "SSB index or SRS resource index is used"
1234 static const true_false_string aper_csi_trigger_state_t_vals =
1236 "Mapped to the codepoint of the DCI CSI request field",
1237 "Not mapped to the codepoint of the DCI CSI request field"
1240 static const value_string bit_rate_vals[] =
1242 { 0, "no bit rate recommendation"},
1243 { 1, "0 kbit/s"},
1244 { 2, "9 kbit/s"},
1245 { 3, "11 kbit/s"},
1246 { 4, "13 kbit/s"},
1247 { 5, "17 kbit/s"},
1248 { 6, "21 kbit/s"},
1249 { 7, "25 kbit/s"},
1250 { 8, "29 kbit/s"},
1251 { 9, "32 kbit/s"},
1252 { 10, "36 kbit/s"},
1253 { 11, "40 kbit/s"},
1254 { 12, "48 kbit/s"},
1255 { 13, "56 kbit/s"},
1256 { 14, "72 kbit/s"},
1257 { 15, "88 kbit/s"},
1258 { 16, "104 kbit/s"},
1259 { 17, "120 kbit/s"},
1260 { 18, "140 kbit/s"},
1261 { 19, "160 kbit/s"},
1262 { 20, "180 kbit/s"},
1263 { 21, "200 kbit/s"},
1264 { 22, "220 kbit/s"},
1265 { 23, "240 kbit/s"},
1266 { 24, "260 kbit/s"},
1267 { 25, "280 kbit/s"},
1268 { 26, "300 kbit/s"},
1269 { 27, "350 kbit/s"},
1270 { 28, "400 kbit/s"},
1271 { 29, "450 kbit/s"},
1272 { 30, "500 kbit/s"},
1273 { 31, "600 kbit/s"},
1274 { 32, "700 kbit/s"},
1275 { 33, "800 kbit/s"},
1276 { 34, "900 kbit/s"},
1277 { 35, "1000 kbit/s"},
1278 { 36, "1100 kbit/s"},
1279 { 37, "1200 kbit/s"},
1280 { 38, "1300 kbit/s"},
1281 { 39, "1400 kbit/s"},
1282 { 40, "1500 kbit/s"},
1283 { 41, "1750 kbit/s"},
1284 { 42, "2000 kbit/s"},
1285 { 43, "2250 kbit/s"},
1286 { 44, "2500 kbit/s"},
1287 { 45, "2750 kbit/s"},
1288 { 46, "3000 kbit/s"},
1289 { 47, "3500 kbit/s"},
1290 { 48, "4000 kbit/s"},
1291 { 49, "4500 kbit/s"},
1292 { 50, "5000 kbit/s"},
1293 { 51, "5500 kbit/s"},
1294 { 52, "6000 kbit/s"},
1295 { 53, "6500 kbit/s"},
1296 { 54, "7000 kbit/s"},
1297 { 55, "7500 kbit/s"},
1298 { 56, "8000 kbit/s"},
1299 { 0, NULL }
1301 static value_string_ext bit_rate_vals_ext = VALUE_STRING_EXT_INIT(bit_rate_vals);
1304 static const true_false_string msgb_t1_vals = {
1305 "Random Access Preamble ID present",
1306 "T2 is valid"
1309 static const true_false_string msgb_t2_vals = {
1310 "S is valid",
1311 "Backoff Indicator",
1314 static const true_false_string msgb_s_vals = {
1315 "MAC subPDU(s) for MAC SDU present",
1316 "MAC subPDU(s) for MAC SDU *NOT* present"
1320 /* Forward declarations */
1321 static int dissect_mac_nr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*);
1323 static int dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1324 proto_item *pdu_ti, uint32_t offset,
1325 mac_nr_info *p_mac_nr_info,
1326 mac_3gpp_tap_info *tap_info);
1329 /* Write the given formatted text to:
1330 - the info column (if pinfo != NULL)
1331 - 1 or 2 other labels (optional)
1333 static void write_pdu_label_and_info(proto_item *ti1, proto_item *ti2,
1334 packet_info *pinfo, const char *format, ...) G_GNUC_PRINTF(4,5);
1335 static void write_pdu_label_and_info(proto_item *ti1, proto_item *ti2,
1336 packet_info *pinfo, const char *format, ...)
1338 #define MAX_INFO_BUFFER 256
1339 static char info_buffer[MAX_INFO_BUFFER];
1340 va_list ap;
1342 if ((ti1 == NULL) && (ti2 == NULL) && (pinfo == NULL)) {
1343 return;
1346 va_start(ap, format);
1347 vsnprintf(info_buffer, MAX_INFO_BUFFER, format, ap);
1348 va_end(ap);
1350 /* Add to indicated places */
1351 if (pinfo != NULL) {
1352 col_append_str(pinfo->cinfo, COL_INFO, info_buffer);
1354 if (ti1 != NULL) {
1355 proto_item_append_text(ti1, "%s", info_buffer);
1357 if (ti2 != NULL) {
1358 proto_item_append_text(ti2, "%s", info_buffer);
1362 /* Version of function above, where no vsnprintf() call needed */
1363 static void write_pdu_label_and_info_literal(proto_item *ti1, proto_item *ti2,
1364 packet_info *pinfo, const char *info_buffer)
1366 /* Add to indicated places */
1367 if (pinfo != NULL) {
1368 col_append_str(pinfo->cinfo, COL_INFO, info_buffer);
1370 if (ti1 != NULL) {
1371 proto_item_append_text(ti1, "%s", info_buffer);
1373 if (ti2 != NULL) {
1374 proto_item_append_text(ti2, "%s", info_buffer);
1378 static void
1379 call_with_catch_all(dissector_handle_t handle, tvbuff_t* tvb, packet_info *pinfo, proto_tree *tree)
1381 /* Call it (catch exceptions so that stats will be updated) */
1382 if (handle) {
1383 TRY {
1384 call_dissector_only(handle, tvb, pinfo, tree, NULL);
1386 CATCH_ALL {
1388 ENDTRY
1392 /* Dissect BCCH PDU */
1393 static void dissect_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1394 proto_item *pdu_ti,
1395 int offset,
1396 mac_nr_info *p_mac_nr_info,
1397 mac_3gpp_tap_info *tap_info _U_)
1399 proto_item *ti;
1401 write_pdu_label_and_info(pdu_ti, NULL, pinfo,
1402 "BCCH PDU (%u bytes, on %s transport) ",
1403 tvb_reported_length_remaining(tvb, offset),
1404 val_to_str_const(p_mac_nr_info->rntiType,
1405 bcch_transport_channel_vals,
1406 "Unknown"));
1408 /* Show which transport layer it came in on (inferred from RNTI type) */
1409 ti = proto_tree_add_uint(tree, hf_mac_nr_context_bcch_transport_channel,
1410 tvb, offset, 0, p_mac_nr_info->rntiType);
1411 proto_item_set_generated(ti);
1413 /****************************************/
1414 /* Whole frame is BCCH data */
1416 /* Raw data */
1417 ti = proto_tree_add_item(tree, hf_mac_nr_bcch_pdu,
1418 tvb, offset, -1, ENC_NA);
1420 if (global_mac_nr_attempt_rrc_decode) {
1421 /* Attempt to decode payload using NR RRC dissector */
1422 dissector_handle_t protocol_handle;
1423 tvbuff_t *rrc_tvb = tvb_new_subset_remaining(tvb, offset);
1425 if (p_mac_nr_info->rntiType == NO_RNTI) {
1426 protocol_handle = nr_rrc_bcch_bch_handle;
1427 } else {
1428 protocol_handle = nr_rrc_bcch_dl_sch_handle;
1431 /* Hide raw view of bytes */
1432 proto_item_set_hidden(ti);
1434 call_with_catch_all(protocol_handle, rrc_tvb, pinfo, tree);
1438 /* Dissect PCCH PDU */
1439 static void dissect_pcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1440 proto_item *pdu_ti, int offset,
1441 mac_nr_info *p_mac_nr_info _U_,
1442 mac_3gpp_tap_info *tap_info _U_)
1444 proto_item *ti;
1446 write_pdu_label_and_info(pdu_ti, NULL, pinfo,
1447 "PCCH PDU (%u bytes) ",
1448 tvb_reported_length_remaining(tvb, offset));
1450 /****************************************/
1451 /* Whole frame is PCCH data */
1453 /* Always show as raw data */
1454 ti = proto_tree_add_item(tree, hf_mac_nr_pcch_pdu,
1455 tvb, offset, -1, ENC_NA);
1457 // TODO: add to tap_info->number_of_paging_ids. See LTE.
1459 if (global_mac_nr_attempt_rrc_decode) {
1461 /* Attempt to decode payload using NR RRC dissector */
1462 tvbuff_t *rrc_tvb = tvb_new_subset_remaining(tvb, offset);
1464 /* Hide raw view of bytes */
1465 proto_item_set_hidden(ti);
1467 call_with_catch_all(nr_rrc_pcch_handle, rrc_tvb, pinfo, tree);
1472 /* Common to RAR and MSGB */
1473 static int dissect_fallbackrar(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset,
1474 proto_item *ti, proto_item *pdu_ti, uint32_t rapid)
1476 /* 1 reserved bit */
1477 proto_tree_add_item(tree, hf_mac_nr_rar_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
1479 /* TA (12 bits) */
1480 uint32_t ta;
1481 proto_tree_add_item_ret_uint(tree, hf_mac_nr_rar_ta, tvb, offset, 2, ENC_BIG_ENDIAN, &ta);
1482 offset++;
1484 /* Break down the 27-bits of the grant field, according to 38.213, section 8.2 */
1485 static int * const rar_grant_fields[] = {
1486 &hf_mac_nr_rar_grant_hopping,
1487 &hf_mac_nr_rar_grant_fra,
1488 &hf_mac_nr_rar_grant_tsa,
1489 &hf_mac_nr_rar_grant_mcs,
1490 &hf_mac_nr_rar_grant_tcsp,
1491 &hf_mac_nr_rar_grant_csi,
1492 NULL
1494 proto_tree_add_bitmask(tree, tvb, offset, hf_mac_nr_rar_grant,
1495 ett_mac_nr_rar_grant, rar_grant_fields, ENC_BIG_ENDIAN);
1496 offset += 4;
1498 /* C-RNTI (2 bytes) */
1499 uint32_t c_rnti;
1500 proto_tree_add_item_ret_uint(tree, hf_mac_nr_rar_temp_crnti, tvb, offset, 2, ENC_BIG_ENDIAN, &c_rnti);
1501 offset += 2;
1503 write_pdu_label_and_info(pdu_ti, ti, pinfo,
1504 "(RAPID=%u TA=%u Temp C-RNTI=%u) ", rapid, ta, c_rnti);
1506 return offset;
1510 static void dissect_rar(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1511 proto_item *pdu_ti _U_, uint32_t offset,
1512 mac_nr_info *p_mac_nr_info, mac_3gpp_tap_info *tap_info)
1514 write_pdu_label_and_info(pdu_ti, NULL, pinfo,
1515 "RAR (RA-RNTI=%u) ",
1516 p_mac_nr_info->rnti);
1518 /* Create hidden 'virtual root' so can filter on mac-nr.rar */
1519 proto_item *ti = proto_tree_add_item(tree, hf_mac_nr_rar, tvb, offset, -1, ENC_NA);
1520 proto_item_set_hidden(ti);
1522 bool E, T;
1524 do {
1525 /* Subheader */
1526 proto_item *subheader_ti = proto_tree_add_item(tree,
1527 hf_mac_nr_rar_subheader,
1528 tvb, offset, 0, ENC_ASCII);
1529 proto_tree *rar_subheader_tree = proto_item_add_subtree(subheader_ti, ett_mac_nr_rar_subheader);
1531 /* Note extension & T bits */
1532 proto_tree_add_item_ret_boolean(rar_subheader_tree, hf_mac_nr_rar_e, tvb, offset, 1, ENC_BIG_ENDIAN, &E);
1533 proto_tree_add_item_ret_boolean(rar_subheader_tree, hf_mac_nr_rar_t, tvb, offset, 1, ENC_BIG_ENDIAN, &T);
1535 if (!T) {
1536 /* BI */
1538 /* 2 reserved bits */
1539 proto_tree_add_item(rar_subheader_tree, hf_mac_nr_rar_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1541 /* BI (4 bits) */
1542 uint32_t BI;
1543 proto_tree_add_item_ret_uint(rar_subheader_tree, hf_mac_nr_rar_bi, tvb, offset, 1, ENC_BIG_ENDIAN, &BI);
1544 offset++;
1546 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
1547 "(BI=%u) ", BI);
1549 else {
1550 /* RAPID */
1551 uint32_t rapid;
1552 proto_tree_add_item_ret_uint(rar_subheader_tree, hf_mac_nr_rar_rapid, tvb, offset, 1, ENC_BIG_ENDIAN, &rapid);
1553 offset++;
1555 if (true) {
1556 /* SubPDU. Not for SI request - TODO: define RAPID range for SI request in mac_nr_info */
1558 offset = dissect_fallbackrar(rar_subheader_tree, pinfo, tvb, offset, subheader_ti, pdu_ti, rapid);
1560 tap_info->number_of_rars++;
1562 /* Set subheader (+subpdu..) length */
1563 proto_item_set_end(subheader_ti, tvb, offset);
1565 } while (E);
1567 /* Any remaining length is padding */
1568 if (tvb_reported_length_remaining(tvb, offset)) {
1569 proto_tree_add_item(tree, hf_mac_nr_padding, tvb, offset, -1, ENC_NA);
1572 /* Update padding bytes in stats */
1573 tap_info->padding_bytes += (p_mac_nr_info->length - offset);
1576 static void dissect_msgb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1577 proto_item *pdu_ti _U_, uint32_t offset,
1578 mac_nr_info *p_mac_nr_info, mac_3gpp_tap_info *tap_info)
1580 write_pdu_label_and_info(pdu_ti, NULL, pinfo,
1581 "MSGB (MSGB-RNTI=%u) ",
1582 p_mac_nr_info->rnti);
1584 /* Create hidden 'virtual root' so can filter on mac-nr.msgb */
1585 proto_item *ti = proto_tree_add_item(tree, hf_mac_nr_msgb, tvb, offset, -1, ENC_NA);
1586 proto_item_set_hidden(ti);
1588 bool E, T1, T2, S;
1590 /* N.B. T2 only present if T1 is 0 */
1591 /* N.B. T2 indicates BI (can only appear in first subheader */
1593 do {
1594 /* Subheader */
1595 proto_item *subheader_ti = proto_tree_add_item(tree,
1596 hf_mac_nr_msgb_subheader,
1597 tvb, offset, 0, ENC_ASCII);
1598 proto_tree *msgb_subheader_tree = proto_item_add_subtree(subheader_ti, ett_mac_nr_rar_subheader);
1600 /* Note extension & T1, T2 bits */
1601 proto_tree_add_item_ret_boolean(msgb_subheader_tree, hf_mac_nr_msgb_e, tvb, offset, 1, ENC_BIG_ENDIAN, &E);
1602 proto_tree_add_item_ret_boolean(msgb_subheader_tree, hf_mac_nr_msgb_t1, tvb, offset, 1, ENC_BIG_ENDIAN, &T1);
1603 if (!T1) {
1604 /* T2 */
1605 proto_tree_add_item_ret_boolean(msgb_subheader_tree, hf_mac_nr_msgb_t2, tvb, offset, 1, ENC_BIG_ENDIAN, &T2);
1608 if (T1) {
1609 /* RAPID (FallbackRAR MAC subheader) */
1610 uint32_t rapid;
1611 proto_tree_add_item_ret_uint(msgb_subheader_tree, hf_mac_nr_rar_rapid, tvb, offset, 1, ENC_BIG_ENDIAN, &rapid);
1612 offset++;
1614 /* FallbackRAR (see 6.2.3a) */
1615 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "FallbackRAR ");
1616 offset = dissect_fallbackrar(msgb_subheader_tree, pinfo, tvb, offset,
1617 subheader_ti, pdu_ti, rapid);
1619 else if (!T2) {
1620 /* BI */
1621 uint32_t BI;
1623 /* 1 reserved bit */
1624 proto_tree_add_item(msgb_subheader_tree, hf_mac_nr_msgb_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1625 /* BI (4 bits) */
1626 /* N.B., should define & use own BI field? */
1627 proto_tree_add_item_ret_uint(msgb_subheader_tree, hf_mac_nr_rar_bi, tvb, offset, 1, ENC_BIG_ENDIAN, &BI);
1628 offset++;
1630 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
1631 "(BI=%u) ", BI);
1633 else {
1634 /* Read S (MAC SDU Indicator) */
1635 proto_tree_add_item_ret_boolean(msgb_subheader_tree, hf_mac_nr_msgb_s, tvb, offset, 1, ENC_BIG_ENDIAN, &S);
1637 /* 4 reserved bits */
1638 proto_tree_add_item(msgb_subheader_tree, hf_mac_nr_msgb_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN);
1639 offset += 1;
1641 /* successRAR is in 6.2.3a-2 */
1642 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "SuccessRAR ");
1644 /* UE Contention Resolution Identity */
1645 proto_tree_add_item(msgb_subheader_tree, hf_mac_nr_control_ue_contention_resolution_identity,
1646 tvb, offset, 6, ENC_NA);
1647 offset += 6;
1649 /* R (1 bit) */
1650 proto_tree_add_item(msgb_subheader_tree, hf_mac_nr_msgb_reserved3, tvb, offset, 1, ENC_BIG_ENDIAN);
1651 /* ChannelAccess-CPext */
1652 proto_tree_add_item(msgb_subheader_tree, hf_mac_nr_msgb_channelaccess_cpext, tvb, offset, 1, ENC_BIG_ENDIAN);
1653 /* TPC */
1654 proto_tree_add_item(msgb_subheader_tree, hf_mac_nr_msgb_tpc, tvb, offset, 1, ENC_BIG_ENDIAN);
1655 /* HARQ Feedback Timing Indicator */
1656 proto_tree_add_item(msgb_subheader_tree, hf_mac_nr_msgb_harq_feedback_timing_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
1657 offset += 1;
1659 /* PUCCH Resource Indicator */
1660 proto_tree_add_item(msgb_subheader_tree, hf_mac_nr_msgb_pucch_resource_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
1661 /* Timing Advance Command */
1662 uint32_t ta_command;
1663 proto_tree_add_item_ret_uint(msgb_subheader_tree, hf_mac_nr_msgb_ta_command, tvb, offset, 2, ENC_BIG_ENDIAN, &ta_command);
1664 offset += 2;
1666 /* C-RNTI */
1667 uint32_t c_rnti;
1668 proto_tree_add_item_ret_uint(msgb_subheader_tree, hf_mac_nr_rar_temp_crnti, tvb, offset, 2, ENC_BIG_ENDIAN, &c_rnti);
1669 offset += 2;
1671 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
1672 "(C-RNTI=%u, TA=%u) ", c_rnti, ta_command);
1674 if (S) {
1675 /* subPDU(s) for MAC SDU present */
1676 offset = dissect_ulsch_or_dlsch(tvb, pinfo, tree, pdu_ti, offset,
1677 p_mac_nr_info,
1678 tap_info);
1681 /* Set subheader (+subpdu..) length */
1682 proto_item_set_end(subheader_ti, tvb, offset);
1684 } while (E);
1686 /* Any remaining length is padding */
1687 if (tvb_reported_length_remaining(tvb, offset)) {
1688 proto_tree_add_item(tree, hf_mac_nr_padding, tvb, offset, -1, ENC_NA);
1691 /* Update padding bytes in stats */
1692 tap_info->padding_bytes += (p_mac_nr_info->length - offset);
1696 static bool is_fixed_sized_lcid(uint8_t lcid, uint8_t direction)
1698 if (direction == DIRECTION_UPLINK) {
1699 switch (lcid) {
1700 case CCCH_LCID:
1701 case 35: /* RedCap CCCH (48 bits) */
1702 case 36: /* RedCap CCCH1 (64 bits) */
1703 case CCCH_48_BITS_LCID:
1704 case TIMING_ADVANCE_REPORT_LCID:
1705 case RECOMMENDED_BIT_RATE_QUERY_LCID:
1706 case CONFIGURED_GRANT_CONFIGURATION_LCID:
1707 case SINGLE_ENTRY_PHR_LCID:
1708 case C_RNTI_LCID:
1709 case SHORT_TRUNCATED_BSR_LCID:
1710 case SHORT_BSR_LCID:
1711 case PADDING_LCID:
1712 return true;
1713 default:
1714 return false;
1717 else {
1718 switch (lcid) {
1719 case TWO_OCTET_ELCID_FIELD:
1720 case ONE_OCTET_ELCID_FIELD:
1721 case RECOMMENDED_BIT_RATE_LCID:
1722 case SP_ZP_CSI_RS_RESOURCE_SET_ACT_DEACT_LCID:
1723 case PUCCH_SPATIAL_REL_ACT_DEACT_LCID:
1724 case SP_CSI_REPORT_ON_PUCCH_ACT_DEACT_LCID:
1725 case TCI_STATE_IND_FOR_UE_SPEC_PDCCH_LCID:
1726 case DUPLICATION_ACTIVATION_DEACTIVATION_LCID:
1727 case SCELL_ACTIVATION_DEACTIVATION_4_LCID:
1728 case SCELL_ACTIVATION_DEACTIVATION_1_LCID:
1729 case LONG_DRX_COMMAND_LCID:
1730 case DRX_COMMAND_LCID:
1731 case TIMING_ADVANCE_COMMAND_LCID:
1732 case UE_CONTENTION_RESOLUTION_IDENTITY_LCID:
1733 case PADDING_LCID:
1734 return true;
1735 default:
1736 return false;
1741 static bool is_fixed_sized_elcid(uint8_t elcid, uint8_t direction)
1743 if (direction == DIRECTION_UPLINK) {
1744 switch (elcid) {
1745 case ENHANCED_SINGLE_ENTRY_PHR_FOR_MULTIPLE_TRP:
1746 /* Enhanced Single Entry PHR for multiple TRP */
1747 case POSITIONING_MEASUREMENT_GAP_ACTIVATION_DEACTIVATION_REQUEST:
1748 /* Positioning Measurement Gap Activation/Deactivation Request */
1749 case CASE_6_TIMING_REQUEST:
1750 /* Case-6 Timing Request */
1751 case DESIRED_GUARD_SYMBOLS_FOR_CASE_6_TIMING:
1752 /* Desired Guard Symbols for Case 6 timing */
1753 case DESIRED_GUARD_SYMBOLS_FOR_CASE_7_TIMING:
1754 /* Desired Guard Symbols for Case 7 timing*/
1755 case EXTENDED_SHORT_TRUNCATED_BSR:
1756 /* Extended Short Truncated BSR */
1757 case EXTENDED_SHORT_BSR:
1758 /* Extended Short BSR */
1759 case MULTIPLE_ENTRY_CONFIGURED_GRANT_CONFIRMATION:
1760 /* Multiple Entry Configured Grant Confirmation 4 octets*/
1761 case SIDELINK_CONFIGURED_GRANT_CONFIRMATION:
1762 /* Sidelink Configured Grant Confirmation 1 oct*/
1763 case DESIRED_GUARD_SYMBOLS:
1764 /* Desired Guard Symbols 3 oct*/
1765 return true;
1766 default:
1767 /* Enhanced Multiple Entry PHR for multiple TRP (one octets Ci) */
1768 /* 234 Enhanced Single Entry PHR*/
1769 /* 235 Enhanced BFR (one octet Ci) */
1770 /* 236 Enhanced BFR (four octet Ci) */
1771 /* 237 Truncated Enhanced BFR(four octet Ci) */
1772 /* 239 IAB-MT Recommended Beam Indication */
1773 /* 240 Desired IAB-MT PSD range */
1774 /* 241 Desired DL Tx Power Adjustment */
1775 /* 246 Extended Long Truncated BSR */
1776 /* 248 Extended Long BSR */
1777 /* 249 Extended Pre-emptive BSR */
1778 /* 250 BFR (four octets Ci) */
1779 /* 251 Truncated BFR (four octets Ci)*/
1780 /* 255 Pre-emptive BSR */
1781 return false;
1784 else {
1785 switch (elcid) {
1786 case DIFFERENTIAL_KOFFSET_ELCD:
1787 /* Differential Koffset, 6bits(1 oct)*/
1788 case ENHANCED_TCI_STATES_INDICATION_FOR_UE_SPECIFIC_PDCCH_ELCD:
1789 /* Enhanced TCI States Indication for UE-specific PDCCH 3 oct*/
1790 case POSITIONING_MEASUREMENT_GAP_ACTIVATION_DEACTIVATION_COMMAND_ELCD:
1791 /* Positioning Measurement Gap Activation/Deactivation Command 1 oct*/
1792 case CASE_7_TIMING_ADVANCE_OFFSET_ELCD:
1793 /* Case-7 Timing advance offset 2 oct*/
1794 case PROVIDED_GUARD_SYMBOLS_FOR_CASE_6_TIMING_ELCD:
1795 /* Provided Guard Symbols for Case-6 timing 3 oct*/
1796 case PROVIDED_GUARD_SYMBOLS_FOR_CASE_7_TIMING_ELCD:
1797 /* Provided Guard Symbols for Case-7 timing 3 oct*/
1798 case SRS_PATHLOSS_REFERENCE_RS_UPDATE_ELCD:
1799 /* SRS Pathloss Reference RS Update 3 oct*/
1800 case DUPLICATION_RLC_ACTIVATION_DEACTIVATION_ELCD:
1801 /* Duplication RLC Activation/Deactivation 1 oct*/
1802 case ABSOLUTE_TIMING_ADVANCE_COMMAND_ELCD:
1803 /* Absolute Timing Advance Command 2 oct*/
1804 case PROVIDED_GUARD_SYMBOLS_ELCD:
1805 /* Provided Guard Symbols 4 oct*/
1806 case TIMING_DELTA_ELCD:
1807 /* Timing Delta 2 oct*/
1808 return true;
1809 default:
1810 /* 227 Serving Cell Set based SRS TCI State Indication */
1811 /* 228 SP/AP SRS TCI State Indication */
1812 /* 229 BFD-RS Indication */
1813 /* 231 Enhanced SCell Activation/Deactivation with one octet Ci field */
1814 /* 232 Enhanced SCell Activation/Deactivation with four octet Ci field */
1815 /* 233 Unified TCI States Activation/Deactivation */
1816 /* 234 PUCCH Power Control Set Update for multiple TRP PUCCH repetition*/
1817 /* 235 PUCCH spatial relation Activation/Deactivation for multiple TRP PUCCH repetition */
1818 /* 238 PPW Activation/Deactivation Command */
1819 /* 239 DL Tx Power Adjustment */
1820 /* 240 Timing Case Indication*/
1821 /* 241 Child IAB-DU Restricted Beam Indication*/
1822 /* 245 Serving Cell Set based SRS Spatial Relation Indication */
1823 /* 246 PUSCH Pathloss Reference RS Update */
1824 /* 248 Enhanced SP/AP SRS Spatial Relation Indication */
1825 /* 249 Enhanced PUCCH Spatial Relation Activation/Deactivation */
1826 /* 250 Enhanced TCI States Activation/Deactivation for UE-specific PDSCH */
1827 /* 253 SP Positioning SRS Activation/Deactivation */
1828 return false;
1832 static true_false_string subheader_f_vals = {
1833 "16 bits",
1834 "8 bits"
1838 /* Returns new subtree that was added for this item */
1839 static proto_item* dissect_me_phr_ph(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
1840 int ph_item, int pcmax_f_c_item,
1841 uint32_t *PH, uint32_t *offset)
1843 /* Subtree for this entry */
1844 proto_item *entry_ti = proto_tree_add_item(tree,
1845 hf_mac_nr_control_me_phr_entry,
1846 tvb, *offset, 0, ENC_ASCII);
1847 proto_tree *entry_tree = proto_item_add_subtree(entry_ti, ett_mac_nr_me_phr_entry);
1849 /* P */
1850 proto_tree_add_item(entry_tree, hf_mac_nr_control_me_phr_p, tvb, *offset, 1, ENC_BIG_ENDIAN);
1851 /* V */
1852 bool V;
1853 proto_tree_add_item_ret_boolean(entry_tree, hf_mac_nr_control_me_phr_v, tvb, *offset, 1, ENC_BIG_ENDIAN, &V);
1854 /* PH. TODO: infer whether value relates to Type1 (PUSCH), Type2 (PUCCH) or Type3 (SRS).
1855 And decide whether:
1856 - there needs to be a separate field for each SCellIndex and type OR
1857 - a generated field added with the inferred type OR
1858 - just do proto_item_append_text() indicating what the type was
1860 proto_tree_add_item_ret_uint(entry_tree, ph_item, tvb, *offset, 1, ENC_BIG_ENDIAN, PH);
1861 (*offset)++;
1863 if (!V) {
1864 /* Reserved (2 bits) */
1865 proto_tree_add_item(entry_tree, hf_mac_nr_control_me_phr_reserved_2, tvb, *offset, 1, ENC_BIG_ENDIAN);
1866 /* pcmax_f_c (6 bits) */
1867 proto_tree_add_item(entry_tree, pcmax_f_c_item, tvb, *offset, 1, ENC_BIG_ENDIAN);
1868 (*offset)++;
1871 proto_item_set_end(entry_ti, tvb, *offset);
1872 return entry_ti;
1876 static uint8_t get_rlc_seqnum_length(rlc_bearer_type_t rlc_bearer_type)
1878 switch (rlc_bearer_type) {
1879 case rlcUM6:
1880 return 6;
1881 case rlcUM12:
1882 return 12;
1883 case rlcAM12:
1884 return 12;
1885 case rlcAM18:
1886 return 18;
1888 default:
1889 /* Not expected */
1890 return 0;
1896 /* Lookup bearer details for lcid */
1897 static bool lookup_rlc_bearer_from_lcid(uint16_t ueid,
1898 uint8_t lcid,
1899 uint8_t direction,
1900 rlc_bearer_type_t *rlc_bearer_type, /* out */
1901 uint8_t *seqnum_length, /* out */
1902 int *drb_id, /* out */
1903 bool *is_srb) /* out */
1905 /* Zero params (in case no match is found) */
1906 *rlc_bearer_type = rlcRaw;
1907 *seqnum_length = 0;
1908 *drb_id = 0;
1910 *is_srb = false;
1912 if (global_mac_nr_lcid_drb_source == (int)FromStaticTable) {
1914 /* Look up in static (UAT) table */
1915 unsigned m;
1916 for (m=0; m < num_lcid_drb_mappings; m++) {
1917 if (lcid == lcid_drb_mappings[m].lcid) {
1919 /* Found, set out parameters */
1920 if (direction == DIRECTION_UPLINK) {
1921 *rlc_bearer_type = lcid_drb_mappings[m].bearer_type_ul;
1923 else {
1924 *rlc_bearer_type = lcid_drb_mappings[m].bearer_type_dl;
1926 *seqnum_length = get_rlc_seqnum_length(*rlc_bearer_type);
1927 *drb_id = lcid_drb_mappings[m].drbid;
1928 return true;
1931 if (lcid==3 || lcid==4) {
1932 /* Wasn't found as DRB, so lets assume SRB-3 (or SRB-4) */
1933 *is_srb = true;
1935 return false;
1937 else {
1938 /* Look up the dynamic mappings for this UE */
1939 ue_dynamic_drb_mappings_t *ue_mappings = (ue_dynamic_drb_mappings_t *)g_hash_table_lookup(mac_nr_ue_bearers_hash, GUINT_TO_POINTER((unsigned)ueid));
1940 if (!ue_mappings) {
1941 /* No entry for this UE.. */
1942 if (lcid==3 || lcid==4) {
1943 *is_srb = true;
1945 return false;
1948 if (lcid==3) {
1949 *is_srb = ue_mappings->srb3_set;
1951 if (lcid==4) {
1952 *is_srb = ue_mappings->srb4_set;
1955 /* Look up setting gleaned from configuration protocol */
1956 if (!ue_mappings->mapping[lcid].valid) {
1957 return false;
1960 /* Found, set out params */
1961 *rlc_bearer_type = (direction == DIRECTION_UPLINK) ?
1962 ue_mappings->mapping[lcid].bearer_type_ul :
1963 ue_mappings->mapping[lcid].bearer_type_dl;
1964 *seqnum_length = get_rlc_seqnum_length(*rlc_bearer_type);
1965 *drb_id = ue_mappings->mapping[lcid].drbid;
1967 return true;
1972 /* Helper function to call RLC dissector for SDUs (where channel params are known) */
1973 static void call_rlc_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1974 proto_item *pdu_ti,
1975 int offset, uint16_t data_length,
1976 uint8_t mode, uint8_t direction, uint16_t ueid,
1977 uint8_t bearerType, uint8_t bearerId,
1978 uint8_t sequenceNumberLength,
1979 uint8_t priority _U_)
1981 tvbuff_t *rb_tvb = tvb_new_subset_length(tvb, offset, data_length);
1982 struct rlc_nr_info *p_rlc_nr_info;
1984 /* Reuse or create RLC info */
1985 p_rlc_nr_info = (rlc_nr_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc_nr, 0);
1986 if (p_rlc_nr_info == NULL) {
1987 p_rlc_nr_info = wmem_new0(wmem_file_scope(), struct rlc_nr_info);
1990 /* Fill in details for channel */
1991 p_rlc_nr_info->rlcMode = mode;
1992 p_rlc_nr_info->direction = direction;
1993 /* p_rlc_nr_info->priority = priority; */
1994 p_rlc_nr_info->ueid = ueid;
1995 p_rlc_nr_info->bearerType = bearerType;
1996 p_rlc_nr_info->bearerId = bearerId;
1997 p_rlc_nr_info->pduLength = data_length;
1998 p_rlc_nr_info->sequenceNumberLength = sequenceNumberLength;
2000 /* Store info in packet */
2001 p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc_nr, 0, p_rlc_nr_info);
2003 if (global_mac_nr_layer_to_show != ShowRLCLayer) {
2004 /* Don't want these columns replaced */
2005 col_set_writable(pinfo->cinfo, -1, false);
2007 else {
2008 /* Clear info column before first RLC PDU */
2009 if (s_number_of_rlc_pdus_shown == 0) {
2010 col_clear(pinfo->cinfo, COL_INFO);
2012 else {
2013 /* Add a separator and protect column contents here */
2014 write_pdu_label_and_info_literal(pdu_ti, NULL, pinfo, " || ");
2015 col_set_fence(pinfo->cinfo, COL_INFO);
2018 s_number_of_rlc_pdus_shown++;
2020 /* Call it (catch exceptions so that stats will be updated) */
2021 call_with_catch_all(rlc_nr_handle, rb_tvb, pinfo, tree);
2023 /* Let columns be written to again */
2024 col_set_writable(pinfo->cinfo, -1, true);
2027 /* see 3GPP 38.133 Table 10.1.17.1-1 */
2028 static void
2029 mac_nr_phr_fmt(char *s, uint32_t v)
2031 int32_t val = (int32_t)v;
2033 if (val == 0) {
2034 snprintf(s, ITEM_LABEL_LENGTH, "PH < -32 dB (0)");
2035 } else if (val == 63) {
2036 snprintf(s, ITEM_LABEL_LENGTH, "PH >= 38 dB (63)");
2037 } else if (val <= 54) {
2038 snprintf(s, ITEM_LABEL_LENGTH, "%d dB <= PH < %d dB (%d)", val - 33, val - 32, val);
2039 } else {
2040 snprintf(s, ITEM_LABEL_LENGTH, "%d dB <= PH < %d dB (%d)", 22 + 2 * (val - 55), 24 + 2 * (val - 55), val);
2044 /* see 3GPP 38.133 Table 10.1.18.1-1 */
2045 static void
2046 mac_nr_pcmax_f_c_fmt(char *s, uint32_t v)
2048 int32_t val = (int32_t)v;
2050 if (val == 0) {
2051 snprintf(s, ITEM_LABEL_LENGTH, "Pcmax,f,c < -29 dBm (0)");
2052 } else if (val == 63) {
2053 snprintf(s, ITEM_LABEL_LENGTH, "Pcmax,f,c >= 33 dBm (63)");
2054 } else {
2055 snprintf(s, ITEM_LABEL_LENGTH, "%d dBm <= Pcmax,f,c < %d dBm (%d)", val - 30, val - 29, val);
2059 /* UL-SCH and DL-SCH formats have much in common, so handle them in a common
2060 function */
2061 static int dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2062 proto_item *pdu_ti, uint32_t offset,
2063 mac_nr_info *p_mac_nr_info,
2064 mac_3gpp_tap_info *tap_info)
2066 bool ces_seen = false;
2067 bool data_seen = false;
2069 write_pdu_label_and_info(pdu_ti, NULL, pinfo,
2070 "%s ",
2071 (p_mac_nr_info->direction == DIRECTION_UPLINK) ? "UL-SCH" : "DL-SCH");
2073 tap_info->raw_length = p_mac_nr_info->length;
2075 /************************************************************************/
2076 /* Dissect each sub-pdu. */
2077 do {
2078 /* Subheader */
2079 proto_item *subheader_ti = proto_tree_add_item(tree,
2080 hf_mac_nr_subheader,
2081 tvb, offset, 0, ENC_ASCII);
2082 proto_tree *subheader_tree = proto_item_add_subtree(subheader_ti, ett_mac_nr_subheader);
2085 bool F, fixed_len;
2086 uint32_t SDU_length=0;
2088 /* 1st bit is always reserved */
2089 /* 2nd bit depends upon LCID */
2090 uint8_t lcid = tvb_get_uint8(tvb, offset) & 0x3f;
2091 int32_t elcid= -1;
2092 switch (lcid) {
2093 case TWO_OCTET_ELCID_FIELD:
2094 elcid = tvb_get_uint16(tvb, offset+1, ENC_BIG_ENDIAN);
2095 fixed_len = true;
2096 break;
2097 case ONE_OCTET_ELCID_FIELD:
2098 elcid = tvb_get_uint8(tvb, offset+1);
2099 fixed_len = is_fixed_sized_elcid(elcid, p_mac_nr_info->direction);
2100 default:
2101 break;
2103 if (elcid == -1) {
2104 /* No elcid present */
2105 fixed_len = is_fixed_sized_lcid(lcid, p_mac_nr_info->direction);
2107 if (fixed_len) {
2108 proto_tree_add_bits_item(subheader_tree, hf_mac_nr_subheader_reserved, tvb, offset<<3, 2, ENC_BIG_ENDIAN);
2110 else {
2111 proto_tree_add_bits_item(subheader_tree, hf_mac_nr_subheader_reserved, tvb, offset<<3, 1, ENC_BIG_ENDIAN);
2112 /* Data, so check F bit and length */
2113 proto_tree_add_item_ret_boolean(subheader_tree, hf_mac_nr_subheader_f, tvb, offset, 1, ENC_BIG_ENDIAN, &F);
2116 /* LCID (UL or DL) */
2117 proto_tree_add_uint(subheader_tree,
2118 (p_mac_nr_info->direction == DIRECTION_UPLINK) ?
2119 hf_mac_nr_ulsch_lcid : hf_mac_nr_dlsch_lcid,
2120 tvb, offset, 1, lcid);
2121 /* Also add LCID as a hidden, direction-less field */
2122 proto_item *bi_di_lcid = proto_tree_add_uint(subheader_tree, hf_mac_nr_lcid, tvb, offset, 1, lcid);
2123 proto_item_set_hidden(bi_di_lcid);
2124 offset++;
2126 /* Show eLCID, if present */
2127 switch (lcid) {
2128 case TWO_OCTET_ELCID_FIELD:
2129 elcid = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
2130 proto_tree_add_uint(subheader_tree,
2131 (p_mac_nr_info->direction == DIRECTION_UPLINK) ?
2132 hf_mac_nr_ulsch_elcid_2oct : hf_mac_nr_dlsch_elcid_2oct,
2133 tvb, offset, 2, elcid);
2134 offset += 2;
2135 break;
2136 case ONE_OCTET_ELCID_FIELD:
2137 elcid = tvb_get_uint8(tvb, offset);
2138 proto_tree_add_uint(subheader_tree,
2139 (p_mac_nr_info->direction == DIRECTION_UPLINK) ?
2140 hf_mac_nr_ulsch_elcid_1oct : hf_mac_nr_dlsch_elcid_1oct,
2141 tvb, offset, 1, elcid);
2142 offset += 1;
2143 break;
2145 default:
2146 break;
2149 /* Show length */
2150 if (!fixed_len) {
2151 if (F) {
2152 /* Long length */
2153 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_subheader_length_2_bytes, tvb, offset, 2, ENC_BIG_ENDIAN, &SDU_length);
2154 offset += 2;
2156 else {
2157 /* Short length */
2158 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_subheader_length_1_byte, tvb, offset, 1, ENC_BIG_ENDIAN, &SDU_length);
2159 offset++;
2163 if (lcid <= 32 || (p_mac_nr_info->direction == DIRECTION_UPLINK &&
2164 (lcid == 35 || lcid == 36 || lcid == CCCH_48_BITS_LCID))) {
2165 proto_item *sch_pdu_ti;
2167 /* Note whether this sub-pdu gets dissected by RLC/RRC */
2168 bool dissected_by_upper_layer = false;
2170 /* Add SDU, for now just as hex data */
2171 if (p_mac_nr_info->direction == DIRECTION_UPLINK) {
2172 /* UL. Check various CCCH LCIDs */
2173 if ((lcid == CCCH_LCID) || (lcid == 36)) {
2174 SDU_length = 8;
2175 } else if ((lcid == CCCH_48_BITS_LCID) || (lcid == 35)) {
2176 SDU_length = 6;
2178 sch_pdu_ti = proto_tree_add_item(subheader_tree, hf_mac_nr_ulsch_sdu,
2179 tvb, offset, SDU_length, ENC_NA);
2181 else {
2182 /* DL */
2183 sch_pdu_ti = proto_tree_add_item(subheader_tree, hf_mac_nr_dlsch_sdu,
2184 tvb, offset, SDU_length, ENC_NA);
2187 bool is_srb = false;
2188 if (lcid == 3 || lcid == 4) {
2189 /* Work out whether we are to assume that we are dealing with SRB-3 or SRB-4 */
2190 rlc_bearer_type_t rlc_bearer_type;
2191 uint8_t seqnum_length;
2192 int drb_id;
2194 lookup_rlc_bearer_from_lcid(p_mac_nr_info->ueid,
2195 lcid,
2196 p_mac_nr_info->direction,
2197 &rlc_bearer_type,
2198 &seqnum_length,
2199 &drb_id,
2200 &is_srb);
2203 /* Might also call RLC if configured to do so for this SDU */
2204 if ((lcid >= 3) && (lcid <= 32) && !is_srb) {
2205 /* Look for DRB mapping for this LCID to drb channel set by UAT table */
2206 rlc_bearer_type_t rlc_bearer_type;
2207 uint8_t seqnum_length;
2208 int drb_id;
2210 tap_info->sdus_for_lcid[lcid]++;
2211 tap_info->bytes_for_lcid[lcid] += SDU_length;
2213 // TODO: priority not set.
2214 uint8_t priority = 0;
2215 lookup_rlc_bearer_from_lcid(p_mac_nr_info->ueid,
2216 lcid,
2217 p_mac_nr_info->direction,
2218 &rlc_bearer_type,
2219 &seqnum_length,
2220 &drb_id,
2221 &is_srb);
2223 /* Dissect according to channel type */
2224 switch (rlc_bearer_type) {
2225 case rlcUM6:
2226 case rlcUM12:
2227 call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, SDU_length,
2228 RLC_UM_MODE, p_mac_nr_info->direction, p_mac_nr_info->ueid,
2229 BEARER_TYPE_DRB, drb_id, seqnum_length,
2230 priority);
2231 dissected_by_upper_layer = true;
2232 break;
2233 case rlcAM12:
2234 case rlcAM18:
2235 call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, SDU_length,
2236 RLC_AM_MODE, p_mac_nr_info->direction, p_mac_nr_info->ueid,
2237 BEARER_TYPE_DRB, drb_id, seqnum_length,
2238 priority);
2239 dissected_by_upper_layer = true;
2240 break;
2241 case rlcTM:
2242 call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, SDU_length,
2243 RLC_TM_MODE, p_mac_nr_info->direction, p_mac_nr_info->ueid,
2244 BEARER_TYPE_DRB, drb_id, 0,
2245 priority);
2246 dissected_by_upper_layer = true;
2247 break;
2248 case rlcRaw:
2249 /* Nothing to do! */
2250 break;
2252 } else if ((lcid >= 1 && lcid <= 2) || ((lcid==3 || lcid==4) && is_srb)) {
2253 /* SRB */
2254 tap_info->sdus_for_lcid[lcid]++;
2255 tap_info->bytes_for_lcid[lcid] += SDU_length;
2257 if (global_mac_nr_attempt_srb_decode) {
2258 /* SRB, call RLC dissector */
2259 /* These are defaults (38.331, 9.2.1) - only priority may be overridden, but not passing in yet. */
2260 call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, SDU_length,
2261 RLC_AM_MODE, p_mac_nr_info->direction, p_mac_nr_info->ueid,
2262 BEARER_TYPE_SRB, lcid, 12,
2263 (lcid == 2) ? 3 : 1);
2264 dissected_by_upper_layer = true;
2266 } else if (global_mac_nr_attempt_rrc_decode) {
2267 dissector_handle_t protocol_handle;
2268 tvbuff_t *rrc_tvb = tvb_new_subset_length(tvb, offset, SDU_length);
2270 if (p_mac_nr_info->direction == DIRECTION_UPLINK) {
2271 protocol_handle = ((lcid == CCCH_LCID) || (lcid == 36)) ?
2272 nr_rrc_ul_ccch1_handle :
2273 nr_rrc_ul_ccch_handle;
2274 } else {
2275 protocol_handle = nr_rrc_dl_ccch_handle;
2277 /* Hide raw view of bytes */
2278 proto_item_set_hidden(sch_pdu_ti);
2279 call_with_catch_all(protocol_handle, rrc_tvb, pinfo, tree);
2280 dissected_by_upper_layer = true;
2283 /* Only write summary to Info column if didn't send to upper_layer dissector */
2284 write_pdu_label_and_info(pdu_ti, subheader_ti, dissected_by_upper_layer ? NULL : pinfo,
2285 "(LCID:%u %u bytes) ", lcid, SDU_length);
2287 offset += SDU_length;
2290 if (p_mac_nr_info->direction == DIRECTION_UPLINK) {
2291 if (ces_seen) {
2292 expert_add_info_format(pinfo, subheader_ti, &ei_mac_nr_ul_sch_control_subheader_before_data_subheader,
2293 "UL-SCH: should not have Data SDUs after Control Elements");
2296 data_seen = true;
2298 else {
2299 /* UL Control Elements */
2301 /* Add some space to info column between entries */
2302 if (data_seen || ces_seen) {
2303 col_append_str(pinfo->cinfo, COL_INFO, " ");
2306 if (lcid != PADDING_LCID) {
2307 ces_seen = true;
2310 if (p_mac_nr_info->direction == DIRECTION_UPLINK) {
2311 uint32_t phr_ph, phr_pcmax_f_c, c_rnti, lcg_id, bs, br_lcid, bit_rate;
2312 bool dir;
2314 switch (lcid) {
2315 case TWO_OCTET_ELCID_FIELD:
2316 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(Identity of the logical channel %u) ", elcid);
2317 break;
2318 case ONE_OCTET_ELCID_FIELD:
2319 switch (elcid) {
2320 case ENHANCED_MULTIPLE_ENTRY_PHR_FOR_MULTIPLE_TRP_FOUR_OCTETS_CI:
2321 /* It has a variable size, */
2322 offset += SDU_length;
2323 break;
2324 case ENHANCED_MULTIPLE_ENTRY_PHR_FOR_MULTIPLE_TRP_ONE_OCTETS_CI:
2325 /* It has a variable size, */
2326 offset += SDU_length;
2327 break;
2328 case ENHANCED_SINGLE_ENTRY_PHR_FOR_MULTIPLE_TRP:
2329 /* It has a fixed size and consists of three octets */
2330 offset += 3;
2331 break;
2332 case ENHANCED_MULTIPLE_ENTRY_PHR_FOUR_OCTETS_CI:
2333 /* has a variable size */
2334 offset += SDU_length;
2335 break;
2336 case ENHANCED_MULTIPLE_ENTRY_PHR_ONE_OCTETS_CI:
2337 offset += SDU_length;
2338 break;
2339 case ENHANCED_SINGLE_ENTRY_PHR:
2340 /* has a variable size */
2341 offset += SDU_length;
2342 break;
2343 case ENHANCED_BFR_ONE_OCTET_CI:
2344 /* have a variable size */
2345 offset += SDU_length;
2346 break;
2347 case ENHANCED_BFR_FOUR_OCTET_CI:
2348 /* have a variable size*/
2349 offset += SDU_length;
2350 break;
2351 case TRUNCATED_ENHANCED_BFR_FOUR_OCTET_CI:
2352 /* have a variable size*/
2353 offset += SDU_length;
2354 break;
2355 case POSITIONING_MEASUREMENT_GAP_ACTIVATION_DEACTIVATION_REQUEST:
2356 /* It has a fixed size of zero bits */
2357 break;
2358 case IAB_MT_RECOMMENDED_BEAM_INDICATION:
2359 /* It has a variable size */
2360 offset += SDU_length;
2361 break;
2362 case DESIRED_IAB_MT_PSD_RANGE:
2363 break;
2364 case DESIRED_DL_TX_POWER_ADJUSTMENT:
2365 break;
2366 case CASE_6_TIMING_REQUEST:
2367 break;
2368 case DESIRED_GUARD_SYMBOLS_FOR_CASE_6_TIMING:
2369 break;
2370 case DESIRED_GUARD_SYMBOLS_FOR_CASE_7_TIMING:
2371 break;
2372 case EXTENDED_SHORT_TRUNCATED_BSR:
2373 break;
2374 case EXTENDED_LONG_TRUNCATED_BSR:
2375 break;
2376 case EXTENDED_SHORT_BSR:
2377 break;
2378 case EXTENDED_LONG_BSR:
2379 break;
2380 case EXTENDED_PRE_EMPTIVE_BSR:
2381 break;
2382 case BFR_FOUR_OCTETS_CI:
2383 break;
2384 case TRUNCATED_BFR_FOUR_OCTETS_CI:
2385 break;
2386 case MULTIPLE_ENTRY_CONFIGURED_GRANT_CONFIRMATION:
2387 break;
2388 case SIDELINK_CONFIGURED_GRANT_CONFIRMATION:
2389 break;
2390 case DESIRED_GUARD_SYMBOLS:
2391 break;
2392 case PRE_EMPTIVE_BSR:
2393 break;
2394 default:
2395 break;
2397 break;
2398 case TRUNCATED_ENHANCED_BFR_LCID:
2399 /* variable size */
2400 offset += SDU_length;
2401 break;
2402 case TIMING_ADVANCE_REPORT_LCID:
2404 /* Reserved (2 bits) */
2405 proto_tree_add_item(subheader_tree, hf_mac_nr_control_timing_advance_report_reserved,
2406 tvb, offset, 1, ENC_BIG_ENDIAN);
2407 /* Timing Advance */
2408 uint32_t ta;
2409 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_timing_advance_report_ta,
2410 tvb, offset, 2, ENC_BIG_ENDIAN, &ta);
2411 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(Timing Advance Report TA=%u) ", ta);
2413 offset += 2;
2414 break;
2416 case TRUNCATED_SIDELINK_BSR_LCID:
2417 /* No description? */
2418 break;
2419 case SIDELINK_BSR_LCID:
2420 /* No description? */
2421 break;
2422 case LBT_FAILURE_4_OCTETS_LCID:
2423 offset += 4;
2424 break;
2425 case LBT_FAILURE_1_OCTET_LCID:
2426 offset += 1;
2427 break;
2428 case BFR_LCID:
2429 /* variable size */
2430 offset += SDU_length;
2431 break;
2432 case TRUNCATED_BFR_LCID:
2433 offset += SDU_length;
2434 break;
2435 /* CCCH_48_BITS_LCID Handled above*/
2436 case RECOMMENDED_BIT_RATE_QUERY_LCID:
2437 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_recommended_bit_rate_query_lcid,
2438 tvb, offset, 1, ENC_BIG_ENDIAN, &br_lcid);
2439 proto_tree_add_item_ret_boolean(subheader_tree, hf_mac_nr_control_recommended_bit_rate_query_dir,
2440 tvb, offset, 1, ENC_BIG_ENDIAN, &dir);
2441 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_recommended_bit_rate_query_bit_rate,
2442 tvb, offset, 2, ENC_BIG_ENDIAN, &bit_rate);
2443 proto_tree_add_item(subheader_tree, hf_mac_nr_control_recommended_bit_rate_query_reserved,
2444 tvb, offset + 1, 1, ENC_BIG_ENDIAN);
2445 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
2446 "(Recommended BR Query LCID=%u Dir=%s BR=%s) ", br_lcid, dir ? "UL" : "DL",
2447 val_to_str_ext_const(bit_rate, &bit_rate_vals_ext, "Unknown"));
2448 offset += 2;
2449 break;
2450 case CONFIGURED_GRANT_CONFIGURATION_LCID:
2451 /* Fixed size of zero bits */
2452 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
2453 "(Configured Grant Config) ");
2454 break;
2455 case MULTIPLE_ENTRY_PHR_1_LCID:
2456 case MULTIPLE_ENTRY_PHR_4_LCID:
2458 static int* const me_phr_byte1_flags[] = {
2459 &hf_mac_nr_control_me_phr_c7_flag,
2460 &hf_mac_nr_control_me_phr_c6_flag,
2461 &hf_mac_nr_control_me_phr_c5_flag,
2462 &hf_mac_nr_control_me_phr_c4_flag,
2463 &hf_mac_nr_control_me_phr_c3_flag,
2464 &hf_mac_nr_control_me_phr_c2_flag,
2465 &hf_mac_nr_control_me_phr_c1_flag,
2466 &hf_mac_nr_control_me_phr_reserved,
2467 NULL
2469 static int* const me_phr_byte2_flags[] = {
2470 &hf_mac_nr_control_me_phr_c15_flag,
2471 &hf_mac_nr_control_me_phr_c14_flag,
2472 &hf_mac_nr_control_me_phr_c13_flag,
2473 &hf_mac_nr_control_me_phr_c12_flag,
2474 &hf_mac_nr_control_me_phr_c11_flag,
2475 &hf_mac_nr_control_me_phr_c10_flag,
2476 &hf_mac_nr_control_me_phr_c9_flag,
2477 &hf_mac_nr_control_me_phr_c8_flag,
2478 NULL
2480 static int* const me_phr_byte3_flags[] = {
2481 &hf_mac_nr_control_me_phr_c23_flag,
2482 &hf_mac_nr_control_me_phr_c22_flag,
2483 &hf_mac_nr_control_me_phr_c21_flag,
2484 &hf_mac_nr_control_me_phr_c20_flag,
2485 &hf_mac_nr_control_me_phr_c19_flag,
2486 &hf_mac_nr_control_me_phr_c18_flag,
2487 &hf_mac_nr_control_me_phr_c17_flag,
2488 &hf_mac_nr_control_me_phr_c16_flag,
2489 NULL
2491 static int* const me_phr_byte4_flags[] = {
2492 &hf_mac_nr_control_me_phr_c31_flag,
2493 &hf_mac_nr_control_me_phr_c30_flag,
2494 &hf_mac_nr_control_me_phr_c29_flag,
2495 &hf_mac_nr_control_me_phr_c28_flag,
2496 &hf_mac_nr_control_me_phr_c27_flag,
2497 &hf_mac_nr_control_me_phr_c26_flag,
2498 &hf_mac_nr_control_me_phr_c25_flag,
2499 &hf_mac_nr_control_me_phr_c24_flag,
2500 NULL
2502 uint32_t start_offset = offset;
2503 uint8_t scell_bitmap1;
2504 uint32_t scell_bitmap2_3_4 = 0;
2505 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, me_phr_byte1_flags, ENC_NA);
2506 scell_bitmap1 = tvb_get_uint8(tvb, offset);
2507 offset++;
2508 if (lcid == MULTIPLE_ENTRY_PHR_4_LCID) {
2509 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, me_phr_byte2_flags, ENC_NA);
2510 proto_tree_add_bitmask_list(subheader_tree, tvb, offset + 1, 1, me_phr_byte3_flags, ENC_NA);
2511 proto_tree_add_bitmask_list(subheader_tree, tvb, offset + 2, 1, me_phr_byte4_flags, ENC_NA);
2512 scell_bitmap2_3_4 = tvb_get_letoh24(tvb, offset); /* read them in little endian on purpose */
2513 offset += 3;
2516 static int* const ph_fields1[] = {
2517 &hf_mac_nr_control_me_phr_ph_c1,
2518 &hf_mac_nr_control_me_phr_ph_c2,
2519 &hf_mac_nr_control_me_phr_ph_c3,
2520 &hf_mac_nr_control_me_phr_ph_c4,
2521 &hf_mac_nr_control_me_phr_ph_c5,
2522 &hf_mac_nr_control_me_phr_ph_c6,
2523 &hf_mac_nr_control_me_phr_ph_c7,
2525 static int* const ph_fields2_3_4[] = {
2526 &hf_mac_nr_control_me_phr_ph_c8,
2527 &hf_mac_nr_control_me_phr_ph_c9,
2528 &hf_mac_nr_control_me_phr_ph_c10,
2529 &hf_mac_nr_control_me_phr_ph_c11,
2530 &hf_mac_nr_control_me_phr_ph_c12,
2531 &hf_mac_nr_control_me_phr_ph_c13,
2532 &hf_mac_nr_control_me_phr_ph_c14,
2533 &hf_mac_nr_control_me_phr_ph_c15,
2534 &hf_mac_nr_control_me_phr_ph_c16,
2535 &hf_mac_nr_control_me_phr_ph_c17,
2536 &hf_mac_nr_control_me_phr_ph_c18,
2537 &hf_mac_nr_control_me_phr_ph_c19,
2538 &hf_mac_nr_control_me_phr_ph_c20,
2539 &hf_mac_nr_control_me_phr_ph_c21,
2540 &hf_mac_nr_control_me_phr_ph_c22,
2541 &hf_mac_nr_control_me_phr_ph_c23,
2542 &hf_mac_nr_control_me_phr_ph_c24,
2543 &hf_mac_nr_control_me_phr_ph_c25,
2544 &hf_mac_nr_control_me_phr_ph_c26,
2545 &hf_mac_nr_control_me_phr_ph_c27,
2546 &hf_mac_nr_control_me_phr_ph_c28,
2547 &hf_mac_nr_control_me_phr_ph_c29,
2548 &hf_mac_nr_control_me_phr_ph_c30,
2549 &hf_mac_nr_control_me_phr_ph_c31,
2552 /* PCell entries */
2553 uint32_t PH;
2554 proto_item* entry_ti;
2555 if (p_mac_nr_info->phr_type2_othercell) {
2556 /* The PH and PCMAX,f,c fields can be either for a LTE or NR cell */
2557 entry_ti = dissect_me_phr_ph(tvb, pinfo, subheader_ti, hf_mac_nr_control_me_phr_ph_type2_spcell,
2558 hf_mac_nr_control_me_phr_pcmax_f_c_type2_spcell, &PH, &offset);
2559 proto_item_append_text(entry_ti, " (Type2, SpCell PH=%u)", PH);
2561 entry_ti = dissect_me_phr_ph(tvb, pinfo, subheader_ti, hf_mac_nr_control_me_phr_ph_type1_pcell,
2562 hf_mac_nr_control_me_phr_pcmax_f_c_type1_pcell, &PH, &offset);
2563 proto_item_append_text(entry_ti, " (Type1, PCell PH=%u)", PH);
2566 /* SCell entries */
2567 /* The PH and PCMAX,f,c fields can be either for a LTE or NR cell */
2568 for (int n = 1; n <= 7; n++) {
2569 if (scell_bitmap1 & (1 << n)) {
2570 entry_ti = dissect_me_phr_ph(tvb, pinfo, subheader_ti, *ph_fields1[n - 1],
2571 hf_mac_nr_control_me_phr_pcmax_f_c_typeX, &PH, &offset);
2572 proto_item_append_text(entry_ti, " (SCellIndex %d PH=%u)", n, PH);
2575 if (lcid == MULTIPLE_ENTRY_PHR_4_LCID) {
2576 for (int n = 0; n <= 23; n++) {
2577 if (scell_bitmap2_3_4 & (1 << n)) {
2578 entry_ti = dissect_me_phr_ph(tvb, pinfo, subheader_ti, *ph_fields2_3_4[n],
2579 hf_mac_nr_control_me_phr_pcmax_f_c_typeX, &PH, &offset);
2580 proto_item_append_text(entry_ti, " (SCellIndex %d PH=%u)", n + 8, PH);
2585 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
2586 "(Multi-entry PHR) ");
2588 /* Make sure dissected length matches signalled length */
2589 if (offset != start_offset + SDU_length) {
2590 proto_tree_add_expert_format(subheader_tree, pinfo, &ei_mac_nr_sdu_length_different_from_dissected,
2591 tvb, start_offset, offset - start_offset,
2592 "A Multiple-Entry PHR subheader has a length field of %u bytes, but "
2593 "dissected %u bytes", SDU_length, offset - start_offset);
2594 /* Assume length was correct, so at least can dissect further subheaders */
2595 offset = start_offset + SDU_length;
2597 break;
2599 case SINGLE_ENTRY_PHR_LCID:
2600 /* R R PH (6 bits) */
2601 proto_tree_add_item(subheader_tree, hf_mac_nr_control_se_phr_reserved,
2602 tvb, offset, 1, ENC_NA);
2603 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_se_phr_ph,
2604 tvb, offset, 1, ENC_BIG_ENDIAN, &phr_ph);
2605 offset++;
2607 /* R R PCMAX_f_c (6 bits) */
2608 proto_tree_add_item(subheader_tree, hf_mac_nr_control_se_phr_reserved,
2609 tvb, offset, 1, ENC_NA);
2610 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_se_phr_pcmax_f_c,
2611 tvb, offset, 1, ENC_NA, &phr_pcmax_f_c);
2612 offset++;
2613 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
2614 "(PHR PH=%u PCMAX_f_c=%u) ", phr_ph, phr_pcmax_f_c);
2615 break;
2616 case C_RNTI_LCID:
2617 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_crnti,
2618 tvb, offset, 2, ENC_BIG_ENDIAN, &c_rnti);
2619 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
2620 "(C-RNTI=%u) ", c_rnti);
2621 offset += 2;
2622 break;
2623 case SHORT_TRUNCATED_BSR_LCID:
2624 case SHORT_BSR_LCID:
2626 static int* const hf_mac_nr_control_bsr_short_bs_lcg[] = {
2627 &hf_mac_nr_control_bsr_short_bs_lcg0,
2628 &hf_mac_nr_control_bsr_short_bs_lcg1,
2629 &hf_mac_nr_control_bsr_short_bs_lcg2,
2630 &hf_mac_nr_control_bsr_short_bs_lcg3,
2631 &hf_mac_nr_control_bsr_short_bs_lcg4,
2632 &hf_mac_nr_control_bsr_short_bs_lcg5,
2633 &hf_mac_nr_control_bsr_short_bs_lcg6,
2634 &hf_mac_nr_control_bsr_short_bs_lcg7
2637 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_bsr_short_lcg,
2638 tvb, offset, 1, ENC_BIG_ENDIAN, &lcg_id);
2639 proto_tree_add_item_ret_uint(subheader_tree, *hf_mac_nr_control_bsr_short_bs_lcg[lcg_id],
2640 tvb, offset, 1, ENC_BIG_ENDIAN, &bs);
2641 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
2642 "(Short %sBSR LCG ID=%u BS=%u) ",
2643 lcid == SHORT_BSR_LCID ? "" : "Truncated ", lcg_id, bs);
2644 offset++;
2646 break;
2647 case LONG_TRUNCATED_BSR_LCID:
2649 static int* const long_bsr_flags[] = {
2650 &hf_mac_nr_control_bsr_long_lcg7,
2651 &hf_mac_nr_control_bsr_long_lcg6,
2652 &hf_mac_nr_control_bsr_long_lcg5,
2653 &hf_mac_nr_control_bsr_long_lcg4,
2654 &hf_mac_nr_control_bsr_long_lcg3,
2655 &hf_mac_nr_control_bsr_long_lcg2,
2656 &hf_mac_nr_control_bsr_long_lcg1,
2657 &hf_mac_nr_control_bsr_long_lcg0,
2658 NULL
2661 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, long_bsr_flags, ENC_NA);
2662 unsigned CE_start = offset;
2663 offset++;
2665 while ((offset - CE_start) < SDU_length) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_trunc_long_bs, tvb, offset++, 1, ENC_NA);
2667 /* TODO: show in string here how many BSs were seen */
2668 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
2669 "(Long Truncated BSR) ");
2671 if (SDU_length > 7) {
2672 proto_tree_add_expert_format(subheader_tree, pinfo, &ei_mac_nr_sdu_length_different_from_dissected,
2673 tvb, CE_start, SDU_length,
2674 "A Long Truncated BSR subheader should have a length field up to 7 bytes, but "
2675 "is set to %u bytes", SDU_length);
2678 break;
2679 case LONG_BSR_LCID:
2681 static int* const long_bsr_flags[] = {
2682 &hf_mac_nr_control_bsr_long_lcg7,
2683 &hf_mac_nr_control_bsr_long_lcg6,
2684 &hf_mac_nr_control_bsr_long_lcg5,
2685 &hf_mac_nr_control_bsr_long_lcg4,
2686 &hf_mac_nr_control_bsr_long_lcg3,
2687 &hf_mac_nr_control_bsr_long_lcg2,
2688 &hf_mac_nr_control_bsr_long_lcg1,
2689 &hf_mac_nr_control_bsr_long_lcg0,
2690 NULL
2693 uint8_t flags = tvb_get_uint8(tvb, offset);
2694 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, long_bsr_flags, ENC_NA);
2695 unsigned CE_start = offset;
2696 offset++;
2698 /* Show BSR values. */
2699 if (flags & 0x01) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_long_bs_lcg0, tvb, offset++, 1, ENC_NA);
2700 if (flags & 0x02) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_long_bs_lcg1, tvb, offset++, 1, ENC_NA);
2701 if (flags & 0x04) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_long_bs_lcg2, tvb, offset++, 1, ENC_NA);
2702 if (flags & 0x08) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_long_bs_lcg3, tvb, offset++, 1, ENC_NA);
2703 if (flags & 0x10) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_long_bs_lcg4, tvb, offset++, 1, ENC_NA);
2704 if (flags & 0x20) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_long_bs_lcg5, tvb, offset++, 1, ENC_NA);
2705 if (flags & 0x40) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_long_bs_lcg6, tvb, offset++, 1, ENC_NA);
2706 if (flags & 0x80) proto_tree_add_item(subheader_tree, hf_mac_nr_control_bsr_long_bs_lcg7, tvb, offset++, 1, ENC_NA);
2708 /* TODO: show in string here how many BSs were seen */
2709 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
2710 "(Long BSR) ");
2713 /* Make sure dissected length matches signalled length */
2714 if ((offset - CE_start) != SDU_length) {
2715 proto_tree_add_expert_format(subheader_tree, pinfo, &ei_mac_nr_sdu_length_different_from_dissected,
2716 tvb, CE_start, offset - CE_start,
2717 "A Long BSR subheader has a length field of %u bytes, but "
2718 "dissected %u bytes", SDU_length, offset - CE_start);
2719 /* Assume length was correct, so at least can dissect further subheaders */
2720 offset = CE_start + SDU_length;
2723 break;
2724 case PADDING_LCID:
2726 /* The rest of the PDU is padding */
2727 int pad_len = tvb_reported_length_remaining(tvb, offset);
2728 if (pad_len > 0)
2729 proto_tree_add_item(subheader_tree, hf_mac_nr_padding, tvb, offset, -1, ENC_NA);
2730 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(Padding %u bytes) ", pad_len);
2731 /* Move to the end of the frame */
2732 offset = tvb_reported_length(tvb);
2734 break;
2737 else {
2738 /* Downlink control elements */
2739 uint32_t ta_tag_id, ta_ta, br_lcid, bit_rate;
2740 bool dir;
2742 if (lcid != PADDING_LCID) {
2743 if (data_seen) {
2744 expert_add_info_format(pinfo, subheader_ti, &ei_mac_nr_dl_sch_control_subheader_after_data_subheader,
2745 "DL-SCH: should not have Control Elements after Data SDUs");
2748 switch (lcid) {
2749 case TWO_OCTET_ELCID_FIELD:
2750 /* Error */
2751 break;
2752 case ONE_OCTET_ELCID_FIELD:
2753 switch (elcid) {
2754 case SERVING_CELL_SET_BASED_SRS_TCI_STATE_INDICATIONS_ELCD:
2755 break;
2756 case SP_AP_SRS_TCI_STATE_INDICATION_ELCD:
2757 break;
2758 case BFD_RS_INDICATION_ELCD:
2759 break;
2760 case DIFFERENTIAL_KOFFSET_ELCD:
2762 uint32_t koffset;
2763 proto_tree_add_item(subheader_tree, hf_mac_nr_differential_koffset_reserved,
2764 tvb, offset, 1, ENC_BIG_ENDIAN);
2765 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_differential_koffset,
2766 tvb, offset, 1, ENC_BIG_ENDIAN, &koffset);
2767 offset += 1;
2768 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
2769 "(Differential Koffset %u) ", koffset);
2771 break;
2772 case ENHANCED_SCELL_ACTIVATION_DEACTIVATION_MAC_CE_WITH_ONE_OCTET_CI_FIELD_ELCD:
2773 break;
2774 case ENHANCED_SCELL_ACTIVATION_DEACTIVATION_MAC_CE_WITH_FOUR_OCTET_CI_FIELD_ELCD:
2775 break;
2776 case UNIFIED_TCI_STATES_ACTIVATION_DEACTIVATION_ELCD:
2777 break;
2778 case PUCCH_POWER_CONTROL_SET_UPDATE_FOR_MULTIPLE_TRP_PUCCH_REPETITION__ELCD:
2779 break;
2780 case PUCCH_SPATIAL_RELATION_ACTIVATION_DEACTIVATION_FOR_MULTIPLE_TRP_PUCCH_REPETITION_ELCD:
2781 break;
2782 case ENHANCED_TCI_STATES_INDICATION_FOR_UE_SPECIFIC_PDCCH_ELCD:
2783 break;
2784 case POSITIONING_MEASUREMENT_GAP_ACTIVATION_DEACTIVATION_COMMAND_ELCD:
2785 break;
2786 case PPW_ACTIVATION_DEACTIVATION_COMMAND_ELCD:
2787 break;
2788 case DL_TX_POWER_ADJUSTMENT_ELCD:
2789 break;
2790 case TIMING_CASE_INDICATION_ELCD:
2791 break;
2792 case CHILD_IAB_DU_RESTRICTED_BEAM_INDICATION_ELCD:
2793 break;
2794 case CASE_7_TIMING_ADVANCE_OFFSET_ELCD:
2795 break;
2796 case PROVIDED_GUARD_SYMBOLS_FOR_CASE_6_TIMING_ELCD:
2797 break;
2798 case PROVIDED_GUARD_SYMBOLS_FOR_CASE_7_TIMING_ELCD:
2799 break;
2800 case SERVING_CELL_SET_BASED_SRS_SPATIAL_RELATION_INDICATION_ELCD:
2801 break;
2802 case PUSCH_PATHLOSS_REFERENCE_RS_UPDATE_ELCD:
2803 break;
2804 case SRS_PATHLOSS_REFERENCE_RS_UPDATE_ELCD:
2805 break;
2806 case ENHANCED_SP_AP_SRS_SPATIAL_RELATION_INDICATION_ELCD:
2807 break;
2808 case ENHANCED_PUCCH_SPATIAL_RELATION_ACTIVATION_DEACTIVATION_ELCD:
2809 break;
2810 case ENHANCED_TCI_STATES_ACTIVATION_DEACTIVATION_FOR_UE_SPECIFIC_PDSCH_ELCD:
2811 break;
2812 case DUPLICATION_RLC_ACTIVATION_DEACTIVATION_ELCD:
2813 /* 251 */
2814 break;
2815 case ABSOLUTE_TIMING_ADVANCE_COMMAND_ELCD:
2816 break;
2817 case SP_POSITIONING_SRS_ACTIVATION_DEACTIVATION_ELCD:
2818 break;
2819 case PROVIDED_GUARD_SYMBOLS_ELCD:
2820 break;
2821 case TIMING_DELTA_ELCD:
2822 break;
2823 default:
2824 break;
2826 break;
2827 case RECOMMENDED_BIT_RATE_LCID:
2828 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_recommended_bit_rate_lcid,
2829 tvb, offset, 1, ENC_BIG_ENDIAN, &br_lcid);
2830 proto_tree_add_item_ret_boolean(subheader_tree, hf_mac_nr_control_recommended_bit_rate_dir,
2831 tvb, offset, 1, ENC_BIG_ENDIAN, &dir);
2832 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_recommended_bit_rate_bit_rate,
2833 tvb, offset, 2, ENC_BIG_ENDIAN, &bit_rate);
2834 proto_tree_add_item(subheader_tree, hf_mac_nr_control_recommended_bit_rate_reserved,
2835 tvb, offset+1, 1, ENC_BIG_ENDIAN);
2836 offset += 2;
2837 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
2838 "(Recommended BR LCID=%u Dir=%s BR=%s) ", br_lcid, dir ? "UL" : "DL",
2839 val_to_str_ext_const(bit_rate, &bit_rate_vals_ext, "Unknown"));
2840 break;
2841 case SP_ZP_CSI_RS_RESOURCE_SET_ACT_DEACT_LCID:
2842 proto_tree_add_item(subheader_tree, hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_ad,
2843 tvb, offset, 1, ENC_NA);
2844 proto_tree_add_item(subheader_tree, hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_serving_cell_id,
2845 tvb, offset, 1, ENC_NA);
2846 proto_tree_add_item(subheader_tree, hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_bwp_id,
2847 tvb, offset, 1, ENC_NA);
2848 offset++;
2849 proto_tree_add_item(subheader_tree, hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_reserved_2,
2850 tvb, offset, 1, ENC_NA);
2851 proto_tree_add_item(subheader_tree, hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_sp_zp_rs_resource_set_id,
2852 tvb, offset, 1, ENC_NA);
2853 offset++;
2854 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
2855 "(SP ZP CSI-RS Res Set Act/Deact) ");
2856 break;
2857 case PUCCH_SPATIAL_REL_ACT_DEACT_LCID:
2859 static int * const pucch_spatial_rel_act_deact_flags[] = {
2860 &hf_mac_nr_control_pucch_spatial_rel_act_deact_s8,
2861 &hf_mac_nr_control_pucch_spatial_rel_act_deact_s7,
2862 &hf_mac_nr_control_pucch_spatial_rel_act_deact_s6,
2863 &hf_mac_nr_control_pucch_spatial_rel_act_deact_s5,
2864 &hf_mac_nr_control_pucch_spatial_rel_act_deact_s4,
2865 &hf_mac_nr_control_pucch_spatial_rel_act_deact_s3,
2866 &hf_mac_nr_control_pucch_spatial_rel_act_deact_s2,
2867 &hf_mac_nr_control_pucch_spatial_rel_act_deact_s1,
2868 NULL
2870 proto_tree_add_item(subheader_tree, hf_mac_nr_control_pucch_spatial_rel_act_deact_reserved,
2871 tvb, offset, 1, ENC_NA);
2872 proto_tree_add_item(subheader_tree, hf_mac_nr_control_pucch_spatial_rel_act_deact_serving_cell_id,
2873 tvb, offset, 1, ENC_NA);
2874 proto_tree_add_item(subheader_tree, hf_mac_nr_control_pucch_spatial_rel_act_deact_bwp_id,
2875 tvb, offset, 1, ENC_NA);
2876 offset++;
2877 proto_tree_add_item(subheader_tree, hf_mac_nr_control_pucch_spatial_rel_act_deact_reserved,
2878 tvb, offset, 1, ENC_NA);
2879 proto_tree_add_item(subheader_tree, hf_mac_nr_control_pucch_spatial_rel_act_deact_pucch_resource_id,
2880 tvb, offset, 1, ENC_NA);
2881 offset++;
2882 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, pucch_spatial_rel_act_deact_flags, ENC_NA);
2883 offset++;
2884 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
2885 "(PUCCH Spatial Rel Act/Deact) ");
2887 break;
2888 case SP_SRS_ACT_DEACT_LCID:
2890 bool ad, c;
2891 uint32_t start_offset = offset;
2892 unsigned resources = 0;
2894 /* Header */
2895 proto_tree_add_item_ret_boolean(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_ad,
2896 tvb, offset, 1, ENC_NA, &ad);
2897 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_srs_resource_set_cell_id,
2898 tvb, offset, 1, ENC_NA);
2899 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_srs_resource_set_bwp_id,
2900 tvb, offset, 1, ENC_NA);
2901 offset++;
2903 proto_tree_add_bits_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_reserved,
2904 tvb, offset<<3, 2, ENC_NA);
2905 proto_tree_add_item_ret_boolean(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_c,
2906 tvb, offset, 1, ENC_NA, &c);
2907 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_sul,
2908 tvb, offset, 1, ENC_NA);
2909 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_sp_srs_resource_set_id,
2910 tvb, offset, 1, ENC_NA);
2911 offset++;
2913 if (ad) {
2914 /* Activating - show info for resources */
2915 unsigned length = c ? (SDU_length-2) / 2 + 2: SDU_length;
2916 while (offset - start_offset < length) {
2917 bool f;
2918 proto_tree_add_item_ret_boolean(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_f,
2919 tvb, offset, 1, ENC_NA, &f);
2920 uint32_t resource_id = tvb_get_uint8(tvb, offset) & 0x7f;
2921 proto_item *resource_id_ti;
2922 if (!f && (resource_id & 0x40)) {
2923 /* SSB case - first bit just indicates type */
2924 resource_id_ti = proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_resource_id_ssb,
2925 tvb, offset, 1, ENC_NA);
2926 proto_item_append_text(resource_id_ti, " (SSB)");
2928 else {
2929 resource_id_ti = proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_resource_id,
2930 tvb, offset, 1, ENC_NA);
2931 if (f) {
2932 proto_item_append_text(resource_id_ti, " (NZP-CSI-RS)");
2934 else {
2935 proto_item_append_text(resource_id_ti, " (SRS)");
2938 offset++;
2939 resources++;
2943 if (c) {
2944 /* Deactivating (no resources) */
2945 while (offset - start_offset < SDU_length) {
2946 proto_tree_add_bits_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_reserved,
2947 tvb, offset<<3, 1, ENC_NA);
2948 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_resource_serving_cell_id,
2949 tvb, offset, 1, ENC_NA);
2950 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_srs_act_deact_resource_bwp_id,
2951 tvb, offset, 1, ENC_NA);
2952 offset++;
2956 /* Add summary to Info column */
2957 if (ad) {
2958 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(SP SRS Act/Deact Activate %d resources)", resources);
2960 else {
2961 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(SP SRS Act/Deact Deactivate)");
2964 break;
2965 case SP_CSI_REPORT_ON_PUCCH_ACT_DEACT_LCID:
2967 static int * const sp_csi_report_on_pucch_act_deact_flags[] = {
2968 &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s7,
2969 &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s6,
2970 &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s5,
2971 &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s4,
2972 &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s3,
2973 &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s2,
2974 &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s1,
2975 &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s0,
2976 NULL
2978 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_reserved,
2979 tvb, offset, 1, ENC_NA);
2980 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_serving_cell_id,
2981 tvb, offset, 1, ENC_NA);
2982 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_bwp_id,
2983 tvb, offset, 1, ENC_NA);
2984 offset++;
2985 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, sp_csi_report_on_pucch_act_deact_flags, ENC_NA);
2986 offset++;
2987 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
2988 "(SP CSI Report on PUCCH Act/Deact) ");
2990 break;
2991 case TCI_STATE_IND_FOR_UE_SPEC_PDCCH_LCID:
2992 proto_tree_add_item(subheader_tree, hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_serving_cell_id,
2993 tvb, offset, 1, ENC_NA);
2994 proto_tree_add_item(subheader_tree, hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_coreset_id,
2995 tvb, offset, 2, ENC_NA);
2996 offset++;
2997 proto_tree_add_item(subheader_tree, hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_tci_state_id,
2998 tvb, offset, 1, ENC_NA);
2999 offset++;
3000 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
3001 "(TCI State Ind PDCCH) ");
3002 break;
3003 case TCI_STATES_ACT_DEACT_FOR_UE_SPEC_PDSCH_LCID:
3005 uint32_t start_offset = offset;
3006 static int * const tci_states_act_deact_for_ue_spec_pdsc_flags[] = {
3007 &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t7,
3008 &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t6,
3009 &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t5,
3010 &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t4,
3011 &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t3,
3012 &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t2,
3013 &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t1,
3014 &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t0,
3015 NULL
3017 proto_tree_add_item(subheader_tree, hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_reserved,
3018 tvb, offset, 1, ENC_NA);
3019 proto_tree_add_item(subheader_tree, hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_serving_cell_id,
3020 tvb, offset, 1, ENC_NA);
3021 proto_tree_add_item(subheader_tree, hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_bwp_id,
3022 tvb, offset, 1, ENC_NA);
3023 offset++;
3024 while (offset - start_offset < SDU_length) {
3025 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, tci_states_act_deact_for_ue_spec_pdsc_flags, ENC_NA);
3026 offset++;
3028 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
3029 "(TCI States Act Deact PDSCH) ");
3031 break;
3032 case APER_CSI_TRIGGER_STATE_SUBSELECT_LCID:
3034 uint32_t start_offset = offset;
3035 static int * const aper_csi_trigger_state_subselect_flags[] = {
3036 &hf_mac_nr_control_aper_csi_trigger_state_subselect_t7,
3037 &hf_mac_nr_control_aper_csi_trigger_state_subselect_t6,
3038 &hf_mac_nr_control_aper_csi_trigger_state_subselect_t5,
3039 &hf_mac_nr_control_aper_csi_trigger_state_subselect_t4,
3040 &hf_mac_nr_control_aper_csi_trigger_state_subselect_t3,
3041 &hf_mac_nr_control_aper_csi_trigger_state_subselect_t2,
3042 &hf_mac_nr_control_aper_csi_trigger_state_subselect_t1,
3043 &hf_mac_nr_control_aper_csi_trigger_state_subselect_t0,
3044 NULL
3046 proto_tree_add_item(subheader_tree, hf_mac_nr_control_aper_csi_trigger_state_subselect_reserved,
3047 tvb, offset, 1, ENC_NA);
3048 proto_tree_add_item(subheader_tree, hf_mac_nr_control_aper_csi_trigger_state_subselect_serving_cell_id,
3049 tvb, offset, 1, ENC_NA);
3050 proto_tree_add_item(subheader_tree, hf_mac_nr_control_aper_csi_trigger_state_subselect_bwp_id,
3051 tvb, offset, 1, ENC_NA);
3052 offset++;
3053 while (offset - start_offset < SDU_length) {
3054 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, aper_csi_trigger_state_subselect_flags, ENC_NA);
3055 offset++;
3057 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
3058 "(Aperiodic CSI Trigger State Subselection) ");
3060 break;
3061 case SP_CSI_RS_CSI_IM_RES_SET_ACT_DEACT_LCID:
3063 bool ad;
3064 uint32_t start_offset = offset;
3065 static int * const sp_csi_rs_csi_im_res_set_act_deact_flags[] = {
3066 &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved3,
3067 &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_tci_state_id,
3068 NULL
3070 proto_tree_add_item_ret_boolean(subheader_tree, hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_ad,
3071 tvb, offset, 1, ENC_NA, &ad);
3072 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_serving_cell_id,
3073 tvb, offset, 1, ENC_NA);
3074 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_bwp_id,
3075 tvb, offset, 1, ENC_NA);
3076 offset++;
3077 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved,
3078 tvb, offset, 1, ENC_NA);
3079 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_im,
3080 tvb, offset, 1, ENC_NA);
3081 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_sp_csi_rs_res_set_id,
3082 tvb, offset, 1, ENC_NA);
3083 offset++;
3084 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved2,
3085 tvb, offset, 1, ENC_NA);
3086 proto_tree_add_item(subheader_tree, hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_sp_csi_im_res_set_id,
3087 tvb, offset, 1, ENC_NA);
3088 offset++;
3089 if (ad) {
3090 while (offset - start_offset < SDU_length) {
3091 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, sp_csi_rs_csi_im_res_set_act_deact_flags, ENC_NA);
3092 offset++;
3095 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
3096 "(SP CSI-RS/CSI-IM Res Set Act/Deact) ");
3098 break;
3099 case DUPLICATION_ACTIVATION_DEACTIVATION_LCID:
3101 static int * const dupl_act_deact_flags[] = {
3102 &hf_mac_nr_control_dupl_act_deact_drb7,
3103 &hf_mac_nr_control_dupl_act_deact_drb6,
3104 &hf_mac_nr_control_dupl_act_deact_drb5,
3105 &hf_mac_nr_control_dupl_act_deact_drb4,
3106 &hf_mac_nr_control_dupl_act_deact_drb3,
3107 &hf_mac_nr_control_dupl_act_deact_drb2,
3108 &hf_mac_nr_control_dupl_act_deact_drb1,
3109 &hf_mac_nr_control_dupl_act_deact_reserved,
3110 NULL
3112 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, dupl_act_deact_flags, ENC_NA);
3113 offset++;
3114 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
3115 "(Dupl Act/Deact) ");
3117 break;
3118 case SCELL_ACTIVATION_DEACTIVATION_4_LCID:
3120 static int * const scell_act_deact_1_flags[] = {
3121 &hf_mac_nr_control_scell_act_deact_cell7,
3122 &hf_mac_nr_control_scell_act_deact_cell6,
3123 &hf_mac_nr_control_scell_act_deact_cell5,
3124 &hf_mac_nr_control_scell_act_deact_cell4,
3125 &hf_mac_nr_control_scell_act_deact_cell3,
3126 &hf_mac_nr_control_scell_act_deact_cell2,
3127 &hf_mac_nr_control_scell_act_deact_cell1,
3128 &hf_mac_nr_control_scell_act_deact_reserved,
3129 NULL
3131 static int * const scell_act_deact_2_flags[] = {
3132 &hf_mac_nr_control_scell_act_deact_cell15,
3133 &hf_mac_nr_control_scell_act_deact_cell14,
3134 &hf_mac_nr_control_scell_act_deact_cell13,
3135 &hf_mac_nr_control_scell_act_deact_cell12,
3136 &hf_mac_nr_control_scell_act_deact_cell11,
3137 &hf_mac_nr_control_scell_act_deact_cell10,
3138 &hf_mac_nr_control_scell_act_deact_cell9,
3139 &hf_mac_nr_control_scell_act_deact_cell8,
3140 NULL
3142 static int * const scell_act_deact_3_flags[] = {
3143 &hf_mac_nr_control_scell_act_deact_cell23,
3144 &hf_mac_nr_control_scell_act_deact_cell22,
3145 &hf_mac_nr_control_scell_act_deact_cell21,
3146 &hf_mac_nr_control_scell_act_deact_cell20,
3147 &hf_mac_nr_control_scell_act_deact_cell19,
3148 &hf_mac_nr_control_scell_act_deact_cell18,
3149 &hf_mac_nr_control_scell_act_deact_cell17,
3150 &hf_mac_nr_control_scell_act_deact_cell16,
3151 NULL
3153 static int * const scell_act_deact_4_flags[] = {
3154 &hf_mac_nr_control_scell_act_deact_cell31,
3155 &hf_mac_nr_control_scell_act_deact_cell30,
3156 &hf_mac_nr_control_scell_act_deact_cell29,
3157 &hf_mac_nr_control_scell_act_deact_cell28,
3158 &hf_mac_nr_control_scell_act_deact_cell27,
3159 &hf_mac_nr_control_scell_act_deact_cell26,
3160 &hf_mac_nr_control_scell_act_deact_cell25,
3161 &hf_mac_nr_control_scell_act_deact_cell24,
3162 NULL
3164 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, scell_act_deact_1_flags, ENC_NA);
3165 offset++;
3166 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, scell_act_deact_2_flags, ENC_NA);
3167 offset++;
3168 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, scell_act_deact_3_flags, ENC_NA);
3169 offset++;
3170 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, scell_act_deact_4_flags, ENC_NA);
3171 offset++;
3173 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo,
3174 "(SCell Act/Deact 4) ");
3176 break;
3177 case SCELL_ACTIVATION_DEACTIVATION_1_LCID:
3179 static int * const scell_act_deact_1_flags[] = {
3180 &hf_mac_nr_control_scell_act_deact_cell7,
3181 &hf_mac_nr_control_scell_act_deact_cell6,
3182 &hf_mac_nr_control_scell_act_deact_cell5,
3183 &hf_mac_nr_control_scell_act_deact_cell4,
3184 &hf_mac_nr_control_scell_act_deact_cell3,
3185 &hf_mac_nr_control_scell_act_deact_cell2,
3186 &hf_mac_nr_control_scell_act_deact_cell1,
3187 &hf_mac_nr_control_scell_act_deact_reserved,
3188 NULL
3190 proto_tree_add_bitmask_list(subheader_tree, tvb, offset, 1, scell_act_deact_1_flags, ENC_NA);
3191 offset++;
3193 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo, "(SCell Act/Deact 1) ");
3195 break;
3196 case LONG_DRX_COMMAND_LCID:
3197 /* Fixed size of zero bits */
3198 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo, "(Long DRX) ");
3199 break;
3200 case DRX_COMMAND_LCID:
3201 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo, "(DRX) ");
3202 break;
3203 case TIMING_ADVANCE_COMMAND_LCID:
3204 /* TAG ID (2 bits) */
3205 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_timing_advance_tagid,
3206 tvb, offset, 1, ENC_BIG_ENDIAN, &ta_tag_id);
3208 /* Timing Advance Command (6 bits) */
3209 proto_tree_add_item_ret_uint(subheader_tree, hf_mac_nr_control_timing_advance_command,
3210 tvb, offset, 1, ENC_BIG_ENDIAN, &ta_ta);
3211 offset++;
3213 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo,
3214 "(TAG=%u TA=%u) ", ta_tag_id, ta_ta);
3215 break;
3216 case UE_CONTENTION_RESOLUTION_IDENTITY_LCID:
3217 proto_tree_add_item(subheader_tree, hf_mac_nr_control_ue_contention_resolution_identity,
3218 tvb, offset, 6, ENC_NA);
3219 offset += 6;
3220 write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo, "(Contention Resolution) ");
3221 break;
3222 case PADDING_LCID:
3224 /* The rest of the PDU is padding */
3225 int pad_len = tvb_reported_length_remaining(tvb, offset);
3226 if (pad_len > 0)
3227 proto_tree_add_item(subheader_tree, hf_mac_nr_padding, tvb, offset, -1, ENC_NA);
3228 write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(Padding %u bytes) ", pad_len);
3229 /* Move to the end of the frame */
3230 offset = tvb_reported_length(tvb);
3232 break;
3237 /* Set subheader extent here */
3238 proto_item_set_end(subheader_ti, tvb, offset);
3240 } while (tvb_reported_length_remaining(tvb, offset));
3242 return offset;
3246 /*****************************/
3247 /* Main dissection function. */
3248 static int dissect_mac_nr(tvbuff_t *tvb, packet_info *pinfo,
3249 proto_tree *tree, void* data _U_)
3251 proto_tree *mac_nr_tree;
3252 proto_item *pdu_ti;
3253 proto_tree *context_tree;
3254 proto_item *context_ti, *ti;
3255 int offset = 0;
3256 struct mac_nr_info *p_mac_nr_info;
3258 /* Allocate and zero tap struct */
3259 mac_3gpp_tap_info *tap_info = wmem_new0(wmem_file_scope(), mac_3gpp_tap_info);
3260 tap_info->rat = MAC_RAT_NR;
3262 /* Set protocol name */
3263 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAC-NR");
3265 /* Create protocol tree */
3266 pdu_ti = proto_tree_add_item(tree, proto_mac_nr, tvb, offset, tvb_reported_length(tvb), ENC_NA);
3267 proto_item_append_text(pdu_ti, " ");
3268 mac_nr_tree = proto_item_add_subtree(pdu_ti, ett_mac_nr);
3270 /* Look for packet info! */
3271 p_mac_nr_info = (mac_nr_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_mac_nr, 0);
3273 /* Can't dissect anything without it... */
3274 if (p_mac_nr_info == NULL) {
3275 proto_tree_add_expert(mac_nr_tree, pinfo, &ei_mac_nr_no_per_frame_data, tvb, offset, -1);
3276 return 0;
3279 /* Clear info column */
3280 col_clear(pinfo->cinfo, COL_INFO);
3282 /* Restart this count */
3283 s_number_of_rlc_pdus_shown = 0;
3286 /*****************************************/
3287 /* Show context information */
3289 /* Create context root */
3290 context_ti = proto_tree_add_string_format(mac_nr_tree, hf_mac_nr_context,
3291 tvb, offset, 0, "", "Context");
3292 context_tree = proto_item_add_subtree(context_ti, ett_mac_nr_context);
3293 proto_item_set_generated(context_ti);
3295 /* Radio type */
3296 ti = proto_tree_add_uint(context_tree, hf_mac_nr_context_radio_type,
3297 tvb, 0, 0, p_mac_nr_info->radioType);
3298 proto_item_set_generated(ti);
3300 /* Direction */
3301 ti = proto_tree_add_uint(context_tree, hf_mac_nr_context_direction,
3302 tvb, 0, 0, p_mac_nr_info->direction);
3303 proto_item_set_generated(ti);
3305 /* RNTI type and value */
3306 if (p_mac_nr_info->rntiType != NO_RNTI) {
3307 ti = proto_tree_add_uint(context_tree, hf_mac_nr_context_rnti,
3308 tvb, 0, 0, p_mac_nr_info->rnti);
3309 proto_item_set_generated(ti);
3310 proto_item_append_text(context_ti, " (RNTI=%u)", p_mac_nr_info->rnti);
3313 ti = proto_tree_add_uint(context_tree, hf_mac_nr_context_rnti_type,
3314 tvb, 0, 0, p_mac_nr_info->rntiType);
3315 proto_item_set_generated(ti);
3317 /* UEId */
3318 if (p_mac_nr_info->ueid != 0) {
3319 ti = proto_tree_add_uint(context_tree, hf_mac_nr_context_ueid,
3320 tvb, 0, 0, p_mac_nr_info->ueid);
3321 proto_item_set_generated(ti);
3324 if (p_mac_nr_info->sfnSlotInfoPresent) {
3325 ti = proto_tree_add_uint(context_tree, hf_mac_nr_context_sysframe_number,
3326 tvb, 0, 0, p_mac_nr_info->sysframeNumber);
3327 proto_item_set_generated(ti);
3328 ti = proto_tree_add_uint(context_tree, hf_mac_nr_context_slot_number,
3329 tvb, 0, 0, p_mac_nr_info->slotNumber);
3330 proto_item_set_generated(ti);
3333 if (p_mac_nr_info->rntiType == C_RNTI || p_mac_nr_info->rntiType == CS_RNTI) {
3334 /* Harqid */
3335 ti = proto_tree_add_uint(context_tree, hf_mac_nr_context_harqid,
3336 tvb, 0, 0, p_mac_nr_info->harqid);
3337 proto_item_set_generated(ti);
3339 if (p_mac_nr_info->direction == DIRECTION_UPLINK) {
3340 /* Type 2 other */
3341 ti = proto_tree_add_boolean(context_tree, hf_mac_nr_context_phr_type2_othercell,
3342 tvb, 0, 0, p_mac_nr_info->phr_type2_othercell);
3343 proto_item_set_generated(ti);
3347 /* Set context-info parts of tap struct */
3348 tap_info->rnti = p_mac_nr_info->rnti;
3349 tap_info->ueid = p_mac_nr_info->ueid;
3350 tap_info->rntiType = p_mac_nr_info->rntiType;
3351 tap_info->isPredefinedData = false;
3352 tap_info->isPHYRetx = false; /* don't really know */
3353 tap_info->crcStatusValid = false; /* don't really know */
3354 tap_info->direction = p_mac_nr_info->direction;
3356 tap_info->mac_time = pinfo->abs_ts;
3357 tap_info->single_number_of_bytes = tvb_reported_length_remaining(tvb, offset);
3359 /* Dissect the MAC PDU itself. Format depends upon RNTI type. */
3360 switch (p_mac_nr_info->rntiType) {
3362 case P_RNTI:
3363 /* PCCH PDU */
3364 dissect_pcch(tvb, pinfo, mac_nr_tree, pdu_ti, offset, p_mac_nr_info, tap_info);
3365 break;
3367 case RA_RNTI:
3368 /* RAR PDU */
3369 dissect_rar(tvb, pinfo, mac_nr_tree, pdu_ti, offset, p_mac_nr_info, tap_info);
3370 break;
3372 case MSGB_RNTI:
3373 /* MSGB PDU */
3374 dissect_msgb(tvb, pinfo, mac_nr_tree, pdu_ti, offset, p_mac_nr_info, tap_info);
3375 break;
3377 case C_RNTI:
3378 case CS_RNTI:
3379 /* Can be UL-SCH or DL-SCH */
3380 dissect_ulsch_or_dlsch(tvb, pinfo, mac_nr_tree, pdu_ti, offset,
3381 p_mac_nr_info, tap_info);
3382 break;
3384 case SI_RNTI:
3385 /* BCCH over DL-SCH */
3386 dissect_bcch(tvb, pinfo, mac_nr_tree, pdu_ti, offset,
3387 p_mac_nr_info, tap_info);
3388 break;
3390 case NO_RNTI:
3391 /* Must be BCCH over BCH... */
3392 dissect_bcch(tvb, pinfo, mac_nr_tree, pdu_ti, offset,
3393 p_mac_nr_info, tap_info);
3394 break;
3396 default:
3397 break;
3400 tap_queue_packet(mac_nr_tap, pinfo, tap_info);
3402 return -1;
3405 /* Heuristic dissector looks for supported framing protocol (see header file for details) */
3406 static bool dissect_mac_nr_heur(tvbuff_t *tvb, packet_info *pinfo,
3407 proto_tree *tree, void *data _U_)
3409 int offset = 0;
3410 mac_nr_info *p_mac_nr_info;
3411 tvbuff_t *mac_tvb;
3413 /* Needs to be at least as long as:
3414 - the signature string
3415 - fixed header bytes
3416 - tag for data
3417 - at least one byte of MAC PDU payload */
3418 if (tvb_captured_length_remaining(tvb, offset) < (int)(strlen(MAC_NR_START_STRING)+3+2)) {
3419 return false;
3422 /* OK, compare with signature string */
3423 if (tvb_strneql(tvb, offset, MAC_NR_START_STRING, strlen(MAC_NR_START_STRING)) != 0) {
3424 return false;
3426 offset += (int)strlen(MAC_NR_START_STRING);
3428 /* If redissecting, use previous info struct (if available) */
3429 p_mac_nr_info = (mac_nr_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_mac_nr, 0);
3430 if (p_mac_nr_info == NULL) {
3431 /* Allocate new info struct for this frame */
3432 p_mac_nr_info = wmem_new0(wmem_file_scope(), mac_nr_info);
3433 /* Dissect the fields to populate p_mac_nr */
3434 if(!dissect_mac_nr_context_fields(p_mac_nr_info, tvb, pinfo, tree, &offset)){
3435 return true;
3437 /* Store info in packet */
3438 p_add_proto_data(wmem_file_scope(), pinfo, proto_mac_nr, 0, p_mac_nr_info);
3440 else {
3441 offset = tvb_reported_length(tvb) - p_mac_nr_info->length;
3444 /**************************************/
3445 /* OK, now dissect as MAC NR */
3447 /* Create tvb that starts at actual MAC PDU */
3448 mac_tvb = tvb_new_subset_remaining(tvb, offset);
3449 dissect_mac_nr(mac_tvb, pinfo, tree, NULL);
3451 return true;
3454 /* Dissect context fields in the format described in packet-mac-nr.h.
3455 Return true if the necessary information was successfully found */
3456 bool dissect_mac_nr_context_fields(struct mac_nr_info *p_mac_nr_info, tvbuff_t *tvb,
3457 packet_info *pinfo, proto_tree *tree, int *p_offset)
3459 int offset = *p_offset;
3460 uint8_t tag = 0;
3462 /* Read fixed fields */
3463 p_mac_nr_info->radioType = tvb_get_uint8(tvb, offset++);
3464 p_mac_nr_info->direction = tvb_get_uint8(tvb, offset++);
3465 p_mac_nr_info->rntiType = tvb_get_uint8(tvb, offset++);
3467 /* Read optional fields */
3468 do {
3469 /* Process next tag */
3470 tag = tvb_get_uint8(tvb, offset++);
3471 switch (tag) {
3472 case MAC_NR_RNTI_TAG:
3473 p_mac_nr_info->rnti = tvb_get_ntohs(tvb, offset);
3474 offset += 2;
3475 break;
3476 case MAC_NR_UEID_TAG:
3477 p_mac_nr_info->ueid = tvb_get_ntohs(tvb, offset);
3478 offset += 2;
3479 break;
3480 case MAC_NR_HARQID:
3481 p_mac_nr_info->harqid = tvb_get_uint8(tvb, offset);
3482 offset++;
3483 break;
3484 case MAC_NR_FRAME_SUBFRAME_TAG:
3485 /* deprecated */
3486 offset += 2;
3487 break;
3488 case MAC_NR_PHR_TYPE2_OTHERCELL_TAG:
3489 p_mac_nr_info->phr_type2_othercell = tvb_get_uint8(tvb, offset);
3490 offset++;
3491 break;
3492 case MAC_NR_FRAME_SLOT_TAG:
3493 p_mac_nr_info->sfnSlotInfoPresent = true;
3494 p_mac_nr_info->sysframeNumber = tvb_get_ntohs(tvb, offset);
3495 p_mac_nr_info->slotNumber = tvb_get_ntohs(tvb, offset+2);
3496 offset += 4;
3497 break;
3498 case MAC_NR_PAYLOAD_TAG:
3499 /* Have reached data, so set payload length and get out of loop */
3500 /* TODO: this is not correct if there is padding which isn't in frame */
3501 p_mac_nr_info->length = tvb_reported_length_remaining(tvb, offset);
3502 continue;
3503 default:
3504 /* It must be a recognised tag */
3506 proto_item *ti;
3507 proto_tree *subtree;
3509 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAC-NR");
3510 col_clear(pinfo->cinfo, COL_INFO);
3511 ti = proto_tree_add_item(tree, proto_mac_nr, tvb, offset, tvb_reported_length(tvb), ENC_NA);
3512 subtree = proto_item_add_subtree(ti, ett_mac_nr);
3513 proto_tree_add_expert(subtree, pinfo, &ei_mac_nr_unknown_udp_framing_tag,
3514 tvb, offset-1, 1);
3516 wmem_free(wmem_file_scope(), p_mac_nr_info);
3517 return true;
3519 } while (tag != MAC_NR_PAYLOAD_TAG);
3521 /* Pass out where offset is now */
3522 *p_offset = offset;
3524 return true;
3527 /* Callback used as part of configuring a channel mapping using UAT */
3528 static void* lcid_drb_mapping_copy_cb(void* dest, const void* orig, size_t len _U_)
3530 const lcid_drb_mapping_t *o = (const lcid_drb_mapping_t *)orig;
3531 lcid_drb_mapping_t *d = (lcid_drb_mapping_t *)dest;
3533 /* Copy all items over */
3534 d->lcid = o->lcid;
3535 d->drbid = o->drbid;
3536 d->bearer_type_ul = o->bearer_type_ul;
3537 d->bearer_type_dl = o->bearer_type_dl;
3539 return d;
3542 static void set_bearer_type(dynamic_lcid_drb_mapping_t *mapping, uint8_t rlcMode, uint8_t rlcSnLength, uint8_t direction)
3544 /* Point to field for appropriate direction */
3545 rlc_bearer_type_t *type_var = (direction == DIRECTION_UPLINK) ?
3546 &mapping->bearer_type_ul :
3547 &mapping->bearer_type_dl;
3549 switch (rlcMode) {
3550 case RLC_AM_MODE:
3551 switch (rlcSnLength) {
3552 case 12:
3553 *type_var = rlcAM12;
3554 break;
3555 case 18:
3556 *type_var = rlcAM18;
3557 break;
3559 default:
3560 break;
3562 break;
3563 case RLC_UM_MODE:
3564 switch (rlcSnLength) {
3565 case 6:
3566 *type_var = rlcUM6;
3567 break;
3568 case 12:
3569 *type_var = rlcUM12;
3570 break;
3572 default:
3573 break;
3575 break;
3577 default:
3578 break;
3583 /* Set LCID -> RLC channel mappings from signalling protocol (i.e. RRC or similar). */
3584 void set_mac_nr_bearer_mapping(nr_drb_mac_rlc_mapping_t *drb_mapping)
3586 ue_dynamic_drb_mappings_t *ue_mappings;
3587 uint8_t lcid = 0;
3589 /* Check lcid range */
3590 if (drb_mapping->lcid_present) {
3591 lcid = drb_mapping->lcid;
3593 /* Ignore if LCID is out of range. */
3594 if ((lcid < 3) || (lcid > 32)) {
3595 return;
3599 /* Look for existing UE entry */
3600 ue_mappings = (ue_dynamic_drb_mappings_t *)g_hash_table_lookup(mac_nr_ue_bearers_hash,
3601 GUINT_TO_POINTER((unsigned)drb_mapping->ueid));
3602 if (!ue_mappings) {
3603 /* If not found, create & add to table */
3604 ue_mappings = wmem_new0(wmem_file_scope(), ue_dynamic_drb_mappings_t);
3605 g_hash_table_insert(mac_nr_ue_bearers_hash,
3606 GUINT_TO_POINTER((unsigned)drb_mapping->ueid),
3607 ue_mappings);
3610 /* If lcid wasn't supplied, need to try to look up from drbid */
3611 if ((lcid == 0) && (drb_mapping->rbid <= 32)) {
3612 lcid = ue_mappings->drb_to_lcid_mappings[drb_mapping->rbid];
3614 if (lcid == 0) {
3615 /* Still no lcid - give up */
3616 return;
3619 /* Set array entry */
3620 ue_mappings->mapping[lcid].valid = true;
3621 ue_mappings->mapping[lcid].drbid = drb_mapping->rbid;
3622 ue_mappings->drb_to_lcid_mappings[drb_mapping->rbid] = lcid;
3624 /* Fill in available RLC info */
3625 if (drb_mapping->rlcMode_present) {
3626 if (drb_mapping->rlcUlSnLength_present) {
3627 set_bearer_type(&ue_mappings->mapping[lcid], drb_mapping->rlcMode, drb_mapping->rlcUlSnLength, DIRECTION_UPLINK);
3629 if (drb_mapping->rlcDlSnLength_present) {
3630 set_bearer_type(&ue_mappings->mapping[lcid], drb_mapping->rlcMode, drb_mapping->rlcDlSnLength, DIRECTION_DOWNLINK);
3635 void set_mac_nr_srb3_in_use(uint16_t ueid)
3637 ue_dynamic_drb_mappings_t *ue_mappings;
3639 /* Look for existing UE entry */
3640 ue_mappings = (ue_dynamic_drb_mappings_t *)g_hash_table_lookup(mac_nr_ue_bearers_hash,
3641 GUINT_TO_POINTER(ueid));
3642 if (!ue_mappings) {
3643 /* If not found, create & add to table */
3644 ue_mappings = wmem_new0(wmem_file_scope(), ue_dynamic_drb_mappings_t);
3645 g_hash_table_insert(mac_nr_ue_bearers_hash,
3646 GUINT_TO_POINTER(ueid),
3647 ue_mappings);
3649 ue_mappings->srb3_set = true;
3652 void set_mac_nr_srb4_in_use(uint16_t ueid)
3654 ue_dynamic_drb_mappings_t *ue_mappings;
3656 /* Look for existing UE entry */
3657 ue_mappings = (ue_dynamic_drb_mappings_t *)g_hash_table_lookup(mac_nr_ue_bearers_hash,
3658 GUINT_TO_POINTER(ueid));
3659 if (!ue_mappings) {
3660 /* If not found, create & add to table */
3661 ue_mappings = wmem_new0(wmem_file_scope(), ue_dynamic_drb_mappings_t);
3662 g_hash_table_insert(mac_nr_ue_bearers_hash,
3663 GUINT_TO_POINTER(ueid),
3664 ue_mappings);
3666 ue_mappings->srb4_set = true;
3671 /* Function to be called from outside this module (e.g. in a plugin) to get per-packet data */
3672 mac_nr_info *get_mac_nr_proto_data(packet_info *pinfo)
3674 return (mac_nr_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_mac_nr, 0);
3677 /* Function to be called from outside this module (e.g. in a plugin) to set per-packet data */
3678 void set_mac_nr_proto_data(packet_info *pinfo, mac_nr_info *p_mac_nr_info)
3680 p_add_proto_data(wmem_file_scope(), pinfo, proto_mac_nr, 0, p_mac_nr_info);
3683 /* Initializes the hash tables each time a new
3684 * file is loaded or re-loaded in wireshark */
3685 static void mac_nr_init_protocol(void)
3687 mac_nr_ue_bearers_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
3690 static void mac_nr_cleanup_protocol(void)
3692 g_hash_table_destroy(mac_nr_ue_bearers_hash);
3697 void proto_register_mac_nr(void)
3699 static hf_register_info hf[] =
3701 /**********************************/
3702 /* Items for decoding context */
3703 { &hf_mac_nr_context,
3704 { "Context",
3705 "mac-nr.context", FT_STRING, BASE_NONE, NULL, 0x0,
3706 NULL, HFILL
3709 { &hf_mac_nr_context_radio_type,
3710 { "Radio Type",
3711 "mac-nr.radio-type", FT_UINT8, BASE_DEC, VALS(radio_type_vals), 0x0,
3712 NULL, HFILL
3715 { &hf_mac_nr_context_direction,
3716 { "Direction",
3717 "mac-nr.direction", FT_UINT8, BASE_DEC, VALS(direction_vals), 0x0,
3718 "Direction of message", HFILL
3721 { &hf_mac_nr_context_rnti,
3722 { "RNTI",
3723 "mac-nr.rnti", FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
3724 "RNTI associated with message", HFILL
3727 { &hf_mac_nr_context_rnti_type,
3728 { "RNTI Type",
3729 "mac-nr.rnti-type", FT_UINT8, BASE_DEC, VALS(rnti_type_vals), 0x0,
3730 "Type of RNTI associated with message", HFILL
3733 { &hf_mac_nr_context_ueid,
3734 { "UEId",
3735 "mac-nr.ueid", FT_UINT16, BASE_DEC, NULL, 0x0,
3736 "User Equipment Identifier associated with message", HFILL
3739 { &hf_mac_nr_context_sysframe_number,
3740 { "System Frame Number",
3741 "mac-nr.sfn", FT_UINT16, BASE_DEC, NULL, 0x0,
3742 "System Frame Number associated with message", HFILL
3745 { &hf_mac_nr_context_slot_number,
3746 { "Slot",
3747 "mac-nr.slot", FT_UINT16, BASE_DEC, NULL, 0x0,
3748 "Slot number associated with message", HFILL
3751 { &hf_mac_nr_context_harqid,
3752 { "HarqId",
3753 "mac-nr.harqid", FT_UINT8, BASE_DEC, NULL, 0x0,
3754 "HARQ Identifier", HFILL
3757 { &hf_mac_nr_context_bcch_transport_channel,
3758 { "Transport channel",
3759 "mac-nr.bcch-transport-channel", FT_UINT8, BASE_DEC, VALS(bcch_transport_channel_vals), 0x0,
3760 "Transport channel BCCH data was carried on", HFILL
3763 { &hf_mac_nr_context_phr_type2_othercell,
3764 { "PHR Type2 other cell PHR",
3765 "mac-nr.type2-other-cell", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3766 NULL, HFILL
3770 { &hf_mac_nr_subheader,
3771 { "Subheader",
3772 "mac-nr.subheader", FT_STRING, BASE_NONE, NULL, 0x0,
3773 NULL, HFILL
3776 { &hf_mac_nr_subheader_reserved,
3777 { "Reserved",
3778 "mac-nr.subheader.reserved", FT_UINT8, BASE_HEX, NULL, 0x0,
3779 NULL, HFILL
3782 { &hf_mac_nr_subheader_f,
3783 { "Format",
3784 "mac-nr.subheader.f", FT_BOOLEAN, 8, TFS(&subheader_f_vals), 0x40,
3785 "Format of subheader length field", HFILL
3788 { &hf_mac_nr_subheader_length_1_byte,
3789 { "SDU Length",
3790 "mac-nr.subheader.sdu-length", FT_UINT8, BASE_DEC, NULL, 0x0,
3791 NULL, HFILL
3794 { &hf_mac_nr_subheader_length_2_bytes,
3795 { "SDU Length",
3796 "mac-nr.subheader.sdu-length", FT_UINT16, BASE_DEC, NULL, 0x0,
3797 NULL, HFILL
3800 /* Will be hidden, but useful for bi-directional filtering */
3801 { &hf_mac_nr_lcid,
3802 { "LCID",
3803 "mac-nr.lcid", FT_UINT8, BASE_HEX, NULL, 0x3f,
3804 "Logical Channel Identifier", HFILL
3807 { &hf_mac_nr_ulsch_lcid,
3808 { "LCID",
3809 "mac-nr.ulsch.lcid", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ulsch_lcid_vals_ext, 0x3f,
3810 "UL-SCH Logical Channel Identifier", HFILL
3813 { &hf_mac_nr_dlsch_lcid,
3814 { "LCID",
3815 "mac-nr.dlsch.lcid", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &dlsch_lcid_vals_ext, 0x3f,
3816 "DL-SCH Logical Channel Identifier", HFILL
3819 { &hf_mac_nr_dlsch_elcid_2oct,
3820 { "eLCID2oct",
3821 "mac-nr.dlsch.elcid-2oct", FT_UINT16, BASE_DEC, NULL, 0x0,
3822 NULL, HFILL
3825 { &hf_mac_nr_ulsch_elcid_2oct,
3826 { "eLCID2oct",
3827 "mac-nr.dlsch.elcid-2oct", FT_UINT16, BASE_DEC, NULL, 0x0,
3828 NULL, HFILL
3831 { &hf_mac_nr_dlsch_elcid_1oct,
3832 { "eLCID",
3833 "mac-nr.dlsch.elcid-1oct", FT_UINT8,BASE_DEC|BASE_EXT_STRING,&dlsch_elcid_vals_ext, 0x0,
3834 NULL, HFILL
3837 { &hf_mac_nr_ulsch_elcid_1oct,
3838 { "eLCID",
3839 "mac-nr.dlsch.elcid-1oct", FT_UINT8,BASE_DEC|BASE_EXT_STRING,&ulsch_elcid_vals_ext, 0x0,
3840 NULL, HFILL
3843 { &hf_mac_nr_ulsch_sdu,
3844 { "UL-SCH SDU",
3845 "mac-nr.ulsch.sdu", FT_BYTES, BASE_NONE, NULL, 0x0,
3846 NULL, HFILL
3849 { &hf_mac_nr_dlsch_sdu,
3850 { "DL-SCH SDU",
3851 "mac-nr.dlsch.sdu", FT_BYTES, BASE_NONE, NULL, 0x0,
3852 NULL, HFILL
3855 { &hf_mac_nr_bcch_pdu,
3856 { "BCCH PDU",
3857 "mac-nr.bcch.pdu", FT_BYTES, BASE_NONE, NULL, 0x0,
3858 NULL, HFILL
3861 { &hf_mac_nr_pcch_pdu,
3862 { "PCCH PDU",
3863 "mac-nr.pcch.pdu", FT_BYTES, BASE_NONE, NULL, 0x0,
3864 NULL, HFILL
3869 /*********************************/
3870 /* RAR fields */
3871 { &hf_mac_nr_rar,
3872 { "RAR",
3873 "mac-nr.rar", FT_NONE, BASE_NONE, NULL, 0x0,
3874 NULL, HFILL
3877 { &hf_mac_nr_rar_e,
3878 { "Extension",
3879 "mac-nr.rar.e", FT_BOOLEAN, 8, TFS(&rar_ext_vals), 0x80,
3880 NULL, HFILL
3883 { &hf_mac_nr_rar_t,
3884 { "Type",
3885 "mac-nr.rar.t", FT_BOOLEAN, 8, TFS(&rar_type_vals), 0x40,
3886 NULL, HFILL
3889 { &hf_mac_nr_rar_reserved,
3890 { "Reserved",
3891 "mac-nr.rar.reserved", FT_UINT8, BASE_DEC, NULL, 0x30,
3892 NULL, HFILL
3895 { &hf_mac_nr_rar_reserved1,
3896 { "Reserved",
3897 "mac-nr.rar.reserved", FT_UINT8, BASE_DEC, NULL, 0x80,
3898 NULL, HFILL
3902 { &hf_mac_nr_rar_subheader,
3903 { "Subheader",
3904 "mac-nr.rar.subheader", FT_STRING, BASE_NONE, NULL, 0x0,
3905 NULL, HFILL
3908 { &hf_mac_nr_rar_bi,
3909 { "Backoff Indicator",
3910 "mac-nr.rar.bi", FT_UINT8, BASE_DEC, VALS(rar_bi_vals), 0x0f,
3911 NULL, HFILL
3914 { &hf_mac_nr_rar_rapid,
3915 { "RAPID",
3916 "mac-nr.rar.rapid", FT_UINT8, BASE_DEC, NULL, 0x3f,
3917 NULL, HFILL
3920 { &hf_mac_nr_rar_ta,
3921 { "Timing Advance",
3922 "mac-nr.rar.ta", FT_UINT16, BASE_DEC, NULL, 0x7ff8,
3923 NULL, HFILL
3927 { &hf_mac_nr_rar_grant,
3928 { "Grant",
3929 "mac-nr.rar.grant", FT_UINT32, BASE_HEX, NULL, 0x07ffffff,
3930 "UL Grant details", HFILL
3933 { &hf_mac_nr_rar_grant_hopping,
3934 { "Frequency hopping flag",
3935 "mac-nr.rar.grant.hopping", FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x04000000,
3936 NULL, HFILL
3939 { &hf_mac_nr_rar_grant_fra,
3940 { "Msg3 PUSCH frequency resource allocation",
3941 "mac-nr.rar.grant.fra", FT_UINT32, BASE_DEC, NULL, 0x03fff000,
3942 NULL, HFILL
3945 { &hf_mac_nr_rar_grant_tsa,
3946 { "Msg3 PUSCH time resource allocation",
3947 "mac-nr.rar.grant.tsa", FT_UINT32, BASE_DEC, NULL, 0x00000f00,
3948 NULL, HFILL
3951 { &hf_mac_nr_rar_grant_mcs,
3952 { "MCS",
3953 "mac-nr.rar.grant.mcs", FT_UINT32, BASE_DEC, NULL, 0x000000f0,
3954 NULL, HFILL
3957 { &hf_mac_nr_rar_grant_tcsp,
3958 { "TPC command for Msg3 PUSCH",
3959 "mac-nr.rar.grant.tcsp", FT_UINT32, BASE_DEC, VALS(tpc_command_vals), 0x0000000e,
3960 NULL, HFILL
3963 { &hf_mac_nr_rar_grant_csi,
3964 { "CSI request",
3965 "mac-nr.rar.grant.csi", FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
3966 NULL, HFILL
3969 { &hf_mac_nr_rar_temp_crnti,
3970 { "Temporary C-RNTI",
3971 "mac-nr.rar.temp_crnti", FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
3972 NULL, HFILL
3976 /* MSGB */
3977 { &hf_mac_nr_msgb,
3978 { "MSGB",
3979 "mac-nr.msgb", FT_NONE, BASE_NONE, NULL, 0x0,
3980 NULL, HFILL
3983 { &hf_mac_nr_msgb_subheader,
3984 { "Subheader",
3985 "mac-nr.msgb.subheader", FT_STRING, BASE_NONE, NULL, 0x0,
3986 NULL, HFILL
3989 { &hf_mac_nr_msgb_e,
3990 { "Extension",
3991 "mac-nr.msgb.e", FT_BOOLEAN, 8, TFS(&rar_ext_vals), 0x80,
3992 NULL, HFILL
3995 { &hf_mac_nr_msgb_t1,
3996 { "t1",
3997 "mac-nr.msgb.t1", FT_BOOLEAN, 8, TFS(&msgb_t1_vals), 0x40,
3998 NULL, HFILL
4001 { &hf_mac_nr_msgb_t2,
4002 { "t2",
4003 "mac-nr.msgb.t2", FT_BOOLEAN, 8, TFS(&msgb_t2_vals), 0x20,
4004 NULL, HFILL
4007 { &hf_mac_nr_msgb_s,
4008 { "s",
4009 "mac-nr.msgb.s", FT_BOOLEAN, 8, TFS(&msgb_s_vals), 0x10,
4010 "MAC SDU indicator", HFILL
4014 { &hf_mac_nr_msgb_reserved,
4015 { "Reserved",
4016 "mac-nr.msgb.reserved", FT_UINT8, BASE_DEC, NULL, 0x10,
4017 NULL, HFILL
4020 { &hf_mac_nr_msgb_reserved2,
4021 { "Reserved",
4022 "mac-nr.msgb.reserved", FT_UINT8, BASE_DEC, NULL, 0x0f,
4023 NULL, HFILL
4026 { &hf_mac_nr_msgb_reserved3,
4027 { "Reserved",
4028 "mac-nr.msgb.reserved", FT_UINT8, BASE_DEC, NULL, 0x80,
4029 NULL, HFILL
4032 { &hf_mac_nr_msgb_ta_command,
4033 { "Timing Advance Command",
4034 "mac-nr.msgb.ta-command", FT_UINT16, BASE_DEC, NULL, 0x0fff,
4035 NULL, HFILL
4038 /* TODO: vals from 38.213 [6] */
4039 { &hf_mac_nr_msgb_channelaccess_cpext,
4040 { "ChannelAccess-CPext",
4041 "mac-nr.msgb.channelaccess-cpext", FT_UINT8, BASE_DEC, NULL, 0x60,
4042 NULL, HFILL
4045 /* TODO: vals from 38.213 [6] */
4046 { &hf_mac_nr_msgb_tpc,
4047 { "TPC",
4048 "mac-nr.msgb.tpc", FT_UINT8, BASE_DEC, NULL, 0x18,
4049 "TPC command for the PUCCH resource containing HARQ feedback for MSGB", HFILL
4052 { &hf_mac_nr_msgb_harq_feedback_timing_indicator,
4053 { "HARQ Feedback Timing Indicator",
4054 "mac-nr.msgb.harq-feedback-timing-indicator", FT_UINT8, BASE_DEC, NULL, 0x07,
4055 NULL, HFILL
4058 { &hf_mac_nr_msgb_pucch_resource_indicator,
4059 { "PUCCH Resource Indicator",
4060 "mac-nr.msgb.pucch-resource-indicator", FT_UINT8, BASE_DEC, NULL, 0xf0,
4061 NULL, HFILL
4065 { &hf_mac_nr_padding,
4066 { "Padding",
4067 "mac-nr.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
4068 NULL, HFILL
4072 { &hf_mac_nr_control_crnti,
4073 { "C-RNTI",
4074 "mac-nr.control.crnti", FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
4075 NULL, HFILL
4078 { &hf_mac_nr_control_ue_contention_resolution_identity,
4079 { "UE Contention Resolution Identity",
4080 "mac-nr.control.ue-contention-resolution.identity", FT_BYTES, BASE_NONE, NULL, 0x0,
4081 NULL, HFILL
4084 { &hf_mac_nr_control_timing_advance_tagid,
4085 { "TAG ID",
4086 "mac-nr.control.timing-advance.tag-id", FT_UINT8, BASE_DEC, NULL, 0xc0,
4087 NULL, HFILL
4090 { &hf_mac_nr_control_timing_advance_command,
4091 { "Timing Advance Command",
4092 "mac-nr.control.timing-advance.command", FT_UINT8, BASE_DEC, NULL, 0x3f,
4093 NULL, HFILL
4096 { &hf_mac_nr_control_se_phr_reserved,
4097 { "Reserved",
4098 "mac-nr.control.se-phr.reserved", FT_UINT8, BASE_HEX, NULL, 0xc0,
4099 NULL, HFILL
4102 { &hf_mac_nr_control_se_phr_ph,
4103 { "Power Headroom",
4104 "mac-nr.control.se-phr.ph", FT_UINT8, BASE_CUSTOM, CF_FUNC(mac_nr_phr_fmt), 0x3f,
4105 NULL, HFILL
4108 { &hf_mac_nr_control_se_phr_pcmax_f_c,
4109 { "Pcmax,c,f",
4110 "mac-nr.control.se-phr.pcmax_f_c", FT_UINT8, BASE_CUSTOM, CF_FUNC(mac_nr_pcmax_f_c_fmt), 0x3f,
4111 NULL, HFILL
4115 { &hf_mac_nr_control_recommended_bit_rate_query_lcid,
4116 { "LCID",
4117 "mac-nr.control.recommended-bit-rate-query.lcid", FT_UINT8, BASE_DEC, NULL, 0xfc,
4118 NULL, HFILL
4121 { &hf_mac_nr_control_recommended_bit_rate_query_dir,
4122 { "Direction",
4123 "mac-nr.control.recommended-bit-rate-query.dir", FT_BOOLEAN, 8, TFS(&tfs_uplink_downlink), 0x02,
4124 NULL, HFILL
4127 { &hf_mac_nr_control_recommended_bit_rate_query_bit_rate,
4128 { "Bit Rate",
4129 "mac-nr.control.recommended-bit-rate-query.bit-rate", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &bit_rate_vals_ext, 0x01f8,
4130 NULL, HFILL
4133 { &hf_mac_nr_control_recommended_bit_rate_query_reserved,
4134 { "Reserved",
4135 "mac-nr.control.recommended-bit-rate-query.reserved", FT_UINT8, BASE_DEC, NULL, 0x07,
4136 NULL, HFILL
4140 { &hf_mac_nr_control_me_phr_c7_flag,
4141 { "C7",
4142 "mac-nr.control.me-phr.c7", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
4143 "SCellIndex 7 PHR report flag", HFILL
4146 { &hf_mac_nr_control_me_phr_c6_flag,
4147 { "C6",
4148 "mac-nr.control.me-phr.c6", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
4149 "SCellIndex 6 PHR report flag", HFILL
4152 { &hf_mac_nr_control_me_phr_c5_flag,
4153 { "C5",
4154 "mac-nr.control.me-phr.c5", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
4155 "SCellIndex 5 PHR report flag", HFILL
4158 { &hf_mac_nr_control_me_phr_c4_flag,
4159 { "C4",
4160 "mac-nr.control.me-phr.c4", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
4161 "SCellIndex 4 PHR report flag", HFILL
4164 { &hf_mac_nr_control_me_phr_c3_flag,
4165 { "C3",
4166 "mac-nr.control.me-phr.c3", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
4167 "SCellIndex 3 PHR report flag", HFILL
4170 { &hf_mac_nr_control_me_phr_c2_flag,
4171 { "C2",
4172 "mac-nr.control.me-phr.c2", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
4173 "SCellIndex 2 PHR report flag", HFILL
4176 { &hf_mac_nr_control_me_phr_c1_flag,
4177 { "C1",
4178 "mac-nr.control.me-phr.c1", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4179 "SCellIndex 1 PHR report flag", HFILL
4182 { &hf_mac_nr_control_me_phr_c15_flag,
4183 { "C15",
4184 "mac-nr.control.me-phr.c15", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
4185 "SCellIndex 15 PHR report flag", HFILL
4188 { &hf_mac_nr_control_me_phr_c14_flag,
4189 { "C14",
4190 "mac-nr.control.me-phr.c14", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
4191 "SCellIndex 14 PHR report flag", HFILL
4194 { &hf_mac_nr_control_me_phr_c13_flag,
4195 { "C13",
4196 "mac-nr.control.me-phr.c13", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
4197 "SCellIndex 13 PHR report flag", HFILL
4200 { &hf_mac_nr_control_me_phr_c12_flag,
4201 { "C12",
4202 "mac-nr.control.me-phr.c12", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
4203 "SCellIndex 12 PHR report flag", HFILL
4206 { &hf_mac_nr_control_me_phr_c11_flag,
4207 { "C11",
4208 "mac-nr.control.me-phr.c11", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
4209 "SCellIndex 11 PHR report flag", HFILL
4212 { &hf_mac_nr_control_me_phr_c10_flag,
4213 { "C10",
4214 "mac-nr.control.me-phr.c10", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
4215 "SCellIndex 10 PHR report flag", HFILL
4218 { &hf_mac_nr_control_me_phr_c9_flag,
4219 { "C9",
4220 "mac-nr.control.me-phr.c9", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4221 "SCellIndex 9 PHR report flag", HFILL
4224 { &hf_mac_nr_control_me_phr_c8_flag,
4225 { "C8",
4226 "mac-nr.control.me-phr.c8", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
4227 "SCellIndex 8 PHR report flag", HFILL
4230 { &hf_mac_nr_control_me_phr_c23_flag,
4231 { "C23",
4232 "mac-nr.control.me-phr.c23", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
4233 "SCellIndex 23 PHR report flag", HFILL
4236 { &hf_mac_nr_control_me_phr_c22_flag,
4237 { "C22",
4238 "mac-nr.control.me-phr.c22", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
4239 "SCellIndex 22 PHR report flag", HFILL
4242 { &hf_mac_nr_control_me_phr_c21_flag,
4243 { "C21",
4244 "mac-nr.control.me-phr.c21", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
4245 "SCellIndex 21 PHR report flag", HFILL
4248 { &hf_mac_nr_control_me_phr_c20_flag,
4249 { "C20",
4250 "mac-nr.control.me-phr.c20", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
4251 "SCellIndex 20 PHR report flag", HFILL
4254 { &hf_mac_nr_control_me_phr_c19_flag,
4255 { "C19",
4256 "mac-nr.control.me-phr.c19", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
4257 "SCellIndex 19 PHR report flag", HFILL
4260 { &hf_mac_nr_control_me_phr_c18_flag,
4261 { "C18",
4262 "mac-nr.control.me-phr.c18", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
4263 "SCellIndex 18 PHR report flag", HFILL
4266 { &hf_mac_nr_control_me_phr_c17_flag,
4267 { "C17",
4268 "mac-nr.control.me-phr.c17", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4269 "SCellIndex 17 PHR report flag", HFILL
4272 { &hf_mac_nr_control_me_phr_c16_flag,
4273 { "C16",
4274 "mac-nr.control.me-phr.c16", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
4275 "SCellIndex 16 PHR report flag", HFILL
4278 { &hf_mac_nr_control_me_phr_c31_flag,
4279 { "C31",
4280 "mac-nr.control.me-phr.c31", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
4281 "SCellIndex 31 PHR report flag", HFILL
4284 { &hf_mac_nr_control_me_phr_c30_flag,
4285 { "C30",
4286 "mac-nr.control.me-phr.c30", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
4287 "SCellIndex 30 PHR report flag", HFILL
4290 { &hf_mac_nr_control_me_phr_c29_flag,
4291 { "C29",
4292 "mac-nr.control.me-phr.c29", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
4293 "SCellIndex 29 PHR report flag", HFILL
4296 { &hf_mac_nr_control_me_phr_c28_flag,
4297 { "C28",
4298 "mac-nr.control.me-phr.c28", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
4299 "SCellIndex 28 PHR report flag", HFILL
4302 { &hf_mac_nr_control_me_phr_c27_flag,
4303 { "C27",
4304 "mac-nr.control.me-phr.c27", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
4305 "SCellIndex 27 PHR report flag", HFILL
4308 { &hf_mac_nr_control_me_phr_c26_flag,
4309 { "C26",
4310 "mac-nr.control.me-phr.c26", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
4311 "SCellIndex 26 PHR report flag", HFILL
4314 { &hf_mac_nr_control_me_phr_c25_flag,
4315 { "C25",
4316 "mac-nr.control.me-phr.c25", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4317 "SCellIndex 25 PHR report flag", HFILL
4320 { &hf_mac_nr_control_me_phr_c24_flag,
4321 { "C24",
4322 "mac-nr.control.me-phr.c24", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
4323 "SCellIndex 24 PHR report flag", HFILL
4326 { &hf_mac_nr_control_me_phr_entry,
4327 { "Entry",
4328 "mac-nr.control.me.phr.entry", FT_STRING, BASE_NONE, NULL, 0x0,
4329 NULL, HFILL
4332 { &hf_mac_nr_control_me_phr_reserved,
4333 { "Reserved",
4334 "mac-nr.control.me-phr.reserved", FT_BOOLEAN, 8, NULL, 0x01,
4335 NULL, HFILL
4338 { &hf_mac_nr_control_me_phr_p,
4339 { "P",
4340 "mac-nr.control.me-phr.p", FT_BOOLEAN, 8, TFS(&power_backoff_affects_power_management_vals), 0x80,
4341 NULL, HFILL
4344 { &hf_mac_nr_control_me_phr_v,
4345 { "V",
4346 "mac-nr.control.me-phr.v", FT_BOOLEAN, 8, TFS(&phr_source_vals), 0x40,
4347 NULL, HFILL
4350 { &hf_mac_nr_control_me_phr_ph_type2_spcell,
4351 { "Power Headroom, (Type2, SpCell)",
4352 "mac-nr.control.me-phr.ph", FT_UINT8, BASE_DEC, NULL, 0x3f,
4353 NULL, HFILL
4356 { &hf_mac_nr_control_me_phr_ph_type1_pcell,
4357 { "Power Headroom (Type1, PCell)",
4358 "mac-nr.control.me-phr.ph.type1-pcell", FT_UINT8, BASE_CUSTOM, CF_FUNC(mac_nr_phr_fmt), 0x3f,
4359 NULL, HFILL
4363 { &hf_mac_nr_control_me_phr_ph_c31,
4364 { "PH for SCellIndex 31",
4365 "mac-nr.control.me-phr.ph.c31", FT_UINT8, BASE_DEC, NULL, 0x3f,
4366 NULL, HFILL
4369 { &hf_mac_nr_control_me_phr_ph_c30,
4370 { "PH for SCellIndex 30",
4371 "mac-nr.control.me-phr.ph.c30", FT_UINT8, BASE_DEC, NULL, 0x3f,
4372 NULL, HFILL
4375 { &hf_mac_nr_control_me_phr_ph_c29,
4376 { "PH for SCellIndex 29",
4377 "mac-nr.control.me-phr.ph.c29", FT_UINT8, BASE_DEC, NULL, 0x3f,
4378 NULL, HFILL
4381 { &hf_mac_nr_control_me_phr_ph_c28,
4382 { "PH for SCellIndex 28",
4383 "mac-nr.control.me-phr.ph.c28", FT_UINT8, BASE_DEC, NULL, 0x3f,
4384 NULL, HFILL
4387 { &hf_mac_nr_control_me_phr_ph_c27,
4388 { "PH for SCellIndex 27",
4389 "mac-nr.control.me-phr.ph.c27", FT_UINT8, BASE_DEC, NULL, 0x3f,
4390 NULL, HFILL
4393 { &hf_mac_nr_control_me_phr_ph_c26,
4394 { "PH for SCellIndex 26",
4395 "mac-nr.control.me-phr.ph.c26", FT_UINT8, BASE_DEC, NULL, 0x3f,
4396 NULL, HFILL
4399 { &hf_mac_nr_control_me_phr_ph_c25,
4400 { "PH for SCellIndex 25",
4401 "mac-nr.control.me-phr.ph.c25", FT_UINT8, BASE_DEC, NULL, 0x3f,
4402 NULL, HFILL
4405 { &hf_mac_nr_control_me_phr_ph_c24,
4406 { "PH for SCellIndex 24",
4407 "mac-nr.control.me-phr.ph.c24", FT_UINT8, BASE_DEC, NULL, 0x3f,
4408 NULL, HFILL
4411 { &hf_mac_nr_control_me_phr_ph_c23,
4412 { "PH for SCellIndex 23",
4413 "mac-nr.control.me-phr.ph.c23", FT_UINT8, BASE_DEC, NULL, 0x3f,
4414 NULL, HFILL
4417 { &hf_mac_nr_control_me_phr_ph_c22,
4418 { "PH for SCellIndex 22",
4419 "mac-nr.control.me-phr.ph.c22", FT_UINT8, BASE_DEC, NULL, 0x3f,
4420 NULL, HFILL
4423 { &hf_mac_nr_control_me_phr_ph_c21,
4424 { "PH for SCellIndex 21",
4425 "mac-nr.control.me-phr.ph.c21", FT_UINT8, BASE_DEC, NULL, 0x3f,
4426 NULL, HFILL
4429 { &hf_mac_nr_control_me_phr_ph_c20,
4430 { "PH for SCellIndex 20",
4431 "mac-nr.control.me-phr.ph.c20", FT_UINT8, BASE_DEC, NULL, 0x3f,
4432 NULL, HFILL
4435 { &hf_mac_nr_control_me_phr_ph_c19,
4436 { "PH for SCellIndex 19",
4437 "mac-nr.control.me-phr.ph.c19", FT_UINT8, BASE_DEC, NULL, 0x3f,
4438 NULL, HFILL
4441 { &hf_mac_nr_control_me_phr_ph_c18,
4442 { "PH for SCellIndex 18",
4443 "mac-nr.control.me-phr.ph.c18", FT_UINT8, BASE_DEC, NULL, 0x3f,
4444 NULL, HFILL
4447 { &hf_mac_nr_control_me_phr_ph_c17,
4448 { "PH for SCellIndex 17",
4449 "mac-nr.control.me-phr.ph.c17", FT_UINT8, BASE_DEC, NULL, 0x3f,
4450 NULL, HFILL
4453 { &hf_mac_nr_control_me_phr_ph_c16,
4454 { "PH for SCellIndex 16",
4455 "mac-nr.control.me-phr.ph.c16", FT_UINT8, BASE_DEC, NULL, 0x3f,
4456 NULL, HFILL
4459 { &hf_mac_nr_control_me_phr_ph_c15,
4460 { "PH for SCellIndex 15",
4461 "mac-nr.control.me-phr.ph.c15", FT_UINT8, BASE_DEC, NULL, 0x3f,
4462 NULL, HFILL
4465 { &hf_mac_nr_control_me_phr_ph_c14,
4466 { "PH for SCellIndex 14",
4467 "mac-nr.control.me-phr.ph.c14", FT_UINT8, BASE_DEC, NULL, 0x3f,
4468 NULL, HFILL
4471 { &hf_mac_nr_control_me_phr_ph_c13,
4472 { "PH for SCellIndex 13",
4473 "mac-nr.control.me-phr.ph.c13", FT_UINT8, BASE_DEC, NULL, 0x3f,
4474 NULL, HFILL
4477 { &hf_mac_nr_control_me_phr_ph_c12,
4478 { "PH for SCellIndex 12",
4479 "mac-nr.control.me-phr.ph.c12", FT_UINT8, BASE_DEC, NULL, 0x3f,
4480 NULL, HFILL
4483 { &hf_mac_nr_control_me_phr_ph_c11,
4484 { "PH for SCellIndex 11",
4485 "mac-nr.control.me-phr.ph.c11", FT_UINT8, BASE_DEC, NULL, 0x3f,
4486 NULL, HFILL
4489 { &hf_mac_nr_control_me_phr_ph_c10,
4490 { "PH for SCellIndex 10",
4491 "mac-nr.control.me-phr.ph.c10", FT_UINT8, BASE_DEC, NULL, 0x3f,
4492 NULL, HFILL
4495 { &hf_mac_nr_control_me_phr_ph_c9,
4496 { "PH for SCellIndex 9",
4497 "mac-nr.control.me-phr.ph.c9", FT_UINT8, BASE_DEC, NULL, 0x3f,
4498 NULL, HFILL
4501 { &hf_mac_nr_control_me_phr_ph_c8,
4502 { "PH for SCellIndex 8",
4503 "mac-nr.control.me-phr.ph.c8", FT_UINT8, BASE_DEC, NULL, 0x3f,
4504 NULL, HFILL
4507 { &hf_mac_nr_control_me_phr_ph_c7,
4508 { "PH for SCellIndex 7",
4509 "mac-nr.control.me-phr.ph.c7", FT_UINT8, BASE_DEC, NULL, 0x3f,
4510 NULL, HFILL
4513 { &hf_mac_nr_control_me_phr_ph_c6,
4514 { "PH for SCellIndex 6",
4515 "mac-nr.control.me-phr.ph.c6", FT_UINT8, BASE_DEC, NULL, 0x3f,
4516 NULL, HFILL
4519 { &hf_mac_nr_control_me_phr_ph_c5,
4520 { "PH for SCellIndex 5",
4521 "mac-nr.control.me-phr.ph.c5", FT_UINT8, BASE_DEC, NULL, 0x3f,
4522 NULL, HFILL
4525 { &hf_mac_nr_control_me_phr_ph_c4,
4526 { "PH for SCellIndex 4",
4527 "mac-nr.control.me-phr.ph.c4", FT_UINT8, BASE_DEC, NULL, 0x3f,
4528 NULL, HFILL
4531 { &hf_mac_nr_control_me_phr_ph_c3,
4532 { "PH for SCellIndex 3",
4533 "mac-nr.control.me-phr.ph.c3", FT_UINT8, BASE_DEC, NULL, 0x3f,
4534 NULL, HFILL
4537 { &hf_mac_nr_control_me_phr_ph_c2,
4538 { "PH for SCellIndex 2",
4539 "mac-nr.control.me-phr.ph.c2", FT_UINT8, BASE_DEC, NULL, 0x3f,
4540 NULL, HFILL
4543 { &hf_mac_nr_control_me_phr_ph_c1,
4544 { "PH for SCellIndex 1",
4545 "mac-nr.control.me-phr.ph.c1", FT_UINT8, BASE_DEC, NULL, 0x3f,
4546 NULL, HFILL
4549 { &hf_mac_nr_control_me_phr_reserved_2,
4550 { "Reserved",
4551 "mac-nr.control.me-phr.reserved", FT_BOOLEAN, 8, NULL, 0xc0,
4552 NULL, HFILL
4555 { &hf_mac_nr_control_me_phr_pcmax_f_c_type2_spcell,
4556 { "Pcmax,f,c",
4557 "mac-nr.control.me-phr.type2-spcell", FT_UINT8, BASE_DEC, NULL, 0x3f,
4558 NULL, HFILL
4561 { &hf_mac_nr_control_me_phr_pcmax_f_c_type1_pcell,
4562 { "Pcmax,f,c",
4563 "mac-nr.control.me-phr.type1-pcell", FT_UINT8, BASE_CUSTOM, CF_FUNC(mac_nr_pcmax_f_c_fmt), 0x3f,
4564 NULL, HFILL
4567 { &hf_mac_nr_control_me_phr_pcmax_f_c_typeX,
4568 { "Pcmax,f,c",
4569 "mac-nr.control.me-phr.typeX", FT_UINT8, BASE_DEC, NULL, 0x3f,
4570 NULL, HFILL
4574 { &hf_mac_nr_control_recommended_bit_rate_lcid,
4575 { "LCID",
4576 "mac-nr.control.recommended-bit-rate.lcid", FT_UINT8, BASE_DEC, NULL, 0xfc,
4577 NULL, HFILL
4580 { &hf_mac_nr_control_recommended_bit_rate_dir,
4581 { "Direction",
4582 "mac-nr.control.recommended-bit-rate.dir", FT_BOOLEAN, 8, TFS(&tfs_uplink_downlink), 0x02,
4583 NULL, HFILL
4586 { &hf_mac_nr_control_recommended_bit_rate_bit_rate,
4587 { "Bit Rate",
4588 "mac-nr.control.recommended-bit-rate.bit-rate", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &bit_rate_vals_ext, 0x01f8,
4589 NULL, HFILL
4592 { &hf_mac_nr_control_recommended_bit_rate_reserved,
4593 { "Reserved",
4594 "mac-nr.control.recommended-bit-rate.reserved", FT_UINT8, BASE_DEC, NULL, 0x07,
4595 NULL, HFILL
4599 { &hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_ad,
4600 { "Reserved",
4601 "mac-nr.control.sp-zp-csi-rs-resource-set-act-deact.ad", FT_BOOLEAN, 8, TFS(&activation_deactivation_vals), 0x80,
4602 NULL, HFILL
4605 { &hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_serving_cell_id,
4606 { "Serving Cell ID",
4607 "mac-nr.control.sp-zp-csi-rs-resource-set-act-deact.serving-cell-id", FT_UINT8, BASE_DEC, NULL, 0x7c,
4608 NULL, HFILL
4611 { &hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_bwp_id,
4612 { "BWP ID",
4613 "mac-nr.control.sp-zp-csi-rs-resource-set-act-deact.bwp-id", FT_UINT8, BASE_DEC, NULL, 0x03,
4614 NULL, HFILL
4617 { &hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_reserved_2,
4618 { "Reserved",
4619 "mac-nr.control.sp-zp-csi-rs-resource-set-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0xf0,
4620 NULL, HFILL
4623 { &hf_mac_control_sp_zp_csi_rs_resource_set_act_deact_sp_zp_rs_resource_set_id,
4624 { "SP ZP CSI-RS resource set ID",
4625 "mac-nr.control.sp-zp-csi-rs-resource-set-act-deact.sp-zp-rs-resource-set-id", FT_UINT8, BASE_DEC, NULL, 0x0f,
4626 NULL, HFILL
4629 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_reserved,
4630 { "Reserved",
4631 "mac-nr.control.pucch-spatial-rel-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0x80,
4632 NULL, HFILL
4635 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_serving_cell_id,
4636 { "Serving Cell ID",
4637 "mac-nr.control.pucch-spatial-rel-act-deact.serving-cell-id", FT_UINT8, BASE_DEC, NULL, 0x7c,
4638 NULL, HFILL
4641 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_bwp_id,
4642 { "BWP ID",
4643 "mac-nr.control.pucch-spatial-rel-act-deact.bwp-id", FT_UINT8, BASE_DEC, NULL, 0x03,
4644 NULL, HFILL
4647 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_pucch_resource_id,
4648 { "PUCCH Resource ID",
4649 "mac-nr.control.pucch-spatial-rel-act-deact.pucch-resource-id", FT_UINT8, BASE_DEC, NULL, 0x7f,
4650 NULL, HFILL
4653 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_s8,
4654 { "PUCCH Spatial Relation Info 8",
4655 "mac-nr.control.pucch-spatial-rel-act-deact.s8", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
4656 NULL, HFILL
4659 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_s7,
4660 { "PUCCH Spatial Relation Info 7",
4661 "mac-nr.control.pucch-spatial-rel-act-deact.s7", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
4662 NULL, HFILL
4665 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_s6,
4666 { "PUCCH Spatial Relation Info 6",
4667 "mac-nr.control.pucch-spatial-rel-act-deact.s6", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
4668 NULL, HFILL
4671 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_s5,
4672 { "PUCCH Spatial Relation Info 5",
4673 "mac-nr.control.pucch-spatial-rel-act-deact.s5", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
4674 NULL, HFILL
4677 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_s4,
4678 { "PUCCH Spatial Relation Info 4",
4679 "mac-nr.control.pucch-spatial-rel-act-deact.s4", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
4680 NULL, HFILL
4683 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_s3,
4684 { "PUCCH Spatial Relation Info 3",
4685 "mac-nr.control.pucch-spatial-rel-act-deact.s3", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
4686 NULL, HFILL
4689 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_s2,
4690 { "PUCCH Spatial Relation Info 2",
4691 "mac-nr.control.pucch-spatial-rel-act-deact.s2", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
4692 NULL, HFILL
4695 { &hf_mac_nr_control_pucch_spatial_rel_act_deact_s1,
4696 { "PUCCH Spatial Relation Info 1",
4697 "mac-nr.control.pucch-spatial-rel-act-deact.s1", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x01,
4698 NULL, HFILL
4701 { &hf_mac_nr_control_sp_srs_act_deact_ad,
4702 { "A/D",
4703 "mac-nr.control.sp-srs-act-deact.ad", FT_BOOLEAN, 8, TFS(&activation_deactivation_vals), 0x80,
4704 NULL, HFILL
4707 { &hf_mac_nr_control_sp_srs_act_deact_srs_resource_set_cell_id,
4708 { "SRS Resource Set's Cell ID",
4709 "mac-nr.control.sp-srs-act-deact.srs-resource-set-cell-id", FT_UINT8, BASE_DEC, NULL, 0x7c,
4710 NULL, HFILL
4713 { &hf_mac_nr_control_sp_srs_act_deact_srs_resource_set_bwp_id,
4714 { "SRS Resource Set's BWP ID",
4715 "mac-nr.control.sp-srs-act-deact.srs-resource-set-bwp-id", FT_UINT8, BASE_DEC, NULL, 0x03,
4716 NULL, HFILL
4719 { &hf_mac_nr_control_sp_srs_act_deact_reserved,
4720 { "Reserved",
4721 "mac-nr.control.sp-srs-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0x00,
4722 NULL, HFILL
4725 { &hf_mac_nr_control_sp_srs_act_deact_c,
4726 { "C",
4727 "mac-nr.control.sp-srs-act-deact.c", FT_BOOLEAN, 8, TFS(&c_vals), 0x20,
4728 NULL, HFILL
4731 { &hf_mac_nr_control_sp_srs_act_deact_sul,
4732 { "SUL",
4733 "mac-nr.control.sp-srs-act-deact.sul", FT_BOOLEAN, 8, TFS(&sul_vals), 0x10,
4734 NULL, HFILL
4737 { &hf_mac_nr_control_sp_srs_act_deact_sp_srs_resource_set_id,
4738 { "SP SRS Resource Set ID",
4739 "mac-nr.control.sp-srs-act-deact.sp-srs-resource-set-id", FT_UINT8, BASE_DEC, NULL, 0x0f,
4740 NULL, HFILL
4743 { &hf_mac_nr_control_sp_srs_act_deact_f,
4744 { "F",
4745 "mac-nr.control.sp-srs-act-deact.f", FT_BOOLEAN, 8, TFS(&sp_srs_act_deact_f_vals), 0x80,
4746 NULL, HFILL
4749 { &hf_mac_nr_control_sp_srs_act_deact_resource_id,
4750 { "Resource ID",
4751 "mac-nr.control.sp-srs-act-deact.resource-id", FT_UINT8, BASE_DEC, NULL, 0x7f,
4752 NULL, HFILL
4755 { &hf_mac_nr_control_sp_srs_act_deact_resource_id_ssb,
4756 { "Resource ID",
4757 "mac-nr.control.sp-srs-act-deact.resource-id", FT_UINT8, BASE_DEC, NULL, 0x3f,
4758 NULL, HFILL
4762 { &hf_mac_nr_control_sp_srs_act_deact_resource_serving_cell_id,
4763 { "Resource Serving Cell ID",
4764 "mac-nr.control.sp-srs-act-deact.resource-serving-cell-id", FT_UINT8, BASE_DEC, NULL, 0x7c,
4765 NULL, HFILL
4768 { &hf_mac_nr_control_sp_srs_act_deact_resource_bwp_id,
4769 { "Resource BWP ID",
4770 "mac-nr.control.sp-srs-act-deact.resource-bwp-id", FT_UINT8, BASE_DEC, NULL, 0x03,
4771 NULL, HFILL
4774 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_reserved,
4775 { "Reserved",
4776 "mac-nr.control.sp-csi-report-on-pucch-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0x80,
4777 NULL, HFILL
4780 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_serving_cell_id,
4781 { "Serving Cell ID",
4782 "mac-nr.control.sp-csi-report-on-pucch-act-deact.serving-cell-id", FT_UINT8, BASE_DEC, NULL, 0x7c,
4783 NULL, HFILL
4786 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_bwp_id,
4787 { "BWP ID",
4788 "mac-nr.control.sp-csi-report-on-pucch-act-deact.bwp-id", FT_UINT8, BASE_DEC, NULL, 0x03,
4789 NULL, HFILL
4792 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s7,
4793 { "Semi-Persistent CSI report configuration 7",
4794 "mac-nr.control.sp-csi-report-on-pucch-act-deact.s7", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
4795 NULL, HFILL
4798 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s6,
4799 { "Semi-Persistent CSI report configuration 6",
4800 "mac-nr.control.sp-csi-report-on-pucch-act-deact.s6", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
4801 NULL, HFILL
4804 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s5,
4805 { "Semi-Persistent CSI report configuration 5",
4806 "mac-nr.control.sp-csi-report-on-pucch-act-deact.s5", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
4807 NULL, HFILL
4810 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s4,
4811 { "Semi-Persistent CSI report configuration 4",
4812 "mac-nr.control.sp-csi-report-on-pucch-act-deact.s4", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
4813 NULL, HFILL
4816 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s3,
4817 { "Semi-Persistent CSI report configuration 3",
4818 "mac-nr.control.sp-csi-report-on-pucch-act-deact.s3", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
4819 NULL, HFILL
4822 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s2,
4823 { "Semi-Persistent CSI report configuration 2",
4824 "mac-nr.control.sp-csi-report-on-pucch-act-deact.s2", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
4825 NULL, HFILL
4828 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s1,
4829 { "Semi-Persistent CSI report configuration 1",
4830 "mac-nr.control.sp-csi-report-on-pucch-act-deact.s1", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
4831 NULL, HFILL
4834 { &hf_mac_nr_control_sp_csi_report_on_pucch_act_deact_s0,
4835 { "Semi-Persistent CSI report configuration 0",
4836 "mac-nr.control.sp-csi-report-on-pucch-act-deact.s0", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x01,
4837 NULL, HFILL
4840 { &hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_serving_cell_id,
4841 { "Serving Cell ID",
4842 "mac-nr.control.tci-state-ind-for-ue-spec-pdcch.serving-cell-id", FT_UINT8, BASE_DEC, NULL, 0xf8,
4843 NULL, HFILL
4846 { &hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_coreset_id,
4847 { "CORESET ID",
4848 "mac-nr.control.tci-state-ind-for-ue-spec-pdcch.coreset-id", FT_UINT16, BASE_DEC, NULL, 0x0780,
4849 NULL, HFILL
4852 { &hf_mac_nr_control_tci_state_ind_for_ue_spec_pdcch_tci_state_id,
4853 { "TCI State ID",
4854 "mac-nr.control.tci-state-ind-for-ue-spec-pdcch.tci-state-id", FT_UINT8, BASE_DEC, NULL, 0x7f,
4855 NULL, HFILL
4858 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_reserved,
4859 { "Reserved",
4860 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.reserved", FT_UINT8, BASE_HEX, NULL, 0x80,
4861 NULL, HFILL
4864 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_serving_cell_id,
4865 { "Serving Cell ID",
4866 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.serving-cell-id", FT_UINT8, BASE_DEC, NULL, 0x7c,
4867 NULL, HFILL
4870 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_bwp_id,
4871 { "BWP ID",
4872 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.bwp-id", FT_UINT8, BASE_DEC, NULL, 0x03,
4873 NULL, HFILL
4876 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t7,
4877 { "TCI state N+7",
4878 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.t7", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
4879 NULL, HFILL
4882 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t6,
4883 { "TCI state N+6",
4884 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.t6", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
4885 NULL, HFILL
4888 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t5,
4889 { "TCI state N+5",
4890 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.t5", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
4891 NULL, HFILL
4894 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t4,
4895 { "TCI state N+4",
4896 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.t4", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
4897 NULL, HFILL
4900 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t3,
4901 { "TCI state N+3",
4902 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.t3", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
4903 NULL, HFILL
4906 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t2,
4907 { "TCI state N+2",
4908 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.t2", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
4909 NULL, HFILL
4912 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t1,
4913 { "TCI state N+1",
4914 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.t1", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
4915 NULL, HFILL
4918 { &hf_mac_nr_control_tci_states_act_deact_for_ue_spec_pdsch_t0,
4919 { "TCI state N",
4920 "mac-nr.control.tci-states-act-deact-for-ue-spec-pdsch.t0", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x01,
4921 NULL, HFILL
4924 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_reserved,
4925 { "Reserved",
4926 "mac-nr.control.aper-csi-trigger-state-subselect.reserved", FT_UINT8, BASE_HEX, NULL, 0x80,
4927 NULL, HFILL
4930 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_serving_cell_id,
4931 { "Serving Cell ID",
4932 "mac-nr.control.aper-csi-trigger-state-subselect.serving-cell-id", FT_UINT8, BASE_DEC, NULL, 0x7c,
4933 NULL, HFILL
4936 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_bwp_id,
4937 { "BWP ID",
4938 "mac-nr.control.aper-csi-trigger-state-subselect.bwp-id", FT_UINT8, BASE_DEC, NULL, 0x03,
4939 NULL, HFILL
4942 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_t7,
4943 { "Aperiodic trigger state N+7",
4944 "mac-nr.control.aper-csi-trigger-state-subselect.t7", FT_BOOLEAN, 8, TFS(&aper_csi_trigger_state_t_vals), 0x80,
4945 NULL, HFILL
4948 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_t6,
4949 { "Aperiodic trigger state N+6",
4950 "mac-nr.control.aper-csi-trigger-state-subselect.t6", FT_BOOLEAN, 8, TFS(&aper_csi_trigger_state_t_vals), 0x40,
4951 NULL, HFILL
4954 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_t5,
4955 { "Aperiodic trigger state N+5",
4956 "mac-nr.control.aper-csi-trigger-state-subselect.t5", FT_BOOLEAN, 8, TFS(&aper_csi_trigger_state_t_vals), 0x20,
4957 NULL, HFILL
4960 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_t4,
4961 { "Aperiodic trigger state N+4",
4962 "mac-nr.control.aper-csi-trigger-state-subselect.t4", FT_BOOLEAN, 8, TFS(&aper_csi_trigger_state_t_vals), 0x10,
4963 NULL, HFILL
4966 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_t3,
4967 { "Aperiodic trigger state N+3",
4968 "mac-nr.control.aper-csi-trigger-state-subselect.t3", FT_BOOLEAN, 8, TFS(&aper_csi_trigger_state_t_vals), 0x08,
4969 NULL, HFILL
4972 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_t2,
4973 { "Aperiodic trigger state N+2",
4974 "mac-nr.control.aper-csi-trigger-state-subselect.t2", FT_BOOLEAN, 8, TFS(&aper_csi_trigger_state_t_vals), 0x04,
4975 NULL, HFILL
4978 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_t1,
4979 { "Aperiodic trigger state N+1",
4980 "mac-nr.control.aper-csi-trigger-state-subselect.t1", FT_BOOLEAN, 8, TFS(&aper_csi_trigger_state_t_vals), 0x02,
4981 NULL, HFILL
4984 { &hf_mac_nr_control_aper_csi_trigger_state_subselect_t0,
4985 { "Aperiodic trigger state N",
4986 "mac-nr.control.aper-csi-trigger-state-subselect.t0", FT_BOOLEAN, 8, TFS(&aper_csi_trigger_state_t_vals), 0x01,
4987 NULL, HFILL
4990 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_ad,
4991 { "A/D",
4992 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.ad", FT_BOOLEAN, 8, TFS(&activation_deactivation_vals), 0x80,
4993 NULL, HFILL
4996 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_serving_cell_id,
4997 { "Serving Cell ID",
4998 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.serving-cell-id", FT_UINT8, BASE_DEC, NULL, 0x7c,
4999 NULL, HFILL
5002 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_bwp_id,
5003 { "BWP ID",
5004 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.bwp-id", FT_UINT8, BASE_DEC, NULL, 0x03,
5005 NULL, HFILL
5008 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved,
5009 { "Reserved",
5010 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0xe0,
5011 NULL, HFILL
5014 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_im,
5015 { "IM",
5016 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.im", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
5017 NULL, HFILL
5020 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_sp_csi_rs_res_set_id,
5021 { "SP CSI-RS resource set ID",
5022 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.sp-csi-rs-res-set-id", FT_UINT8, BASE_DEC, NULL, 0x0f,
5023 NULL, HFILL
5026 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved2,
5027 { "Reserved",
5028 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0xf0,
5029 NULL, HFILL
5032 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_sp_csi_im_res_set_id,
5033 { "SP CSI-IM resource set ID",
5034 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.sp-csi-im-res-set-id", FT_UINT8, BASE_DEC, NULL, 0x0f,
5035 NULL, HFILL
5038 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_reserved3,
5039 { "Reserved",
5040 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0x80,
5041 NULL, HFILL
5044 { &hf_mac_nr_control_sp_csi_rs_csi_im_res_set_act_deact_tci_state_id,
5045 { "TCI State ID",
5046 "mac-nr.control.sp-csi-rs-cs-im-res-set-act-deact.tci-state-id", FT_UINT8, BASE_DEC, NULL, 0x7f,
5047 NULL, HFILL
5050 { &hf_mac_nr_control_dupl_act_deact_drb7,
5051 { "DRB 7",
5052 "mac-nr.control.dupl-act-deact.drb7", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
5053 NULL, HFILL
5056 { &hf_mac_nr_control_dupl_act_deact_drb6,
5057 { "DRB 6",
5058 "mac-nr.control.dupl-act-deact.drb6", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
5059 NULL, HFILL
5062 { &hf_mac_nr_control_dupl_act_deact_drb5,
5063 { "DRB 5",
5064 "mac-nr.control.dupl-act-deact.drb5", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
5065 NULL, HFILL
5068 { &hf_mac_nr_control_dupl_act_deact_drb4,
5069 { "DRB 4",
5070 "mac-nr.control.dupl-act-deact.drb4", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
5071 NULL, HFILL
5074 { &hf_mac_nr_control_dupl_act_deact_drb3,
5075 { "DRB 3",
5076 "mac-nr.control.dupl-act-deact.drb3", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
5077 NULL, HFILL
5080 { &hf_mac_nr_control_dupl_act_deact_drb2,
5081 { "DRB 2",
5082 "mac-nr.control.dupl-act-deact.drb2", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
5083 NULL, HFILL
5086 { &hf_mac_nr_control_dupl_act_deact_drb1,
5087 { "DRB 1",
5088 "mac-nr.control.dupl-act-deact.drb1", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
5089 NULL, HFILL
5092 { &hf_mac_nr_control_dupl_act_deact_reserved,
5093 { "Reserved",
5094 "mac-nr.control.dupl-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0x01,
5095 NULL, HFILL
5098 { &hf_mac_nr_control_scell_act_deact_cell7,
5099 { "Cell 7",
5100 "mac-nr.control.scell-act-deact.cell7", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
5101 NULL, HFILL
5104 { &hf_mac_nr_control_scell_act_deact_cell6,
5105 { "Cell 6",
5106 "mac-nr.control.scell-act-deact.cell6", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
5107 NULL, HFILL
5110 { &hf_mac_nr_control_scell_act_deact_cell5,
5111 { "Cell 5",
5112 "mac-nr.control.scell-act-deact.cell5", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
5113 NULL, HFILL
5116 { &hf_mac_nr_control_scell_act_deact_cell4,
5117 { "Cell 4",
5118 "mac-nr.control.scell-act-deact.cell4", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
5119 NULL, HFILL
5122 { &hf_mac_nr_control_scell_act_deact_cell3,
5123 { "Cell 3",
5124 "mac-nr.control.scell-act-deact.cell3", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
5125 NULL, HFILL
5128 { &hf_mac_nr_control_scell_act_deact_cell2,
5129 { "Cell 2",
5130 "mac-nr.control.scell-act-deact.cell2", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
5131 NULL, HFILL
5134 { &hf_mac_nr_control_scell_act_deact_cell1,
5135 { "Cell 1",
5136 "mac-nr.control.scell-act-deact.cell1", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
5137 NULL, HFILL
5140 { &hf_mac_nr_control_scell_act_deact_reserved,
5141 { "Reserved",
5142 "mac-nr.control.scell-act-deact.reserved", FT_UINT8, BASE_HEX, NULL, 0x01,
5143 NULL, HFILL
5146 { &hf_mac_nr_control_scell_act_deact_cell15,
5147 { "Cell 15",
5148 "mac-nr.control.scell-act-deact.cell15", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
5149 NULL, HFILL
5152 { &hf_mac_nr_control_scell_act_deact_cell14,
5153 { "Cell 14",
5154 "mac-nr.control.scell-act-deact.cell14", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
5155 NULL, HFILL
5158 { &hf_mac_nr_control_scell_act_deact_cell13,
5159 { "Cell 13",
5160 "mac-nr.control.scell-act-deact.cell13", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
5161 NULL, HFILL
5164 { &hf_mac_nr_control_scell_act_deact_cell12,
5165 { "Cell 12",
5166 "mac-nr.control.scell-act-deact.cell12", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
5167 NULL, HFILL
5170 { &hf_mac_nr_control_scell_act_deact_cell11,
5171 { "Cell 11",
5172 "mac-nr.control.scell-act-deact.cell11", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
5173 NULL, HFILL
5176 { &hf_mac_nr_control_scell_act_deact_cell10,
5177 { "Cell 10",
5178 "mac-nr.control.scell-act-deact.cell10", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
5179 NULL, HFILL
5182 { &hf_mac_nr_control_scell_act_deact_cell9,
5183 { "Cell 9",
5184 "mac-nr.control.scell-act-deact.cell9", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
5185 NULL, HFILL
5188 { &hf_mac_nr_control_scell_act_deact_cell8,
5189 { "Cell 8",
5190 "mac-nr.control.scell-act-deact.cell8", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x01,
5191 NULL, HFILL
5194 { &hf_mac_nr_control_scell_act_deact_cell23,
5195 { "Cell 23",
5196 "mac-nr.control.scell-act-deact.cell23", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
5197 NULL, HFILL
5200 { &hf_mac_nr_control_scell_act_deact_cell22,
5201 { "Cell 22",
5202 "mac-nr.control.scell-act-deact.cell22", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
5203 NULL, HFILL
5206 { &hf_mac_nr_control_scell_act_deact_cell21,
5207 { "Cell 21",
5208 "mac-nr.control.scell-act-deact.cell21", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
5209 NULL, HFILL
5212 { &hf_mac_nr_control_scell_act_deact_cell20,
5213 { "Cell 20",
5214 "mac-nr.control.scell-act-deact.cell20", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
5215 NULL, HFILL
5218 { &hf_mac_nr_control_scell_act_deact_cell19,
5219 { "Cell 19",
5220 "mac-nr.control.scell-act-deact.cell19", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
5221 NULL, HFILL
5224 { &hf_mac_nr_control_scell_act_deact_cell18,
5225 { "Cell 18",
5226 "mac-nr.control.scell-act-deact.cell18", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
5227 NULL, HFILL
5230 { &hf_mac_nr_control_scell_act_deact_cell17,
5231 { "Cell 17",
5232 "mac-nr.control.scell-act-deact.cell17", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
5233 NULL, HFILL
5236 { &hf_mac_nr_control_scell_act_deact_cell16,
5237 { "Cell 16",
5238 "mac-nr.control.scell-act-deact.cell16", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x01,
5239 NULL, HFILL
5242 { &hf_mac_nr_control_scell_act_deact_cell31,
5243 { "Cell 31",
5244 "mac-nr.control.scell-act-deact.cell31", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
5245 NULL, HFILL
5248 { &hf_mac_nr_control_scell_act_deact_cell30,
5249 { "Cell 30",
5250 "mac-nr.control.scell-act-deact.cell30", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
5251 NULL, HFILL
5254 { &hf_mac_nr_control_scell_act_deact_cell29,
5255 { "Cell 29",
5256 "mac-nr.control.scell-act-deact.cell29", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
5257 NULL, HFILL
5260 { &hf_mac_nr_control_scell_act_deact_cell28,
5261 { "Cell 28",
5262 "mac-nr.control.scell-act-deact.cell28", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
5263 NULL, HFILL
5266 { &hf_mac_nr_control_scell_act_deact_cell27,
5267 { "Cell 27",
5268 "mac-nr.control.scell-act-deact.cell27", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
5269 NULL, HFILL
5272 { &hf_mac_nr_control_scell_act_deact_cell26,
5273 { "Cell 26",
5274 "mac-nr.control.scell-act-deact.cell26", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
5275 NULL, HFILL
5278 { &hf_mac_nr_control_scell_act_deact_cell25,
5279 { "Cell 25",
5280 "mac-nr.control.scell-act-deact.cell25", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
5281 NULL, HFILL
5284 { &hf_mac_nr_control_scell_act_deact_cell24,
5285 { "Cell 24",
5286 "mac-nr.control.scell-act-deact.cell24", FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x01,
5287 NULL, HFILL
5290 { &hf_mac_nr_control_bsr_short_lcg,
5291 { "LCG",
5292 "mac-nr.control.bsr.short.lcg", FT_UINT8, BASE_DEC, NULL, 0xe0,
5293 "Logical Channel Group", HFILL
5296 { &hf_mac_nr_control_bsr_short_bs_lcg0,
5297 { "Buffer Size for LCG0",
5298 "mac-nr.control.bsr.bs-lcg0", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_5bits_vals_ext, 0x1f,
5299 NULL, HFILL
5302 { &hf_mac_nr_control_bsr_short_bs_lcg1,
5303 { "Buffer Size for LCG1",
5304 "mac-nr.control.bsr.bs-lcg1", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_5bits_vals_ext, 0x1f,
5305 NULL, HFILL
5308 { &hf_mac_nr_control_bsr_short_bs_lcg2,
5309 { "Buffer Size for LCG2",
5310 "mac-nr.control.bsr.bs-lcg2", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_5bits_vals_ext, 0x1f,
5311 NULL, HFILL
5314 { &hf_mac_nr_control_bsr_short_bs_lcg3,
5315 { "Buffer Size for LCG3",
5316 "mac-nr.control.bsr.bs-lcg3", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_5bits_vals_ext, 0x1f,
5317 NULL, HFILL
5320 { &hf_mac_nr_control_bsr_short_bs_lcg4,
5321 { "Buffer Size for LCG4",
5322 "mac-nr.control.bsr.bs-lcg4", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_5bits_vals_ext, 0x1f,
5323 NULL, HFILL
5326 { &hf_mac_nr_control_bsr_short_bs_lcg5,
5327 { "Buffer Size for LCG5",
5328 "mac-nr.control.bsr.bs-lcg5", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_5bits_vals_ext, 0x1f,
5329 NULL, HFILL
5332 { &hf_mac_nr_control_bsr_short_bs_lcg6,
5333 { "Buffer Size for LCG6",
5334 "mac-nr.control.bsr.bs-lcg6", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_5bits_vals_ext, 0x1f,
5335 NULL, HFILL
5338 { &hf_mac_nr_control_bsr_short_bs_lcg7,
5339 { "Buffer Size for LCG7",
5340 "mac-nr.control.bsr.bs-lcg7", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_5bits_vals_ext, 0x1f,
5341 NULL, HFILL
5344 { &hf_mac_nr_control_bsr_long_lcg7,
5345 { "LCG7",
5346 "mac-nr.control.bsr.long.lcg7", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
5347 "Logical Channel Group 7", HFILL
5350 { &hf_mac_nr_control_bsr_long_lcg6,
5351 { "LCG6",
5352 "mac-nr.control.bsr.long.lcg6", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
5353 "Logical Channel Group 6", HFILL
5356 { &hf_mac_nr_control_bsr_long_lcg5,
5357 { "LCG5",
5358 "mac-nr.control.bsr.long.lcg5", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
5359 "Logical Channel Group 5", HFILL
5362 { &hf_mac_nr_control_bsr_long_lcg4,
5363 { "LCG4",
5364 "mac-nr.control.bsr.long.lcg4", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
5365 "Logical Channel Group 4", HFILL
5368 { &hf_mac_nr_control_bsr_long_lcg3,
5369 { "LCG3",
5370 "mac-nr.control.bsr.long.lcg3", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
5371 "Logical Channel Group 3", HFILL
5374 { &hf_mac_nr_control_bsr_long_lcg2,
5375 { "LCG2",
5376 "mac-nr.control.bsr.long.lcg2", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
5377 "Logical Channel Group 2", HFILL
5380 { &hf_mac_nr_control_bsr_long_lcg1,
5381 { "LCG1",
5382 "mac-nr.control.bsr.long.lcg1", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
5383 "Logical Channel Group 1", HFILL
5386 { &hf_mac_nr_control_bsr_long_lcg0,
5387 { "LCG0",
5388 "mac-nr.control.bsr.long.lcg0", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
5389 "Logical Channel Group 0", HFILL
5392 { &hf_mac_nr_control_bsr_trunc_long_bs,
5393 { "Buffer Size",
5394 "mac-nr.control.bsr.trunc-bs", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5395 NULL, HFILL
5398 { &hf_mac_nr_control_bsr_long_bs_lcg7,
5399 { "Buffer Size for LCG7",
5400 "mac-nr.control.bsr.bs-lcg7", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5401 NULL, HFILL
5404 { &hf_mac_nr_control_bsr_long_bs_lcg6,
5405 { "Buffer Size for LCG6",
5406 "mac-nr.control.bsr.bs-lcg6", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5407 NULL, HFILL
5410 { &hf_mac_nr_control_bsr_long_bs_lcg5,
5411 { "Buffer Size for LCG5",
5412 "mac-nr.control.bsr.bs-lcg5", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5413 NULL, HFILL
5416 { &hf_mac_nr_control_bsr_long_bs_lcg4,
5417 { "Buffer Size for LCG4",
5418 "mac-nr.control.bsr.bs-lcg4", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5419 NULL, HFILL
5422 { &hf_mac_nr_control_bsr_long_bs_lcg3,
5423 { "Buffer Size for LCG3",
5424 "mac-nr.control.bsr.bs-lcg3", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5425 NULL, HFILL
5428 { &hf_mac_nr_control_bsr_long_bs_lcg2,
5429 { "Buffer Size for LCG2",
5430 "mac-nr.control.bsr.bs-lcg2", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5431 NULL, HFILL
5434 { &hf_mac_nr_control_bsr_long_bs_lcg1,
5435 { "Buffer Size for LCG1",
5436 "mac-nr.control.bsr.bs-lcg1", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5437 NULL, HFILL
5440 { &hf_mac_nr_control_bsr_long_bs_lcg0,
5441 { "Buffer Size for LCG0",
5442 "mac-nr.control.bsr.bs-lcg0", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_8bits_vals_ext, 0x0,
5443 NULL, HFILL
5446 { &hf_mac_nr_control_timing_advance_report_reserved,
5447 { "Reserved",
5448 "mac-nr.control.ta-command.reserved", FT_UINT8, BASE_HEX, NULL, 0xc0,
5449 NULL, HFILL
5452 { &hf_mac_nr_control_timing_advance_report_ta,
5453 { "Timing Advance",
5454 "mac-nr.control.ta-command.ta", FT_UINT16, BASE_DEC, NULL, 0x3f,
5455 NULL, HFILL
5458 { &hf_mac_nr_differential_koffset,
5459 { "Differential Koffset",
5460 "mac-nr.differential_koffset", FT_UINT8, BASE_DEC, NULL, 0x3f,
5461 NULL, HFILL
5464 { &hf_mac_nr_differential_koffset_reserved,
5465 { "Reserved",
5466 "mac-nr.differential_koffset.reserved", FT_UINT8, BASE_DEC, NULL, 0xc0,
5467 NULL, HFILL
5469 }, };
5471 static int *ett[] =
5473 &ett_mac_nr,
5474 &ett_mac_nr_context,
5475 &ett_mac_nr_subheader,
5476 &ett_mac_nr_rar_subheader,
5477 &ett_mac_nr_rar_grant,
5478 &ett_mac_nr_me_phr_entry
5481 static ei_register_info ei[] = {
5482 { &ei_mac_nr_no_per_frame_data, { "mac-nr.no_per_frame_data", PI_UNDECODED, PI_WARN, "Can't dissect NR MAC frame because no per-frame info was attached!", EXPFILL }},
5483 { &ei_mac_nr_sdu_length_different_from_dissected, { "mac-nr.sdu-length-different-from-dissected", PI_UNDECODED, PI_WARN, "Something is wrong with sdu length or dissection is wrong", EXPFILL }},
5484 { &ei_mac_nr_unknown_udp_framing_tag, { "mac-nr.unknown-udp-framing-tag", PI_UNDECODED, PI_WARN, "Unknown UDP framing tag, aborting dissection", EXPFILL }},
5485 { &ei_mac_nr_dl_sch_control_subheader_after_data_subheader, { "mac-nr.ulsch.ce-after-data", PI_SEQUENCE, PI_WARN, "For DL-SCH PDUs, CEs should come before data", EXPFILL }},
5486 { &ei_mac_nr_ul_sch_control_subheader_before_data_subheader, { "mac-nr.dlsch.ce-before-data", PI_SEQUENCE, PI_WARN, "For UL-SCH PDUs, CEs should come after data", EXPFILL }}
5489 module_t *mac_nr_module;
5490 expert_module_t* expert_mac_nr;
5492 static const enum_val_t lcid_drb_source_vals[] = {
5493 {"from-static-stable", "From static table", FromStaticTable},
5494 {"from-configuration-protocol", "From configuration protocol", FromConfigurationProtocol},
5495 {NULL, NULL, -1}
5498 static uat_field_t lcid_drb_mapping_flds[] = {
5499 UAT_FLD_VS(lcid_drb_mappings, lcid, "LCID (3-32)", drb_lcid_vals,
5500 "The MAC LCID. Note that under NR-DC, LCID 3 may be SRB-3. "
5501 "LCID 4 may also be LCID4"),
5502 UAT_FLD_DEC(lcid_drb_mappings, drbid,"DRBID id (1-32)", "Identifier of logical data channel"),
5503 UAT_FLD_VS(lcid_drb_mappings, bearer_type_ul, "UL RLC Bearer Type", rlc_bearer_type_vals, "UL Bearer Mode"),
5504 UAT_FLD_VS(lcid_drb_mappings, bearer_type_dl, "DL RLC Bearer Type", rlc_bearer_type_vals, "DL Bearer Mode"),
5505 UAT_END_FIELDS
5508 /* Register protocol. */
5509 proto_mac_nr = proto_register_protocol("MAC-NR", "MAC-NR", "mac-nr");
5510 proto_register_field_array(proto_mac_nr, hf, array_length(hf));
5511 proto_register_subtree_array(ett, array_length(ett));
5512 expert_mac_nr = expert_register_protocol(proto_mac_nr);
5513 expert_register_field_array(expert_mac_nr, ei, array_length(ei));
5515 /* Allow other dissectors to find this one by name. */
5516 register_dissector("mac-nr", dissect_mac_nr, proto_mac_nr);
5518 /* Register the tap name. */
5519 mac_nr_tap = register_tap("mac-3gpp");
5521 /* Preferences */
5522 mac_nr_module = prefs_register_protocol(proto_mac_nr, NULL);
5524 prefs_register_bool_preference(mac_nr_module, "attempt_rrc_decode",
5525 "Attempt to decode BCCH, PCCH and CCCH data using NR RRC dissector",
5526 "Attempt to decode BCCH, PCCH and CCCH data using NR RRC dissector",
5527 &global_mac_nr_attempt_rrc_decode);
5529 prefs_register_bool_preference(mac_nr_module, "attempt_to_dissect_srb_sdus",
5530 "Attempt to dissect LCID 1-4 as srb1-4",
5531 "Will call NR RLC dissector with standard settings as per RRC spec, unless "
5532 "LCID 3,4 are being used for user-plane",
5533 &global_mac_nr_attempt_srb_decode);
5535 prefs_register_enum_preference(mac_nr_module, "lcid_to_drb_mapping_source",
5536 "Source of LCID -> drb channel settings",
5537 "Set whether LCID -> drb Table is taken from static table (below) or from "
5538 "info learned from control protocol (i.e. RRC)",
5539 &global_mac_nr_lcid_drb_source, lcid_drb_source_vals, false);
5541 lcid_drb_mappings_uat = uat_new("Static LCID -> drb Table",
5542 sizeof(lcid_drb_mapping_t),
5543 "drb_bearerconfig",
5544 true,
5545 &lcid_drb_mappings,
5546 &num_lcid_drb_mappings,
5547 UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
5548 "", /* TODO: is this ref to help manual? */
5549 lcid_drb_mapping_copy_cb,
5550 NULL,
5551 NULL,
5552 NULL,
5553 NULL,
5554 lcid_drb_mapping_flds);
5556 prefs_register_uat_preference(mac_nr_module,
5557 "drb_table",
5558 "LCID -> DRB Mappings Table",
5559 "A table that maps from configurable lcids -> RLC bearer configs",
5560 lcid_drb_mappings_uat);
5562 register_init_routine(&mac_nr_init_protocol);
5563 register_cleanup_routine(&mac_nr_cleanup_protocol);
5566 void proto_reg_handoff_mac_nr(void)
5568 /* Add as a heuristic UDP dissector */
5569 heur_dissector_add("udp", dissect_mac_nr_heur, "MAC-NR over UDP", "mac_nr_udp", proto_mac_nr, HEURISTIC_DISABLE);
5571 rlc_nr_handle = find_dissector_add_dependency("rlc-nr", proto_mac_nr);
5572 nr_rrc_bcch_bch_handle = find_dissector_add_dependency("nr-rrc.bcch.bch", proto_mac_nr);
5573 nr_rrc_bcch_dl_sch_handle = find_dissector_add_dependency("nr-rrc.bcch.dl.sch", proto_mac_nr);
5574 nr_rrc_pcch_handle = find_dissector_add_dependency("nr-rrc.pcch", proto_mac_nr);
5575 nr_rrc_dl_ccch_handle = find_dissector_add_dependency("nr-rrc.dl.ccch", proto_mac_nr);
5576 nr_rrc_ul_ccch_handle = find_dissector_add_dependency("nr-rrc.ul.ccch", proto_mac_nr);
5577 nr_rrc_ul_ccch1_handle = find_dissector_add_dependency("nr-rrc.ul.ccch1", proto_mac_nr);
5582 * Editor modelines - https://www.wireshark.org/tools/modelines.html
5584 * Local variables:
5585 * c-basic-offset: 4
5586 * tab-width: 8
5587 * indent-tabs-mode: nil
5588 * End:
5590 * vi: set shiftwidth=4 tabstop=8 expandtab:
5591 * :indentSize=4:tabSize=8:noTabs=true: