[PATCH 19/33] Move chan act/rel/modify from bts_model to PH-/MPH-/TCH-SAP interface

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Harald Welte laforge at gnumonks.org
Wed Aug 27 21:54:38 UTC 2014


From: Andreas Eversberg <jolly at eversberg.eu>

This part replaces channel activation/deactivation/modification routines
by MPH_INFO messages.
---
 include/osmo-bts/bts_model.h |   6 --
 include/osmo-bts/l1sap.h     |   2 +-
 src/common/handover.c        |   3 +-
 src/common/l1sap.c           | 145 +++++++++++++++++++++++++++++++++++++++++++
 src/common/pcu_sock.c        |   8 +--
 src/common/rsl.c             |  25 ++++----
 src/osmo-bts-sysmo/l1_if.c   |  41 ++++++++++++
 src/osmo-bts-sysmo/l1_if.h   |   7 +++
 src/osmo-bts-sysmo/oml.c     |  60 ++++++++----------
 9 files changed, 240 insertions(+), 57 deletions(-)

diff --git a/include/osmo-bts/bts_model.h b/include/osmo-bts/bts_model.h
index 64161d2..a219d5b 100644
--- a/include/osmo-bts/bts_model.h
+++ b/include/osmo-bts/bts_model.h
@@ -25,12 +25,6 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
 int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo,
 			    void *obj, uint8_t adm_state);
 
-int bts_model_rsl_chan_act(struct gsm_lchan *lchan, struct tlv_parsed *tp);
-int bts_model_rsl_chan_rel(struct gsm_lchan *lchan);
-int bts_model_rsl_chan_mod(struct gsm_lchan *lchan);
-int bts_model_rsl_deact_sacch(struct gsm_lchan *lchan);
-int bts_model_rsl_mode_modify(struct gsm_lchan *lchan);
-
 int bts_model_trx_deact_rf(struct gsm_bts_trx *trx);
 int bts_model_trx_close(struct gsm_bts_trx *trx);
 
diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h
index a1dc303..dee430f 100644
--- a/include/osmo-bts/l1sap.h
+++ b/include/osmo-bts/l1sap.h
@@ -56,7 +56,7 @@ void l1sap_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl,
 	unsigned int rtp_pl_len);
 
 /* channel control */
-int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr);
+int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed *tp);
 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);
diff --git a/src/common/handover.c b/src/common/handover.c
index 26a3f51..03433ea 100644
--- a/src/common/handover.c
+++ b/src/common/handover.c
@@ -33,6 +33,7 @@
 #include <osmo-bts/rsl.h>
 #include <osmo-bts/logging.h>
 #include <osmo-bts/handover.h>
+#include <osmo-bts/l1sap.h>
 
 /* Transmit a handover related PHYS INFO on given lchan */
 static int ho_tx_phys_info(struct gsm_lchan *lchan)
@@ -114,7 +115,7 @@ void handover_rach(struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay)
 
 	/* Stop handover detection, wait for valid frame */
 	lchan->ho.active = HANDOVER_WAIT_FRAME;
