diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-12-14 13:23:15 +0100 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-12-16 19:37:49 +0100 |
commit | e8f5fe52554895661f7dafedb96c4c68b0ca9bda (patch) | |
tree | addd3f0b41b8a0a3a35d2e6c466692edef32916d /src/tbf.cpp | |
parent | ce1beb423cddfddebeb2ebacb60eb10506eeff71 (diff) |
tbf: Refactor parts of extract_tlli into set_tlli_from_ul
Currently gprs_rlcmac_tbf::extract_tlli takes care of decoding and
the TBF update. These are really different things and doing the
decoding in extract_tlli makes EGPRS support more complex.
This commit moves the TBF state related part into a new method
gprs_rlcmac_tbf::set_tlli_from_ul.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r-- | src/tbf.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp index 590d115..556f6e8 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -992,31 +992,14 @@ int gprs_rlcmac_tbf::establish_dl_tbf_on_pacch() return 0; } -int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len) +int gprs_rlcmac_tbf::set_tlli_from_ul(uint32_t new_tlli) { struct gprs_rlcmac_tbf *dl_tbf = NULL; struct gprs_rlcmac_tbf *ul_tbf = NULL; - struct rlc_ul_header *rh = (struct rlc_ul_header *)data; - uint32_t new_tlli; - int rc; GprsMs *old_ms; OSMO_ASSERT(direction == GPRS_RLCMAC_UL_TBF); - /* no TLLI yet */ - if (!rh->ti) { - LOGP(DRLCMACUL, LOGL_NOTICE, "UL DATA TFI=%d without " - "TLLI, but no TLLI received yet\n", rh->tfi); - return 0; - } - rc = Decoding::tlli_from_ul_data(data, len, &new_tlli); - if (rc) { - bts->decode_error(); - LOGP(DRLCMACUL, LOGL_NOTICE, "Failed to decode TLLI " - "of UL DATA TFI=%d.\n", rh->tfi); - return 0; - } - old_ms = bts->ms_by_tlli(new_tlli); /* Keep the old MS object for the update_ms() */ GprsMs::Guard guard(old_ms); @@ -1036,8 +1019,6 @@ int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len) /* 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 && dl_tbf->ms() != ms()) { LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from " "TLLI=0x%08x while %s still exists. " @@ -1057,6 +1038,33 @@ int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len) return 1; } +int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len) +{ + struct rlc_ul_header *rh = (struct rlc_ul_header *)data; + uint32_t new_tlli; + int rc; + + OSMO_ASSERT(direction == GPRS_RLCMAC_UL_TBF); + + /* no TLLI yet */ + if (!rh->ti) { + LOGP(DRLCMACUL, LOGL_NOTICE, "UL DATA TFI=%d without " + "TLLI, but no TLLI received yet\n", rh->tfi); + return 0; + } + rc = Decoding::tlli_from_ul_data(data, len, &new_tlli); + if (rc) { + bts->decode_error(); + LOGP(DRLCMACUL, LOGL_NOTICE, "Failed to decode TLLI " + "of UL DATA TFI=%d.\n", rh->tfi); + return 0; + } + LOGP(DRLCMACUL, LOGL_INFO, "Decoded premier TLLI=0x%08x of " + "UL DATA TFI=%d.\n", new_tlli, rh->tfi); + + return set_tlli_from_ul(new_tlli); +} + const char *tbf_name(gprs_rlcmac_tbf *tbf) { return tbf->name(); |