fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/42911?usp=email )

Change subject: common: stop buffering UL measurements when SACCH is deactivated
......................................................................

common: stop buffering UL measurements when SACCH is deactivated

When the BSC sends RSL DEACT SACCH, the per-SACCH UL measurement drain
stops (it runs on SACCH timing), but the producer in lchan_new_ul_meas()
keeps appending the measurement contributions from every received
TCH/SDCCH burst.  After one SACCH period (104 frames) the 104-slot
uplink measurement buffer fills up, yielding a flood of:

  NOTICE measurement.c:336 no space for uplink measurement, num_ul_meas=104

Add a bool sacch_active flag to gsm_lchan, set to true in the common
l1sap_chan_act() and clear in l1sap_chan_deact_sacch().  Guard
lchan_new_ul_meas() with this flag so that measurements are silently
discarded while SACCH is inactive - there is nothing to drain the
buffer and no SACCH channel on which to report the results to the BSC.

Change-Id: I3943c788cab5d2411b06ac681d4d412852bac0a7
AI-Assisted: yes (Claude)
---
M include/osmo-bts/lchan.h
M src/common/l1sap.c
M src/common/measurement.c
M tests/meas/meas_test.c
4 files changed, 11 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified




diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h
index 071197d..909768d 100644
--- a/include/osmo-bts/lchan.h
+++ b/include/osmo-bts/lchan.h
@@ -210,6 +210,7 @@
         * want_dl_sacch_active indicates whether dl SACCH should be activated 
on CHAN ACT.
         */
        bool want_dl_sacch_active;
+       bool ul_sacch_active; /* UL SACCH measurements active (cleared by RSL 
DEACT SACCH) */

        /* Number of different GsmL1_Sapi_t used in osmo_bts_sysmo is 23.
         * Currently we don't share these headers so this is a magic number. */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index f11bb2c..e0d0bba 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -3013,6 +3013,8 @@
                                               lchan->ts->vamos.is_shadow ? 
"-shadow" : "");
                OSMO_ASSERT(rc == 0);
        }
+
+       lchan->ul_sacch_active = true;
        return 0;
 }

@@ -3055,6 +3057,8 @@
        LOGPLCHAN(lchan, DL1C, LOGL_INFO, "Deactivating SACCH on channel %s\n",
                  rsl_chan_nr_str(chan_nr));

+       lchan->ul_sacch_active = false;
+
        return l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_DEACTIVATE,
                1);
 }
diff --git a/src/common/measurement.c b/src/common/measurement.c
index afbdc84..8bb3e6e 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -332,6 +332,11 @@
                         gsm_lchans_name(lchan->state), 
lchan->meas.num_ul_meas, fn_mod);
        }

+       /* No point buffering measurements when SACCH is deactivated: the drain
+        * runs on SACCH timing, so the buffer would fill up and overflow. */
+       if (!lchan->ul_sacch_active)
+               return 0;
+
        if (lchan->meas.num_ul_meas >= ARRAY_SIZE(lchan->meas.uplink)) {
                LOGPLCFN(lchan, fn, DMEAS, LOGL_NOTICE,
                         "no space for uplink measurement, num_ul_meas=%d, 
fn_mod=%u\n", lchan->meas.num_ul_meas,
diff --git a/tests/meas/meas_test.c b/tests/meas/meas_test.c
index 4c93421..d2b6199 100644
--- a/tests/meas/meas_test.c
+++ b/tests/meas/meas_test.c
@@ -68,6 +68,7 @@
 static void reset_lchan_meas(struct gsm_lchan *lchan)
 {
        lchan->state = LCHAN_S_ACTIVE;
+       lchan->ul_sacch_active = true;
        memset(&lchan->meas, 0, sizeof(lchan->meas));
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42911?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I3943c788cab5d2411b06ac681d4d412852bac0a7
Gerrit-Change-Number: 42911
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to