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

common/l1sap.c: limit the minimal ToA for RACH bursts

In general, RACH bursts should not arrive with negative offset.
Let's limit early signal arrival up to 2 symbols, otherwise
it is most likely noise, interference or a ghost.

Change-Id: Id3983b1a3ced148ced101584cbc0267f059fe7f6
---
M src/common/l1sap.c
1 file changed, 10 insertions(+), 4 deletions(-)


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

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index ecd6805..85f8830 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1173,6 +1173,8 @@
        return 0;
 }
 
+#define RACH_MIN_TOA256 -2 * 256
+
 /* RACH received from bts model */
 static int l1sap_ph_rach_ind(struct gsm_bts_trx *trx,
         struct osmo_phsap_prim *l1sap, struct ph_rach_ind_param *rach_ind)
@@ -1208,11 +1210,15 @@
 
        lc = &trx->ts[0].lchan[CCCH_LCHAN].lapdm_ch;
 
-       /* Make sure that ToA (Timing of Arrival) is acceptable */
-       if (toa256 > btsb->max_ta * 256) {
+       /**
+        * Make sure that ToA (Timing of Arrival) is acceptable.
+        * We allow early arrival up to 2 symbols, and delay
+        * according to maximal allowed Timing Advance value.
+        */
+       if (toa256 < RACH_MIN_TOA256 || toa256 > btsb->max_ta * 256) {
                LOGPFN(DL1C, LOGL_INFO, rach_ind->fn, "Ignoring RACH request: "
-                       "ToA(%d) exceeds the maximal allowed TA(%u) * 256 
value\n",
-                       toa256, btsb->max_ta);
+                       "ToA(%d) exceeds the allowed range (%d..%d)\n",
+                       toa256, RACH_MIN_TOA256, btsb->max_ta * 256);
                rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_DROP);
                return 0;
        }

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

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

Reply via email to