aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-18 14:35:11 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-21 17:11:14 +0200
commitbe0cbc1b7ede65ff6c5390905fc956d52a5d88b1 (patch)
treefa89219a82018fff5dcab50f461e1a255ce21a55
parent87597358cfe216a80405c21559ba640eedf44ad2 (diff)
tbf: Explicitly pass the direction to update_ms()
The type of the TBF update_ms() is being called on does not always reflect whether the TLLI has been signaled by the MS or the SGSN. This commit adds an additional parameter to tell the method, in which direction the TLLI has been passed. Sponsored-by: On-Waves ehf
-rw-r--r--src/bts.cpp4
-rw-r--r--src/tbf.cpp9
-rw-r--r--src/tbf.h2
-rw-r--r--src/tbf_dl.cpp4
-rw-r--r--tests/alloc/AllocTest.cpp8
-rw-r--r--tests/tbf/TbfTest.cpp2
6 files changed, 15 insertions, 14 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 8d4f494..72c33ed 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -750,9 +750,9 @@ void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t *packet,
tbf->update_tlli(tlli);
if (tbf->new_tbf())
- tbf->new_tbf()->update_ms(tlli);
+ tbf->new_tbf()->update_ms(tlli, GPRS_RLCMAC_UL_TBF);
else
- tbf->update_ms(tlli);
+ tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF);
LOGP(DRLCMAC, LOGL_DEBUG, "RX: [PCU <- BTS] %s Packet Control Ack\n", tbf_name(tbf));
tbf->poll_state = GPRS_RLCMAC_POLL_NONE;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index c8659cf..e3602e2 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -96,11 +96,11 @@ void gprs_rlcmac_tbf::set_ms(GprsMs *ms)
m_ms->attach_tbf(this);
}
-void gprs_rlcmac_tbf::update_ms(uint32_t tlli)
+void gprs_rlcmac_tbf::update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir)
{
if (!ms())
set_ms(bts->ms_store().get_or_create_ms(tlli));
- else if (direction == GPRS_RLCMAC_UL_TBF)
+ else if (dir == GPRS_RLCMAC_UL_TBF)
ms()->set_tlli(tlli);
else
ms()->confirm_tlli(tlli);
@@ -136,7 +136,7 @@ gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts,
tbf->set_state(GPRS_RLCMAC_ASSIGN);
tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
tbf_timer_start(tbf, 3169, bts->t3169, 0);
- tbf->update_ms(tlli);
+ tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF);
return tbf;
}
@@ -863,7 +863,8 @@ int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len)
}
update_tlli(new_tlli);
- update_ms(new_tlli);
+ /* The TLLI has been taken from an UL message */
+ update_ms(new_tlli, GPRS_RLCMAC_UL_TBF);
LOGP(DRLCMACUL, LOGL_INFO, "Decoded premier TLLI=0x%08x of "
"UL DATA TFI=%d.\n", tlli(), rh->tfi);
if (dl_tbf) {
diff --git a/src/tbf.h b/src/tbf.h
index a1edff3..dfda22a 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -144,7 +144,7 @@ struct gprs_rlcmac_tbf {
void tlli_mark_valid();
/** MS updating */
- void update_ms(uint32_t tlli);
+ void update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction);
uint8_t tfi() const;
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index b258a3c..5e4a51c 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -208,7 +208,7 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts,
dl_tbf->m_tlli = tlli;
dl_tbf->m_tlli_valid = 1;
dl_tbf->ta = ta;
- dl_tbf->update_ms(tlli);
+ dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF);
LOGP(DRLCMAC, LOGL_DEBUG, "%s [DOWNLINK] START\n", tbf_name(dl_tbf));
@@ -806,7 +806,7 @@ void gprs_rlcmac_dl_tbf::reuse_tbf(const uint8_t *data, const uint16_t len)
new_tbf->m_tlli_valid = m_tlli_valid;
new_tbf->ta = ta;
new_tbf->assign_imsi(m_imsi);
- new_tbf->update_ms(m_tlli);
+ new_tbf->update_ms(m_tlli, GPRS_RLCMAC_DL_TBF);
/* Copy over all data to the new TBF */
new_tbf->m_llc.put_frame(data, len);
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index 3dc3e7a..e453de6 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -190,7 +190,7 @@ static void test_alloc_b(int ms_class)
dl_tbf = tbf_alloc_dl_tbf(bts, NULL, tfi, trx_no, ms_class, 1);
dl_tbf->m_tlli = 0x23;
dl_tbf->m_tlli_valid = true;
- dl_tbf->update_ms(dl_tbf->m_tlli);
+ dl_tbf->update_ms(dl_tbf->m_tlli, GPRS_RLCMAC_DL_TBF);
OSMO_ASSERT(dl_tbf);
dump_assignment(dl_tbf, "DL");
@@ -199,7 +199,7 @@ static void test_alloc_b(int ms_class)
ul_tbf = tbf_alloc_ul_tbf(bts, dl_tbf, tfi, trx_no, ms_class, 0);
ul_tbf->m_tlli = 0x23;
ul_tbf->m_tlli_valid = true;
- ul_tbf->update_ms(ul_tbf->m_tlli);
+ ul_tbf->update_ms(ul_tbf->m_tlli, GPRS_RLCMAC_UL_TBF);
ul_tbf->m_contention_resolution_done = 1;
OSMO_ASSERT(ul_tbf);
dump_assignment(ul_tbf, "UL");
@@ -350,7 +350,7 @@ static void test_alloc_b(bool ts0, bool ts1, bool ts2, bool ts3, bool ts4, bool
OSMO_ASSERT(dl_tbf);
dl_tbf->m_tlli = 0x23;
dl_tbf->m_tlli_valid = true;
- dl_tbf->update_ms(dl_tbf->m_tlli);
+ dl_tbf->update_ms(dl_tbf->m_tlli, GPRS_RLCMAC_DL_TBF);
tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1);
OSMO_ASSERT(tfi >= 0);
@@ -358,7 +358,7 @@ static void test_alloc_b(bool ts0, bool ts1, bool ts2, bool ts3, bool ts4, bool
OSMO_ASSERT(ul_tbf);
ul_tbf->m_tlli = 0x23;
ul_tbf->m_tlli_valid = true;
- ul_tbf->update_ms(ul_tbf->m_tlli);
+ ul_tbf->update_ms(ul_tbf->m_tlli, GPRS_RLCMAC_UL_TBF);
ul_tbf->m_contention_resolution_done = 1;
OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts);
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 2ec715b..081feef 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -65,7 +65,7 @@ static void test_tbf_tlli_update()
0, 0, 0);
dl_tbf->update_tlli(0x2342);
dl_tbf->tlli_mark_valid();
- dl_tbf->update_ms(0x2342);
+ dl_tbf->update_ms(0x2342, GPRS_RLCMAC_DL_TBF);
dl_tbf->ta = 4;
the_bts.timing_advance()->remember(0x2342, dl_tbf->ta);