From 69e9c0dfc6cc10c07d03f8800d8ff7197fe97c8b Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 18 May 2016 13:04:47 +0200 Subject: 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 Reviewed-on: https://gerrit.osmocom.org/81 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther --- openbsc/tests/gsm0408/gsm0408_test.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'openbsc/tests/gsm0408/gsm0408_test.c') diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 92626670c..7acc93f96 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,15 @@ static inline void add_arfcn_b(struct osmo_earfcn_si2q *e, uint16_t earfcn, static inline void gen(struct gsm_bts *bts) { + bts->si_valid = 0; + bts->si_valid |= (1 << SYSINFO_TYPE_2quater); + /* should be no-op as entire buffer is filled with padding: */ + memset(bts->si_buf[SYSINFO_TYPE_2quater], 0xAE, GSM_MACBLOCK_LEN); 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 +129,9 @@ static inline void test_si2q_u(void) exit(1); bts = gsm_bts_alloc(network); + /* first generate invalid SI as no UARFCN added */ + gen(bts); + /* subsequent calls should produce valid SI if there's enough memory */ _bts_uarfcn_add(bts, 1982, 13, 1); _bts_uarfcn_add(bts, 1982, 44, 0); _bts_uarfcn_add(bts, 1982, 61, 1); @@ -155,7 +164,9 @@ static inline void test_si2q_e(void) bts->si_common.si2quater_neigh_list.thresh_hi = 5; osmo_earfcn_init(&bts->si_common.si2quater_neigh_list); - + /* first generate invalid SI as no EARFCN added */ + gen(bts); + /* subsequent calls should produce valid SI if there's enough memory */ add_arfcn_b(&bts->si_common.si2quater_neigh_list, 1917, 1); gen(bts); -- cgit v1.2.3