Project

General

Profile

0001-RACH-decoding-Use-BER-threshold-for-RACH-ghost-detec.patch

laforge, 06/27/2016 05:03 PM

View differences:

include/osmo-bts/gsm_data.h
107 107

  
108 108
	float min_qual_rach;	/* minimum quality for RACH bursts */
109 109
	float min_qual_norm;	/* minimum quality for normal daata */
110
	uint16_t max_ber10k_rach;	/* Maximum permitted RACH BER in 0.01% */
110 111

  
111 112
	struct {
112 113
		char *sock_path;
src/common/bts.c
118 118
	btsb->t3105_ms = 300;
119 119
	btsb->min_qual_rach = MIN_QUAL_RACH;
120 120
	btsb->min_qual_norm = MIN_QUAL_NORM;
121
	btsb->max_ber10k_rach = 1707; /* 7 of 41 bits is Eb/N0 of 0 dB = 0.1707 */
121 122
	btsb->pcu.sock_path = talloc_strdup(btsb, PCU_SOCK_DEFAULT);
122 123
	for (i = 0; i < ARRAY_SIZE(btsb->t200_ms); i++)
123 124
		btsb->t200_ms[i] = oml_default_t200_ms[i];
src/common/l1sap.c
936 936

  
937 937
	lc = &trx->ts[0].lchan[4].lapdm_ch;
938 938

  
939
	/* check for RACH exceeding BER threshold (ghost RACH) */
940
	if (rach_ind->ber10k > btsb->max_ber10k_rach) {
941
		DEBUGP(DL1C, "ignoring RACH request: %u > %u (max BER)\n",
942
			rach_ind->ber10k, btsb->max_ber10k_rach);
943
		return 0;
944
	}
945

  
939 946
	/* check for under/overflow / sign */
940 947
	if (!check_acc_delay(rach_ind, btsb, &acc_delay)) {
941 948
		LOGP(DL1C, LOGL_INFO, "ignoring RACH request %u > max_ta(%u)\n",
src/common/vty.c
304 304
		VTY_NEWLINE);
305 305
	vty_out(vty, " min-qual-norm %.0f%s", btsb->min_qual_norm * 10.0f,
306 306
		VTY_NEWLINE);
307
	vty_out(vty, " max-ber10k-rach %u%s", btsb->max_ber10k_rach,
308
		VTY_NEWLINE);
307 309
	if (strcmp(btsb->pcu.sock_path, PCU_SOCK_DEFAULT))
308 310
		vty_out(vty, " pcu-socket %s%s", btsb->pcu.sock_path, VTY_NEWLINE);
309 311

  
......
603 605
	return CMD_SUCCESS;
604 606
}
605 607

  
608
DEFUN(cfg_bts_max_ber_rach, cfg_bts_max_ber_rach_cmd,
609
	"max-ber10k-rach <0-10000>",
610
	"Set the maximum BER for valid RACH requests\n"
611
	"BER in 1/10000 units (0=no BER; 100=1% BER)\n")
612
{
613
	struct gsm_bts *bts = vty->index;
614
	struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
615

  
616
	btsb->max_ber10k_rach = strtoul(argv[0], NULL, 10);
617

  
618
	return CMD_SUCCESS;
619
}
620

  
606 621
DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd,
607 622
	"pcu-socket PATH",
608 623
	"Configure the PCU socket file/path name\n")
......
1093 1108
	install_element(BTS_NODE, &cfg_bts_ul_power_target_cmd);
1094 1109
	install_element(BTS_NODE, &cfg_bts_min_qual_rach_cmd);
1095 1110
	install_element(BTS_NODE, &cfg_bts_min_qual_norm_cmd);
1111
	install_element(BTS_NODE, &cfg_bts_max_ber_rach_cmd);
1096 1112
	install_element(BTS_NODE, &cfg_bts_pcu_sock_cmd);
1097 1113

  
1098 1114
	install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_cmd);
src/osmo-bts-litecell15/l1_if.c
964 964
	l1sap->u.rach_ind.ra = ra;
965 965
	l1sap->u.rach_ind.acc_delay = acc_delay;
966 966
	l1sap->u.rach_ind.fn = fn;
967
	l1sap->u.rach_ind.ber10k = (uint16_t) (ra_ind->measParam.fBer * 100);
967 968
	if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
968 969
	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4)
969 970
		l1sap->u.rach_ind.chan_nr = 0x88;
