Change in osmo-pcu[master]: Dl TBF: Get rid of LLC UI dummy blocks following other data

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
Fri Nov 27 16:55:12 UTC 2020


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


Change subject: Dl TBF: Get rid of LLC UI dummy blocks following other data
......................................................................

Dl TBF: Get rid of LLC UI dummy blocks following other data

According to:
* 3GPP TS 44.060 version 16.0.0 "9.3.1a Delayed release of downlink Temporary Block Flow"
* 3GPP TS 44.064 version 16.0.0 "6.4.2.2 Unconfirmed Information (UI) Dummy command"

LLC UI Dummy frames are to be used when there no more data to send, only
in order to delay the release of a TBF. Hence, while not incorrect per
se, makes no sense to send those LLC UI Dummy frames inserted into
rlcmac blocks which already contain other LLC frames, since the MS in
that case is already being kept active.
It only makes sense to send those LLC UI Dummy frames when we have
nothing else to send, that is, alone inside a RLCMAC block without other
LLC frames.

Related: OS#4849
Change-Id: Ifae1a7b2b3dfad8df19585063088ba0df2749c8f
---
M src/encoding.cpp
M src/encoding.h
M src/tbf_dl.cpp
3 files changed, 80 insertions(+), 60 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/87/21387/1

diff --git a/src/encoding.cpp b/src/encoding.cpp
index 23e1460..847e0a1 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -1397,9 +1397,10 @@
 			"larger than space (%d) left in block: copy "
 			"only remaining space, and we are done\n",
 			chunk, space);
-		/* block is filled, so there is no extension */
-		if (e_pointer)
-			*e_pointer |= 0x01;
+		if (e_pointer) {
+			/* LLC frame not finished, so there is no extension octet */
+			*e_pointer |= 0x02; /* set previous M bit = 1 */
+		}
 		/* fill only space */
 		llc->consume(data, space);
 		if (count_payload)
@@ -1438,6 +1439,10 @@
 		if (delimiter != data)
 			memmove(delimiter + 1, delimiter,
 				data - delimiter);
+		if (e_pointer) {
+			*e_pointer &= 0xfe; /* set previous E bit = 0 */
+			*e_pointer |= 0x02; /* set previous M bit = 1 */
+		}
 		data++;
 		(*offset)++;
 		space--;
@@ -1465,12 +1470,16 @@
 	/* make space for delimiter */
 	if (delimiter != data)
 		memmove(delimiter + 1, delimiter, data - delimiter);
+	if (e_pointer) {
+		*e_pointer &= 0xfe; /* set previous E bit = 0 */
+		*e_pointer |= 0x02; /* set previous M bit = 1 */
+	}
 	data++;
 	(*offset)++;
 	space--;
 	/* add LI to delimit frame */
 	li = (struct rlc_li_field *)delimiter;
-	li->e = 0; /* Extension bit, maybe set later */
+	li->e = 1; /*  not more extension, maybe set later */
 	li->m = 0; /* will be set later, if there is more LLC data */
 	li->li = chunk; /* length of chunk */
 	rdbi->e = 0; /* 0: extensions present */
@@ -1483,22 +1492,19 @@
 	space -= chunk;
 	(*offset) += chunk;
 	/* if we have more data and we have space left */
-	if (space > 0 && !is_final) {
-		li->m = 1; /* we indicate more frames to follow */
+	if (space > 0 && !is_final)
 		return Encoding::AR_COMPLETED_SPACE_LEFT;
-	}
+
 	/* if we don't have more LLC frames */
 	if (is_final) {
 		LOGP(DRLCMACDL, LOGL_DEBUG, "-- Final block, so we "
 			"done.\n");
-		li->e = 1; /* we cannot extend */
 		rdbi->cv = 0;
 		return Encoding::AR_COMPLETED_BLOCK_FILLED;
 	}
 	/* we have no space left */
 	LOGP(DRLCMACDL, LOGL_DEBUG, "-- No space left, so we are "
 		"done.\n");
-	li->e = 1; /* we cannot extend */
 	return Encoding::AR_COMPLETED_BLOCK_FILLED;
 }
 
@@ -1594,7 +1600,7 @@
 	space     -= 1;
 	/* add LI to delimit frame */
 	li = (struct rlc_li_field_egprs *)delimiter;
-	li->e = 1; /* Extension bit, maybe set later */
+	li->e = 1; /* not more extension, maybe set later */
 	li->li = chunk; /* length of chunk */
 	/* tell previous extension header about the new one */
 	if (prev_li)
@@ -1611,56 +1617,21 @@
 	space -= chunk;
 	(*offset) += chunk;
 	/* if we have more data and we have space left */
