Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 1 | #ifndef _GSM_DATA_SHAREDH |
| 2 | #define _GSM_DATA_SHAREDH |
| 3 | |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 4 | #include <regex.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 5 | #include <stdbool.h> |
| 6 | #include <stdint.h> |
| 7 | |
| 8 | #include <osmocom/core/timer.h> |
| 9 | #include <osmocom/core/bitvec.h> |
| 10 | #include <osmocom/core/statistics.h> |
| 11 | #include <osmocom/core/utils.h> |
| 12 | #include <osmocom/gsm/gsm_utils.h> |
| 13 | #include <osmocom/gsm/tlv.h> |
| 14 | #include <osmocom/gsm/rxlev_stat.h> |
| 15 | #include <osmocom/gsm/sysinfo.h> |
Harald Welte | 7ff4f0e | 2013-03-07 18:38:09 +0000 | [diff] [blame] | 16 | #include <osmocom/gsm/meas_rep.h> |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 17 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 18 | #include <osmocom/gsm/protocol/gsm_08_58.h> |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 19 | #include <osmocom/gsm/protocol/gsm_12_21.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 20 | |
Harald Welte | 0eae613 | 2011-08-24 13:52:07 +0200 | [diff] [blame] | 21 | #include <osmocom/abis/e1_input.h> |
| 22 | |
Holger Hans Peter Freyther | 0e0a09c | 2012-12-20 19:03:18 +0100 | [diff] [blame] | 23 | #ifndef ROLE_BSC |
| 24 | #include <osmocom/gsm/lapdm.h> |
| 25 | #endif |
| 26 | |
Neels Hofmeyr | ac1f143 | 2016-05-10 13:30:17 +0200 | [diff] [blame] | 27 | #include <openbsc/common_cs.h> |
| 28 | |
Holger Hans Peter Freyther | 8ec4952 | 2011-08-15 15:53:00 +0200 | [diff] [blame] | 29 | struct osmo_bsc_data; |
| 30 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 31 | struct osmo_bsc_sccp_con; |
| 32 | struct gsm_sms_queue; |
| 33 | |
| 34 | /* RRLP mode of operation */ |
| 35 | enum rrlp_mode { |
| 36 | RRLP_MODE_NONE, |
| 37 | RRLP_MODE_MS_BASED, |
| 38 | RRLP_MODE_MS_PREF, |
| 39 | RRLP_MODE_ASS_PREF, |
| 40 | }; |
| 41 | |
| 42 | /* Channel Request reason */ |
| 43 | enum gsm_chreq_reason_t { |
| 44 | GSM_CHREQ_REASON_EMERG, |
| 45 | GSM_CHREQ_REASON_PAG, |
| 46 | GSM_CHREQ_REASON_CALL, |
| 47 | GSM_CHREQ_REASON_LOCATION_UPD, |
| 48 | GSM_CHREQ_REASON_OTHER, |
Alexander Couzens | 1136811 | 2016-11-28 23:26:50 +0100 | [diff] [blame] | 49 | GSM_CHREQ_REASON_PDCH, |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 50 | }; |
| 51 | |
Max | 582e4f6 | 2016-10-18 16:19:33 +0200 | [diff] [blame] | 52 | /* lchans 0..3 are SDCCH in combined channel configuration, |
| 53 | use 4 as magic number for BCCH hack - see osmo-bts-../oml.c:opstart_compl() */ |
| 54 | #define CCCH_LCHAN 4 |
| 55 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 56 | #define TRX_NR_TS 8 |
| 57 | #define TS_MAX_LCHAN 8 |
| 58 | |
| 59 | #define HARDCODED_ARFCN 123 |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 60 | #define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */ |
| 61 | |
| 62 | /* for multi-drop config */ |
| 63 | #define HARDCODED_BTS0_TS 1 |
| 64 | #define HARDCODED_BTS1_TS 6 |
| 65 | #define HARDCODED_BTS2_TS 11 |
| 66 | |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 67 | #define MAX_VERSION_LENGTH 64 |
| 68 | |
Max | 7b62d54 | 2017-05-09 15:19:15 +0200 | [diff] [blame] | 69 | #define MAX_BTS_FEATURES 128 |
| 70 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 71 | enum gsm_hooks { |
| 72 | GSM_HOOK_NM_SWLOAD, |
| 73 | GSM_HOOK_RR_PAGING, |
| 74 | GSM_HOOK_RR_SECURITY, |
| 75 | }; |
| 76 | |
| 77 | enum gsm_paging_event { |
| 78 | GSM_PAGING_SUCCEEDED, |
| 79 | GSM_PAGING_EXPIRED, |
| 80 | GSM_PAGING_OOM, |
| 81 | GSM_PAGING_BUSY, |
| 82 | }; |
| 83 | |
| 84 | enum bts_gprs_mode { |
| 85 | BTS_GPRS_NONE = 0, |
| 86 | BTS_GPRS_GPRS = 1, |
| 87 | BTS_GPRS_EGPRS = 2, |
| 88 | }; |
| 89 | |
| 90 | struct gsm_lchan; |
| 91 | struct gsm_subscriber; |
| 92 | struct gsm_mncc; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 93 | struct osmo_rtp_socket; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 94 | struct rtp_socket; |
| 95 | struct bsc_api; |
| 96 | |
| 97 | /* Network Management State */ |
| 98 | struct gsm_nm_state { |
| 99 | uint8_t operational; |
| 100 | uint8_t administrative; |
| 101 | uint8_t availability; |
| 102 | }; |
| 103 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 104 | struct gsm_abis_mo { |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 105 | uint8_t obj_class; |
Holger Hans Peter Freyther | 49976f4 | 2013-11-05 16:06:17 +0100 | [diff] [blame] | 106 | uint8_t procedure_pending; |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 107 | struct abis_om_obj_inst obj_inst; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 108 | const char *name; |
| 109 | struct gsm_nm_state nm_state; |
| 110 | struct tlv_parsed *nm_attr; |
Harald Welte | 32bc116 | 2011-06-06 18:58:48 +0200 | [diff] [blame] | 111 | struct gsm_bts *bts; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 112 | }; |
| 113 | |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 114 | /* Ericsson OM2000 Managed Object */ |
| 115 | struct abis_om2k_mo { |
| 116 | uint8_t class; |
| 117 | uint8_t bts; |
| 118 | uint8_t assoc_so; |
| 119 | uint8_t inst; |
| 120 | } __attribute__ ((packed)); |
| 121 | |
| 122 | struct om2k_mo { |
| 123 | struct abis_om2k_mo addr; |
| 124 | struct osmo_fsm_inst *fsm; |
| 125 | }; |
| 126 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 127 | #define A38_XOR_MIN_KEY_LEN 12 |
| 128 | #define A38_XOR_MAX_KEY_LEN 16 |
| 129 | #define A38_COMP128_KEY_LEN 16 |
| 130 | #define RSL_ENC_ALG_A5(x) (x+1) |
Max | 27c3e76 | 2016-04-20 15:57:12 +0200 | [diff] [blame] | 131 | #define MAX_EARFCN_LIST 32 |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 132 | |
| 133 | /* is the data link established? who established it? */ |
| 134 | #define LCHAN_SAPI_UNUSED 0 |
| 135 | #define LCHAN_SAPI_MS 1 |
| 136 | #define LCHAN_SAPI_NET 2 |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 137 | #define LCHAN_SAPI_REL 3 |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 138 | |
| 139 | /* state of a logical channel */ |
| 140 | enum gsm_lchan_state { |
| 141 | LCHAN_S_NONE, /* channel is not active */ |
Holger Hans Peter Freyther | ded0268 | 2012-01-15 00:02:17 +0100 | [diff] [blame] | 142 | LCHAN_S_ACT_REQ, /* channel activation requested */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 143 | LCHAN_S_ACTIVE, /* channel is active and operational */ |
| 144 | LCHAN_S_REL_REQ, /* channel release has been requested */ |
| 145 | LCHAN_S_REL_ERR, /* channel is in an error state */ |
Holger Hans Peter Freyther | 638da51 | 2012-12-06 19:25:06 +0100 | [diff] [blame] | 146 | LCHAN_S_BROKEN, /* channel is somehow unusable */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 147 | LCHAN_S_INACTIVE, /* channel is set inactive */ |
| 148 | }; |
| 149 | |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 150 | /* BTS ONLY */ |
| 151 | #define MAX_NUM_UL_MEAS 104 |
| 152 | #define LC_UL_M_F_L1_VALID (1 << 0) |
| 153 | #define LC_UL_M_F_RES_VALID (1 << 1) |
| 154 | |
| 155 | struct bts_ul_meas { |
| 156 | /* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */ |
| 157 | uint16_t ber10k; |
| 158 | /* timing advance offset (in quarter bits) */ |
| 159 | int16_t ta_offs_qbits; |
| 160 | /* C/I ratio in dB */ |
| 161 | float c_i; |
| 162 | /* flags */ |
| 163 | uint8_t is_sub:1; |
| 164 | /* RSSI in dBm * -1 */ |
| 165 | uint8_t inv_rssi; |
| 166 | }; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 167 | |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 168 | struct bts_codec_conf { |
| 169 | uint8_t hr; |
| 170 | uint8_t efr; |
| 171 | uint8_t amr; |
| 172 | }; |
| 173 | |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 174 | struct amr_mode { |
| 175 | uint8_t mode; |
Holger Hans Peter Freyther | 615ed46 | 2015-09-24 11:30:58 +0200 | [diff] [blame] | 176 | uint8_t threshold; |
| 177 | uint8_t hysteresis; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 178 | }; |
Holger Hans Peter Freyther | 615ed46 | 2015-09-24 11:30:58 +0200 | [diff] [blame] | 179 | |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 180 | struct amr_multirate_conf { |
| 181 | uint8_t gsm48_ie[2]; |
Holger Hans Peter Freyther | 615ed46 | 2015-09-24 11:30:58 +0200 | [diff] [blame] | 182 | struct amr_mode ms_mode[4]; |
| 183 | struct amr_mode bts_mode[4]; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 184 | uint8_t num_modes; |
| 185 | }; |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 186 | /* /BTS ONLY */ |
| 187 | |
Harald Welte | e422798 | 2012-08-24 15:33:56 +0200 | [diff] [blame] | 188 | enum lchan_csd_mode { |
| 189 | LCHAN_CSD_M_NT, |
| 190 | LCHAN_CSD_M_T_1200_75, |
| 191 | LCHAN_CSD_M_T_600, |
| 192 | LCHAN_CSD_M_T_1200, |
| 193 | LCHAN_CSD_M_T_2400, |
| 194 | LCHAN_CSD_M_T_9600, |
| 195 | LCHAN_CSD_M_T_14400, |
| 196 | LCHAN_CSD_M_T_29000, |
| 197 | LCHAN_CSD_M_T_32000, |
| 198 | }; |
| 199 | |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 200 | /* State of the SAPIs in the lchan */ |
| 201 | enum lchan_sapi_state { |
| 202 | LCHAN_SAPI_S_NONE, |
| 203 | LCHAN_SAPI_S_REQ, |
| 204 | LCHAN_SAPI_S_ASSIGNED, |
| 205 | LCHAN_SAPI_S_REL, |
| 206 | LCHAN_SAPI_S_ERROR, |
| 207 | }; |
| 208 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 209 | struct gsm_lchan { |
| 210 | /* The TS that we're part of */ |
| 211 | struct gsm_bts_trx_ts *ts; |
| 212 | /* The logical subslot number in the TS */ |
| 213 | uint8_t nr; |
| 214 | /* The logical channel type */ |
| 215 | enum gsm_chan_t type; |
| 216 | /* RSL channel mode */ |
| 217 | enum rsl_cmod_spd rsl_cmode; |
| 218 | /* If TCH, traffic channel mode */ |
| 219 | enum gsm48_chan_mode tch_mode; |
Harald Welte | e422798 | 2012-08-24 15:33:56 +0200 | [diff] [blame] | 220 | enum lchan_csd_mode csd_mode; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 221 | /* State */ |
| 222 | enum gsm_lchan_state state; |
Holger Hans Peter Freyther | 454140e | 2014-12-28 12:08:28 +0100 | [diff] [blame] | 223 | const char *broken_reason; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 224 | /* Power levels for MS and BTS */ |
| 225 | uint8_t bs_power; |
| 226 | uint8_t ms_power; |
| 227 | /* Encryption information */ |
Neels Hofmeyr | ac1f143 | 2016-05-10 13:30:17 +0200 | [diff] [blame] | 228 | struct gsm_encr encr; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 229 | |
| 230 | /* AMR bits */ |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 231 | uint8_t mr_ms_lv[7]; |
| 232 | uint8_t mr_bts_lv[7]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 233 | |
| 234 | /* Established data link layer services */ |
| 235 | uint8_t sapis[8]; |
Holger Hans Peter Freyther | b9b828b | 2013-01-01 19:20:28 +0100 | [diff] [blame] | 236 | int sacch_deact; |
Holger Hans Peter Freyther | dfcfe65 | 2011-12-27 20:49:53 +0100 | [diff] [blame] | 237 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 238 | struct { |
| 239 | uint32_t bound_ip; |
| 240 | uint32_t connect_ip; |
| 241 | uint16_t bound_port; |
| 242 | uint16_t connect_port; |
| 243 | uint16_t conn_id; |
| 244 | uint8_t rtp_payload; |
| 245 | uint8_t rtp_payload2; |
| 246 | uint8_t speech_mode; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 247 | #ifdef ROLE_BSC |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 248 | struct rtp_socket *rtp_socket; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 249 | #else |
| 250 | struct osmo_rtp_socket *rtp_socket; |
| 251 | #endif |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 252 | } abis_ip; |
| 253 | |
Harald Welte | 2c1ae47 | 2011-06-26 14:13:37 +0200 | [diff] [blame] | 254 | uint8_t rqd_ta; |
| 255 | |
Harald Welte | c696cc2 | 2015-12-05 16:19:21 +0100 | [diff] [blame] | 256 | char *name; |
| 257 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 258 | #ifdef ROLE_BSC |
| 259 | struct osmo_timer_list T3101; |
Holger Hans Peter Freyther | b348939 | 2011-12-28 16:21:05 +0100 | [diff] [blame] | 260 | struct osmo_timer_list T3109; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 261 | struct osmo_timer_list T3111; |
| 262 | struct osmo_timer_list error_timer; |
Harald Welte | e8bd9e8 | 2011-08-10 23:26:33 +0200 | [diff] [blame] | 263 | struct osmo_timer_list act_timer; |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 264 | struct osmo_timer_list rel_work; |
Holger Hans Peter Freyther | 638da51 | 2012-12-06 19:25:06 +0100 | [diff] [blame] | 265 | uint8_t error_cause; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 266 | |
| 267 | /* table of neighbor cell measurements */ |
| 268 | struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS]; |
| 269 | |
| 270 | /* cache of last measurement reports on this lchan */ |
| 271 | struct gsm_meas_rep meas_rep[6]; |
| 272 | int meas_rep_idx; |
| 273 | |
| 274 | /* GSM Random Access data */ |
| 275 | struct gsm48_req_ref *rqd_ref; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 276 | |
| 277 | struct gsm_subscriber_connection *conn; |
Andreas Eversberg | 9df268e | 2013-10-11 13:32:30 +0200 | [diff] [blame] | 278 | |
| 279 | struct { |
| 280 | /* channel activation type and handover ref */ |
| 281 | uint8_t act_type; |
| 282 | uint8_t ho_ref; |
Neels Hofmeyr | b91e600 | 2016-07-23 19:45:15 +0200 | [diff] [blame] | 283 | struct gsm48_req_ref *rqd_ref; |
| 284 | uint8_t rqd_ta; |
Neels Hofmeyr | 6e999b7 | 2016-07-23 21:00:51 +0200 | [diff] [blame] | 285 | } dyn; |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 286 | #else |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 287 | /* Number of different GsmL1_Sapi_t used in osmo_bts_sysmo is 23. |
| 288 | * Currently we don't share these headers so this is a magic number. */ |
Holger Hans Peter Freyther | 30156e1 | 2013-04-05 18:41:45 +0200 | [diff] [blame] | 289 | struct llist_head sapi_cmds; |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 290 | uint8_t sapis_dl[23]; |
| 291 | uint8_t sapis_ul[23]; |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 292 | struct lapdm_channel lapdm_ch; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 293 | struct llist_head dl_tch_queue; |
Harald Welte | 2c1ae47 | 2011-06-26 14:13:37 +0200 | [diff] [blame] | 294 | struct { |
| 295 | /* bitmask of all SI that are present/valid in si_buf */ |
| 296 | uint32_t valid; |
| 297 | uint32_t last; |
| 298 | /* buffers where we put the pre-computed SI */ |
| 299 | sysinfo_buf_t buf[_MAX_SYSINFO_TYPE]; |
| 300 | } si; |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 301 | struct { |
| 302 | uint8_t flags; |
| 303 | /* RSL measurment result number, 0 at lchan_act */ |
| 304 | uint8_t res_nr; |
| 305 | /* current Tx power level of the BTS */ |
| 306 | uint8_t bts_tx_pwr; |
| 307 | /* number of measurements stored in array below */ |
| 308 | uint8_t num_ul_meas; |
| 309 | struct bts_ul_meas uplink[MAX_NUM_UL_MEAS]; |
| 310 | /* last L1 header from the MS */ |
| 311 | uint8_t l1_info[2]; |
Harald Welte | 7ff4f0e | 2013-03-07 18:38:09 +0000 | [diff] [blame] | 312 | struct gsm_meas_rep_unidir ul_res; |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 313 | } meas; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 314 | struct { |
| 315 | struct amr_multirate_conf amr_mr; |
Harald Welte | 4329099 | 2011-09-07 12:41:38 +0200 | [diff] [blame] | 316 | struct { |
Max | 1e646f0 | 2016-10-05 17:29:02 +0200 | [diff] [blame] | 317 | struct osmo_fsm_inst *dl_amr_fsm; |
Max | 1b76a03 | 2016-10-25 20:22:16 +0200 | [diff] [blame] | 318 | /* TCH cache */ |
Max | 1e646f0 | 2016-10-05 17:29:02 +0200 | [diff] [blame] | 319 | uint8_t cache[20]; |
Max | 1b76a03 | 2016-10-25 20:22:16 +0200 | [diff] [blame] | 320 | /* FACCH cache */ |
| 321 | uint8_t facch[GSM_MACBLOCK_LEN]; |
Harald Welte | 4329099 | 2011-09-07 12:41:38 +0200 | [diff] [blame] | 322 | uint8_t len; |
Max | f5fe31d | 2016-06-10 14:09:07 +0200 | [diff] [blame] | 323 | uint32_t fn; |
| 324 | bool is_update; |
Max | 1e646f0 | 2016-10-05 17:29:02 +0200 | [diff] [blame] | 325 | /* set for each SID frame to detect talkspurt for codecs |
| 326 | without explicit ONSET event */ |
| 327 | bool ul_sid; |
| 328 | /* indicates if DTXd was active during DL measurement |
| 329 | period */ |
| 330 | bool dl_active; |
| 331 | } dtx; |
Holger Hans Peter Freyther | 922ef5d | 2014-07-24 21:05:32 +0200 | [diff] [blame] | 332 | uint8_t last_cmr; |
Max | d7df7ae | 2016-06-03 12:06:26 +0200 | [diff] [blame] | 333 | uint32_t last_fn; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 334 | } tch; |
Max | abf53d8 | 2017-01-25 16:19:20 +0100 | [diff] [blame] | 335 | |
| 336 | /* 3GPP TS 48.058 § 9.3.37: [0; 255] ok, -1 means invalid*/ |
| 337 | int16_t ms_t_offs; |
| 338 | /* 3GPP TS 45.010 § 1.2 round trip propagation delay (in symbols) or -1 */ |
| 339 | int16_t p_offs; |
| 340 | |
Harald Welte | 5d52c97 | 2012-04-08 20:23:28 +0200 | [diff] [blame] | 341 | /* BTS-side ciphering state (rx only, bi-directional, ...) */ |
| 342 | uint8_t ciph_state; |
Holger Hans Peter Freyther | 2c6b59c | 2014-08-09 09:43:53 +0200 | [diff] [blame] | 343 | uint8_t ciph_ns; |
Harald Welte | 46cb851 | 2012-04-19 23:13:35 +0200 | [diff] [blame] | 344 | uint8_t loopback; |
Harald Welte | 704cb86 | 2012-06-16 14:57:08 +0800 | [diff] [blame] | 345 | struct { |
| 346 | uint8_t active; |
| 347 | uint8_t ref; |
| 348 | /* T3105: PHYS INF retransmission */ |
| 349 | struct osmo_timer_list t3105; |
| 350 | /* counts up to Ny1 */ |
| 351 | unsigned int phys_info_count; |
| 352 | } ho; |
Andreas Eversberg | 1af682a | 2013-02-20 16:06:20 +0100 | [diff] [blame] | 353 | /* S counter for link loss */ |
| 354 | int s; |
Holger Hans Peter Freyther | fc7a75f | 2013-10-25 18:58:30 +0200 | [diff] [blame] | 355 | /* Kind of the release/activation. E.g. RSL or PCU */ |
| 356 | int rel_act_kind; |
Max | ec74465 | 2016-05-18 16:42:16 +0200 | [diff] [blame] | 357 | /* RTP header Marker bit to indicate beginning of speech after pause */ |
| 358 | bool rtp_tx_marker; |
Holger Hans Peter Freyther | f6f86b0 | 2015-02-05 22:25:03 +0100 | [diff] [blame] | 359 | /* power handling */ |
| 360 | struct { |
| 361 | uint8_t current; |
| 362 | uint8_t fixed; |
| 363 | } ms_power_ctrl; |
Minh-Quang Nguyen | f188623 | 2017-01-18 16:49:00 +0100 | [diff] [blame] | 364 | |
| 365 | struct msgb *pending_rel_ind_msg; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 366 | #endif |
| 367 | }; |
| 368 | |
Neels Hofmeyr | 2ebacce | 2016-06-14 14:08:35 +0200 | [diff] [blame] | 369 | enum { |
| 370 | TS_F_PDCH_ACTIVE = 0x1000, |
| 371 | TS_F_PDCH_ACT_PENDING = 0x2000, |
| 372 | TS_F_PDCH_DEACT_PENDING = 0x4000, |
| 373 | TS_F_PDCH_PENDING_MASK = 0x6000 /*< |
| 374 | TS_F_PDCH_ACT_PENDING | TS_F_PDCH_DEACT_PENDING */ |
| 375 | } gsm_bts_trx_ts_flags; |
| 376 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 377 | /* One Timeslot in a TRX */ |
| 378 | struct gsm_bts_trx_ts { |
| 379 | struct gsm_bts_trx *trx; |
| 380 | /* number of this timeslot at the TRX */ |
| 381 | uint8_t nr; |
| 382 | |
| 383 | enum gsm_phys_chan_config pchan; |
| 384 | |
Neels Hofmeyr | c165876 | 2016-07-23 16:14:06 +0200 | [diff] [blame] | 385 | struct { |
| 386 | enum gsm_phys_chan_config pchan_is; |
| 387 | enum gsm_phys_chan_config pchan_want; |
| 388 | struct msgb *pending_chan_activ; |
| 389 | } dyn; |
| 390 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 391 | unsigned int flags; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 392 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 393 | struct tlv_parsed nm_attr; |
| 394 | uint8_t nm_chan_comb; |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 395 | int tsc; /* -1 == use BTS TSC */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 396 | |
| 397 | struct { |
| 398 | /* Parameters below are configured by VTY */ |
| 399 | int enabled; |
| 400 | uint8_t maio; |
| 401 | uint8_t hsn; |
| 402 | struct bitvec arfcns; |
| 403 | uint8_t arfcns_data[1024/8]; |
| 404 | /* This is the pre-computed MA for channel assignments */ |
| 405 | struct bitvec ma; |
| 406 | uint8_t ma_len; /* part of ma_data that is used */ |
| 407 | uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */ |
| 408 | } hopping; |
| 409 | |
| 410 | /* To which E1 subslot are we connected */ |
| 411 | struct gsm_e1_subslot e1_link; |
| 412 | |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 413 | union { |
| 414 | struct { |
| 415 | struct om2k_mo om2k_mo; |
| 416 | } rbs2000; |
| 417 | }; |
| 418 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 419 | struct gsm_lchan lchan[TS_MAX_LCHAN]; |
| 420 | }; |
| 421 | |
| 422 | /* One TRX in a BTS */ |
| 423 | struct gsm_bts_trx { |
| 424 | /* list header in bts->trx_list */ |
| 425 | struct llist_head list; |
| 426 | |
| 427 | struct gsm_bts *bts; |
| 428 | /* number of this TRX in the BTS */ |
| 429 | uint8_t nr; |
| 430 | /* human readable name / description */ |
| 431 | char *description; |
| 432 | /* how do we talk RSL with this TRX? */ |
| 433 | struct gsm_e1_subslot rsl_e1_link; |
| 434 | uint8_t rsl_tei; |
| 435 | struct e1inp_sign_link *rsl_link; |
Holger Hans Peter Freyther | caa98d5 | 2013-10-06 15:52:14 +0200 | [diff] [blame] | 436 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 437 | /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ |
| 438 | struct e1inp_sign_link *oml_link; |
| 439 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 440 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 441 | struct tlv_parsed nm_attr; |
| 442 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 443 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 444 | } bb_transc; |
| 445 | |
| 446 | uint16_t arfcn; |
| 447 | int nominal_power; /* in dBm */ |
| 448 | unsigned int max_power_red; /* in actual dB */ |
Holger Hans Peter Freyther | 9b62580 | 2014-07-30 18:20:51 +0200 | [diff] [blame] | 449 | |
| 450 | #ifndef ROLE_BSC |
Harald Welte | 101c5c2 | 2014-08-22 16:12:03 +0200 | [diff] [blame] | 451 | struct trx_power_params power_params; |
Holger Hans Peter Freyther | f6f86b0 | 2015-02-05 22:25:03 +0100 | [diff] [blame] | 452 | int ms_power_control; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 453 | |
Harald Welte | d134cc7 | 2011-06-07 00:12:53 +0200 | [diff] [blame] | 454 | struct { |
| 455 | void *l1h; |
| 456 | } role_bts; |
Holger Hans Peter Freyther | 9b62580 | 2014-07-30 18:20:51 +0200 | [diff] [blame] | 457 | #endif |
Harald Welte | d134cc7 | 2011-06-07 00:12:53 +0200 | [diff] [blame] | 458 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 459 | union { |
| 460 | struct { |
| 461 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 462 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 463 | } bbsig; |
| 464 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 465 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 466 | } pa; |
| 467 | } bs11; |
| 468 | struct { |
| 469 | unsigned int test_state; |
| 470 | uint8_t test_nr; |
| 471 | struct rxlev_stats rxlev_stat; |
| 472 | } ipaccess; |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 473 | struct { |
| 474 | struct { |
| 475 | struct om2k_mo om2k_mo; |
| 476 | } trxc; |
| 477 | struct { |
| 478 | struct om2k_mo om2k_mo; |
| 479 | } rx; |
| 480 | struct { |
| 481 | struct om2k_mo om2k_mo; |
| 482 | } tx; |
| 483 | } rbs2000; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 484 | }; |
| 485 | struct gsm_bts_trx_ts ts[TRX_NR_TS]; |
| 486 | }; |
| 487 | |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 488 | #define GSM_BTS_SI2Q(bts) (struct gsm48_system_information_type_2quater *)((bts)->si_buf[SYSINFO_TYPE_2quater]) |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 489 | #define GSM_BTS_SI(bts, i) (void *)((bts)->si_buf[i]) |
| 490 | #define GSM_LCHAN_SI(lchan, i) (void *)((lchan)->si.buf[i]) |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 491 | |
| 492 | enum gsm_bts_type { |
| 493 | GSM_BTS_TYPE_UNKNOWN, |
| 494 | GSM_BTS_TYPE_BS11, |
| 495 | GSM_BTS_TYPE_NANOBTS, |
| 496 | GSM_BTS_TYPE_RBS2000, |
Dieter Spaar | 1664602 | 2011-07-28 00:01:50 +0200 | [diff] [blame] | 497 | GSM_BTS_TYPE_NOKIA_SITE, |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 498 | GSM_BTS_TYPE_OSMOBTS, |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 499 | _NUM_GSM_BTS_TYPE |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 500 | }; |
| 501 | |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 502 | enum gsm_bts_type_variant { |
| 503 | BTS_UNKNOWN, |
| 504 | BTS_OSMO_LITECELL15, |
| 505 | BTS_OSMO_OCTPHY, |
| 506 | BTS_OSMO_SYSMO, |
| 507 | BTS_OSMO_TRX, |
| 508 | _NUM_BTS_VARIANT |
| 509 | }; |
| 510 | |
Max | 7507aef | 2017-04-10 13:59:14 +0200 | [diff] [blame] | 511 | /* Used by OML layer for BTS Attribute reporting */ |
| 512 | enum bts_attribute { |
| 513 | BTS_TYPE_VARIANT, |
| 514 | BTS_SUB_MODEL, |
Max | 33e1357 | 2017-05-29 11:48:29 +0200 | [diff] [blame^] | 515 | TRX_PHY_VERSION, |
Max | 7507aef | 2017-04-10 13:59:14 +0200 | [diff] [blame] | 516 | }; |
| 517 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 518 | struct vty; |
| 519 | |
| 520 | struct gsm_bts_model { |
| 521 | struct llist_head list; |
| 522 | |
| 523 | enum gsm_bts_type type; |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 524 | enum gsm_bts_type_variant variant; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 525 | const char *name; |
| 526 | |
| 527 | bool started; |
| 528 | int (*start)(struct gsm_network *net); |
| 529 | int (*oml_rcvmsg)(struct msgb *msg); |
| 530 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 531 | void (*e1line_bind_ops)(struct e1inp_line *line); |
| 532 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 533 | void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts); |
| 534 | void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx); |
| 535 | void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts); |
| 536 | |
| 537 | struct tlv_definition nm_att_tlvdef; |
| 538 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 539 | /* features of a given BTS model set via gsm_bts_model_register() locally */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 540 | struct bitvec features; |
Max | 7b62d54 | 2017-05-09 15:19:15 +0200 | [diff] [blame] | 541 | uint8_t _features_data[MAX_BTS_FEATURES/8]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 542 | }; |
| 543 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 544 | /* N. B: always add new features to the end of the list (right before _NUM_BTS_FEAT) to avoid breaking compatibility |
| 545 | with BTS compiled against earlier version of this header */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 546 | enum gsm_bts_features { |
| 547 | BTS_FEAT_HSCSD, |
| 548 | BTS_FEAT_GPRS, |
| 549 | BTS_FEAT_EGPRS, |
| 550 | BTS_FEAT_ECSD, |
| 551 | BTS_FEAT_HOPPING, |
Harald Welte | 903aaea | 2014-01-19 17:10:50 +0100 | [diff] [blame] | 552 | BTS_FEAT_MULTI_TSC, |
Max | 1ebf23b | 2017-05-10 12:21:17 +0200 | [diff] [blame] | 553 | BTS_FEAT_OML_ALERTS, |
| 554 | BTS_FEAT_AGCH_PCH_PROP, |
| 555 | BTS_FEAT_CBCH, |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 556 | _NUM_BTS_FEAT |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 557 | }; |
| 558 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 559 | extern const struct value_string gsm_bts_features_descs[]; |
| 560 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 561 | /* |
| 562 | * This keeps track of the paging status of one BTS. It |
| 563 | * includes a number of pending requests, a back pointer |
| 564 | * to the gsm_bts, a timer and some more state. |
| 565 | */ |
| 566 | struct gsm_bts_paging_state { |
| 567 | /* pending requests */ |
| 568 | struct llist_head pending_requests; |
| 569 | struct gsm_bts *bts; |
| 570 | |
| 571 | struct osmo_timer_list work_timer; |
| 572 | struct osmo_timer_list credit_timer; |
| 573 | |
| 574 | /* free chans needed */ |
| 575 | int free_chans_need; |
| 576 | |
| 577 | /* load */ |
| 578 | uint16_t available_slots; |
| 579 | }; |
| 580 | |
| 581 | struct gsm_envabtse { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 582 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 583 | }; |
| 584 | |
| 585 | struct gsm_bts_gprs_nsvc { |
| 586 | struct gsm_bts *bts; |
| 587 | /* data read via VTY config file, to configure the BTS |
| 588 | * via OML from BSC */ |
| 589 | int id; |
| 590 | uint16_t nsvci; |
| 591 | uint16_t local_port; /* on the BTS */ |
| 592 | uint16_t remote_port; /* on the SGSN */ |
| 593 | uint32_t remote_ip; /* on the SGSN */ |
| 594 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 595 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 596 | }; |
| 597 | |
Harald Welte | 019f913 | 2012-06-28 08:43:14 +0200 | [diff] [blame] | 598 | enum gprs_rlc_par { |
| 599 | RLC_T3142, |
| 600 | RLC_T3169, |
| 601 | RLC_T3191, |
| 602 | RLC_T3193, |
| 603 | RLC_T3195, |
| 604 | RLC_N3101, |
| 605 | RLC_N3103, |
| 606 | RLC_N3105, |
| 607 | CV_COUNTDOWN, |
| 608 | T_DL_TBF_EXT, /* ms */ |
| 609 | T_UL_TBF_EXT, /* ms */ |
| 610 | _NUM_RLC_PAR |
| 611 | }; |
| 612 | |
| 613 | enum gprs_cs { |
| 614 | GPRS_CS1, |
| 615 | GPRS_CS2, |
| 616 | GPRS_CS3, |
| 617 | GPRS_CS4, |
| 618 | GPRS_MCS1, |
| 619 | GPRS_MCS2, |
| 620 | GPRS_MCS3, |
| 621 | GPRS_MCS4, |
| 622 | GPRS_MCS5, |
| 623 | GPRS_MCS6, |
| 624 | GPRS_MCS7, |
| 625 | GPRS_MCS8, |
| 626 | GPRS_MCS9, |
| 627 | _NUM_GRPS_CS |
| 628 | }; |
| 629 | |
| 630 | struct gprs_rlc_cfg { |
| 631 | uint16_t parameter[_NUM_RLC_PAR]; |
| 632 | struct { |
| 633 | uint16_t repeat_time; /* ms */ |
| 634 | uint8_t repeat_count; |
| 635 | } paging; |
| 636 | uint32_t cs_mask; /* bitmask of gprs_cs */ |
| 637 | uint8_t initial_cs; |
| 638 | uint8_t initial_mcs; |
| 639 | }; |
| 640 | |
| 641 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 642 | enum neigh_list_manual_mode { |
| 643 | NL_MODE_AUTOMATIC = 0, |
| 644 | NL_MODE_MANUAL = 1, |
| 645 | NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */ |
| 646 | }; |
| 647 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 648 | enum bts_loc_fix { |
| 649 | BTS_LOC_FIX_INVALID = 0, |
| 650 | BTS_LOC_FIX_2D = 1, |
| 651 | BTS_LOC_FIX_3D = 2, |
| 652 | }; |
| 653 | |
Daniel Willmann | 7d10983 | 2012-05-14 18:43:23 +0200 | [diff] [blame] | 654 | extern const struct value_string bts_loc_fix_names[]; |
| 655 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 656 | struct bts_location { |
| 657 | struct llist_head list; |
| 658 | time_t tstamp; |
| 659 | enum bts_loc_fix valid; |
| 660 | double lat; |
| 661 | double lon; |
| 662 | double height; |
| 663 | }; |
| 664 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 665 | /* One BTS */ |
| 666 | struct gsm_bts { |
| 667 | /* list header in net->bts_list */ |
| 668 | struct llist_head list; |
| 669 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 670 | /* Geographical location of the BTS */ |
| 671 | struct llist_head loc_list; |
| 672 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 673 | /* number of ths BTS in network */ |
| 674 | uint8_t nr; |
| 675 | /* human readable name / description */ |
| 676 | char *description; |
| 677 | /* Cell Identity */ |
| 678 | uint16_t cell_identity; |
| 679 | /* location area code of this BTS */ |
| 680 | uint16_t location_area_code; |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 681 | /* Base Station Identification Code (BSIC), lower 3 bits is BCC, |
| 682 | * which is used as TSC for the CCCH */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 683 | uint8_t bsic; |
| 684 | /* type of BTS */ |
| 685 | enum gsm_bts_type type; |
Max | 6d8e519 | 2017-04-11 18:23:47 +0200 | [diff] [blame] | 686 | enum gsm_bts_type_variant variant; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 687 | struct gsm_bts_model *model; |
| 688 | enum gsm_band band; |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 689 | char version[MAX_VERSION_LENGTH]; |
Max | 1ebf23b | 2017-05-10 12:21:17 +0200 | [diff] [blame] | 690 | char sub_model[MAX_VERSION_LENGTH]; |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 691 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 692 | /* features of a given BTS set/reported via OML */ |
| 693 | struct bitvec features; |
| 694 | uint8_t _features_data[MAX_BTS_FEATURES/8]; |
| 695 | |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 696 | /* Connected PCU version (if any) */ |
| 697 | char pcu_version[MAX_VERSION_LENGTH]; |
| 698 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 699 | /* maximum Tx power that the MS is permitted to use in this cell */ |
| 700 | int ms_max_power; |
| 701 | |
| 702 | /* how do we talk OML with this TRX? */ |
| 703 | struct gsm_e1_subslot oml_e1_link; |
| 704 | uint8_t oml_tei; |
| 705 | struct e1inp_sign_link *oml_link; |
| 706 | |
| 707 | /* Abis network management O&M handle */ |
| 708 | struct abis_nm_h *nmh; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 709 | |
| 710 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 711 | |
| 712 | /* number of this BTS on given E1 link */ |
| 713 | uint8_t bts_nr; |
| 714 | |
Max | c08ee71 | 2016-05-11 12:45:13 +0200 | [diff] [blame] | 715 | /* DTX features of this BTS */ |
| 716 | enum gsm48_dtx_mode dtxu; |
| 717 | bool dtxd; |
| 718 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 719 | /* paging state and control */ |
| 720 | struct gsm_bts_paging_state paging; |
| 721 | |
| 722 | /* CCCH is on C0 */ |
| 723 | struct gsm_bts_trx *c0; |
| 724 | |
| 725 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 726 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 727 | } site_mgr; |
| 728 | |
| 729 | /* bitmask of all SI that are present/valid in si_buf */ |
| 730 | uint32_t si_valid; |
Max | 6f0e50c | 2017-04-12 15:30:54 +0200 | [diff] [blame] | 731 | /* 3GPP TS 44.018 Table 10.5.2.33b.1 INDEX and COUNT for SI2quater */ |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 732 | uint8_t si2q_index; /* distinguish individual SI2quater messages */ |
| 733 | uint8_t si2q_count; /* si2q_index for the last (highest indexed) individual SI2quater message */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 734 | /* buffers where we put the pre-computed SI */ |
| 735 | sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE]; |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 736 | /* offsets used while generating SI2quater */ |
| 737 | size_t e_offset; |
| 738 | size_t u_offset; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 739 | |
| 740 | /* ip.accesss Unit ID's have Site/BTS/TRX layout */ |
| 741 | union { |
| 742 | struct { |
| 743 | uint16_t site_id; |
| 744 | uint16_t bts_id; |
| 745 | uint32_t flags; |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 746 | uint32_t rsl_ip; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 747 | } ip_access; |
| 748 | struct { |
| 749 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 750 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 751 | } cclk; |
| 752 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 753 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 754 | } rack; |
| 755 | struct gsm_envabtse envabtse[4]; |
| 756 | } bs11; |
| 757 | struct { |
| 758 | struct { |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 759 | struct om2k_mo om2k_mo; |
| 760 | struct gsm_abis_mo mo; |
| 761 | struct llist_head conn_groups; |
| 762 | } cf; |
| 763 | struct { |
| 764 | struct om2k_mo om2k_mo; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 765 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 766 | struct llist_head conn_groups; |
| 767 | } is; |
| 768 | struct { |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 769 | struct om2k_mo om2k_mo; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 770 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 771 | struct llist_head conn_groups; |
| 772 | } con; |
| 773 | struct { |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 774 | struct om2k_mo om2k_mo; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 775 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 776 | } dp; |
| 777 | struct { |
Harald Welte | 591e1d7 | 2016-07-09 22:20:57 +0200 | [diff] [blame] | 778 | struct om2k_mo om2k_mo; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 779 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 780 | } tf; |
Harald Welte | ce49258 | 2016-11-15 22:59:24 +0100 | [diff] [blame] | 781 | uint32_t use_superchannel:1; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 782 | } rbs2000; |
| 783 | struct { |
Harald Welte | c8755af | 2011-07-28 00:22:17 +0200 | [diff] [blame] | 784 | uint8_t bts_type; |
Holger Hans Peter Freyther | 3e60348 | 2012-03-02 14:14:33 +0100 | [diff] [blame] | 785 | unsigned int configured:1, |
| 786 | skip_reset:1, |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 787 | no_loc_rel_cnf:1, |
Sipos Csaba | 56e1766 | 2015-02-07 13:27:36 +0100 | [diff] [blame] | 788 | bts_reset_timer_cnf, |
Holger Hans Peter Freyther | 3e60348 | 2012-03-02 14:14:33 +0100 | [diff] [blame] | 789 | did_reset:1, |
| 790 | wait_reset:1; |
Harald Welte | c8755af | 2011-07-28 00:22:17 +0200 | [diff] [blame] | 791 | struct osmo_timer_list reset_timer; |
| 792 | } nokia; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 793 | }; |
| 794 | |
| 795 | /* Not entirely sure how ip.access specific this is */ |
| 796 | struct { |
bhargava | 350533c | 2016-07-21 11:14:34 +0530 | [diff] [blame] | 797 | uint8_t supports_egprs_11bit_rach; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 798 | enum bts_gprs_mode mode; |
| 799 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 800 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 801 | uint16_t nsei; |
| 802 | uint8_t timer[7]; |
| 803 | } nse; |
| 804 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 805 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 806 | uint16_t bvci; |
| 807 | uint8_t timer[11]; |
Harald Welte | 019f913 | 2012-06-28 08:43:14 +0200 | [diff] [blame] | 808 | struct gprs_rlc_cfg rlc_cfg; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 809 | } cell; |
| 810 | struct gsm_bts_gprs_nsvc nsvc[2]; |
| 811 | uint8_t rac; |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 812 | uint8_t net_ctrl_ord; |
Max | 292ec58 | 2016-07-28 11:55:37 +0200 | [diff] [blame] | 813 | bool ctrl_ack_type_use_block; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 814 | } gprs; |
| 815 | |
| 816 | /* RACH NM values */ |
| 817 | int rach_b_thresh; |
| 818 | int rach_ldavg_slots; |
| 819 | |
| 820 | /* transceivers */ |
| 821 | int num_trx; |
| 822 | struct llist_head trx_list; |
| 823 | |
Holger Hans Peter Freyther | b92a538 | 2014-11-21 10:00:39 +0100 | [diff] [blame] | 824 | /* SI related items */ |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 825 | int force_combined_si; |
Holger Hans Peter Freyther | b92a538 | 2014-11-21 10:00:39 +0100 | [diff] [blame] | 826 | int bcch_change_mark; |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 827 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 828 | #ifdef ROLE_BSC |
| 829 | /* Abis NM queue */ |
| 830 | struct llist_head abis_queue; |
| 831 | int abis_nm_pend; |
| 832 | |
| 833 | struct gsm_network *network; |
| 834 | |
| 835 | /* should the channel allocator allocate channels from high TRX to TRX0, |
| 836 | * rather than starting from TRX0 and go upwards? */ |
| 837 | int chan_alloc_reverse; |
| 838 | |
| 839 | enum neigh_list_manual_mode neigh_list_manual_mode; |
| 840 | /* parameters from which we build SYSTEM INFORMATION */ |
| 841 | struct { |
| 842 | struct gsm48_rach_control rach_control; |
| 843 | uint8_t ncc_permitted; |
| 844 | struct gsm48_cell_sel_par cell_sel_par; |
| 845 | struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */ |
| 846 | struct gsm48_cell_options cell_options; |
| 847 | struct gsm48_control_channel_descr chan_desc; |
| 848 | struct bitvec neigh_list; |
| 849 | struct bitvec cell_alloc; |
| 850 | struct bitvec si5_neigh_list; |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 851 | struct osmo_earfcn_si2q si2quater_neigh_list; |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 852 | size_t uarfcn_length; /* index for uarfcn and scramble lists */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 853 | struct { |
| 854 | /* bitmask large enough for all possible ARFCN's */ |
| 855 | uint8_t neigh_list[1024/8]; |
| 856 | uint8_t cell_alloc[1024/8]; |
| 857 | /* If the user wants a different neighbor list in SI5 than in SI2 */ |
| 858 | uint8_t si5_neigh_list[1024/8]; |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 859 | uint8_t meas_bw_list[MAX_EARFCN_LIST]; |
| 860 | uint16_t earfcn_list[MAX_EARFCN_LIST]; |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 861 | uint16_t uarfcn_list[MAX_EARFCN_LIST]; |
| 862 | uint16_t scramble_list[MAX_EARFCN_LIST]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 863 | } data; |
| 864 | } si_common; |
Harald Welte | 42def72 | 2017-01-13 00:10:32 +0100 | [diff] [blame] | 865 | bool early_classmark_allowed; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 866 | |
| 867 | /* do we use static (user-defined) system information messages? (bitmask) */ |
| 868 | uint32_t si_mode_static; |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 869 | |
| 870 | /* exclude the BTS from the global RF Lock handling */ |
| 871 | int excl_from_rf_lock; |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 872 | |
| 873 | /* supported codecs beside FR */ |
| 874 | struct bts_codec_conf codec; |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 875 | |
| 876 | /* BTS dependencies bit field */ |
| 877 | uint32_t depends_on[256/(8*4)]; |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 878 | |
| 879 | /* full and half rate multirate config */ |
| 880 | struct amr_multirate_conf mr_full; |
| 881 | struct amr_multirate_conf mr_half; |
| 882 | |
Philipp Maier | b4999b6 | 2016-10-26 15:19:41 +0200 | [diff] [blame] | 883 | /* PCU socket state */ |
Harald Welte | 8254cf7 | 2017-05-29 13:42:19 +0200 | [diff] [blame] | 884 | char *pcu_sock_path; |
Philipp Maier | b4999b6 | 2016-10-26 15:19:41 +0200 | [diff] [blame] | 885 | struct pcu_sock_state *pcu_state; |
| 886 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 887 | #endif /* ROLE_BSC */ |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 888 | void *role; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 889 | }; |
| 890 | |
| 891 | |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 892 | struct gsm_bts *gsm_bts_alloc(void *talloc_ctx); |
Harald Welte | 1449c9f | 2014-08-24 09:50:10 +0200 | [diff] [blame] | 893 | struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 894 | |
Harald Welte | 1449c9f | 2014-08-24 09:50:10 +0200 | [diff] [blame] | 895 | struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 896 | struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 897 | |
Max | 7507aef | 2017-04-10 13:59:14 +0200 | [diff] [blame] | 898 | enum gsm_bts_type str2btstype(const char *arg); |
| 899 | const char *btstype2str(enum gsm_bts_type type); |
| 900 | |
| 901 | enum bts_attribute str2btsattr(const char *s); |
| 902 | const char *btsatttr2str(enum bts_attribute v); |
| 903 | |
| 904 | enum gsm_bts_type_variant str2btsvariant(const char *arg); |
| 905 | const char *btsvariant2str(enum gsm_bts_type_variant v); |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 906 | |
Philipp Maier | 6f483d3 | 2017-02-24 15:18:08 +0100 | [diff] [blame] | 907 | extern const struct value_string gsm_chreq_descs[]; |
Neels Hofmeyr | 17a6bab | 2016-07-23 16:14:06 +0200 | [diff] [blame] | 908 | const struct value_string gsm_pchant_names[13]; |
| 909 | const struct value_string gsm_pchant_descs[13]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 910 | const char *gsm_pchan_name(enum gsm_phys_chan_config c); |
| 911 | enum gsm_phys_chan_config gsm_pchan_parse(const char *name); |
| 912 | const char *gsm_lchant_name(enum gsm_chan_t c); |
| 913 | const char *gsm_chreq_name(enum gsm_chreq_reason_t c); |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 914 | char *gsm_trx_name(const struct gsm_bts_trx *trx); |
| 915 | char *gsm_ts_name(const struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 34b8b5b | 2016-07-16 23:59:32 +0200 | [diff] [blame] | 916 | char *gsm_ts_and_pchan_name(const struct gsm_bts_trx_ts *ts); |
Harald Welte | c696cc2 | 2015-12-05 16:19:21 +0100 | [diff] [blame] | 917 | char *gsm_lchan_name_compute(const struct gsm_lchan *lchan); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 918 | const char *gsm_lchans_name(enum gsm_lchan_state s); |
| 919 | |
Harald Welte | c696cc2 | 2015-12-05 16:19:21 +0100 | [diff] [blame] | 920 | static inline char *gsm_lchan_name(const struct gsm_lchan *lchan) |
| 921 | { |
| 922 | return lchan->name; |
| 923 | } |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 924 | |
Max | aef6838 | 2017-05-31 12:15:54 +0200 | [diff] [blame] | 925 | static inline int gsm_bts_set_feature(struct gsm_bts *bts, enum gsm_bts_features feat) |
| 926 | { |
| 927 | OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); |
| 928 | return bitvec_set_bit_pos(&bts->features, feat, 1); |
| 929 | } |
| 930 | |
| 931 | static inline bool gsm_bts_has_feature(const struct gsm_bts *bts, enum gsm_bts_features feat) |
| 932 | { |
| 933 | OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); |
| 934 | return bitvec_get_bit_pos(&bts->features, feat); |
| 935 | } |
| 936 | |
Harald Welte | b784998 | 2011-06-29 16:49:03 +0200 | [diff] [blame] | 937 | void gsm_abis_mo_reset(struct gsm_abis_mo *mo); |
| 938 | |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 939 | struct gsm_abis_mo * |
| 940 | gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 941 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 942 | |
| 943 | struct gsm_nm_state * |
| 944 | gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 945 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 946 | void * |
| 947 | gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 948 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 949 | |
Harald Welte | b784998 | 2011-06-29 16:49:03 +0200 | [diff] [blame] | 950 | /* reset the state of all MO in the BTS */ |
| 951 | void gsm_bts_mo_reset(struct gsm_bts *bts); |
| 952 | |
Neels Hofmeyr | d384110 | 2016-07-18 23:43:44 +0200 | [diff] [blame] | 953 | uint8_t gsm_pchan2chan_nr(enum gsm_phys_chan_config pchan, |
| 954 | uint8_t ts_nr, uint8_t lchan_nr); |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 955 | uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan); |
Neels Hofmeyr | d384110 | 2016-07-18 23:43:44 +0200 | [diff] [blame] | 956 | uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan, |
| 957 | enum gsm_phys_chan_config as_pchan); |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 958 | |
Harald Welte | 142d12d | 2014-12-29 17:47:08 +0100 | [diff] [blame] | 959 | /* return the gsm_lchan for the CBCH (if it exists at all) */ |
| 960 | struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts); |
| 961 | |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 962 | /* |
| 963 | * help with parsing regexps |
| 964 | */ |
| 965 | int gsm_parse_reg(void *ctx, regex_t *reg, char **str, |
| 966 | int argc, const char **argv) __attribute__ ((warn_unused_result)); |
| 967 | |
Harald Welte | 1fe2412 | 2014-01-19 17:18:21 +0100 | [diff] [blame] | 968 | static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts) |
| 969 | { |
| 970 | if (ts->tsc != -1) |
| 971 | return ts->tsc; |
| 972 | else |
Harald Welte | a2bbc5e | 2015-11-20 10:43:31 +0100 | [diff] [blame] | 973 | return ts->trx->bts->bsic & 7; |
Harald Welte | 1fe2412 | 2014-01-19 17:18:21 +0100 | [diff] [blame] | 974 | } |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 975 | |
Neels Hofmeyr | 7458572 | 2016-07-23 17:38:22 +0200 | [diff] [blame] | 976 | struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, |
| 977 | int *rc); |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 978 | |
Neels Hofmeyr | ec16c16 | 2016-10-17 01:03:53 +0200 | [diff] [blame] | 979 | enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 76a0ad7 | 2016-07-29 18:12:06 +0200 | [diff] [blame] | 980 | uint8_t ts_subslots(struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 255dbfe | 2016-09-25 15:07:01 +0200 | [diff] [blame] | 981 | bool ts_is_tch(struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 76a0ad7 | 2016-07-29 18:12:06 +0200 | [diff] [blame] | 982 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 983 | #endif |