openbsc[master]: libcommon: Fix log output for bts>0.
Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d Gerrit-PatchSet: 4 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
[MERGED] openbsc[master]: libcommon: Fix log output for bts>0.
Harald Welte has submitted this change and it was merged. Change subject: libcommon: Fix log output for bts>0. .. libcommon: Fix log output for bts>0. Fixes regression probably introduced in c696cc28. For bts>0 logging doesn't show bts number correctly when printing lchan identification string - it will always show it as "bts=0". The reason for this is that the identification string is cached before bts->nr value is set to a proper value. This patch sets bts->nr as part of the first step of the bts structure initialization, before caching happens thus making sure the cached identification string is cached with the correct values. Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c M openbsc/tests/channel/channel_test.c M openbsc/tests/channel/channel_test.ok M openbsc/tests/gsm0408/gsm0408_test.c 6 files changed, 44 insertions(+), 10 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4c71a07..369668d 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -900,7 +900,7 @@ }; -struct gsm_bts *gsm_bts_alloc(void *talloc_ctx); +struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num); struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index db7de08..f1049e9 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -286,12 +286,13 @@ if (!model && type != GSM_BTS_TYPE_UNKNOWN) return NULL; - bts = gsm_bts_alloc(net); + bts = gsm_bts_alloc(net, net->num_bts); if (!bts) return NULL; + net->num_bts++; + bts->network = net; - bts->nr = net->num_bts++; bts->type = type; bts->model = model; bts->bsic = bsic; diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 8992636..d792f3b 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -312,7 +312,7 @@ .initial_mcs = 6, }; -struct gsm_bts *gsm_bts_alloc(void *ctx) +struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num) { struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts); int i; @@ -320,6 +320,7 @@ if (!bts) return NULL; + bts->nr = bts_num; bts->num_trx = 0; INIT_LLIST_HEAD(&bts->trx_list); bts->ms_max_power = 15; /* dBm */ diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index 88293d0..cf19aab 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -70,7 +70,7 @@ network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); bts->location_area_code = 23; s_conn.network = network; @@ -91,6 +91,36 @@ OSMO_ASSERT(s_end); } + + +void test_bts_debug_print(void) +{ + struct gsm_network *network; + struct gsm_bts *bts; + struct gsm_bts_trx *trx; + + printf("Testing the lchan printing:"); + + /* Create a dummy network */ + network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); + if (!network) + exit(1); + /* Add a BTS with some reasonanbly non-zero id */ + bts = gsm_bts_alloc(network, 45); + /* Add a second TRX to test on multiple TRXs */ + gsm_bts_trx_alloc(bts); + + llist_for_each_entry(trx, &bts->trx_list, list) { + char *name = gsm_lchan_name(&trx->ts[3].lchan[4]); + + if (name) + printf(" %s", name); + else + printf("NULL name"); + } + printf("\n"); +} + void test_dyn_ts_subslots(void) { @@ -128,6 +158,7 @@ test_request_chan(); test_dyn_ts_subslots(); + test_bts_debug_print(); return EXIT_SUCCESS; } diff --git a/openbsc/tests/channel/channel_test.ok b/openbsc/tests/channel/channel_test.ok index 33c8193..e2e93ef 100644 --- a/openbsc/tests/channel/channel_test.ok +++ b/openbsc/tests/channel/channel_test.ok @@ -1,3 +1,4 @@ Testing the gsm_subscriber chan logic Reached, didn't crash, test passed Testing subslot numbers for pchan types +Testing the lchan printing: (bts=45,trx=0,ts=3,ss=4) (bts=45,trx=1,ts=3,ss=4) diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 5a8c6ca..63b5c7c 100644 --- a/openb
openbsc[master]: libcommon: Fix log output for bts>0.
Patch Set 3: Harald - I've added a test. Hope it's enough. It doesn't look like the build failure is due to my change.. Not sure if I need to do anything? -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
[PATCH] openbsc[master]: libcommon: Fix log output for bts>0.
Hello Max, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3185 to look at the new patch set (#3). libcommon: Fix log output for bts>0. Fixes regression probably introduced in c696cc28. For bts>0 logging doesn't show bts number correctly when printing lchan identification string - it will always show it as "bts=0". The reason for this is that the identification string is cached before bts->nr value is set to a proper value. This patch sets bts->nr as part of the first step of the bts structure initialization, before caching happens thus making sure the cached identification string is cached with the correct values. Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c M openbsc/tests/channel/channel_test.c M openbsc/tests/channel/channel_test.ok M openbsc/tests/gsm0408/gsm0408_test.c 6 files changed, 44 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/3185/3 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4c71a07..369668d 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -900,7 +900,7 @@ }; -struct gsm_bts *gsm_bts_alloc(void *talloc_ctx); +struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num); struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index db7de08..f1049e9 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -286,12 +286,13 @@ if (!model && type != GSM_BTS_TYPE_UNKNOWN) return NULL; - bts = gsm_bts_alloc(net); + bts = gsm_bts_alloc(net, net->num_bts); if (!bts) return NULL; + net->num_bts++; + bts->network = net; - bts->nr = net->num_bts++; bts->type = type; bts->model = model; bts->bsic = bsic; diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 8992636..d792f3b 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -312,7 +312,7 @@ .initial_mcs = 6, }; -struct gsm_bts *gsm_bts_alloc(void *ctx) +struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num) { struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts); int i; @@ -320,6 +320,7 @@ if (!bts) return NULL; + bts->nr = bts_num; bts->num_trx = 0; INIT_LLIST_HEAD(&bts->trx_list); bts->ms_max_power = 15; /* dBm */ diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index 88293d0..cf19aab 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -70,7 +70,7 @@ network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); bts->location_area_code = 23; s_conn.network = network; @@ -91,6 +91,36 @@ OSMO_ASSERT(s_end); } + + +void test_bts_debug_print(void) +{ + struct gsm_network *network; + struct gsm_bts *bts; + struct gsm_bts_trx *trx; + + printf("Testing the lchan printing:"); + + /* Create a dummy network */ + network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); + if (!network) + exit(1); + /* Add a BTS with some reasonanbly non-zero id */ + bts = gsm_bts_alloc(network, 45); + /* Add a second TRX to test on multiple TRXs */ + gsm_bts_trx_alloc(bts); + + llist_for_each_entry(trx, &bts->trx_list, list) { + char *name = gsm_lchan_name(&trx->ts[3].lchan[4]); + + if (name) + printf(" %s", name); + else + printf("NULL name"); + } + printf("\n"); +} + void test_dyn_ts_subslots(void) { @@ -128,6 +158,7 @@ test_request_chan(); test_dyn_ts_subslots(); + test_bts_debug_print(); return EXIT_SUCCESS; } diff --git a/openbsc/tests/channel/channel_test.ok b/openbsc/tests/channel/channel_test.ok index 33c8193..e2e93ef 100644 --- a/openbsc/tests/channel/channel_test.ok +++ b/openbsc/tests/channel/channel_test.ok @@ -1,3 +1,4 @@ Testing the gsm_subscriber chan logic Reached, didn't crash, test passed Testing subslot numbers for pchan types +Testing the lchan printing: (bts=45,trx=0,ts=3,ss=4) (bts=45,trx=1,ts=3,ss=4) diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 5a8c6ca..63b5c7c 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/open
openbsc[master]: libcommon: Fix log output for bts>0.
Patch Set 2: Hi Harald, thank you for a reminder. I'll try to find some time to extend the patch. -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
openbsc[master]: libcommon: Fix log output for bts>0.
Patch Set 2: ping? Alexander, can I motivat you to extend the test case to cover multiple BTSs and their numbers, as requested a month ago? Should be super trivial, AFAICT. -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
openbsc[master]: libcommon: Fix log output for bts>0.
Patch Set 2: (1 comment) > Btw, Harald - any reason we're caching lchan log string, but > doesn't cache pchan log string? We don't print pchan names anywhere nearly as frequently as lchan names. Have you seen the pchan name printing show up in any profiles? We can certainly add it if needed. https://gerrit.osmocom.org/#/c/3185/2/openbsc/tests/channel/channel_test.c File openbsc/tests/channel/channel_test.c: Line 73:bts = gsm_bts_alloc(network, 0); actually, as you're modifying the test case, it would make a lot of sense to extend it to cover the actual situation with multiple BTSs and verifyng that the string contains the right BTS number. -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: Yes
openbsc[master]: libcommon: Fix log output for bts>0.
Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
[PATCH] openbsc[master]: libcommon: Fix log output for bts>0.
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3185 to look at the new patch set (#2). libcommon: Fix log output for bts>0. Fixes regression probably introduced in c696cc28. For bts>0 logging doesn't show bts number correctly when printing lchan identification string - it will always show it as "bts=0". The reason for this is that the identification string is cached before bts->nr value is set to a proper value. This patch sets bts->nr as part of the first step of the bts structure initialization, before caching happens thus making sure the cached identification string is cached with the correct values. Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c M openbsc/tests/channel/channel_test.c M openbsc/tests/gsm0408/gsm0408_test.c 5 files changed, 12 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/3185/2 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4c71a07..369668d 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -900,7 +900,7 @@ }; -struct gsm_bts *gsm_bts_alloc(void *talloc_ctx); +struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num); struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index db7de08..f1049e9 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -286,12 +286,13 @@ if (!model && type != GSM_BTS_TYPE_UNKNOWN) return NULL; - bts = gsm_bts_alloc(net); + bts = gsm_bts_alloc(net, net->num_bts); if (!bts) return NULL; + net->num_bts++; + bts->network = net; - bts->nr = net->num_bts++; bts->type = type; bts->model = model; bts->bsic = bsic; diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 8992636..d792f3b 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -312,7 +312,7 @@ .initial_mcs = 6, }; -struct gsm_bts *gsm_bts_alloc(void *ctx) +struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num) { struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts); int i; @@ -320,6 +320,7 @@ if (!bts) return NULL; + bts->nr = bts_num; bts->num_trx = 0; INIT_LLIST_HEAD(&bts->trx_list); bts->ms_max_power = 15; /* dBm */ diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index 88293d0..77a9da1 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -70,7 +70,7 @@ network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); bts->location_area_code = 23; s_conn.network = network; diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 5a8c6ca..63b5c7c 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -153,7 +153,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); _bts_uarfcn_add(bts, 10564, 319, 0); _bts_uarfcn_add(bts, 10612, 319, 0); @@ -168,7 +168,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); _bts_uarfcn_add(bts, 10564, 318, 0); _bts_uarfcn_add(bts, 10612, 319, 0); @@ -188,7 +188,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); /* first generate invalid SI as no UARFCN added */ gen(bts, __func__); @@ -216,7 +216,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); bts->si_common.si2quater_neigh_list.arfcn = bts->si_common.data.earfcn_list; bts->si_common.si2quater_neigh_list.meas_bw = bts->si_common.data.meas_bw_list; @@ -249,7 +249,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); bts->si_common.si2quater_neigh_list.arfcn = bts->si_common.data.earfcn_list; bts->si_common.si2quater_neigh_list.meas_bw = bts->si_common.data.meas_bw_list; -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: n
openbsc[master]: libcommon: Fix log output for bts>0.
Patch Set 1: Btw, Harald - any reason we're caching lchan log string, but doesn't cache pchan log string? -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] openbsc[master]: libcommon: Fix log output for bts>0.
Review at https://gerrit.osmocom.org/3185 libcommon: Fix log output for bts>0. Fixes regression probably introduced in c696cc28. For bts>0 logging doesn't show bts number correctly when printing lchan identification string - it will always show it as "bts=0". The reason for this is that the identification string is cached before bts->nr value is set to a proper value. This patch sets bts->nr as part of the first step of the bts structure initialization, before caching happens thus making sure the cached identification string is cached with the correct values. Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d --- M openbsc/include/openbsc/gsm_data_shared.h M openbsc/src/libcommon/gsm_data.c M openbsc/src/libcommon/gsm_data_shared.c M openbsc/tests/channel/channel_test.c M openbsc/tests/gsm0408/gsm0408_test.c 5 files changed, 11 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/3185/1 diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 4c71a07..369668d 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -900,7 +900,7 @@ }; -struct gsm_bts *gsm_bts_alloc(void *talloc_ctx); +struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num); struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index db7de08..f1049e9 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -286,12 +286,13 @@ if (!model && type != GSM_BTS_TYPE_UNKNOWN) return NULL; - bts = gsm_bts_alloc(net); + bts = gsm_bts_alloc(net, net->num_bts); if (!bts) return NULL; + net->num_bts++; + bts->network = net; - bts->nr = net->num_bts++; bts->type = type; bts->model = model; bts->bsic = bsic; diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 8992636..d792f3b 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -312,7 +312,7 @@ .initial_mcs = 6, }; -struct gsm_bts *gsm_bts_alloc(void *ctx) +struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num) { struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts); int i; @@ -320,6 +320,7 @@ if (!bts) return NULL; + bts->nr = bts_num; bts->num_trx = 0; INIT_LLIST_HEAD(&bts->trx_list); bts->ms_max_power = 15; /* dBm */ diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index 88293d0..77a9da1 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -70,7 +70,7 @@ network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); bts->location_area_code = 23; s_conn.network = network; diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 5a8c6ca..17ca5bb 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -153,7 +153,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); _bts_uarfcn_add(bts, 10564, 319, 0); _bts_uarfcn_add(bts, 10612, 319, 0); @@ -168,7 +168,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); _bts_uarfcn_add(bts, 10564, 318, 0); _bts_uarfcn_add(bts, 10612, 319, 0); @@ -188,7 +188,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); /* first generate invalid SI as no UARFCN added */ gen(bts, __func__); @@ -216,7 +216,7 @@ if (!network) exit(1); - bts = gsm_bts_alloc(network); + bts = gsm_bts_alloc(network, 0); bts->si_common.si2quater_neigh_list.arfcn = bts->si_common.data.earfcn_list; bts->si_common.si2quater_neigh_list.meas_bw = bts->si_common.data.meas_bw_list; -- To view, visit https://gerrit.osmocom.org/3185 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris