From patchwork Wed May 25 09:30:32 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: 626080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 3rF6TC2mKzz9sds for ; Wed, 25 May 2016 19:30:38 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id C83F26C49; Wed, 25 May 2016 09:30:33 +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 5C0376C41; Wed, 25 May 2016 09:30:32 +0000 (UTC) Date: Wed, 25 May 2016 09:30:32 +0000 From: Max X-Gerrit-MessageType: newpatchset Subject: [PATCH] openbsc[master]: Make si2q scheduling optional X-Gerrit-Change-Id: Ibe997803ffb894133fd4d838410fe735791d414f X-Gerrit-ChangeURL: X-Gerrit-Commit: 7d3fa2799ecc5d2e016897e73e5098978f6a39a4 In-Reply-To: References: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/2.12.2-31-gb331dbd-dirty 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: msuraev@sysmocom.de Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" Message-Id: <20160525093033.C83F26C49@lists.osmocom.org> Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/81 to look at the new patch set (#4). Make si2q scheduling optional Previously si2quater SI messages were always scheduled. Check for neighbor configuration and only schedule si2q when necessary. Add corresponding unit test. Change-Id: Ibe997803ffb894133fd4d838410fe735791d414f Fixes: OS#1727 --- M openbsc/src/libbsc/system_information.c M openbsc/tests/gsm0408/gsm0408_test.c M openbsc/tests/gsm0408/gsm0408_test.ok 3 files changed, 34 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/81/81/4 diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index bf20394..28d5319 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -648,7 +648,7 @@ static int generate_si2quater(uint8_t *output, struct gsm_bts *bts) { - int rc; + int rc, i = MAX_EARFCN_LIST; struct gsm48_system_information_type_2quater *si2q = (struct gsm48_system_information_type_2quater *) output; @@ -667,6 +667,14 @@ if (rc < 0) return rc; + if (bts->si_common.si2quater_neigh_list.arfcn) + for (i = 0; i < MAX_EARFCN_LIST; i++) + if (bts->si_common.si2quater_neigh_list.arfcn[i] != + OSMO_EARFCN_INVALID) + break; + if (!bts->si_common.uarfcn_length && i == MAX_EARFCN_LIST) + bts->si_valid &= ~(1 << SYSINFO_TYPE_2quater); + return sizeof(*si2q) + rc; } diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 9262667..e7c1d7d 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -21,7 +21,7 @@ #include #include #include - +#include #include #include @@ -95,9 +95,13 @@ static inline void gen(struct gsm_bts *bts) { + bts->si_valid = 0; + bts->si_valid |= (1 << SYSINFO_TYPE_2quater); int r = gsm_generate_si(bts, SYSINFO_TYPE_2quater); + bool v = bts->si_valid & (1 << SYSINFO_TYPE_2quater); if (r > 0) - printf("generated SI2quater: [%d] %s\n", r, + printf("generated %s SI2quater: [%d] %s\n", + v ? "valid" : "invalid", r, osmo_hexdump(bts->si_buf[SYSINFO_TYPE_2quater], r)); else printf("failed to generate SI2quater: %s\n", strerror(-r)); @@ -123,6 +127,7 @@ exit(1); bts = gsm_bts_alloc(network); + gen(bts); _bts_uarfcn_add(bts, 1982, 13, 1); _bts_uarfcn_add(bts, 1982, 44, 0); _bts_uarfcn_add(bts, 1982, 61, 1); @@ -155,7 +160,7 @@ bts->si_common.si2quater_neigh_list.thresh_hi = 5; osmo_earfcn_init(&bts->si_common.si2quater_neigh_list); - + gen(bts); add_arfcn_b(&bts->si_common.si2quater_neigh_list, 1917, 1); gen(bts); diff --git a/openbsc/tests/gsm0408/gsm0408_test.ok b/openbsc/tests/gsm0408/gsm0408_test.ok index 7b7a2cc..ebe9476 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.ok +++ b/openbsc/tests/gsm0408/gsm0408_test.ok @@ -63,24 +63,26 @@ Allocated reference: 0 Allocated reference: 1 Testing SYSINFO_TYPE_2quater EARFCN generation: -added EARFCN 1917 - generated SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be c8 50 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b -added EARFCN 1932 - generated SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be cc 1e 30 14 03 2b 2b 2b 2b 2b 2b 2b 2b -added EARFCN 1937 - generated SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be cc 1e 31 07 91 a0 a0 2b 2b 2b 2b 2b 2b -added EARFCN 1945 - generated SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be cc 1e 31 07 91 a8 3c c8 28 0b 2b 2b 2b -added EARFCN 1965 - generated SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be cc 1e 31 07 91 a8 3c ca 0f 5a 0a 03 2b +generated invalid SI2quater: [23] 59 06 07 c0 00 04 86 59 0a 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b +added EARFCN 1917 - generated valid SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be c8 50 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b +added EARFCN 1932 - generated valid SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be cc 1e 30 14 03 2b 2b 2b 2b 2b 2b 2b 2b +added EARFCN 1937 - generated valid SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be cc 1e 31 07 91 a0 a0 2b 2b 2b 2b 2b 2b +added EARFCN 1945 - generated valid SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be cc 1e 31 07 91 a8 3c c8 28 0b 2b 2b 2b +added EARFCN 1965 - generated valid SI2quater: [23] 59 06 07 c0 00 04 86 59 83 be cc 1e 31 07 91 a8 3c ca 0f 5a 0a 03 2b added EARFCN 1967 - failed to generate SI2quater: Cannot allocate memory added EARFCN 1982 - failed to generate SI2quater: Cannot allocate memory Testing SYSINFO_TYPE_2quater UARFCN generation: -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 0c 1a 10 99 64 00 0b 2b 2b 2b 2b 2b 2b 2b 2b -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 14 1a 1f 00 44 b2 00 03 2b 2b 2b 2b 2b 2b 2b -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 18 58 12 f0 84 86 59 00 03 2b 2b 2b 2b 2b 2b -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 20 58 2e f0 f2 04 86 59 00 03 2b 2b 2b 2b 2b -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 28 58 2e 22 f2 4e 84 86 59 00 03 2b 2b 2b 2b -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 34 1a 64 26 5d f2 05 04 86 59 00 03 2b 2b 2b -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 38 58 12 22 fd ce 8e 05 04 86 59 00 03 2b 2b -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 40 58 1d 22 fa ce 88 85 7b 00 44 b2 00 03 2b -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 4c 7a 34 0e 64 77 85 43 55 c8 10 99 64 00 0b +generated invalid SI2quater: [23] 59 06 07 c0 00 04 86 59 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 0c 1a 10 99 64 00 0b 2b 2b 2b 2b 2b 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 14 1a 1f 00 44 b2 00 03 2b 2b 2b 2b 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 18 58 12 f0 84 86 59 00 03 2b 2b 2b 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 20 58 2e f0 f2 04 86 59 00 03 2b 2b 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 28 58 2e 22 f2 4e 84 86 59 00 03 2b 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 34 1a 64 26 5d f2 05 04 86 59 00 03 2b 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 38 58 12 22 fd ce 8e 05 04 86 59 00 03 2b 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 40 58 1d 22 fa ce 88 85 7b 00 44 b2 00 03 2b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 4c 7a 34 0e 64 77 85 43 55 c8 10 99 64 00 0b failed to add UARFCN to SI2quater: No space left on device failed to add UARFCN to SI2quater: No space left on device -generated SI2quater: [23] 59 06 07 c0 00 25 0f 7c 4c 7a 34 0e 64 77 85 43 55 c8 10 99 64 00 0b +generated valid SI2quater: [23] 59 06 07 c0 00 25 0f 7c 4c 7a 34 0e 64 77 85 43 55 c8 10 99 64 00 0b Done.