aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-03-02 01:58:00 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-03-03 16:58:54 +0700
commit03fba6ddf04f386a613c26759d8ee248ecfe137a (patch)
tree9f7232fd55edbc45f3578245e9254fd7928edb56
parentbab6a5f74958fc2ab952b1adce1809cc4e6edb54 (diff)
bitvec2freq_list(): fix handling of E-GSM ARFCNs
According to 3GPP TS 44.018, section 10.5.2.1b.2, only ARFCN values in range 1..124 can be encoded using the 'bit map 0' format. Before this patch, ARFCN values belonging to E-GSM band (0, 975..1023) were ignored in bitvec2freq_list(), and thus not present in the resulting Cell Channel Description IE. Change-Id: I17739e6845cd84e2a81bc406dd532541f7c52cb6 Related: SYS#5854
-rw-r--r--src/osmo-bsc/system_information.c27
-rw-r--r--tests/gsm0408/gsm0408_test.ok2
2 files changed, 19 insertions, 10 deletions
diff --git a/src/osmo-bsc/system_information.c b/src/osmo-bsc/system_information.c
index 7ec613c41..20685a9fa 100644
--- a/src/osmo-bsc/system_information.c
+++ b/src/osmo-bsc/system_information.c
@@ -504,20 +504,29 @@ static int bitvec2freq_list(uint8_t *chan_list, const struct bitvec *bv,
bool pgsm = false;
memset(chan_list, 0, 16);
- if (bts->band == GSM_BAND_900
- && bts->c0->arfcn >= 1 && bts->c0->arfcn <= 124)
+ /* According to 3GPP TS 44.018, section 10.5.2.1b.2, only ARFCN values
+ * in range 1..124 can be encoded using the 'bit map 0' format. */
+ if (bts->band == GSM_BAND_900)
pgsm = true;
+ /* Check presence of E-GSM ARFCN 0 */
+ if (pgsm && bitvec_get_bit_pos(bv, 0) == ONE)
+ pgsm = false;
+ /* Check presence of E-GSM ARFCNs 975..1023 */
+ for (i = 975; pgsm && i <= 1023; i++) {
+ if (bitvec_get_bit_pos(bv, i) == ONE)
+ pgsm = false;
+ }
+
/* P-GSM-only handsets only support 'bit map 0 format' */
if (!bis && !ter && pgsm) {
chan_list[0] = 0;
- for (i = 0; i < bv->data_len*8; i++) {
- if (i >= 1 && i <= 124
- && bitvec_get_bit_pos(bv, i)) {
- rc = freq_list_bm0_set_arfcn(chan_list, i);
- if (rc < 0)
- return rc;
- }
+ for (i = 1; i <= 124; i++) {
+ if (!bitvec_get_bit_pos(bv, i))
+ continue;
+ rc = freq_list_bm0_set_arfcn(chan_list, i);
+ if (rc < 0)
+ return rc;
}
return 0;
}
diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok
index 38b5b4bc0..264a9c774 100644
--- a/tests/gsm0408/gsm0408_test.ok
+++ b/tests/gsm0408/gsm0408_test.ok
@@ -247,6 +247,6 @@ BTS allocation OK in test_cell_chan_desc()
Testing generation of the Cell Channel Description IE:
Case a) only the BCCH carrier: 10
Case b) more carriers from P-GSM band: 1 3 10 64 99 124
-Case c) more carriers from E-GSM band: 1 3 10 64 99 124
+Case c) more carriers from E-GSM band: 0 3 10 64 99 124 975 1001 1023
BTS deallocated OK in test_cell_chan_desc()
Done.