-	if (bts_model_rsl_chan_mod(lchan) != 0) {
+	if (l1sap_chan_modify(lchan->ts->trx, gsm_lchan2chan_nr(lchan)) != 0) {
 		LOGP(DHO, LOGL_ERROR,
 			"%s failed to modify channel after handover\n",
 			gsm_lchan_name(lchan));
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 9bbbdf3..e9d815c 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -126,6 +126,67 @@ static int l1sap_mph_info_ind(struct gsm_bts_trx *trx,
 	return rc;
 }
 
+/* activation confirm received from bts model */
+static int l1sap_info_act_cnf(struct gsm_bts_trx *trx,
+	struct osmo_phsap_prim *l1sap,
+	struct info_act_cnf_param *info_act_cnf)
+{
+	struct gsm_lchan *lchan;
+
+	LOGP(DL1P, LOGL_INFO, "activate confirm chan_nr=%02x trx=%d\n",
+		info_act_cnf->chan_nr, trx->nr);
+
+	lchan = &trx->ts[L1SAP_CHAN2TS(info_act_cnf->chan_nr)]
+				.lchan[l1sap_chan2ss(info_act_cnf->chan_nr)];
+
+	if (info_act_cnf->cause)
+		rsl_tx_chan_act_nack(lchan, info_act_cnf->cause);
+	else
+		rsl_tx_chan_act_ack(lchan);
+
+	return 0;
+}
+
+/* activation confirm received from bts model */
+static int l1sap_info_rel_cnf(struct gsm_bts_trx *trx,
+	struct osmo_phsap_prim *l1sap,
+	struct info_act_cnf_param *info_act_cnf)
+{
+	struct gsm_lchan *lchan;
+
+	LOGP(DL1P, LOGL_INFO, "deactivate confirm chan_nr=%02x trx=%d\n",
+		info_act_cnf->chan_nr, trx->nr);
+
+	lchan = &trx->ts[L1SAP_CHAN2TS(info_act_cnf->chan_nr)]
+				.lchan[l1sap_chan2ss(info_act_cnf->chan_nr)];
+
+	rsl_tx_rf_rel_ack(lchan);
+
+	return 0;
+}
+
+/* any L1 MPH_INFO confirm prim recevied from bts model */
+static int l1sap_mph_info_cnf(struct gsm_bts_trx *trx,
+	 struct osmo_phsap_prim *l1sap, struct mph_info_param *info)
+{
+	int rc = 0;
+
+	switch (info->type) {
+	case PRIM_INFO_ACTIVATE:
+		rc = l1sap_info_act_cnf(trx, l1sap, &info->u.act_cnf);
+		break;
+	case PRIM_INFO_DEACTIVATE:
+		rc = l1sap_info_rel_cnf(trx, l1sap, &info->u.act_cnf);
+		break;
+	default:
+		LOGP(DL1P, LOGL_NOTICE, "unknown MPH_INFO cnf type %d\n",
+			info->type);
+		break;
+	}
+
+	return rc;
+}
+
 /* PH-RTS-IND prim recevied from bts model */
 static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
 	struct osmo_phsap_prim *l1sap, struct ph_data_param *rts_ind)
@@ -322,6 +383,9 @@ int l1sap_up(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
 	case OSMO_PRIM(PRIM_MPH_INFO, PRIM_OP_INDICATION):
 		rc = l1sap_mph_info_ind(trx, l1sap, &l1sap->u.info);
 		break;
+	case OSMO_PRIM(PRIM_MPH_INFO, PRIM_OP_CONFIRM):
+		rc = l1sap_mph_info_cnf(trx, l1sap, &l1sap->u.info);
+		break;
 	case OSMO_PRIM(PRIM_PH_RTS, PRIM_OP_INDICATION):
 		rc = l1sap_ph_rts_ind(trx, l1sap, &l1sap->u.data);
 		break;
@@ -376,3 +440,84 @@ int l1sap_pdch_req(struct gsm_bts_trx_ts *ts, int is_ptcch, uint32_t fn,
 
 	return l1sap_down(ts->trx, l1sap);
 }
+
+static int l1sap_chan_act_dact_modify(struct gsm_bts_trx *trx, uint8_t chan_nr,
+		enum osmo_mph_info_type type, uint8_t sacch_only)
+{
+	struct osmo_phsap_prim l1sap;
+
+	memset(&l1sap, 0, sizeof(l1sap));
+	osmo_prim_init(&l1sap.oph, SAP_GSM_PH, PRIM_MPH_INFO, PRIM_OP_REQUEST,
+		NULL);
+	l1sap.u.info.type = type;
+	l1sap.u.info.u.act_req.chan_nr = chan_nr;
+	l1sap.u.info.u.act_req.sacch_only = sacch_only;
+
+	return l1sap_down(trx, &l1sap);
+}
+
+int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed *tp)
+{
+	struct gsm_bts_role_bts *btsb = trx->bts->role;
+	struct gsm_lchan *lchan = &trx->ts[L1SAP_CHAN2TS(chan_nr)]
+				.lchan[l1sap_chan2ss(chan_nr)];
+	struct gsm48_chan_desc *cd;
+	int rc;
+
+	LOGP(DL1P, LOGL_INFO, "activating channel chan_nr=%02x trx=%d\n",
+		chan_nr, trx->nr);
+
+	if (tp && TLVP_PRESENT(tp, GSM48_IE_CHANDESC_2) &&
+	    TLVP_LEN(tp, GSM48_IE_CHANDESC_2) >= sizeof(*cd)) {
+		cd = (struct gsm48_chan_desc *)
+		TLVP_VAL(tp, GSM48_IE_CHANDESC_2);
+
+		/* our L1 only supports one global TSC for all channels
+		 * one one TRX, so we need to make sure not to activate
+		 * channels with a different TSC!! */
+		if (cd->h0.tsc != (lchan->ts->trx->bts->bsic & 7)) {
+			LOGP(DRSL, LOGL_ERROR, "lchan TSC %u != BSIC-TSC %u\n",
+				cd->h0.tsc, lchan->ts->trx->bts->bsic & 7);
+			return -RSL_ERR_SERV_OPT_UNIMPL;
+		}
+	}
+
+	lchan->sacch_deact = 0;
+	lchan->s = btsb->radio_link_timeout;
+
+	rc = l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_ACTIVATE, 0);
+	if (rc)
+		return -RSL_ERR_EQUIPMENT_FAIL;
+	return 0;
+}
+
+int l1sap_chan_rel(struct gsm_bts_trx *trx, uint8_t chan_nr)
+{
+	LOGP(DL1P, LOGL_INFO, "deactivating channel chan_nr=%02x trx=%d\n",
+		chan_nr, trx->nr);
+
+	return l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_DEACTIVATE,
+		0);
+}
+
+int l1sap_chan_deact_sacch(struct gsm_bts_trx *trx, uint8_t chan_nr)
+{
+	struct gsm_lchan *lchan = &trx->ts[L1SAP_CHAN2TS(chan_nr)]
+				.lchan[l1sap_chan2ss(chan_nr)];
+
+	LOGP(DL1P, LOGL_INFO, "deactivating sacch chan_nr=%02x trx=%d\n",
+		chan_nr, trx->nr);
+
+	lchan->sacch_deact = 1;
+
+	return l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_DEACTIVATE,
+		1);
+}
+
+int l1sap_chan_modify(struct gsm_bts_trx *trx, uint8_t chan_nr)
+{
+	LOGP(DL1P, LOGL_INFO, "modifying channel chan_nr=%02x trx=%d\n",
+		chan_nr, trx->nr);
+
+	return l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_MODIFY, 0);
+}
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 515993e..a4ca25f 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -39,7 +39,6 @@
 #include <osmo-bts/bts.h>
 #include <osmo-bts/rsl.h>
 #include <osmo-bts/signal.h>