-	if (space > 0) {
-		if (!is_final)
+	if (!is_final) {
+		if (space > 0) {
 			return Encoding::AR_COMPLETED_SPACE_LEFT;
-
+		} else {
+			/* we have no space left */
+			LOGP(DRLCMACDL, LOGL_DEBUG, "-- No space left, so we are "
+				"done.\n");
+			return Encoding::AR_COMPLETED_BLOCK_FILLED;
+		}
+	} else {
 		/* we don't have more LLC frames */
-		/* We will have to add another chunk with filling octets */
-		LOGP(DRLCMACDL, LOGL_DEBUG,
-			"-- There is remaining space (%d): add filling byte chunk\n",
-			space);
-
-		if (delimiter != data)
-			memmove(delimiter + 1, delimiter, data - delimiter);
-
-		data      += 1;
-		(*offset) += 1;
-		space     -= 1;
-
-		/* set filling bytes extension */
-		li = (struct rlc_li_field_egprs *)delimiter;
-		li->e = 1;
-		li->li = 127;
-
-		/* tell previous extension header about the new one */
-		if (prev_li)
-			prev_li->e = 0;
-
-		delimiter++;
-		(*num_chunks)++;
-
-		rdbi->cv = 0;
-
-		LOGP(DRLCMACDL, LOGL_DEBUG, "-- Final block, so we "
-			"are done.\n");
-
-		*offset = rdbi->data_len;
-		return Encoding::AR_COMPLETED_BLOCK_FILLED;
-	}
-
-	if (is_final) {
-		/* we don't have more LLC frames */
-		LOGP(DRLCMACDL, LOGL_DEBUG, "-- Final block, so we "
-			"are done.\n");
+		LOGP(DRLCMACDL, LOGL_DEBUG, "-- Final block, so we are done.\n");
 		rdbi->cv = 0;
 		return Encoding::AR_COMPLETED_BLOCK_FILLED;
 	}
-
-	/* we have no space left */
-	LOGP(DRLCMACDL, LOGL_DEBUG, "-- No space left, so we are "
-		"done.\n");
-	return Encoding::AR_COMPLETED_BLOCK_FILLED;
 }
 
 /*!
@@ -1697,6 +1668,36 @@
 	return AR_NEED_MORE_BLOCKS;
 }
 
+void Encoding::rlc_data_to_dl_append_egprs_li_padding(
+	int offset, int num_chunks, uint8_t *data_block)
+{
+	struct rlc_li_field_egprs *li;
+	struct rlc_li_field_egprs *prev_li;
+	uint8_t *delimiter, *data;
+
+	LOGP(DRLCMACDL, LOGL_DEBUG, "Adding LI=127 to signal padding\n");
+
+	data = data_block + offset;
+	delimiter = data_block + num_chunks;
+	prev_li = (struct rlc_li_field_egprs *)
+		(num_chunks ? delimiter - 1 : NULL);
+
+	/* we don't have more LLC frames */
+	/* We will have to add another chunk with filling octets */
+
+	if (delimiter != data)
+		memmove(delimiter + 1, delimiter, data - delimiter);
+
+	/* set filling bytes extension */
+	li = (struct rlc_li_field_egprs *)delimiter;
+	li->e = 1;
+	li->li = 127;
+
+	/* tell previous extension header about the new one */
+	if (prev_li)
+		prev_li->e = 0;
+}
+
 /*
  * Refer 44.060 version 7.27.0 Release 7
  * section 7.1.3.2.1 On receipt of a PACKET RESOURCE REQUEST message
diff --git a/src/encoding.h b/src/encoding.h
index 5f8496e..6ac004d 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -104,4 +104,6 @@
 		struct gprs_rlc_data_block_info *rdbi, enum CodingScheme cs,
 		gprs_llc *llc, int *offset, int *num_chunks,
 		uint8_t *data, bool is_final, int *count_payload);
+	static void rlc_data_to_dl_append_egprs_li_padding(
+		int offset, int num_chunks, uint8_t *data_block);
 };
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 4b184b8..d932a83 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -680,9 +680,30 @@
 		int payload_written = 0;
 
 		if (m_llc.frame_length() == 0) {
-			/* nothing to sent - delay the release of the TBF */
+			/* It is not clear, when the next real data will
+			 * arrive, so request a DL ack/nack now */
+			request_dl_ack();
 
 			int space = block_data_len - write_offset;
+
+			if (num_chunks != 0) {
+				/* Nothing to send, and we already put some data in
+				 * rlcmac data block, we are done */
+				LOGPTBFDL(this, LOGL_DEBUG,
+					  "LLC queue completely drained and there's "
+					  "still %d free bytes in rlcmac data block\n", space);
+				if (mcs_is_edge(cs)) {
+					/* in EGPRS there's no M bit, so we need
+					 * to flag padding with LI=127 */
+					Encoding::rlc_data_to_dl_append_egprs_li_padding(write_offset, num_chunks, data);
+				}
+				break;
+			}
+
+			/* Nothing to send from upper layers (LLC), but still
+			 * requested to send something to MS to delay the
+			 * release of the TBF. See 3GPP TS 44.060 9.3.1a
+			 * "Delayed release of downlink Temporary Block Flow" */
 			/* A header will need to by added, so we just need
 			 * space-1 octets */
 			m_llc.put_dummy_frame(space - 1);
@@ -691,10 +712,6 @@
 			if (m_last_dl_drained_fn < 0)
 				m_last_dl_drained_fn = fn;
 
-			/* It is not clear, when the next real data will
-			 * arrive, so request a DL ack/nack now */
-			request_dl_ack();
-
 			LOGPTBFDL(this, LOGL_DEBUG,
 				  "Empty chunk, added LLC dummy command of size %d, drained_since=%d\n",
 				  m_llc.frame_length(), frames_since_last_drain(fn));

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ifae1a7b2b3dfad8df19585063088ba0df2749c8f
Gerrit-Change-Number: 21387
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/20201127/8a0a899e/attachment.htm>


More information about the gerrit-log mailing list