aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-02-26 11:57:49 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-27 17:27:35 +0100
commitc2b4c668f3510b7b0baace749c5a310959010e90 (patch)
treee4796019dc76a1655ab4a0f99e79b27636126e0b
parentb60d9e9464dabba64e7ba73a1a8f41adab21ff31 (diff)
Move rach_busy counting above L1SAP
In the past, rach_busy counting was performed below L1SAP, while reporting was handled above. This lead to subtle differences between the BTS models, such as osmo-bts-trx missing to increment rach_busy. Let's move the rach_busy counting above L1SAP to share more code. This means we need libosmocore Change-Id I9439810c3a3ad89ea0302753617b850749af887c for the additional required parameters in ph_rach_ind_param, as well as libosmocore Change-id I2b1926a37bde860dcfeb0d613eb55a71271928c5 for osmo-bts-trx to determine the RACH bit error rate. Change-Id: I3b989580cb38082e3fd8fc50a11fedda13991092 Closes: OS#3003
-rw-r--r--src/common/l1sap.c22
-rw-r--r--src/osmo-bts-litecell15/l1_if.c16
-rw-r--r--src/osmo-bts-octphy/l1_if.c32
-rw-r--r--src/osmo-bts-sysmo/l1_if.c16
-rw-r--r--src/osmo-bts-trx/scheduler_trx.c6
5 files changed, 44 insertions, 48 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2623d84a..90f045a2 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1190,8 +1190,24 @@ static int l1sap_ph_rach_ind(struct gsm_bts_trx *trx,
uint8_t acc_delay;
DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind");
+
+ /* check for handover access burst on dedicated channels */
+ if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
+ rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_HO);
+ return l1sap_handover_rach(trx, l1sap, rach_ind);
+ }
+
rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_RCVD);
+ /* increment number of busy RACH slots, if required */
+ if (rach_ind->rssi >= btsb->load.rach.busy_thresh)
+ btsb->load.rach.busy++;
+
+ /* FIXME: RACH filtering due to BER limit */
+
+ /* increment number of RACH slots with valid non-handover RACH burst */
+ btsb->load.rach.access++;
+
lc = &trx->ts[0].lchan[CCCH_LCHAN].lapdm_ch;
/* check for under/overflow / sign */
@@ -1205,12 +1221,6 @@ static int l1sap_ph_rach_ind(struct gsm_bts_trx *trx,
/* According to 3GPP TS 48.058 ยง 9.3.17 Access Delay is expressed same way as TA (number of symbols) */
set_ms_to_data(get_lchan_by_chan_nr(trx, rach_ind->chan_nr), acc_delay, false);
- /* check for handover rach */
- if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
- rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_HO);
- return l1sap_handover_rach(trx, l1sap, rach_ind);
- }
-
/* check for packet access */
if ((trx == bts->c0 && L1SAP_IS_PACKET_RACH(rach_ind->ra)) ||
(trx == bts->c0 && rach_ind->is_11bit)) {
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 9c3b8672..1b83fbde 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1002,24 +1002,16 @@ static int handle_ph_ra_ind(struct lc15l1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
uint16_t ra = 0, is_11bit = 0, burst_type = 0, temp = 0;
int rc;
- /* increment number of busy RACH slots, if required */
- if (trx == bts->c0 &&
- ra_ind->measParam.fRssi >= btsb->load.rach.busy_thresh)
- btsb->load.rach.busy++;
-
+ /* FIXME: this should be deprecated/obsoleted as it bypasses rach.busy counting */
if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) {
msgb_free(l1p_msg);
return 0;
}
+ /* the old legacy full-bits acc_delay cannot express negative values */
if (ra_ind->measParam.i16BurstTiming > 0)
acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
- /* increment number of RACH slots with valid non-handover RACH burst */
- lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
- if (trx == bts->c0 && !(lchan && lchan->ho.active == HANDOVER_ENABLED))
- btsb->load.rach.access++;
-
dump_meas_res(LOGL_DEBUG, &ra_ind->measParam);
burst_type = ra_ind->burstType;
@@ -1052,6 +1044,9 @@ static int handle_ph_ra_ind(struct lc15l1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
l1sap->u.rach_ind.acc_delay = acc_delay;
l1sap->u.rach_ind.fn = fn;
l1sap->u.rach_ind.is_11bit = is_11bit; /* no of bits in 11 bit RACH */
+ l1sap->u.rach_ind.rssi = (int8_t) ra_ind->measParam.fRssi;
+ l1sap->u.rach_ind.ber10k = (unsigned int) (ra_ind->measParam.fBer * 10000.0);
+ l1sap->u.rach_ind.acc_delay_256bits = ra_ind->measParam.i16BurstTiming * 64;
/* mapping of the burst type, the values are specific to
* osmo-bts-litecell15 */
@@ -1074,6 +1069,7 @@ static int handle_ph_ra_ind(struct lc15l1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
break;
}
+ lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index ddaa9b35..535ac8b7 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1167,30 +1167,17 @@ static int handle_ph_rach_ind(struct octphy_hdl *fl1,
struct gsm_bts_trx *trx = trx_by_l1h(fl1, ra_ind->TrxId.byTrxId);
struct gsm_bts *bts = trx->bts;
struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
- struct gsm_lchan *lchan;
struct osmo_phsap_prim *l1sap;
- uint32_t fn;
uint8_t ra, acc_delay;
int rc;
- /* increment number of busy RACH slots, if required */
- if (trx == bts->c0 &&
- ra_ind->MeasurementInfo.sRSSIDbm >= btsb->load.rach.busy_thresh) {
- btsb->load.rach.busy++;
- }
- /* FIXME: Check min_qual_rach */
-
- lchan = get_lchan_by_lchid(trx, &ra_ind->LchId);
- if (trx == bts->c0 && !(lchan && lchan->ho.active == HANDOVER_ENABLED))
- btsb->load.rach.access++;
-
dump_meas_res(LOGL_DEBUG, &ra_ind->MeasurementInfo);
- fn = ra_ind->ulFrameNumber;
ra = ra_ind->abyMsg[0];
if (ra_ind->ulMsgLength != 1) {
- LOGPFN(DL1C, LOGL_ERROR, fn, "Rx PH-RACH.ind has lenghth %d > 1\n", ra_ind->ulMsgLength);
+ LOGPFN(DL1C, LOGL_ERROR, ra_ind->ulFrameNumber,
+ "Rx PH-RACH.ind has lenghth %d > 1\n", ra_ind->ulMsgLength);
msgb_free(l1p_msg);
return 0;
}
@@ -1209,16 +1196,19 @@ static int handle_ph_rach_ind(struct octphy_hdl *fl1,
l1p_msg);
l1sap->u.rach_ind.ra = ra;
l1sap->u.rach_ind.acc_delay = acc_delay;
- l1sap->u.rach_ind.fn = fn;
+ l1sap->u.rach_ind.fn = ra_ind->ulFrameNumber;
l1sap->u.rach_ind.is_11bit = 0;
+ l1sap->u.rach_ind.rssi = oct_meas2rssi_dBm(&ra_ind->MeasurementInfo);
+ l1sap->u.rach_ind.ber10k = oct_meas2ber10k(&ra_ind->MeasurementInfo);
+ l1sap->u.rach_ind.acc_delay_256bits = ra_ind->MeasurementInfo.sBurstTiming4x * 64;
- if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
- lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
- lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
+ if (ra_ind->LchId.bySubChannelNb == cOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM_ALL &&
+ ra_ind->LchId.bySAPI == cOCTVC1_GSM_SAPI_ENUM_RACH) {
l1sap->u.rach_ind.chan_nr = 0x88;
- else
+ } else {
+ struct gsm_lchan *lchan = get_lchan_by_lchid(trx, &ra_ind->LchId);
l1sap->u.rach_ind.chan_nr = gsm_lchan2chan_nr(lchan);
-
+ }
l1sap_up(trx, l1sap);
/* return '1' to indicate l1sap_up has taken msgb ownership */
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 396d1c2f..08f584b2 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -992,24 +992,16 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
uint16_t ra = 0, is_11bit = 0, burst_type = 0, temp = 0;
int rc;
- /* increment number of busy RACH slots, if required */
- if (trx == bts->c0 &&
- ra_ind->measParam.fRssi >= btsb->load.rach.busy_thresh)
- btsb->load.rach.busy++;
-
+ /* FIXME: this should be deprecated/obsoleted as it bypasses rach.busy counting */
if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) {
msgb_free(l1p_msg);
return 0;
}
+ /* the old legacy full-bits acc_delay cannot express negative values */
if (ra_ind->measParam.i16BurstTiming > 0)
acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
- /* increment number of RACH slots with valid non-handover RACH burst */
- lchan = l1if_hLayer_to_lchan(trx, ra_ind->hLayer2);
- if (trx == bts->c0 && !(lchan && lchan->ho.active == HANDOVER_ENABLED))
- btsb->load.rach.access++;
-
dump_meas_res(LOGL_DEBUG, &ra_ind->measParam);
burst_type = ra_ind->burstType;
@@ -1043,6 +1035,9 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
l1sap->u.rach_ind.acc_delay = acc_delay;
l1sap->u.rach_ind.fn = fn;
l1sap->u.rach_ind.is_11bit = is_11bit; /* no of bits in 11 bit RACH */
+ l1sap->u.rach_ind.rssi = (int8_t) ra_ind->measParam.fRssi;
+ l1sap->u.rach_ind.ber10k = (unsigned int) (ra_ind->measParam.fBer * 10000.0);
+ l1sap->u.rach_ind.acc_delay_256bits = ra_ind->measParam.i16BurstTiming * 64;
/*mapping of the burst type, the values are specific to osmo-bts-sysmo*/
@@ -1065,6 +1060,7 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
break;
}
+ lchan = l1if_hLayer_to_lchan(trx, ra_ind->hLayer2);
if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index f53e4828..43cc30b0 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -718,6 +718,7 @@ int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
{
uint8_t chan_nr;
struct osmo_phsap_prim l1sap;
+ int n_errors, n_bits_total;
uint8_t ra;
int rc;
@@ -726,7 +727,7 @@ int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn, "Received RACH toa=%.2f\n", toa);
/* decode */
- rc = gsm0503_rach_decode(&ra, bits + 8 + 41, l1t->trx->bts->bsic);
+ rc = gsm0503_rach_decode_ber(&ra, bits + 8 + 41, l1t->trx->bts->bsic, &n_errors, &n_bits_total);
if (rc) {
LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn, "Received bad AB frame\n");
return 0;
@@ -749,6 +750,9 @@ int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
/* 11bit RACH is not supported for osmo-trx */
l1sap.u.rach_ind.is_11bit = 0;
l1sap.u.rach_ind.burst_type = GSM_L1_BURST_TYPE_ACCESS_0;
+ l1sap.u.rach_ind.rssi = rssi;
+ l1sap.u.rach_ind.ber10k = compute_ber10k(n_bits_total, n_errors);
+ l1sap.u.rach_ind.acc_delay_256bits = 256*toa;
/* forward primitive */
l1sap_up(l1t->trx, &l1sap);