Change in ...osmo-bts[master]: L1SAP: refactor handling of Access Bursts on PDCH

2019-10-09 Thread fixeria
fixeria has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15711 )

Change subject: L1SAP: refactor handling of Access Bursts on PDCH
..

L1SAP: refactor handling of Access Bursts on PDCH

First of all, we also need to apply the same filtering to Access
Bursts on PDCH as for the normal ones on RACH, i.e. filter them
by ToA (Timing of Arrival) and BER (Bit Error Rate).

Secondly, we shall not interpret Access Bursts on PDTCH/U as
handover related ones. Instead, let's print a warning and
ignore them since they are not (yet) supported by OsmoBTS.

Finally, in gsmtap_pdch() we need to set a proper channel type
for Access Bursts received on PDCH (PDTCH/U or PTCCH/U).

Change-Id: I461fde9f4543c45c42b591cd3fd0ff3d98673cec
---
M src/common/l1sap.c
1 file changed, 47 insertions(+), 19 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 93a70cd..06de8a3 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -349,18 +349,27 @@
 static int gsmtap_ph_rach(struct osmo_phsap_prim *l1sap, uint8_t *chan_type,
uint8_t *tn, uint8_t *ss, uint32_t *fn, uint8_t **data, unsigned int 
*len)
 {
-   uint8_t chan_nr;
+   uint8_t chan_nr = l1sap->u.rach_ind.chan_nr;

*chan_type = GSMTAP_CHANNEL_RACH;
*fn = l1sap->u.rach_ind.fn;
-   *tn = L1SAP_CHAN2TS(l1sap->u.rach_ind.chan_nr);
-   chan_nr = l1sap->u.rach_ind.chan_nr;
+   *tn = L1SAP_CHAN2TS(chan_nr);
+
if (L1SAP_IS_CHAN_TCHH(chan_nr))
*ss = L1SAP_CHAN2SS_TCHH(chan_nr);
else if (L1SAP_IS_CHAN_SDCCH4(chan_nr))
*ss = L1SAP_CHAN2SS_SDCCH4(chan_nr);
else if (L1SAP_IS_CHAN_SDCCH8(chan_nr))
*ss = L1SAP_CHAN2SS_SDCCH8(chan_nr);
+   else if (L1SAP_IS_CHAN_PDCH(chan_nr)) {
+   if (L1SAP_IS_PTCCH(*fn)) {
+   /* TODO: calculate sub-slot from frame-number */
+   *chan_type = GSMTAP_CHANNEL_PTCCH;
+   } else {
+   *chan_type = GSMTAP_CHANNEL_PDTCH;
+   }
+   }
+
*data = (uint8_t *)>u.rach_ind.ra;
*len = 1;

@@ -1303,6 +1312,32 @@
return 0;
 }

