Move NULL and ASSIGN tbf_state transition to tbf_fsm
At some point later in time the state_flags will most probably be split
into different variables, one ending up in a different FSM. It is moved
so far to the exsiting FSM from the C++ class since it's easier to
access it from C and C++ code, and anyway that kind of information
belongs to the FSM.
Related: OS#2709
Change-Id: I3c62e9e83965cb28065338733f182863e54d7474
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index eb215fe..12fd99f 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -605,7 +605,7 @@
old_tbf->was_releasing = old_tbf->state_is(TBF_ST_WAIT_RELEASE);
/* change state */
- TBF_SET_ASS_ON(this, GPRS_RLCMAC_FLAG_PACCH, true);
+ osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_ASSIGN_ADD_PACCH, NULL);
/* Start timer, expiry in gprs_rlcmac_tbf::handle_timeout tbf_free()s the TBF */
T_START(this, T0, -2001, "assignment (PACCH)", true);
@@ -615,7 +615,7 @@
was_releasing = state_is(TBF_ST_WAIT_RELEASE);
/* change state */
- TBF_SET_ASS_ON(this, GPRS_RLCMAC_FLAG_CCCH, false);
+ osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_ASSIGN_ADD_CCCH, NULL);
/* send immediate assignment */
if ((pgroup = imsi2paging_group(imsi())) > 999)
@@ -777,7 +777,7 @@
{
bool ack_recovered = false;
- state_flags |= (1 << GPRS_RLCMAC_FLAG_DL_ACK);
+ state_fsm.state_flags |= (1 << GPRS_RLCMAC_FLAG_DL_ACK);
if (check_n_clear(GPRS_RLCMAC_FLAG_TO_DL_ACK)) {
ack_recovered = true;
}
@@ -957,7 +957,7 @@
if (m_last_dl_poll_fn < 0)
m_last_dl_poll_fn = fn;
- need_poll = state_flags & (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK);
+ need_poll = state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK);
/* poll after POLL_ACK_AFTER_FRAMES frames, or when final block is tx.
*/
@@ -985,7 +985,7 @@
if (is_final)
T_START(this, T3191, 3191, "final block (DL-TBF)", true);
- state_flags &= ~(1 << GPRS_RLCMAC_FLAG_TO_DL_ACK); /* clear poll timeout flag */
+ state_fsm.state_flags &= ~(1 << GPRS_RLCMAC_FLAG_TO_DL_ACK); /* clear poll timeout flag */
/* Clear request flag */
m_dl_ack_requested = false;
@@ -1251,7 +1251,7 @@
m_wait_confirm = 0;
m_window.reset();
- TBF_ASS_TYPE_UNSET(this, GPRS_RLCMAC_FLAG_CCCH);
+ osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_ASSIGN_DEL_CCCH, NULL);
return 0;
}
@@ -1277,7 +1277,7 @@
/* reset rlc states */
m_window.reset();
- TBF_ASS_TYPE_UNSET(this, GPRS_RLCMAC_FLAG_CCCH);
+ osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_ASSIGN_DEL_CCCH, NULL);
return 0;
}
@@ -1324,7 +1324,7 @@
bool gprs_rlcmac_dl_tbf::need_control_ts() const
{
- return state_flags & (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK) ||
+ return state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK) ||
m_tx_counter >= POLL_ACK_AFTER_FRAMES ||
m_dl_ack_requested;
}