-#include <osmo-bts/bts_model.h>
 #include <osmo-bts/l1sap.h>
 
 uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx);
@@ -543,9 +542,9 @@ static int pcu_rx_act_req(struct gsm_bts *bts,
 		return -EINVAL;
 	}
 	if (act_req->activate)
-		bts_model_rsl_chan_act(lchan, NULL);
+		l1sap_chan_act(trx, gsm_lchan2chan_nr(lchan), NULL);
 	else
-		bts_model_rsl_chan_rel(lchan);
+		l1sap_chan_rel(trx, gsm_lchan2chan_nr(lchan));
 
 	return 0;
 }
@@ -650,7 +649,8 @@ static void pcu_sock_close(struct pcu_sock_state *state)
 			if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED
 			 && ts->pchan == GSM_PCHAN_PDCH) {
 				ts->lchan->rel_act_kind = LCHAN_REL_ACT_PCU;
-				bts_model_rsl_chan_rel(ts->lchan);
+				l1sap_chan_rel(trx,
+					gsm_lchan2chan_nr(ts->lchan));
 			}
 		}
 	}
diff --git a/src/common/rsl.c b/src/common/rsl.c
index b2e5622..1a52c6e 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -46,6 +46,7 @@
 #include <osmo-bts/measurement.h>
 #include <osmo-bts/pcu_if.h>
 #include <osmo-bts/handover.h>