+/* Special case for Access Bursts on PDTCH/U or PTCCH/U */
+static int l1sap_pdch_rach(struct gsm_bts_trx *trx, struct ph_rach_ind_param 
*rach_ind)
+{
+   /* Filter out noise / interference / ghosts */
+   if (!rach_pass_filter(rach_ind, trx->bts))
+   return -EAGAIN;
+
+   /* PTCCH/U (Packet Timing Advance Control Channel) */
+   if (L1SAP_IS_PTCCH(rach_ind->fn)) {
+   LOGPFN(DL1P, LOGL_DEBUG, rach_ind->fn,
+  /* TODO: calculate and print Timing Advance Index */
+  "Access Burst for continuous Timing Advance control 
(toa256=%d)\n",
+  rach_ind->acc_delay_256bits);
+
+   /* QTA: Timing Advance in units of 1/4 of a symbol */
+   pcu_tx_rach_ind(trx->bts, rach_ind->acc_delay_256bits >> 6,
+   rach_ind->ra, rach_ind->fn, rach_ind->is_11bit,
+   rach_ind->burst_type, PCU_IF_SAPI_PTCCH);
+   return 0;
+   } else { /* The MS may acknowledge DL data by 4 consequent Access 
Bursts */
+   LOGPFN(DL1P, LOGL_NOTICE, rach_ind->fn,
+  "Access Bursts on PDTCH/U are not (yet) supported\n");
+   return -ENOTSUP;
+   }
+}
+
 /* 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)
@@ -1312,22 +1347,15 @@

DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind\n");
 
-   /* PTCCH/UL (Packet Timing Advance Control Channel) */
-   if (L1SAP_IS_CHAN_PDCH(rach_ind->chan_nr) && 
L1SAP_IS_PTCCH(rach_ind->fn)) {
-   LOGPFN(DL1P, LOGL_DEBUG, rach_ind->fn,
-  /* TODO: calculate and print Timing Advance Index */
-  "Access Burst for continuous Timing Advance control 
(toa256=%d)\n",
-  rach_ind->acc_delay_256bits);
-
-   /* QTA: Timing Advance in units of 1/4 of a symbol */
-   pcu_tx_rach_ind(bts, rach_ind->acc_delay_256bits >> 6,
-   rach_ind->ra, rach_ind->fn, rach_ind->is_11bit,
-   rach_ind->burst_type, PCU_IF_SAPI_PTCCH);
-   return 0;
-   }
-
-   /* check for handover access burst on dedicated channels */
-   if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
+   /* Check the origin of an Access Burst */
+   switch (rach_ind->chan_nr & 0xf8) {
+   case RSL_CHAN_RACH:
+   /* CS or PS RACH, to be handled in this function */
+  

Change in ...osmo-bts[master]: L1SAP: refactor handling of Access Bursts on PDCH

2019-10-09 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15711 )

Change subject: L1SAP: refactor handling of Access Bursts on PDCH
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15711
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I461fde9f4543c45c42b591cd3fd0ff3d98673cec
Gerrit-Change-Number: 15711
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 09 Oct 2019 11:06:01 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-bts[master]: L1SAP: refactor handling of Access Bursts on PDCH

2019-10-08 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15711 )

Change subject: L1SAP: refactor handling of Access Bursts on PDCH
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15711
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I461fde9f4543c45c42b591cd3fd0ff3d98673cec
Gerrit-Change-Number: 15711
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 08 Oct 2019 20:27:33 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-bts[master]: L1SAP: refactor handling of Access Bursts on PDCH

2019-10-08 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15711 )

Change subject: L1SAP: refactor handling of Access Bursts on PDCH
..


Patch Set 1:

looks good to me, but I think we still need to also have a similar filter on 
the PCU side as osmo-bts-{sysmo,lc15,oc2g} feed all L1 primitives on P* SAPIs 
directly to the PCU, bypassing the BTS for efficiency reasons.


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15711
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I461fde9f4543c45c42b591cd3fd0ff3d98673cec
Gerrit-Change-Number: 15711
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-Comment-Date: Tue, 08 Oct 2019 20:25:44 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-bts[master]: L1SAP: refactor handling of Access Bursts on PDCH

2019-10-08 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15711


Change subject: L1SAP: refactor handling of Access Bursts on PDCH
..

L1SAP: refactor handling of Access Bursts on PDCH

First of all, we also need to apply the same filtering to Access
Bursts on PDCH as for the normal ones on RACH, i.e. filter them
by ToA (Timing of Arrival) and BER (Bit Error Rate).

Secondly, we shall not interpret Access Bursts on PDTCH/U as
handover related ones. Instead, let's print a warning and
ignore them since they are not (yet) supported by OsmoBTS.

Finally, in gsmtap_pdch() we need to set a proper channel type
for Access Bursts received on PDCH (PDTCH/U or PTCCH/U).

