Change in osmo-pcu[master]: Set matching USF if available when polling a UL TBF

pespin gerrit-no-reply at lists.osmocom.org
Wed Mar 24 18:12:10 UTC 2021


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


Change subject: Set matching USF if available when polling a UL TBF
......................................................................

Set matching USF if available when polling a UL TBF

When the scheduler detects it's time to receive a UL block due to a
scheduled poll, if that polling is done on a UL TBF, then use its USF if
available instead of using USF_UNUSED (=7) when sending a DL block on
that same FN.

This is not really needed for correct work, since MS take care
themselves of scheduling a UL block when they receive the poll (RRBP)
some time before, and don't check the USF at the time of transmitting.
In any case, it helps understand better when looking at pcap traces that
indeed it a UL block from that MS was requested, instead of setting USF
to 7.

Related: OS#5033
Change-Id: I2ad9d8ea6afc8f83192033470bd27010a7474430
---
M src/gprs_rlcmac_sched.cpp
M src/tbf_ul.cpp
M src/tbf_ul.h
3 files changed, 23 insertions(+), 16 deletions(-)



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

diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 25a3766..c431d9c 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -461,27 +461,31 @@
 
 	/* polling for next uplink block */
 	poll_fn = rts_next_fn(fn, block_nr);
-
-	/* check uplink resource for polling */
-	if ((poll_tbf = pdch_ulc_get_tbf_poll(pdch->ulc, poll_fn))) {
+	/* check for sba */
+	if ((sba = pdch_ulc_get_sba(pdch->ulc, poll_fn))) {
+		LOGPDCH(pdch, DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: "
+			"FN=%d block_nr=%d scheduling free USF for "
+			"single block allocation at FN=%d\n", fn, block_nr, sba->fn);
+	/* else, check uplink resource for polling */
+	} else if ((poll_tbf = pdch_ulc_get_tbf_poll(pdch->ulc, poll_fn))) {
 		LOGP(DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: TRX=%d "
 			"TS=%d FN=%d block_nr=%d scheduling free USF for "
 			"polling at FN=%d of %s\n", trx, ts, fn,
 			block_nr, poll_fn, tbf_name(poll_tbf));
-	/* else. check for sba */
-	} else if ((sba = pdch_ulc_get_sba(pdch->ulc, poll_fn))) {
-		LOGPDCH(pdch, DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: "
-			"FN=%d block_nr=%d scheduling free USF for "
-			"single block allocation at FN=%d\n", fn, block_nr, sba->fn);
-	/* else, we search for uplink resource */
+		/* If POLL TBF is UL and already has a USF assigned on this TS,
+		 * let's set its USF in the DL msg. This is not really needed,
+		 * but it helps understand better the flow when looking at
+		 * pcaps. */
+		if (poll_tbf->direction == GPRS_RLCMAC_UL_TBF && as_ul_tbf(poll_tbf)->m_usf[ts] != USF_INVALID)
+			usf_tbf = as_ul_tbf(poll_tbf);
+	/* else, search for uplink tbf */
 	} else {
 		usf_tbf = sched_select_uplink(trx, ts, fn, block_nr, pdch, require_gprs_only);
-		/* If MS selected for USF is GPRS-only, then it will only be
-		 * able to read USF if dl block uses GMSK * (CS1-4, MCS1-4)
-		 */
-		if (usf_tbf && req_mcs_kind == EGPRS && ms_mode(usf_tbf->ms()) != EGPRS)
-				req_mcs_kind = EGPRS_GMSK;
 	}
+	/* If MS selected for USF is GPRS-only, then it will only be
+	 * able to read USF if dl block uses GMSK * (CS1-4, MCS1-4) */
+	if (usf_tbf && req_mcs_kind == EGPRS && ms_mode(usf_tbf->ms()) != EGPRS)
+		req_mcs_kind = EGPRS_GMSK;
 
 	get_tbf_candidates(bts, trx, ts, &tbf_cand);
 
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index 8ef600b..f226b29 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -213,7 +213,7 @@
 	m_ul_gprs_ctrs(NULL),
 	m_ul_egprs_ctrs(NULL)
 {
-	memset(&m_usf, 0, sizeof(m_usf));
+	memset(&m_usf, USF_INVALID, sizeof(m_usf));
 }
 
 /*
diff --git a/src/tbf_ul.h b/src/tbf_ul.h
index 8713596..0c78e10 100644
--- a/src/tbf_ul.h
+++ b/src/tbf_ul.h
@@ -47,6 +47,9 @@
         TBF_CTR_EGPRS_UL_MCS9,
 };
 
+/* Used in ul_tbf->m_usf[] to flag unassigned USF on a given TS: */
+#define USF_INVALID 0xFF
+
 #define LOGPTBFUL(tbf, level, fmt, args...) LOGP(DTBFUL, level, "%s " fmt, tbf_name(tbf), ## args)
 
 struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf {
@@ -90,7 +93,7 @@
 	 * variables are in both (dl and ul) structs and not outside union.
 	 */
 	int32_t m_rx_counter; /* count all received blocks */
-	uint8_t m_usf[8];	/* list USFs per PDCH (timeslot) */
+	uint8_t m_usf[8];	/* list USFs per PDCH (timeslot), initialized to USF_INVALID */
 	uint8_t m_contention_resolution_done; /* set after done */
 	uint8_t m_final_ack_sent; /* set if we sent final ack */
 

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I2ad9d8ea6afc8f83192033470bd27010a7474430
Gerrit-Change-Number: 23489
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/20210324/2cc15c0f/attachment.htm>


More information about the gerrit-log mailing list