Change in osmo-ttcn3-hacks[master]: RLCMAC_EncDec: Provide decoded (m)cs in (E)GPRS data blocks

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Nov 3 20:12:58 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21033 )


Change subject: RLCMAC_EncDec: Provide decoded (m)cs in (E)GPRS data blocks
......................................................................

RLCMAC_EncDec: Provide decoded (m)cs in (E)GPRS data blocks

Let's provide this information to higher layer since CS is mostly
discovered by original bitstring size which is available during
decoding.

Call the size2mcs converter in each function to avoid having to pass it
as a parameter and have it selfcontained, meaning one can simply call
decode(bitstring) from TTCN3 code and be done with it.

Change-Id: I80ed44e575cc0a11510832e5bbfc07173e7b75b8
---
M library/RLCMAC_EncDec.cc
M library/RLCMAC_Templates.ttcn
M library/RLCMAC_Types.ttcn
3 files changed, 27 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/33/21033/1

diff --git a/library/RLCMAC_EncDec.cc b/library/RLCMAC_EncDec.cc
index d25a7e0..6b78064 100644
--- a/library/RLCMAC_EncDec.cc
+++ b/library/RLCMAC_EncDec.cc
@@ -450,6 +450,8 @@
 	TTCN_Buffer ttcn_buffer(stream);
 	int num_llc_blocks = 0;
 
+	ret_val.cs() = payload_len_2_coding_scheme(stream.lengthof());
+
 	/* use automatic/generated decoder for header */
 	ret_val.mac__hdr().decode(DlMacDataHeader_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
 
@@ -541,7 +543,7 @@
 }
 
 static
