aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-01-22 17:41:33 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-08 00:45:37 +0100
commit646da1ba8dea43035c5ade1949b1876e5e1cbfa0 (patch)
treeb145c079329bb241eccd86eac1b507d1a44c5823
parent5a3c84d0fd41a2477463e6f1df108b5b4369a434 (diff)
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
-rw-r--r--src/gprs_rlcmac_sched.cpp4
-rw-r--r--src/tbf.cpp7
-rw-r--r--src/tbf.h6
-rw-r--r--src/tbf_dl.cpp2
4 files changed, 11 insertions, 8 deletions
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 140a0be7..e03f84be 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -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
diff --git a/src/tbf.cpp b/src/tbf.cpp
index f73f1e07..35a004cf 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -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;
+}
diff --git a/src/tbf.h b/src/tbf.h
index 835d2c48..f3487c6e 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -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);
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 64ebea4f..21a042ed 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -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);