From d6fcd2aff21f7dc2e15e8e9ede5449ead42a18fb Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 14 Apr 2021 23:47:41 +0200 Subject: move mr_*_lv arrays out of lchan state Change-Id: I5763c29bcc476fb916ae64eb3ea875cca1a8d9b2 --- include/osmocom/bsc/gsm_data.h | 3 --- src/osmo-bsc/gsm_04_08_rr.c | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 3505a1300..c1d8fd58b 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -645,9 +645,6 @@ struct gsm_lchan { /* Encryption information */ struct gsm_encr encr; - /* AMR bits */ - uint8_t mr_ms_lv[7]; - uint8_t mr_bts_lv[7]; /* AMR bits were based on these rate bits: */ uint16_t s15_s0; diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c index b69b13342..ffc039ae3 100644 --- a/src/osmo-bsc/gsm_04_08_rr.c +++ b/src/osmo-bsc/gsm_04_08_rr.c @@ -558,6 +558,18 @@ int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, return gsm48_sendmsg(msg); } +void put_multi_rate_cfg(struct msgb *msg, struct gsm_bts *bts, struct gsm48_multi_rate_conf *mr_conf, + bool full_rate) +{ + /* AMR bits */ + uint8_t mr_ms_lv[7]; + uint8_t mr_bts_lv[7]; + + mr_config_render_lv(mr_ms_lv + msgb_tlv_put(msg, GSM48_IE_MUL_RATE_CFG, new_lchan->mr_ms_lv[0], + new_lchan->mr_ms_lv + 1); +} + /* Chapter 9.1.2: Assignment Command */ int gsm48_send_rr_ass_cmd(struct gsm_lchan *current_lchan, struct gsm_lchan *new_lchan, uint8_t power_command) { @@ -602,8 +614,8 @@ 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->tch_mode == GSM48_CMODE_SPEECH_AMR) - msgb_tlv_put(msg, GSM48_IE_MUL_RATE_CFG, new_lchan->mr_ms_lv[0], - new_lchan->mr_ms_lv + 1); + put_multi_rate_cfg(msg, new_lchan->ts->trx->bts, new_lchan->activate.mr_config, + new_lchan->type == LCHAN_TCH_F); return gsm48_sendmsg(msg); } -- cgit v1.2.3