Split tbf_fsm as tbf_{ul,dl}_fsm
The 2 types of TBF share some parts of the implementation, but actually
half of the code is specific to one direction or another.
Since FSM are becoming (and will become even) more complex, split the
FSM implementation into 2 separate FSMs, one for each direction.
The FSM interface is kept compatible (events and states), hence code can
still operate on the tbfs on events and states which are shared.
Test output changes are mainly due to:
* FSM instance now created in subclass constructor, so order of log
lines during constructor of parent class and subclass slightly
changes.
* osmo_fsm doesn't allow having 2 FSM types with same name registered,
hence the "TBF" name has to be changed to "DL_TBF" and "UL_TBF" for
each FSM class.
* FSM classes now use DTBFUL and DTBFDL instead of DTBF for logging. Some
tests don't have those categories enabled, hence some log lines
dissappear (it's actually fine we don't care about those in the test
cases).
Change-Id: I879af3f4b3e330687d498cd59f5f4933d6ca56f0
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 5006675..ae90041 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -180,6 +180,10 @@
m_dl_gprs_ctrs(NULL),
m_dl_egprs_ctrs(NULL)
{
+ memset(&state_fsm, 0, sizeof(state_fsm));
+ state_fsm.tbf = (struct gprs_rlcmac_tbf *)this;
+ state_fi = osmo_fsm_inst_alloc(&tbf_dl_fsm, this, &state_fsm, LOGL_INFO, NULL);
+ OSMO_ASSERT(state_fi);
}
/**