Hi,
in my refactorings (creating a TBF class and moving code that modifes the internals into the TBF) I am trying to make gprs_rlcmac_ul_tbfs and gprs_rlcmac_dl_tbfs private and I notice code like:
if (dir == GPRS_RLCMAC_UL_TBF) { llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) { if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) && tbf->tlli == tlli && tbf->tlli_valid) return tbf; } } else { llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) { if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) && tbf->tlli == tlli) return tbf; } }
llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) { if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) && tbf->poll_state == GPRS_RLCMAC_POLL_SCHED && tbf->poll_fn == fn && tbf->trx_no == trx && tbf->control_ts == ts) return tbf; } llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) { if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) && tbf->poll_state == GPRS_RLCMAC_POLL_SCHED && tbf->poll_fn == fn && tbf->trx_no == trx && tbf->control_ts == ts) return tbf; }
In the first code. Why is tlli_valid only checked for the UL TBF and not the downlink one?
holger
Holger Hans Peter Freyther wrote:
In the first code. Why is tlli_valid only checked for the UL TBF and not the downlink one?
there is a "one phase access", where devices request a channel for uplink TBF, but we don't know the TLLI until we get a valid RLC/MAC block. for every downlink TBF we know the TLLI for sure, because it is contained in the LLC data frame from SGSN.
On Thu, Oct 17, 2013 at 12:03:23PM +0200, Andreas Eversberg wrote:
there is a "one phase access", where devices request a channel for uplink TBF, but we don't know the TLLI until we get a valid RLC/MAC block. for every downlink TBF we know the TLLI for sure, because it is contained in the LLC data frame from SGSN.
thanks for the explanation. So the tlli is always valid in the DL direction and sometimes valid in the UL.
Code duplication (as witnessed with the missing tfi assignment in (a) algorithm) has the danger that one codepath is fixed while the others are left broken.
I will then use the version with tlli_valid and kill the code clones.
holger
osmocom-net-gprs@lists.osmocom.org