ORAN FH CUS: More changes to line up samples properly for Mod Compr

This commit is contained in:
Martin Mathieson 2022-11-17 09:33:42 +00:00
parent b00725c945
commit 7efa4cb9a4
1 changed files with 32 additions and 23 deletions

View File

@ -194,7 +194,7 @@ static guint pref_ru_port_id_bits = 4;
static guint pref_sample_bit_width_uplink = 14; static guint pref_sample_bit_width_uplink = 14;
static guint pref_sample_bit_width_downlink = 14; static guint pref_sample_bit_width_downlink = 14;
/* Compression schemes */
#define COMP_NONE 0 #define COMP_NONE 0
#define COMP_BLOCK_FP 1 #define COMP_BLOCK_FP 1
#define COMP_BLOCK_SCALE 2 #define COMP_BLOCK_SCALE 2
@ -304,13 +304,13 @@ static const range_string ud_comp_header_width[] = {
{0, 0, NULL} }; {0, 0, NULL} };
static const range_string ud_comp_header_meth[] = { static const range_string ud_comp_header_meth[] = {
{0, 0, "No compression" }, {COMP_NONE, COMP_NONE, "No compression" },
{1, 1, "Block floating point compression" }, {COMP_BLOCK_FP, COMP_BLOCK_FP, "Block floating point compression" },
{2, 2, "Block scaling" }, {COMP_BLOCK_SCALE, COMP_BLOCK_SCALE, "Block scaling" },
{3, 3, "Mu - law" }, {COMP_U_LAW, COMP_U_LAW, "Mu - law" },
{4, 4, "Modulation compression" }, {COMP_MODULATION, COMP_MODULATION, "Modulation compression" },
{5, 5, "BFP + selective RE sending" }, {BFP_AND_SELECTIVE_RE, BFP_AND_SELECTIVE_RE, "BFP + selective RE sending" },
{6, 6, "mod-compr + selective RE sending" }, {MOD_COMPR_AND_SELECTIVE_RE, MOD_COMPR_AND_SELECTIVE_RE, "mod-compr + selective RE sending" },
{7, 15, "Reserved"}, {7, 15, "Reserved"},
{0, 0, NULL} {0, 0, NULL}
}; };
@ -533,7 +533,7 @@ addPcOrRtcid(tvbuff_t *tvb, proto_tree *tree, gint *offset, const char *name)
proto_item_set_generated(pi); proto_item_set_generated(pi);
} }
/* 3.1.3.1.6 (message identfier) */ /* 3.1.3.1.6 (message series identfier) */
static void static void
addSeqid(tvbuff_t *tvb, proto_tree *oran_tree, gint *offset) addSeqid(tvbuff_t *tvb, proto_tree *oran_tree, gint *offset)
{ {
@ -1392,7 +1392,8 @@ static int dissect_oran_c_section(tvbuff_t *tvb, proto_tree *tree, packet_info *
return offset; return offset;
} }
static int dissect_udcomphdr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, guint *bit_width) static int dissect_udcomphdr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset,
guint *bit_width, guint *comp_meth)
{ {
/* Subtree */ /* Subtree */
proto_item *udcomphdr_ti = proto_tree_add_string_format(tree, hf_oran_udCompHdr, proto_item *udcomphdr_ti = proto_tree_add_string_format(tree, hf_oran_udCompHdr,
@ -1409,6 +1410,9 @@ static int dissect_udcomphdr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
/* udCompMeth */ /* udCompMeth */
guint32 ud_comp_meth; guint32 ud_comp_meth;
proto_tree_add_item_ret_uint(udcomphdr_tree, hf_oran_udCompHdrMeth, tvb, offset, 1, ENC_NA, &ud_comp_meth); proto_tree_add_item_ret_uint(udcomphdr_tree, hf_oran_udCompHdrMeth, tvb, offset, 1, ENC_NA, &ud_comp_meth);
if (comp_meth) {
*comp_meth = ud_comp_meth;
}
offset += 1; offset += 1;
/* Summary */ /* Summary */
@ -1512,7 +1516,7 @@ static int dissect_oran_c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
case SEC_C_NORMAL: /* Section Type "1" */ case SEC_C_NORMAL: /* Section Type "1" */
case SEC_C_UE_SCHED: /* Section Type "5" */ case SEC_C_UE_SCHED: /* Section Type "5" */
/* udCompHdr */ /* udCompHdr */
offset = dissect_udcomphdr(tvb, pinfo, section_tree, offset, &bit_width); offset = dissect_udcomphdr(tvb, pinfo, section_tree, offset, &bit_width, NULL);
/* reserved */ /* reserved */
proto_tree_add_item(section_tree, hf_oran_rsvd8, tvb, offset, 1, ENC_NA); proto_tree_add_item(section_tree, hf_oran_rsvd8, tvb, offset, 1, ENC_NA);
offset += 1; offset += 1;
@ -1533,7 +1537,7 @@ static int dissect_oran_c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
proto_tree_add_item(section_tree, hf_oran_cpLength, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(section_tree, hf_oran_cpLength, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2; offset += 2;
/* udCompHdr */ /* udCompHdr */
offset = dissect_udcomphdr(tvb, pinfo, section_tree, offset, &bit_width); offset = dissect_udcomphdr(tvb, pinfo, section_tree, offset, &bit_width, NULL);
break; break;
case SEC_C_CH_INFO: case SEC_C_CH_INFO:
@ -1573,7 +1577,7 @@ static int dissect_oran_c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
return tvb_captured_length(tvb); return tvb_captured_length(tvb);
} }
/* User plane dissector */ /* User plane dissector (6.3.2) */
static int static int
dissect_oran_u(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) dissect_oran_u(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ {
@ -1648,13 +1652,11 @@ dissect_oran_u(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
return offset; return offset;
} }
guint nBytesForSamples = (sample_bit_width * 12 * 2) / 8;
guint nBytesPerPrb = nBytesForSamples;
if (compression != COMP_NONE)
nBytesPerPrb++; /* 1 extra byte reserved/exponent */
guint bytesLeft; guint bytesLeft;
guint number_of_sections = 0; guint number_of_sections = 0;
guint nBytesPerPrb;
do { do {
proto_item *sectionHeading; proto_item *sectionHeading;
proto_tree *section_tree = proto_tree_add_subtree(oran_tree, tvb, offset, 2, ett_oran_u_section, &sectionHeading, "Section"); proto_tree *section_tree = proto_tree_add_subtree(oran_tree, tvb, offset, 2, ett_oran_u_section, &sectionHeading, "Section");
@ -1681,16 +1683,23 @@ dissect_oran_u(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
if (includeUdCompHeader) { if (includeUdCompHeader) {
/* 5.4.4.10. Described in 6.3.3.13 */ /* 5.4.4.10. Described in 6.3.3.13 */
/* TODO: extract these values to inform how wide IQ samples in each PRB will be? */ /* Extract these values to inform how wide IQ samples in each PRB will be? */
/* TODO: should this be setting sample_bit_width ?? */ /* TODO: should be setting compression here as well? */
guint bit_width; offset = dissect_udcomphdr(tvb, pinfo, section_tree, offset, &sample_bit_width, &compression);
offset = dissect_udcomphdr(tvb, pinfo, section_tree, offset, &bit_width);
/* Not part of udCompHdr */ /* Not part of udCompHdr */
proto_tree_add_item(section_tree, hf_oran_rsvd8, tvb, offset, 1, ENC_NA); proto_tree_add_item(section_tree, hf_oran_rsvd8, tvb, offset, 1, ENC_NA);
offset += 1; offset += 1;
} }
/* Work this out each time, as udCompHdr may have changed things */
guint nBytesForSamples = (sample_bit_width * 12 * 2) / 8;
nBytesPerPrb = nBytesForSamples;
if ((compression != COMP_NONE) && (compression != COMP_MODULATION)) {
nBytesPerPrb++; /* 1 extra byte reserved/exponent */
}
write_section_info(sectionHeading, pinfo, protocol_item, sectionId, startPrbu, numPrbu); write_section_info(sectionHeading, pinfo, protocol_item, sectionId, startPrbu, numPrbu);
/* TODO: should this use the same pref as c-plane? */ /* TODO: should this use the same pref as c-plane? */
@ -1704,7 +1713,7 @@ dissect_oran_u(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
proto_item *prbHeading; proto_item *prbHeading;
proto_tree *rb_tree = proto_tree_add_subtree(section_tree, tvb, offset, nBytesPerPrb, ett_oran_u_prb, &prbHeading, "PRB"); proto_tree *rb_tree = proto_tree_add_subtree(section_tree, tvb, offset, nBytesPerPrb, ett_oran_u_prb, &prbHeading, "PRB");
guint32 exponent = 0; guint32 exponent = 0;
if (compression != COMP_NONE) { if ((compression != COMP_NONE) && (compression != COMP_MODULATION)) {
proto_tree_add_item(rb_tree, hf_oran_rsvd4, tvb, offset, 1, ENC_NA); proto_tree_add_item(rb_tree, hf_oran_rsvd4, tvb, offset, 1, ENC_NA);
proto_tree_add_item_ret_uint(rb_tree, hf_oran_exponent, tvb, offset, 1, ENC_BIG_ENDIAN, &exponent); proto_tree_add_item_ret_uint(rb_tree, hf_oran_exponent, tvb, offset, 1, ENC_BIG_ENDIAN, &exponent);
offset += 1; offset += 1;