+#include <osmo-bts/l1sap.h>
 
 //#define FAKE_CIPH_MODE_COMPL
 
@@ -826,7 +827,7 @@ static int rsl_rx_chan_activ(struct msgb *msg)
 
 	/* actually activate the channel in the BTS */
 	lchan->rel_act_kind = LCHAN_REL_ACT_RSL;
-	rc = bts_model_rsl_chan_act(msg->lchan, &tp);
+	rc = l1sap_chan_act(lchan->ts->trx, dch->chan_nr, &tp);
 	if (rc < 0)
 		return rsl_tx_chan_act_nack(lchan, -rc);
 
@@ -834,10 +835,8 @@ static int rsl_rx_chan_activ(struct msgb *msg)
 }
 
 /* 8.4.14 RF CHANnel RELease is received */
-static int rsl_rx_rf_chan_rel(struct gsm_lchan *lchan)
+static int rsl_rx_rf_chan_rel(struct gsm_lchan *lchan, uint8_t chan_nr)
 {
-	int rc;
-
 	if (lchan->abis_ip.rtp_socket) {
 		rsl_tx_ipac_dlcx_ind(lchan, RSL_ERR_NORMAL_UNSPEC);
 		osmo_rtp_socket_free(lchan->abis_ip.rtp_socket);
@@ -849,9 +848,11 @@ static int rsl_rx_rf_chan_rel(struct gsm_lchan *lchan)
 	handover_reset(lchan);
 
 	lchan->rel_act_kind = LCHAN_REL_ACT_RSL;
-	rc = bts_model_rsl_chan_rel(lchan);
+	l1sap_chan_rel(lchan->ts->trx, chan_nr);
+
+	lapdm_channel_exit(&lchan->lapdm_ch);
 
-	return rc;
+	return 0;
 }
 
 #ifdef FAKE_CIPH_MODE_COMPL
@@ -1034,10 +1035,10 @@ static int rsl_tx_mode_modif_ack(struct gsm_lchan *lchan)
 /* 8.4.9 MODE MODIFY */
 static int rsl_rx_mode_modif(struct msgb *msg)
 {
+	struct abis_rsl_dchan_hdr *dch = msgb_l2(msg);
 	struct gsm_lchan *lchan = msg->lchan;
 	struct rsl_ie_chan_mode *cm;
 	struct tlv_parsed tp;
-	int rc;
 
 	rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
 
@@ -1078,12 +1079,12 @@ static int rsl_rx_mode_modif(struct msgb *msg)
 	/* 9.3.53 MultiRate Control */
 	/* 9.3.54 Supported Codec Types */
 
-	rc = bts_model_rsl_mode_modify(msg->lchan);
+	l1sap_chan_modify(lchan->ts->trx, dch->chan_nr);
 
 	/* FIXME: delay this until L1 says OK? */
-	rsl_tx_mode_modif_ack(msg->lchan);
+	rsl_tx_mode_modif_ack(lchan);
 
-	return rc;
+	return 0;
 }
 
 /* 8.4.20 SACCH INFO MODify */
@@ -1734,13 +1735,13 @@ static int rsl_rx_dchan(struct gsm_bts_trx *trx, struct msgb *msg)
 		ret = rsl_rx_chan_activ(msg);
 		break;
 	case RSL_MT_RF_CHAN_REL:
-		ret = rsl_rx_rf_chan_rel(msg->lchan);
+		ret = rsl_rx_rf_chan_rel(msg->lchan, dch->chan_nr);
 		break;
 	case RSL_MT_SACCH_INFO_MODIFY:
 		ret = rsl_rx_sacch_inf_mod(msg);
 		break;
 	case RSL_MT_DEACTIVATE_SACCH:
-		ret = bts_model_rsl_deact_sacch(msg->lchan);
+		ret = l1sap_chan_deact_sacch(trx, dch->chan_nr);
 		break;
 	case RSL_MT_ENCR_CMD:
 		ret = rsl_rx_encr_cmd(msg);
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 59a30f2..4a398ea 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -532,6 +532,44 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg,
 	return 0;
 }
 
