From b69928cfaf8967936aabcf7bb3afda3a762d8ac6 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 18 Aug 2020 20:29:40 +0200 Subject: [PATCH] pdch: rcv pkt meas rep: Allocate MS object early in path and use it Let's create the MS object early if doesn't exist and fill in the information, so that we can operate on it in an early way (for instance, logging macros), this way it's easier to trace the lifecycle of subscribers. Change-Id: I3ec7eb970310698dd228ae6ad65ec5ca833bab3f --- src/gprs_rlcmac.h | 2 +- src/gprs_rlcmac_meas.cpp | 5 ++--- src/pdch.cpp | 21 ++++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index 6587c400..3d5ea996 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -75,7 +75,7 @@ int gprs_rlcmac_received_lost(struct gprs_rlcmac_dl_tbf *tbf, uint16_t received, int gprs_rlcmac_lost_rep(struct gprs_rlcmac_dl_tbf *tbf); -int gprs_rlcmac_meas_rep(Packet_Measurement_Report_t *pmr); +int gprs_rlcmac_meas_rep(GprsMs *ms, Packet_Measurement_Report_t *pmr); int gprs_rlcmac_rssi(struct gprs_rlcmac_tbf *tbf, int8_t rssi); diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp index e4df559e..b9a324fb 100644 --- a/src/gprs_rlcmac_meas.cpp +++ b/src/gprs_rlcmac_meas.cpp @@ -37,14 +37,13 @@ extern "C" { /* TODO: trigger the measurement report from the pollcontroller and use it for flow control */ /* received Measurement Report */ -int gprs_rlcmac_meas_rep(Packet_Measurement_Report_t *pmr) +int gprs_rlcmac_meas_rep(GprsMs *ms, Packet_Measurement_Report_t *pmr) { NC_Measurement_Report_t *ncr; NC_Measurements_t *nc; int i; - LOGP(DRLCMACMEAS, LOGL_INFO, "Measurement Report of TLLI=0x%08x:", - pmr->TLLI); + LOGPMS(ms, DRLCMACMEAS, LOGL_INFO, "Rx Measurement Report:"); switch (pmr->UnionType) { case 0: diff --git a/src/pdch.cpp b/src/pdch.cpp index fbbeddc5..7986373f 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -663,18 +663,21 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request, void gprs_rlcmac_pdch::rcv_measurement_report(Packet_Measurement_Report_t *report, uint32_t fn) { - struct gprs_rlcmac_sba *sba = bts()->sba()->find(this, fn); - if (sba) { - GprsMs *ms = bts()->ms_store().get_ms(report->TLLI); - if (!ms) - LOGP(DRLCMAC, LOGL_NOTICE, "MS send measurement " - "but TLLI 0x%08x is unknown\n", report->TLLI); - else - ms->set_ta(sba->ta); + struct gprs_rlcmac_sba *sba; + GprsMs *ms; + ms = bts()->ms_by_tlli(report->TLLI); + if (!ms) { + LOGP(DRLCMAC, LOGL_NOTICE, "MS send measurement " + "but TLLI 0x%08x is unknown\n", report->TLLI); + ms = bts()->ms_alloc(0, 0); + ms->set_tlli(report->TLLI); + } + if ((sba = bts()->sba()->find(this, fn))) { + ms->set_ta(sba->ta); bts()->sba()->free_sba(sba); } - gprs_rlcmac_meas_rep(report); + gprs_rlcmac_meas_rep(ms, report); } /* Received Uplink RLC control block. */