Hello Max, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/2813

to look at the new patch set (#3).

osmo-bts-trx: fix missing frame number in MEAS IND

The layer 1 interface (l1_if.c) for osmo-trx does not include
the frame number into the measurement indications it forwards
to higher layers. The frame number is required to properly
detect the end of a measurement period.

This commit changes l1if_fill_meas_res() to properly include
the frame number into the l1sap primitive (struct osmo_phsap_prim *l1sap)
it also takes care of the normalization so that the reported
frame number matches the lookup tables in the higher layers.

Change-Id: Ife3c791ff50e8a866a97b9783ac7ef3ef2402a70
---
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
2 files changed, 17 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/13/2813/3

diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index a7bcd2c..1492503 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -527,9 +527,10 @@
 }
 
 
-void l1if_fill_meas_res(struct osmo_phsap_prim *l1sap, uint8_t chan_nr, float 
ta,
-       float ber, float rssi)
+void l1if_fill_meas_res(struct osmo_phsap_prim *l1sap, uint8_t chan_nr, struct 
gsm_lchan *lchan,
+                       uint32_t fn, float ber, float rssi, float toa)
 {
+       float ta = lchan->rqd_ta + toa;
        memset(l1sap, 0, sizeof(*l1sap));
        osmo_prim_init(&l1sap->oph, SAP_GSM_PH, PRIM_MPH_INFO,
                PRIM_OP_INDICATION, NULL);
@@ -538,6 +539,17 @@
        l1sap->u.info.u.meas_ind.ta_offs_qbits = (int16_t)(ta*4);
        l1sap->u.info.u.meas_ind.ber10k = (unsigned int) (ber * 10000);
        l1sap->u.info.u.meas_ind.inv_rssi = (uint8_t) (rssi * -1);
+       l1sap->u.info.u.meas_ind.fn = fn;
+
+       /* Align frame number with measurement period ends */
+       if (lchan->type == GSM_LCHAN_TCH_F)
+               l1sap->u.info.u.meas_ind.fn += 1;
+       else if (lchan->type == GSM_LCHAN_TCH_H) {
+               if (lchan->nr == 0)
+                       l1sap->u.info.u.meas_ind.fn += 2;
+               else if (lchan->nr == 1)
+                       l1sap->u.info.u.meas_ind.fn += 1;
+       }
 }
 
 int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t fn, 
uint8_t chan_nr,
@@ -553,7 +565,7 @@
                gsm_lchan_name(lchan), fn, chan_nr, 
ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
                rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], 
lchan->rqd_ta, toa);
 
-       l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi);
+       l1if_fill_meas_res(&l1sap, chan_nr, lchan, fn, ber, rssi, toa);
 
        return l1sap_up(trx, &l1sap);
 }
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index 1864857..52af02d 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -68,8 +68,8 @@
 int l1if_provision_transceiver_trx(struct trx_l1h *l1h);
 int l1if_provision_transceiver(struct gsm_bts *bts);
 int l1if_mph_time_ind(struct gsm_bts *bts, uint32_t fn);
-void l1if_fill_meas_res(struct osmo_phsap_prim *l1sap, uint8_t chan_nr, float 
ta,
-       float ber, float rssi);
+void l1if_fill_meas_res(struct osmo_phsap_prim *l1sap, uint8_t chan_nr, struct 
gsm_lchan *lchan,
+                       uint32_t fn, float ber, float rssi, float toa);
 int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t fn, 
uint8_t chan_nr,
        int n_errors, int n_bits_total, float rssi, float toa);
 

-- 
To view, visit https://gerrit.osmocom.org/2813
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ife3c791ff50e8a866a97b9783ac7ef3ef2402a70
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <[email protected]>

Reply via email to