diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2016-01-22 18:12:10 +0100 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2016-02-09 23:09:59 +0100 |
commit | 2c4adbfb3089a7496b6cb13853245fc377e89ebb (patch) | |
tree | d056246bc0c52b8e26961e7bae3d008fe2fb4075 /src | |
parent | 9ab384c2ed4399a08d76cbea2b652a564caf9a69 (diff) |
tbf: Add gprs_rlcmac_tbf::first_control_ts method
Currently the tbf->first_ts field is accessed directly to get the
first allocated TS when an immediate assigment is generated. While
this is in principle correct (since in that state no other TBF
exists), a more generic function that always returns the current
(first) PACCH TS would hide the details.
Add a function to return the current first PACCH timeslot.
Note that concurrent TBF are not supported yet, which will not
lead to errors yet, since it is only being used after RACH.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r-- | src/bts.cpp | 4 | ||||
-rw-r--r-- | src/pcu_vty_functions.cpp | 2 | ||||
-rw-r--r-- | src/tbf.cpp | 16 | ||||
-rw-r--r-- | src/tbf.h | 1 |
4 files changed, 19 insertions, 4 deletions
diff --git a/src/bts.cpp b/src/bts.cpp index 41f1cc82..1263bad4 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -528,7 +528,7 @@ int BTS::rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta) LOGP(DRLCMAC, LOGL_INFO, "%s TX: START Immediate " "Assignment Uplink (AGCH)\n", tbf_name(tbf)); trx_no = tbf->trx->trx_no; - ts_no = tbf->first_ts; + ts_no = tbf->first_control_ts(); usf = tbf->m_usf[ts_no]; tsc = tbf->tsc(); } @@ -594,7 +594,7 @@ void BTS::trigger_dl_ass( void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi) { int plen; - unsigned int ts = tbf->first_ts; + unsigned int ts = tbf->first_control_ts(); LOGP(DRLCMAC, LOGL_INFO, "TX: START %s Immediate Assignment Downlink (PCH)\n", tbf_name(tbf)); bitvec *immediate_assignment = bitvec_alloc(22); /* without plen */ diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 166b15eb..93270d18 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -51,7 +51,7 @@ static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf) vty_out(vty, " created=%lu state=%08x 1st_TS=%d 1st_cTS=%d ctrl_TS=%d " "MS_CLASS=%d/%d%s", tbf->created_ts(), tbf->state_flags, tbf->first_ts, - tbf->first_common_ts, tbf->control_ts, + tbf->first_common_ts, tbf->first_control_ts(), tbf->ms_class(), tbf->ms() ? tbf->ms()->egprs_ms_class() : -1, VTY_NEWLINE); diff --git a/src/tbf.cpp b/src/tbf.cpp index bd868885..02a9ca9b 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -445,7 +445,7 @@ int gprs_rlcmac_tbf::check_polling(uint32_t fn, uint8_t ts, if (!is_control_ts(ts)) { LOGP(DRLCMAC, LOGL_DEBUG, "Polling cannot be " "scheduled in this TS %d (first control TS %d)\n", - ts, control_ts); + ts, first_control_ts()); return -EINVAL; } if (poll_state != GPRS_RLCMAC_POLL_NONE) { @@ -1256,3 +1256,17 @@ bool gprs_rlcmac_tbf::is_control_ts(uint8_t ts) const { return ts == control_ts; } + +uint8_t gprs_rlcmac_tbf::first_control_ts() const +{ + if (!m_ms) + return first_ts; + + if (m_ms->dl_tbf() && m_ms->dl_tbf() != this) + return first_common_ts; + + if (m_ms->ul_tbf() && m_ms->ul_tbf() != this) + return first_common_ts; + + return first_ts; +} @@ -158,6 +158,7 @@ struct gprs_rlcmac_tbf { uint8_t ul_slots() const; bool is_control_ts(uint8_t ts) const; + uint8_t first_control_ts() const; /* EGPRS */ bool is_egprs_enabled() const; |