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

Change subject: ASCI: Control uplink access bursts detection of physical 
interface
......................................................................

ASCI: Control uplink access bursts detection of physical interface

An MPH-INFO message is used to turn detection of uplink access bursts on
or off. Whenever the uplink on a voice group channel is free, the uplink
access burst detection is turned on. When the uplink access is granted
to a talker or when the calling subscriber has been assigned to the
channel, the uplink access burst detection is turned off until the
uplink becomes free again.

Related: OS#4851
Depends: libosmocore.git Ibd6a1d468a70126a8f67e944fcb916969cc3c36b
Change-Id: I92d6773a3a463eb747143c85aa149e54c1fda122
---
M include/osmo-bts/asci.h
M include/osmo-bts/l1sap.h
M src/common/asci.c
M src/common/l1sap.c
M src/common/lchan.c
M src/common/rsl.c
6 files changed, 80 insertions(+), 11 deletions(-)

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




diff --git a/include/osmo-bts/asci.h b/include/osmo-bts/asci.h
index 59b48b2..9980296 100644
--- a/include/osmo-bts/asci.h
+++ b/include/osmo-bts/asci.h
@@ -11,11 +11,13 @@

 void vgcs_rach(struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay, 
uint32_t fn);

+void vgcs_lchan_activate(struct gsm_lchan *lchan);
+
 void vgcs_lchan_react(struct gsm_lchan *lchan);

 void vgcs_talker_frame(struct gsm_lchan *lchan);

-void vgcs_talker_reset(struct gsm_lchan *lchan);
+void vgcs_talker_reset(struct gsm_lchan *lchan, bool ul_access);

 void vgcs_listener_reset(struct gsm_lchan *lchan);

diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h
index 353fc90..34259bd 100644
--- a/include/osmo-bts/l1sap.h
+++ b/include/osmo-bts/l1sap.h
@@ -102,6 +102,7 @@
 int l1sap_chan_rel(struct gsm_bts_trx *trx, uint8_t chan_nr);
 int l1sap_chan_deact_sacch(struct gsm_bts_trx *trx, uint8_t chan_nr);
 int l1sap_chan_modify(struct gsm_bts_trx *trx, uint8_t chan_nr);
