Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11552 )

Change subject: LCLS: add bts-loop variant
......................................................................

LCLS: add bts-loop variant

Add LCLS variant where the loop is closed on BTS level instead of
MGW. The main difference is the handling of connection-related
messages (we use IPA RSL instead of MGCP), the configuration and
correlation logic remains the same.

Change-Id: I7e8379f31037f2c48da69a01919701919a3066a2
Related: OS#3659
---
M include/osmocom/bsc/bsc_msc_data.h
M src/osmo-bsc/gsm_data.c
M src/osmo-bsc/osmo_bsc_lcls.c
M src/osmo-bsc/osmo_bsc_vty.c
4 files changed, 54 insertions(+), 9 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/bsc_msc_data.h 
b/include/osmocom/bsc/bsc_msc_data.h
index 32b161e..0c2094e 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -56,7 +56,7 @@
 enum bsc_lcls_mode {
        BSC_LCLS_MODE_DISABLED,
        BSC_LCLS_MODE_MGW_LOOP,
-       /* we may later introduce BTS_LOOP here: direct RTP between BTSs */
+       BSC_LCLS_MODE_BTS_LOOP,
 };

 extern const struct value_string bsc_lcls_mode_names[];
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index 774238b..6d39642 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -50,6 +50,7 @@
 const struct value_string bsc_lcls_mode_names[] = {
        { BSC_LCLS_MODE_DISABLED,       "disabled" },
        { BSC_LCLS_MODE_MGW_LOOP,       "mgw-loop" },
+       { BSC_LCLS_MODE_BTS_LOOP,       "bts-loop" },
        { 0, NULL }
 };

diff --git a/src/osmo-bsc/osmo_bsc_lcls.c b/src/osmo-bsc/osmo_bsc_lcls.c
index 81daaf0..cdd6557 100644
--- a/src/osmo-bsc/osmo_bsc_lcls.c
+++ b/src/osmo-bsc/osmo_bsc_lcls.c
@@ -22,6 +22,7 @@
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/gsm/gsm0808.h>
 #include <osmocom/core/msgb.h>
+#include <osmocom/bsc/abis_rsl.h>
 #include <osmocom/bsc/bsc_msc_data.h>
 #include <osmocom/bsc/debug.h>
 #include <osmocom/bsc/osmo_bsc.h>
@@ -227,6 +228,26 @@
        osmo_fsm_inst_dispatch(conn->lcls.fi, LCLS_EV_APPLY_CFG_CSC, NULL);
 }

