aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-22 15:47:55 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-28 12:29:43 +0200
commitd3eac2867a84d009fa3c1c7d8da9502f8468fbca (patch)
tree52c91d907249f0eefe6d070af1141273eadb3252 /src/tbf.cpp
parent1c68abaffab6b7f8472d54b7881c3618d72e00d9 (diff)
tbf: Remove TBF chaining (m_new_tbf and m_old_tbf)
Currently a new TBF is chained to an existing older one, either of the other direction (active or releasing) or of the same direction (releasing). This does not work properly work if and uplink and a downlink TBF are being established at the same time while an old TBF is being released. In that case, one of them is thrown away and the pending procedure is cancelled. The chaining is no longer necessary since the GprsMs objects have been introduced which keep track of the active TBFs. This commit removes the TBF members m_new_tbf and m_old_tbf and the related methods and code paths. Note that a new TBF can replace an older TBF entry of the same direction within an MS object when it is associated with an MS (e.g. by TLLI or because it is assigned via another, already associated TBF). In that case, the old TBF is no longer associated with an MS object. Ticket: #1674 Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r--src/tbf.cpp70
1 files changed, 7 insertions, 63 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 4bafe144..ac0cdf3f 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -89,31 +89,6 @@ void gprs_rlcmac_tbf::assign_imsi(const char *imsi_)
m_ms->set_imsi(imsi_);
}
-void gprs_rlcmac_tbf::set_new_tbf(gprs_rlcmac_tbf *tbf)
-{
- if (m_new_tbf) {
- if (m_new_tbf == tbf) {
- LOGP(DRLCMAC, LOGL_INFO,
- "%s reassigning %s to m_new_tbf\n",
- tbf_name(this), tbf_name(tbf));
- return;
- }
- if (m_new_tbf != this) {
- LOGP(DRLCMAC, LOGL_NOTICE,
- "%s m_new_tbf is already assigned to %s, "
- "overwriting the old value with %s\n",
- tbf_name(this), tbf_name(m_new_tbf), tbf_name(tbf));
- }
- /* Detach from other TBF */
- m_new_tbf->m_old_tbf = NULL;
- }
- m_new_tbf = tbf;
- tbf->m_old_tbf = this;
-
- if (!tbf->ms())
- tbf->set_ms(ms());
-}
-
void gprs_rlcmac_tbf::set_ms(GprsMs *ms)
{
if (m_ms == ms)
@@ -227,40 +202,6 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
else
tbf->bts->tbf_dl_freed();
- if (tbf->m_old_tbf) {
- if (tbf->m_old_tbf == tbf) {
- /* points to itself, ignore */
- } else if (tbf->m_old_tbf->m_new_tbf == tbf) {
- LOGP(DRLCMAC, LOGL_INFO,
- "%s Old TBF %s still exists, detaching\n",
- tbf_name(tbf), tbf_name(tbf->m_old_tbf));
- tbf->m_old_tbf->m_new_tbf = NULL;
- } else {
- LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: "
- "tbf->m_old_tbf->m_new_tbf != tbf\n",
- tbf_name(tbf));
- }
-
- tbf->m_old_tbf = NULL;
- }
-
- if (tbf->m_new_tbf) {
- if (tbf->m_new_tbf == tbf) {
- /* points to itself, ignore */
- } else if (tbf->m_new_tbf->m_old_tbf == tbf) {
- LOGP(DRLCMAC, LOGL_INFO,
- "%s New TBF %s still exists, detaching\n",
- tbf_name(tbf), tbf_name(tbf->m_new_tbf));
- tbf->m_new_tbf->m_old_tbf = NULL;
- } else {
- LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: "
- "tbf->m_new_tbf->m_old_tbf != tbf\n",
- tbf_name(tbf));
- }
-
- tbf->m_new_tbf = NULL;
- }
-
if (tbf->ms())
tbf->set_ms(NULL);
@@ -668,7 +609,7 @@ int gprs_rlcmac_tbf::rlcmac_diag()
struct msgb *gprs_rlcmac_tbf::create_dl_ass(uint32_t fn)
{
struct msgb *msg;
- struct gprs_rlcmac_dl_tbf *new_dl_tbf;
+ struct gprs_rlcmac_dl_tbf *new_dl_tbf = NULL;
int poll_ass_dl = 1;
if (direction == GPRS_RLCMAC_DL_TBF && control_ts != first_common_ts) {
@@ -706,7 +647,9 @@ struct msgb *gprs_rlcmac_tbf::create_dl_ass(uint32_t fn)
}
}
- new_dl_tbf = static_cast<gprs_rlcmac_dl_tbf *>(m_new_tbf);
+ if (ms())
+ new_dl_tbf = ms()->dl_tbf();
+
if (!new_dl_tbf) {
LOGP(DRLCMACDL, LOGL_ERROR, "We have a schedule for downlink "
"assignment at uplink %s, but there is no downlink "
@@ -758,7 +701,7 @@ struct msgb *gprs_rlcmac_tbf::create_dl_ass(uint32_t fn)
struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn)
{
struct msgb *msg;
- struct gprs_rlcmac_ul_tbf *new_tbf;
+ struct gprs_rlcmac_ul_tbf *new_tbf = NULL;
if (poll_state != GPRS_RLCMAC_POLL_NONE) {
LOGP(DRLCMACUL, LOGL_DEBUG, "Polling is already "
@@ -772,7 +715,8 @@ struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn)
return NULL;
}
- new_tbf = static_cast<gprs_rlcmac_ul_tbf *>(m_new_tbf);
+ if (ms())
+ new_tbf = ms()->ul_tbf();
if (!new_tbf) {
LOGP(DRLCMACUL, LOGL_ERROR, "We have a schedule for uplink "
"assignment at downlink %s, but there is no uplink "