aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-05-10 11:21:50 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-05-10 11:21:52 +0200
commit393484a5d08ac7e9d70213c2fad54e3f5f9a42f8 (patch)
treef7e08b0c922b1841fe5dbfd274fe304f1c1598d8
parent0e35aee19472e8146f255a2e0ca5092c852cae5b (diff)
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
-rw-r--r--src/gprs_rlcmac_ts_alloc.cpp13
-rw-r--r--tests/tbf/TbfTest.err8
2 files changed, 11 insertions, 10 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index dd921e71..e8c9bc4d 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -711,7 +711,8 @@ static int tbf_select_slot_set(const gprs_rlcmac_tbf *tbf, const gprs_rlcmac_trx
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 @@ static int tbf_select_slot_set(const gprs_rlcmac_tbf *tbf, const gprs_rlcmac_trx
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 be7caf09..0a826a7e 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -3153,7 +3153,7 @@ Slot Allocation (Algorithm B) for class 12
- 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 @@ Slot Allocation (Algorithm B) for class 12
- 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 @@ Slot Allocation (Algorithm B) for class 11
- 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 @@ DL TBF slots: 0x10, N: 1, WS: 192
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.