+static int mph_info_req(struct gsm_bts_trx *trx, struct msgb *msg,
+		        struct osmo_phsap_prim *l1sap)
+{
+	uint8_t u8Tn, ss;
+	uint8_t chan_nr;
+	struct gsm_lchan *lchan;
+	int rc = 0;
+
+	switch (l1sap->u.info.type) {
+	case PRIM_INFO_ACTIVATE:
+	case PRIM_INFO_DEACTIVATE:
+	case PRIM_INFO_MODIFY:
+		chan_nr = l1sap->u.info.u.act_req.chan_nr;
+		u8Tn = L1SAP_CHAN2TS(chan_nr);
+		ss = l1sap_chan2ss(chan_nr);
+		lchan = &trx->ts[u8Tn].lchan[ss];
+		if (l1sap->u.info.type == PRIM_INFO_ACTIVATE)
+			l1if_rsl_chan_act(lchan);
+		else if (l1sap->u.info.type == PRIM_INFO_MODIFY) {
+			if (lchan->ho.active == HANDOVER_WAIT_FRAME)
+				l1if_rsl_chan_mod(lchan);
+			else
+				l1if_rsl_mode_modify(lchan);
+		} else if (l1sap->u.info.u.act_req.sacch_only)
+			l1if_rsl_deact_sacch(lchan);
+		else
+			l1if_rsl_chan_rel(lchan);
+		msgb_free(msg);
+		break;
+	default:
+		LOGP(DL1C, LOGL_NOTICE, "unknown MPH-INFO.req %d\n",
+			l1sap->u.info.type);
+		rc = -EINVAL;
+	}
+
+	return rc;
+}
+
 /* primitive from common part */
 int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
 {
@@ -542,6 +580,9 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
 	case OSMO_PRIM(PRIM_PH_DATA, PRIM_OP_REQUEST):
 		rc = ph_data_req(trx, msg, l1sap);
 		break;
+	case OSMO_PRIM(PRIM_MPH_INFO, PRIM_OP_REQUEST):
+		rc = mph_info_req(trx, msg, l1sap);
+		break;
 	default:
 		LOGP(DL1C, LOGL_NOTICE, "unknown prim %d op %d\n",
 			l1sap->oph.primitive, l1sap->oph.operation);
diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h
index 5efa25b..b0a624d 100644
--- a/src/osmo-bts-sysmo/l1_if.h
+++ b/src/osmo-bts-sysmo/l1_if.h
@@ -119,6 +119,13 @@ int l1if_set_ciphering(struct femtol1_hdl *fl1h,
 			  struct gsm_lchan *lchan,
 			  int dir_downlink);
 
+/* channel control */
+int l1if_rsl_chan_act(struct gsm_lchan *lchan);
+int l1if_rsl_chan_rel(struct gsm_lchan *lchan);
+int l1if_rsl_chan_mod(struct gsm_lchan *lchan);
+int l1if_rsl_deact_sacch(struct gsm_lchan *lchan);
+int l1if_rsl_mode_modify(struct gsm_lchan *lchan);
+
 /* calibration loading */
 int calib_load(struct femtol1_hdl *fl1h);
 
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 853cb43..f490195 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -37,11 +37,27 @@
 #include <osmo-bts/bts.h>
 #include <osmo-bts/bts_model.h>
 #include <osmo-bts/handover.h>
+#include <osmo-bts/l1sap.h>
 
 #include "l1_if.h"
 #include "femtobts.h"
 #include "utils.h"
 
+static int mph_info_chan_confirm(struct gsm_lchan *lchan,
+			enum osmo_mph_info_type type, uint8_t cause)
+{
+	struct osmo_phsap_prim l1sap;
+
+	memset(&l1sap, 0, sizeof(l1sap));
+	osmo_prim_init(&l1sap.oph, SAP_GSM_PH, PRIM_MPH_INFO, PRIM_OP_CONFIRM,
+		NULL);
+	l1sap.u.info.type = type;
+	l1sap.u.info.u.act_cnf.chan_nr = gsm_lchan2chan_nr(lchan);
+	l1sap.u.info.u.act_cnf.cause = cause;
+
+	return l1sap_up(lchan->ts->trx, &l1sap);
+}
+
 enum sapi_cmd_type {
 	SAPI_CMD_ACTIVATE,
 	SAPI_CMD_CONFIG_CIPHERING,
@@ -950,7 +966,7 @@ static int sapi_activate_cb(struct gsm_lchan *lchan, int status)
 			gsm_lchan_name(lchan), status);
 		lchan_set_state(lchan, LCHAN_S_BROKEN);
 		sapi_clear_queue(&lchan->sapi_cmds);
-		rsl_tx_chan_act_nack(lchan, RSL_ERR_PROCESSOR_OVERLOAD);
+		mph_info_chan_confirm(lchan, PRIM_INFO_ACTIVATE, RSL_ERR_PROCESSOR_OVERLOAD);
 		return -1;
 	}
 
