Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1 | #ifndef _GSM_DATA_H |
| 2 | #define _GSM_DATA_H |
| 3 | |
Harald Welte | f142c97 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 4 | #include <stdint.h> |
Max | ddee01f | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 5 | #include <sys/types.h> |
Max | e6052c4 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 6 | #include <stdbool.h> |
Harald Welte | f142c97 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 7 | |
| 8 | #include <osmocom/core/timer.h> |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 9 | #include <osmocom/core/rate_ctr.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 10 | #include <osmocom/core/select.h> |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 11 | #include <osmocom/core/stats.h> |
Stefan Sperling | 81dc9e7 | 2018-02-05 17:34:36 +0100 | [diff] [blame] | 12 | #include <osmocom/core/stat_item.h> |
Philipp Maier | 8c498fc | 2018-02-21 13:24:36 +0100 | [diff] [blame] | 13 | #include <osmocom/gsm/bts_features.h> |
Neels Hofmeyr | a60f344 | 2018-02-12 16:44:32 +0100 | [diff] [blame] | 14 | #include <osmocom/gsm/protocol/gsm_08_08.h> |
Harald Welte | d41b7c7 | 2019-06-13 09:41:58 +0200 | [diff] [blame] | 15 | #include <osmocom/gsm/protocol/gsm_48_049.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 16 | #include <osmocom/gsm/gsm0808.h> |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 17 | #include <osmocom/gsm/gsm48.h> |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 18 | #include <osmocom/core/fsm.h> |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 19 | #include <osmocom/core/tdef.h> |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 20 | |
Harald Welte | 121e9a4 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 21 | #include <osmocom/crypt/auth.h> |
Harald Welte | f142c97 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 22 | |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 23 | #include <osmocom/bsc/rest_octets.h> |
Harald Welte | b96be39 | 2011-05-25 12:33:33 +0200 | [diff] [blame] | 24 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 25 | #include <osmocom/core/bitvec.h> |
| 26 | #include <osmocom/gsm/gsm_utils.h> |
| 27 | #include <osmocom/gsm/rxlev_stat.h> |
| 28 | #include <osmocom/gsm/protocol/gsm_08_58.h> |
| 29 | #include <osmocom/gsm/protocol/gsm_12_21.h> |
| 30 | #include <osmocom/abis/e1_input.h> |
| 31 | #include <osmocom/bsc/meas_rep.h> |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 32 | #include <osmocom/bsc/acc_ramp.h> |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 33 | #include <osmocom/bsc/neighbor_ident.h> |
Pau Espin Pedrol | 83c0f76 | 2019-04-16 20:05:32 +0200 | [diff] [blame] | 34 | #include <osmocom/bsc/osmux.h> |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 35 | |
Neels Hofmeyr | 596c402 | 2018-06-16 19:29:50 +0200 | [diff] [blame] | 36 | #define GSM_T3122_DEFAULT 10 |
| 37 | |
Harald Welte | 74b8cdb | 2018-01-15 19:26:06 +0100 | [diff] [blame] | 38 | struct mgcp_client_conf; |
| 39 | struct mgcp_client; |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 40 | struct gsm0808_cell_id; |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 41 | struct osmo_mgcpc_ep; |
Philipp Maier | 39f62bb | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 42 | |
Holger Hans Peter Freyther | d7b22c6 | 2013-04-29 09:11:02 +0200 | [diff] [blame] | 43 | /** annotations for msgb ownership */ |
| 44 | #define __uses |
| 45 | |
Holger Hans Peter Freyther | 6f61555 | 2010-11-15 20:50:42 +0100 | [diff] [blame] | 46 | #define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3] |
| 47 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 48 | struct bsc_subscr; |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 49 | struct gprs_ra_id; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 50 | struct handover; |
Holger Hans Peter Freyther | 694c82d | 2011-10-26 18:37:09 +0200 | [diff] [blame] | 51 | |
Holger Hans Peter Freyther | 9c595b7 | 2010-06-15 11:20:52 +0800 | [diff] [blame] | 52 | #define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3] |
| 53 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 54 | /* 3-bit long values */ |
| 55 | #define EARFCN_PRIO_INVALID 8 |
| 56 | #define EARFCN_MEAS_BW_INVALID 8 |
| 57 | /* 5-bit long values */ |
| 58 | #define EARFCN_QRXLV_INVALID 32 |
| 59 | #define EARFCN_THRESH_LOW_INVALID 32 |
| 60 | |
Harald Welte | 8e1e3ee | 2009-02-01 13:32:45 +0000 | [diff] [blame] | 61 | struct msgb; |
| 62 | typedef int gsm_cbfn(unsigned int hooknum, |
| 63 | unsigned int event, |
| 64 | struct msgb *msg, |
| 65 | void *data, void *param); |
| 66 | |
Harald Welte | f7c28b0 | 2009-12-21 13:30:17 +0100 | [diff] [blame] | 67 | /* Maximum number of neighbor cells whose average we track */ |
| 68 | #define MAX_NEIGH_MEAS 10 |
| 69 | /* Maximum size of the averaging window for neighbor cells */ |
| 70 | #define MAX_WIN_NEIGH_AVG 10 |
Andreas Eversberg | 9869203 | 2013-06-23 10:44:34 +0200 | [diff] [blame] | 71 | /* Maximum number of report history we store */ |
| 72 | #define MAX_MEAS_REP 10 |
Harald Welte | f7c28b0 | 2009-12-21 13:30:17 +0100 | [diff] [blame] | 73 | |
| 74 | /* processed neighbor measurements for one cell */ |
| 75 | struct neigh_meas_proc { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 76 | uint16_t arfcn; |
| 77 | uint8_t bsic; |
| 78 | uint8_t rxlev[MAX_WIN_NEIGH_AVG]; |
Harald Welte | f7c28b0 | 2009-12-21 13:30:17 +0100 | [diff] [blame] | 79 | unsigned int rxlev_cnt; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 80 | uint8_t last_seen_nr; |
Harald Welte | f7c28b0 | 2009-12-21 13:30:17 +0100 | [diff] [blame] | 81 | }; |
| 82 | |
Harald Welte | a43e0b4 | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 83 | struct gsm_classmark { |
| 84 | bool classmark1_set; |
| 85 | struct gsm48_classmark1 classmark1; |
| 86 | uint8_t classmark2_len; |
| 87 | uint8_t classmark2[3]; |
| 88 | uint8_t classmark3_len; |
| 89 | uint8_t classmark3[14]; /* if cm3 gets extended by spec, it will be truncated */ |
| 90 | }; |
| 91 | |
Harald Welte | 519c7e1 | 2018-01-28 02:45:46 +0100 | [diff] [blame] | 92 | enum subscr_sccp_state { |
| 93 | SUBSCR_SCCP_ST_NONE, |
| 94 | SUBSCR_SCCP_ST_WAIT_CONN_CONF, |
| 95 | SUBSCR_SCCP_ST_CONNECTED |
| 96 | }; |
| 97 | |
Sylvain Munaut | aa82492 | 2019-03-07 16:32:02 +0100 | [diff] [blame] | 98 | enum channel_rate { |
| 99 | CH_RATE_SDCCH, |
| 100 | CH_RATE_HALF, |
| 101 | CH_RATE_FULL, |
| 102 | }; |
| 103 | |
Philipp Maier | bb66d10 | 2019-01-22 11:29:06 +0100 | [diff] [blame] | 104 | struct channel_mode_and_rate { |
| 105 | enum gsm48_chan_mode chan_mode; |
Sylvain Munaut | aa82492 | 2019-03-07 16:32:02 +0100 | [diff] [blame] | 106 | enum channel_rate chan_rate; |
Philipp Maier | bb66d10 | 2019-01-22 11:29:06 +0100 | [diff] [blame] | 107 | uint16_t s15_s0; |
| 108 | }; |
| 109 | |
Neels Hofmeyr | 7cfdbe7 | 2019-02-06 01:30:19 +0100 | [diff] [blame] | 110 | /* Information retrieved during an Assignment Request from the MSC. This is storage of the Assignment instructions |
| 111 | * parsed from the Assignment Request message, to pass on until the gscon and assignment FSMs have decided whether an |
| 112 | * Assignment is actually going to be carried out. Should remain unchanged after initial decoding. */ |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 113 | struct assignment_request { |
| 114 | bool aoip; |
| 115 | |
| 116 | uint16_t msc_assigned_cic; |
| 117 | |
| 118 | char msc_rtp_addr[INET_ADDRSTRLEN]; |
| 119 | uint16_t msc_rtp_port; |
Pau Espin Pedrol | 83c0f76 | 2019-04-16 20:05:32 +0200 | [diff] [blame] | 120 | bool use_osmux; |
| 121 | uint8_t osmux_cid; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 122 | |
Sylvain Munaut | aa82492 | 2019-03-07 16:32:02 +0100 | [diff] [blame] | 123 | /* Rate/codec setting in preference order (need at least 1 !) */ |
| 124 | int n_ch_mode_rate; |
| 125 | struct channel_mode_and_rate ch_mode_rate[3]; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 126 | }; |
| 127 | |
Neels Hofmeyr | 7cfdbe7 | 2019-02-06 01:30:19 +0100 | [diff] [blame] | 128 | /* State of an ongoing Assignment, while the assignment_fsm is still busy. This serves as state separation to keep the |
| 129 | * currently used lchan and gscon unmodified until the outcome of an Assignment is known. If the Assignment fails, this |
| 130 | * state is simply discarded, and the gscon carries on with the original lchan remaining unchanged. */ |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 131 | struct assignment_fsm_data { |
| 132 | struct assignment_request req; |
| 133 | bool requires_voice_stream; |
| 134 | |
| 135 | struct osmo_fsm_inst *fi; |
| 136 | struct gsm_lchan *new_lchan; |
| 137 | |
| 138 | /* Whether this assignment triggered creation of the MGW endpoint: if the assignment |
| 139 | * fails, we will release that again as soon as possible. (If false, the endpoint already |
| 140 | * existed before or isn't needed at all.)*/ |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 141 | struct osmo_mgcpc_ep_ci *created_ci_for_msc; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 142 | |
| 143 | enum gsm0808_cause failure_cause; |
| 144 | enum gsm48_rr_cause rr_cause; |
| 145 | |
| 146 | bool result_rate_ctr_done; |
| 147 | }; |
| 148 | |
| 149 | enum hodec_id { |
| 150 | HODEC_NONE, |
| 151 | HODEC1 = 1, |
| 152 | HODEC2 = 2, |
| 153 | HODEC_USER, |
| 154 | HODEC_REMOTE, |
| 155 | }; |
| 156 | |
| 157 | /* For example, to count specific kinds of ongoing handovers, it is useful to be able to OR-combine |
| 158 | * scopes. */ |
| 159 | enum handover_scope { |
| 160 | HO_NO_HANDOVER = 0, |
| 161 | HO_INTRA_CELL = 0x1, |
| 162 | HO_INTRA_BSC = 0x2, |
| 163 | HO_INTER_BSC_OUT = 0x4, |
| 164 | HO_INTER_BSC_IN = 0x8, |
| 165 | HO_SCOPE_ALL = 0xffff, |
| 166 | }; |
| 167 | |
| 168 | extern const struct value_string handover_scope_names[]; |
| 169 | inline static const char *handover_scope_name(enum handover_scope val) |
| 170 | { return get_value_string(handover_scope_names, val); } |
| 171 | |
| 172 | struct handover_out_req { |
| 173 | enum hodec_id from_hodec_id; |
| 174 | struct gsm_lchan *old_lchan; |
| 175 | struct neighbor_ident_key target_nik; |
| 176 | enum gsm_chan_t new_lchan_type; /*< leave GSM_LCHAN_NONE to use same as old_lchan */ |
| 177 | }; |
| 178 | |
| 179 | struct handover_in_req { |
| 180 | struct gsm0808_channel_type ct; |
| 181 | struct gsm0808_speech_codec_list scl; |
| 182 | struct gsm0808_encrypt_info ei; |
| 183 | struct gsm_classmark classmark; |
Neels Hofmeyr | c15f6cd | 2019-03-15 02:48:39 +0100 | [diff] [blame] | 184 | /* chosen_encr_alg reflects the encoded value as in RSL_ENC_ALG_A5(a5_numer): |
| 185 | * chosen_encr_alg == 1 means A5/0 i.e. no encryption, chosen_encr_alg == 4 means A5/3. |
| 186 | * chosen_encr_alg == 0 means no such IE was present. */ |
| 187 | uint8_t chosen_encr_alg; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 188 | struct gsm0808_cell_id cell_id_serving; |
| 189 | char cell_id_serving_name[64]; |
| 190 | struct gsm0808_cell_id cell_id_target; |
| 191 | char cell_id_target_name[64]; |
| 192 | uint16_t msc_assigned_cic; |
| 193 | char msc_assigned_rtp_addr[INET_ADDRSTRLEN]; |
| 194 | uint16_t msc_assigned_rtp_port; |
| 195 | }; |
| 196 | |
| 197 | struct handover { |
| 198 | struct osmo_fsm_inst *fi; |
| 199 | |
| 200 | enum hodec_id from_hodec_id; |
| 201 | enum handover_scope scope; |
| 202 | enum gsm_chan_t new_lchan_type; |
| 203 | struct neighbor_ident_key target_cell; |
| 204 | |
| 205 | uint8_t ho_ref; |
| 206 | struct gsm_bts *new_bts; |
| 207 | struct gsm_lchan *new_lchan; |
| 208 | bool async; |
| 209 | struct handover_in_req inter_bsc_in; |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 210 | struct osmo_mgcpc_ep_ci *created_ci_for_msc; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 211 | }; |
| 212 | |
Neels Hofmeyr | 378a492 | 2016-05-09 21:07:43 +0200 | [diff] [blame] | 213 | /* active radio connection of a mobile subscriber */ |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 214 | struct gsm_subscriber_connection { |
Harald Welte | a43e0b4 | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 215 | /* global linked list of subscriber_connections */ |
Holger Hans Peter Freyther | 79f763f | 2010-09-16 00:53:37 +0800 | [diff] [blame] | 216 | struct llist_head entry; |
| 217 | |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 218 | /* FSM instance to control the subscriber connection state (RTP, A) */ |
| 219 | struct osmo_fsm_inst *fi; |
| 220 | |
Harald Welte | a43e0b4 | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 221 | /* libbsc subscriber information (if available) */ |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 222 | struct bsc_subscr *bsub; |
| 223 | |
Holger Hans Peter Freyther | 18b63f4 | 2010-03-23 07:52:17 +0100 | [diff] [blame] | 224 | /* back pointers */ |
Neels Hofmeyr | 5e0b0a6 | 2016-05-09 22:33:01 +0200 | [diff] [blame] | 225 | struct gsm_network *network; |
| 226 | |
Neels Hofmeyr | 7cfdbe7 | 2019-02-06 01:30:19 +0100 | [diff] [blame] | 227 | /* the primary / currently active lchan to the BTS/subscriber. During Assignment and Handover, separate lchans |
| 228 | * are kept in the .assignment or .handover sub-structs, respectively, so that this lchan remains unaffected |
| 229 | * until Assignment or Handover have actually succeeded. */ |
Harald Welte | 4a8ebc8 | 2017-12-18 18:34:41 +0100 | [diff] [blame] | 230 | struct gsm_lchan *lchan; |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 231 | |
Neels Hofmeyr | 7cfdbe7 | 2019-02-06 01:30:19 +0100 | [diff] [blame] | 232 | /* Only valid during an ongoing Assignment; might be overwritten at any time by a failed Assignment attempt. |
| 233 | * Once an Assignment was successful, all relevant state must be copied out of this sub-struct. */ |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 234 | struct assignment_fsm_data assignment; |
Holger Hans Peter Freyther | 77cd95d | 2010-11-14 16:19:48 +0100 | [diff] [blame] | 235 | |
Neels Hofmeyr | 7cfdbe7 | 2019-02-06 01:30:19 +0100 | [diff] [blame] | 236 | /* handover information, if a handover is pending for this conn. Valid only during an ongoing Handover |
| 237 | * operation. If a Handover was successful, all relevant state must be copied out of this sub-struct. */ |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 238 | struct handover ho; |
Holger Hans Peter Freyther | 77cd95d | 2010-11-14 16:19:48 +0100 | [diff] [blame] | 239 | |
Neels Hofmeyr | 149160f | 2018-06-16 17:20:13 +0200 | [diff] [blame] | 240 | /* Queue DTAP messages during handover/assignment (msgb_enqueue()/msgb_dequeue())*/ |
| 241 | struct llist_head dtap_queue; |
| 242 | unsigned int dtap_queue_len; |
Andreas Eversberg | 084b421 | 2013-05-30 14:12:48 +0200 | [diff] [blame] | 243 | |
Neels Hofmeyr | ec42264 | 2018-02-15 14:07:40 +0100 | [diff] [blame] | 244 | struct { |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 245 | int failures; |
Neels Hofmeyr | ec42264 | 2018-02-15 14:07:40 +0100 | [diff] [blame] | 246 | struct penalty_timers *penalty_timers; |
| 247 | } hodec2; |
Neels Hofmeyr | a60f344 | 2018-02-12 16:44:32 +0100 | [diff] [blame] | 248 | |
| 249 | /* "Codec List (MSC Preferred)" as received by the BSSAP Assignment Request. 3GPP 48.008 |
| 250 | * 3.2.2.103 says: |
| 251 | * The "Codec List (MSC Preferred)" shall not include codecs |
| 252 | * that are not supported by the MS. |
| 253 | * i.e. by heeding the "Codec list (MSC Preferred)", we inherently heed the MS bearer |
| 254 | * capabilities, which the MSC is required to translate into the codec list. */ |
| 255 | struct gsm0808_speech_codec_list codec_list; |
Harald Welte | 519c7e1 | 2018-01-28 02:45:46 +0100 | [diff] [blame] | 256 | |
| 257 | /* flag to prevent multiple simultaneous ciphering commands */ |
| 258 | int ciphering_handled; |
| 259 | |
Harald Welte | 519c7e1 | 2018-01-28 02:45:46 +0100 | [diff] [blame] | 260 | /* SCCP connection associatd with this subscriber_connection */ |
| 261 | struct { |
| 262 | /* for advanced ping/pong */ |
| 263 | int send_ping; |
| 264 | |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 265 | /* SCCP connection related */ |
Harald Welte | 519c7e1 | 2018-01-28 02:45:46 +0100 | [diff] [blame] | 266 | struct bsc_msc_data *msc; |
| 267 | |
| 268 | /* Sigtran connection ID */ |
| 269 | int conn_id; |
| 270 | enum subscr_sccp_state state; |
| 271 | } sccp; |
| 272 | |
| 273 | /* for audio handling */ |
| 274 | struct { |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 275 | uint16_t msc_assigned_cic; |
Harald Welte | 519c7e1 | 2018-01-28 02:45:46 +0100 | [diff] [blame] | 276 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 277 | /* RTP address where the MSC expects us to send the RTP stream coming from the BTS. */ |
| 278 | char msc_assigned_rtp_addr[INET_ADDRSTRLEN]; |
| 279 | uint16_t msc_assigned_rtp_port; |
Harald Welte | 519c7e1 | 2018-01-28 02:45:46 +0100 | [diff] [blame] | 280 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 281 | /* The endpoint at the MGW used to join both BTS and MSC side connections, e.g. |
| 282 | * "rtpbridge/23@mgw". */ |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 283 | struct osmo_mgcpc_ep *mgw_endpoint; |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 284 | |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 285 | /* The connection identifier of the osmo_mgcpc_ep used to transceive RTP towards the MSC. |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 286 | * (The BTS side CI is handled by struct gsm_lchan and the lchan_fsm.) */ |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 287 | struct osmo_mgcpc_ep_ci *mgw_endpoint_ci_msc; |
Harald Welte | 519c7e1 | 2018-01-28 02:45:46 +0100 | [diff] [blame] | 288 | } user_plane; |
Harald Welte | c997ceb | 2018-05-30 01:39:43 +0200 | [diff] [blame] | 289 | |
| 290 | /* LCLS (local call, local switch) related state */ |
| 291 | struct { |
| 292 | uint8_t global_call_ref[15]; |
| 293 | uint8_t global_call_ref_len; /* length of global_call_ref */ |
Max | fe65ece | 2018-11-09 13:36:11 +0100 | [diff] [blame] | 294 | enum gsm0808_lcls_config config; /* TS 48.008 3.2.2.116 */ |
| 295 | enum gsm0808_lcls_control control; /* TS 48.008 3.2.2.117 */ |
Harald Welte | c997ceb | 2018-05-30 01:39:43 +0200 | [diff] [blame] | 296 | /* LCLS FSM */ |
| 297 | struct osmo_fsm_inst *fi; |
| 298 | /* pointer to "other" connection, if Call Leg Relocation was successful */ |
| 299 | struct gsm_subscriber_connection *other; |
| 300 | } lcls; |
Pau Espin Pedrol | 7950e5d | 2019-10-31 15:59:49 +0100 | [diff] [blame] | 301 | |
| 302 | /* MS Power Class, TS 05.05 sec 4.1.1 "Mobile station". 0 means unset. */ |
| 303 | uint8_t ms_power_class:3; |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 304 | }; |
| 305 | |
Harald Welte | f142c97 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 306 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 307 | /* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018 Table 10.5.2.33b.1: |
| 308 | 4-bit index is used (2#1111 = 10#15) */ |
| 309 | #define SI2Q_MAX_NUM 16 |
| 310 | /* length in bits (for single SI2quater message) */ |
| 311 | #define SI2Q_MAX_LEN 160 |
| 312 | #define SI2Q_MIN_LEN 18 |
| 313 | |
| 314 | struct osmo_bsc_data; |
| 315 | |
| 316 | struct osmo_bsc_sccp_con; |
| 317 | |
| 318 | /* Channel Request reason */ |
| 319 | enum gsm_chreq_reason_t { |
| 320 | GSM_CHREQ_REASON_EMERG, |
| 321 | GSM_CHREQ_REASON_PAG, |
| 322 | GSM_CHREQ_REASON_CALL, |
| 323 | GSM_CHREQ_REASON_LOCATION_UPD, |
| 324 | GSM_CHREQ_REASON_OTHER, |
| 325 | GSM_CHREQ_REASON_PDCH, |
| 326 | }; |
| 327 | |
| 328 | /* lchans 0..3 are SDCCH in combined channel configuration, |
| 329 | use 4 as magic number for BCCH hack - see osmo-bts-../oml.c:opstart_compl() */ |
| 330 | #define CCCH_LCHAN 4 |
| 331 | |
| 332 | #define TRX_NR_TS 8 |
| 333 | #define TS_MAX_LCHAN 8 |
| 334 | |
| 335 | #define HARDCODED_ARFCN 123 |
| 336 | #define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */ |
| 337 | |
| 338 | /* for multi-drop config */ |
| 339 | #define HARDCODED_BTS0_TS 1 |
| 340 | #define HARDCODED_BTS1_TS 6 |
| 341 | #define HARDCODED_BTS2_TS 11 |
| 342 | |
| 343 | #define MAX_VERSION_LENGTH 64 |
| 344 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 345 | enum gsm_hooks { |
| 346 | GSM_HOOK_NM_SWLOAD, |
| 347 | GSM_HOOK_RR_PAGING, |
| 348 | GSM_HOOK_RR_SECURITY, |
| 349 | }; |
| 350 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 351 | enum bts_gprs_mode { |
| 352 | BTS_GPRS_NONE = 0, |
| 353 | BTS_GPRS_GPRS = 1, |
| 354 | BTS_GPRS_EGPRS = 2, |
| 355 | }; |
| 356 | |
| 357 | struct gsm_lchan; |
| 358 | struct osmo_rtp_socket; |
| 359 | struct rtp_socket; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 360 | |
| 361 | /* Network Management State */ |
| 362 | struct gsm_nm_state { |
| 363 | uint8_t operational; |
| 364 | uint8_t administrative; |
| 365 | uint8_t availability; |
| 366 | }; |
| 367 | |
| 368 | struct gsm_abis_mo { |
| 369 | uint8_t obj_class; |
| 370 | uint8_t procedure_pending; |
| 371 | struct abis_om_obj_inst obj_inst; |
| 372 | const char *name; |
| 373 | struct gsm_nm_state nm_state; |
| 374 | struct tlv_parsed *nm_attr; |
| 375 | struct gsm_bts *bts; |
| 376 | }; |
| 377 | |
| 378 | /* Ericsson OM2000 Managed Object */ |
| 379 | struct abis_om2k_mo { |
| 380 | uint8_t class; |
| 381 | uint8_t bts; |
| 382 | uint8_t assoc_so; |
| 383 | uint8_t inst; |
| 384 | } __attribute__ ((packed)); |
| 385 | |
| 386 | struct om2k_mo { |
| 387 | struct abis_om2k_mo addr; |
| 388 | struct osmo_fsm_inst *fsm; |
| 389 | }; |
| 390 | |
| 391 | #define A38_XOR_MIN_KEY_LEN 12 |
| 392 | #define A38_XOR_MAX_KEY_LEN 16 |
| 393 | #define A38_COMP128_KEY_LEN 16 |
| 394 | #define RSL_ENC_ALG_A5(x) (x+1) |
Neels Hofmeyr | 19ec374 | 2020-07-08 02:58:52 +0200 | [diff] [blame] | 395 | /* Up to 16 SI2quater are multiplexed; each fits 3 EARFCNS, so the practical maximum is 3*16. |
| 396 | * The real maximum that fits in a total of 16 SI2quater rest octets also depends on the bits left by other SI2quater |
| 397 | * rest octets elements, so to really fit 48 EARFCNs most other SI2quater elements need to be omitted. */ |
| 398 | #define MAX_EARFCN_LIST (3*16) |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 399 | |
| 400 | /* is the data link established? who established it? */ |
| 401 | #define LCHAN_SAPI_UNUSED 0 |
| 402 | #define LCHAN_SAPI_MS 1 |
| 403 | #define LCHAN_SAPI_NET 2 |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 404 | |
| 405 | /* BTS ONLY */ |
| 406 | #define MAX_NUM_UL_MEAS 104 |
| 407 | #define LC_UL_M_F_L1_VALID (1 << 0) |
| 408 | #define LC_UL_M_F_RES_VALID (1 << 1) |
| 409 | |
| 410 | struct bts_ul_meas { |
| 411 | /* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */ |
| 412 | uint16_t ber10k; |
| 413 | /* timing advance offset (in quarter bits) */ |
| 414 | int16_t ta_offs_qbits; |
| 415 | /* C/I ratio in dB */ |
| 416 | float c_i; |
| 417 | /* flags */ |
| 418 | uint8_t is_sub:1; |
| 419 | /* RSSI in dBm * -1 */ |
| 420 | uint8_t inv_rssi; |
| 421 | }; |
| 422 | |
| 423 | struct bts_codec_conf { |
| 424 | uint8_t hr; |
| 425 | uint8_t efr; |
| 426 | uint8_t amr; |
| 427 | }; |
| 428 | |
| 429 | struct amr_mode { |
| 430 | uint8_t mode; |
| 431 | uint8_t threshold; |
| 432 | uint8_t hysteresis; |
| 433 | }; |
| 434 | |
| 435 | struct amr_multirate_conf { |
| 436 | uint8_t gsm48_ie[2]; |
| 437 | struct amr_mode ms_mode[4]; |
| 438 | struct amr_mode bts_mode[4]; |
| 439 | uint8_t num_modes; |
| 440 | }; |
| 441 | /* /BTS ONLY */ |
| 442 | |
| 443 | enum lchan_csd_mode { |
| 444 | LCHAN_CSD_M_NT, |
| 445 | LCHAN_CSD_M_T_1200_75, |
| 446 | LCHAN_CSD_M_T_600, |
| 447 | LCHAN_CSD_M_T_1200, |
| 448 | LCHAN_CSD_M_T_2400, |
| 449 | LCHAN_CSD_M_T_9600, |
| 450 | LCHAN_CSD_M_T_14400, |
| 451 | LCHAN_CSD_M_T_29000, |
| 452 | LCHAN_CSD_M_T_32000, |
| 453 | }; |
| 454 | |
| 455 | /* State of the SAPIs in the lchan */ |
| 456 | enum lchan_sapi_state { |
| 457 | LCHAN_SAPI_S_NONE, |
| 458 | LCHAN_SAPI_S_REQ, |
| 459 | LCHAN_SAPI_S_ASSIGNED, |
| 460 | LCHAN_SAPI_S_REL, |
| 461 | LCHAN_SAPI_S_ERROR, |
| 462 | }; |
| 463 | |
Neels Hofmeyr | 92b9f2e | 2018-02-14 00:19:11 +0100 | [diff] [blame] | 464 | #define MAX_A5_KEY_LEN (128/8) |
| 465 | |
| 466 | struct gsm_encr { |
| 467 | uint8_t alg_id; |
| 468 | uint8_t key_len; |
| 469 | uint8_t key[MAX_A5_KEY_LEN]; |
| 470 | }; |
| 471 | |
Neels Hofmeyr | 8da2233 | 2018-04-11 01:43:41 +0200 | [diff] [blame] | 472 | #define LOGPLCHAN(lchan, ss, level, fmt, args...) \ |
| 473 | LOGP(ss, level, "%s (ss=%d,%s) (%s) " fmt, \ |
| 474 | lchan ? gsm_ts_and_pchan_name(lchan->ts) : "-", \ |
| 475 | lchan ? lchan->nr : 0, \ |
| 476 | lchan ? gsm_lchant_name(lchan->type) : "-", \ |
| 477 | bsc_subscr_name(lchan && lchan->conn ? lchan->conn->bsub : NULL), \ |
| 478 | ## args) |
| 479 | |
Pau Espin Pedrol | d3e8e0c | 2018-11-28 16:35:10 +0100 | [diff] [blame] | 480 | /* Iterate lchans that have an FSM allocated based based on explicit pchan kind |
| 481 | * (GSM_PCHAN_* constant). |
| 482 | * Remark: PDCH related lchans are not handled in BSC but in PCU, so trying to |
| 483 | * iterate through GSM_PCHAN_PDCH is considered a void loop. |
| 484 | */ |
| 485 | #define ts_as_pchan_for_each_lchan(lchan, ts, as_pchan) \ |
| 486 | for (lchan = (ts)->lchan; \ |
| 487 | ((lchan - (ts)->lchan) < ARRAY_SIZE((ts)->lchan)) \ |
| 488 | && lchan->fi \ |
| 489 | && lchan->nr < pchan_subslots(as_pchan); \ |
| 490 | lchan++) |
| 491 | |
Pau Espin Pedrol | 7ae0f9c | 2018-11-28 16:37:37 +0100 | [diff] [blame] | 492 | /* Iterate lchans that have an FSM allocated based on current PCHAN |
| 493 | * mode set in \ref ts. |
| 494 | * usage: |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 495 | * struct gsm_lchan *lchan; |
| 496 | * struct gsm_bts_trx_ts *ts = get_some_timeslot(); |
| 497 | * ts_for_each_lchan(lchan, ts) { |
| 498 | * LOGPLCHAN(DMAIN, LOGL_DEBUG, "hello world\n"); |
| 499 | * } |
Pau Espin Pedrol | 7ae0f9c | 2018-11-28 16:37:37 +0100 | [diff] [blame] | 500 | */ |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 501 | #define ts_for_each_lchan(lchan, ts) ts_as_pchan_for_each_lchan(lchan, ts, (ts)->pchan_is) |
| 502 | |
Pau Espin Pedrol | 0ba20df | 2018-11-28 16:39:29 +0100 | [diff] [blame] | 503 | /* Iterate over all possible lchans available that have an FSM allocated based |
| 504 | * on PCHAN \ref ts (dynamic) configuration. |
| 505 | * Iterate all lchan instances set up by this \ref ts type, including those |
| 506 | * lchans currently disabled or in process of being enabled (e.g. due to dynamic |
| 507 | * timeslot in switchover). Compare ts_for_each_lchan(), which iterates only the |
| 508 | * enabled lchans. |
| 509 | * For example, it is useful in case dynamic timeslot \ref ts is in process of |
| 510 | * switching from configuration PDCH (no lchans) to TCH_F (1 lchan), where |
| 511 | * pchan_is is still set to PDCH but \ref ts may contain already an \ref lchan |
| 512 | * of type TCH_F which initiated the request to switch the \ts configuration. |
| 513 | */ |
| 514 | #define ts_for_each_potential_lchan(lchan, ts) ts_as_pchan_for_each_lchan(lchan, ts, (ts)->pchan_on_init) |
| 515 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 516 | enum lchan_activate_mode { |
| 517 | FOR_NONE, |
| 518 | FOR_MS_CHANNEL_REQUEST, |
| 519 | FOR_ASSIGNMENT, |
| 520 | FOR_HANDOVER, |
| 521 | FOR_VTY, |
| 522 | }; |
| 523 | |
| 524 | extern const struct value_string lchan_activate_mode_names[]; |
| 525 | static inline const char *lchan_activate_mode_name(enum lchan_activate_mode activ_for) |
| 526 | { return get_value_string(lchan_activate_mode_names, activ_for); } |
| 527 | |
Neels Hofmeyr | 700e518 | 2018-12-19 17:19:02 +0100 | [diff] [blame] | 528 | struct lchan_activate_info { |
| 529 | enum lchan_activate_mode activ_for; |
| 530 | struct gsm_subscriber_connection *for_conn; |
| 531 | /* This always is for a specific lchan, so its lchan->type indicates full or half rate. |
| 532 | * When a dyn TS was selected, the lchan->type has been set to the desired rate. */ |
| 533 | enum gsm48_chan_mode chan_mode; |
Neels Hofmeyr | 58cf1b1 | 2019-03-15 02:49:18 +0100 | [diff] [blame] | 534 | struct gsm_encr encr; |
Neels Hofmeyr | 38134ea | 2018-12-21 03:01:00 +0100 | [diff] [blame] | 535 | /* AMR config */ |
Neels Hofmeyr | 700e518 | 2018-12-19 17:19:02 +0100 | [diff] [blame] | 536 | uint16_t s15_s0; |
| 537 | bool requires_voice_stream; |
| 538 | bool wait_before_switching_rtp; /*< true = requires LCHAN_EV_READY_TO_SWITCH_RTP */ |
| 539 | uint16_t msc_assigned_cic; |
Neels Hofmeyr | 38134ea | 2018-12-21 03:01:00 +0100 | [diff] [blame] | 540 | /* During intra-BSC handover, we keep the MGW endpoint intact and just re-route to the new lchan. This |
| 541 | * activate_info is for the new lchan, the re_use_mgw_endpoint_from_lchan points at the old lchan. */ |
Neels Hofmeyr | 700e518 | 2018-12-19 17:19:02 +0100 | [diff] [blame] | 542 | struct gsm_lchan *re_use_mgw_endpoint_from_lchan; |
| 543 | }; |
| 544 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 545 | struct gsm_lchan { |
| 546 | /* The TS that we're part of */ |
| 547 | struct gsm_bts_trx_ts *ts; |
| 548 | /* The logical subslot number in the TS */ |
| 549 | uint8_t nr; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 550 | char *name; |
| 551 | |
Neels Hofmeyr | eee24eb | 2018-11-06 21:39:15 +0100 | [diff] [blame] | 552 | char *last_error; |
| 553 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 554 | struct osmo_fsm_inst *fi; |
Neels Hofmeyr | ac85b34 | 2018-07-12 21:23:26 +0200 | [diff] [blame] | 555 | struct osmo_fsm_inst *fi_rtp; |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 556 | struct osmo_mgcpc_ep_ci *mgw_endpoint_ci_bts; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 557 | |
| 558 | struct { |
Neels Hofmeyr | 700e518 | 2018-12-19 17:19:02 +0100 | [diff] [blame] | 559 | struct lchan_activate_info info; |
Neels Hofmeyr | ac85b34 | 2018-07-12 21:23:26 +0200 | [diff] [blame] | 560 | bool activ_ack; /*< true as soon as RSL Chan Activ Ack is received */ |
Neels Hofmeyr | 369fba2 | 2018-11-27 01:30:50 +0100 | [diff] [blame] | 561 | bool immediate_assignment_sent; |
Neels Hofmeyr | 193c1e3 | 2018-08-27 22:06:24 +0200 | [diff] [blame] | 562 | /*! This flag ensures that when an lchan activation has succeeded, and we have already |
| 563 | * sent ACKs like Immediate Assignment or BSSMAP Assignment Complete, and if other errors |
| 564 | * occur later, e.g. during release, that we don't send a NACK out of context. */ |
| 565 | bool concluded; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 566 | enum gsm0808_cause gsm0808_error_cause; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 567 | } activate; |
| 568 | |
Neels Hofmeyr | eee24eb | 2018-11-06 21:39:15 +0100 | [diff] [blame] | 569 | struct { |
| 570 | /* If an event to release the lchan comes in while still waiting for responses, just mark this |
| 571 | * flag, so that the lchan will gracefully release at the next sensible junction. */ |
| 572 | bool requested; |
| 573 | bool do_rr_release; |
Neels Hofmeyr | b523f54 | 2020-07-09 15:54:40 +0200 | [diff] [blame] | 574 | enum gsm48_rr_cause rr_cause; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 575 | |
Neels Hofmeyr | eee24eb | 2018-11-06 21:39:15 +0100 | [diff] [blame] | 576 | /* There is an RSL error cause of value 0, so we need a separate flag. */ |
| 577 | bool in_error; |
| 578 | /* RSL error code, RSL_ERR_* */ |
| 579 | uint8_t rsl_error_cause; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 580 | |
Neels Hofmeyr | eee24eb | 2018-11-06 21:39:15 +0100 | [diff] [blame] | 581 | /* If a release event is being handled, ignore other ricocheting release events until that |
| 582 | * release handling has concluded. */ |
| 583 | bool in_release_handler; |
Harald Welte | 963763d | 2019-02-03 12:11:12 +0100 | [diff] [blame] | 584 | |
| 585 | /* is this release at the end of a CSFB call? */ |
| 586 | bool is_csfb; |
Neels Hofmeyr | eee24eb | 2018-11-06 21:39:15 +0100 | [diff] [blame] | 587 | } release; |
Neels Hofmeyr | d5df9a1 | 2018-07-20 05:35:47 +0200 | [diff] [blame] | 588 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 589 | /* The logical channel type */ |
| 590 | enum gsm_chan_t type; |
| 591 | /* RSL channel mode */ |
| 592 | enum rsl_cmod_spd rsl_cmode; |
| 593 | /* If TCH, traffic channel mode */ |
| 594 | enum gsm48_chan_mode tch_mode; |
| 595 | enum lchan_csd_mode csd_mode; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 596 | /* Power levels for MS and BTS */ |
| 597 | uint8_t bs_power; |
| 598 | uint8_t ms_power; |
| 599 | /* Encryption information */ |
| 600 | struct gsm_encr encr; |
| 601 | |
| 602 | /* AMR bits */ |
| 603 | uint8_t mr_ms_lv[7]; |
| 604 | uint8_t mr_bts_lv[7]; |
Neels Hofmeyr | 4daa210 | 2019-01-30 16:46:58 +0100 | [diff] [blame] | 605 | /* AMR bits were based on these rate bits: */ |
| 606 | uint16_t s15_s0; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 607 | |
| 608 | /* Established data link layer services */ |
| 609 | uint8_t sapis[8]; |
| 610 | |
| 611 | struct { |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 612 | uint32_t bound_ip; /*< where the BTS receives RTP */ |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 613 | uint16_t bound_port; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 614 | uint32_t connect_ip; /*< where the BTS sends RTP to (MGW) */ |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 615 | uint16_t connect_port; |
| 616 | uint16_t conn_id; |
| 617 | uint8_t rtp_payload; |
| 618 | uint8_t rtp_payload2; |
| 619 | uint8_t speech_mode; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 620 | |
| 621 | /* info we need to postpone the AoIP |
| 622 | * assignment completed message */ |
| 623 | struct { |
| 624 | uint8_t rr_cause; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 625 | bool valid; |
| 626 | } ass_compl; |
| 627 | } abis_ip; |
| 628 | |
| 629 | uint8_t rqd_ta; |
| 630 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 631 | /* table of neighbor cell measurements */ |
| 632 | struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS]; |
| 633 | |
| 634 | /* cache of last measurement reports on this lchan */ |
| 635 | struct gsm_meas_rep meas_rep[MAX_MEAS_REP]; |
| 636 | int meas_rep_idx; |
| 637 | int meas_rep_count; |
Neels Hofmeyr | 35ba85c | 2018-02-12 16:47:40 +0100 | [diff] [blame] | 638 | uint8_t meas_rep_last_seen_nr; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 639 | |
| 640 | /* GSM Random Access data */ |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 641 | /* TODO: don't allocate this, rather keep an "is_present" flag */ |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 642 | struct gsm48_req_ref *rqd_ref; |
| 643 | |
| 644 | struct gsm_subscriber_connection *conn; |
Philipp Maier | bb66d10 | 2019-01-22 11:29:06 +0100 | [diff] [blame] | 645 | |
| 646 | /* Depending on the preferences that where submitted together with |
| 647 | * the assignment and the current channel load, the BSC has to select |
| 648 | * one of the offered codec/rates. The final selection by the BSC is |
| 649 | * stored here and is used when sending the assignment complete or |
| 650 | * when performing a handover procedure. */ |
| 651 | struct channel_mode_and_rate ch_mode_rate; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 652 | }; |
| 653 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 654 | /* One Timeslot in a TRX */ |
| 655 | struct gsm_bts_trx_ts { |
| 656 | struct gsm_bts_trx *trx; |
| 657 | /* number of this timeslot at the TRX */ |
| 658 | uint8_t nr; |
| 659 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 660 | struct osmo_fsm_inst *fi; |
| 661 | char *last_errmsg; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 662 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 663 | /* vty phys_chan_config setting, not necessarily in effect in case it was changed in the telnet |
| 664 | * vty after OML activation. Gets written on vty 'write file'. */ |
| 665 | enum gsm_phys_chan_config pchan_from_config; |
| 666 | /* When the timeslot OML is established, pchan_from_config is copied here. This is the pchan |
| 667 | * currently in effect; for dynamic ts, this is the dyn kind (GSM_PCHAN_TCH_F_TCH_H_PDCH or |
| 668 | * GSM_PCHAN_TCH_F_PDCH) and does not show the pchan type currently active. */ |
| 669 | enum gsm_phys_chan_config pchan_on_init; |
| 670 | /* This is the *actual* pchan type currently active. For dynamic timeslots, this reflects either |
| 671 | * GSM_PCHAN_NONE or one of the standard GSM_PCHAN_TCH_F, GSM_PCHAN_TCH_H, GSM_PCHAN_PDCH. |
| 672 | * Callers can use this transparently without being aware of dyn ts. */ |
| 673 | enum gsm_phys_chan_config pchan_is; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 674 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 675 | /* After a PDCH ACT NACK, we shall not infinitely loop to try and ACT again. |
| 676 | * Also marks a timeslot where PDCH was deactivated by VTY. This is cleared whenever a timeslot |
| 677 | * enters IN_USE state, i.e. after each TCH use we try to PDCH ACT once again. */ |
| 678 | bool pdch_act_allowed; |
| 679 | |
Neels Hofmeyr | bcdbfb7 | 2018-07-26 20:33:15 +0200 | [diff] [blame] | 680 | /* Whether TS_EV_OML_READY was received */ |
| 681 | bool is_oml_ready; |
| 682 | /* Whether TS_EV_RSL_READY was received */ |
| 683 | bool is_rsl_ready; |
| 684 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 685 | struct gsm_abis_mo mo; |
| 686 | struct tlv_parsed nm_attr; |
| 687 | uint8_t nm_chan_comb; |
| 688 | int tsc; /* -1 == use BTS TSC */ |
| 689 | |
| 690 | struct { |
| 691 | /* Parameters below are configured by VTY */ |
| 692 | int enabled; |
| 693 | uint8_t maio; |
| 694 | uint8_t hsn; |
| 695 | struct bitvec arfcns; |
| 696 | uint8_t arfcns_data[1024/8]; |
| 697 | /* This is the pre-computed MA for channel assignments */ |
| 698 | struct bitvec ma; |
| 699 | uint8_t ma_len; /* part of ma_data that is used */ |
| 700 | uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */ |
| 701 | } hopping; |
| 702 | |
| 703 | /* To which E1 subslot are we connected */ |
| 704 | struct gsm_e1_subslot e1_link; |
| 705 | |
| 706 | union { |
| 707 | struct { |
| 708 | struct om2k_mo om2k_mo; |
| 709 | } rbs2000; |
| 710 | }; |
| 711 | |
| 712 | struct gsm_lchan lchan[TS_MAX_LCHAN]; |
| 713 | }; |
| 714 | |
| 715 | /* One TRX in a BTS */ |
| 716 | struct gsm_bts_trx { |
| 717 | /* list header in bts->trx_list */ |
| 718 | struct llist_head list; |
| 719 | |
| 720 | struct gsm_bts *bts; |
| 721 | /* number of this TRX in the BTS */ |
| 722 | uint8_t nr; |
| 723 | /* human readable name / description */ |
| 724 | char *description; |
| 725 | /* how do we talk RSL with this TRX? */ |
| 726 | struct gsm_e1_subslot rsl_e1_link; |
| 727 | uint8_t rsl_tei; |
| 728 | struct e1inp_sign_link *rsl_link; |
| 729 | |
| 730 | /* Timeout for initiating the RSL connection. */ |
| 731 | struct osmo_timer_list rsl_connect_timeout; |
| 732 | |
| 733 | /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ |
| 734 | struct e1inp_sign_link *oml_link; |
| 735 | |
| 736 | struct gsm_abis_mo mo; |
| 737 | struct tlv_parsed nm_attr; |
| 738 | struct { |
| 739 | struct gsm_abis_mo mo; |
| 740 | } bb_transc; |
| 741 | |
| 742 | uint16_t arfcn; |
| 743 | int nominal_power; /* in dBm */ |
| 744 | unsigned int max_power_red; /* in actual dB */ |
| 745 | |
| 746 | union { |
| 747 | struct { |
| 748 | struct { |
| 749 | struct gsm_abis_mo mo; |
| 750 | } bbsig; |
| 751 | struct { |
| 752 | struct gsm_abis_mo mo; |
| 753 | } pa; |
| 754 | } bs11; |
| 755 | struct { |
| 756 | unsigned int test_state; |
| 757 | uint8_t test_nr; |
| 758 | struct rxlev_stats rxlev_stat; |
| 759 | } ipaccess; |
| 760 | struct { |
| 761 | struct { |
| 762 | struct om2k_mo om2k_mo; |
| 763 | } trxc; |
| 764 | struct { |
| 765 | struct om2k_mo om2k_mo; |
| 766 | } rx; |
| 767 | struct { |
| 768 | struct om2k_mo om2k_mo; |
| 769 | } tx; |
| 770 | } rbs2000; |
| 771 | }; |
| 772 | struct gsm_bts_trx_ts ts[TRX_NR_TS]; |
| 773 | }; |
| 774 | |
| 775 | #define GSM_BTS_SI2Q(bts, i) (struct gsm48_system_information_type_2quater *)((bts)->si_buf[SYSINFO_TYPE_2quater][i]) |
| 776 | #define GSM_BTS_HAS_SI(bts, i) ((bts)->si_valid & (1 << i)) |
| 777 | #define GSM_BTS_SI(bts, i) (void *)((bts)->si_buf[i][0]) |
| 778 | #define GSM_LCHAN_SI(lchan, i) (void *)((lchan)->si.buf[i][0]) |
| 779 | |
| 780 | enum gsm_bts_type { |
| 781 | GSM_BTS_TYPE_UNKNOWN, |
| 782 | GSM_BTS_TYPE_BS11, |
| 783 | GSM_BTS_TYPE_NANOBTS, |
| 784 | GSM_BTS_TYPE_RBS2000, |
| 785 | GSM_BTS_TYPE_NOKIA_SITE, |
| 786 | GSM_BTS_TYPE_OSMOBTS, |
| 787 | _NUM_GSM_BTS_TYPE |
| 788 | }; |
| 789 | |
| 790 | enum gsm_bts_type_variant { |
| 791 | BTS_UNKNOWN, |
| 792 | BTS_OSMO_LITECELL15, |
| 793 | BTS_OSMO_OCTPHY, |
| 794 | BTS_OSMO_SYSMO, |
| 795 | BTS_OSMO_TRX, |
| 796 | _NUM_BTS_VARIANT |
| 797 | }; |
| 798 | |
| 799 | /* Used by OML layer for BTS Attribute reporting */ |
| 800 | enum bts_attribute { |
| 801 | BTS_TYPE_VARIANT, |
| 802 | BTS_SUB_MODEL, |
| 803 | TRX_PHY_VERSION, |
| 804 | }; |
| 805 | |
| 806 | struct vty; |
| 807 | |
| 808 | struct gsm_bts_model { |
| 809 | struct llist_head list; |
| 810 | |
| 811 | enum gsm_bts_type type; |
| 812 | enum gsm_bts_type_variant variant; |
| 813 | const char *name; |
| 814 | |
| 815 | bool started; |
| 816 | int (*start)(struct gsm_network *net); |
| 817 | int (*oml_rcvmsg)(struct msgb *msg); |
| 818 | char * (*oml_status)(const struct gsm_bts *bts); |
| 819 | |
| 820 | void (*e1line_bind_ops)(struct e1inp_line *line); |
| 821 | |
| 822 | void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts); |
| 823 | void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx); |
| 824 | void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts); |
| 825 | |
Pau Espin Pedrol | 167cb82 | 2018-11-19 17:48:17 +0100 | [diff] [blame] | 826 | /* Should SI2bis and SI2ter be disabled by default on this BTS model? */ |
| 827 | bool force_combined_si; |
| 828 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 829 | struct tlv_definition nm_att_tlvdef; |
| 830 | |
| 831 | /* features of a given BTS model set via gsm_bts_model_register() locally */ |
| 832 | struct bitvec features; |
| 833 | uint8_t _features_data[MAX_BTS_FEATURES/8]; |
| 834 | }; |
| 835 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 836 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 837 | |
| 838 | /* |
| 839 | * This keeps track of the paging status of one BTS. It |
| 840 | * includes a number of pending requests, a back pointer |
| 841 | * to the gsm_bts, a timer and some more state. |
| 842 | */ |
| 843 | struct gsm_bts_paging_state { |
| 844 | /* pending requests */ |
| 845 | struct llist_head pending_requests; |
| 846 | struct gsm_bts *bts; |
| 847 | |
| 848 | struct osmo_timer_list work_timer; |
| 849 | struct osmo_timer_list credit_timer; |
| 850 | |
| 851 | /* free chans needed */ |
| 852 | int free_chans_need; |
| 853 | |
| 854 | /* load */ |
| 855 | uint16_t available_slots; |
| 856 | }; |
| 857 | |
| 858 | struct gsm_envabtse { |
| 859 | struct gsm_abis_mo mo; |
| 860 | }; |
| 861 | |
| 862 | struct gsm_bts_gprs_nsvc { |
| 863 | struct gsm_bts *bts; |
| 864 | /* data read via VTY config file, to configure the BTS |
| 865 | * via OML from BSC */ |
| 866 | int id; |
| 867 | uint16_t nsvci; |
| 868 | uint16_t local_port; /* on the BTS */ |
| 869 | uint16_t remote_port; /* on the SGSN */ |
| 870 | uint32_t remote_ip; /* on the SGSN */ |
| 871 | |
| 872 | struct gsm_abis_mo mo; |
| 873 | }; |
| 874 | |
| 875 | enum gprs_rlc_par { |
| 876 | RLC_T3142, |
| 877 | RLC_T3169, |
| 878 | RLC_T3191, |
| 879 | RLC_T3193, |
| 880 | RLC_T3195, |
| 881 | RLC_N3101, |
| 882 | RLC_N3103, |
| 883 | RLC_N3105, |
| 884 | CV_COUNTDOWN, |
| 885 | T_DL_TBF_EXT, /* ms */ |
| 886 | T_UL_TBF_EXT, /* ms */ |
| 887 | _NUM_RLC_PAR |
| 888 | }; |
| 889 | |
| 890 | enum gprs_cs { |
| 891 | GPRS_CS1, |
| 892 | GPRS_CS2, |
| 893 | GPRS_CS3, |
| 894 | GPRS_CS4, |
| 895 | GPRS_MCS1, |
| 896 | GPRS_MCS2, |
| 897 | GPRS_MCS3, |
| 898 | GPRS_MCS4, |
| 899 | GPRS_MCS5, |
| 900 | GPRS_MCS6, |
| 901 | GPRS_MCS7, |
| 902 | GPRS_MCS8, |
| 903 | GPRS_MCS9, |
| 904 | _NUM_GRPS_CS |
| 905 | }; |
| 906 | |
| 907 | struct gprs_rlc_cfg { |
| 908 | uint16_t parameter[_NUM_RLC_PAR]; |
| 909 | struct { |
| 910 | uint16_t repeat_time; /* ms */ |
| 911 | uint8_t repeat_count; |
| 912 | } paging; |
| 913 | uint32_t cs_mask; /* bitmask of gprs_cs */ |
| 914 | uint8_t initial_cs; |
| 915 | uint8_t initial_mcs; |
| 916 | }; |
| 917 | |
| 918 | |
| 919 | enum neigh_list_manual_mode { |
| 920 | NL_MODE_AUTOMATIC = 0, |
| 921 | NL_MODE_MANUAL = 1, |
| 922 | NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */ |
| 923 | }; |
| 924 | |
| 925 | enum bts_loc_fix { |
| 926 | BTS_LOC_FIX_INVALID = 0, |
| 927 | BTS_LOC_FIX_2D = 1, |
| 928 | BTS_LOC_FIX_3D = 2, |
| 929 | }; |
| 930 | |
| 931 | extern const struct value_string bts_loc_fix_names[]; |
| 932 | |
| 933 | struct bts_location { |
| 934 | struct llist_head list; |
| 935 | time_t tstamp; |
| 936 | enum bts_loc_fix valid; |
| 937 | double lat; |
| 938 | double lon; |
| 939 | double height; |
| 940 | }; |
| 941 | |
| 942 | /* Channel load counter */ |
| 943 | struct load_counter { |
| 944 | unsigned int total; |
| 945 | unsigned int used; |
| 946 | }; |
| 947 | |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 948 | /* Useful to track N-N relations between BTS, for example neighbors. */ |
| 949 | struct gsm_bts_ref { |
| 950 | struct llist_head entry; |
| 951 | struct gsm_bts *bts; |
| 952 | }; |
| 953 | |
Harald Welte | d41b7c7 | 2019-06-13 09:41:58 +0200 | [diff] [blame] | 954 | /* A single Page of a SMSCB message */ |
| 955 | struct bts_smscb_page { |
| 956 | /* SMSCB message we're part of */ |
| 957 | struct bts_smscb_message *msg; |
| 958 | /* Page Number within message (1 to 15) */ |
| 959 | uint8_t nr; |
| 960 | /* number of valid blocks in data (up to 4) */ |
| 961 | uint8_t num_blocks; |
| 962 | /* up to four blocks of 22 bytes each */ |
| 963 | uint8_t data[88]; |
| 964 | }; |
| 965 | |
| 966 | /* A SMSCB message (received from CBSP) */ |
| 967 | struct bts_smscb_message { |
| 968 | /* entry in bts_smscb_chan_state.messages */ |
| 969 | struct llist_head list; |
| 970 | struct { |
| 971 | /* input data from CBSP (CBC) side */ |
| 972 | uint16_t msg_id; |
| 973 | uint16_t serial_nr; |
| 974 | enum cbsp_category category; |
| 975 | uint16_t rep_period; |
| 976 | uint16_t num_bcast_req; |
| 977 | uint8_t dcs; |
| 978 | } input; |
| 979 | /* how often have all pages of this message been broadcast? */ |
| 980 | uint32_t bcast_count; |
| 981 | /* actual page data of this message */ |
| 982 | uint8_t num_pages; /* up to 15 */ |
| 983 | struct bts_smscb_page page[15]; |
| 984 | }; |
| 985 | |
| 986 | /* per-channel (basic/extended) CBCH state for a single BTS */ |
| 987 | struct bts_smscb_chan_state { |
| 988 | /* back-pointer to BTS */ |
| 989 | struct gsm_bts *bts; |
| 990 | /* list of bts_smscb_message */ |
| 991 | struct llist_head messages; |
| 992 | /* scheduling array; pointer of SMSCB pages */ |
| 993 | struct bts_smscb_page **sched_arr; |
| 994 | size_t sched_arr_size; |
| 995 | /* index of the next to be transmitted page into the scheduler array */ |
| 996 | size_t next_idx; |
| 997 | /* number of messages we have to pause due to overflow */ |
| 998 | uint8_t overflow; |
| 999 | }; |
| 1000 | |
Oliver Smith | ba0a122 | 2020-03-18 12:39:30 +0100 | [diff] [blame] | 1001 | struct bts_oml_fail_rep { |
| 1002 | struct llist_head list; |
| 1003 | time_t time; |
| 1004 | struct msgb *mb; |
| 1005 | }; |
| 1006 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1007 | /* One BTS */ |
| 1008 | struct gsm_bts { |
| 1009 | /* list header in net->bts_list */ |
| 1010 | struct llist_head list; |
| 1011 | |
| 1012 | /* Geographical location of the BTS */ |
| 1013 | struct llist_head loc_list; |
| 1014 | |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1015 | /* number of this BTS in network */ |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1016 | uint8_t nr; |
| 1017 | /* human readable name / description */ |
| 1018 | char *description; |
| 1019 | /* Cell Identity */ |
| 1020 | uint16_t cell_identity; |
| 1021 | /* location area code of this BTS */ |
| 1022 | uint16_t location_area_code; |
| 1023 | /* Base Station Identification Code (BSIC), lower 3 bits is BCC, |
| 1024 | * which is used as TSC for the CCCH */ |
| 1025 | uint8_t bsic; |
| 1026 | /* type of BTS */ |
| 1027 | enum gsm_bts_type type; |
| 1028 | enum gsm_bts_type_variant variant; |
| 1029 | struct gsm_bts_model *model; |
| 1030 | enum gsm_band band; |
| 1031 | char version[MAX_VERSION_LENGTH]; |
| 1032 | char sub_model[MAX_VERSION_LENGTH]; |
| 1033 | |
| 1034 | /* features of a given BTS set/reported via OML */ |
| 1035 | struct bitvec features; |
| 1036 | uint8_t _features_data[MAX_BTS_FEATURES/8]; |
| 1037 | |
| 1038 | /* Connected PCU version (if any) */ |
| 1039 | char pcu_version[MAX_VERSION_LENGTH]; |
| 1040 | |
| 1041 | /* maximum Tx power that the MS is permitted to use in this cell */ |
| 1042 | int ms_max_power; |
| 1043 | |
| 1044 | /* how do we talk OML with this TRX? */ |
| 1045 | struct gsm_e1_subslot oml_e1_link; |
| 1046 | uint8_t oml_tei; |
| 1047 | struct e1inp_sign_link *oml_link; |
Pau Espin Pedrol | 9862bcb | 2018-08-22 21:54:12 +0200 | [diff] [blame] | 1048 | /* Timer to use for deferred drop of OML link, see \ref ipaccess_drop_oml_deferred */ |
| 1049 | struct osmo_timer_list oml_drop_link_timer; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1050 | /* when OML link was established */ |
| 1051 | time_t uptime; |
| 1052 | |
| 1053 | /* Abis network management O&M handle */ |
| 1054 | struct abis_nm_h *nmh; |
| 1055 | |
| 1056 | struct gsm_abis_mo mo; |
| 1057 | |
| 1058 | /* number of this BTS on given E1 link */ |
| 1059 | uint8_t bts_nr; |
| 1060 | |
| 1061 | /* DTX features of this BTS */ |
| 1062 | enum gsm48_dtx_mode dtxu; |
| 1063 | bool dtxd; |
| 1064 | |
| 1065 | /* paging state and control */ |
| 1066 | struct gsm_bts_paging_state paging; |
| 1067 | |
| 1068 | /* CCCH is on C0 */ |
| 1069 | struct gsm_bts_trx *c0; |
| 1070 | |
| 1071 | struct { |
| 1072 | struct gsm_abis_mo mo; |
| 1073 | } site_mgr; |
| 1074 | |
| 1075 | /* bitmask of all SI that are present/valid in si_buf */ |
| 1076 | uint32_t si_valid; |
| 1077 | /* 3GPP TS 44.018 Table 10.5.2.33b.1 INDEX and COUNT for SI2quater */ |
| 1078 | uint8_t si2q_index; /* distinguish individual SI2quater messages */ |
| 1079 | uint8_t si2q_count; /* si2q_index for the last (highest indexed) individual SI2quater message */ |
| 1080 | /* buffers where we put the pre-computed SI */ |
| 1081 | sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE][SI2Q_MAX_NUM]; |
| 1082 | /* offsets used while generating SI2quater */ |
| 1083 | size_t e_offset; |
| 1084 | size_t u_offset; |
Pau Espin Pedrol | 1cf21de | 2018-12-05 13:38:10 +0100 | [diff] [blame] | 1085 | /* 3GPP TS 08.58 §8.5.1 BCCH INFORMATION. Some nanoBTS fail upon |
| 1086 | * receival of empty SI disabling unsupported SI. see OS#3707. */ |
| 1087 | bool si_unused_send_empty; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1088 | |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1089 | /* ip.access Unit ID's have Site/BTS/TRX layout */ |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1090 | union { |
| 1091 | struct { |
| 1092 | uint16_t site_id; |
| 1093 | uint16_t bts_id; |
| 1094 | uint32_t flags; |
| 1095 | uint32_t rsl_ip; |
| 1096 | } ip_access; |
| 1097 | struct { |
| 1098 | struct { |
| 1099 | struct gsm_abis_mo mo; |
| 1100 | } cclk; |
| 1101 | struct { |
| 1102 | struct gsm_abis_mo mo; |
| 1103 | } rack; |
| 1104 | struct gsm_envabtse envabtse[4]; |
| 1105 | } bs11; |
| 1106 | struct { |
| 1107 | struct { |
| 1108 | struct om2k_mo om2k_mo; |
| 1109 | struct gsm_abis_mo mo; |
| 1110 | struct llist_head conn_groups; |
| 1111 | } cf; |
| 1112 | struct { |
| 1113 | struct om2k_mo om2k_mo; |
| 1114 | struct gsm_abis_mo mo; |
| 1115 | struct llist_head conn_groups; |
| 1116 | } is; |
| 1117 | struct { |
| 1118 | struct om2k_mo om2k_mo; |
| 1119 | struct gsm_abis_mo mo; |
| 1120 | struct llist_head conn_groups; |
| 1121 | } con; |
| 1122 | struct { |
| 1123 | struct om2k_mo om2k_mo; |
| 1124 | struct gsm_abis_mo mo; |
| 1125 | } dp; |
| 1126 | struct { |
| 1127 | struct om2k_mo om2k_mo; |
| 1128 | struct gsm_abis_mo mo; |
| 1129 | } tf; |
Sylvain Munaut | cbaa179 | 2020-05-05 20:14:44 +0200 | [diff] [blame] | 1130 | struct { |
| 1131 | struct om2k_mo om2k_mo; |
| 1132 | struct gsm_abis_mo mo; |
| 1133 | } mctr; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1134 | uint32_t use_superchannel:1; |
Sylvain Munaut | dbd1b50 | 2020-05-05 21:07:58 +0200 | [diff] [blame] | 1135 | struct { |
| 1136 | uint16_t limit; |
| 1137 | uint16_t active; |
| 1138 | } om2k_version[16]; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1139 | } rbs2000; |
| 1140 | struct { |
| 1141 | uint8_t bts_type; |
Harald Welte | 1d7349f | 2020-05-03 11:48:31 +0200 | [diff] [blame] | 1142 | unsigned int configured:1, /* we sent the config data request */ |
| 1143 | skip_reset:1, /* skip reset at bootstrap */ |
| 1144 | no_loc_rel_cnf:1, /* don't wait for RSL REL CONF */ |
| 1145 | bts_reset_timer_cnf, /* timer for BTS RESET */ |
| 1146 | did_reset:1, /* we received a RESET ACK */ |
Harald Welte | 456a62e | 2020-05-03 12:00:52 +0200 | [diff] [blame] | 1147 | wait_reset:2; /* we are waiting for reset to complete */ |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1148 | struct osmo_timer_list reset_timer; |
| 1149 | } nokia; |
| 1150 | }; |
| 1151 | |
| 1152 | /* Not entirely sure how ip.access specific this is */ |
| 1153 | struct { |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1154 | enum bts_gprs_mode mode; |
| 1155 | struct { |
| 1156 | struct gsm_abis_mo mo; |
| 1157 | uint16_t nsei; |
| 1158 | uint8_t timer[7]; |
| 1159 | } nse; |
| 1160 | struct { |
| 1161 | struct gsm_abis_mo mo; |
| 1162 | uint16_t bvci; |
| 1163 | uint8_t timer[11]; |
| 1164 | struct gprs_rlc_cfg rlc_cfg; |
| 1165 | } cell; |
| 1166 | struct gsm_bts_gprs_nsvc nsvc[2]; |
| 1167 | uint8_t rac; |
| 1168 | uint8_t net_ctrl_ord; |
| 1169 | bool ctrl_ack_type_use_block; |
Vadim Yanitskiy | e981f17 | 2020-04-06 18:09:55 +0700 | [diff] [blame] | 1170 | bool egprs_pkt_chan_request; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1171 | } gprs; |
| 1172 | |
Harald Welte | 1540025 | 2019-05-24 11:56:23 +0200 | [diff] [blame] | 1173 | /* threshold (in percent) when BTS shall send CCCH LOAD IND */ |
| 1174 | int ccch_load_ind_thresh; |
| 1175 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1176 | /* RACH NM values */ |
| 1177 | int rach_b_thresh; |
| 1178 | int rach_ldavg_slots; |
| 1179 | |
| 1180 | /* transceivers */ |
| 1181 | int num_trx; |
| 1182 | struct llist_head trx_list; |
| 1183 | |
| 1184 | /* SI related items */ |
| 1185 | int force_combined_si; |
Pau Espin Pedrol | 167cb82 | 2018-11-19 17:48:17 +0100 | [diff] [blame] | 1186 | bool force_combined_si_set; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1187 | int bcch_change_mark; |
| 1188 | |
| 1189 | /* Abis NM queue */ |
| 1190 | struct llist_head abis_queue; |
| 1191 | int abis_nm_pend; |
| 1192 | |
| 1193 | struct gsm_network *network; |
| 1194 | |
| 1195 | /* should the channel allocator allocate channels from high TRX to TRX0, |
| 1196 | * rather than starting from TRX0 and go upwards? */ |
| 1197 | int chan_alloc_reverse; |
| 1198 | |
| 1199 | enum neigh_list_manual_mode neigh_list_manual_mode; |
| 1200 | /* parameters from which we build SYSTEM INFORMATION */ |
| 1201 | struct { |
| 1202 | struct gsm48_rach_control rach_control; |
| 1203 | uint8_t ncc_permitted; |
| 1204 | struct gsm48_cell_sel_par cell_sel_par; |
| 1205 | struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */ |
| 1206 | struct gsm48_cell_options cell_options; |
| 1207 | struct gsm48_control_channel_descr chan_desc; |
| 1208 | struct bitvec neigh_list; |
| 1209 | struct bitvec cell_alloc; |
| 1210 | struct bitvec si5_neigh_list; |
| 1211 | struct osmo_earfcn_si2q si2quater_neigh_list; |
| 1212 | size_t uarfcn_length; /* index for uarfcn and scramble lists */ |
| 1213 | struct { |
| 1214 | /* bitmask large enough for all possible ARFCN's */ |
| 1215 | uint8_t neigh_list[1024/8]; |
| 1216 | uint8_t cell_alloc[1024/8]; |
| 1217 | /* If the user wants a different neighbor list in SI5 than in SI2 */ |
| 1218 | uint8_t si5_neigh_list[1024/8]; |
| 1219 | uint8_t meas_bw_list[MAX_EARFCN_LIST]; |
| 1220 | uint16_t earfcn_list[MAX_EARFCN_LIST]; |
| 1221 | uint16_t uarfcn_list[MAX_EARFCN_LIST]; |
| 1222 | uint16_t scramble_list[MAX_EARFCN_LIST]; |
| 1223 | } data; |
| 1224 | } si_common; |
| 1225 | bool early_classmark_allowed; |
| 1226 | bool early_classmark_allowed_3g; |
| 1227 | /* for testing only: Have an infinitely long radio link timeout */ |
| 1228 | bool infinite_radio_link_timeout; |
| 1229 | |
| 1230 | /* do we use static (user-defined) system information messages? (bitmask) */ |
| 1231 | uint32_t si_mode_static; |
| 1232 | |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 1233 | /* access control class ramping */ |
| 1234 | struct acc_ramp acc_ramp; |
| 1235 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1236 | /* exclude the BTS from the global RF Lock handling */ |
| 1237 | int excl_from_rf_lock; |
| 1238 | |
| 1239 | /* supported codecs beside FR */ |
| 1240 | struct bts_codec_conf codec; |
| 1241 | |
| 1242 | /* BTS dependencies bit field */ |
| 1243 | uint32_t depends_on[256/(8*4)]; |
| 1244 | |
| 1245 | /* full and half rate multirate config */ |
| 1246 | struct amr_multirate_conf mr_full; |
| 1247 | struct amr_multirate_conf mr_half; |
| 1248 | |
| 1249 | /* PCU socket state */ |
| 1250 | char *pcu_sock_path; |
| 1251 | struct pcu_sock_state *pcu_state; |
| 1252 | |
| 1253 | struct rate_ctr_group *bts_ctrs; |
| 1254 | struct osmo_stat_item_group *bts_statg; |
| 1255 | |
| 1256 | struct handover_cfg *ho; |
| 1257 | |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 1258 | /* A list of struct gsm_bts_ref, indicating neighbors of this BTS. |
| 1259 | * When the si_common neigh_list is in automatic mode, it is populated from this list as well as |
| 1260 | * gsm_network->neighbor_bss_cells. */ |
| 1261 | struct llist_head local_neighbors; |
| 1262 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1263 | /* BTS-specific overrides for timer values from struct gsm_network. */ |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1264 | uint8_t T3122; /* ASSIGNMENT REJECT wait indication */ |
Pau Espin Pedrol | 1b96334 | 2018-11-07 14:19:32 +0100 | [diff] [blame] | 1265 | bool T3113_dynamic; /* Calculate T3113 timeout dynamically based on BTS channel config and load */ |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1266 | |
| 1267 | /* Periodic channel load measurements are used to maintain T3122. */ |
| 1268 | struct load_counter chan_load_samples[7]; |
| 1269 | int chan_load_samples_idx; |
Stefan Sperling | 6442e43 | 2018-02-06 14:44:54 +0100 | [diff] [blame] | 1270 | uint8_t chan_load_avg; /* current channel load average in percent (0 - 100). */ |
Harald Welte | d41b7c7 | 2019-06-13 09:41:58 +0200 | [diff] [blame] | 1271 | |
| 1272 | /* cell broadcast system */ |
| 1273 | struct osmo_timer_list cbch_timer; |
| 1274 | struct bts_smscb_chan_state cbch_basic; |
| 1275 | struct bts_smscb_chan_state cbch_extended; |
Harald Welte | 7d88844 | 2019-09-06 23:18:27 +0200 | [diff] [blame] | 1276 | struct osmo_timer_list etws_timer; /* when to stop ETWS PN */ |
Oliver Smith | ba0a122 | 2020-03-18 12:39:30 +0100 | [diff] [blame] | 1277 | |
| 1278 | struct llist_head oml_fail_rep; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1279 | }; |
| 1280 | |
Oliver Smith | 8d8d710 | 2018-10-23 15:35:43 +0200 | [diff] [blame] | 1281 | /* One rejected BTS */ |
| 1282 | struct gsm_bts_rejected { |
| 1283 | /* list header in net->bts_rejected */ |
| 1284 | struct llist_head list; |
| 1285 | |
| 1286 | uint16_t site_id; |
| 1287 | uint16_t bts_id; |
| 1288 | char ip[INET6_ADDRSTRLEN]; |
| 1289 | time_t time; |
| 1290 | }; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1291 | |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1292 | struct gsm_network *gsm_network_init(void *ctx); |
| 1293 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1294 | struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num); |
Neels Hofmeyr | 6d568ed | 2018-07-09 16:49:18 +0200 | [diff] [blame] | 1295 | struct gsm_bts *gsm_bts_num(const struct gsm_network *net, int num); |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 1296 | bool gsm_bts_matches_lai(const struct gsm_bts *bts, const struct osmo_location_area_id *lai); |
| 1297 | bool gsm_bts_matches_cell_id(const struct gsm_bts *bts, const struct gsm0808_cell_id *cell_id); |
| 1298 | struct gsm_bts *gsm_bts_by_cell_id(const struct gsm_network *net, |
| 1299 | const struct gsm0808_cell_id *cell_id, |
| 1300 | int match_idx); |
| 1301 | int gsm_bts_local_neighbor_add(struct gsm_bts *bts, struct gsm_bts *neighbor); |
| 1302 | int gsm_bts_local_neighbor_del(struct gsm_bts *bts, const struct gsm_bts *neighbor); |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1303 | |
| 1304 | struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); |
| 1305 | struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); |
| 1306 | |
| 1307 | enum gsm_bts_type str2btstype(const char *arg); |
| 1308 | const char *btstype2str(enum gsm_bts_type type); |
| 1309 | |
| 1310 | enum bts_attribute str2btsattr(const char *s); |
| 1311 | const char *btsatttr2str(enum bts_attribute v); |
| 1312 | |
| 1313 | enum gsm_bts_type_variant str2btsvariant(const char *arg); |
| 1314 | const char *btsvariant2str(enum gsm_bts_type_variant v); |
| 1315 | |
| 1316 | extern const struct value_string gsm_chreq_descs[]; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1317 | extern const struct value_string gsm_pchant_names[]; |
| 1318 | extern const struct value_string gsm_pchant_descs[]; |
| 1319 | extern const struct value_string gsm_pchan_ids[]; |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1320 | const char *gsm_pchan_name(enum gsm_phys_chan_config c); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1321 | static inline const char *gsm_pchan_id(enum gsm_phys_chan_config c) |
| 1322 | { return get_value_string(gsm_pchan_ids, c); } |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1323 | enum gsm_phys_chan_config gsm_pchan_parse(const char *name); |
| 1324 | const char *gsm_lchant_name(enum gsm_chan_t c); |
| 1325 | const char *gsm_chreq_name(enum gsm_chreq_reason_t c); |
Harald Welte | 57658ec | 2019-02-04 12:30:44 +0100 | [diff] [blame] | 1326 | char *gsm_bts_name(const struct gsm_bts *bts); |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1327 | char *gsm_trx_name(const struct gsm_bts_trx *trx); |
| 1328 | char *gsm_ts_name(const struct gsm_bts_trx_ts *ts); |
| 1329 | char *gsm_ts_and_pchan_name(const struct gsm_bts_trx_ts *ts); |
| 1330 | char *gsm_lchan_name_compute(const struct gsm_lchan *lchan); |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1331 | |
| 1332 | static inline char *gsm_lchan_name(const struct gsm_lchan *lchan) |
| 1333 | { |
| 1334 | return lchan->name; |
| 1335 | } |
| 1336 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1337 | void gsm_abis_mo_reset(struct gsm_abis_mo *mo); |
| 1338 | |
| 1339 | struct gsm_nm_state * |
| 1340 | gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class, |
| 1341 | const struct abis_om_obj_inst *obj_inst); |
| 1342 | void * |
| 1343 | gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class, |
| 1344 | const struct abis_om_obj_inst *obj_inst); |
| 1345 | |
| 1346 | /* reset the state of all MO in the BTS */ |
| 1347 | void gsm_bts_mo_reset(struct gsm_bts *bts); |
| 1348 | |
| 1349 | uint8_t gsm_pchan2chan_nr(enum gsm_phys_chan_config pchan, |
| 1350 | uint8_t ts_nr, uint8_t lchan_nr); |
| 1351 | uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan); |
| 1352 | uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan, |
| 1353 | enum gsm_phys_chan_config as_pchan); |
| 1354 | |
Harald Welte | 251bec1 | 2018-09-09 17:14:09 +0200 | [diff] [blame] | 1355 | void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd, |
| 1356 | const struct gsm_lchan *lchan); |
Harald Welte | 24286f3 | 2018-09-09 17:17:44 +0200 | [diff] [blame] | 1357 | void gsm48_lchan2chan_desc_as_configured(struct gsm48_chan_desc *cd, const struct gsm_lchan *lchan); |
Harald Welte | 251bec1 | 2018-09-09 17:14:09 +0200 | [diff] [blame] | 1358 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1359 | /* return the gsm_lchan for the CBCH (if it exists at all) */ |
| 1360 | struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts); |
| 1361 | |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1362 | static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts) |
| 1363 | { |
| 1364 | if (ts->tsc != -1) |
| 1365 | return ts->tsc; |
| 1366 | else |
| 1367 | return ts->trx->bts->bsic & 7; |
| 1368 | } |
| 1369 | |
| 1370 | struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr, |
| 1371 | int *rc); |
| 1372 | |
| 1373 | enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1374 | uint8_t pchan_subslots(enum gsm_phys_chan_config pchan); |
Neels Hofmeyr | 1048516 | 2018-02-13 23:22:03 +0100 | [diff] [blame] | 1375 | bool ts_is_tch(struct gsm_bts_trx_ts *ts); |
| 1376 | |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 1377 | |
Harald Welte | b794887 | 2017-12-18 18:48:21 +0100 | [diff] [blame] | 1378 | static inline struct gsm_bts *conn_get_bts(struct gsm_subscriber_connection *conn) { |
Vadim Yanitskiy | 6281d4f | 2020-06-18 22:29:56 +0700 | [diff] [blame] | 1379 | if (!conn || !conn->lchan) |
| 1380 | return NULL; |
Harald Welte | b794887 | 2017-12-18 18:48:21 +0100 | [diff] [blame] | 1381 | return conn->lchan->ts->trx->bts; |
| 1382 | } |
| 1383 | |
Pau Espin Pedrol | 7950e5d | 2019-10-31 15:59:49 +0100 | [diff] [blame] | 1384 | void conn_update_ms_power_class(struct gsm_subscriber_connection *conn, uint8_t power_class); |
| 1385 | void lchan_update_ms_power_ctrl_level(struct gsm_lchan *lchan, int ms_power_dbm); |
| 1386 | |
Alexander Chemeris | 5d63827 | 2020-05-11 00:30:11 +0300 | [diff] [blame] | 1387 | enum bts_counter_id { |
Harald Welte | d82101e | 2017-12-09 23:07:38 +0100 | [diff] [blame] | 1388 | BTS_CTR_CHREQ_TOTAL, |
Daniel Willmann | fea5d64 | 2020-06-03 18:25:45 +0200 | [diff] [blame] | 1389 | BTS_CTR_CHREQ_SUCCESSFUL, |
Harald Welte | d82101e | 2017-12-09 23:07:38 +0100 | [diff] [blame] | 1390 | BTS_CTR_CHREQ_NO_CHANNEL, |
| 1391 | BTS_CTR_CHAN_RF_FAIL, |
| 1392 | BTS_CTR_CHAN_RLL_ERR, |
| 1393 | BTS_CTR_BTS_OML_FAIL, |
| 1394 | BTS_CTR_BTS_RSL_FAIL, |
| 1395 | BTS_CTR_CODEC_AMR_F, |
| 1396 | BTS_CTR_CODEC_AMR_H, |
| 1397 | BTS_CTR_CODEC_EFR, |
| 1398 | BTS_CTR_CODEC_V1_FR, |
| 1399 | BTS_CTR_CODEC_V1_HR, |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 1400 | BTS_CTR_PAGING_ATTEMPTED, |
| 1401 | BTS_CTR_PAGING_ALREADY, |
| 1402 | BTS_CTR_PAGING_RESPONDED, |
| 1403 | BTS_CTR_PAGING_EXPIRED, |
Alexander Chemeris | 43def74 | 2020-05-16 18:49:59 +0300 | [diff] [blame] | 1404 | BTS_CTR_PAGING_NO_ACTIVE_PAGING, |
Alexander Chemeris | 001a2df | 2020-05-22 21:43:57 +0300 | [diff] [blame] | 1405 | BTS_CTR_PAGING_MSC_FLUSH, |
Harald Welte | 4f59892 | 2017-12-14 13:47:02 +0100 | [diff] [blame] | 1406 | BTS_CTR_CHAN_ACT_TOTAL, |
| 1407 | BTS_CTR_CHAN_ACT_NACK, |
Harald Welte | 62d9cb0 | 2017-12-14 14:00:26 +0100 | [diff] [blame] | 1408 | BTS_CTR_RSL_UNKNOWN, |
Harald Welte | 581398a | 2017-12-14 14:29:44 +0100 | [diff] [blame] | 1409 | BTS_CTR_RSL_IPA_NACK, |
Harald Welte | 0415a5c | 2020-06-21 16:05:43 +0200 | [diff] [blame] | 1410 | BTS_CTR_RSL_DELETE_IND, |
Harald Welte | 00d64fd | 2017-12-14 14:34:16 +0100 | [diff] [blame] | 1411 | BTS_CTR_MODE_MODIFY_NACK, |
Alexander Chemeris | 5d63827 | 2020-05-11 00:30:11 +0300 | [diff] [blame] | 1412 | BTS_CTR_LCHAN_BORKEN_FROM_UNUSED, |
| 1413 | BTS_CTR_LCHAN_BORKEN_FROM_WAIT_ACTIV_ACK, |
| 1414 | BTS_CTR_LCHAN_BORKEN_FROM_WAIT_RF_RELEASE_ACK, |
| 1415 | BTS_CTR_LCHAN_BORKEN_FROM_BORKEN, |
| 1416 | BTS_CTR_LCHAN_BORKEN_FROM_UNKNOWN, |
| 1417 | BTS_CTR_LCHAN_BORKEN_EV_CHAN_ACTIV_ACK, |
| 1418 | BTS_CTR_LCHAN_BORKEN_EV_CHAN_ACTIV_NACK, |
| 1419 | BTS_CTR_LCHAN_BORKEN_EV_RF_CHAN_REL_ACK, |
| 1420 | BTS_CTR_LCHAN_BORKEN_EV_VTY, |
| 1421 | BTS_CTR_LCHAN_BORKEN_EV_TEARDOWN, |
| 1422 | BTS_CTR_TS_BORKEN_FROM_NOT_INITIALIZED, |
| 1423 | BTS_CTR_TS_BORKEN_FROM_UNUSED, |
| 1424 | BTS_CTR_TS_BORKEN_FROM_WAIT_PDCH_ACT, |
| 1425 | BTS_CTR_TS_BORKEN_FROM_PDCH, |
| 1426 | BTS_CTR_TS_BORKEN_FROM_WAIT_PDCH_DEACT, |
| 1427 | BTS_CTR_TS_BORKEN_FROM_IN_USE, |
| 1428 | BTS_CTR_TS_BORKEN_FROM_BORKEN, |
| 1429 | BTS_CTR_TS_BORKEN_FROM_UNKNOWN, |
| 1430 | BTS_CTR_TS_BORKEN_EV_PDCH_ACT_ACK_NACK, |
| 1431 | BTS_CTR_TS_BORKEN_EV_PDCH_DEACT_ACK_NACK, |
| 1432 | BTS_CTR_TS_BORKEN_EV_TEARDOWN, |
Daniel Willmann | b5ccf09 | 2020-06-08 14:36:46 +0200 | [diff] [blame] | 1433 | BTS_CTR_ASSIGNMENT_ATTEMPTED, |
| 1434 | BTS_CTR_ASSIGNMENT_COMPLETED, |
| 1435 | BTS_CTR_ASSIGNMENT_STOPPED, |
| 1436 | BTS_CTR_ASSIGNMENT_NO_CHANNEL, |
| 1437 | BTS_CTR_ASSIGNMENT_TIMEOUT, |
| 1438 | BTS_CTR_ASSIGNMENT_FAILED, |
| 1439 | BTS_CTR_ASSIGNMENT_ERROR, |
Harald Welte | d82101e | 2017-12-09 23:07:38 +0100 | [diff] [blame] | 1440 | }; |
| 1441 | |
| 1442 | static const struct rate_ctr_desc bts_ctr_description[] = { |
Daniel Willmann | ce7aa0d | 2020-06-09 17:24:19 +0200 | [diff] [blame] | 1443 | [BTS_CTR_CHREQ_TOTAL] = {"chreq:total", "Received channel requests"}, |
Daniel Willmann | fea5d64 | 2020-06-03 18:25:45 +0200 | [diff] [blame] | 1444 | [BTS_CTR_CHREQ_SUCCESSFUL] = {"chreq:successful", "Successful channel requests (immediate assign sent)"}, |
Daniel Willmann | ce7aa0d | 2020-06-09 17:24:19 +0200 | [diff] [blame] | 1445 | [BTS_CTR_CHREQ_NO_CHANNEL] = {"chreq:no_channel", "Sent to MS no channel available"}, |
| 1446 | [BTS_CTR_CHAN_RF_FAIL] = {"chan:rf_fail", "Received a RF failure indication from BTS"}, |
| 1447 | [BTS_CTR_CHAN_RLL_ERR] = {"chan:rll_err", "Received a RLL failure with T200 cause from BTS"}, |
| 1448 | [BTS_CTR_BTS_OML_FAIL] = {"oml_fail", "Received a TEI down on a OML link"}, |
| 1449 | [BTS_CTR_BTS_RSL_FAIL] = {"rsl_fail", "Received a TEI down on a OML link"}, |
| 1450 | [BTS_CTR_CODEC_AMR_F] = {"codec:amr_f", "Count the usage of AMR/F codec by channel mode requested"}, |
| 1451 | [BTS_CTR_CODEC_AMR_H] = {"codec:amr_h", "Count the usage of AMR/H codec by channel mode requested"}, |
| 1452 | [BTS_CTR_CODEC_EFR] = {"codec:efr", "Count the usage of EFR codec by channel mode requested"}, |
| 1453 | [BTS_CTR_CODEC_V1_FR] = {"codec:fr", "Count the usage of FR codec by channel mode requested"}, |
| 1454 | [BTS_CTR_CODEC_V1_HR] = {"codec:hr", "Count the usage of HR codec by channel mode requested"}, |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 1455 | |
Daniel Willmann | ce7aa0d | 2020-06-09 17:24:19 +0200 | [diff] [blame] | 1456 | [BTS_CTR_PAGING_ATTEMPTED] = {"paging:attempted", "Paging attempts for a subscriber"}, |
| 1457 | [BTS_CTR_PAGING_ALREADY] = {"paging:already", "Paging attempts ignored as subscriber was already being paged"}, |
| 1458 | [BTS_CTR_PAGING_RESPONDED] = {"paging:responded", "Paging attempts with successful paging response"}, |
| 1459 | [BTS_CTR_PAGING_EXPIRED] = {"paging:expired", "Paging Request expired because of timeout T3113"}, |
| 1460 | [BTS_CTR_PAGING_NO_ACTIVE_PAGING] = {"paging:no_active_paging", "Paging response without an active paging request (arrived after paging expiration?)"}, |
| 1461 | [BTS_CTR_PAGING_MSC_FLUSH] = {"paging:msc_flush", "Paging flushed due to MSC Reset BSSMAP message"}, |
| 1462 | [BTS_CTR_CHAN_ACT_TOTAL] = {"chan_act:total", "Total number of Channel Activations"}, |
Harald Welte | 4f59892 | 2017-12-14 13:47:02 +0100 | [diff] [blame] | 1463 | [BTS_CTR_CHAN_ACT_NACK] = {"chan_act:nack", "Number of Channel Activations that the BTS NACKed"}, |
Harald Welte | 62d9cb0 | 2017-12-14 14:00:26 +0100 | [diff] [blame] | 1464 | [BTS_CTR_RSL_UNKNOWN] = {"rsl:unknown", "Number of unknown/unsupported RSL messages received from BTS"}, |
Harald Welte | 581398a | 2017-12-14 14:29:44 +0100 | [diff] [blame] | 1465 | [BTS_CTR_RSL_IPA_NACK] = {"rsl:ipa_nack", "Number of IPA (RTP/dyn-PDCH) related NACKs received from BTS"}, |
Harald Welte | 0415a5c | 2020-06-21 16:05:43 +0200 | [diff] [blame] | 1466 | [BTS_CTR_RSL_DELETE_IND] = {"rsl:delete_ind", "Number of RSL DELETE INDICATION (DL CCCH overload)"}, |
Harald Welte | 00d64fd | 2017-12-14 14:34:16 +0100 | [diff] [blame] | 1467 | [BTS_CTR_MODE_MODIFY_NACK] = {"chan:mode_modify_nack", "Number of Channel Mode Modify NACKs received from BTS"}, |
Alexander Chemeris | 5d63827 | 2020-05-11 00:30:11 +0300 | [diff] [blame] | 1468 | |
| 1469 | /* lchan/TS BORKEN state counters */ |
| 1470 | [BTS_CTR_LCHAN_BORKEN_FROM_UNUSED] = {"lchan_borken:from_state:unused", "Transitions from lchan UNUSED state to BORKEN state"}, |
| 1471 | [BTS_CTR_LCHAN_BORKEN_FROM_WAIT_ACTIV_ACK] = {"lchan_borken:from_state:wait_activ_ack", "Transitions from lchan WAIT_ACTIV_ACK state to BORKEN state"}, |
| 1472 | [BTS_CTR_LCHAN_BORKEN_FROM_WAIT_RF_RELEASE_ACK] = {"lchan_borken:from_state:wait_rf_release_ack", "Transitions from lchan WAIT_RF_RELEASE_ACK state to BORKEN state"}, |
| 1473 | [BTS_CTR_LCHAN_BORKEN_FROM_BORKEN] = {"lchan_borken:from_state:borken", "Transitions from lchan BORKEN state to BORKEN state"}, |
| 1474 | [BTS_CTR_LCHAN_BORKEN_FROM_UNKNOWN] = {"lchan_borken:from_state:unknown", "Transitions from an unknown lchan state to BORKEN state"}, |
| 1475 | [BTS_CTR_LCHAN_BORKEN_EV_CHAN_ACTIV_ACK] = {"lchan_borken:event:chan_activ_ack", "CHAN_ACTIV_ACK received in the lchan BORKEN state"}, |
| 1476 | [BTS_CTR_LCHAN_BORKEN_EV_CHAN_ACTIV_NACK] = {"lchan_borken:event:chan_activ_nack", "CHAN_ACTIV_NACK received in the lchan BORKEN state"}, |
| 1477 | [BTS_CTR_LCHAN_BORKEN_EV_RF_CHAN_REL_ACK] = {"lchan_borken:event:rf_chan_rel_ack", "RF_CHAN_REL_ACK received in the lchan BORKEN state"}, |
| 1478 | [BTS_CTR_LCHAN_BORKEN_EV_VTY] = {"lchan_borken:event:vty", "VTY commands received in the lchan BORKEN state"}, |
| 1479 | [BTS_CTR_LCHAN_BORKEN_EV_TEARDOWN] = {"lchan_borken:event:teardown", "lchan in a BORKEN state is shutting down (BTS disconnected?)"}, |
| 1480 | [BTS_CTR_TS_BORKEN_FROM_NOT_INITIALIZED] = {"ts_borken:from_state:not_initialized", "Transitions from TS NOT_INITIALIZED state to BORKEN state"}, |
| 1481 | [BTS_CTR_TS_BORKEN_FROM_UNUSED] = {"ts_borken:from_state:unused", "Transitions from TS UNUSED state to BORKEN state"}, |
| 1482 | [BTS_CTR_TS_BORKEN_FROM_WAIT_PDCH_ACT] = {"ts_borken:from_state:wait_pdch_act", "Transitions from TS WAIT_PDCH_ACT state to BORKEN state"}, |
| 1483 | [BTS_CTR_TS_BORKEN_FROM_PDCH] = {"ts_borken:from_state:pdch", "Transitions from TS PDCH state to BORKEN state"}, |
| 1484 | [BTS_CTR_TS_BORKEN_FROM_WAIT_PDCH_DEACT] = {"ts_borken:from_state:wait_pdch_deact", "Transitions from TS WAIT_PDCH_DEACT state to BORKEN state"}, |
| 1485 | [BTS_CTR_TS_BORKEN_FROM_IN_USE] = {"ts_borken:from_state:in_use", "Transitions from TS IN_USE state to BORKEN state"}, |
| 1486 | [BTS_CTR_TS_BORKEN_FROM_BORKEN] = {"ts_borken:from_state:borken", "Transitions from TS BORKEN state to BORKEN state"}, |
| 1487 | [BTS_CTR_TS_BORKEN_FROM_UNKNOWN] = {"ts_borken:from_state:unknown", "Transitions from an unknown TS state to BORKEN state"}, |
| 1488 | [BTS_CTR_TS_BORKEN_EV_PDCH_ACT_ACK_NACK] = {"ts_borken:event:pdch_act_ack_nack", "PDCH_ACT_ACK/NACK received in the TS BORKEN state"}, |
| 1489 | [BTS_CTR_TS_BORKEN_EV_PDCH_DEACT_ACK_NACK] = {"ts_borken:event:pdch_deact_ack_nack", "PDCH_DEACT_ACK/NACK received in the TS BORKEN state"}, |
| 1490 | [BTS_CTR_TS_BORKEN_EV_TEARDOWN] = {"ts_borken:event:teardown", "TS in a BORKEN state is shutting down (BTS disconnected?)"}, |
Daniel Willmann | b5ccf09 | 2020-06-08 14:36:46 +0200 | [diff] [blame] | 1491 | [BTS_CTR_ASSIGNMENT_ATTEMPTED] = {"assignment:attempted", "Assignment attempts"}, |
| 1492 | [BTS_CTR_ASSIGNMENT_COMPLETED] = {"assignment:completed", "Assignment completed"}, |
| 1493 | [BTS_CTR_ASSIGNMENT_STOPPED] = {"assignment:stopped", "Connection ended during Assignment"}, |
| 1494 | [BTS_CTR_ASSIGNMENT_NO_CHANNEL] = {"assignment:no_channel", "Failure to allocate lchan for Assignment"}, |
| 1495 | [BTS_CTR_ASSIGNMENT_TIMEOUT] = {"assignment:timeout", "Assignment timed out"}, |
| 1496 | [BTS_CTR_ASSIGNMENT_FAILED] = {"assignment:failed", "Received Assignment Failure message"}, |
| 1497 | [BTS_CTR_ASSIGNMENT_ERROR] = {"assignment:error", "Assignment failed for other reason"}, |
Harald Welte | 0415a5c | 2020-06-21 16:05:43 +0200 | [diff] [blame] | 1498 | |
Harald Welte | d82101e | 2017-12-09 23:07:38 +0100 | [diff] [blame] | 1499 | }; |
| 1500 | |
| 1501 | static const struct rate_ctr_group_desc bts_ctrg_desc = { |
| 1502 | "bts", |
| 1503 | "base transceiver station", |
| 1504 | OSMO_STATS_CLASS_GLOBAL, |
| 1505 | ARRAY_SIZE(bts_ctr_description), |
| 1506 | bts_ctr_description, |
| 1507 | }; |
Holger Hans Peter Freyther | 5ba6f48 | 2009-10-28 14:23:39 +0100 | [diff] [blame] | 1508 | |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 1509 | enum { |
Stefan Sperling | 81dc9e7 | 2018-02-05 17:34:36 +0100 | [diff] [blame] | 1510 | BTS_STAT_CHAN_LOAD_AVERAGE, |
Alexander Chemeris | b091def | 2020-05-06 23:17:49 +0300 | [diff] [blame] | 1511 | BTS_STAT_CHAN_CCCH_SDCCH4_USED, |
| 1512 | BTS_STAT_CHAN_CCCH_SDCCH4_TOTAL, |
| 1513 | BTS_STAT_CHAN_TCH_F_USED, |
| 1514 | BTS_STAT_CHAN_TCH_F_TOTAL, |
| 1515 | BTS_STAT_CHAN_TCH_H_USED, |
| 1516 | BTS_STAT_CHAN_TCH_H_TOTAL, |
| 1517 | BTS_STAT_CHAN_SDCCH8_USED, |
| 1518 | BTS_STAT_CHAN_SDCCH8_TOTAL, |
| 1519 | BTS_STAT_CHAN_TCH_F_PDCH_USED, |
| 1520 | BTS_STAT_CHAN_TCH_F_PDCH_TOTAL, |
| 1521 | BTS_STAT_CHAN_CCCH_SDCCH4_CBCH_USED, |
| 1522 | BTS_STAT_CHAN_CCCH_SDCCH4_CBCH_TOTAL, |
| 1523 | BTS_STAT_CHAN_SDCCH8_CBCH_USED, |
| 1524 | BTS_STAT_CHAN_SDCCH8_CBCH_TOTAL, |
| 1525 | BTS_STAT_CHAN_TCH_F_TCH_H_PDCH_USED, |
| 1526 | BTS_STAT_CHAN_TCH_F_TCH_H_PDCH_TOTAL, |
Stefan Sperling | 81dc9e7 | 2018-02-05 17:34:36 +0100 | [diff] [blame] | 1527 | BTS_STAT_T3122, |
Harald Welte | be86caa | 2019-05-24 09:30:28 +0200 | [diff] [blame] | 1528 | BTS_STAT_RACH_BUSY, |
| 1529 | BTS_STAT_RACH_ACCESS, |
Alexander Chemeris | 8b0f687 | 2020-05-07 16:46:47 +0300 | [diff] [blame] | 1530 | BTS_STAT_OML_CONNECTED, |
| 1531 | BTS_STAT_RSL_CONNECTED, |
Alexander Chemeris | 5d63827 | 2020-05-11 00:30:11 +0300 | [diff] [blame] | 1532 | BTS_STAT_LCHAN_BORKEN, |
| 1533 | BTS_STAT_TS_BORKEN, |
Stefan Sperling | 81dc9e7 | 2018-02-05 17:34:36 +0100 | [diff] [blame] | 1534 | }; |
| 1535 | |
| 1536 | enum { |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1537 | BSC_CTR_ASSIGNMENT_ATTEMPTED, |
| 1538 | BSC_CTR_ASSIGNMENT_COMPLETED, |
| 1539 | BSC_CTR_ASSIGNMENT_STOPPED, |
| 1540 | BSC_CTR_ASSIGNMENT_NO_CHANNEL, |
| 1541 | BSC_CTR_ASSIGNMENT_TIMEOUT, |
| 1542 | BSC_CTR_ASSIGNMENT_FAILED, |
| 1543 | BSC_CTR_ASSIGNMENT_ERROR, |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 1544 | BSC_CTR_HANDOVER_ATTEMPTED, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1545 | BSC_CTR_HANDOVER_COMPLETED, |
| 1546 | BSC_CTR_HANDOVER_STOPPED, |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 1547 | BSC_CTR_HANDOVER_NO_CHANNEL, |
| 1548 | BSC_CTR_HANDOVER_TIMEOUT, |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 1549 | BSC_CTR_HANDOVER_FAILED, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1550 | BSC_CTR_HANDOVER_ERROR, |
| 1551 | BSC_CTR_INTER_BSC_HO_OUT_ATTEMPTED, |
| 1552 | BSC_CTR_INTER_BSC_HO_OUT_COMPLETED, |
| 1553 | BSC_CTR_INTER_BSC_HO_OUT_STOPPED, |
| 1554 | BSC_CTR_INTER_BSC_HO_OUT_TIMEOUT, |
| 1555 | BSC_CTR_INTER_BSC_HO_OUT_ERROR, |
| 1556 | BSC_CTR_INTER_BSC_HO_IN_ATTEMPTED, |
| 1557 | BSC_CTR_INTER_BSC_HO_IN_COMPLETED, |
| 1558 | BSC_CTR_INTER_BSC_HO_IN_STOPPED, |
| 1559 | BSC_CTR_INTER_BSC_HO_IN_NO_CHANNEL, |
| 1560 | BSC_CTR_INTER_BSC_HO_IN_FAILED, |
| 1561 | BSC_CTR_INTER_BSC_HO_IN_TIMEOUT, |
| 1562 | BSC_CTR_INTER_BSC_HO_IN_ERROR, |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 1563 | BSC_CTR_PAGING_ATTEMPTED, |
| 1564 | BSC_CTR_PAGING_DETACHED, |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 1565 | BSC_CTR_PAGING_RESPONDED, |
Alexander Chemeris | 43def74 | 2020-05-16 18:49:59 +0300 | [diff] [blame] | 1566 | BSC_CTR_PAGING_NO_ACTIVE_PAGING, |
Stefan Sperling | 7926d98 | 2018-05-17 14:52:02 +0200 | [diff] [blame] | 1567 | BSC_CTR_UNKNOWN_UNIT_ID, |
Neels Hofmeyr | 1c963eb | 2020-06-16 12:08:39 +0200 | [diff] [blame] | 1568 | BSC_CTR_MSCPOOL_SUBSCR_NO_MSC, |
| 1569 | BSC_CTR_MSCPOOL_EMERG_FORWARDED, |
| 1570 | BSC_CTR_MSCPOOL_EMERG_LOST, |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 1571 | }; |
| 1572 | |
| 1573 | static const struct rate_ctr_desc bsc_ctr_description[] = { |
Neels Hofmeyr | dbb38d5 | 2018-07-11 19:53:56 +0200 | [diff] [blame] | 1574 | [BSC_CTR_ASSIGNMENT_ATTEMPTED] = {"assignment:attempted", "Assignment attempts."}, |
| 1575 | [BSC_CTR_ASSIGNMENT_COMPLETED] = {"assignment:completed", "Assignment completed."}, |
| 1576 | [BSC_CTR_ASSIGNMENT_STOPPED] = {"assignment:stopped", "Connection ended during Assignment."}, |
| 1577 | [BSC_CTR_ASSIGNMENT_NO_CHANNEL] = {"assignment:no_channel", "Failure to allocate lchan for Assignment."}, |
| 1578 | [BSC_CTR_ASSIGNMENT_TIMEOUT] = {"assignment:timeout", "Assignment timed out."}, |
| 1579 | [BSC_CTR_ASSIGNMENT_FAILED] = {"assignment:failed", "Received Assignment Failure message."}, |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1580 | [BSC_CTR_ASSIGNMENT_ERROR] = {"assignment:error", "Assignment failed for other reason."}, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1581 | |
| 1582 | [BSC_CTR_HANDOVER_ATTEMPTED] = {"handover:attempted", "Intra-BSC handover attempts."}, |
| 1583 | [BSC_CTR_HANDOVER_COMPLETED] = {"handover:completed", "Intra-BSC handover completed."}, |
| 1584 | [BSC_CTR_HANDOVER_STOPPED] = {"handover:stopped", "Connection ended during HO."}, |
| 1585 | [BSC_CTR_HANDOVER_NO_CHANNEL] = {"handover:no_channel", "Failure to allocate lchan for HO."}, |
| 1586 | [BSC_CTR_HANDOVER_TIMEOUT] = {"handover:timeout", "Handover timed out."}, |
| 1587 | [BSC_CTR_HANDOVER_FAILED] = {"handover:failed", "Received Handover Fail messages."}, |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1588 | [BSC_CTR_HANDOVER_ERROR] = {"handover:error", "Re-assignment failed for other reason."}, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1589 | |
| 1590 | [BSC_CTR_INTER_BSC_HO_OUT_ATTEMPTED] = {"interbsc_ho_out:attempted", |
| 1591 | "Attempts to handover to remote BSS."}, |
| 1592 | [BSC_CTR_INTER_BSC_HO_OUT_COMPLETED] = {"interbsc_ho_out:completed", |
| 1593 | "Handover to remote BSS completed."}, |
| 1594 | [BSC_CTR_INTER_BSC_HO_OUT_STOPPED] = {"interbsc_ho_out:stopped", "Connection ended during HO."}, |
| 1595 | [BSC_CTR_INTER_BSC_HO_OUT_TIMEOUT] = {"interbsc_ho_out:timeout", "Handover timed out."}, |
| 1596 | [BSC_CTR_INTER_BSC_HO_OUT_ERROR] = {"interbsc_ho_out:error", |
| 1597 | "Handover to remote BSS failed for other reason."}, |
| 1598 | |
| 1599 | [BSC_CTR_INTER_BSC_HO_IN_ATTEMPTED] = {"interbsc_ho_in:attempted", |
| 1600 | "Attempts to handover from remote BSS."}, |
| 1601 | [BSC_CTR_INTER_BSC_HO_IN_COMPLETED] = {"interbsc_ho_in:completed", |
| 1602 | "Handover from remote BSS completed."}, |
| 1603 | [BSC_CTR_INTER_BSC_HO_IN_STOPPED] = {"interbsc_ho_in:stopped", "Connection ended during HO."}, |
| 1604 | [BSC_CTR_INTER_BSC_HO_IN_NO_CHANNEL] = {"interbsc_ho_in:no_channel", |
| 1605 | "Failure to allocate lchan for HO."}, |
| 1606 | [BSC_CTR_INTER_BSC_HO_IN_TIMEOUT] = {"interbsc_ho_in:timeout", "Handover from remote BSS timed out."}, |
| 1607 | [BSC_CTR_INTER_BSC_HO_IN_FAILED] = {"interbsc_ho_in:failed", "Received Handover Fail message."}, |
| 1608 | [BSC_CTR_INTER_BSC_HO_IN_ERROR] = {"interbsc_ho_in:error", |
| 1609 | "Handover from remote BSS failed for other reason."}, |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 1610 | |
| 1611 | [BSC_CTR_PAGING_ATTEMPTED] = {"paging:attempted", "Paging attempts for a subscriber."}, |
Stefan Sperling | 71d524c | 2018-05-17 14:38:27 +0200 | [diff] [blame] | 1612 | [BSC_CTR_PAGING_DETACHED] = {"paging:detached", "Paging request send failures because no responsible BTS was found."}, |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 1613 | [BSC_CTR_PAGING_RESPONDED] = {"paging:responded", "Paging attempts with successful response."}, |
Alexander Chemeris | 43def74 | 2020-05-16 18:49:59 +0300 | [diff] [blame] | 1614 | [BSC_CTR_PAGING_NO_ACTIVE_PAGING] = {"paging:no_active_paging", "Paging response without an active paging request (arrived after paging expiration?)."}, |
Stefan Sperling | 7926d98 | 2018-05-17 14:52:02 +0200 | [diff] [blame] | 1615 | |
| 1616 | [BSC_CTR_UNKNOWN_UNIT_ID] = {"abis:unknown_unit_id", "Connection attempts from unknown IPA CCM Unit ID."}, |
Neels Hofmeyr | 1c963eb | 2020-06-16 12:08:39 +0200 | [diff] [blame] | 1617 | |
| 1618 | [BSC_CTR_MSCPOOL_SUBSCR_NO_MSC] = {"mscpool:subscr:no_msc", |
| 1619 | "Complete Layer 3 requests lost because no connected MSC is found available."}, |
| 1620 | [BSC_CTR_MSCPOOL_EMERG_FORWARDED] = {"mscpool:emerg:forwarded", |
| 1621 | "Emergency call requests forwarded to an MSC (see also per-MSC counters)"}, |
| 1622 | [BSC_CTR_MSCPOOL_EMERG_LOST] = {"mscpool:emerg:lost", |
| 1623 | "Emergency call requests lost because no MSC was found available."}, |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 1624 | }; |
| 1625 | |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 1626 | |
| 1627 | |
| 1628 | static const struct rate_ctr_group_desc bsc_ctrg_desc = { |
| 1629 | "bsc", |
| 1630 | "base station controller", |
| 1631 | OSMO_STATS_CLASS_GLOBAL, |
| 1632 | ARRAY_SIZE(bsc_ctr_description), |
| 1633 | bsc_ctr_description, |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 1634 | }; |
| 1635 | |
Alexander Chemeris | db54283 | 2020-05-08 01:49:12 +0300 | [diff] [blame] | 1636 | /* Constants for the BSC stats */ |
| 1637 | enum { |
| 1638 | BSC_STAT_NUM_BTS_TOTAL, |
| 1639 | }; |
| 1640 | |
Neels Hofmeyr | 7398395 | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 1641 | struct gsm_tz { |
| 1642 | int override; /* if 0, use system's time zone instead. */ |
| 1643 | int hr; /* hour */ |
| 1644 | int mn; /* minute */ |
| 1645 | int dst; /* daylight savings */ |
| 1646 | }; |
| 1647 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1648 | struct gsm_network { |
Neels Hofmeyr | ce4d88b | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 1649 | /* TODO MSCSPLIT the gsm_network struct is basically a kitchen sink for |
| 1650 | * global settings and variables, "madly" mixing BSC and MSC stuff. Split |
| 1651 | * this in e.g. struct osmo_bsc and struct osmo_msc, with the things |
| 1652 | * these have in common, like country and network code, put in yet |
| 1653 | * separate structs and placed as members in osmo_bsc and osmo_msc. */ |
| 1654 | |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 1655 | struct osmo_plmn_id plmn; |
| 1656 | |
Harald Welte | 51e4bf3 | 2017-12-23 17:30:18 +0100 | [diff] [blame] | 1657 | /* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */ |
| 1658 | uint8_t a5_encryption_mask; |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 1659 | int neci; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1660 | |
Neels Hofmeyr | e25018b | 2017-11-27 21:29:33 +0100 | [diff] [blame] | 1661 | struct handover_cfg *ho; |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 1662 | struct { |
| 1663 | unsigned int congestion_check_interval_s; |
| 1664 | struct osmo_timer_list congestion_check_timer; |
| 1665 | } hodec2; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1666 | |
Alexander Chemeris | db54283 | 2020-05-08 01:49:12 +0300 | [diff] [blame] | 1667 | /* structures for keeping rate counters and gauge stats */ |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 1668 | struct rate_ctr_group *bsc_ctrs; |
Alexander Chemeris | db54283 | 2020-05-08 01:49:12 +0300 | [diff] [blame] | 1669 | struct osmo_stat_item_group *bsc_statg; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 1670 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1671 | unsigned int num_bts; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1672 | struct llist_head bts_list; |
Oliver Smith | 8d8d710 | 2018-10-23 15:35:43 +0200 | [diff] [blame] | 1673 | struct llist_head bts_rejected; |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 1674 | |
Neels Hofmeyr | 08822a3 | 2019-07-11 03:43:34 +0200 | [diff] [blame] | 1675 | /* see gsm_network_T_defs */ |
Neels Hofmeyr | a6078fe | 2019-01-28 03:52:14 +0100 | [diff] [blame] | 1676 | struct osmo_tdef *T_defs; |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 1677 | |
Alexander Couzens | 547c207 | 2017-11-21 12:03:04 +0100 | [diff] [blame] | 1678 | enum gsm_chan_t ctype_by_chreq[_NUM_CHREQ_T]; |
Holger Hans Peter Freyther | 7889107 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 1679 | |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 1680 | /* Use a TCH for handling requests of type paging any */ |
| 1681 | int pag_any_tch; |
| 1682 | |
Neels Hofmeyr | 06a14d2 | 2020-05-26 12:41:18 +0200 | [diff] [blame] | 1683 | /* msc configuration */ |
| 1684 | struct llist_head mscs; |
Neels Hofmeyr | eec776e | 2020-05-25 00:02:56 +0200 | [diff] [blame] | 1685 | uint8_t mscs_round_robin_next_nr; |
| 1686 | /* Emergency calls potentially select a different set of MSCs, so to not mess up the normal round-robin |
| 1687 | * behavior, emergency calls need a separate round-robin counter. */ |
| 1688 | uint8_t mscs_round_robin_next_emerg_nr; |
Neels Hofmeyr | 06a14d2 | 2020-05-26 12:41:18 +0200 | [diff] [blame] | 1689 | |
| 1690 | /* rf ctl related bits */ |
| 1691 | int mid_call_timeout; |
| 1692 | char *rf_ctrl_name; |
| 1693 | struct osmo_bsc_rf *rf_ctrl; |
| 1694 | int auto_off_timeout; |
| 1695 | |
| 1696 | struct bsc_cbc_link *cbc; |
Holger Hans Peter Freyther | daee5ca | 2010-12-22 12:34:39 +0100 | [diff] [blame] | 1697 | |
Daniel Willmann | 6fc4a98 | 2011-07-22 17:55:42 +0200 | [diff] [blame] | 1698 | /* control interface */ |
| 1699 | struct ctrl_handle *ctrl; |
Neels Hofmeyr | 5f0c71b | 2016-07-23 20:15:28 +0200 | [diff] [blame] | 1700 | |
| 1701 | /* Allow or disallow TCH/F on dynamic TCH/F_TCH/H_PDCH; OS#1778 */ |
| 1702 | bool dyn_ts_allow_tch_f; |
Neels Hofmeyr | d90fa42 | 2016-05-09 21:03:12 +0200 | [diff] [blame] | 1703 | |
| 1704 | /* all active subscriber connections. */ |
| 1705 | struct llist_head subscr_conns; |
Neels Hofmeyr | 7398395 | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 1706 | |
| 1707 | /* if override is nonzero, this timezone data is used for all MM |
| 1708 | * contexts. */ |
| 1709 | /* TODO: in OsmoNITB, tz-override used to be BTS-specific. To enable |
| 1710 | * BTS|RNC specific timezone overrides for multi-tz networks in |
Neels Hofmeyr | fe291de | 2017-02-23 21:06:12 +0100 | [diff] [blame] | 1711 | * OsmoMSC, this should be tied to the location area code (LAC). */ |
Neels Hofmeyr | 7398395 | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 1712 | struct gsm_tz tz; |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 1713 | |
| 1714 | /* List of all struct bsc_subscr used in libbsc. This llist_head is |
| 1715 | * allocated so that the llist_head pointer itself can serve as a |
| 1716 | * talloc context (useful to not have to pass the entire gsm_network |
| 1717 | * struct to the bsc_subscr_* API, and for bsc_susbscr unit tests to |
| 1718 | * not require gsm_data.h). In an MSC-without-BSC environment, this |
| 1719 | * pointer is NULL to indicate absence of a bsc_subscribers list. */ |
| 1720 | struct llist_head *bsc_subscribers; |
Harald Welte | a43e0b4 | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 1721 | |
Stefan Sperling | 6cee893 | 2018-01-30 18:14:22 +0100 | [diff] [blame] | 1722 | /* Timer for periodic channel load measurements to maintain each BTS's T3122. */ |
| 1723 | struct osmo_timer_list t3122_chan_load_timer; |
| 1724 | |
Neels Hofmeyr | c29505e | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 1725 | struct { |
Philipp Maier | 39c609b | 2017-09-27 15:51:34 +0200 | [diff] [blame] | 1726 | struct mgcp_client_conf *conf; |
| 1727 | struct mgcp_client *client; |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 1728 | struct osmo_tdef *tdefs; |
Philipp Maier | 39c609b | 2017-09-27 15:51:34 +0200 | [diff] [blame] | 1729 | } mgw; |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 1730 | |
| 1731 | /* Remote BSS Cell Identifier Lists */ |
| 1732 | struct neighbor_ident_list *neighbor_bss_cells; |
Oliver Smith | a595db1 | 2020-03-17 12:21:00 +0100 | [diff] [blame] | 1733 | |
| 1734 | /* Don't refuse to start with mutually exclusive codec settings */ |
| 1735 | bool allow_unusable_timeslots; |
Neels Hofmeyr | 4099f1d | 2020-05-26 03:58:14 +0200 | [diff] [blame] | 1736 | |
| 1737 | uint8_t nri_bitlen; |
| 1738 | struct osmo_nri_ranges *null_nri_ranges; |
Harald Welte | 7e310b1 | 2009-03-30 20:56:32 +0000 | [diff] [blame] | 1739 | }; |
| 1740 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1741 | struct gsm_audio_support { |
| 1742 | uint8_t hr : 1, |
| 1743 | ver : 7; |
| 1744 | }; |
| 1745 | |
Neels Hofmeyr | f93970b | 2018-03-05 02:09:40 +0100 | [diff] [blame] | 1746 | static inline const struct osmo_location_area_id *bts_lai(struct gsm_bts *bts) |
| 1747 | { |
| 1748 | static struct osmo_location_area_id lai; |
| 1749 | lai = (struct osmo_location_area_id){ |
| 1750 | .plmn = bts->network->plmn, |
| 1751 | .lac = bts->location_area_code, |
| 1752 | }; |
| 1753 | return &lai; |
| 1754 | } |
| 1755 | |
Neels Hofmeyr | c13e687 | 2016-05-11 13:53:47 +0200 | [diff] [blame] | 1756 | extern void talloc_ctx_init(void *ctx_root); |
| 1757 | |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 1758 | int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type); |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 1759 | |
Harald Welte | 1d014a5 | 2009-08-08 15:38:29 +0200 | [diff] [blame] | 1760 | enum gsm_bts_type parse_btstype(const char *arg); |
Holger Hans Peter Freyther | 2dceae6 | 2009-06-12 17:39:38 +0200 | [diff] [blame] | 1761 | const char *btstype2str(enum gsm_bts_type type); |
Harald Welte | be99149 | 2009-05-23 13:56:40 +0000 | [diff] [blame] | 1762 | struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac, |
| 1763 | struct gsm_bts *start_bts); |
Harald Welte | 32201c1 | 2009-03-10 12:15:10 +0000 | [diff] [blame] | 1764 | |
Andreas Eversberg | 8226fa7 | 2009-06-29 15:19:38 +0200 | [diff] [blame] | 1765 | extern void *tall_bsc_ctx; |
Harald Welte | 2cf161b | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 1766 | |
Martin Hauke | a29affd | 2019-11-13 22:10:41 +0100 | [diff] [blame] | 1767 | /* this actually refers to the IPA transport, not the BTS model */ |
Vadim Yanitskiy | c1b141c | 2020-05-30 23:43:59 +0700 | [diff] [blame] | 1768 | static inline int is_ipaccess_bts(const struct gsm_bts *bts) |
Harald Welte | 32201c1 | 2009-03-10 12:15:10 +0000 | [diff] [blame] | 1769 | { |
| 1770 | switch (bts->type) { |
Mike Haben | e2d8227 | 2009-10-02 12:19:34 +0100 | [diff] [blame] | 1771 | case GSM_BTS_TYPE_NANOBTS: |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 1772 | case GSM_BTS_TYPE_OSMOBTS: |
Harald Welte | 32201c1 | 2009-03-10 12:15:10 +0000 | [diff] [blame] | 1773 | return 1; |
| 1774 | default: |
| 1775 | break; |
| 1776 | } |
| 1777 | return 0; |
| 1778 | } |
| 1779 | |
Vadim Yanitskiy | c1b141c | 2020-05-30 23:43:59 +0700 | [diff] [blame] | 1780 | static inline int is_sysmobts_v2(const struct gsm_bts *bts) |
Holger Hans Peter Freyther | 6f6cbf7 | 2015-04-04 19:35:22 +0200 | [diff] [blame] | 1781 | { |
| 1782 | switch (bts->type) { |
Max | f9685c1 | 2017-03-23 12:01:07 +0100 | [diff] [blame] | 1783 | case GSM_BTS_TYPE_OSMOBTS: |
Holger Hans Peter Freyther | 6f6cbf7 | 2015-04-04 19:35:22 +0200 | [diff] [blame] | 1784 | return 1; |
| 1785 | default: |
| 1786 | break; |
| 1787 | } |
| 1788 | return 0; |
| 1789 | } |
| 1790 | |
Vadim Yanitskiy | c1b141c | 2020-05-30 23:43:59 +0700 | [diff] [blame] | 1791 | static inline int is_siemens_bts(const struct gsm_bts *bts) |
Harald Welte | 5b57067 | 2009-08-10 10:08:01 +0200 | [diff] [blame] | 1792 | { |
| 1793 | switch (bts->type) { |
| 1794 | case GSM_BTS_TYPE_BS11: |
| 1795 | return 1; |
| 1796 | default: |
| 1797 | break; |
| 1798 | } |
| 1799 | |
| 1800 | return 0; |
| 1801 | } |
| 1802 | |
Vadim Yanitskiy | c1b141c | 2020-05-30 23:43:59 +0700 | [diff] [blame] | 1803 | static inline int is_nokia_bts(const struct gsm_bts *bts) |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 1804 | { |
| 1805 | switch (bts->type) { |
| 1806 | case GSM_BTS_TYPE_NOKIA_SITE: |
| 1807 | return 1; |
| 1808 | default: |
| 1809 | break; |
| 1810 | } |
| 1811 | |
| 1812 | return 0; |
| 1813 | } |
| 1814 | |
Vadim Yanitskiy | c1b141c | 2020-05-30 23:43:59 +0700 | [diff] [blame] | 1815 | static inline int is_ericsson_bts(const struct gsm_bts *bts) |
Sylvain Munaut | 57a1ec5 | 2020-05-08 09:58:26 +0200 | [diff] [blame] | 1816 | { |
| 1817 | switch (bts->type) { |
| 1818 | case GSM_BTS_TYPE_RBS2000: |
| 1819 | return 1; |
| 1820 | default: |
| 1821 | break; |
| 1822 | } |
| 1823 | |
| 1824 | return 0; |
| 1825 | } |
| 1826 | |
Vadim Yanitskiy | c1b141c | 2020-05-30 23:43:59 +0700 | [diff] [blame] | 1827 | static inline int is_e1_bts(const struct gsm_bts *bts) |
Andreas Eversberg | dcf38e1 | 2013-12-05 14:37:11 +0100 | [diff] [blame] | 1828 | { |
| 1829 | switch (bts->type) { |
| 1830 | case GSM_BTS_TYPE_BS11: |
| 1831 | case GSM_BTS_TYPE_RBS2000: |
| 1832 | case GSM_BTS_TYPE_NOKIA_SITE: |
| 1833 | return 1; |
| 1834 | default: |
| 1835 | break; |
| 1836 | } |
| 1837 | |
| 1838 | return 0; |
| 1839 | } |
| 1840 | |
Harald Welte | 1876c31 | 2018-05-27 11:53:43 +0200 | [diff] [blame] | 1841 | extern struct gsm_network *bsc_gsmnet; |
| 1842 | |
Holger Hans Peter Freyther | 4e13a8f | 2015-01-31 22:16:00 +0100 | [diff] [blame] | 1843 | enum bts_gprs_mode bts_gprs_mode_parse(const char *arg, int *valid); |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1844 | const char *bts_gprs_mode_name(enum bts_gprs_mode mode); |
Holger Hans Peter Freyther | 4e13a8f | 2015-01-31 22:16:00 +0100 | [diff] [blame] | 1845 | int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode); |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 1846 | |
Neels Hofmeyr | 4d358c0 | 2018-02-22 03:19:05 +0100 | [diff] [blame] | 1847 | void gsm48_ra_id_by_bts(struct gsm48_ra_id *buf, struct gsm_bts *bts); |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 1848 | void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts); |
Harald Welte | d12b0fd | 2009-12-15 21:36:05 +0100 | [diff] [blame] | 1849 | |
Harald Welte | fbda4e1 | 2010-03-04 11:04:52 +0100 | [diff] [blame] | 1850 | int gsm_bts_model_register(struct gsm_bts_model *model); |
| 1851 | |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 1852 | struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *network); |
Neels Hofmeyr | 42eb014 | 2016-05-20 17:15:44 +0200 | [diff] [blame] | 1853 | |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1854 | struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_type type, uint8_t bsic); |
| 1855 | struct gsm_bts *bsc_bts_alloc_register(struct gsm_network *net, enum gsm_bts_type type, uint8_t bsic); |
Harald Welte | 142d12d | 2014-12-29 17:47:08 +0100 | [diff] [blame] | 1856 | |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 1857 | void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr, |
| 1858 | uint8_t e1_ts, uint8_t e1_ts_ss); |
| 1859 | |
Max | be356ed | 2017-09-07 19:10:09 +0200 | [diff] [blame] | 1860 | void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason); |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 1861 | struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr); |
Holger Hans Peter Freyther | a49b2c0 | 2014-11-21 11:18:45 +0100 | [diff] [blame] | 1862 | int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx); |
Alexander Chemeris | c36a13b | 2015-05-30 14:40:54 -0400 | [diff] [blame] | 1863 | int gsm_bts_set_system_infos(struct gsm_bts *bts); |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 1864 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 1865 | /* generic E1 line operations for all ISDN-based BTS. */ |
| 1866 | extern struct e1inp_line_ops bts_isdn_e1inp_line_ops; |
| 1867 | |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 1868 | extern const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE+1]; |
| 1869 | extern const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1]; |
| 1870 | |
Max | 3d049d2 | 2017-10-09 17:12:53 +0200 | [diff] [blame] | 1871 | char *get_model_oml_status(const struct gsm_bts *bts); |
| 1872 | |
Max | 25cc407 | 2017-10-10 14:50:35 +0200 | [diff] [blame] | 1873 | unsigned long long bts_uptime(const struct gsm_bts *bts); |
| 1874 | |
Holger Hans Peter Freyther | f8c4219 | 2013-01-09 17:03:27 +0100 | [diff] [blame] | 1875 | /* control interface handling */ |
| 1876 | int bsc_base_ctrl_cmds_install(void); |
| 1877 | |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 1878 | /* dependency handling */ |
| 1879 | void bts_depend_mark(struct gsm_bts *bts, int dep); |
| 1880 | void bts_depend_clear(struct gsm_bts *bts, int dep); |
| 1881 | int bts_depend_check(struct gsm_bts *bts); |
Holger Hans Peter Freyther | f7e23c5 | 2014-12-17 15:44:32 +0100 | [diff] [blame] | 1882 | int bts_depend_is_depedency(struct gsm_bts *base, struct gsm_bts *other); |
Holger Hans Peter Freyther | c22930e | 2014-12-17 14:46:17 +0100 | [diff] [blame] | 1883 | |
Harald Welte | 2f8b9d2 | 2017-06-18 11:12:13 +0300 | [diff] [blame] | 1884 | int gsm_bts_get_radio_link_timeout(const struct gsm_bts *bts); |
| 1885 | void gsm_bts_set_radio_link_timeout(struct gsm_bts *bts, int value); |
| 1886 | |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1887 | bool trx_is_usable(const struct gsm_bts_trx *trx); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1888 | bool ts_is_usable(const struct gsm_bts_trx_ts *ts); |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1889 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 1890 | int gsm_lchan_type_by_pchan(enum gsm_phys_chan_config pchan); |
| 1891 | enum gsm_phys_chan_config gsm_pchan_by_lchan_type(enum gsm_chan_t type); |
| 1892 | |
| 1893 | void gsm_bts_all_ts_dispatch(struct gsm_bts *bts, uint32_t ts_ev, void *data); |
| 1894 | void gsm_trx_all_ts_dispatch(struct gsm_bts_trx *trx, uint32_t ts_ev, void *data); |
| 1895 | |
| 1896 | int bts_count_free_ts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan); |
Neels Hofmeyr | 958f259 | 2018-05-27 01:26:31 +0200 | [diff] [blame] | 1897 | |
Vadim Yanitskiy | 73bd463 | 2019-11-02 00:57:23 +0700 | [diff] [blame] | 1898 | bool trx_has_valid_pchan_config(const struct gsm_bts_trx *trx); |
| 1899 | |
Neels Hofmeyr | b523f54 | 2020-07-09 15:54:40 +0200 | [diff] [blame] | 1900 | enum gsm48_rr_cause bsc_gsm48_rr_cause_from_gsm0808_cause(enum gsm0808_cause c); |
Neels Hofmeyr | 3405c77 | 2020-07-11 01:44:08 +0200 | [diff] [blame^] | 1901 | enum gsm48_rr_cause bsc_gsm48_rr_cause_from_rsl_cause(uint8_t c); |
Neels Hofmeyr | b523f54 | 2020-07-09 15:54:40 +0200 | [diff] [blame] | 1902 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 1903 | #endif /* _GSM_DATA_H */ |