Review at  https://gerrit.osmocom.org/3061

octphy: record SAACH and TCH BFI

Check for bad blocks. If a bad block is detected, increment the
block failure indicator (BFI). If a good block is detected,
decrement the BFI again. Both happends independently for SACCH
and TCH. The data is recored in the lchan struct.

This commit depends on openbsc change:
Change-Id I2ed78a9dd8747736d01ccf700396d7996f9f4e5d

(Patch by Octasic Inc.)

Change-Id: Idf044e58863aeab7239ba420b71e1676be62cacb
---
M src/osmo-bts-octphy/l1_if.c
1 file changed, 31 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/61/3061/1

diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index c36b701..3a0c055 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -993,6 +993,7 @@
        int16_t snr;
        int8_t rssi;
        int rc;
+       struct gsm_lchan *lchan;
 
        uint8_t sapi = (uint8_t) data_ind->LchId.bySAPI;
        uint8_t ts_num = (uint8_t) data_ind->LchId.byTimeslotNb;
@@ -1029,12 +1030,41 @@
                            data_ind->Data.ulDataLength),
               data_ind->Data.ulDataLength);
 
+       lchan = get_lchan_by_chan_nr(trx, chan_nr);
+       if (!lchan)
+               return -EINVAL;
+
        /* check for TCH */
        if (sapi == cOCTVC1_GSM_SAPI_ENUM_TCHF ||
            sapi == cOCTVC1_GSM_SAPI_ENUM_TCHH) {
                /* TCH speech frame handling */
                rc = l1if_tch_rx(trx, chan_nr, data_ind);
-               return rc;
+
+               if (data_ind->Data.ulDataLength == 0) {
+                       lchan->meas.num_tch_bfi++;
+               } else {
+                       if (lchan->meas.num_tch_bfi > 0)
+                               lchan->meas.num_tch_bfi--;
+                       return rc;
+               }
+
+       }
+
+       /*check for SACCH BFI count for radio link failure */
+       else if (sapi == cOCTVC1_GSM_SAPI_ENUM_SACCH) {
+               if (data_ind->Data.ulDataLength == 0) {
+                       lchan->meas.num_sacch_bfi++;
+
+                       LOGP(DL1C, LOGL_NOTICE,
+                            "%s UL RLF meas, num_ul_meas=%d, meas_res_num=%d "
+                            "num_tch_bfi=%d, num_sacch_bfi=%d, fn=%u\n",
+                            gsm_lchan_name(lchan), lchan->meas.num_ul_meas,
+                            lchan->meas.res_nr, lchan->meas.num_tch_bfi,
+                            lchan->meas.num_sacch_bfi, fn);
+               } else {
+                       if (lchan->meas.num_sacch_bfi > 0)
+                               lchan->meas.num_sacch_bfi--;
+               }
        }
 
        /* get rssi, rssi is in q8 format */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf044e58863aeab7239ba420b71e1676be62cacb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <[email protected]>

Reply via email to