Change in ...osmocom-bb[master]: trxcon/l1ctl.c: properly handle handover RACH request

2019-06-02 Thread fixeria
fixeria has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/14274 )

Change subject: trxcon/l1ctl.c: properly handle handover RACH request
..

trxcon/l1ctl.c: properly handle handover RACH request

During the handover the MS needs to release the existing dedicated
channel(s), establish the new one(s) as indicated by the network,
and then, depending on the synchronisation state, send one or more
HANDOVER ACCESS messages carried by Access Bursts.

In order to implement this, trxcon needs to be able to transmit
Access Bursts on any TDMA timeslot regardless of the logical
channel type and the associated handler, i.e. != TRXC_RACH.

The controlling side on L1CTL (layer23 or TTCN-3) needs to send
one or more L1CTL_RACH_REQ message(s) with properly populated
UL info header. Otherwise a regular RACH on TS0 is assumed.

Change-Id: Ia967820a536c99966ba2c60b63d2ea9edb093f46
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/sched_lchan_rach.c
M src/host/trxcon/sched_trx.c
3 files changed, 20 insertions(+), 15 deletions(-)

Approvals:
  fixeria: Looks good to me, approved; Verified
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 30f43d0..e722624 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -512,7 +512,6 @@
struct l1ctl_rach_req *req;
struct l1ctl_info_ul *ul;
struct trx_ts_prim *prim;
-   uint8_t chan_nr, link_id;
size_t len;
int rc;

@@ -537,25 +536,24 @@
"(offset=%u, ra=0x%02x)\n", req->offset, req->ra);
}

-   /**
-* FIXME: l1ctl_info_ul doesn't provide channel description
-* FIXME: Can we use other than TS0?
-*/
-   chan_nr = RSL_CHAN_RACH;
-   link_id = 0x00;
+   /* The controlling L1CTL side always does include the UL info header,
+* but may leave it empty. We assume RACH is on TS0 in this case. */
+   if (ul->chan_nr == 0x00) {
+   LOGP(DL1C, LOGL_NOTICE, "The UL info header is empty, "
+   "assuming RACH is on TS0\n");
+   ul->chan_nr = RSL_CHAN_RACH;
+   }

/* Init a new primitive */
-   rc = sched_prim_init(l1l->trx, &prim, len, chan_nr, link_id);
+   rc = sched_prim_init(l1l->trx, &prim, len, ul->chan_nr, ul->link_id);
if (rc)
goto exit;

/**
-* Push this primitive to transmit queue
-*
-* FIXME: what if requested TS is not configured?
-* Or what if one (such as TCH) has no TRXC_RACH slots?
+* Push this primitive to the transmit queue.
+* Indicated timeslot needs to be configured.
 */
-   rc = sched_prim_push(l1l->trx, prim, chan_nr);
+   rc = sched_prim_push(l1l->trx, prim, ul->chan_nr);
if (rc) {
talloc_free(prim);
goto exit;
diff --git a/src/host/trxcon/sched_lchan_rach.c 
b/src/host/trxcon/sched_lchan_rach.c
index 7d202b8..e96a0e6 100644
--- a/src/host/trxcon/sched_lchan_rach.c
+++ b/src/host/trxcon/sched_lchan_rach.c
@@ -155,9 +155,10 @@
/* BN85-156: tail bits & extended guard period */
memset(burst_ptr, 0, burst + GSM_BURST_LEN - burst_ptr);

-   LOGP(DSCHD, LOGL_DEBUG, "Transmitting %s RACH (%s) fn=%u\n",
+   LOGP(DSCHD, LOGL_NOTICE, "Transmitting %s RACH (%s) on fn=%u, tn=%u, 
lchan=%s\n",
PRIM_IS_RACH11(lchan->prim) ? "extended (11-bit)" : "regular 
(8-bit)",
-   get_value_string(rach_synch_seq_names, synch_seq), fn);
+   get_value_string(rach_synch_seq_names, synch_seq), fn,
+   ts->index, trx_lchan_desc[lchan->type].name);

/* Forward burst to scheduler */
rc = sched_trx_handle_tx_burst(trx, ts, lchan, fn, burst);
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index 62fe870..37d1acf 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -35,6 +35,7 @@
 #include 
 #include 

+#include "l1ctl_proto.h"
 #include "scheduler.h"
 #include "sched_trx.h"
 #include "trx_if.h"
@@ -116,6 +117,11 @@
if (lchan->prim == NULL)
continue;

+   /* Handover RACH needs to be handled regardless of the
+* current channel type and the associated handler. */
+   if (PRIM_IS_RACH(lchan->prim) && lchan->prim->chan != TRXC_RACH)
+   handler = trx_lchan_desc[TRXC_RACH].tx_fn;
+
/* Poke lchan handler */
handler(trx, ts, lchan, fn, bid);
}

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ia967820a536c99966ba2c60b63d2ea9edb093f46
Gerrit-Change-Number: 14274
Gerrit-

