aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-01 20:59:04 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-08 00:45:39 +0100
commitf1a7b8fc6651f92a8b7f3f27b7ca05d07f4e44e0 (patch)
tree7adf5d9b864822cc47d4e5794c8230d86e92bb37 /src
parent7c72acaa941fd7f3663b0f9b36fe30f4974f1979 (diff)
tbf: Add state WAIT_ASSIGN
Currently the state on the TBF is set to ASSIGN when it is created and in general changed to FLOW when it is acknowledged by the MS. The moment when the assignment is really transmitted to the MS (which can take some time) is not reflected by the state. A TBF can considered to be valid, when the assignment is received by the MS. Add the state WAIT_ASSIGN that is entered when the assigment has been send to the MS (more precisely: when the corresponding RTS has been processed or the message has been sent to the BTS). The TBF, its PDCH(s), and its TFI can be assumed to be valid, when the TBF has a state of WAIT_ASSIGN or higher (assuming that the TBF starting time has not been set, which is currently only done for SBA, which are not associated with a TBF). Note that due to queuing in the BTS there can still be a invalid time period for immediate assignments, when the request is lingering in the AGCH or PCH queues. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r--src/bts.cpp9
-rw-r--r--src/tbf.cpp13
-rw-r--r--src/tbf.h10
3 files changed, 23 insertions, 9 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 5cadda1b..715fb515 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -544,8 +544,11 @@ int BTS::rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta)
m_bts.trx[trx_no].arfcn, ts_no, tsc, usf, 0, sb_fn,
m_bts.alpha, m_bts.gamma, -1);
- if (plen >= 0)
+ if (plen >= 0) {
pcu_l1if_tx_agch(immediate_assignment, plen);
+ if (tbf)
+ tbf->set_state(GPRS_RLCMAC_WAIT_ASSIGN);
+ }
bitvec_free(immediate_assignment);
@@ -603,8 +606,10 @@ void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi)
(tbf->pdch[ts]->last_rts_fn + 21216) % 2715648, tbf->ta(),
tbf->trx->arfcn, ts, tbf->tsc(), 7, poll,
tbf->poll_fn, m_bts.alpha, m_bts.gamma, -1);
- if (plen >= 0)
+ if (plen >= 0) {
pcu_l1if_tx_pch(immediate_assignment, plen, imsi);
+ tbf->set_state(GPRS_RLCMAC_WAIT_ASSIGN);
+ }
bitvec_free(immediate_assignment);
}
diff --git a/src/tbf.cpp b/src/tbf.cpp
index c07f379e..69b9e3a0 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -394,6 +394,7 @@ int tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf)
const char *gprs_rlcmac_tbf::tbf_state_name[] = {
"NULL",
"ASSIGN",
+ "WAIT ASSIGN",
"FLOW",
"FINISHED",
"WAIT RELEASE",
@@ -824,6 +825,12 @@ void gprs_rlcmac_tbf::handle_timeout()
if ((state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH))) {
if (state_is(GPRS_RLCMAC_ASSIGN)) {
LOGP(DRLCMAC, LOGL_NOTICE, "%s releasing due to "
+ "PACCH assignment timeout (not yet sent).\n",
+ tbf_name(this));
+ tbf_free(this);
+ return;
+ } else if (state_is(GPRS_RLCMAC_WAIT_ASSIGN)) {
+ LOGP(DRLCMAC, LOGL_NOTICE, "%s releasing due to "
"PACCH assignment timeout.\n", tbf_name(this));
tbf_free(this);
return;
@@ -834,7 +841,7 @@ void gprs_rlcmac_tbf::handle_timeout()
if ((state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH))) {
gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(this);
dl_tbf->m_wait_confirm = 0;
- if (dl_tbf->state_is(GPRS_RLCMAC_ASSIGN)) {
+ if (dl_tbf->state_is(GPRS_RLCMAC_WAIT_ASSIGN)) {
tbf_assign_control_ts(dl_tbf);
if (!dl_tbf->upgrade_to_multislot) {
@@ -995,6 +1002,8 @@ struct msgb *gprs_rlcmac_tbf::create_dl_ass(uint32_t fn, uint8_t ts)
if (poll_ass_dl) {
set_polling(new_poll_fn, ts);
+ if (new_dl_tbf->state_is(GPRS_RLCMAC_ASSIGN))
+ new_dl_tbf->set_state(GPRS_RLCMAC_WAIT_ASSIGN);
dl_ass_state = GPRS_RLCMAC_DL_ASS_WAIT_ACK;
LOGP(DRLCMACDL, LOGL_INFO,
"%s Scheduled DL Assignment polling on FN=%d, TS=%d\n",
@@ -1067,6 +1076,8 @@ struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn, uint8_t ts)
set_polling(new_poll_fn, ts);
ul_ass_state = GPRS_RLCMAC_UL_ASS_WAIT_ACK;
+ if (new_tbf->state_is(GPRS_RLCMAC_ASSIGN))
+ new_tbf->set_state(GPRS_RLCMAC_WAIT_ASSIGN);
LOGP(DRLCMACDL, LOGL_INFO,
"%s Scheduled UL Assignment polling on FN=%d, TS=%d\n",
name(), poll_fn, poll_ts);
diff --git a/src/tbf.h b/src/tbf.h
index d1b286cb..443f85fc 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -43,7 +43,8 @@ class GprsMs;
enum gprs_rlcmac_tbf_state {
GPRS_RLCMAC_NULL = 0, /* new created TBF */
- GPRS_RLCMAC_ASSIGN, /* wait for downlink assignment */
+ GPRS_RLCMAC_ASSIGN, /* wait for DL transmission */
+ GPRS_RLCMAC_WAIT_ASSIGN,/* wait for confirmation */
GPRS_RLCMAC_FLOW, /* RLC/MAC flow, resource needed */
GPRS_RLCMAC_FINISHED, /* flow finished, wait for release */
GPRS_RLCMAC_WAIT_RELEASE,/* wait for release or restart of DL TBF */
@@ -230,7 +231,7 @@ protected:
int set_tlli_from_ul(uint32_t new_tlli);
void merge_and_clear_ms(GprsMs *old_ms);
- static const char *tbf_state_name[6];
+ static const char *tbf_state_name[7];
class GprsMs *m_ms;
@@ -315,10 +316,7 @@ inline bool gprs_rlcmac_tbf::is_tfi_assigned() const
{
/* The TBF is established or has been assigned by a IMM.ASS for
* download */
- return state > GPRS_RLCMAC_ASSIGN ||
- (direction == GPRS_RLCMAC_DL_TBF &&
- state == GPRS_RLCMAC_ASSIGN &&
- (state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)));
+ return state > GPRS_RLCMAC_ASSIGN;
}
inline uint8_t gprs_rlcmac_tbf::tfi() const