From c997ceb750a67baef1a05590febe1c678b287d8f Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 30 May 2018 01:39:43 +0200 Subject: Add initial 3GPP LCLS support to OsmoBSC This code contains the following code: * receive/parse/interpret LCLS specific BSSMAP IEs and PDUs * osmo_fsm handling the various states and their transitions * call leg correlation (finding the other subscr_conn with same GCR) * communication between the two call-leg LCLS FSMs * detection of supported / unsupported LCLS configurations * display of GCR / LCLS information in "show conns" * switch the media streams locally using MDCX to the MGW Closes: OS#1602 Change-Id: I614fade62834def5cafc94c4d2578cd747a3f9f7 --- include/osmocom/bsc/Makefile.am | 1 + include/osmocom/bsc/bsc_subscr_conn_fsm.h | 5 ++++ include/osmocom/bsc/debug.h | 1 + include/osmocom/bsc/gsm_data.h | 12 ++++++++++ include/osmocom/bsc/osmo_bsc_lcls.h | 40 +++++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+) create mode 100644 include/osmocom/bsc/osmo_bsc_lcls.h (limited to 'include') diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index bae13f0cb..0987be9dd 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -47,4 +47,5 @@ noinst_HEADERS = \ vty.h \ bsc_api.h \ penalty_timers.h \ + osmo_bsc_lcls.h \ $(NULL) diff --git a/include/osmocom/bsc/bsc_subscr_conn_fsm.h b/include/osmocom/bsc/bsc_subscr_conn_fsm.h index 9498d9f2e..e8226f443 100644 --- a/include/osmocom/bsc/bsc_subscr_conn_fsm.h +++ b/include/osmocom/bsc/bsc_subscr_conn_fsm.h @@ -48,6 +48,8 @@ enum gscon_fsm_event { GSCON_EV_MGW_MDCX_RESP_BTS, /* CRCX response received (MSC) */ GSCON_EV_MGW_CRCX_RESP_MSC, + /* MDCX response received (MSC) - triggered by LCLS */ + GSCON_EV_MGW_MDCX_RESP_MSC, /* Internal handover request (intra-BSC handover) */ GSCON_EV_HO_START, @@ -57,6 +59,9 @@ enum gscon_fsm_event { GSCON_EV_HO_FAIL, /* Handover completed successfully (handover_logic.c) */ GSCON_EV_HO_COMPL, + + /* LCLS child FSM has terminated due to hard failure */ + GSCON_EV_LCLS_FAIL, }; struct gsm_subscriber_connection; diff --git a/include/osmocom/bsc/debug.h b/include/osmocom/bsc/debug.h index 37f102c7a..006b91873 100644 --- a/include/osmocom/bsc/debug.h +++ b/include/osmocom/bsc/debug.h @@ -25,5 +25,6 @@ enum { DCTRL, DFILTER, DPCU, + DLCLS, Debug_LastEntry, }; diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 1cf79a53d..b1fceb3ea 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -188,6 +188,18 @@ struct gsm_subscriber_connection { enum gsm48_chan_mode chan_mode; } user_plane; + + /* LCLS (local call, local switch) related state */ + struct { + uint8_t global_call_ref[15]; + uint8_t global_call_ref_len; /* length of global_call_ref */ + uint8_t config; /* TS 48.008 3.2.2.116 */ + uint8_t control;/* TS 48.008 3.2.2.117 */ + /* LCLS FSM */ + struct osmo_fsm_inst *fi; + /* pointer to "other" connection, if Call Leg Relocation was successful */ + struct gsm_subscriber_connection *other; + } lcls; }; diff --git a/include/osmocom/bsc/osmo_bsc_lcls.h b/include/osmocom/bsc/osmo_bsc_lcls.h new file mode 100644 index 000000000..2e6023404 --- /dev/null +++ b/include/osmocom/bsc/osmo_bsc_lcls.h @@ -0,0 +1,40 @@ +#pragma once +#include + +enum lcls_fsm_state { + ST_NO_LCLS, + ST_NOT_YET_LS, + ST_NOT_POSSIBLE_LS, + ST_NO_LONGER_LS, + ST_REQ_LCLS_NOT_SUPP, + ST_LOCALLY_SWITCHED, + /* locally switched; received remote break; wait for "local" break */ + ST_LOCALLY_SWITCHED_WAIT_BREAK, + /* locally switched; received break; wait for "other" break */ + ST_LOCALLY_SWITCHED_WAIT_OTHER_BREAK, +}; + +enum lcls_event { + /* update LCLS config/control based on some BSSMAP signaling */ + LCLS_EV_UPDATE_CFG_CSC, + /* apply LCLS config/control */ + LCLS_EV_APPLY_CFG_CSC, + /* we have been identified as the correlation peer of another conn */ + LCLS_EV_CORRELATED, + /* "other" LCLS connection has enabled local switching */ + LCLS_EV_OTHER_ENABLED, + /* "other" LCLS connection is breaking local switch */ + LCLS_EV_OTHER_BREAK, + /* "other" LCLS connection is dying */ + LCLS_EV_OTHER_DEAD, +}; + +enum gsm0808_lcls_status lcls_get_status(struct gsm_subscriber_connection *conn); + +void lcls_update_config(struct gsm_subscriber_connection *conn, + const uint8_t *config, const uint8_t *control); + +void lcls_apply_config(struct gsm_subscriber_connection *conn); + +extern struct osmo_fsm lcls_fsm; + -- cgit v1.2.3