diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-11-09 18:41:05 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-11-10 11:36:55 +0100 |
commit | 54a126f6d4c8d113077d7ac0ad47449a04878902 (patch) | |
tree | f6af45300ef9a4b5ac25b12596483a3f7ba47171 | |
parent | 853cdf85ebf09883231fbade92737b2237c6287c (diff) |
pdch: Update ms_reserved_slots in GprsMS when TS becomes disabled
Otherwise, after the TS is disabled, a new TBF created for that MS may
end up in alloc_algorithm assigning the disabled TS, since it will be in
the mask of reserved PDCH TS for that MS.
Related: OS#5265
Change-Id: Ifc59ac37fa6b0ad9ecc8f76326928611e748b11c
-rw-r--r-- | src/pdch.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/pdch.cpp b/src/pdch.cpp index 6aae7d19..4d82ab16 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -131,6 +131,32 @@ static inline void sched_ul_ass_or_rej(struct gprs_rlcmac_bts *bts, struct gprs_ } } +/* Make sure the PDCH vanished from the mask of reserved PDCHs for all MS, to + * avoid alloc_algorithm using it. */ +static void pdch_unreserve_all_ms_reserved_slots(struct gprs_rlcmac_pdch *pdch) +{ + struct llist_head *tmp; + uint8_t ts_rm_mask = (~(1 << pdch->ts_no)); + struct gprs_rlcmac_trx *trx = pdch->trx; + + llist_for_each(tmp, bts_ms_list(trx->bts)) { + struct GprsMs *ms = llist_entry(tmp, typeof(*ms), list); + if (ms->current_trx != trx) + continue; + uint8_t old_dl_slots = ms_reserved_dl_slots(ms); + uint8_t old_ul_slots = ms_reserved_ul_slots(ms); + uint8_t new_dl_slots = old_dl_slots & ts_rm_mask; + uint8_t new_ul_slots = old_ul_slots & ts_rm_mask; + if (old_dl_slots == new_dl_slots && old_ul_slots == new_ul_slots) + continue; + ms_set_reserved_slots(ms, trx, new_ul_slots, new_dl_slots); + } + if (pdch->num_reserved(GPRS_RLCMAC_UL_TBF) > 0 || pdch->num_reserved(GPRS_RLCMAC_DL_TBF) > 0) + LOGPDCH(pdch, DRLCMAC, LOGL_ERROR, + "Reserved TS count not zero after unreserving from all current MS in list! UL=%u DL=%u\n", + pdch->num_reserved(GPRS_RLCMAC_UL_TBF), pdch->num_reserved(GPRS_RLCMAC_DL_TBF)); +} + void pdch_init(struct gprs_rlcmac_pdch *pdch, struct gprs_rlcmac_trx *trx, uint8_t ts_nr) { pdch->ts_no = ts_nr; @@ -171,6 +197,8 @@ void gprs_rlcmac_pdch::free_resources() /* kick all TBF on slot */ pdch_free_all_tbf(this); + pdch_unreserve_all_ms_reserved_slots(this); + /* flush all pending paging messages */ while ((pag = dequeue_paging())) talloc_free(pag); |