From b3a2a3e24f44adcc6660d33cc9684a8f24271e2e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 27 Jun 2016 18:56:01 +0200 Subject: RACH decoding: Use BER threshold for RACH ghost detection When decoding RACH bursts, we should use a BER threshold in order to help distinguish 'ghost' RACH bursts from real RACH bursts. The theoretical ideal threshold according to some papers is 7 out of 41 bits qhich aquals to Eb/N0 of 0 dB = 0.1707 (17.07%) We add a new 'ber10k' parameter to the RACH indication l1sap primitive (needs separate change for libosmocore), and then fill this value from osmo-bts-{sysmo,lc15,trx,octphy}. The common part above L1SAP then applies the threshold, which can be changed from vty using the "max-ber10k-rach <0-10000>" command available at the BTS node. The unit is BER in 1/10000, i.e. a value of 100 equals 1% bit error rate. Change-Id: Ic41c11f6312a36baa2738547e8dcec80829457f8 --- include/osmo-bts/gsm_data.h | 1 + src/common/bts.c | 1 + src/common/l1sap.c | 7 ++++++- src/common/vty.c | 16 ++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index f2574b15..10c9d049 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -111,6 +111,7 @@ struct gsm_bts_role_bts { float min_qual_rach; /* minimum quality for RACH bursts */ float min_qual_norm; /* minimum quality for normal daata */ + uint16_t max_ber10k_rach; /* Maximum permitted RACH BER in 0.01% */ struct { char *sock_path; diff --git a/src/common/bts.c b/src/common/bts.c index b10d7f21..15b92d72 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -149,6 +149,7 @@ int bts_init(struct gsm_bts *bts) btsb->t3105_ms = 300; btsb->min_qual_rach = MIN_QUAL_RACH; btsb->min_qual_norm = MIN_QUAL_NORM; + btsb->max_ber10k_rach = 1707; /* 7 of 41 bits is Eb/N0 of 0 dB = 0.1707 */ btsb->pcu.sock_path = talloc_strdup(btsb, PCU_SOCK_DEFAULT); for (i = 0; i < ARRAY_SIZE(btsb->t200_ms); i++) btsb->t200_ms[i] = oml_default_t200_ms[i]; diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 90f045a2..50bd612d 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -1203,7 +1203,12 @@ static int l1sap_ph_rach_ind(struct gsm_bts_trx *trx, if (rach_ind->rssi >= btsb->load.rach.busy_thresh) btsb->load.rach.busy++; - /* FIXME: RACH filtering due to BER limit */ + /* check for RACH exceeding BER threshold (ghost RACH) */ + if (rach_ind->ber10k > btsb->max_ber10k_rach) { + DEBUGPFN(DL1C, rach_ind->fn, "ignoring RACH request: %u > %u (max BER)\n", + rach_ind->ber10k, btsb->max_ber10k_rach); + return 0; + } /* increment number of RACH slots with valid non-handover RACH burst */ btsb->load.rach.access++; diff --git a/src/common/vty.c b/src/common/vty.c index a1cb2fec..3938de5b 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -291,6 +291,8 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) VTY_NEWLINE); vty_out(vty, " min-qual-norm %.0f%s", btsb->min_qual_norm * 10.0f, VTY_NEWLINE); + vty_out(vty, " max-ber10k-rach %u%s", btsb->max_ber10k_rach, + VTY_NEWLINE); if (strcmp(btsb->pcu.sock_path, PCU_SOCK_DEFAULT)) vty_out(vty, " pcu-socket %s%s", btsb->pcu.sock_path, VTY_NEWLINE); @@ -592,6 +594,19 @@ DEFUN(cfg_bts_min_qual_norm, cfg_bts_min_qual_norm_cmd, return CMD_SUCCESS; } +DEFUN(cfg_bts_max_ber_rach, cfg_bts_max_ber_rach_cmd, + "max-ber10k-rach <0-10000>", + "Set the maximum BER for valid RACH requests\n" + "BER in 1/10000 units (0=no BER; 100=1% BER)\n") +{ + struct gsm_bts *bts = vty->index; + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); + + btsb->max_ber10k_rach = strtoul(argv[0], NULL, 10); + + return CMD_SUCCESS; +} + DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd, "pcu-socket PATH", "Configure the PCU socket file/path name\n") @@ -1542,6 +1557,7 @@ int bts_vty_init(struct gsm_bts *bts, const struct log_info *cat) install_element(BTS_NODE, &cfg_bts_ul_power_target_cmd); install_element(BTS_NODE, &cfg_bts_min_qual_rach_cmd); install_element(BTS_NODE, &cfg_bts_min_qual_norm_cmd); + install_element(BTS_NODE, &cfg_bts_max_ber_rach_cmd); install_element(BTS_NODE, &cfg_bts_pcu_sock_cmd); install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_cmd); -- cgit v1.2.3