Change in osmo-bsc[master]: ensure chan_mode comparisons in non-VAMOS mode

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


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

Change subject: ensure chan_mode comparisons in non-VAMOS mode
......................................................................

ensure chan_mode comparisons in non-VAMOS mode

Both VAMOS- and non-VAMOS speech modes should result in indentical voice
handling. So make sure that all chan_modes are converted to non-vamos
before comparing / evaluating in switch statements.

Change-Id: I791e7966b1f8eaa3299a8a46abeb313cf5136e0b
---
M src/osmo-bsc/abis_rsl.c
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/gsm_04_08_rr.c
M src/osmo-bsc/gsm_data.c
M src/osmo-bsc/handover_decision_2.c
M src/osmo-bsc/handover_fsm.c
M src/osmo-bsc/lchan_fsm.c
M src/osmo-bsc/lchan_rtp_fsm.c
M src/osmo-bsc/lchan_select.c
9 files changed, 25 insertions(+), 25 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/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index 0436bf5..7fe961e 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -70,7 +70,7 @@
 	OSMO_ASSERT(bts);
 
 	if (lchan->type == GSM_LCHAN_TCH_H) {
-		switch (lchan->current_ch_mode_rate.chan_mode) {
+		switch (gsm48_chan_mode_to_non_vamos(lchan->current_ch_mode_rate.chan_mode)) {
 		case GSM48_CMODE_SPEECH_AMR:
 			rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CODEC_AMR_H]);
 			break;
@@ -81,7 +81,7 @@
 			break;
 		}
 	} else if (lchan->type == GSM_LCHAN_TCH_F) {
-		switch (lchan->current_ch_mode_rate.chan_mode) {
+		switch (gsm48_chan_mode_to_non_vamos(lchan->current_ch_mode_rate.chan_mode)) {
 		case GSM48_CMODE_SPEECH_AMR:
 			rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CODEC_AMR_F]);
 			break;
@@ -389,7 +389,7 @@
 		return -EINVAL;
 	}
 
