From 1842c921b3ed5c941a092542b922274c535111a9 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 2 Mar 2015 13:01:35 +0100 Subject: tbf: Reduce m_new_tbf logging messages Currently tbf->m_new_tbf may point to itself if no new TBF is assigned. But this leads to additional logging messages, since the code in set_new_tbf and tbf_free assumes, that a real new TBF is assigned and generates log messages accordingly. This commit adds checks to avoid those messages in the above case. Sponsored-by: On-Waves ehf --- src/tbf.cpp | 35 ++++++++++++++++++++++------------- tests/tbf/TbfTest.err | 2 -- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/tbf.cpp b/src/tbf.cpp index 6f4f15c7..388f82d7 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -55,15 +55,16 @@ void gprs_rlcmac_tbf::set_new_tbf(gprs_rlcmac_tbf *tbf) { if (m_new_tbf) { if (m_new_tbf == tbf) { - LOGP(DRLCMAC, LOGL_NOTICE, + LOGP(DRLCMAC, LOGL_INFO, "%s reassigning %s to m_new_tbf\n", tbf_name(this), tbf_name(tbf)); return; } - 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)); + 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; } @@ -154,25 +155,33 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf) tbf->bts->tbf_dl_freed(); if (tbf->m_old_tbf) { - LOGP(DRLCMAC, LOGL_INFO, "%s Old TBF %s still exists, detaching\n", - tbf_name(tbf), tbf_name(tbf->m_old_tbf)); - if (tbf->m_old_tbf->m_new_tbf == 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 + } else { LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: " "tbf->m_old_tbf->m_new_tbf != tbf\n", tbf_name(tbf)); + } } if (tbf->m_new_tbf) { - LOGP(DRLCMAC, LOGL_INFO, "%s New TBF %s still exists, detaching\n", - tbf_name(tbf), tbf_name(tbf->m_new_tbf)); - if (tbf->m_new_tbf->m_old_tbf == 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 + } else { LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: " "tbf->m_new_tbf->m_old_tbf != tbf\n", tbf_name(tbf)); + } } LOGP(DRLCMAC, LOGL_DEBUG, "********** TBF ends here **********\n"); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 39d6807e..485d0eec 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -72,7 +72,6 @@ Slot Allocation (Algorithm A) for class 45 - Assign downlink TS=4 TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=WAIT RELEASE) Trigger dowlink assignment on PACCH, because another LLC PDU has arrived in between Send dowlink assignment on PACCH, because TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=WAIT RELEASE) exists -TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=WAIT RELEASE) m_new_tbf is already assigned to TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=WAIT RELEASE), overwriting the old value with TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to ASSIGN TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=ASSIGN) starting timer 0. DL packet loss of IMSI= / TLLI=0x00000000: 0% @@ -139,7 +138,6 @@ Slot Allocation (Algorithm A) for class 45 - Assign downlink TS=4 TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=WAIT RELEASE) Trigger dowlink assignment on PACCH, because another LLC PDU has arrived in between Send dowlink assignment on PACCH, because TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=WAIT RELEASE) exists -TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=WAIT RELEASE) m_new_tbf is already assigned to TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=WAIT RELEASE), overwriting the old value with TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL) changes state from NULL to ASSIGN TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=ASSIGN) starting timer 0. TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=ASSIGN) free -- cgit v1.2.3