+int l1sap_uplink_access(struct gsm_lchan *lchan, bool active);

 enum l1sap_common_sapi {
        L1SAP_COMMON_SAPI_UNKNOWN,
diff --git a/src/common/asci.c b/src/common/asci.c
index ccaacd8..88d40e7 100644
--- a/src/common/asci.c
+++ b/src/common/asci.c
@@ -126,9 +126,9 @@
 
                /* Stop RACH detection, wait for valid frame */
                lchan->asci.talker_active = VGCS_TALKER_WAIT_FRAME;
-               if (l1sap_chan_modify(lchan->ts->trx, gsm_lchan2chan_nr(lchan)) 
!= 0) {
-                       LOGPLCHAN(lchan, DASCI, LOGL_ERROR, "failed to modify 
channel after TALKER DET\n");
-                       rsl_tx_conn_fail(lchan, RSL_ERR_TALKER_ACC_FAIL);
+               if (l1sap_uplink_access(lchan, false) != 0) {
+                       LOGPLCHAN(lchan, DASCI, LOGL_ERROR, "Failed to 
deactivate uplink access after TALKER DET.\n");
+                       rsl_tx_conn_fail(lchan, RSL_ERR_EQUIPMENT_FAIL);
                        lchan->asci.talker_active = VGCS_TALKER_NONE;
                        return;
                }
@@ -151,11 +151,25 @@
        }
 }

+/* Received channel activation. */
+void vgcs_lchan_activate(struct gsm_lchan *lchan)
+{
+       LOGPLCHAN(lchan, DASCI, LOGL_INFO, "Channel is activated.\n");
+       if (l1sap_uplink_access(lchan, true) != 0) {
+               LOGPLCHAN(lchan, DASCI, LOGL_ERROR, "Failed to activate uplink 
access after channel activation.\n");
+               rsl_tx_conn_fail(lchan, RSL_ERR_EQUIPMENT_FAIL);
+       }
+}
+
 /* Received channel reactivation. (for assignment) */
 void vgcs_lchan_react(struct gsm_lchan *lchan)
 {
        LOGPLCHAN(lchan, DASCI, LOGL_INFO, "Channel is activated for 
assignment.\n");
        lchan->asci.talker_active = VGCS_TALKER_WAIT_FRAME;
+       if (l1sap_uplink_access(lchan, false) != 0) {
+               LOGPLCHAN(lchan, DASCI, LOGL_ERROR, "Failed to deactivate 
uplink access for assignment.\n");
+               rsl_tx_conn_fail(lchan, RSL_ERR_EQUIPMENT_FAIL);
+       }
        radio_link_timeout_reset(lchan);
 }

@@ -169,7 +183,7 @@
 }

 /* Release VGCS Talker state. */
-void vgcs_talker_reset(struct gsm_lchan *lchan)
+void vgcs_talker_reset(struct gsm_lchan *lchan, bool ul_access)
 {
        if (lchan->asci.talker_active == VGCS_TALKER_NONE)
                return;
@@ -179,8 +193,15 @@
        /* Stop T3115 */
        osmo_timer_del(&lchan->asci.t3115);

-       /* Talker detection done */
+       /* Talker released. */
        lchan->asci.talker_active = VGCS_TALKER_NONE;
+       if (ul_access) {
+               if (l1sap_uplink_access(lchan, true) != 0) {
+                       LOGPLCHAN(lchan, DASCI, LOGL_ERROR,
+                                 "Failed to activate uplink access after 
uplink became free.\n");
+                       rsl_tx_conn_fail(lchan, RSL_ERR_EQUIPMENT_FAIL);
+               }
+       }
 }

 /* Release VGCS Listener state. */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 844fdad..c599726 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2444,3 +2444,26 @@
 
        return l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_MODIFY, 0);
 }
+
+int l1sap_uplink_access(struct gsm_lchan *lchan, bool active)
+{
+       uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+       struct osmo_phsap_prim l1sap;
+
+       if (lchan->state != LCHAN_S_ACTIVE && 
!rsl_chan_rt_is_asci(lchan->rsl_chan_rt)) {
+               LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Channel %s is not an active 
ASCI type channel.\n",
+                         rsl_chan_nr_str(chan_nr));
+               return -EINVAL;
+       }
+
+       LOGPLCHAN(lchan, DL1C, LOGL_INFO, "%s uplink access detection on 
channel %s\n",
+                 (active) ? "Activating" : "Deactivating", 
rsl_chan_nr_str(chan_nr));
+
+
+       memset(&l1sap, 0, sizeof(l1sap));
+       osmo_prim_init(&l1sap.oph, SAP_GSM_PH, PRIM_MPH_INFO, PRIM_OP_REQUEST, 
NULL);
+       l1sap.u.info.type = (active) ? PRIM_INFO_ACT_UL_ACC : 
PRIM_INFO_DEACT_UL_ACC;
+       l1sap.u.info.u.ulacc_req.chan_nr = chan_nr;
+
+       return l1sap_down(lchan->ts->trx, &l1sap);
+}
diff --git a/src/common/lchan.c b/src/common/lchan.c
index bd50349..6178200 100644
--- a/src/common/lchan.c
+++ b/src/common/lchan.c
@@ -219,7 +219,7 @@

        /* release handover, listener and talker states */
        handover_reset(lchan);
-       vgcs_talker_reset(lchan);
+       vgcs_talker_reset(lchan, false);
        vgcs_listener_reset(lchan);
        vgcs_uplink_free_reset(lchan);

diff --git a/src/common/rsl.c b/src/common/rsl.c
index 09723be..deeb255 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -2207,8 +2207,12 @@
                lchan->top_acch_active = false;

        /* set ASCI channel into right state */
-       if (reactivation && rsl_chan_rt_is_asci(lchan->rsl_chan_rt))
-               vgcs_lchan_react(lchan);
+       if (rsl_chan_rt_is_asci(lchan->rsl_chan_rt)) {
+               if (reactivation)
+                       vgcs_lchan_react(lchan);
+               else
+                       vgcs_lchan_activate(lchan);
+       }

        /* on reactivation, the channel is already activated */
        if (reactivation) {
@@ -3618,7 +3622,7 @@

        /* VGCS Uplink is released by MSC using REL-REQ. */
        if (rh->c.msg_type == RSL_MT_REL_REQ)
-               vgcs_talker_reset(lchan);
+               vgcs_talker_reset(lchan, true);

        LOGPLCHAN(lchan, DRLL, LOGL_DEBUG, "Rx RLL %s Abis -> LAPDm\n", 
rsl_msg_name(rh->c.msg_type));

@@ -3840,7 +3844,7 @@

                /* REL_IND handling */
                if (rh->msg_type == RSL_MT_REL_IND && lchan_is_tch(lchan)) {
-                       vgcs_talker_reset(lchan);
+                       vgcs_talker_reset(lchan, true);
                        LOGPLCHAN(lchan, DRSL, LOGL_INFO,
                                  "Scheduling %s to L3 in next associated 
TCH-RTS.ind\n",
                                  rsl_msg_name(rh->msg_type));

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/34889?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: I92d6773a3a463eb747143c85aa149e54c1fda122
Gerrit-Change-Number: 34889
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andr...@eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: jolly <andr...@eversberg.eu>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-MessageType: merged

Reply via email to