-RlcmacDlEgprsDataBlock dec__RlcmacDlEgprsDataBlock(const OCTETSTRING& stream, CodingScheme::enum_type mcs)
+RlcmacDlEgprsDataBlock dec__RlcmacDlEgprsDataBlock(const OCTETSTRING& stream)
 {
 	RlcmacDlEgprsDataBlock ret_val;
 	TTCN_Buffer ttcn_buffer(stream);
@@ -551,7 +553,8 @@
 	unsigned int num_calls;
 	const uint8_t *ti_e;
 
-	switch (mcs) {
+	ret_val.mcs() = payload_len_2_coding_scheme(stream.lengthof());
+	switch (ret_val.mcs()) {
 	case CodingScheme::MCS__0:
 	case CodingScheme::MCS__1:
 	case CodingScheme::MCS__2:
@@ -569,7 +572,7 @@
 		ret_val.mac__hdr() = dec__EgprsDlMacDataHeader_type1(stream);
 		break;
 	}
-	setup_rlc_mac_priv(mcs, ret_val.mac__hdr().header__type(), false,
+	setup_rlc_mac_priv(ret_val.mcs(), ret_val.mac__hdr().header__type(), false,
 			   &num_calls, &data_block_bits, data_block_offsets);
 	get_egprs_data_block(ttcn_buffer, data_block_offsets[0], data_block_bits, aligned_buffer);
 
@@ -611,10 +614,10 @@
 {
 	RlcmacDlBlock ret_val;
 	size_t stream_len = stream.lengthof();
-	CodingScheme::enum_type mcs = payload_len_2_coding_scheme(stream_len);
+	CodingScheme::enum_type cs_mcs = payload_len_2_coding_scheme(stream_len);
 	unsigned char pt;
 
-	switch (mcs) {
+	switch (cs_mcs) {
 	case CodingScheme::CS__1:
 	case CodingScheme::CS__2:
 	case CodingScheme::CS__3:
@@ -635,7 +638,7 @@
 	case CodingScheme::MCS__7:
 	case CodingScheme::MCS__8:
 	case CodingScheme::MCS__9:
-		ret_val.data__egprs() = dec__RlcmacDlEgprsDataBlock(stream, mcs);
+		ret_val.data__egprs() = dec__RlcmacDlEgprsDataBlock(stream);
 		break;
 	}
 	return ret_val;
@@ -655,6 +658,8 @@
 	stream.log();
 	TTCN_Logger::end_event();
 
+	ret_val.cs() = payload_len_2_coding_scheme(stream.lengthof());
+
 	/* use automatic/generated decoder for header */
 	ret_val.mac__hdr().decode(UlMacDataHeader_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
 
@@ -792,7 +797,7 @@
 	return ret_val;
 }
 
-RlcmacUlEgprsDataBlock dec__RlcmacUlEgprsDataBlock(const OCTETSTRING& stream, CodingScheme::enum_type mcs)
+RlcmacUlEgprsDataBlock dec__RlcmacUlEgprsDataBlock(const OCTETSTRING& stream)
 {
 	RlcmacUlEgprsDataBlock ret_val;
 	TTCN_Buffer ttcn_buffer(stream);
@@ -802,7 +807,8 @@
 	unsigned int num_calls;
 	const uint8_t *ti_e;
 
-	switch (mcs) {
+	ret_val.mcs() = payload_len_2_coding_scheme(stream.lengthof());
+	switch (ret_val.mcs()) {
 	case CodingScheme::MCS__1:
 	case CodingScheme::MCS__2:
 	case CodingScheme::MCS__3:
@@ -819,7 +825,7 @@
 		ret_val.mac__hdr() = dec__EgprsUlMacDataHeader_type1(stream);
 		break;
 	}
-	setup_rlc_mac_priv(mcs, ret_val.mac__hdr().header__type(), true,
+	setup_rlc_mac_priv(ret_val.mcs(), ret_val.mac__hdr().header__type(), true,
 			   &num_calls, &data_block_bits, data_block_offsets);
 	get_egprs_data_block(ttcn_buffer, data_block_offsets[0], data_block_bits, aligned_buffer);
 
@@ -889,10 +895,10 @@
 {
 	RlcmacUlBlock ret_val;
 	size_t stream_len = stream.lengthof();
-	CodingScheme::enum_type mcs = payload_len_2_coding_scheme(stream_len);
+	CodingScheme::enum_type cs_mcs = payload_len_2_coding_scheme(stream_len);
 	unsigned char pt;
 
-	switch (mcs) {
+	switch (cs_mcs) {
 	case CodingScheme::CS__1:
 	case CodingScheme::CS__2:
 	case CodingScheme::CS__3:
@@ -912,7 +918,7 @@
 	case CodingScheme::MCS__7:
 	case CodingScheme::MCS__8:
 	case CodingScheme::MCS__9:
-		ret_val.data__egprs() = dec__RlcmacUlEgprsDataBlock(stream, mcs);
+		ret_val.data__egprs() = dec__RlcmacUlEgprsDataBlock(stream);
 		break;
 	}
 
diff --git a/library/RLCMAC_Templates.ttcn b/library/RLCMAC_Templates.ttcn
index edf6516..f7bd570 100644
--- a/library/RLCMAC_Templates.ttcn
+++ b/library/RLCMAC_Templates.ttcn
@@ -374,6 +374,7 @@
 	template RlcmacUlBlock t_RLCMAC_UL_DATA(template uint5_t tfi, template uint4_t cv, template uint7_t bsn,
 						template LlcBlocks blocks := {}, template boolean stall := false) := {
 		data := {
+			cs := CS_1, /* TODO: make this available to template */
 			mac_hdr := {
 				payload_type := MAC_PT_RLC_DATA,
 				countdown := cv,
@@ -394,6 +395,7 @@
 	template RlcmacUlBlock t_RLCMAC_UL_DATA_TLLI(template uint5_t tfi, template uint4_t cv, template uint7_t bsn,
 						     template LlcBlocks blocks := {}, template boolean stall := false, template GprsTlli tlli) := {
 		data := {
+			cs := CS_1, /* TODO: make this available to template */
 			mac_hdr := {
 				payload_type := MAC_PT_RLC_DATA,
 				countdown := cv,
@@ -417,6 +419,7 @@
 						      template uint5_t tfi, template uint4_t cv,
 						      template uint11_t bsn1, template EgprsLlcBlocks blocks := {}) := {
 		data_egprs := {
+			mcs := mcs,
 			mac_hdr := {
 				header_type := f_rlcmac_mcs2headertype(mcs),
 				tfi := tfi,
@@ -657,6 +660,7 @@
 						   template (present) MacRrbp rrbp := ?,
 						   template (present) uint3_t usf := ?) := {
 		data := {
+			cs := ?,
 			mac_hdr := {
 				mac_hdr := {
 					payload_type := MAC_PT_RLC_DATA,
@@ -672,6 +676,7 @@
 
 	template RlcmacDlBlock tr_RLCMAC_DATA_EGPRS := {
 		data_egprs := {
+			mcs := ?,
 			mac_hdr := ?,
 			fbi := ?,
 			e := ?,
diff --git a/library/RLCMAC_Types.ttcn b/library/RLCMAC_Types.ttcn
index 96b8a64..80a9997 100644
--- a/library/RLCMAC_Types.ttcn
+++ b/library/RLCMAC_Types.ttcn
@@ -182,6 +182,7 @@
 		DlMacHdrDataExt		hdr_ext
 	} with { variant "" };
 	type record RlcmacDlDataBlock {
+		CodingScheme		cs, /* Provided by C++ Decoder */
 		DlMacDataHeader		mac_hdr,
 		/* Octet 3..M / N: manual C++ Decoder */
 		LlcBlocks		blocks
@@ -230,6 +231,7 @@
 	} with { variant "" };
 	/* Manual C++ Decoder: */
 	type record RlcmacDlEgprsDataBlock {
+		CodingScheme		mcs, /* Provided by C++ Decoder */
 		EgprsDlMacDataHeader	mac_hdr,
 		boolean			fbi,
 		boolean			e,
@@ -286,6 +288,7 @@
 	};
 	/* Manual C++ Decoder:  10.3a.2.1 EGPRS Uplink RLC data block */
 	type record RlcmacUlEgprsDataBlock {
+		CodingScheme		mcs, /* Provided by C++ Decoder */
 		EgprsUlMacDataHeader	mac_hdr,
 		boolean			tlli_ind,
 		boolean			e,
@@ -300,6 +303,7 @@
 
 	/* TS 44.060 10.2.2 */
 	type record RlcmacUlDataBlock {
+		CodingScheme		cs, /* Provided by C++ Decoder */
 		/* MAC header */
 		UlMacDataHeader		mac_hdr,
 		/* Octet 3 ... M (optional): manual C++ Decoder */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21033
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I80ed44e575cc0a11510832e5bbfc07173e7b75b8
Gerrit-Change-Number: 21033
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201103/a2af3160/attachment.htm>


More information about the gerrit-log mailing list