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
This commit is contained in:
Neels Hofmeyr 2021-05-28 17:18:11 +00:00
parent 27c07690d9
commit e24da2ef95
9 changed files with 25 additions and 25 deletions

View File

@ -70,7 +70,7 @@ static void count_codecs(struct gsm_bts *bts, struct gsm_lchan *lchan)
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 @@ static void count_codecs(struct gsm_bts *bts, struct gsm_lchan *lchan)
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 @@ static int channel_mode_from_lchan(struct rsl_ie_chan_mode *cm,
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 @@ int rsl_tx_chan_activ(struct gsm_lchan *lchan, uint8_t act_type, uint8_t ho_ref)
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 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
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 @@ static int abis_rsl_rx_rll(struct msgb *msg)
/* 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 @@ void ipacc_speech_mode_set_direction(uint8_t *speech_mode, bool send)
/* 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:

View File

@ -84,7 +84,7 @@ static const struct osmo_tdef_state_timeout assignment_fsm_timeouts[32] = {
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 @@ static bool lchan_type_compat_with_mode(enum gsm_chan_t type, const struct chann
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 @@ static int check_requires_voice(bool *requires_voice, enum gsm48_chan_mode chan_
{
*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:

View File

@ -572,7 +572,7 @@ struct msgb *gsm48_make_ho_cmd(struct gsm_lchan *new_lchan, uint8_t power_comman
}
/* 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 @@ int gsm48_send_rr_ass_cmd(struct gsm_lchan *current_lchan, struct gsm_lchan *new
}
/* 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 @@ int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t mode)
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) {

View File

@ -1066,7 +1066,7 @@ const struct gsm_power_ctrl_params power_ctrl_params_def = {
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:

View File

@ -479,7 +479,7 @@ static void check_requirements(struct ho_candidate *c)
/* 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 @@ static void check_requirements(struct ho_candidate *c)
// 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 @@ static void check_requirements_remote_bss(struct ho_candidate *c)
/* 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 @@ static int trigger_local_ho_or_as(struct ho_candidate *c, uint8_t requirements)
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 void collect_candidates_for_lchan(struct gsm_lchan *lchan,
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 @@ static void on_measurement_report(struct gsm_meas_rep *mr)
/* 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);

View File

@ -594,7 +594,7 @@ static bool parse_ho_request(struct gsm_subscriber_connection *conn, const struc
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:

View File

@ -628,7 +628,7 @@ static void lchan_fsm_wait_ts_ready_onenter(struct osmo_fsm_inst *fi, uint32_t p
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 @@ static void lchan_fsm_established(struct osmo_fsm_inst *fi, uint32_t event, void
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");

View File

@ -796,7 +796,7 @@ static struct osmo_fsm lchan_rtp_fsm = {
/* 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;

View File

@ -146,7 +146,7 @@ _lc_find_bts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan, bool log)
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: