Change in osmo-ttcn3-hacks[master]: pcu: Support sending with CS other than CS1 in f_ms_tx_ul_block()

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
Mon Jul 6 12:50:03 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19076 )

Change subject: pcu: Support sending with CS other than CS1 in f_ms_tx_ul_block()
......................................................................

pcu: Support sending with CS other than CS1 in f_ms_tx_ul_block()

Change-Id: Ibafa4246b442e7c26666eb0d37570bfbbf1dbda7
---
M library/RLCMAC_Templates.ttcn
M pcu/GPRS_Components.ttcn
2 files changed, 45 insertions(+), 3 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  neels: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/library/RLCMAC_Templates.ttcn b/library/RLCMAC_Templates.ttcn
index 848052e..560074f 100644
--- a/library/RLCMAC_Templates.ttcn
+++ b/library/RLCMAC_Templates.ttcn
@@ -93,6 +93,30 @@
 		return CS_1;
 	}
 
+	/* Minimum CodingScheme required to fit RLCMAC block */
+	function f_rlcmac_block_len_required_cs_mcs(uint32_t len, boolean is_mcs) return CodingScheme {
+		if (is_mcs) {
+			if (len <= 27) { return MCS_1; }
+			if (len <= 33) { return MCS_2; }
+			if (len <= 42) { return MCS_3; }
+			if (len <= 49) { return MCS_4; }
+			if (len <= 60) { return MCS_5; }
+			if (len <= 61) { return MCS_5; }
+			if (len <= 79) { return MCS_6; }
+			if (len <= 119) { return MCS_7; }
+			if (len <= 143) { return MCS_8; }
+			if (len <= 155) { return MCS_9; }
+			return MCS_1; /* error! */
+		} else {
+			/* 3GPP TS 44.060 Table 10.2.1: RLC data block size, discounting padding in octet */
+			if (len <= 23) { return CS_1; }
+			if (len <= 33) { return CS_2; }
+			if (len <= 39) { return CS_3; }
+			if (len <= 53) { return CS_4; }
+			return CS_1; /* error! */
+		}
+	}
+
 	function f_rlcmac_block_ChCodingCommand2cs_mcs(ChCodingCommand chcc) return CodingScheme {
 		select (chcc) {
 			case (CH_CODING_CS1) { return CS_1; }
diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index 3eb3f9f..6018b7b 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -333,14 +333,32 @@
 	f_pcuif_tx_data_ind(data, ms.lqual_cb, fn);
 }
 
-function f_ms_tx_ul_block(inout GprsMS ms, template (value) RlcmacUlBlock ul_data, uint32_t fn := 0)
+function f_ms_tx_ul_block(inout GprsMS ms, template (value) RlcmacUlBlock ul_data, uint32_t fn := 0, template (omit) CodingScheme force_cs_mcs := omit)
 runs on MS_BTS_IFACE_CT return integer {
 	var octetstring data;
 	var integer padding_len;
+	var CodingScheme cs_mcs;
+	var uint32_t cs_mcs_len;
+
 	/* Encode the payload of DATA.ind */
 	data := enc_RlcmacUlBlock(valueof(ul_data));
-	padding_len := 23 - lengthof(data);
-	data := f_pad_oct(data, 23, '00'O); /* CS-1 */
+
+	if (ispresent(force_cs_mcs)) {
+		cs_mcs := valueof(force_cs_mcs);
+	} else if (ischosen(ul_data.ctrl)) {
+		cs_mcs := CS_1; /* CTRL is always CS1 */
+	} else {
+		/* Add padding to encode payload to minimum required CS/MCS: */
+		cs_mcs := f_rlcmac_block_len_required_cs_mcs(lengthof(data), ischosen(ul_data.data_egprs));
+	}
+
+	cs_mcs_len := f_rlcmac_cs_mcs2block_len(cs_mcs);
+	padding_len := cs_mcs_len - lengthof(data);
+	if (padding_len < 0) {
+		setverdict(fail, "Unable to encode UL block of size ", lengthof(data), " with ", cs_mcs);
+		f_shutdown(__BFILE__, __LINE__);
+	}
+	data := f_pad_oct(data, cs_mcs_len, '00'O);
 
 	/* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
 	f_ms_tx_data_ind(ms, data, fn);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19076
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: Ibafa4246b442e7c26666eb0d37570bfbbf1dbda7
Gerrit-Change-Number: 19076
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200706/a71ce8a2/attachment.htm>


More information about the gerrit-log mailing list