Change in osmo-pcu[master]: sched: Use new PDCH UL Controller

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
Thu Mar 11 18:40:20 UTC 2021


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


Change subject: sched: Use new PDCH UL Controller
......................................................................

sched: Use new PDCH UL Controller

Take the time to also do small refactorings to clarify and simplify the
function, by using rts_next_fn() already available in pcu_utils.h and
getting rid of poll_tbf from tbf_candidates, which clearly follows
another objective.

Using PDCH UL Controller has the advantatge that we don't need to check
poll_scheduled() on each TBF, but only do the query once.

Related: OS#5020
Change-Id: Ia60bb5249a9837dec1f42180e44d9848334d86d6
---
M src/gprs_rlcmac_sched.cpp
M src/pdch_ul_controller.c
M src/pdch_ul_controller.h
3 files changed, 25 insertions(+), 24 deletions(-)



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

diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index ce8fd02..c63ed6e 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -35,36 +35,25 @@
 }
 
 struct tbf_sched_candidates {
-	struct gprs_rlcmac_tbf *poll;
 	struct gprs_rlcmac_tbf *ul_ass;
 	struct gprs_rlcmac_tbf *dl_ass;
 	struct gprs_rlcmac_tbf *nacc;
 	struct gprs_rlcmac_ul_tbf *ul_ack;
 };
 
-static uint32_t sched_poll(struct gprs_rlcmac_bts *bts,
-		    uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr,
-		    struct tbf_sched_candidates *tbf_cand)
+static void get_tbf_candidates(const struct gprs_rlcmac_bts *bts, uint8_t trx,
+			       uint8_t ts, struct tbf_sched_candidates *tbf_cand)
 {
 	struct gprs_rlcmac_ul_tbf *ul_tbf;
 	struct gprs_rlcmac_dl_tbf *dl_tbf;
 	struct llist_item *pos;
-	uint32_t poll_fn;
 
-	/* check special TBF for events */
-	poll_fn = fn + 4;
-	if ((block_nr % 3) == 2)
-		poll_fn ++;
-	poll_fn = poll_fn % GSM_MAX_FN;
 	llist_for_each_entry(pos, &bts->ul_tbfs, list) {
 		ul_tbf = as_ul_tbf((struct gprs_rlcmac_tbf *)pos->entry);
 		OSMO_ASSERT(ul_tbf);
 		/* this trx, this ts */
 		if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts))
 			continue;
-		/* polling for next uplink block */
-		if (ul_tbf->poll_scheduled() && ul_tbf->poll_fn == poll_fn)
-			tbf_cand->poll = ul_tbf;
 		if (ul_tbf->ul_ack_state_is(GPRS_RLCMAC_UL_ACK_SEND_ACK))
 			tbf_cand->ul_ack = ul_tbf;
 		if (ul_tbf->dl_ass_state_is(GPRS_RLCMAC_DL_ASS_SEND_ASS))
@@ -84,9 +73,6 @@
 		/* this trx, this ts */
 		if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts))
 			continue;
-		/* polling for next uplink block */
-		if (dl_tbf->poll_scheduled() && dl_tbf->poll_fn == poll_fn)
-			tbf_cand->poll = dl_tbf;
 		if (dl_tbf->dl_ass_state_is(GPRS_RLCMAC_DL_ASS_SEND_ASS))
 			tbf_cand->dl_ass = dl_tbf;
 		if (dl_tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS)
@@ -96,8 +82,6 @@
 		if (dl_tbf->is_tfi_assigned() && ms_nacc_rts(dl_tbf->ms()))
 			tbf_cand->nacc = dl_tbf;
 	}
-
-	return poll_fn;
 }
 
 static struct gprs_rlcmac_ul_tbf *sched_select_uplink(uint8_t trx, uint8_t ts, uint32_t fn,
@@ -436,10 +420,12 @@
 {
 	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_sba *sba;
 	uint8_t usf;
 	struct msgb *msg = NULL;
-	uint32_t poll_fn, sba_fn;
+	uint32_t poll_fn;
 	enum pcu_gsmtap_category gsmtap_cat;
 	bool tx_is_egprs = false;
 	bool require_gprs_only;
@@ -473,19 +459,21 @@
 		req_mcs_kind = EGPRS; /* all kinds are fine */
 	}
 
-	poll_fn = sched_poll(bts, trx, ts, fn, block_nr, &tbf_cand);
+	/* polling for next uplink block */
+	poll_fn = rts_next_fn(fn, block_nr);
+
 	/* check uplink resource for polling */
-	if (tbf_cand.poll) {
+	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(tbf_cand.poll));
+			block_nr, poll_fn, tbf_name(poll_tbf));
 		usf = USF_UNUSED;
 	/* else. check for sba */
-	} else if ((sba_fn = find_sba_rts(pdch, fn, block_nr)) != 0xffffffff) {
+	} 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);
+			"single block allocation at FN=%d\n", fn, block_nr, sba->fn);
 		usf = USF_UNUSED;
 	/* else, we search for uplink resource */
 	} else {
@@ -503,6 +491,8 @@
 		}
 	}
 
+	get_tbf_candidates(bts, trx, ts, &tbf_cand);
+
 	/* Prio 1: select control message */
 	if ((msg = sched_select_ctrl_msg(pdch, fn, block_nr, &tbf_cand))) {
 			gsmtap_cat = PCU_GSMTAP_C_DL_CTRL;
diff --git a/src/pdch_ul_controller.c b/src/pdch_ul_controller.c
index 622dfaf..7106048 100644
--- a/src/pdch_ul_controller.c
+++ b/src/pdch_ul_controller.c
@@ -106,6 +106,16 @@
 	return item->sba.sba;
 }
 
+struct gprs_rlcmac_tbf *pdch_ulc_get_tbf_poll(struct pdch_ulc *ulc, uint32_t fn)
+{
+	struct pdch_ulc_node *item = pdch_ulc_get_node(ulc, fn);
+	if (!item || item->type != PDCH_ULC_NODE_TBF_POLL) {
+		/* It's OK if we don't find one, this func is used by RTS to see if we need to schedule one */
+		return NULL;
+	}
+	return item->tbf_poll.poll_tbf;
+}
+
 bool pdch_ulc_fn_is_free(struct pdch_ulc *ulc, uint32_t fn)
 {
 	return !pdch_ulc_get_node(ulc, fn);
diff --git a/src/pdch_ul_controller.h b/src/pdch_ul_controller.h
index 53604a9..eb93143 100644
--- a/src/pdch_ul_controller.h
+++ b/src/pdch_ul_controller.h
@@ -75,6 +75,7 @@
 struct pdch_ulc_node *pdch_ulc_get_node(struct pdch_ulc *ulc, uint32_t fn);
 struct pdch_ulc_node *pdch_ulc_pop_node(struct pdch_ulc *ulc, uint32_t fn);
 struct gprs_rlcmac_sba *pdch_ulc_get_sba(struct pdch_ulc *ulc, uint32_t fn);
+struct gprs_rlcmac_tbf *pdch_ulc_get_tbf_poll(struct pdch_ulc *ulc, uint32_t fn);
 
 void pdch_ulc_release_tbf(struct pdch_ulc *ulc, const struct gprs_rlcmac_tbf *tbf);
 

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ia60bb5249a9837dec1f42180e44d9848334d86d6
Gerrit-Change-Number: 23323
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/20210311/a8f058e3/attachment.htm>


More information about the gerrit-log mailing list