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

neels gerrit-no-reply at lists.osmocom.org
Tue Jun 1 17:29:50 UTC 2021


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

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

lchan_fsm: introduce lchan.modify.ch_mode_rate to allow tweaking

lchan->modify.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->modify.ch_mode_rate, i.e. not in .modify.info, but in
.modify. Use that everywhere.

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

Change-Id: I8a3daac0287f15a59d3688388bb13e55facb2cea
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/abis_rsl.c
M src/osmo-bsc/gsm_04_08_rr.c
M src/osmo-bsc/lchan_fsm.c
4 files changed, 13 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  fixeria: 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 d128db7..831463a 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -657,6 +657,7 @@
 
 	struct {
 		struct lchan_modify_info info;
+		struct channel_mode_and_rate ch_mode_rate;
 		struct gsm48_multi_rate_conf mr_conf_filtered;
 		int tsc_set;
 		uint8_t tsc;
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index 7fe961e..9378ecb 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -634,7 +634,7 @@
 	struct rsl_ie_chan_mode cm;
 	struct gsm_bts *bts = lchan->ts->trx->bts;
 
-	rc = channel_mode_from_lchan(&cm, lchan, &lchan->modify.info.ch_mode_rate);
+	rc = channel_mode_from_lchan(&cm, lchan, &lchan->modify.ch_mode_rate);
 	if (rc < 0)
 		return rc;
 
@@ -653,7 +653,7 @@
 			msgb_tlv_put(msg, RSL_IE_ENCR_INFO, rc, encr_info);
 	}
 
-	if (gsm48_chan_mode_to_non_vamos(lchan->modify.info.ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
+	if (gsm48_chan_mode_to_non_vamos(lchan->modify.ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
 		rc = put_mr_config_for_bts(msg, &lchan->modify.mr_conf_filtered,
 					   (lchan->type == GSM_LCHAN_TCH_F) ? &bts->mr_full : &bts->mr_half);
 		if (rc) {
diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c
index 6e86c9e..058a107 100644
--- a/src/osmo-bsc/gsm_04_08_rr.c
+++ b/src/osmo-bsc/gsm_04_08_rr.c
@@ -696,7 +696,7 @@
 	cmm->mode = mode;
 
 	/* in case of multi rate we need to attach a config */
-	if (gsm48_chan_mode_to_non_vamos(lchan->modify.info.ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
+	if (gsm48_chan_mode_to_non_vamos(lchan->modify.ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
 		int rc = put_mr_config_for_ms(msg, &lchan->modify.mr_conf_filtered,
 					      (lchan->type == GSM_LCHAN_TCH_F) ? &bts->mr_full : &bts->mr_half);
 		if (rc) {
@@ -718,10 +718,10 @@
 	LOG_LCHAN(msg->lchan, LOGL_DEBUG, "CHANNEL MODE MODIFY ACK for %s\n",
 		  gsm48_chan_mode_name(mod->mode));
 
-	if (mod->mode != msg->lchan->modify.info.ch_mode_rate.chan_mode) {
+	if (mod->mode != msg->lchan->modify.ch_mode_rate.chan_mode) {
 		LOG_LCHAN(msg->lchan, LOGL_ERROR,
 			  "CHANNEL MODE MODIFY ACK has wrong mode: Wanted: %s Got: %s\n",
-			  gsm48_chan_mode_name(msg->lchan->modify.info.ch_mode_rate.chan_mode),
+			  gsm48_chan_mode_name(msg->lchan->modify.ch_mode_rate.chan_mode),
 			  gsm48_chan_mode_name(mod->mode));
 		return -1;
 	}
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index a28f58d..a29ddae 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -928,7 +928,7 @@
 static void lchan_fsm_wait_rr_chan_mode_modify_ack_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
 {
 	struct gsm_lchan *lchan = lchan_fi_lchan(fi);
-	gsm48_lchan_modify(lchan, lchan->modify.info.ch_mode_rate.chan_mode);
+	gsm48_lchan_modify(lchan, lchan->modify.ch_mode_rate.chan_mode);
 }
 
 static void lchan_fsm_wait_rr_chan_mode_modify_ack(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -969,7 +969,7 @@
 
 	case LCHAN_EV_RSL_CHAN_MODE_MODIFY_ACK:
 		/* The Channel Mode Modify was ACKed, now the requested values become the accepted and used values. */
-		lchan->current_ch_mode_rate = lchan->modify.info.ch_mode_rate;
+		lchan->current_ch_mode_rate = lchan->modify.ch_mode_rate;
 		lchan->current_mr_conf = lchan->modify.mr_conf_filtered;
 		lchan->tsc_set = lchan->modify.tsc_set;
 		lchan->tsc = lchan->modify.tsc;
@@ -981,7 +981,7 @@
 			lchan->activate.info = (struct lchan_activate_info){
 				.activ_for = ACTIVATE_FOR_MODE_MODIFY_RTP,
 				.for_conn = lchan->conn,
-				.ch_mode_rate = lchan->modify.info.ch_mode_rate,
+				.ch_mode_rate = lchan->modify.ch_mode_rate,
 				.requires_voice_stream = true,
 				.msc_assigned_cic = lchan->modify.info.msc_assigned_cic,
 			};
@@ -1124,6 +1124,9 @@
 
 		use_mgwep_ci = lchan_use_mgw_endpoint_ci_bts(lchan);
 
+		lchan->modify.ch_mode_rate = lchan->modify.info.ch_mode_rate;
+		/* future: automatically adjust chan_mode in lchan->modify.ch_mode_rate */
+
 		if (gsm48_chan_mode_to_non_vamos(modif_info->ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
 			if (lchan_mr_config(&lchan->modify.mr_conf_filtered, lchan, modif_info->ch_mode_rate.s15_s0)
 			    < 0) {
@@ -1149,7 +1152,7 @@
 			  (use_mgwep_ci ? osmo_mgcpc_ep_ci_name(use_mgwep_ci) : "new")
 			  : "none",
 			  gsm_lchant_name(lchan->type),
-			  gsm48_chan_mode_name(lchan->modify.info.ch_mode_rate.chan_mode),
+			  gsm48_chan_mode_name(lchan->modify.ch_mode_rate.chan_mode),
 			  lchan->modify.tsc_set, lchan->modify.tsc);
 
 		lchan_fsm_state_chg(LCHAN_ST_WAIT_RR_CHAN_MODE_MODIFY_ACK);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I8a3daac0287f15a59d3688388bb13e55facb2cea
Gerrit-Change-Number: 24465
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
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/20210601/87c0e7a1/attachment.htm>


More information about the gerrit-log mailing list