[PATCH] osmo-pcu[master]: Refactoring write_packet_ack_nack_desc_egprs to support CRBB

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/.

pravin gerrit-no-reply at lists.osmocom.org
Fri Oct 28 10:22:45 UTC 2016


Hello Neels Hofmeyr, Jenkins Builder, Holger Freyther,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/412

to look at the new patch set (#4).

Refactoring write_packet_ack_nack_desc_egprs to support CRBB

Change-Id: Ie5c25b6ee30f2f1b613e923c234b03a6ffe12ae2
---
M src/encoding.cpp
M tests/tbf/TbfTest.err
2 files changed, 39 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/12/412/4

diff --git a/src/encoding.cpp b/src/encoding.cpp
index 7d3fa14..3325a49 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -332,7 +332,7 @@
 
 	if (!use_egprs) {
 		bitvec_write_field(dest, wp,0x0,1); // Message escape
-		bitvec_write_field(dest, wp,tbf->current_cs().to_num()-1, 2); // CHANNEL_CODING_COMMAND 
+		bitvec_write_field(dest, wp, tbf->current_cs().to_num()-1, 2); // CHANNEL_CODING_COMMAND
 		bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING 
 		bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on
 		bitvec_write_field(dest, wp,tbf->ta(),6); // TIMING_ADVANCE_VALUE
@@ -355,7 +355,7 @@
 		bitvec_write_field(dest, wp,ws_enc,5); // EGPRS Window Size
 		bitvec_write_field(dest, wp,0x0,1); // No Access Technologies Request
 		bitvec_write_field(dest, wp,0x0,1); // No ARAC RETRANSMISSION REQUEST
-		bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING 
+		bitvec_write_field(dest, wp, 0x1, 1); // TLLI_BLOCK_CHANNEL_CODING
 		bitvec_write_field(dest, wp,0x0,1); // No BEP_PERIOD2
 
 		bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on
@@ -612,14 +612,17 @@
 	gprs_rlc_ul_window *window, bool is_final)
 {
 	int urbb_len = 0;
-	int crbb_len = 0;
 	int len;
 	bool bow = true;
 	bool eow = true;
 	int ssn = window->mod_sns(window->v_q() + 1);
 	int num_blocks = window->mod_sns(window->v_r() - window->v_q());
 	int esn_crbb = window->mod_sns(ssn - 1);
-	int rest_bits = dest->data_len * 8 - wp;
+	/* Bit 0 at the end is mandatory Table 11.2.28.1 in 44.060 */
+	int rest_bits = dest->data_len * 8 - wp - 1;
+	int is_compressed = 0;
+	bool len_coded = true;
+	uint8_t i;
 
 	if (num_blocks > 0)
 		/* V(Q) is NACK and omitted -> SSN = V(Q) + 1 */
@@ -627,33 +630,31 @@
 
 	if (num_blocks > window->ws())
 		num_blocks = window->ws();
+	/* TODO Compression support */
+	if (is_compressed == 0) {
+		/* Union bit takes 1 bit */
+		/* Other fields in descr for uncompresed bitmap takes 15 bits*/
 
-	if (num_blocks > rest_bits) {
-		eow = false;
-		urbb_len = rest_bits;
-		/* TODO: use compression, start encoding bits and stop when the
-		 * space is exhausted. Use the first combination that encodes
-		 * all bits. If there is none, use the combination that encodes
-		 * the largest number of bits (e.g. by setting num_blocks to the
-		 * max and repeating the construction).
-		 */
-	} else if (num_blocks > rest_bits - 9) {
-		/* union bit and length field take 9 bits */
-		eow = false;
-		urbb_len = rest_bits - 9;
-		/* TODO: use compression (see above) */
-	} else
-		urbb_len = num_blocks;
-
-	if (urbb_len + crbb_len == rest_bits)
-		len = -1;
-	else if (crbb_len == 0)
+		if (num_blocks > rest_bits - 15 - 1) {
+			eow = false;
+			urbb_len = rest_bits - 15 - 1;
+			len_coded = false;
+		} else if (num_blocks == rest_bits - 15 - 1) {
+			urbb_len = rest_bits - 15 - 1;
+			len_coded = false;
+		/* Union bit takes 1 bit length field takes 8 bits*/
+		} else if (num_blocks > rest_bits - 15 - 9) {
+			eow = false;
+			urbb_len = rest_bits - 15 - 9;
+		} else
+			urbb_len = num_blocks;
 		len = urbb_len + 15;
-	else
-		len = urbb_len + crbb_len + 23;
+	} else {
+		/* TODO Compressed bitmap */
+	}
 
 	/* EGPRS Ack/Nack Description IE */
-	if (len < 0) {
+	if (len_coded == false) {
 		bitvec_write_field(dest, wp, 0, 1); // 0: don't have length
 	} else {
 		bitvec_write_field(dest, wp, 1, 1); // 1: have length
@@ -664,17 +665,19 @@
 	bitvec_write_field(dest, wp, bow, 1); // BEGINNING_OF_WINDOW
 	bitvec_write_field(dest, wp, eow, 1); // END_OF_WINDOW
 	bitvec_write_field(dest, wp, ssn, 11); // STARTING_SEQUENCE_NUMBER
-	bitvec_write_field(dest, wp, 0, 1); // 0: don't have CRBB
-
-	/* TODO: Add CRBB support */
-
+	if (is_compressed) {
+		/* TODO Add CRBB support */
+	} else
+		bitvec_write_field(dest, wp, 0, 1); // CRBB_Exist
 	LOGP(DRLCMACUL, LOGL_DEBUG,
-		" - EGPRS URBB, len = %d, SSN = %d, ESN_CRBB = %d, "
+		"EGPRS URBB, urbb len = %d, SSN = %d, ESN_CRBB = %d, "
+		"len present = %s,desc len = %d, "
 		"SNS = %d, WS = %d, V(Q) = %d, V(R) = %d%s%s\n",
-		urbb_len, ssn, esn_crbb,
+		urbb_len, ssn, esn_crbb, len_coded ? "yes" : "No", len,
 		window->sns(), window->ws(), window->v_q(), window->v_r(),
 		bow ? ", BOW" : "", eow ? ", EOW" : "");
-	for (int i = urbb_len; i > 0; i--) {
+
+	for (i = urbb_len; i > 0; i--) {
 		/* Set bit at the appropriate position (see 3GPP TS 04.60 12.3.1) */
 		bool is_ack = window->m_v_n.is_received(esn_crbb + i);
 		bitvec_write_field(dest, wp, is_ack, 1);
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 8c6b78c..effae4c 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -6278,7 +6278,7 @@
 -- Frame 1 starts at offset 0, length=37, is_complete=0
 - No gaps in received block, last block: BSN=1 CV=7
 Encoding Ack/Nack for TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW EGPRS) (final=0)
- - EGPRS URBB, len = 0, SSN = 3, ESN_CRBB = 2, SNS = 2048, WS = 64, V(Q) = 2, V(R) = 2, BOW, EOW
+EGPRS URBB, urbb len = 0, SSN = 3, ESN_CRBB = 2, len present = yes,desc len = 15, SNS = 2048, WS = 64, V(Q) = 2, V(R) = 2, BOW, EOW
 Uplink Ack/Nack bit count 98, max 184, message = 40 24 01 3f 3e 24 46 68 90 87 b0 06 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 Got RLC block, coding scheme: MCS-3, length: 42 (42))
   UL data: 1d 20 40 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
@@ -6291,7 +6291,7 @@
 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW EGPRS): data_length=37, data=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
 - Raising V(R) to 5
 Encoding Ack/Nack for TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW EGPRS) (final=0)
- - EGPRS URBB, len = 2, SSN = 3, ESN_CRBB = 2, SNS = 2048, WS = 64, V(Q) = 2, V(R) = 5, BOW, EOW
+EGPRS URBB, urbb len = 2, SSN = 3, ESN_CRBB = 2, len present = yes,desc len = 17, SNS = 2048, WS = 64, V(Q) = 2, V(R) = 5, BOW, EOW
 Uplink Ack/Nack bit count 100, max 184, message = 40 24 01 3f 3e 24 46 68 90 88 b0 06 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW EGPRS)', TA=7
 Got MS: TLLI = 0xf1223344, TA = 7

-- 
To view, visit https://gerrit.osmocom.org/412
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie5c25b6ee30f2f1b613e923c234b03a6ffe12ae2
Gerrit-PatchSet: 4
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: prasadkg <Prasad.Kaup at radisys.com>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: arvind.sirsikar <arvind.sirsikar at radisys.com>
Gerrit-Reviewer: prasadkg <Prasad.Kaup at radisys.com>



More information about the gerrit-log mailing list