-	switch (ch_mode_rate->chan_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(ch_mode_rate->chan_mode)) {
 	case GSM48_CMODE_SIGN:
 		cm->chan_rate = 0;
 		break;
@@ -593,7 +593,7 @@
 	add_power_control_params(msg, RSL_IE_BS_POWER_PARAM, lchan);
 	add_power_control_params(msg, RSL_IE_MS_POWER_PARAM, lchan);
 
-	if (lchan->activate.info.ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR) {
+	if (gsm48_chan_mode_to_non_vamos(lchan->activate.info.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) {
@@ -653,7 +653,7 @@
 			msgb_tlv_put(msg, RSL_IE_ENCR_INFO, rc, encr_info);
 	}
 
-	if (lchan->modify.info.ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR) {
+	if (gsm48_chan_mode_to_non_vamos(lchan->modify.info.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) {
@@ -2095,7 +2095,7 @@
 /* Return an ip.access BTS speech mode value (uint8_t) or negative on error. */
 int ipacc_speech_mode(enum gsm48_chan_mode tch_mode, enum gsm_chan_t type)
 {
-	switch (tch_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(tch_mode)) {
 	case GSM48_CMODE_SPEECH_V1:
 		switch (type) {
 		case GSM_LCHAN_TCH_F:
@@ -2143,7 +2143,7 @@
 /* Return an ip.access BTS payload type value (uint8_t) or negative on error. */
 int ipacc_payload_type(enum gsm48_chan_mode tch_mode, enum gsm_chan_t type)
 {
-	switch (tch_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(tch_mode)) {
 	case GSM48_CMODE_SPEECH_V1:
 		switch (type) {
 		case GSM_LCHAN_TCH_F:
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index 81de958..0f38eec 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -84,7 +84,7 @@
 		rate_ctr_inc(&conn->network->bsc_ctrs->ctr[BSC_##counter]); \
 		if (bts) { \
 			rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_##counter]); \
-			switch (conn->assignment.req.ch_mode_rate_list[0].chan_mode) { \
+			switch (gsm48_chan_mode_to_non_vamos(conn->assignment.req.ch_mode_rate_list[0].chan_mode)) { \
 			case GSM48_CMODE_SIGN: \
 				rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_##counter##_SIGN]); \
 				break; \
@@ -317,7 +317,7 @@
 	enum gsm48_chan_mode chan_mode = ch_mode_rate->chan_mode;
 	enum channel_rate chan_rate = ch_mode_rate->chan_rate;
 
-	switch (chan_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(chan_mode)) {
 	case GSM48_CMODE_SIGN:
 		switch (type) {
 		case GSM_LCHAN_TCH_F: return chan_rate == CH_RATE_FULL;
@@ -361,7 +361,7 @@
 {
 	*requires_voice = false;
 
-	switch (chan_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(chan_mode)) {
 	case GSM48_CMODE_SPEECH_V1:
 	case GSM48_CMODE_SPEECH_EFR:
 	case GSM48_CMODE_SPEECH_AMR:
diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c
index c0efafb..6e86c9e 100644
--- a/src/osmo-bsc/gsm_04_08_rr.c
+++ b/src/osmo-bsc/gsm_04_08_rr.c
@@ -572,7 +572,7 @@
 	}
 
 	/* in case of multi rate we need to attach a config */
-	if (new_lchan->current_ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR) {
+	if (gsm48_chan_mode_to_non_vamos(new_lchan->current_ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
 		if (put_mr_config_for_ms(msg, &new_lchan->current_mr_conf,
 					 (new_lchan->type == GSM_LCHAN_TCH_F) ? &bts->mr_full : &bts->mr_half)) {
 			LOG_LCHAN(new_lchan, LOGL_ERROR, "Cannot encode MultiRate Configuration IE\n");
@@ -638,7 +638,7 @@
 	}
 
 	/* in case of multi rate we need to attach a config */
-	if (new_lchan->current_ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR) {
+	if (gsm48_chan_mode_to_non_vamos(new_lchan->current_ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
 		int rc = put_mr_config_for_ms(msg, &new_lchan->current_mr_conf,
 					      (new_lchan->type == GSM_LCHAN_TCH_F) ? &bts->mr_full : &bts->mr_half);
 		if (rc) {
@@ -696,7 +696,7 @@
 	cmm->mode = mode;
 
 	/* in case of multi rate we need to attach a config */
-	if (lchan->modify.info.ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR) {
+	if (gsm48_chan_mode_to_non_vamos(lchan->modify.info.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) {
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index b676e2f..ea6c685 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -1066,7 +1066,7 @@
 
 enum rsl_cmod_spd chan_mode_to_rsl_cmod_spd(enum gsm48_chan_mode chan_mode)
 {
-	switch (chan_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(chan_mode)) {
 	case GSM48_CMODE_SIGN:
 		return RSL_CMOD_SPD_SIGN;
 	case GSM48_CMODE_SPEECH_V1:
diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c
index 34bd99a..b2027d9 100644
--- a/src/osmo-bsc/handover_decision_2.c
+++ b/src/osmo-bsc/handover_decision_2.c
@@ -479,7 +479,7 @@
 
 	/* compatibility check for codecs.
 	 * if so, the candidates for full rate and half rate are selected */
-	switch (c->current.lchan->current_ch_mode_rate.chan_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(c->current.lchan->current_ch_mode_rate.chan_mode)) {
 	case GSM48_CMODE_SPEECH_V1:
 		switch (c->current.lchan->type) {
 		case GSM_LCHAN_TCH_F: /* mandatory */
@@ -575,7 +575,7 @@
 	// This was useful in osmo-nitb. We're in osmo-bsc now and have no idea whether the osmo-msc does
 	// internal or external call control. Maybe a future config switch wants to add this behavior?
 	/* Built-in call control requires equal codec rates. Remove rates that are not equal. */
-	if (c->current.lchan->tch_mode == GSM48_CMODE_SPEECH_AMR
+	if (gsm48_chan_mode_to_non_vamos(c->current.lchan->tch_mode) == GSM48_CMODE_SPEECH_AMR
 	    && c->current.bts->network->mncc_recv != mncc_sock_from_cc) {
 		switch (c->current.lchan->type) {
 		case GSM_LCHAN_TCH_F:
@@ -759,7 +759,7 @@
 
 	/* compatibility check for codecs -- we have no notion of what the remote BSS supports. We can
 	 * only assume that a handover would work, and use only the local requirements. */
-	switch (c->current.lchan->current_ch_mode_rate.chan_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(c->current.lchan->current_ch_mode_rate.chan_mode)) {
 	case GSM48_CMODE_SPEECH_V1:
 		switch (c->current.lchan->type) {
 		case GSM_LCHAN_TCH_F: /* mandatory */
@@ -817,7 +817,7 @@
 	bool full_rate = false;
 
 	/* afs_bias becomes > 0, if AFS is used and is improved */
-	if (c->current.lchan->current_ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR)
+	if (gsm48_chan_mode_to_non_vamos(c->current.lchan->current_ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR)
 		afs_bias = ho_get_hodec2_afs_bias_rxlev(c->target.bts->ho);
 
 	/* select TCH rate, prefer TCH/F if AFS is improved */
@@ -1247,7 +1247,7 @@
 static int find_alternative_lchan(struct gsm_lchan *lchan, bool include_weaker_rxlev)
 {
 	struct gsm_bts *bts = lchan->ts->trx->bts;
-	int ahs = (lchan->current_ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR
+	int ahs = (gsm48_chan_mode_to_non_vamos(lchan->current_ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR
 		   && lchan->type == GSM_LCHAN_TCH_H);
 	int rxlev_current;
 	struct ho_candidate clist[1 + ARRAY_SIZE(lchan->neigh_meas)];
@@ -1455,7 +1455,7 @@
 
 	/* improve levels in case of AFS, if defined */
 	if (lchan->type == GSM_LCHAN_TCH_F
-	 && lchan->current_ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR) {
+	 && gsm48_chan_mode_to_non_vamos(lchan->current_ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) {
 		int av_rxlev_was = av_rxlev;
 		int av_rxqual_was = av_rxqual;
 		int rxlev_bias = ho_get_hodec2_afs_bias_rxlev(bts->ho);
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index b7658c5..ec70be3 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -594,7 +594,7 @@
 
 static bool chan_mode_is_tch(enum gsm48_chan_mode mode)
 {
-	switch (mode) {
+	switch (gsm48_chan_mode_to_non_vamos(mode)) {
 	case GSM48_CMODE_SPEECH_V1:
 	case GSM48_CMODE_SPEECH_EFR:
 	case GSM48_CMODE_SPEECH_AMR:
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 1610ac3..a28f58d 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -628,7 +628,7 @@
 			lchan->bs_power = bts->bs_power_ctrl.bs_power_val_db / 2;
 	}
 
-	if (info->ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR) {
+	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_fail("Can not generate multirate configuration IE\n");
 			return;
@@ -1124,7 +1124,7 @@
 
 		use_mgwep_ci = lchan_use_mgw_endpoint_ci_bts(lchan);
 
-		if (modif_info->ch_mode_rate.chan_mode == GSM48_CMODE_SPEECH_AMR) {
+		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) {
 				lchan_fail("Can not generate multirate configuration IE\n");
diff --git a/src/osmo-bsc/lchan_rtp_fsm.c b/src/osmo-bsc/lchan_rtp_fsm.c
index 366bd1b..7945359 100644
--- a/src/osmo-bsc/lchan_rtp_fsm.c
+++ b/src/osmo-bsc/lchan_rtp_fsm.c
@@ -796,7 +796,7 @@
 /* Depending on the channel mode and rate, return the codec type that is signalled towards the MGW. */
 static enum mgcp_codecs chan_mode_to_mgcp_codec(enum gsm48_chan_mode chan_mode, bool full_rate)
 {
-	switch (chan_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(chan_mode)) {
 	case GSM48_CMODE_SPEECH_V1:
 		if (full_rate)
 			return CODEC_GSM_8000_1;
diff --git a/src/osmo-bsc/lchan_select.c b/src/osmo-bsc/lchan_select.c
index dba3c3a..53c4358 100644
--- a/src/osmo-bsc/lchan_select.c
+++ b/src/osmo-bsc/lchan_select.c
@@ -146,7 +146,7 @@
 
 enum gsm_chan_t chan_mode_to_chan_type(enum gsm48_chan_mode chan_mode, enum channel_rate chan_rate)
 {
-	switch (chan_mode) {
+	switch (gsm48_chan_mode_to_non_vamos(chan_mode)) {
 	case GSM48_CMODE_SIGN:
 		switch (chan_rate) {
 		case CH_RATE_SDCCH:

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I791e7966b1f8eaa3299a8a46abeb313cf5136e0b
Gerrit-Change-Number: 24459
Gerrit-PatchSet: 3
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/d650b232/attachment.htm>


More information about the gerrit-log mailing list