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
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 140a0be..e03f84b 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -46,7 +46,7 @@
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 @@
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
diff --git a/src/tbf.cpp b/src/tbf.cpp
index f73f1e0..35a004c 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -861,7 +861,7 @@
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 @@
return slots;
}
+
+bool gprs_rlcmac_tbf::is_control_ts(uint8_t ts) const
+{
+ return ts == control_ts;
+}
diff --git a/src/tbf.h b/src/tbf.h
index 835d2c4..f3487c6 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -144,6 +144,8 @@
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 @@
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);
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 64ebea4..21a042e 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -575,7 +575,7 @@
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);