From patchwork Thu Sep 24 15:21:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Holger Freyther X-Patchwork-Id: 522386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (unknown [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 9E3341401F6 for ; Fri, 25 Sep 2015 01:23:24 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 9BE0299C1; Thu, 24 Sep 2015 15:23:22 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from gandharva.secretlabs.de (unknown [IPv6:2a01:4f8:161:8201::2:4]) by lists.osmocom.org (Postfix) with ESMTP id AF6E099A7 for ; Thu, 24 Sep 2015 15:21:41 +0000 (UTC) Received: from localhost.localdomain (ip5b4185b8.dynamic.kabel-deutschland.de [91.65.133.184]) by gandharva.secretlabs.de (Postfix) with ESMTPSA id 12308537AA for ; Thu, 24 Sep 2015 15:21:41 +0000 (UTC) From: Holger Hans Peter Freyther To: openbsc@lists.osmocom.org Subject: [PATCH] amr: Attempt to unbreak the AMR support in the BSC Date: Thu, 24 Sep 2015 17:21:37 +0200 Message-Id: <1443108097-66525-1-git-send-email-holger@freyther.de> X-Mailer: git-send-email 2.3.5 MIME-Version: 1.0 X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Holger Hans Peter Freyther The signature of mr_config and the BSC implementation didn't match and the compiler was warning about it: osmo_bsc_api.c:530:2: warning: initialization from incompatible pointer type .mr_config = bsc_mr_config, ^ osmo_bsc_api.c:530:2: warning: (near initialization for ‘bsc_handler.mr_config’) Change the mr_config again and provide an implementation that will set the ms and bts data structure. It would be better to put the size outside of the IE but I am not going to change it right now. It would also be nice to either move the AMR setting into the "nitb" structure or have the msc data be used _after_ the bts settings. This needs to be cleaned up in the next step. Manually verified by placing a MO call and checking that both the channel mode modify and the mode modify request contain the multi rate config with the rate mr config (length two bytes, version 1, icmi==1, no start mode being set). --- openbsc/include/openbsc/bsc_api.h | 2 +- openbsc/src/libbsc/bsc_api.c | 2 +- openbsc/src/osmo-bsc/osmo_bsc_api.c | 36 +++++++++++++++++++++++++----------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/openbsc/include/openbsc/bsc_api.h b/openbsc/include/openbsc/bsc_api.h index a70d765..a3d12f2 100644 --- a/openbsc/include/openbsc/bsc_api.h +++ b/openbsc/include/openbsc/bsc_api.h @@ -40,7 +40,7 @@ struct bsc_api { * not implemented AMR5.9 will be used. */ void (*mr_config)(struct gsm_subscriber_connection *conn, - uint8_t *mr_ms_lv, uint8_t *mr_bts_lv); + struct gsm_lchan *lchan, int full_rate); }; int bsc_api_init(struct gsm_network *network, struct bsc_api *api); diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index e157eb9..504f044 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -163,7 +163,7 @@ static void handle_mr_config(struct gsm_subscriber_connection *conn, struct gsm48_multi_rate_conf *mr_conf; if (api->mr_config) - return api->mr_config(conn, lchan->mr_ms_lv, lchan->mr_bts_lv); + return api->mr_config(conn, lchan, full_rate); if (full_rate) mr = &lchan->ts->trx->bts->mr_full; diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c index 00a10b3..fbeed77 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_api.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c @@ -491,9 +491,10 @@ static void bsc_cm_update(struct gsm_subscriber_connection *conn, } static void bsc_mr_config(struct gsm_subscriber_connection *conn, - struct gsm48_multi_rate_conf *conf) + struct gsm_lchan *lchan, int full_rate) { struct osmo_msc_data *msc; + struct gsm48_multi_rate_conf *ms_conf, *bts_conf; if (!conn->sccp_con) { LOGP(DMSC, LOGL_ERROR, @@ -504,18 +505,31 @@ static void bsc_mr_config(struct gsm_subscriber_connection *conn, msc = conn->sccp_con->msc; - conf->ver = 1; - conf->icmi = 1; + /* initialize the data structure */ + lchan->mr_ms_lv[0] = sizeof(*ms_conf); + lchan->mr_bts_lv[0] = sizeof(*bts_conf); + ms_conf = (struct gsm48_multi_rate_conf *) &lchan->mr_ms_lv[1]; + bts_conf = (struct gsm48_multi_rate_conf *) &lchan->mr_bts_lv[1]; + memset(ms_conf, 0, sizeof(*ms_conf)); + memset(bts_conf, 0, sizeof(*bts_conf)); + + bts_conf->ver = ms_conf->ver = 1; + bts_conf->icmi = ms_conf->icmi = 1; /* maybe gcc see's it is copy of _one_ byte */ - conf->m4_75 = msc->amr_conf.m4_75; - conf->m5_15 = msc->amr_conf.m5_15; - conf->m5_90 = msc->amr_conf.m5_90; - conf->m6_70 = msc->amr_conf.m6_70; - conf->m7_40 = msc->amr_conf.m7_40; - conf->m7_95 = msc->amr_conf.m7_95; - conf->m10_2 = msc->amr_conf.m10_2; - conf->m12_2 = msc->amr_conf.m12_2; + bts_conf->m4_75 = ms_conf->m4_75 = msc->amr_conf.m4_75; + bts_conf->m5_15 = ms_conf->m5_15 = msc->amr_conf.m5_15; + bts_conf->m5_90 = ms_conf->m5_90 = msc->amr_conf.m5_90; + bts_conf->m6_70 = ms_conf->m6_70 = msc->amr_conf.m6_70; + bts_conf->m7_40 = ms_conf->m7_40 = msc->amr_conf.m7_40; + bts_conf->m7_95 = ms_conf->m7_95 = msc->amr_conf.m7_95; + if (full_rate) { + bts_conf->m10_2 = ms_conf->m10_2 = msc->amr_conf.m10_2; + bts_conf->m12_2 = ms_conf->m12_2 = msc->amr_conf.m12_2; + } + + /* now copy this into the bts structure */ + memcpy(lchan->mr_bts_lv, lchan->mr_ms_lv, sizeof(lchan->mr_ms_lv)); } static struct bsc_api bsc_handler = {