aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-07-08 17:35:12 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-07-09 13:37:15 +0200
commit9e7361a8ba65f92d4c4b72a4a0d1cd01dc8fdcc1 (patch)
tree1395dcc0356db392d05431b29c08e901116dfdd7
parentbcb226d6070cc70c21f98c025ef776e2a9b00c28 (diff)
pdch.cpp: Fix wrong annoying log line about non-scheduled ResourceReq received
It's perfectly fine receiving a Resource Request message under some circumstances (as stated in the comment added in the commit). To print issues only under non-expected circumstances, the function rcv_resource_request need to be refactored: * Destroying older UL_TBF is delayed because it is needed further down. * When the old UL_TBF is FINISHED, it's an acceptable time to receive a Resource request, so we check if that's the case and don't print a warning in that case. Change-Id: I4b4367126d6a16055cd2f45afc4a6b9c15a7c980
-rw-r--r--src/pdch.cpp41
-rw-r--r--tests/tbf/TbfTest.err2
2 files changed, 22 insertions, 21 deletions
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 3436e5ba..cee92dc0 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -550,42 +550,35 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
if (request->ID.UnionType) {
struct gprs_rlcmac_ul_tbf *ul_tbf;
uint32_t tlli = request->ID.u.TLLI;
- bool found = true;
+ bool ms_found = true;
GprsMs *ms = bts()->ms_by_tlli(tlli);
if (!ms) {
- found = false;
+ ms_found = false;
ms = bts()->ms_alloc(0, 0); /* ms class updated later */
}
+ ul_tbf = ms->ul_tbf(); /* hence ul_tbf may be NULL */
/* Keep the ms, even if it gets idle temporarily */
GprsMs::Guard guard(ms);
- if (found) {
- ul_tbf = ms->ul_tbf();
- /* We got a RACH so the MS was in packet idle mode and thus
- * didn't have any active TBFs */
- if (ul_tbf) {
- LOGPTBFUL(ul_tbf, LOGL_NOTICE,
- "Got RACH from TLLI=0x%08x while TBF still exists. Killing pending UL TBF\n",
- tlli);
- tbf_free(ul_tbf);
- }
- }
-
LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF "
"in packet resource request of single "
"block, so we provide one:\n");
sba = bts()->sba()->find(this, fn);
- if (!sba) {
- LOGP(DRLCMAC, LOGL_NOTICE, "MS requests UL TBF "
- "in packet resource request of single "
- "block, but there is no resource request "
- "scheduled!\n");
- } else {
+ if (sba) {
ms->set_ta(sba->ta);
bts()->sba()->free_sba(sba);
+ } else if (!ul_tbf || !ul_tbf->state_is(GPRS_RLCMAC_FINISHED)) {
+ LOGPTBFUL(ul_tbf, LOGL_NOTICE,
+ "MS requests UL TBF in PACKET RESOURCE REQ of "
+ "single block, but there is no resource request "
+ "scheduled!\n");
}
+ /* else: Resource Request can be received even if not scheduled
+ by the network since it's used by MS to re-establish a new UL
+ TBF when last one has finished. */
+
if (request->Exist_MS_Radio_Access_capability2) {
uint8_t ms_class, egprs_ms_class;
ms_class = Decoding::get_ms_class_by_capability(&request->MS_Radio_Access_capability2);
@@ -596,6 +589,14 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
ms->set_egprs_ms_class(egprs_ms_class);
}
+ /* Get rid of previous finished UL TBF before providing a new one */
+ if (ms_found && ul_tbf) {
+ if (!ul_tbf->state_is(GPRS_RLCMAC_FINISHED))
+ LOGPTBFUL(ul_tbf, LOGL_NOTICE,
+ "Got PACKET RESOURCE REQ while TBF not finished, killing pending UL TBF\n");
+ tbf_free(ul_tbf);
+ }
+
ul_tbf = tbf_alloc_ul(bts_data(), ms, trx_no(), tlli);
if (!ul_tbf) {
handle_tbf_reject(bts_data(), ms, tlli,
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 800d4f81..29c8eb3c 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -7902,7 +7902,7 @@ Tx Immediate Assignment on AGCH: TRX=0 (ARFCN 0) TS=7 TA=7 TSC=0 TFI=6 USF=6
------------------------- RX : Uplink Control Block -------------------------
Creating MS object, TLLI = 0x00000000
MS requests UL TBF in packet resource request of single block, so we provide one:
-MS requests UL TBF in packet resource request of single block, but there is no resource request scheduled!
+(no TBF) MS requests UL TBF in PACKET RESOURCE REQ of single block, but there is no resource request scheduled!
Modifying MS object, TLLI = 0x00000000, MS class 0 -> 11
Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 11
********** UL-TBF starts here **********