Change in osmo-pcu[master]: Simplify helper function tbf_select_slot_set()

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
Mon May 10 17:53:38 UTC 2021


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


Change subject: Simplify helper function tbf_select_slot_set()
......................................................................

Simplify helper function tbf_select_slot_set()

Store direction check to simplify the code.
Get rid of 2-step LOGP to avoid multi-row logs in gsmtap log.

Change-Id: Ia2e061da82ddce564b2d768d8ade1672c22934e2
---
M src/gprs_rlcmac_ts_alloc.cpp
M tests/tbf/TbfTest.err
2 files changed, 11 insertions(+), 10 deletions(-)



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

diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index dd921e7..e8c9bc4 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -711,7 +711,8 @@
 			       uint8_t reserved_ul_slots, uint8_t reserved_dl_slots,
 			       int8_t first_common_ts)
 {
-	uint8_t sl = tbf->direction != GPRS_RLCMAC_DL_TBF ? ul_slots : dl_slots;
+	bool is_ul = tbf->direction == GPRS_RLCMAC_UL_TBF;
+	uint8_t sl = is_ul ? ul_slots : dl_slots;
 	char slot_info[9] = { 0 };
 
 	if (single)
@@ -719,22 +720,22 @@
 
 	if (!sl) {
 		LOGP(DRLCMAC, LOGL_NOTICE, "No %s slots available\n",
-		     tbf->direction != GPRS_RLCMAC_DL_TBF ? "uplink" : "downlink");
+		     is_ul ? "uplink" : "downlink");
 		bts_do_rate_ctr_inc(trx->bts, CTR_TBF_ALLOC_FAIL_NO_SLOT_AVAIL);
 		return -EINVAL;
 	}
 
-	if (tbf->direction != GPRS_RLCMAC_DL_TBF) {
+	if (is_ul) {
 		snprintf(slot_info, 9, OSMO_BIT_SPEC, OSMO_BIT_PRINT_EX(reserved_ul_slots, 'u'));
 		masked_override_with(slot_info, sl, 'U');
-		LOGP(DRLCMAC, LOGL_DEBUG, "- Selected UL");
 	} else {
 		snprintf(slot_info, 9, OSMO_BIT_SPEC, OSMO_BIT_PRINT_EX(reserved_dl_slots, 'd'));
 		masked_override_with(slot_info, sl, 'D');
-		LOGP(DRLCMAC, LOGL_DEBUG, "- Selected DL");
 	}
 
-	LOGPC(DRLCMAC, LOGL_DEBUG, " slots: (TS=0)\"%s\"(TS=7), %s\n", slot_info, single ? "single" : "multi");
+	LOGPC(DRLCMAC, LOGL_DEBUG, "Selected %s slots: (TS=0)\"%s\"(TS=7), %s\n",
+	      is_ul ? "UL" : "DL",
+	      slot_info, single ? "single" : "multi");
 
 	return sl;
 }
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index be7caf0..0a826a7 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -3153,7 +3153,7 @@
 - Skipping TS 7, because not enabled
 - Possible DL/UL slots: (TS=0)"..CCCC.."(TS=7)
 Rx=4 Tx=4 Sum Rx+Tx=5, Tta=2 Ttb=1, Tra=2 Trb=1, Type=1
-- Selected DL slots: (TS=0)"..DDDD.."(TS=7), multi
+Selected DL slots: (TS=0)"..DDDD.."(TS=7), multi
 [DL] algo B <multi> (suggested TRX: 0): using 4 slots
 - Reserved DL/UL slots: (TS=0)"..DDCD.."(TS=7)
 - Assigning DL TS 2
@@ -3192,7 +3192,7 @@
 - Skipping TS 7, because not enabled
 - Possible DL/UL slots: (TS=0)"..CCCC.."(TS=7)
 Rx=4 Tx=4 Sum Rx+Tx=5, Tta=2 Ttb=1, Tra=2 Trb=1, Type=1
-- Selected DL slots: (TS=0)"..DDDD.."(TS=7), multi
+Selected DL slots: (TS=0)"..DDDD.."(TS=7), multi
 [DL] algo B <multi> (suggested TRX: 0): using 4 slots
 - Reserved DL/UL slots: (TS=0)"..DDCD.."(TS=7)
 - Assigning DL TS 2
@@ -6013,7 +6013,7 @@
 - Skipping TS 7, because not enabled
 - Possible DL/UL slots: (TS=0)"..CCCC.."(TS=7)
 Rx=4 Tx=3 Sum Rx+Tx=5, Tta=3 Ttb=1, Tra=2 Trb=1, Type=1
-- Selected DL slots: (TS=0)"..ddDd.."(TS=7), single
+Selected DL slots: (TS=0)"..ddDd.."(TS=7), single
 [DL] algo B <single> (suggested TRX: 0): using single slot at TS 4
 - Reserved DL/UL slots: (TS=0)"...DC..."(TS=7)
 - Assigning DL TS 4
@@ -6028,7 +6028,7 @@
 PDCH(bts=0,trx=0,ts=4) Detaching TBF(TFI=0 TLLI=0xffffffff DIR=DL STATE=NULL EGPRS), 0 TBFs, USFs = 00, TFIs = 00000000.
 [DL] algo B <multi> (suggested TRX: -1): Alloc start
 Found first unallocated TRX=0 TFI=0
-- Selected DL slots: (TS=0)"..DDDD.."(TS=7), multi
+Selected DL slots: (TS=0)"..DDDD.."(TS=7), multi
 [DL] algo B <multi> (suggested TRX: -1): using 4 slots
 - Assigning DL TS 2
 PDCH(bts=0,trx=0,ts=2) Attaching TBF(TFI=0 TLLI=0xffffffff DIR=DL STATE=NULL EGPRS), 1 TBFs, USFs = 00, TFIs = 00000001.

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ia2e061da82ddce564b2d768d8ade1672c22934e2
Gerrit-Change-Number: 24186
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/20210510/3cc3d8db/attachment.htm>


More information about the gerrit-log mailing list