@@ -961,7 +977,7 @@ static int sapi_activate_cb(struct gsm_lchan *lchan, int status)
 		return 0;
 
 	lchan_set_state(lchan, LCHAN_S_ACTIVE);
-	rsl_tx_chan_act_ack(lchan);
+	mph_info_chan_confirm(lchan, PRIM_INFO_ACTIVATE, 0);
 
 	/* set the initial ciphering parameters for both directions */
 	l1if_set_ciphering(fl1h, lchan, 0);
@@ -983,7 +999,6 @@ static void enqueue_sapi_act_cmd(struct gsm_lchan *lchan, int sapi, int dir)
 
 int lchan_activate(struct gsm_lchan *lchan)
 {
-	struct gsm_bts_role_bts *btsb = lchan->ts->trx->bts->role;
 	struct femtol1_hdl *fl1h = trx_femtol1_hdl(lchan->ts->trx);
 	const struct lchan_sapis *s4l = &sapis_for_lchan[lchan->type];
 	unsigned int i;
@@ -1017,8 +1032,6 @@ int lchan_activate(struct gsm_lchan *lchan)
 #warning "FIXME: Should this be in sapi_activate_cb?"
 	lchan_init_lapdm(lchan);
 
-	lchan->s = btsb->radio_link_timeout;
-
 	return 0;
 }
 
@@ -1279,7 +1292,7 @@ int l1if_set_ciphering(struct femtol1_hdl *fl1h,
 	return 0;
 }
 
-int bts_model_rsl_mode_modify(struct gsm_lchan *lchan)
+int l1if_rsl_mode_modify(struct gsm_lchan *lchan)
 {
 	if (lchan->state != LCHAN_S_ACTIVE)
 		return -1;
@@ -1389,7 +1402,7 @@ static int sapi_deactivate_cb(struct gsm_lchan *lchan, int status)
 			gsm_lchan_name(lchan));
 		lchan_set_state(lchan, LCHAN_S_BROKEN);
 		sapi_clear_queue(&lchan->sapi_cmds);
-		rsl_tx_rf_rel_ack(lchan);
+		mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0);
 		return -1;
 	}
 
@@ -1401,7 +1414,7 @@ static int sapi_deactivate_cb(struct gsm_lchan *lchan, int status)
 		return 0;
 
 	lchan_set_state(lchan, LCHAN_S_NONE);
