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
changes/86/24186/1
Pau Espin 2 years ago
parent 0e35aee194
commit 393484a5d0
  1. 13
      src/gprs_rlcmac_ts_alloc.cpp
  2. 8
      tests/tbf/TbfTest.err

@ -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;
}

@ -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.

Loading…
Cancel
Save