diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2018-09-21 14:21:50 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-10-05 07:58:22 +0000 |
commit | c9a4f697d38b35680938f20928544a734739b185 (patch) | |
tree | 02447f24c7f99783e2f1bf8dd2b6fd690b5a2bb9 /src/osmo-bsc/lchan_fsm.c | |
parent | 2043db02362ff94463fb8a797724f36bef3e0090 (diff) |
codec_pref: handle S0-S15 in ASSIGNMENT REQUEST
Opposed to all other codecs that are common in GSM, AMR requires a codec
configuration that is expressed by a bitmask (S0 to S15) in the speech
codec list in the ASSIGNMENT REQUEST. Also the BSC acknowledges those
configuration in the ASSIGNMENT COMPLETE message.
At the moment osmo-bsc ignores all incoming configuration bits. The bits
in the ASSIGNMENT COMPLETE speech codec (choosen) field are hardcoded.
- Store the configuration bits while parsing the ASSIGNMENT COMPLETE
- Create an intersection with the configuration that is actually
supported by the BSS
- Return the resulting (chosen) configuration bits with the assignment
complete message.
- Use the (highest of the) agreed codec rates in RSL channel activation.
Change-Id: I2d8ded51b3eb4c003fe2da6f2d6f48d001b73737
Related: OS#3529
Diffstat (limited to 'src/osmo-bsc/lchan_fsm.c')
-rw-r--r-- | src/osmo-bsc/lchan_fsm.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index c80d8a16e..4aaedde66 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -425,11 +425,48 @@ void lchan_mr_config(struct gsm_lchan *lchan, struct gsm48_multi_rate_conf *mr_c }; } +/* Mask all rates instead of the highest possible */ +static void lchan_mr_config_mask(struct gsm48_multi_rate_conf *mr_conf) +{ + unsigned int i; + bool highest_seen = false; + uint8_t *_mr_conf = (uint8_t *) mr_conf; + + /* FIXME: At the moment we can not support multiple codec rates in one + * struct gsm48_multi_rate_conf, because the struct lacks the fields + * for Threshold and Hysteresis. Those fields are not needed when only + * a single codec rate is in place, but as soon as multiple codec + * rates are used the parameters are mandatory. The layout for the + * struct would then also be different because each rate needs its + * own Threshold and Hysteresis value. (See also 3GPP TS 04.08, + * chapter 10.5.2.21aa MultiRate configuration). + * + * Since we are unable to signal multiple codec rates properly, we just + * remove all codec rates from the active set, except the highest + * possible. Doing so we lack the functionality to switch towards the + * other, lower codec rates that were offered by the MSC, but it is + * still guaranteed that a rate is selected that is supported by all + * entities. + * + * To fix this problem, we should implement a proper encoder for + * struct gsm48_multi_rate_conf, in libosmocore and use it here. + * struct amr_mode already seems to have members for threshold and + * hysteresis we can use. */ + + for (i = 7; i > 0; i--) { + if (_mr_conf[1] & (1 << i) && highest_seen == false) { + highest_seen = true; + } else if (highest_seen) + _mr_conf[1] &= ~(1 << i); + } +} + static void lchan_fsm_unused(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct lchan_activate_info *info = data; struct gsm_lchan *lchan = lchan_fi_lchan(fi); struct gsm_bts *bts = lchan->ts->trx->bts; + struct gsm48_multi_rate_conf mr_conf; switch (event) { @@ -469,8 +506,12 @@ static void lchan_fsm_unused(struct osmo_fsm_inst *fi, uint32_t event, void *dat * - TA is still zero, to be determined by RACH. */ } - if (info->chan_mode == GSM48_CMODE_SPEECH_AMR) - lchan_mr_config(lchan, &info->for_conn->sccp.msc->amr_conf); + if (info->chan_mode == GSM48_CMODE_SPEECH_AMR) { + gsm48_mr_cfg_from_gsm0808_sc_cfg(&mr_conf, info->s15_s0); + /* FIXME: See above. */ + lchan_mr_config_mask(&mr_conf); + lchan_mr_config(lchan, &mr_conf); + } switch (info->chan_mode) { |