-	rsl_tx_rf_rel_ack(lchan);
+	mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0);
 	return 0;
 }
 
@@ -1476,7 +1489,7 @@ static int lchan_deactivate_sapis(struct gsm_lchan *lchan)
 		LOGP(DL1C, LOGL_ERROR, "%s all SAPIs already released?\n",
 			gsm_lchan_name(lchan));
 		lchan_set_state(lchan, LCHAN_S_BROKEN);
-		rsl_tx_rf_rel_ack(lchan);
+		mph_info_chan_confirm(lchan, PRIM_INFO_DEACTIVATE, 0);
 	}
 
 	return res;
@@ -1633,30 +1646,11 @@ int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo,
 		return oml_mo_statechg_nack(mo, NM_NACK_REQ_NOT_GRANT);
 
 }
-int bts_model_rsl_chan_act(struct gsm_lchan *lchan, struct tlv_parsed *tp)
+
+int l1if_rsl_chan_act(struct gsm_lchan *lchan)
 {
 	//uint8_t mode = *TLVP_VAL(tp, RSL_IE_CHAN_MODE);
 	//uint8_t type = *TLVP_VAL(tp, RSL_IE_ACT_TYPE);
-	struct gsm48_chan_desc *cd;
-
-	/* osmo-pcu calls this without a valid 'tp' parameter, so we
-	 * need to make sure we don't crash here */
-	if (tp && TLVP_PRESENT(tp, GSM48_IE_CHANDESC_2) &&
-	    TLVP_LEN(tp, GSM48_IE_CHANDESC_2) >= sizeof(*cd)) {
-		cd = (struct gsm48_chan_desc *)
-				TLVP_VAL(tp, GSM48_IE_CHANDESC_2);
-
-		/* our L1 only supports one global TSC for all channels
-		 * one one TRX, so we need to make sure not to activate
-		 * channels with a different TSC!! */
-		if (cd->h0.tsc != (lchan->ts->trx->bts->bsic & 7)) {
-			LOGP(DRSL, LOGL_ERROR, "lchan TSC %u != BSIC-TSC %u\n",
-				cd->h0.tsc, lchan->ts->trx->bts->bsic & 7);
-			return -RSL_ERR_SERV_OPT_UNIMPL;
-		}
-	}
-
-	lchan->sacch_deact = 0;
 	lchan_activate(lchan);
 	return 0;
 }
@@ -1665,7 +1659,7 @@ int bts_model_rsl_chan_act(struct gsm_lchan *lchan, struct tlv_parsed *tp)
  * Modify the given lchan in the handover scenario. This is a lot like
  * second channel activation but with some additional activation.
  */
-int bts_model_rsl_chan_mod(struct gsm_lchan *lchan)
+int l1if_rsl_chan_mod(struct gsm_lchan *lchan)
 {
 	const struct lchan_sapis *s4l = &sapis_for_lchan[lchan->type];
 	unsigned int i;
@@ -1689,7 +1683,7 @@ int bts_model_rsl_chan_mod(struct gsm_lchan *lchan)
 	return 0;
 }
 
-int bts_model_rsl_chan_rel(struct gsm_lchan *lchan)
+int l1if_rsl_chan_rel(struct gsm_lchan *lchan)
 {
 	/* A duplicate RF Release Request, ignore it */
 	if (lchan->state == LCHAN_S_REL_REQ) {
@@ -1702,7 +1696,7 @@ int bts_model_rsl_chan_rel(struct gsm_lchan *lchan)
 	return 0;
 }
 
-int bts_model_rsl_deact_sacch(struct gsm_lchan *lchan)
+int l1if_rsl_deact_sacch(struct gsm_lchan *lchan)
 {
 	/* Only de-activate the SACCH if the lchan is active */
 	if (lchan->state != LCHAN_S_ACTIVE)
-- 
2.1.0





More information about the OpenBSC mailing list