Change in osmo-pcu[master]: sched: Simplify usf selection code

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/+/23488 )


Change subject: sched: Simplify usf selection code
......................................................................

sched: Simplify usf selection code

Simply use the UL TBF pointer all along until the end, instead of setting
both the UL TBF pointer plus the usf var.

This commit is also a preparation for next commit which also selects UL
TBF when a poll is available, to set its USF in the DL message instead
of "USF_UNUSED".

Change-Id: I3aa3886932ef87db18ed7ff6991ea315f481990b
---
M src/gprs_rlcmac_sched.cpp
1 file changed, 6 insertions(+), 13 deletions(-)



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

diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index c54f533..25a3766 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -421,7 +421,7 @@
 	struct gprs_rlcmac_pdch *pdch;
 	struct tbf_sched_candidates tbf_cand = {0};
 	struct gprs_rlcmac_tbf *poll_tbf;
-	struct gprs_rlcmac_ul_tbf *usf_tbf;
+	struct gprs_rlcmac_ul_tbf *usf_tbf = NULL;
 	struct gprs_rlcmac_sba *sba;
 	uint8_t usf;
 	struct msgb *msg = NULL;
@@ -468,27 +468,19 @@
 			"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));
-		usf = USF_UNUSED;
 	/* 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);
-		usf = USF_UNUSED;
 	/* else, we search for uplink resource */
 	} else {
 		usf_tbf = sched_select_uplink(trx, ts, fn, block_nr, pdch, require_gprs_only);
-		if (usf_tbf) {
-			usf = usf_tbf->m_usf[ts];
-			/* 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 (req_mcs_kind == EGPRS && ms_mode(usf_tbf->ms()) != EGPRS)
+		/* 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;
-		} else {
-			usf = USF_UNUSED;
-		}
 	}
 
 	get_tbf_candidates(bts, trx, ts, &tbf_cand);
@@ -521,6 +513,7 @@
 
 	/* set USF */
 	OSMO_ASSERT(msgb_length(msg) > 0);
+	usf = usf_tbf ? usf_tbf->m_usf[ts] : USF_UNUSED;
 	msg->data[0] = (msg->data[0] & 0xf8) | usf;
 
 	/* Used to measure the leak rate, count all blocks */

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I3aa3886932ef87db18ed7ff6991ea315f481990b
Gerrit-Change-Number: 23488
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/591a52dd/attachment.htm>


More information about the gerrit-log mailing list