struct amr_multirate_conf: remove ms_mode[], raname bts_mode[]

Looks like this structure was copied from openbsc/osmo-bsc as-is.
The ms_mode[] makes no sense in the context of BTS, so remove it
and rename bts_mode[] to mode[] for the sake of brevity.

Change-Id: I7442360ed857554440a0b9854f2d2bbab9dc5a71
Related: SYS#5917, OS#4984
This commit is contained in:
Vadim Yanitskiy 2022-04-13 17:40:34 +03:00 committed by fixeria
parent c350b9a9f6
commit fe21e88630
7 changed files with 37 additions and 38 deletions

View File

@ -67,8 +67,7 @@ struct amr_mode {
struct amr_multirate_conf {
uint8_t gsm48_ie[2];
struct amr_mode ms_mode[4];
struct amr_mode bts_mode[4];
struct amr_mode mode[4];
uint8_t num_modes;
};

View File

@ -95,9 +95,9 @@ void amr_log_mr_conf(int ss, int logl, const char *pfx,
for (i = 0; i < amr_mrc->num_modes; i++)
LOGPC(ss, logl, ", mode[%u] = %u/%u/%u",
i, amr_mrc->bts_mode[i].mode,
amr_mrc->bts_mode[i].threshold,
amr_mrc->bts_mode[i].hysteresis);
i, amr_mrc->mode[i].mode,
amr_mrc->mode[i].threshold,
amr_mrc->mode[i].hysteresis);
LOGPC(ss, logl, "\n");
}
@ -106,7 +106,7 @@ static inline int get_amr_mode_idx(const struct amr_multirate_conf *amr_mrc,
{
unsigned int i;
for (i = 0; i < amr_mrc->num_modes; i++) {
if (amr_mrc->bts_mode[i].mode == cmi)
if (amr_mrc->mode[i].mode == cmi)
return i;
}
return -EINVAL;
@ -196,7 +196,7 @@ int amr_parse_mr_conf(struct amr_multirate_conf *amr_mrc,
for (i = 0; i < 8; i++) {
if (mr_conf[1] & (1 << i)) {
amr_mrc->bts_mode[j++].mode = i;
amr_mrc->mode[j++].mode = i;
}
}
@ -204,18 +204,18 @@ int amr_parse_mr_conf(struct amr_multirate_conf *amr_mrc,
mr_conf += 2;
if (num_codecs >= 2) {
amr_mrc->bts_mode[0].threshold = mr_conf[0] & 0x3F;
amr_mrc->bts_mode[0].hysteresis = mr_conf[1] >> 4;
amr_mrc->mode[0].threshold = mr_conf[0] & 0x3F;
amr_mrc->mode[0].hysteresis = mr_conf[1] >> 4;
}
if (num_codecs >= 3) {
amr_mrc->bts_mode[1].threshold =
amr_mrc->mode[1].threshold =
((mr_conf[1] & 0xF) << 2) | (mr_conf[2] >> 6);
amr_mrc->bts_mode[1].hysteresis = (mr_conf[2] >> 2) & 0xF;
amr_mrc->mode[1].hysteresis = (mr_conf[2] >> 2) & 0xF;
}
if (num_codecs >= 4) {
amr_mrc->bts_mode[2].threshold =
amr_mrc->mode[2].threshold =
((mr_conf[2] & 0x3) << 4) | (mr_conf[3] >> 4);
amr_mrc->bts_mode[2].hysteresis = mr_conf[3] & 0xF;
amr_mrc->mode[2].hysteresis = mr_conf[3] & 0xF;
}
return num_codecs;
@ -272,7 +272,7 @@ void amr_init_mr_conf_def(struct gsm_lchan *lchan)
memcpy(lchan->tch.amr_mr.gsm48_ie, mr_cfg,
sizeof(lchan->tch.amr_mr.gsm48_ie));
memcpy(&lchan->tch.amr_mr.bts_mode[0], &bts_mode[0],
sizeof(lchan->tch.amr_mr.bts_mode));
memcpy(&lchan->tch.amr_mr.mode[0], &bts_mode[0],
sizeof(lchan->tch.amr_mr.mode));
lchan->tch.amr_mr.num_modes = num_modes;
}

View File

@ -298,7 +298,7 @@ static struct msgb *l1_to_rtppayload_amr(uint8_t *l1_payload, uint8_t payload_le
LOGP(DL1P, LOGL_NOTICE, "L1->RTP: overriding CMR IDX %u\n", cmr_idx);
cmr = AMR_CMR_NONE;
} else {
cmr = amr_mrc->bts_mode[cmr_idx].mode;
cmr = amr_mrc->mode[cmr_idx].mode;
lchan->tch.last_cmr = cmr;
}

View File

@ -78,7 +78,7 @@ void trx_loop_amr_input(struct l1sched_chan_state *chan_state,
if (chan_state->dl_cmr > 0) {
/* degrade, if ber is above threshold FIXME: C/I */
if (ber >
lchan->tch.amr_mr.bts_mode[chan_state->dl_cmr-1].threshold) {
lchan->tch.amr_mr.mode[chan_state->dl_cmr-1].threshold) {
LOGPLCHAN(lchan, DLOOP, LOGL_DEBUG, "Degrading due to BER %.6f "
"from codec id %d to %d\n", ber, chan_state->dl_cmr,
chan_state->dl_cmr - 1);
@ -87,8 +87,8 @@ void trx_loop_amr_input(struct l1sched_chan_state *chan_state,
} else if (chan_state->dl_cmr < chan_state->codecs - 1) {
/* degrade, if ber is above threshold FIXME: C/I*/
if (ber <
lchan->tch.amr_mr.bts_mode[chan_state->dl_cmr].threshold
- lchan->tch.amr_mr.bts_mode[chan_state->dl_cmr].hysteresis) {
lchan->tch.amr_mr.mode[chan_state->dl_cmr].threshold
- lchan->tch.amr_mr.mode[chan_state->dl_cmr].hysteresis) {
LOGPLCHAN(lchan, DLOOP, LOGL_DEBUG, "Upgrading due to BER %.6f "
"from codec id %d to %d\n", ber, chan_state->dl_cmr,
chan_state->dl_cmr + 1);

View File

@ -428,10 +428,10 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
trx_sched_set_mode(lchan->ts, chan_nr,
lchan->rsl_cmode, lchan->tch_mode,
lchan->tch.amr_mr.num_modes,
lchan->tch.amr_mr.bts_mode[0].mode,
lchan->tch.amr_mr.bts_mode[1].mode,
lchan->tch.amr_mr.bts_mode[2].mode,
lchan->tch.amr_mr.bts_mode[3].mode,
lchan->tch.amr_mr.mode[0].mode,
lchan->tch.amr_mr.mode[1].mode,
lchan->tch.amr_mr.mode[2].mode,
lchan->tch.amr_mr.mode[3].mode,
amr_get_initial_mode(lchan),
(lchan->ho.active == 1));
/* set lchan active */
@ -457,10 +457,10 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
trx_sched_set_mode(lchan->ts, chan_nr,
lchan->rsl_cmode, lchan->tch_mode,
lchan->tch.amr_mr.num_modes,
lchan->tch.amr_mr.bts_mode[0].mode,
lchan->tch.amr_mr.bts_mode[1].mode,
lchan->tch.amr_mr.bts_mode[2].mode,
lchan->tch.amr_mr.bts_mode[3].mode,
lchan->tch.amr_mr.mode[0].mode,
lchan->tch.amr_mr.mode[1].mode,
lchan->tch.amr_mr.mode[2].mode,
lchan->tch.amr_mr.mode[3].mode,
amr_get_initial_mode(lchan),
0);
break;

View File

@ -384,10 +384,10 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
trx_sched_set_mode(lchan->ts, chan_nr,
lchan->rsl_cmode, lchan->tch_mode,
lchan->tch.amr_mr.num_modes,
lchan->tch.amr_mr.bts_mode[0].mode,
lchan->tch.amr_mr.bts_mode[1].mode,
lchan->tch.amr_mr.bts_mode[2].mode,
lchan->tch.amr_mr.bts_mode[3].mode,
lchan->tch.amr_mr.mode[0].mode,
lchan->tch.amr_mr.mode[1].mode,
lchan->tch.amr_mr.mode[2].mode,
lchan->tch.amr_mr.mode[3].mode,
amr_get_initial_mode(lchan),
(lchan->ho.active == 1));
/* set lchan active */
@ -410,10 +410,10 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
trx_sched_set_mode(lchan->ts, chan_nr,
lchan->rsl_cmode, lchan->tch_mode,
lchan->tch.amr_mr.num_modes,
lchan->tch.amr_mr.bts_mode[0].mode,
lchan->tch.amr_mr.bts_mode[1].mode,
lchan->tch.amr_mr.bts_mode[2].mode,
lchan->tch.amr_mr.bts_mode[3].mode,
lchan->tch.amr_mr.mode[0].mode,
lchan->tch.amr_mr.mode[1].mode,
lchan->tch.amr_mr.mode[2].mode,
lchan->tch.amr_mr.mode[3].mode,
amr_get_initial_mode(lchan),
0);
break;

View File

@ -159,9 +159,9 @@ static void test_amr_parse_mr_conf(void)
printf("amr_parse_mr_conf() -> num_modes=%u\n", mrc.num_modes);
for (i = 0; i < mrc.num_modes; i++) {
printf(" Mode[%u] = %u/%u/%u\n",
i, mrc.bts_mode[i].mode,
mrc.bts_mode[i].threshold,
mrc.bts_mode[i].hysteresis);
i, mrc.mode[i].mode,
mrc.mode[i].threshold,
mrc.mode[i].hysteresis);
}
mrc_enc[1] = 0xff; /* all codec modes active */