From patchwork Sat May 30 19:42:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Chemeris X-Patchwork-Id: 478487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (tmp.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 51D02140E1E for ; Sun, 31 May 2015 05:42:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nThK1a5J; dkim-atps=neutral Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 166905CC9; Sat, 30 May 2015 19:42:40 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from mail-pd0-x231.google.com (mail-pd0-x231.google.com [IPv6:2607:f8b0:400e:c02::231]) by lists.osmocom.org (Postfix) with ESMTP id AE76E5CC1 for ; Sat, 30 May 2015 19:42:38 +0000 (UTC) Received: by pdbqa5 with SMTP id qa5so77550522pdb.0 for ; Sat, 30 May 2015 12:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:content-type; bh=kXTOpkr6mkoH7MlovEOLxMUTcI2bwSWbuN8aLI1FiPQ=; b=nThK1a5J3bAVI2OMQEyqIGWFC3k29Tohw8/IsmP3Rh5I17nuK5+WFfeWYf6NyahkMd n21N+NZxbQ3lvn3HV/FPEr8VFCesIDD0kEOtqAsx4movKL5Tv7oGADBl7/GiK8V+2buF UUL4cyPYMxUwUdVPBnD22VPsifoo/NXMRNyRtiARH6/4wGPNWWGb6hP1ljQJLCMeKLEx 3D0V2ukmxFzXw58e/4jKDk4S172S7+aRJkV/YxKre6SuJChAQ+kyIwTvkzLUdcIDe5Pn yArUsWWjk6z993B2As6NgvHzk7Twtc+Yvgzq8i8h3oi3AqjmNPmqUqobtYyA94meA58V D6GA== X-Received: by 10.68.221.70 with SMTP id qc6mr26139910pbc.76.1433014957022; Sat, 30 May 2015 12:42:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.66.253.200 with HTTP; Sat, 30 May 2015 12:42:16 -0700 (PDT) From: Alexander Chemeris Date: Sat, 30 May 2015 15:42:16 -0400 X-Google-Sender-Auth: v6keUXxceGvIgorjw6N93Uq-ZMU Message-ID: Subject: [PATCH 1/2] libbsc: Abstract out SIs update/generation for a BTS into a separate function. To: OpenBSC Mailing List 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" The code to do that doesn't belong to the control interface, so abstract it out to a separate function gsm_bts_set_system_infos(). From 235f557b502566e335cd5a71d1272014496d35a1 Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Sat, 30 May 2015 14:40:54 -0400 Subject: [PATCH 1/2] libbsc: Abstract out SIs update/generation for a BTS into a separate function. The code to do that doesn't belong to the control interface, so abstract it out to a separate function gsm_bts_set_system_infos(). --- openbsc/include/openbsc/gsm_data.h | 1 + openbsc/src/libbsc/bsc_ctrl_commands.c | 18 +++++------------- openbsc/src/libbsc/bsc_init.c | 23 ++++++++++++++++++++++- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 30a397c..6f7c8dd 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -438,6 +438,7 @@ void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked); int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat); struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr); int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx); +int gsm_bts_set_system_infos(struct gsm_bts *bts); /* generic E1 line operations for all ISDN-based BTS. */ extern struct e1inp_line_ops bts_isdn_e1inp_line_ops; diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c index 1d91c5f..b6b1c9a 100644 --- a/openbsc/src/libbsc/bsc_ctrl_commands.c +++ b/openbsc/src/libbsc/bsc_ctrl_commands.c @@ -202,20 +202,12 @@ static int get_bts_si(struct ctrl_cmd *cmd, void *data) static int set_bts_si(struct ctrl_cmd *cmd, void *data) { struct gsm_bts *bts = cmd->node; - struct gsm_bts_trx *trx; + int rc; - /* Generate a new ID */ - bts->bcch_change_mark += 1; - bts->bcch_change_mark %= 0x7; - - llist_for_each_entry(trx, &bts->trx_list, list) { - int rc; - - rc = gsm_bts_trx_set_system_infos(trx); - if (rc != 0) { - cmd->reply = "Failed to generate SI"; - return CTRL_CMD_ERROR; - } + rc = gsm_bts_set_system_infos(bts); + if (rc != 0) { + cmd->reply = "Failed to generate SI"; + return CTRL_CMD_ERROR; } cmd->reply = "Generated new System Information"; diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index a59ab3d..fbfec17 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -120,7 +120,7 @@ static int rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i, int si_len) return rc; } -/* set all system information types */ +/* set all system information types for a TRX */ int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx) { int i, rc; @@ -197,6 +197,27 @@ err_out: return rc; } +/* set all system information types for a BTS */ +int gsm_bts_set_system_infos(struct gsm_bts *bts) +{ + struct gsm_bts_trx *trx; + + /* Generate a new ID */ + bts->bcch_change_mark += 1; + bts->bcch_change_mark %= 0x7; + + llist_for_each_entry(trx, &bts->trx_list, list) { + int rc; + + rc = gsm_bts_trx_set_system_infos(trx); + if (rc != 0) { + return rc; + } + } + + return 0; +} + /* Produce a MA as specified in 10.5.2.21 */ static int generate_ma_for_ts(struct gsm_bts_trx_ts *ts) { -- 1.9.1