tbf: Use is_control_ts() instead of comparing TS values directly

Currently there are some places where tbf->control_ts != ts is
evaluated to check, whether ts is a control slot.

Replace these expressions by tbf->is_control_ts(ts) which does
the same whitout exposing internal fields.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2016-01-22 17:41:33 +01:00
parent 5a3c84d0fd
commit 646da1ba8d
4 changed files with 11 additions and 8 deletions

View File

@ -46,7 +46,7 @@ static uint32_t sched_poll(BTS *bts,
ul_tbf = as_ul_tbf(pos->entry());
OSMO_ASSERT(ul_tbf);
/* this trx, this ts */
if (ul_tbf->trx->trx_no != trx || ul_tbf->control_ts != ts)
if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts))
continue;
/* polling for next uplink block */
if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
@ -64,7 +64,7 @@ static uint32_t sched_poll(BTS *bts,
dl_tbf = as_dl_tbf(pos->entry());
OSMO_ASSERT(dl_tbf);
/* this trx, this ts */
if (dl_tbf->trx->trx_no != trx || dl_tbf->control_ts != ts)
if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts))
continue;
/* polling for next uplink block */
if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED

View File

@ -861,7 +861,7 @@ struct msgb *gprs_rlcmac_tbf::create_dl_ass(uint32_t fn, uint8_t ts)
struct gprs_rlcmac_dl_tbf *new_dl_tbf = NULL;
int poll_ass_dl = 1;
if (direction == GPRS_RLCMAC_DL_TBF && ts != first_common_ts) {
if (direction == GPRS_RLCMAC_DL_TBF && !is_control_ts(ts)) {
LOGP(DRLCMAC, LOGL_NOTICE, "Cannot poll for downlink "
"assigment, because MS cannot reply. (TS=%d, "
"first common TS=%d)\n", ts,
@ -1171,3 +1171,8 @@ uint8_t gprs_rlcmac_tbf::ul_slots() const
return slots;
}
bool gprs_rlcmac_tbf::is_control_ts(uint8_t ts) const
{
return ts == control_ts;
}

View File

@ -144,6 +144,8 @@ struct gprs_rlcmac_tbf {
uint8_t dl_slots() const;
uint8_t ul_slots() const;
bool is_control_ts(uint8_t ts) const;
/* EGPRS */
bool is_egprs_enabled() const;
void enable_egprs();
@ -357,10 +359,6 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
int release();
int abort();
bool is_control_ts(uint8_t ts) const {
return ts == control_ts;
}
/* TODO: add the gettimeofday as parameter */
struct msgb *llc_dequeue(bssgp_bvc_ctx *bctx);

View File

@ -575,7 +575,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
LOGP(DRLCMACDL, LOGL_DEBUG, "Polling is already "
"sheduled for %s, so we must wait for "
"requesting downlink ack\n", tbf_name(this));
else if (control_ts != ts)
else if (!is_control_ts(ts))
LOGP(DRLCMACDL, LOGL_DEBUG, "Polling cannot be "
"sheduled in this TS %d, waiting for "
"TS %d\n", ts, control_ts);