[PATCH] osmo-bts[master]: Move rach_busy counting above L1SAP

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6931

to look at the new patch set (#4).

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
---
M src/common/l1sap.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/scheduler_trx.c
5 files changed, 44 insertions(+), 48 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/31/6931/4

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2623d84..90f045a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1190,7 +1190,23 @@
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 = >ts[0].lchan[CCCH_LCHAN].lapdm_ch;
 
@@ -1204,12 +1220,6 @@
 
/* 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)) ||
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 9c3b867..1b83fbd 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1002,23 +1002,15 @@
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, _ind->measParam);
burst_type = ra_ind->burstType;
@@ -1052,6 +1044,9 @@
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 * 
1.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 @@
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 ddaa9b3..535ac8b 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1167,30 +1167,17 @@
struct gsm_bts_trx *trx = trx_by_l1h(fl1, ra_ind->TrxId.byTrxId);
 

[PATCH] osmo-bts[master]: Move rach_busy counting above L1SAP

2018-02-26 Thread Harald Welte
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6931

to look at the new patch set (#2).

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
---
M src/common/l1sap.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/scheduler_trx.c
5 files changed, 44 insertions(+), 48 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/31/6931/2

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2623d84..90f045a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1190,7 +1190,23 @@
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 = >ts[0].lchan[CCCH_LCHAN].lapdm_ch;
 
@@ -1204,12 +1220,6 @@
 
/* 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)) ||
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 9c3b867..67a1bbd 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1002,23 +1002,15 @@
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, _ind->measParam);
burst_type = ra_ind->burstType;
@@ -1052,6 +1044,9 @@
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 * 
1.0);
+   l1sap->u.rach_ind.acc_delay_qbits = ra_ind->measParam.i16BurstTiming;
 
/* mapping of the burst type, the values are specific to
 * osmo-bts-litecell15 */
@@ -1074,6 +1069,7 @@
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 ddaa9b3..7089194 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1167,30 +1167,17 @@
struct gsm_bts_trx *trx = trx_by_l1h(fl1, ra_ind->TrxId.byTrxId);

[PATCH] osmo-bts[master]: Move rach_busy counting above L1SAP

2018-02-26 Thread Harald Welte

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

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.

Change-Id: I3b989580cb38082e3fd8fc50a11fedda13991092
Closes: OS#3003
---
M src/common/l1sap.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/scheduler_trx.c
5 files changed, 44 insertions(+), 48 deletions(-)


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

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2623d84..90f045a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1190,7 +1190,23 @@
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 = >ts[0].lchan[CCCH_LCHAN].lapdm_ch;
 
@@ -1204,12 +1220,6 @@
 
/* 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)) ||
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 35d31f4..ece4987 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1002,23 +1002,15 @@
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, _ind->measParam);
burst_type = ra_ind->burstType;
@@ -1052,6 +1044,9 @@
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 * 
1.0);
+   l1sap->u.rach_ind.acc_delay_qbits = ra_ind->measParam.i16BurstTiming;
 
/* mapping of the burst type, the values are specific to
 * osmo-bts-litecell15 */
@@ -1074,6 +1069,7 @@
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)
l1sap->u.rach_ind.chan_nr = 0x88;
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index ddaa9b3..7089194 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1167,30 +1167,17 @@
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 >=