From patchwork Thu May 12 15:56:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gerrit-no-reply@lists.osmocom.org X-Patchwork-Id: 621651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3r5Hfj0R40z9vKX for ; Fri, 13 May 2016 01:56:45 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 58C2C1CD75; Thu, 12 May 2016 15:56:41 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from 127.0.1.12 (unknown [127.0.1.12]) by lists.osmocom.org (Postfix) with ESMTPA id EF5EB1CD67; Thu, 12 May 2016 15:56:39 +0000 (UTC) Date: Thu, 12 May 2016 15:56:39 +0000 From: gerrit-no-reply@lists.osmocom.org To: Max X-Gerrit-MessageType: merged Subject: Change in libosmocore[master]: Set DTX in Cell Options X-Gerrit-Change-Id: I5a8924f57669c951b2e51b663d95f1d360062a54 X-Gerrit-ChangeURL: X-Gerrit-Commit: fe65fa7e36a400d362666e2c5bd0f289d45aa56a In-Reply-To: References: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/2.12.2 X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: holger@freyther.de Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" Message-Id: <20160512155641.58C2C1CD75@lists.osmocom.org> From Holger Freyther : Holger Freyther has submitted this change and it was merged. Change subject: Set DTX in Cell Options ...................................................................... Set DTX in Cell Options * rename field of struct gsm48_cell_options to better match the spec * add comments with spec references * add function for setting DTX in cell options struct * add necessary enum type Change-Id: I5a8924f57669c951b2e51b663d95f1d360062a54 Reviewed-on: https://gerrit.osmocom.org/39 Reviewed-by: Harald Welte Tested-by: Jenkins Builder --- M include/osmocom/gsm/protocol/gsm_04_08.h M src/gsm/gsm48.c M src/gsm/libosmogsm.map 3 files changed, 61 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 3282bc1..4800b48 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include @@ -469,11 +470,20 @@ uint8_t t3212; } __attribute__ ((packed)); +enum gsm48_dtx_mode { + GSM48_DTX_MAY_BE_USED, + GSM48_DTX_SHALL_BE_USED, + GSM48_DTX_SHALL_NOT_BE_USED +}; + +/* Cell Options for SI6, SACCH (10.5.2.3a.2) or SI3, BCCH (Table 10.5.2.3.1), + 3GPP TS 44.018 */ struct gsm48_cell_options { uint8_t radio_link_timeout:4, dtx:2, pwrc:1, - spare:1; + /* either DN-IND or top bit of DTX IND */ + d:1; } __attribute__ ((packed)); /* Section 9.2.9 CM service request */ @@ -827,6 +837,9 @@ } } +void gsm48_set_dtx(struct gsm48_cell_options *op, enum gsm48_dtx_mode full, + enum gsm48_dtx_mode half, bool is_bcch); + #define gsm48_hdr_msg_type gsm48_hdr_msg_type_r99 /* Section 10.4 */ diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index ab62605..8a46f76 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -25,7 +25,7 @@ #include #include #include - +#include #include #include @@ -358,6 +358,50 @@ return 0; } +/*! \brief Set DTX mode in Cell Options IE (3GPP TS 44.018) + * \param[in] op Cell Options structure in which DTX parameters will be set + * \param[in] full Mode for full-rate channels + * \param[in] half Mode for half-rate channels + * \param[in] is_bcch Indicates if we should use 10.5.2.3.1 instead of + * 10.5.2.3a.2 + * + * There is no space for separate DTX settings for Full and Half rate channels + * in BCCH - in this case full setting is used for both and half parameter is + * ignored. + */ +void gsm48_set_dtx(struct gsm48_cell_options *op, enum gsm48_dtx_mode full, + enum gsm48_dtx_mode half, bool is_bcch) +{ + if (is_bcch) { + switch (full) { + case GSM48_DTX_MAY_BE_USED: + op->dtx = 0; + return; + case GSM48_DTX_SHALL_BE_USED: + op->dtx = 1; + return; + case GSM48_DTX_SHALL_NOT_BE_USED: + op->dtx = 2; + return; + } + } else { + switch (full) { + case GSM48_DTX_MAY_BE_USED: + op->dtx = (half == GSM48_DTX_SHALL_BE_USED) ? 3 : 0; + op->d = (half == GSM48_DTX_SHALL_NOT_BE_USED) ? 0 : 1; + return; + case GSM48_DTX_SHALL_BE_USED: + op->dtx = (half == GSM48_DTX_MAY_BE_USED) ? 3 : 1; + op->d = (half == GSM48_DTX_SHALL_BE_USED) ? 1 : 0; + return; + case GSM48_DTX_SHALL_NOT_BE_USED: + op->dtx = 2; + op->d = (half == GSM48_DTX_SHALL_BE_USED) ? 1 : 0; + return; + } + } +} + int gsm48_generate_mid_from_tmsi(uint8_t *buf, uint32_t tmsi) { uint32_t tmsi_be = htonl(tmsi); diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index e0d9dcb..834e5d6 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -162,6 +162,8 @@ gsm48_number_of_paging_subchannels; gsm48_parse_ra; gsm48_rr_att_tlvdef; +gsm48_set_dtx; +gsm48_dtx_mode; gsm48_mi_type_name; gsm48_mcc_mnc_to_bcd; gsm48_mcc_mnc_from_bcd;