Move first_common_ts from gprs_rlcmac_tbf to GprsMs
The field contains a common value between the 2 active TBFs of the MS,
so it makes no sense to have them duplicated on each TBF. It can be
sanely stored in the MS object.
Change-Id: I8df01a99ccbfaf7a442ade5000ee282bd638fbba
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 3d9d453..7483d49 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -91,7 +91,6 @@
direction(dir),
trx(NULL),
first_ts(TBF_TS_UNSET),
- first_common_ts(TBF_TS_UNSET),
control_ts(TBF_TS_UNSET),
fT(0),
num_fT_exp(0),
@@ -308,13 +307,14 @@
void tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf)
{
+ int8_t first_common_ts = ms_first_common_ts(tbf_ms(tbf));
if (tbf->control_ts == TBF_TS_UNSET)
LOGPTBF(tbf, LOGL_INFO, "Setting Control TS %d\n",
- tbf->first_common_ts);
- else if (tbf->control_ts != tbf->first_common_ts)
+ first_common_ts);
+ else if (tbf->control_ts != first_common_ts)
LOGPTBF(tbf, LOGL_INFO, "Changing Control TS %d -> %d\n",
- tbf->control_ts, tbf->first_common_ts);
- tbf->control_ts = tbf->first_common_ts;
+ tbf->control_ts, first_common_ts);
+ tbf->control_ts = first_common_ts;
}
void gprs_rlcmac_tbf::n_reset(enum tbf_counters n)
@@ -738,7 +738,8 @@
if (direction == GPRS_RLCMAC_DL_TBF) {
if (control_ts < 8)
slots |= 1 << control_ts;
- if (first_common_ts < 8)
+ int8_t first_common_ts = ms_first_common_ts(tbf_ms(this));
+ if (first_common_ts != TBF_TS_UNSET)
slots |= 1 << first_common_ts;
return slots;
@@ -825,11 +826,6 @@
return &tbf->m_llc;
}
-uint8_t tbf_first_common_ts(const struct gprs_rlcmac_tbf *tbf)
-{
- return tbf->first_common_ts;
-}
-
uint8_t tbf_dl_slots(const struct gprs_rlcmac_tbf *tbf)
{
return tbf->dl_slots();