From e2b20c4aa855fd295b72e090bd1df6cc12bd5993 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sun, 6 Sep 2020 22:39:52 +0700 Subject: generate_ma_for_ts(): fix: properly encode ARFCN 0 (corner case) According to 3GPP TS 44.018, table 10.5.2.21.1 "Mobile Allocation information element", in the cell allocation frequency list the absolute RF channel numbers are placed in increasing order, except that ARFCN 0, if included in the set, is put in the last position. This basically means that the last bit of the Mobile Allocation (MSB on the wire) corresponds to ARFCN 0, if it's included in the cell allocation frequency list, or the last channel otherwise. Recently introduced TTCN-3 test cases uncover the following problems: a) ARFCN 0 is encoded twice: as MSB and LSB of the bit-mask, b) ARFCN 0 is encoded one bit off its expected location. Change-Id: I264a66a1405e72940a79e9e20ad6ad8f269a7bbc Related: SYS#4868, OS#4545 --- src/osmo-bsc/osmo_bsc_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c index 5aa52cf62..ebae0a22e 100644 --- a/src/osmo-bsc/osmo_bsc_main.c +++ b/src/osmo-bsc/osmo_bsc_main.c @@ -261,7 +261,7 @@ static int generate_ma_for_ts(struct gsm_bts_trx_ts *ts) ts->hopping.ma_len = OSMO_BYTES_FOR_BITS(num_cell_arfcns); n_chan = 0; - for (i = 0; i < 1024; i++) { + for (i = 1; i < 1024; i++) { if (!bitvec_get_bit_pos(cell_chan, i)) continue; /* set the corresponding bit in the MA */ @@ -275,7 +275,6 @@ static int generate_ma_for_ts(struct gsm_bts_trx_ts *ts) /* ARFCN 0 is special: It is coded last in the bitmask */ if (bitvec_get_bit_pos(cell_chan, 0)) { - n_chan++; /* set the corresponding bit in the MA */ bitnum = (ts->hopping.ma_len * 8) - 1 - n_chan; if (bitvec_get_bit_pos(ts_arfcn, 0)) -- cgit v1.2.3