src/osmo-bts-octphy/l1_if.c
1087 1087
	l1sap->u.rach_ind.ra = ra;
1088 1088
	l1sap->u.rach_ind.acc_delay = acc_delay;
1089 1089
	l1sap->u.rach_ind.fn = fn;
1090
	l1sap->u.rach_ind.ber10k = (unsigned int)
1091
			(ra_ind->MeasuremenetInfo.usBERCnt * 100);
1090 1092
	if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
1091 1093
	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4)
1092 1094
		l1sap->u.rach_ind.chan_nr = 0x88;
src/osmo-bts-sysmo/l1_if.c
960 960
	l1sap->u.rach_ind.ra = ra;
961 961
	l1sap->u.rach_ind.acc_delay = acc_delay;
962 962
	l1sap->u.rach_ind.fn = fn;
963
	l1sap->u.rach_ind.ber10k = (uint16_t) (ra_ind->measParam.fBer * 100);
963 964
	if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
964 965
	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4)
965 966
		l1sap->u.rach_ind.chan_nr = 0x88;
src/osmo-bts-trx/gsm0503_coding.c
1628 1628
	return 0;
1629 1629
}
1630 1630

  
1631
int rach_decode(uint8_t *ra, sbit_t *burst, uint8_t bsic)
1631
int rach_decode(uint8_t *ra, sbit_t *burst, uint8_t bsic,
1632
		int *n_errors, int *n_bits_total)
1632 1633
{
1633 1634
	ubit_t conv[14];
1634 1635
	int rv;
1635 1636

  
1636
	osmo_conv_decode(&gsm0503_conv_rach, burst, conv);
1637
	osmo_conv_decode_ber(&gsm0503_conv_rach, burst, conv,
1638
				n_errors, n_bits_total);
1637 1639

  
1638 1640
	rach_apply_bsic(conv, bsic);
1639 1641

  
src/osmo-bts-trx/gsm0503_coding.h
45 45
int tch_ahs_encode(ubit_t *bursts, uint8_t *tch_data, int len,
46 46
	int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft,
47 47
	uint8_t cmr);
48
int rach_decode(uint8_t *ra, sbit_t *burst, uint8_t bsic);
48
int rach_decode(uint8_t *ra, sbit_t *burst, uint8_t bsic,
49
		int *n_errors, int *n_bits_total);
49 50
int rach_encode(ubit_t *burst, uint8_t *ra, uint8_t bsic);
50 51
int sch_decode(uint8_t *sb_info, sbit_t *burst);
51 52
int sch_encode(ubit_t *burst, uint8_t *sb_info);
src/osmo-bts-trx/scheduler_trx.c
703 703
}
704 704

  
705 705

  
706
unsigned int compute_ber10k(int n_errors, int n_bits_total)
707
{
708
	float ber = n_bits_total == 0 ? 1.0 :
709
			(float)n_errors / (float)n_bits_total;
710
	return (int) (ber * 10000.0f);
711
}
706 712
/*
707 713
 * RX on uplink (indication to upper layer)
708 714
 */
......
714 720
	uint8_t chan_nr;
715 721
	struct osmo_phsap_prim l1sap;
716 722
	uint8_t ra;
723
	int n_errors, n_bits_total;
717 724
	int rc;
718 725

  
719 726
	chan_nr = trx_chan_desc[chan].chan_nr | tn;
......
722 729
		trx_chan_desc[chan].name, fn, toa);
723 730

  
724 731
	/* decode */
725
	rc = rach_decode(&ra, bits + 8 + 41, l1t->trx->bts->bsic);
732
	rc = rach_decode(&ra, bits + 8 + 41, l1t->trx->bts->bsic,
733
			 &n_errors, &n_bits_total);
726 734
	if (rc) {
727 735
		LOGP(DL1C, LOGL_NOTICE, "Received bad AB frame at fn=%u "
728 736
			"(%u/51)\n", fn, fn % 51);
......
742 750
#endif
743 751
	l1sap.u.rach_ind.acc_delay = (toa >= 0) ? toa : 0;
744 752
	l1sap.u.rach_ind.fn = fn;
753
	l1sap.u.rach_ind.ber10k = compute_ber10k(n_errors, n_bits_total);
745 754

  
746 755
	/* forward primitive */
747 756
	l1sap_up(l1t->trx, &l1sap);
748
- 
Add picture from clipboard (Maximum size: 48.8 MB)