jolly has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/34886?usp=email )

Change subject: ASCI: Add control of uplink access to osmo-bts-trx
......................................................................

ASCI: Add control of uplink access to osmo-bts-trx

An MPH-INFO message is used to turn detection of uplink access bursts on
or off. This is required for voice group/broadcast channels.

Related: OS#4851
Depends: libosmocore.git Ibd6a1d468a70126a8f67e944fcb916969cc3c36b
Change-Id: I9045437d52984b7abe00fbc815d7f83c62c0fb5a
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
M src/osmo-bts-trx/l1_if.c
3 files changed, 61 insertions(+), 4 deletions(-)

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




diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 94333ea..b9c7350 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -186,6 +186,9 @@
 /*! \brief set all matching logical channels active/inactive */
 int trx_sched_set_lchan(struct gsm_lchan *lchan, uint8_t chan_nr, uint8_t 
link_id, bool active);

+/*! \brief set uplink access on given logical channels active/inactive */
+int trx_sched_set_ul_access(struct gsm_lchan *lchan, uint8_t chan_nr, bool 
active);
+
 /*! \brief set all logical channels of BCCH/CCCH active/inactive */
 int trx_sched_set_bcch_ccch(struct gsm_lchan *lchan, bool active);

diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index e68d01f..0e62b65 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1144,6 +1144,33 @@
        return found ? 0 : -EINVAL;
 }

+int trx_sched_set_ul_access(struct gsm_lchan *lchan, uint8_t chan_nr, bool 
active)
+{
+       struct l1sched_ts *l1ts = lchan->ts->priv;
+       uint8_t tn = L1SAP_CHAN2TS(chan_nr);
+       uint8_t ss = l1sap_chan2ss(chan_nr);
+       int i;
+
+       if (!l1ts) {
+               LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "%s UL access on lchan with 
uninitialized scheduler structure.\n",
+                         (active) ? "Activating" : "Deactivating");
+               return -EINVAL;
+       }
+
+       /* look for all matching chan_nr */
+       for (i = 0; i < _TRX_CHAN_MAX; i++) {
+               if (trx_chan_desc[i].chan_nr == (chan_nr & RSL_CHAN_NR_MASK)) {
+                       struct l1sched_chan_state *l1cs = &l1ts->chan_state[i];
+
+                       l1cs->ho_rach_detect = active;
+               }
+       }
+
+       _sched_act_rach_det(lchan->ts->trx, tn, ss, active);
+
+       return 0;
+}
+
 int trx_sched_set_bcch_ccch(struct gsm_lchan *lchan, bool active)
 {
        struct l1sched_ts *l1ts = lchan->ts->priv;
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index ab66094..54f5bd2 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -417,10 +417,18 @@
                /* put data into scheduler's queue */
                return trx_sched_tch_req(trx, l1sap);
        case OSMO_PRIM(PRIM_MPH_INFO, PRIM_OP_REQUEST):
-               if (l1sap->u.info.type == PRIM_INFO_ACT_CIPH)
+               switch (l1sap->u.info.type) {
+               case PRIM_INFO_ACT_CIPH:
                        chan_nr = l1sap->u.info.u.ciph_req.chan_nr;
-               else /* u.act_req used by 
PRIM_INFO_{ACTIVATE,DEACTIVATE,MODIFY} */
+                       break;
+               case PRIM_INFO_ACT_UL_ACC:
+               case PRIM_INFO_DEACT_UL_ACC:
+                       chan_nr = l1sap->u.info.u.ulacc_req.chan_nr;
+                       break;
+               default:
+                       /* u.act_req used by 
PRIM_INFO_{ACTIVATE,DEACTIVATE,MODIFY} */
                        chan_nr = l1sap->u.info.u.act_req.chan_nr;
+               }
                lchan = get_lchan_by_chan_nr(trx, chan_nr);
                if (OSMO_UNLIKELY(lchan == NULL)) {
                        LOGP(DL1C, LOGL_ERROR,
@@ -437,6 +445,12 @@
                        if (l1sap->u.info.u.ciph_req.downlink)
                                l1if_set_ciphering(lchan, chan_nr, 1);
                        break;
+               case PRIM_INFO_ACT_UL_ACC:
+                       trx_sched_set_ul_access(lchan, chan_nr, true);
+                       break;
+               case PRIM_INFO_DEACT_UL_ACC:
+                       trx_sched_set_ul_access(lchan, chan_nr, false);
+                       break;
                case PRIM_INFO_ACTIVATE:
                        if ((chan_nr & 0xE0) == 0x80) {
                                LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Cannot 
activate"
@@ -458,8 +472,7 @@
                                           lchan->tch.amr_mr.mode[2].mode,
                                           lchan->tch.amr_mr.mode[3].mode,
                                           amr_get_initial_mode(lchan),
-                                          (lchan->ho.active == 
HANDOVER_ENABLED) ||
-                                           
rsl_chan_rt_is_asci(lchan->rsl_chan_rt));
+                                          (lchan->ho.active == 
HANDOVER_ENABLED));
                        /* set lchan active */
                        lchan_set_state(lchan, LCHAN_S_ACTIVE);
                        /* set initial ciphering */

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I9045437d52984b7abe00fbc815d7f83c62c0fb5a
Gerrit-Change-Number: 34886
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-CC: laforge <[email protected]>
Gerrit-MessageType: merged

Reply via email to