Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 1 | /* GSM 04.08 System Information (SI) encoding and decoding |
| 2 | * 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0 */ |
| 3 | |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 4 | /* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 9 | * it under the terms of the GNU Affero General Public License as published by |
| 10 | * the Free Software Foundation; either version 3 of the License, or |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 16 | * GNU Affero General Public License for more details. |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 17 | * |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 18 | * You should have received a copy of the GNU Affero General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 20 | * |
| 21 | */ |
| 22 | |
| 23 | #include <errno.h> |
| 24 | #include <string.h> |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 25 | #include <stdio.h> |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 26 | #include <sys/types.h> |
| 27 | #include <netinet/in.h> |
| 28 | |
| 29 | #include <openbsc/gsm_04_08.h> |
| 30 | #include <openbsc/gsm_data.h> |
| 31 | #include <openbsc/abis_rsl.h> |
| 32 | #include <openbsc/rest_octets.h> |
Harald Welte | f4625b1 | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 33 | #include <osmocore/bitvec.h> |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 34 | #include <osmocore/utils.h> |
Harald Welte | e285bad | 2009-12-16 11:57:48 +0100 | [diff] [blame] | 35 | #include <openbsc/debug.h> |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 36 | |
| 37 | #define GSM48_CELL_CHAN_DESC_SIZE 16 |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 38 | #define GSM_MACBLOCK_PADDING 0x2b |
| 39 | |
Holger Hans Peter Freyther | 8526b15 | 2010-01-06 06:38:14 +0100 | [diff] [blame] | 40 | /* verify the sizes of the system information type structs */ |
| 41 | |
| 42 | /* rest octets are not part of the struct */ |
| 43 | static_assert(sizeof(struct gsm48_system_information_type_header) == 3, _si_header_size); |
| 44 | static_assert(sizeof(struct gsm48_rach_control) == 3, _si_rach_control); |
| 45 | static_assert(sizeof(struct gsm48_system_information_type_1) == 22, _si1_size); |
| 46 | static_assert(sizeof(struct gsm48_system_information_type_2) == 23, _si2_size); |
| 47 | static_assert(sizeof(struct gsm48_system_information_type_3) == 19, _si3_size); |
| 48 | static_assert(sizeof(struct gsm48_system_information_type_4) == 13, _si4_size); |
| 49 | |
| 50 | /* bs11 forgot the l2 len, 0-6 rest octets */ |
| 51 | static_assert(sizeof(struct gsm48_system_information_type_5) == 18, _si5_size); |
| 52 | static_assert(sizeof(struct gsm48_system_information_type_6) == 11, _si6_size); |
| 53 | |
| 54 | static_assert(sizeof(struct gsm48_system_information_type_13) == 3, _si13_size); |
| 55 | |
Harald Welte | bc47966 | 2009-12-14 20:25:05 +0100 | [diff] [blame] | 56 | /* Frequency Lists as per TS 04.08 10.5.2.13 */ |
| 57 | |
| 58 | /* 10.5.2.13.2: Bit map 0 format */ |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 59 | static int freq_list_bm0_set_arfcn(u_int8_t *chan_list, unsigned int arfcn) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 60 | { |
| 61 | unsigned int byte, bit; |
| 62 | |
Harald Welte | cf2ec4a | 2009-12-17 23:10:46 +0100 | [diff] [blame] | 63 | if (arfcn > 124 || arfcn < 1) { |
| 64 | LOGP(DRR, LOGL_ERROR, "Bitmap 0 only supports ARFCN 1...124\n"); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 65 | return -EINVAL; |
Harald Welte | cf2ec4a | 2009-12-17 23:10:46 +0100 | [diff] [blame] | 66 | } |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 67 | |
Harald Welte | bc47966 | 2009-12-14 20:25:05 +0100 | [diff] [blame] | 68 | /* the bitmask is from 1..124, not from 0..123 */ |
| 69 | arfcn--; |
| 70 | |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 71 | byte = arfcn / 8; |
| 72 | bit = arfcn % 8; |
| 73 | |
Harald Welte | bc47966 | 2009-12-14 20:25:05 +0100 | [diff] [blame] | 74 | chan_list[GSM48_CELL_CHAN_DESC_SIZE-1-byte] |= (1 << bit); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 75 | |
| 76 | return 0; |
| 77 | } |
| 78 | |
Harald Welte | bc47966 | 2009-12-14 20:25:05 +0100 | [diff] [blame] | 79 | /* 10.5.2.13.7: Variable bit map format */ |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 80 | static int freq_list_bmrel_set_arfcn(u_int8_t *chan_list, unsigned int arfcn) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 81 | { |
| 82 | unsigned int byte, bit; |
| 83 | unsigned int min_arfcn; |
| 84 | unsigned int bitno; |
| 85 | |
| 86 | min_arfcn = (chan_list[0] & 1) << 9; |
| 87 | min_arfcn |= chan_list[1] << 1; |
| 88 | min_arfcn |= (chan_list[2] >> 7) & 1; |
| 89 | |
| 90 | /* The lower end of our bitmaks is always implicitly included */ |
| 91 | if (arfcn == min_arfcn) |
| 92 | return 0; |
| 93 | |
Harald Welte | e285bad | 2009-12-16 11:57:48 +0100 | [diff] [blame] | 94 | if (arfcn < min_arfcn) { |
Harald Welte | cf2ec4a | 2009-12-17 23:10:46 +0100 | [diff] [blame] | 95 | LOGP(DRR, LOGL_ERROR, "arfcn(%u) < min(%u)\n", arfcn, min_arfcn); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 96 | return -EINVAL; |
Harald Welte | e285bad | 2009-12-16 11:57:48 +0100 | [diff] [blame] | 97 | } |
| 98 | if (arfcn > min_arfcn + 111) { |
Harald Welte | cf2ec4a | 2009-12-17 23:10:46 +0100 | [diff] [blame] | 99 | LOGP(DRR, LOGL_ERROR, "arfcn(%u) > min(%u) + 111\n", arfcn, min_arfcn); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 100 | return -EINVAL; |
Harald Welte | e285bad | 2009-12-16 11:57:48 +0100 | [diff] [blame] | 101 | } |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 102 | |
| 103 | bitno = (arfcn - min_arfcn); |
| 104 | byte = bitno / 8; |
| 105 | bit = bitno % 8; |
| 106 | |
| 107 | chan_list[2 + byte] |= 1 << (7 - bit); |
| 108 | |
| 109 | return 0; |
| 110 | } |
| 111 | |
| 112 | /* generate a cell channel list as per Section 10.5.2.1b of 04.08 */ |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 113 | static int bitvec2freq_list(u_int8_t *chan_list, struct bitvec *bv, |
| 114 | const struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 115 | { |
Sylvain Munaut | 40f84a9 | 2009-12-24 14:20:19 +0100 | [diff] [blame] | 116 | int i, rc, min = 1024, max = -1; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 117 | |
| 118 | memset(chan_list, 0, 16); |
| 119 | |
| 120 | /* GSM900-only handsets only support 'bit map 0 format' */ |
| 121 | if (bts->band == GSM_BAND_900) { |
| 122 | chan_list[0] = 0; |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 123 | |
| 124 | for (i = 0; i < bv->data_len*8; i++) { |
| 125 | if (bitvec_get_bit_pos(bv, i)) { |
| 126 | rc = freq_list_bm0_set_arfcn(chan_list, i); |
| 127 | if (rc < 0) |
| 128 | return rc; |
| 129 | } |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 130 | } |
| 131 | return 0; |
| 132 | } |
| 133 | |
| 134 | /* We currently only support the 'Variable bitmap format' */ |
| 135 | chan_list[0] = 0x8e; |
| 136 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 137 | for (i = 0; i < bv->data_len*8; i++) { |
| 138 | if (bitvec_get_bit_pos(bv, i)) { |
| 139 | if (i < min) |
| 140 | min = i; |
| 141 | if (i > max) |
| 142 | max = i; |
| 143 | } |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 144 | } |
| 145 | |
Sylvain Munaut | 40f84a9 | 2009-12-24 14:20:19 +0100 | [diff] [blame] | 146 | if (max == -1) { |
| 147 | /* Empty set, use 'bit map 0 format' */ |
| 148 | chan_list[0] = 0; |
| 149 | return 0; |
| 150 | } |
| 151 | |
Harald Welte | e285bad | 2009-12-16 11:57:48 +0100 | [diff] [blame] | 152 | if ((max - min) > 111) { |
Harald Welte | cf2ec4a | 2009-12-17 23:10:46 +0100 | [diff] [blame] | 153 | LOGP(DRR, LOGL_ERROR, "min_arfcn=%u, max_arfcn=%u, " |
| 154 | "distance > 111\n", min, max); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 155 | return -EINVAL; |
Harald Welte | e285bad | 2009-12-16 11:57:48 +0100 | [diff] [blame] | 156 | } |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 157 | |
| 158 | chan_list[0] |= (min >> 9) & 1; |
| 159 | chan_list[1] = (min >> 1); |
| 160 | chan_list[2] = (min & 1) << 7; |
| 161 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 162 | for (i = 0; i < bv->data_len*8; i++) { |
Harald Welte | e285bad | 2009-12-16 11:57:48 +0100 | [diff] [blame] | 163 | if (bitvec_get_bit_pos(bv, i)) { |
| 164 | rc = freq_list_bmrel_set_arfcn(chan_list, i); |
| 165 | if (rc < 0) |
| 166 | return rc; |
| 167 | } |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | return 0; |
| 171 | } |
| 172 | |
| 173 | /* generate a cell channel list as per Section 10.5.2.1b of 04.08 */ |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 174 | static int generate_cell_chan_list(u_int8_t *chan_list, struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 175 | { |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 176 | struct gsm_bts_trx *trx; |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 177 | struct bitvec *bv = &bts->si_common.cell_alloc; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 178 | |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 179 | /* Zero-initialize the bit-vector */ |
Harald Welte | 439e462 | 2010-06-16 11:09:18 +0200 | [diff] [blame] | 180 | memset(bv->data, 0, bv->data_len); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 181 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 182 | /* first we generate a bitvec of all TRX ARFCN's in our BTS */ |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 183 | llist_for_each_entry(trx, &bts->trx_list, list) { |
| 184 | unsigned int i, j; |
| 185 | /* Always add the TRX's ARFCN */ |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 186 | bitvec_set_bit_pos(bv, trx->arfcn, 1); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 187 | for (i = 0; i < ARRAY_SIZE(trx->ts); i++) { |
| 188 | struct gsm_bts_trx_ts *ts = &trx->ts[i]; |
| 189 | /* Add any ARFCNs present in hopping channels */ |
| 190 | for (j = 0; j < 1024; j++) { |
| 191 | if (bitvec_get_bit_pos(&ts->hopping.arfcns, j)) |
| 192 | bitvec_set_bit_pos(bv, j, 1); |
| 193 | } |
| 194 | } |
| 195 | } |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 196 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 197 | /* then we generate a GSM 04.08 frequency list from the bitvec */ |
| 198 | return bitvec2freq_list(chan_list, bv, bts); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 199 | } |
| 200 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 201 | /* generate a cell channel list as per Section 10.5.2.1b of 04.08 */ |
| 202 | static int generate_bcch_chan_list(u_int8_t *chan_list, struct gsm_bts *bts) |
| 203 | { |
| 204 | struct gsm_bts *cur_bts; |
| 205 | struct bitvec *bv = &bts->si_common.neigh_list; |
| 206 | |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 207 | /* Zero-initialize the bit-vector */ |
Harald Welte | 439e462 | 2010-06-16 11:09:18 +0200 | [diff] [blame] | 208 | memset(bv->data, 0, bv->data_len); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 209 | |
Harald Welte | ca46eff | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 210 | /* Generate list of neighbor cells if we are in automatic mode */ |
| 211 | if (bts->neigh_list_manual_mode == 0) { |
| 212 | /* first we generate a bitvec of the BCCH ARFCN's in our BSC */ |
| 213 | llist_for_each_entry(cur_bts, &bts->network->bts_list, list) { |
| 214 | if (cur_bts == bts) |
| 215 | continue; |
| 216 | bitvec_set_bit_pos(bv, cur_bts->c0->arfcn, 1); |
| 217 | } |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | /* then we generate a GSM 04.08 frequency list from the bitvec */ |
| 221 | return bitvec2freq_list(chan_list, bv, bts); |
| 222 | } |
| 223 | |
| 224 | static int generate_si1(u_int8_t *output, struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 225 | { |
| 226 | int rc; |
| 227 | struct gsm48_system_information_type_1 *si1 = |
| 228 | (struct gsm48_system_information_type_1 *) output; |
| 229 | |
| 230 | memset(si1, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); |
| 231 | |
| 232 | si1->header.l2_plen = (21 << 2) | 1; |
| 233 | si1->header.rr_protocol_discriminator = GSM48_PDISC_RR; |
| 234 | si1->header.skip_indicator = 0; |
| 235 | si1->header.system_information = GSM48_MT_RR_SYSINFO_1; |
| 236 | |
| 237 | rc = generate_cell_chan_list(si1->cell_channel_description, bts); |
| 238 | if (rc < 0) |
| 239 | return rc; |
| 240 | |
| 241 | si1->rach_control = bts->si_common.rach_control; |
| 242 | |
| 243 | /* SI1 Rest Octets (10.5.2.32), contains NCH position */ |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 244 | rc = rest_octets_si1(si1->rest_octets, NULL); |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 245 | |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 246 | return sizeof(*si1) + rc; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 247 | } |
| 248 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 249 | static int generate_si2(u_int8_t *output, struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 250 | { |
| 251 | int rc; |
| 252 | struct gsm48_system_information_type_2 *si2 = |
| 253 | (struct gsm48_system_information_type_2 *) output; |
| 254 | |
| 255 | memset(si2, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); |
| 256 | |
| 257 | si2->header.l2_plen = (22 << 2) | 1; |
| 258 | si2->header.rr_protocol_discriminator = GSM48_PDISC_RR; |
| 259 | si2->header.skip_indicator = 0; |
| 260 | si2->header.system_information = GSM48_MT_RR_SYSINFO_2; |
| 261 | |
| 262 | rc = generate_bcch_chan_list(si2->bcch_frequency_list, bts); |
| 263 | if (rc < 0) |
| 264 | return rc; |
| 265 | |
| 266 | si2->ncc_permitted = bts->si_common.ncc_permitted; |
| 267 | si2->rach_control = bts->si_common.rach_control; |
| 268 | |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 269 | return sizeof(*si2); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 270 | } |
| 271 | |
Harald Welte | e050010 | 2010-03-14 23:46:48 +0800 | [diff] [blame] | 272 | static struct gsm48_si_ro_info si_info = { |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 273 | .selection_params = { |
| 274 | .present = 0, |
| 275 | }, |
| 276 | .power_offset = { |
| 277 | .present = 0, |
| 278 | }, |
| 279 | .si2ter_indicator = 0, |
| 280 | .early_cm_ctrl = 1, |
| 281 | .scheduling = { |
| 282 | .present = 0, |
| 283 | }, |
| 284 | .gprs_ind = { |
| 285 | .si13_position = 0, |
| 286 | .ra_colour = 0, |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 287 | .present = 1, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 288 | }, |
| 289 | .lsa_params = { |
| 290 | .present = 0, |
| 291 | }, |
| 292 | .cell_id = 0, /* FIXME: doesn't the bts have this? */ |
| 293 | .break_ind = 0, |
| 294 | }; |
| 295 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 296 | static int generate_si3(u_int8_t *output, struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 297 | { |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 298 | int rc; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 299 | struct gsm48_system_information_type_3 *si3 = |
| 300 | (struct gsm48_system_information_type_3 *) output; |
| 301 | |
| 302 | memset(si3, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); |
| 303 | |
| 304 | si3->header.l2_plen = (18 << 2) | 1; |
| 305 | si3->header.rr_protocol_discriminator = GSM48_PDISC_RR; |
| 306 | si3->header.skip_indicator = 0; |
| 307 | si3->header.system_information = GSM48_MT_RR_SYSINFO_3; |
| 308 | |
| 309 | si3->cell_identity = htons(bts->cell_identity); |
Harald Welte | d8493ac | 2010-03-04 10:55:40 +0100 | [diff] [blame] | 310 | gsm48_generate_lai(&si3->lai, bts->network->country_code, |
| 311 | bts->network->network_code, |
| 312 | bts->location_area_code); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 313 | si3->control_channel_desc = bts->si_common.chan_desc; |
| 314 | si3->cell_options = bts->si_common.cell_options; |
| 315 | si3->cell_sel_par = bts->si_common.cell_sel_par; |
| 316 | si3->rach_control = bts->si_common.rach_control; |
| 317 | |
| 318 | /* SI3 Rest Octets (10.5.2.34), containing |
| 319 | CBQ, CELL_RESELECT_OFFSET, TEMPORARY_OFFSET, PENALTY_TIME |
| 320 | Power Offset, 2ter Indicator, Early Classmark Sending, |
| 321 | Scheduling if and WHERE, GPRS Indicator, SI13 position */ |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 322 | rc = rest_octets_si3(si3->rest_octets, &si_info); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 323 | |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 324 | return sizeof(*si3) + rc; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 325 | } |
| 326 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 327 | static int generate_si4(u_int8_t *output, struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 328 | { |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 329 | int rc; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 330 | struct gsm48_system_information_type_4 *si4 = |
| 331 | (struct gsm48_system_information_type_4 *) output; |
| 332 | |
| 333 | /* length of all IEs present except SI4 rest octets and l2_plen */ |
| 334 | int l2_plen = sizeof(*si4) - 1; |
| 335 | |
| 336 | memset(si4, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); |
| 337 | |
| 338 | si4->header.rr_protocol_discriminator = GSM48_PDISC_RR; |
| 339 | si4->header.skip_indicator = 0; |
| 340 | si4->header.system_information = GSM48_MT_RR_SYSINFO_4; |
| 341 | |
Harald Welte | d8493ac | 2010-03-04 10:55:40 +0100 | [diff] [blame] | 342 | gsm48_generate_lai(&si4->lai, bts->network->country_code, |
| 343 | bts->network->network_code, |
| 344 | bts->location_area_code); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 345 | si4->cell_sel_par = bts->si_common.cell_sel_par; |
| 346 | si4->rach_control = bts->si_common.rach_control; |
| 347 | |
| 348 | /* Optional: CBCH Channel Description + CBCH Mobile Allocation */ |
| 349 | |
| 350 | si4->header.l2_plen = (l2_plen << 2) | 1; |
| 351 | |
| 352 | /* SI4 Rest Octets (10.5.2.35), containing |
| 353 | Optional Power offset, GPRS Indicator, |
| 354 | Cell Identity, LSA ID, Selection Parameter */ |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 355 | rc = rest_octets_si4(si4->data, &si_info); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 356 | |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 357 | return sizeof(*si4) + rc; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 358 | } |
| 359 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 360 | static int generate_si5(u_int8_t *output, struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 361 | { |
Harald Welte | 2a92a71 | 2009-12-19 21:26:54 +0100 | [diff] [blame] | 362 | struct gsm48_system_information_type_5 *si5; |
| 363 | int rc, l2_plen = 18; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 364 | |
Holger Hans Peter Freyther | 4f2ace4 | 2010-01-06 07:52:55 +0100 | [diff] [blame] | 365 | memset(output, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); |
| 366 | |
Harald Welte | 2a92a71 | 2009-12-19 21:26:54 +0100 | [diff] [blame] | 367 | /* ip.access nanoBTS needs l2_plen!! */ |
| 368 | if (is_ipaccess_bts(bts)) { |
| 369 | *output++ = (l2_plen << 2) | 1; |
| 370 | l2_plen++; |
| 371 | } |
| 372 | |
| 373 | si5 = (struct gsm48_system_information_type_5 *) output; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 374 | |
| 375 | /* l2 pseudo length, not part of msg: 18 */ |
| 376 | si5->rr_protocol_discriminator = GSM48_PDISC_RR; |
| 377 | si5->skip_indicator = 0; |
| 378 | si5->system_information = GSM48_MT_RR_SYSINFO_5; |
| 379 | rc = generate_bcch_chan_list(si5->bcch_frequency_list, bts); |
| 380 | if (rc < 0) |
| 381 | return rc; |
| 382 | |
| 383 | /* 04.08 9.1.37: L2 Pseudo Length of 18 */ |
Harald Welte | 2a92a71 | 2009-12-19 21:26:54 +0100 | [diff] [blame] | 384 | return l2_plen; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 385 | } |
| 386 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 387 | static int generate_si6(u_int8_t *output, struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 388 | { |
Harald Welte | 2a92a71 | 2009-12-19 21:26:54 +0100 | [diff] [blame] | 389 | struct gsm48_system_information_type_6 *si6; |
| 390 | int l2_plen = 11; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 391 | |
Holger Hans Peter Freyther | 4f2ace4 | 2010-01-06 07:52:55 +0100 | [diff] [blame] | 392 | memset(output, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); |
| 393 | |
Harald Welte | 2a92a71 | 2009-12-19 21:26:54 +0100 | [diff] [blame] | 394 | /* ip.access nanoBTS needs l2_plen!! */ |
| 395 | if (is_ipaccess_bts(bts)) { |
| 396 | *output++ = (l2_plen << 2) | 1; |
| 397 | l2_plen++; |
| 398 | } |
| 399 | |
| 400 | si6 = (struct gsm48_system_information_type_6 *) output; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 401 | |
| 402 | /* l2 pseudo length, not part of msg: 11 */ |
| 403 | si6->rr_protocol_discriminator = GSM48_PDISC_RR; |
| 404 | si6->skip_indicator = 0; |
| 405 | si6->system_information = GSM48_MT_RR_SYSINFO_6; |
| 406 | si6->cell_identity = htons(bts->cell_identity); |
Harald Welte | d8493ac | 2010-03-04 10:55:40 +0100 | [diff] [blame] | 407 | gsm48_generate_lai(&si6->lai, bts->network->country_code, |
| 408 | bts->network->network_code, |
| 409 | bts->location_area_code); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 410 | si6->cell_options = bts->si_common.cell_options; |
| 411 | si6->ncc_permitted = bts->si_common.ncc_permitted; |
| 412 | |
| 413 | /* SI6 Rest Octets: 10.5.2.35a: PCH / NCH info, VBS/VGCS options */ |
| 414 | |
Harald Welte | 2a92a71 | 2009-12-19 21:26:54 +0100 | [diff] [blame] | 415 | return l2_plen; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 416 | } |
| 417 | |
| 418 | static struct gsm48_si13_info si13_default = { |
| 419 | .cell_opts = { |
Harald Welte | b064471 | 2010-06-02 12:19:21 +0200 | [diff] [blame] | 420 | .nmo = GPRS_NMO_II, |
Harald Welte | a9713bf | 2010-05-31 12:54:23 +0200 | [diff] [blame] | 421 | .t3168 = 2000, |
| 422 | .t3192 = 200, |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 423 | .drx_timer_max = 3, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 424 | .bs_cv_max = 15, |
Harald Welte | a9713bf | 2010-05-31 12:54:23 +0200 | [diff] [blame] | 425 | .ext_info_present = 1, |
Harald Welte | 3ce9a0d | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 426 | .ext_info = { |
| 427 | /* The values below are just guesses ! */ |
Harald Welte | 09faa06 | 2010-04-18 15:53:40 +0200 | [diff] [blame] | 428 | .egprs_supported = 0, |
Harald Welte | 3ce9a0d | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 429 | .use_egprs_p_ch_req = 1, |
Harald Welte | a9713bf | 2010-05-31 12:54:23 +0200 | [diff] [blame] | 430 | .bep_period = 5, |
Harald Welte | 3ce9a0d | 2010-04-18 14:49:05 +0200 | [diff] [blame] | 431 | .pfc_supported = 0, |
| 432 | .dtm_supported = 0, |
| 433 | .bss_paging_coordination = 0, |
| 434 | }, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 435 | }, |
| 436 | .pwr_ctrl_pars = { |
| 437 | .alpha = 10, /* a = 1.0 */ |
Harald Welte | a9713bf | 2010-05-31 12:54:23 +0200 | [diff] [blame] | 438 | .t_avg_w = 16, |
| 439 | .t_avg_t = 16, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 440 | .pc_meas_chan = 0, /* downling measured on CCCH */ |
Harald Welte | a9713bf | 2010-05-31 12:54:23 +0200 | [diff] [blame] | 441 | .n_avg_i = 8, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 442 | }, |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 443 | .bcch_change_mark = 1, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 444 | .si_change_field = 0, |
| 445 | .pbcch_present = 0, |
| 446 | { |
| 447 | .no_pbcch = { |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 448 | .rac = 0, /* needs to be patched */ |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 449 | .spgc_ccch_sup = 0, |
| 450 | .net_ctrl_ord = 0, |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 451 | .prio_acc_thr = 6, |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 452 | }, |
| 453 | }, |
| 454 | }; |
| 455 | |
Harald Welte | 6ae6467 | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 456 | static int generate_si13(u_int8_t *output, struct gsm_bts *bts) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 457 | { |
| 458 | struct gsm48_system_information_type_13 *si13 = |
| 459 | (struct gsm48_system_information_type_13 *) output; |
| 460 | int ret; |
| 461 | |
| 462 | memset(si13, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); |
| 463 | |
| 464 | si13->header.rr_protocol_discriminator = GSM48_PDISC_RR; |
| 465 | si13->header.skip_indicator = 0; |
| 466 | si13->header.system_information = GSM48_MT_RR_SYSINFO_13; |
| 467 | |
Harald Welte | 3055e33 | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 468 | si13_default.no_pbcch.rac = bts->gprs.rac; |
| 469 | |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 470 | ret = rest_octets_si13(si13->rest_octets, &si13_default); |
| 471 | if (ret < 0) |
| 472 | return ret; |
| 473 | |
Holger Hans Peter Freyther | 6c84d70 | 2010-06-16 12:05:56 +0800 | [diff] [blame] | 474 | /* length is coded in bit 2 an up */ |
| 475 | si13->header.l2_plen = 0x01; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 476 | |
Holger Hans Peter Freyther | 02c608c | 2010-01-06 07:52:31 +0100 | [diff] [blame] | 477 | return sizeof (*si13) + ret; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 478 | } |
| 479 | |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 480 | static const uint8_t sitype2rsl[_MAX_SYSINFO_TYPE] = { |
| 481 | [SYSINFO_TYPE_1] = RSL_SYSTEM_INFO_1, |
| 482 | [SYSINFO_TYPE_2] = RSL_SYSTEM_INFO_2, |
| 483 | [SYSINFO_TYPE_3] = RSL_SYSTEM_INFO_3, |
| 484 | [SYSINFO_TYPE_4] = RSL_SYSTEM_INFO_4, |
| 485 | [SYSINFO_TYPE_5] = RSL_SYSTEM_INFO_5, |
| 486 | [SYSINFO_TYPE_6] = RSL_SYSTEM_INFO_6, |
| 487 | [SYSINFO_TYPE_7] = RSL_SYSTEM_INFO_7, |
| 488 | [SYSINFO_TYPE_8] = RSL_SYSTEM_INFO_8, |
| 489 | [SYSINFO_TYPE_9] = RSL_SYSTEM_INFO_9, |
| 490 | [SYSINFO_TYPE_10] = RSL_SYSTEM_INFO_10, |
| 491 | [SYSINFO_TYPE_13] = RSL_SYSTEM_INFO_13, |
| 492 | [SYSINFO_TYPE_16] = RSL_SYSTEM_INFO_16, |
| 493 | [SYSINFO_TYPE_17] = RSL_SYSTEM_INFO_17, |
| 494 | [SYSINFO_TYPE_18] = RSL_SYSTEM_INFO_18, |
| 495 | [SYSINFO_TYPE_19] = RSL_SYSTEM_INFO_19, |
| 496 | [SYSINFO_TYPE_20] = RSL_SYSTEM_INFO_20, |
| 497 | [SYSINFO_TYPE_2bis] = RSL_SYSTEM_INFO_2bis, |
| 498 | [SYSINFO_TYPE_2ter] = RSL_SYSTEM_INFO_2ter, |
| 499 | [SYSINFO_TYPE_2quater] = RSL_SYSTEM_INFO_2quater, |
| 500 | [SYSINFO_TYPE_5bis] = RSL_SYSTEM_INFO_5bis, |
| 501 | [SYSINFO_TYPE_5ter] = RSL_SYSTEM_INFO_5ter, |
| 502 | }; |
| 503 | |
| 504 | static const uint8_t rsl2sitype[0xff] = { |
| 505 | [RSL_SYSTEM_INFO_1] = SYSINFO_TYPE_1, |
| 506 | [RSL_SYSTEM_INFO_2] = SYSINFO_TYPE_2, |
| 507 | [RSL_SYSTEM_INFO_3] = SYSINFO_TYPE_3, |
| 508 | [RSL_SYSTEM_INFO_4] = SYSINFO_TYPE_4, |
| 509 | [RSL_SYSTEM_INFO_5] = SYSINFO_TYPE_5, |
| 510 | [RSL_SYSTEM_INFO_6] = SYSINFO_TYPE_6, |
Harald Welte | 37dfea4 | 2010-07-30 11:11:38 +0200 | [diff] [blame] | 511 | [RSL_SYSTEM_INFO_7] = SYSINFO_TYPE_7, |
| 512 | [RSL_SYSTEM_INFO_8] = SYSINFO_TYPE_8, |
| 513 | [RSL_SYSTEM_INFO_9] = SYSINFO_TYPE_9, |
| 514 | [RSL_SYSTEM_INFO_10] = SYSINFO_TYPE_10, |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 515 | [RSL_SYSTEM_INFO_13] = SYSINFO_TYPE_13, |
Harald Welte | 37dfea4 | 2010-07-30 11:11:38 +0200 | [diff] [blame] | 516 | [RSL_SYSTEM_INFO_16] = SYSINFO_TYPE_16, |
| 517 | [RSL_SYSTEM_INFO_17] = SYSINFO_TYPE_17, |
| 518 | [RSL_SYSTEM_INFO_18] = SYSINFO_TYPE_18, |
| 519 | [RSL_SYSTEM_INFO_19] = SYSINFO_TYPE_19, |
| 520 | [RSL_SYSTEM_INFO_20] = SYSINFO_TYPE_20, |
| 521 | [RSL_SYSTEM_INFO_2bis] = SYSINFO_TYPE_2bis, |
| 522 | [RSL_SYSTEM_INFO_2ter] = SYSINFO_TYPE_2ter, |
| 523 | [RSL_SYSTEM_INFO_2quater] = SYSINFO_TYPE_2quater, |
| 524 | [RSL_SYSTEM_INFO_5bis] = SYSINFO_TYPE_5bis, |
| 525 | [RSL_SYSTEM_INFO_5ter] = SYSINFO_TYPE_5ter, |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 526 | }; |
| 527 | |
| 528 | typedef int (*gen_si_fn_t)(uint8_t *output, struct gsm_bts *bts); |
| 529 | |
| 530 | static const gen_si_fn_t gen_si_fn[_MAX_SYSINFO_TYPE] = { |
| 531 | [SYSINFO_TYPE_1] = &generate_si1, |
| 532 | [SYSINFO_TYPE_2] = &generate_si2, |
| 533 | [SYSINFO_TYPE_3] = &generate_si3, |
| 534 | [SYSINFO_TYPE_4] = &generate_si4, |
| 535 | [SYSINFO_TYPE_5] = &generate_si5, |
| 536 | [SYSINFO_TYPE_6] = &generate_si6, |
| 537 | [SYSINFO_TYPE_13] = &generate_si13, |
| 538 | }; |
| 539 | |
Harald Welte | 37dfea4 | 2010-07-30 11:11:38 +0200 | [diff] [blame] | 540 | const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE] = { |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 541 | { SYSINFO_TYPE_1, "1" }, |
| 542 | { SYSINFO_TYPE_2, "2" }, |
| 543 | { SYSINFO_TYPE_3, "3" }, |
| 544 | { SYSINFO_TYPE_4, "4" }, |
| 545 | { SYSINFO_TYPE_5, "5" }, |
| 546 | { SYSINFO_TYPE_6, "6" }, |
| 547 | { SYSINFO_TYPE_7, "7" }, |
| 548 | { SYSINFO_TYPE_8, "8" }, |
| 549 | { SYSINFO_TYPE_9, "9" }, |
| 550 | { SYSINFO_TYPE_10, "10" }, |
| 551 | { SYSINFO_TYPE_13, "13" }, |
| 552 | { SYSINFO_TYPE_16, "16" }, |
| 553 | { SYSINFO_TYPE_17, "17" }, |
| 554 | { SYSINFO_TYPE_18, "18" }, |
| 555 | { SYSINFO_TYPE_19, "19" }, |
| 556 | { SYSINFO_TYPE_20, "20" }, |
| 557 | { SYSINFO_TYPE_2bis, "2bis" }, |
| 558 | { SYSINFO_TYPE_2ter, "2ter" }, |
| 559 | { SYSINFO_TYPE_2quater, "2quater" }, |
| 560 | { SYSINFO_TYPE_5bis, "5bis" }, |
| 561 | { SYSINFO_TYPE_5ter, "5ter" }, |
| 562 | { 0, NULL } |
| 563 | }; |
| 564 | |
| 565 | uint8_t gsm_sitype2rsl(enum osmo_sysinfo_type si_type) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 566 | { |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 567 | return sitype2rsl[si_type]; |
| 568 | } |
| 569 | |
| 570 | const char *gsm_sitype_name(enum osmo_sysinfo_type si_type) |
| 571 | { |
Harald Welte | 37dfea4 | 2010-07-30 11:11:38 +0200 | [diff] [blame] | 572 | return get_value_string(osmo_sitype_strs, si_type); |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 573 | } |
| 574 | |
| 575 | int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) |
| 576 | { |
| 577 | gen_si_fn_t gen_si; |
| 578 | |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 579 | switch (bts->gprs.mode) { |
| 580 | case BTS_GPRS_EGPRS: |
Harald Welte | 09faa06 | 2010-04-18 15:53:40 +0200 | [diff] [blame] | 581 | si13_default.cell_opts.ext_info_present = 1; |
| 582 | si13_default.cell_opts.ext_info.egprs_supported = 1; |
| 583 | /* fallthrough */ |
Harald Welte | cb20b7a | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 584 | case BTS_GPRS_GPRS: |
| 585 | si_info.gprs_ind.present = 1; |
| 586 | break; |
| 587 | case BTS_GPRS_NONE: |
| 588 | si_info.gprs_ind.present = 0; |
| 589 | break; |
| 590 | } |
Harald Welte | e050010 | 2010-03-14 23:46:48 +0800 | [diff] [blame] | 591 | |
Sylvain Munaut | 00d7146 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 592 | memcpy(&si_info.selection_params, |
| 593 | &bts->si_common.cell_ro_sel_par, |
| 594 | sizeof(struct gsm48_si_selection_params)); |
| 595 | |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 596 | gen_si = gen_si_fn[si_type]; |
| 597 | if (!gen_si) |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 598 | return -EINVAL; |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 599 | |
Harald Welte | 99bed52 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 600 | return gen_si(bts->si_buf[si_type], bts); |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 601 | } |