Change-Id: I461fde9f4543c45c42b591cd3fd0ff3d98673cec
---
M src/common/l1sap.c
1 file changed, 47 insertions(+), 19 deletions(-)



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

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 93a70cd..06de8a3 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -349,18 +349,27 @@
 static int gsmtap_ph_rach(struct osmo_phsap_prim *l1sap, uint8_t *chan_type,
uint8_t *tn, uint8_t *ss, uint32_t *fn, uint8_t **data, unsigned int 
*len)
 {
-   uint8_t chan_nr;
+   uint8_t chan_nr = l1sap->u.rach_ind.chan_nr;

*chan_type = GSMTAP_CHANNEL_RACH;
*fn = l1sap->u.rach_ind.fn;
-   *tn = L1SAP_CHAN2TS(l1sap->u.rach_ind.chan_nr);
-   chan_nr = l1sap->u.rach_ind.chan_nr;
+   *tn = L1SAP_CHAN2TS(chan_nr);
+
if (L1SAP_IS_CHAN_TCHH(chan_nr))
*ss = L1SAP_CHAN2SS_TCHH(chan_nr);
else if (L1SAP_IS_CHAN_SDCCH4(chan_nr))
*ss = L1SAP_CHAN2SS_SDCCH4(chan_nr);
else if (L1SAP_IS_CHAN_SDCCH8(chan_nr))
*ss = L1SAP_CHAN2SS_SDCCH8(chan_nr);
+   else if (L1SAP_IS_CHAN_PDCH(chan_nr)) {
+   if (L1SAP_IS_PTCCH(*fn)) {
+   /* TODO: calculate sub-slot from frame-number */
+   *chan_type = GSMTAP_CHANNEL_PTCCH;
+   } else {
+   *chan_type = GSMTAP_CHANNEL_PDTCH;
+   }
+   }
+
*data = (uint8_t *)>u.rach_ind.ra;
*len = 1;

@@ -1303,6 +1312,32 @@
return 0;
 }

+/* Special case for Access Bursts on PDTCH/U or PTCCH/U */
+static int l1sap_pdch_rach(struct gsm_bts_trx *trx, struct ph_rach_ind_param 
*rach_ind)
+{
+   /* Filter out noise / interference / ghosts */
+   if (!rach_pass_filter(rach_ind, trx->bts))
+   return -EAGAIN;
+
+   /* PTCCH/U (Packet Timing Advance Control Channel) */
+   if (L1SAP_IS_PTCCH(rach_ind->fn)) {
+   LOGPFN(DL1P, LOGL_DEBUG, rach_ind->fn,
+  /* TODO: calculate and print Timing Advance Index */
+  "Access Burst for continuous Timing Advance control 
(toa256=%d)\n",
+  rach_ind->acc_delay_256bits);
+
+   /* QTA: Timing Advance in units of 1/4 of a symbol */
+   pcu_tx_rach_ind(trx->bts, rach_ind->acc_delay_256bits >> 6,
+   rach_ind->ra, rach_ind->fn, rach_ind->is_11bit,
+   rach_ind->burst_type, PCU_IF_SAPI_PTCCH);
+   return 0;
+   } else { /* The MS may acknowledge DL data by 4 consequent Access 
Bursts */
+   LOGPFN(DL1P, LOGL_NOTICE, rach_ind->fn,
+  "Access Bursts on PDTCH/U are not (yet) supported\n");
+   return -ENOTSUP;
+   }
+}
+
 /* 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)
@@ -1312,22 +1347,15 @@

DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind\n");

-   /* PTCCH/UL (Packet Timing Advance Control Channel) */
-   if (L1SAP_IS_CHAN_PDCH(rach_ind->chan_nr) && 
L1SAP_IS_PTCCH(rach_ind->fn)) {
-   LOGPFN(DL1P, LOGL_DEBUG, rach_ind->fn,
-  /* TODO: calculate and print Timing Advance Index */
-  "Access Burst for continuous Timing Advance control 
(toa256=%d)\n",
-  rach_ind->acc_delay_256bits);
-
-   /* QTA: Timing Advance in units of 1/4 of a symbol */
-   pcu_tx_rach_ind(bts, rach_ind->acc_delay_256bits >> 6,
-   rach_ind->ra, rach_ind->fn, rach_ind->is_11bit,
-   rach_ind->burst_type, PCU_IF_SAPI_PTCCH);
-   return 0;
-   }
-
-   /* check for handover access burst on dedicated channels */
-   if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
+   /* Check the origin of an Access Burst */
+   switch (rach_ind->chan_nr & 0xf8) {
+   case RSL_CHAN_RACH:
+   /* CS or PS RACH, to be handled in this function */
+   break;
+   case RSL_CHAN_OSMO_PDCH:
+   /*