Change in ...osmocom-bb[master]: trxcon/l1ctl.c: properly handle handover RACH request

2019-06-02 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/14274 )

Change subject: trxcon/l1ctl.c: properly handle handover RACH request
..


Patch Set 3: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ia967820a536c99966ba2c60b63d2ea9edb093f46
Gerrit-Change-Number: 14274
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Comment-Date: Sun, 02 Jun 2019 11:16:19 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmocom-bb[master]: trxcon/l1ctl.c: properly handle handover RACH request

2019-05-31 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/14274 )

Change subject: trxcon/l1ctl.c: properly handle handover RACH request
..


Patch Set 3: Verified+1 Code-Review+1

Tested using to be introduced TC_ho_rach(), see 
https://gerrit.osmocom.org/#/c/osmo-ttcn3-hacks/+/14291/


--
To view, visit https://gerrit.osmocom.org/14274
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia967820a536c99966ba2c60b63d2ea9edb093f46
Gerrit-Change-Number: 14274
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 31 May 2019 14:57:22 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/l1ctl.c: properly handle handover RACH request

2019-05-31 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/14274 )

Change subject: trxcon/l1ctl.c: properly handle handover RACH request
..


Set Ready For Review


--
To view, visit https://gerrit.osmocom.org/14274
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia967820a536c99966ba2c60b63d2ea9edb093f46
Gerrit-Change-Number: 14274
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 31 May 2019 14:56:10 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmocom-bb[master]: trxcon/l1ctl.c: properly handle handover RACH request

2019-05-29 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/14274


Change subject: trxcon/l1ctl.c: properly handle handover RACH request
..

trxcon/l1ctl.c: properly handle handover RACH request

During the handover the MS needs to release the existing dedicated
channel(s), establish the new one(s) as indicated by the network,
and then, depending on the synchronisation state, send one or more
HANDOVER ACCESS messages carried by Access Bursts.

In order to implement this, trxcon needs to be able to transmit
Access Bursts on any TDMA timeslot regardless of the logical
channel type and the associated handler, i.e. != TRXC_RACH.

The controlling side on L1CTL (layer23 or TTCN-3) needs to send
one or more L1CTL_RESET_REQ message(s) with properly populated
UL info header. Otherwise a regular RACH on TS0 is assumed.

Change-Id: Ia967820a536c99966ba2c60b63d2ea9edb093f46
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/sched_trx.c
2 files changed, 17 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/74/14274/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index fff1c2b..ce83f95 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -509,7 +509,6 @@
struct l1ctl_rach_req *req;
struct l1ctl_info_ul *ul;
struct trx_ts_prim *prim;
-   uint8_t chan_nr, link_id;
size_t len;
int rc;

@@ -534,25 +533,24 @@
"(offset=%u, ra=0x%02x)\n", req->offset, req->ra);
}

-   /**
-* FIXME: l1ctl_info_ul doesn't provide channel description
-* FIXME: Can we use other than TS0?
-*/
-   chan_nr = RSL_CHAN_RACH;
-   link_id = 0x00;
+   /* The controlling L1CTL side always include the UL info header,
+* but may leave it empty. We assume RACH is on TS0 in this case. */
+   if (ul->chan_nr == 0x00) {
+   LOGP(DL1C, LOGL_NOTICE, "The UL info header is empty, "
+   "assuming RACH is on TS0\n");
+   ul->chan_nr = RSL_CHAN_RACH;
+   }

/* Init a new primitive */
-   rc = sched_prim_init(l1l->trx, &prim, len, chan_nr, link_id);
+   rc = sched_prim_init(l1l->trx, &prim, len, ul->chan_nr, ul->link_id);
if (rc)
goto exit;

/**
-* Push this primitive to transmit queue
-*
-* FIXME: what if requested TS is not configured?
-* Or what if one (such as TCH) has no TRXC_RACH slots?
+* Push this primitive to the transmit queue.
+* Indicated timeslot needs to be configured.
 */
-   rc = sched_prim_push(l1l->trx, prim, chan_nr);
+   rc = sched_prim_push(l1l->trx, prim, ul->chan_nr);
if (rc) {
talloc_free(prim);
goto exit;
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index 62fe870..37d1acf 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -35,6 +35,7 @@
 #include 
 #include 

+#include "l1ctl_proto.h"
 #include "scheduler.h"
 #include "sched_trx.h"
 #include "trx_if.h"
@@ -116,6 +117,11 @@
if (lchan->prim == NULL)
continue;

+   /* Handover RACH needs to be handled regardless of the
+* current channel type and the associated handler. */
+   if (PRIM_IS_RACH(lchan->prim) && lchan->prim->chan != TRXC_RACH)
+   handler = trx_lchan_desc[TRXC_RACH].tx_fn;
+
/* Poke lchan handler */
handler(trx, ts, lchan, fn, bid);
}

-- 
To view, visit https://gerrit.osmocom.org/14274
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia967820a536c99966ba2c60b63d2ea9edb093f46
Gerrit-Change-Number: 14274
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy