fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/27757 )
Change subject: rsl: use hard-coded defaults if the MultiRate conf IE is absent ......................................................................
rsl: use hard-coded defaults if the MultiRate conf IE is absent
Change-Id: Ie96af636105ee1ffe2d9a0bd9eea375faebad149 Related: SYS#5917, OS#4984 --- M include/osmo-bts/amr.h M src/common/amr.c M src/common/rsl.c 3 files changed, 28 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/57/27757/1
diff --git a/include/osmo-bts/amr.h b/include/osmo-bts/amr.h index f313287..3fa4b8f 100644 --- a/include/osmo-bts/amr.h +++ b/include/osmo-bts/amr.h @@ -14,5 +14,6 @@ void amr_set_mode_pref(uint8_t *data, const struct amr_multirate_conf *amr_mrc, uint8_t cmi, uint8_t cmr); unsigned int amr_get_initial_mode(struct gsm_lchan *lchan); +void amr_init_mr_conf_def(struct gsm_lchan *lchan);
#endif /* _OSMO_BTS_AMR_H */ diff --git a/src/common/amr.c b/src/common/amr.c index 8545d58..53ce24d 100644 --- a/src/common/amr.c +++ b/src/common/amr.c @@ -250,3 +250,26 @@ } } } + +void amr_init_mr_conf_def(struct gsm_lchan *lchan) +{ + const struct gsm48_multi_rate_conf *mr_cfg; + const struct amr_mode *bts_mode; + unsigned int num_modes; + + if (lchan->type == GSM_LCHAN_TCH_F) { + num_modes = ARRAY_SIZE(amr_fr_bts_mode_def); + bts_mode = &amr_fr_bts_mode_def[0]; + mr_cfg = &amr_fr_mr_cfg_def; + } else { + num_modes = ARRAY_SIZE(amr_hr_bts_mode_def); + bts_mode = &amr_hr_bts_mode_def[0]; + mr_cfg = &amr_hr_mr_cfg_def; + } + + 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)); + lchan->tch.amr_mr.num_modes = num_modes; +} diff --git a/src/common/rsl.c b/src/common/rsl.c index 961e065..5c4a2cd 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -1628,7 +1628,9 @@ if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) { LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Missing MultiRate conf IE " "(TCH mode is %s)\n", gsm48_chan_mode_name(lchan->tch_mode)); - /* TODO: init lchan->tch.amr_mr with some default values */ + /* Init lchan->tch.amr_mr with hard-coded default values */ + amr_init_mr_conf_def(lchan); + goto parsed; } return 0; } @@ -1648,6 +1650,7 @@ return -RSL_ERR_IE_CONTENT; }
+parsed: amr_log_mr_conf(DRTP, LOGL_DEBUG, gsm_lchan_name(lchan), &lchan->tch.amr_mr); lchan->tch.last_cmr = AMR_CMR_NONE; return 0;