+/* Redirect BTS's RTP traffic via RSL MDCX command:
+ * when enable == true, redirect to remote BTS's IP:port
+ * when enable == false, redirect back to the MGW's IP:port
+ */
+static inline void lcls_rsl(const struct gsm_subscriber_connection *conn, bool 
enable)
+{
+       const struct gsm_lchan *lchan = conn->lchan;
+       /* RSL_IE_IPAC_REMOTE_IP */
+       uint32_t ip = enable ? conn->lcls.other->lchan->abis_ip.bound_ip : 
lchan->abis_ip.connect_ip;
+       /* RSL_IE_IPAC_REMOTE_PORT */
+       uint16_t port = enable ? conn->lcls.other->lchan->abis_ip.bound_port : 
lchan->abis_ip.connect_port;
+
+       if (!conn->lcls.other) {
+              LOGPFSM(conn->lcls.fi, "%s LCLS: other conn is not 
available!\n", enable ? "enable" : "disable");
+               return;
+       }
+
+       abis_rsl_sendmsg(rsl_make_ipacc_mdcx(lchan, ip, port));
+}
+
 static inline bool lcls_check_toggle_allowed(const struct 
gsm_subscriber_connection *conn, bool enable)
 {
        if (conn->lcls.other &&
@@ -258,6 +279,7 @@

 static void lcls_break_local_switching(struct gsm_subscriber_connection *conn)
 {
+       struct mgcp_conn_peer mdcx_info;

        LOGPFSM(conn->lcls.fi, "=== HERE IS WHERE WE DISABLE LCLS(%s)\n",
                bsc_lcls_mode_name(conn->sccp.msc->lcls_mode));
@@ -265,12 +287,21 @@
        if (!lcls_check_toggle_allowed(conn, false))
                return;

-       if (conn->sccp.msc->lcls_mode == BSC_LCLS_MODE_MGW_LOOP) {
-               struct mgcp_conn_peer mdcx_info = (struct mgcp_conn_peer){
-                       .port = conn->user_plane.msc_assigned_rtp_port,
-               };
+       switch(conn->sccp.msc->lcls_mode) {
+       case BSC_LCLS_MODE_MGW_LOOP:
+               mdcx_info.port = conn->user_plane.msc_assigned_rtp_port;
                osmo_strlcpy(mdcx_info.addr, 
conn->user_plane.msc_assigned_rtp_addr, sizeof(mdcx_info.addr));
                lcls_mdcx(conn, &mdcx_info);
+               break;
+       case BSC_LCLS_MODE_BTS_LOOP:
+               lcls_rsl(conn, false);
+               break;
+       case BSC_LCLS_MODE_DISABLED:
+               LOGPFSM(conn->lcls.fi, "FIXME: attempt to break LCLS loop while 
LCLS is disabled?!\n");
+               break;
+       default:
+               LOGPFSM(conn->lcls.fi, "FIXME: unknown LCLS mode %s\n",
+                       bsc_lcls_mode_name(conn->sccp.msc->lcls_mode));
        }
 }

@@ -597,6 +628,7 @@
        struct gsm_subscriber_connection *conn = fi->priv;
        struct gsm_subscriber_connection *conn_other = conn->lcls.other;
        const struct mgcp_conn_peer *other_mgw_info;
+       struct mgcp_conn_peer mdcx_info;

        OSMO_ASSERT(conn_other);

@@ -618,11 +650,22 @@
                return;
        }

-       if (conn->sccp.msc->lcls_mode == BSC_LCLS_MODE_MGW_LOOP) {
-               struct mgcp_conn_peer mdcx_info = *other_mgw_info;
+       switch(conn->sccp.msc->lcls_mode) {
+       case BSC_LCLS_MODE_MGW_LOOP:
+               mdcx_info = *other_mgw_info;
                /* Make sure the request doesn't want to use the other side's 
endpoint string. */
                mdcx_info.endpoint[0] = 0;
                lcls_mdcx(conn, &mdcx_info);
+               break;
+       case BSC_LCLS_MODE_BTS_LOOP:
+               lcls_rsl(conn, true);
+               break;
+       case BSC_LCLS_MODE_DISABLED:
+               LOGPFSM(conn->lcls.fi, "FIXME: attempt to close LCLS loop while 
LCLS is disabled?!\n");
+               break;
+       default:
+               LOGPFSM(conn->lcls.fi, "FIXME: unknown LCLS mode %s\n",
+                       bsc_lcls_mode_name(conn->sccp.msc->lcls_mode));
        }
 }

diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index 14fd274..a32f580 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -646,10 +646,11 @@

 DEFUN(cfg_net_msc_lcls_mode,
       cfg_net_msc_lcls_mode_cmd,
-      "lcls-mode (disabled|mgw-loop)",
+      "lcls-mode (disabled|mgw-loop|bts-loop)",
       "Configure 3GPP LCLS (Local Call, Local Switch)\n"
       "Disable LCLS for all calls of this MSC\n"
-      "Enable LCLS with loopping traffic in MGW\n")
+      "Enable LCLS with looping traffic in MGW\n"
+      "Enable LCLS with looping traffic between BTS\n")
 {
        struct bsc_msc_data *data = bsc_msc_data(vty);
        data->lcls_mode = get_string_value(bsc_lcls_mode_names, argv[0]);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7e8379f31037f2c48da69a01919701919a3066a2
Gerrit-Change-Number: 11552
Gerrit-PatchSet: 9
Gerrit-Owner: Max <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <[email protected]>
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>

Reply via email to