Change in osmo-bsc[master]: lchan_fsm: introduce lchan.activate.ch_mode_rate to allow tweaking

neels gerrit-no-reply at lists.osmocom.org
Thu Jun 10 15:21:22 UTC 2021


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24458 )

Change subject: lchan_fsm: introduce lchan.activate.ch_mode_rate to allow tweaking
......................................................................

lchan_fsm: introduce lchan.activate.ch_mode_rate to allow tweaking

lchan->activate.info.ch_mode_rate should remain unchanged, it is the
immutable request data. However, for VAMOS, we will want to
automatically see that the chan_mode is chosen correctly.

As a first step, place a mutable ch_mode_rate copy at
lchan->activate.ch_mode_rate, i.e. not in .activate.info, but in
.activate. Use that everywhere.

This is mostly a non-functional change, preparing for a subsequent patch
that adds handling of VAMOS shadow lchans.

As side effect of adding lchan_activate_set_ch_mode_rate_and_mr_config()
after MODE_MODIF_ACK (enabling the voice stream after a channel mode
modify), fix AMR config: the call to lchan_mr_config() was missing.

Change-Id: Icc9cc7481b3984fdca34eef49ea91ad3388c06fe
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/abis_rsl.c
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/lchan_fsm.c
M src/osmo-bsc/lchan_rtp_fsm.c
5 files changed, 20 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  neels: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 0670232..61e52f6 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -645,6 +645,7 @@
 
 	struct {
 		struct lchan_activate_info info;
+		struct channel_mode_and_rate ch_mode_rate;
 		struct gsm48_multi_rate_conf mr_conf_filtered;
 		bool activ_ack; /*< true as soon as RSL Chan Activ Ack is received */
 		bool immediate_assignment_sent;
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index 001b1da..40bfcec 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -534,7 +534,7 @@
 	/* PDCH activation is a job for rsl_tx_dyn_ts_pdch_act_deact(); */
 	OSMO_ASSERT(act_type != RSL_ACT_OSMO_PDCH);
 
-	rc = channel_mode_from_lchan(&cm, lchan, &lchan->activate.info.ch_mode_rate, false);
+	rc = channel_mode_from_lchan(&cm, lchan, &lchan->activate.ch_mode_rate, false);
 	if (rc < 0) {
 		LOGP(DRSL, LOGL_ERROR,
 		     "%s Cannot find channel mode from lchan type\n",
@@ -608,7 +608,7 @@
 	add_power_control_params(msg, RSL_IE_BS_POWER_PARAM, lchan);
 	add_power_control_params(msg, RSL_IE_MS_POWER_PARAM, lchan);
 
-	if (gsm48_chan_mode_to_non_vamos(lchan->activate.info.ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
+	if (gsm48_chan_mode_to_non_vamos(lchan->activate.ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
 		rc = put_mr_config_for_bts(msg, &lchan->activate.mr_conf_filtered,
 					   (lchan->type == GSM_LCHAN_TCH_F) ? &bts->mr_full : &bts->mr_half);
 		if (rc) {
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index a15807a..65cd8a8 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -210,7 +210,7 @@
 		if (gscon_is_aoip(conn)) {
 			/* Extrapolate speech codec from speech mode */
 			gsm0808_speech_codec_from_chan_type(&sc, perm_spch);
-			sc.cfg = conn->lchan->activate.info.ch_mode_rate.s15_s0;
+			sc.cfg = conn->lchan->activate.ch_mode_rate.s15_s0;
 			sc_ptr = ≻
 		}
 	}
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index b486b40..3b6333d 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -639,8 +639,11 @@
 			lchan->bs_power_db = bts->bs_power_ctrl.bs_power_val_db;
 	}
 
-	if (gsm48_chan_mode_to_non_vamos(info->ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
-		if (lchan_mr_config(&lchan->activate.mr_conf_filtered, lchan, info->ch_mode_rate.s15_s0) < 0) {
+	lchan->activate.ch_mode_rate = lchan->activate.info.ch_mode_rate;
+	/* future: automatically adjust chan_mode in lchan->activate.ch_mode_rate */
+
+	if (gsm48_chan_mode_to_non_vamos(lchan->activate.ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
+		if (lchan_mr_config(&lchan->activate.mr_conf_filtered, lchan, lchan->activate.ch_mode_rate.s15_s0) < 0) {
 			lchan_fail("Can not generate multirate configuration IE\n");
 			return;
 		}
@@ -656,7 +659,7 @@
 			(use_mgwep_ci ? osmo_mgcpc_ep_ci_name(use_mgwep_ci) : "new")
 			: "none",
 		  gsm_lchant_name(lchan->type),
-		  gsm48_chan_mode_name(lchan->activate.info.ch_mode_rate.chan_mode),
+		  gsm48_chan_mode_name(lchan->activate.ch_mode_rate.chan_mode),
 		  (lchan->activate.info.encr.alg_id ? : 1)-1,
 		  lchan->activate.info.encr.key_len ? osmo_hexdump_nospc(lchan->activate.info.encr.key,
 									 lchan->activate.info.encr.key_len) : "none");
@@ -806,7 +809,7 @@
 	int rc;
 	struct gsm_lchan *lchan = lchan_fi_lchan(fi);
 
-	lchan->current_ch_mode_rate = lchan->activate.info.ch_mode_rate;
+	lchan->current_ch_mode_rate = lchan->activate.ch_mode_rate;
 	lchan->current_mr_conf = lchan->activate.mr_conf_filtered;
 	lchan->tsc_set = lchan->activate.tsc_set;
 	lchan->tsc = lchan->activate.tsc;
@@ -999,6 +1002,9 @@
 				.tsc_set = -1,
 				.tsc = -1,
 			};
+			lchan->activate.ch_mode_rate = lchan->activate.info.ch_mode_rate;
+			/* future: automatically adjust chan_mode in lchan->activate.ch_mode_rate */
+
 			lchan->activate.concluded = false;
 			lchan_fsm_state_chg(LCHAN_ST_WAIT_RLL_RTP_ESTABLISH);
 		} else {
diff --git a/src/osmo-bsc/lchan_rtp_fsm.c b/src/osmo-bsc/lchan_rtp_fsm.c
index 7945359..3ba4189 100644
--- a/src/osmo-bsc/lchan_rtp_fsm.c
+++ b/src/osmo-bsc/lchan_rtp_fsm.c
@@ -268,19 +268,19 @@
 		return;
 	}
 
-	val = ipacc_speech_mode(lchan->activate.info.ch_mode_rate.chan_mode, lchan->type);
+	val = ipacc_speech_mode(lchan->activate.ch_mode_rate.chan_mode, lchan->type);
 	if (val < 0) {
 		lchan_rtp_fail("Cannot determine Abis/IP speech mode for tch_mode=%s type=%s\n",
-			   get_value_string(gsm48_chan_mode_names, lchan->activate.info.ch_mode_rate.chan_mode),
+			   get_value_string(gsm48_chan_mode_names, lchan->activate.ch_mode_rate.chan_mode),
 			   gsm_lchant_name(lchan->type));
 		return;
 	}
 	lchan->abis_ip.speech_mode = val;
 
-	val = ipacc_payload_type(lchan->activate.info.ch_mode_rate.chan_mode, lchan->type);
+	val = ipacc_payload_type(lchan->activate.ch_mode_rate.chan_mode, lchan->type);
 	if (val < 0) {
 		lchan_rtp_fail("Cannot determine Abis/IP payload type for tch_mode=%s type=%s\n",
-			   get_value_string(gsm48_chan_mode_names, lchan->activate.info.ch_mode_rate.chan_mode),
+			   get_value_string(gsm48_chan_mode_names, lchan->activate.ch_mode_rate.chan_mode),
 			   gsm_lchant_name(lchan->type));
 		return;
 	}
@@ -834,14 +834,14 @@
 
 void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *lchan, bool bss_side)
 {
-	enum mgcp_codecs codec = chan_mode_to_mgcp_codec(lchan->activate.info.ch_mode_rate.chan_mode,
+	enum mgcp_codecs codec = chan_mode_to_mgcp_codec(lchan->activate.ch_mode_rate.chan_mode,
 							 lchan->type == GSM_LCHAN_TCH_H? false : true);
 	int custom_pt;
 
 	if (codec < 0) {
 		LOG_LCHAN(lchan, LOGL_ERROR,
 			  "Unable to determine MGCP codec type for %s in chan-mode %s\n",
-			  gsm_lchant_name(lchan->type), gsm48_chan_mode_name(lchan->activate.info.ch_mode_rate.chan_mode));
+			  gsm_lchant_name(lchan->type), gsm48_chan_mode_name(lchan->activate.ch_mode_rate.chan_mode));
 		verb_info->codecs_len = 0;
 		return;
 	}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/24458
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Icc9cc7481b3984fdca34eef49ea91ad3388c06fe
Gerrit-Change-Number: 24458
Gerrit-PatchSet: 11
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210610/8c33c4eb/attachment.htm>


More information about the gerrit-log mailing list