Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 1 | /* bts.h |
| 2 | * |
| 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
| 4 | * Copyright (C) 2013 by Holger Hans Peter Freyther |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | */ |
| 20 | |
| 21 | #pragma once |
| 22 | |
| 23 | |
| 24 | #ifdef __cplusplus |
| 25 | extern "C" { |
| 26 | #include <osmocom/core/linuxlist.h> |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 27 | #include <osmocom/core/rate_ctr.h> |
Jacob Erlbeck | f5898a0 | 2015-11-27 19:05:13 +0100 | [diff] [blame] | 28 | #include <osmocom/core/stat_item.h> |
Pau Espin Pedrol | 28f160e | 2019-09-05 14:48:35 +0200 | [diff] [blame] | 29 | #include <osmocom/core/tdef.h> |
bhargava | 959d1de | 2016-08-17 15:17:21 +0530 | [diff] [blame] | 30 | #include <osmocom/gsm/l1sap.h> |
Max | 84bf0fa | 2017-09-01 11:02:40 +0200 | [diff] [blame] | 31 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
Pau Espin Pedrol | b2653fe | 2020-03-26 15:14:01 +0100 | [diff] [blame] | 32 | #include "mslot_class.h" |
| 33 | #include "gsm_rlcmac.h" |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 34 | } |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 35 | |
| 36 | #include "poll_controller.h" |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 37 | #include "sba.h" |
Holger Hans Peter Freyther | 34bd8bd | 2013-10-19 21:10:38 +0200 | [diff] [blame] | 38 | #include "tbf.h" |
Jacob Erlbeck | e43460b | 2015-05-13 13:33:12 +0200 | [diff] [blame] | 39 | #include "gprs_ms_storage.h" |
Jacob Erlbeck | 9e862e1 | 2015-12-14 15:19:12 +0100 | [diff] [blame] | 40 | #include "gprs_coding_scheme.h" |
Max | 1187a77 | 2018-01-26 13:31:42 +0100 | [diff] [blame] | 41 | #include <cxx_linuxlist.h> |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 42 | #endif |
| 43 | |
Daniel Willmann | fb3fd09 | 2019-03-06 17:09:43 +0100 | [diff] [blame] | 44 | #include <pdch.h> |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 45 | #include <stdint.h> |
| 46 | |
Jacob Erlbeck | d4ad731 | 2015-07-17 16:39:09 +0200 | [diff] [blame] | 47 | #define LLC_CODEL_DISABLE 0 |
| 48 | #define LLC_CODEL_USE_DEFAULT (-1) |
Max | 8119ecd | 2019-03-06 19:03:01 +0100 | [diff] [blame] | 49 | |
| 50 | #define MAX_EDGE_MCS 9 |
| 51 | #define MAX_GPRS_CS 4 |
Aravind Sirsikar | 99ab0a8 | 2016-06-15 17:46:41 +0530 | [diff] [blame] | 52 | |
Harald Welte | 717cdf5 | 2017-07-21 21:56:23 +0200 | [diff] [blame] | 53 | /* see bts->gsmtap_categ_mask */ |
| 54 | enum pcu_gsmtap_category { |
| 55 | PCU_GSMTAP_C_DL_UNKNOWN = 0, /* unknown or undecodable downlink blocks */ |
| 56 | PCU_GSMTAP_C_DL_DUMMY = 1, /* downlink dummy blocks */ |
| 57 | PCU_GSMTAP_C_DL_CTRL = 2, /* downlink control blocks */ |
| 58 | PCU_GSMTAP_C_DL_DATA_GPRS = 3, /* downlink GPRS data blocks */ |
| 59 | PCU_GSMTAP_C_DL_DATA_EGPRS = 4, /* downlink EGPRS data blocks */ |
Harald Welte | bc219d5 | 2017-07-29 13:42:27 +0200 | [diff] [blame] | 60 | PCU_GSMTAP_C_DL_PTCCH = 5, /* downlink PTCCH blocks */ |
Pau Espin Pedrol | 5854370 | 2019-09-30 19:07:16 +0200 | [diff] [blame] | 61 | PCU_GSMTAP_C_DL_AGCH = 6, /* downlink AGCH blocks */ |
| 62 | PCU_GSMTAP_C_DL_PCH = 7, /* downlink PCH blocks */ |
Harald Welte | 717cdf5 | 2017-07-21 21:56:23 +0200 | [diff] [blame] | 63 | |
| 64 | PCU_GSMTAP_C_UL_UNKNOWN = 15, /* unknown or undecodable uplink blocks */ |
| 65 | PCU_GSMTAP_C_UL_DUMMY = 16, /* uplink dummy blocks */ |
| 66 | PCU_GSMTAP_C_UL_CTRL = 17, /* uplink control blocks */ |
| 67 | PCU_GSMTAP_C_UL_DATA_GPRS = 18, /* uplink GPRS data blocks */ |
| 68 | PCU_GSMTAP_C_UL_DATA_EGPRS = 19, /* uplink EGPRS data blocks */ |
Pau Espin Pedrol | 1ec211f | 2019-09-30 18:33:14 +0200 | [diff] [blame] | 69 | PCU_GSMTAP_C_UL_RACH = 20, /* uplink RACH bursts */ |
Harald Welte | 717cdf5 | 2017-07-21 21:56:23 +0200 | [diff] [blame] | 70 | }; |
Jacob Erlbeck | d4ad731 | 2015-07-17 16:39:09 +0200 | [diff] [blame] | 71 | |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 72 | struct BTS; |
Jacob Erlbeck | e2e004e | 2015-06-18 17:16:26 +0200 | [diff] [blame] | 73 | struct GprsMs; |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 74 | |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 75 | struct gprs_rlcmac_trx { |
| 76 | void *fl1h; |
| 77 | uint16_t arfcn; |
| 78 | struct gprs_rlcmac_pdch pdch[8]; |
Holger Hans Peter Freyther | 4ed1dae | 2013-10-20 10:14:03 +0200 | [diff] [blame] | 79 | |
| 80 | /* back pointers */ |
| 81 | struct BTS *bts; |
| 82 | uint8_t trx_no; |
Jacob Erlbeck | 23f93a1 | 2015-06-30 08:52:54 +0200 | [diff] [blame] | 83 | |
| 84 | #ifdef __cplusplus |
| 85 | void reserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots); |
| 86 | void unreserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots); |
| 87 | #endif |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 88 | }; |
| 89 | |
Max | d71e8b3 | 2016-09-19 16:17:06 +0200 | [diff] [blame] | 90 | #ifdef __cplusplus |
| 91 | extern "C" { |
| 92 | #endif |
Minh-Quang Nguyen | 1bcfa9a | 2017-11-01 14:41:37 -0400 | [diff] [blame] | 93 | void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts, int8_t ta, bool is_rach); |
Max | d71e8b3 | 2016-09-19 16:17:06 +0200 | [diff] [blame] | 94 | #ifdef __cplusplus |
| 95 | } |
| 96 | #endif |
| 97 | |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 98 | /** |
| 99 | * This is the data from C. As soon as our minimal compiler is gcc 4.7 |
| 100 | * we can start to compile pcu_vty.c with c++ and remove the split. |
| 101 | */ |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 102 | struct gprs_rlcmac_bts { |
Stefan Sperling | 5b22fb7 | 2018-02-14 19:46:33 +0100 | [diff] [blame] | 103 | bool active; |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 104 | uint8_t bsic; |
| 105 | uint8_t fc_interval; |
Jacob Erlbeck | 0288cdb | 2015-05-06 10:47:30 +0200 | [diff] [blame] | 106 | uint16_t fc_bucket_time; |
Jacob Erlbeck | 87d7341 | 2015-04-21 12:56:48 +0200 | [diff] [blame] | 107 | uint32_t fc_bvc_bucket_size; |
| 108 | uint32_t fc_bvc_leak_rate; |
| 109 | uint32_t fc_ms_bucket_size; |
| 110 | uint32_t fc_ms_leak_rate; |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 111 | uint8_t cs1; |
| 112 | uint8_t cs2; |
| 113 | uint8_t cs3; |
| 114 | uint8_t cs4; |
| 115 | uint8_t initial_cs_dl, initial_cs_ul; |
Jacob Erlbeck | 96ccea8 | 2016-01-07 15:00:43 +0100 | [diff] [blame] | 116 | uint8_t initial_mcs_dl, initial_mcs_ul; |
Jacob Erlbeck | b33e675 | 2015-06-04 19:04:30 +0200 | [diff] [blame] | 117 | uint8_t max_cs_dl, max_cs_ul; |
Jacob Erlbeck | 0d05805 | 2016-01-07 11:48:28 +0100 | [diff] [blame] | 118 | uint8_t max_mcs_dl, max_mcs_ul; |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 119 | uint8_t force_cs; /* 0=use from BTS 1=use from VTY */ |
| 120 | uint16_t force_llc_lifetime; /* overrides lifetime from SGSN */ |
Jacob Erlbeck | 0c1c877 | 2015-03-20 12:02:42 +0100 | [diff] [blame] | 121 | uint32_t llc_discard_csec; |
Jacob Erlbeck | d0261b7 | 2015-04-02 13:58:09 +0200 | [diff] [blame] | 122 | uint32_t llc_idle_ack_csec; |
Jacob Erlbeck | d4ad731 | 2015-07-17 16:39:09 +0200 | [diff] [blame] | 123 | uint32_t llc_codel_interval_msec; /* 0=disabled, -1=use default interval */ |
Pau Espin Pedrol | 28f160e | 2019-09-05 14:48:35 +0200 | [diff] [blame] | 124 | /* Timer defintions */ |
| 125 | struct osmo_tdef *T_defs_bts; /* timers controlled by BTS, received through PCUIF */ |
| 126 | struct osmo_tdef *T_defs_pcu; /* timers controlled by PCU */ |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 127 | uint8_t n3101; |
| 128 | uint8_t n3103; |
| 129 | uint8_t n3105; |
Max | 2efdf69 | 2016-02-22 11:39:30 +0100 | [diff] [blame] | 130 | struct gsmtap_inst *gsmtap; |
Harald Welte | 717cdf5 | 2017-07-21 21:56:23 +0200 | [diff] [blame] | 131 | uint32_t gsmtap_categ_mask; |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 132 | struct gprs_rlcmac_trx trx[8]; |
Max | e9fe0e3 | 2017-09-28 15:56:05 +0200 | [diff] [blame] | 133 | int (*alloc_algorithm)(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, |
| 134 | bool single, int8_t use_tbf); |
| 135 | |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 136 | uint8_t force_two_phase; |
| 137 | uint8_t alpha, gamma; |
Jacob Erlbeck | 953c789 | 2015-09-28 18:12:57 +0200 | [diff] [blame] | 138 | uint8_t egprs_enabled; |
Oliver Smith | 45fdc44 | 2019-09-05 15:12:20 +0200 | [diff] [blame] | 139 | bool dl_tbf_preemptive_retransmission; |
Max | 84bf0fa | 2017-09-01 11:02:40 +0200 | [diff] [blame] | 140 | uint8_t si13[GSM_MACBLOCK_LEN]; |
| 141 | bool si13_is_set; |
Aravind Sirsikar | e6cadb4 | 2016-08-16 16:32:59 +0530 | [diff] [blame] | 142 | /* 0 to support resegmentation in DL, 1 for no reseg */ |
| 143 | uint8_t dl_arq_type; |
| 144 | |
Pau Espin Pedrol | 1e6eb30 | 2019-11-28 17:00:44 +0100 | [diff] [blame] | 145 | uint8_t cs_adj_enabled; /* whether cs_adj_{upper,lower}_limit are used to adjust DL CS */ |
| 146 | uint8_t cs_adj_upper_limit; /* downgrade DL CS if error rate above its value */ |
| 147 | uint8_t cs_adj_lower_limit; /* upgrade DL CS if error rate below its value */ |
| 148 | /* downgrade DL CS when less than specified octets are left in tx queue. Optimization, see paper: |
| 149 | "Theoretical Analysis of GPRS Throughput and Delay" */ |
| 150 | uint16_t cs_downgrade_threshold; |
| 151 | /* Link quality range for each UL (M)CS. Below or above, next/prev (M)CS is selected. */ |
Aravind Sirsikar | 99ab0a8 | 2016-06-15 17:46:41 +0530 | [diff] [blame] | 152 | struct {int16_t low; int16_t high; } cs_lqual_ranges[MAX_GPRS_CS]; |
Max | 8119ecd | 2019-03-06 19:03:01 +0100 | [diff] [blame] | 153 | struct {int16_t low; int16_t high; } mcs_lqual_ranges[MAX_EDGE_MCS]; |
Jacob Erlbeck | 36df774 | 2016-01-19 15:53:30 +0100 | [diff] [blame] | 154 | uint16_t ws_base; |
| 155 | uint16_t ws_pdch; /* increase WS by this value per PDCH */ |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 156 | |
Jacob Erlbeck | 77da355 | 2015-07-16 18:33:46 +0200 | [diff] [blame] | 157 | /* State for dynamic algorithm selection */ |
| 158 | int multislot_disabled; |
Holger Hans Peter Freyther | 34bd8bd | 2013-10-19 21:10:38 +0200 | [diff] [blame] | 159 | |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 160 | /** |
| 161 | * Point back to the C++ object. This is used during the transition |
| 162 | * period. |
| 163 | */ |
| 164 | struct BTS *bts; |
Pau Espin Pedrol | c4178e5 | 2017-08-08 15:03:50 +0200 | [diff] [blame] | 165 | |
| 166 | /* Path to be used for the pcu-bts socket */ |
| 167 | char *pcu_sock_path; |
Harald Welte | 57d3515 | 2018-07-05 03:11:17 +0200 | [diff] [blame] | 168 | |
| 169 | /* Are we talking Gb with IP-SNS (true) or classic Gb? */ |
| 170 | bool gb_dialect_sns; |
Oliver Smith | cfb6321 | 2019-09-05 17:13:33 +0200 | [diff] [blame] | 171 | |
| 172 | /* Packet Application Information (3GPP TS 44.060 11.2.47, usually ETWS primary message). We don't need to store |
| 173 | * more than one message, because they get sent so rarely. */ |
| 174 | struct msgb *app_info; |
| 175 | uint32_t app_info_pending; /* Count of MS with active TBF, to which we did not send app_info yet */ |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 176 | }; |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 177 | |
| 178 | #ifdef __cplusplus |
| 179 | /** |
| 180 | * I represent a GSM BTS. I have one or more TRX, I know the current |
| 181 | * GSM time and I have controllers that help with allocating resources |
| 182 | * on my TRXs. |
| 183 | */ |
| 184 | struct BTS { |
| 185 | public: |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 186 | enum { |
| 187 | CTR_TBF_DL_ALLOCATED, |
| 188 | CTR_TBF_DL_FREED, |
Jacob Erlbeck | 0316dc6 | 2016-01-21 20:12:04 +0100 | [diff] [blame] | 189 | CTR_TBF_DL_ABORTED, |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 190 | CTR_TBF_UL_ALLOCATED, |
| 191 | CTR_TBF_UL_FREED, |
Jacob Erlbeck | 0316dc6 | 2016-01-21 20:12:04 +0100 | [diff] [blame] | 192 | CTR_TBF_UL_ABORTED, |
Holger Hans Peter Freyther | aa35ba7 | 2013-11-13 15:02:50 +0100 | [diff] [blame] | 193 | CTR_TBF_REUSED, |
Jacob Erlbeck | 5979fe9 | 2015-07-14 14:02:41 +0200 | [diff] [blame] | 194 | CTR_TBF_ALLOC_ALGO_A, |
| 195 | CTR_TBF_ALLOC_ALGO_B, |
Jacob Erlbeck | 9b3d7e0 | 2016-01-19 10:44:42 +0100 | [diff] [blame] | 196 | CTR_TBF_FAILED_EGPRS_ONLY, |
Holger Hans Peter Freyther | e9429b5 | 2013-11-13 19:36:57 +0100 | [diff] [blame] | 197 | CTR_RLC_SENT, |
| 198 | CTR_RLC_RESENT, |
Holger Hans Peter Freyther | ef93bdb | 2013-11-24 00:01:50 +0100 | [diff] [blame] | 199 | CTR_RLC_RESTARTED, |
Holger Hans Peter Freyther | c70aae4 | 2013-11-19 17:09:37 +0100 | [diff] [blame] | 200 | CTR_RLC_STALLED, |
Holger Hans Peter Freyther | 092478f | 2013-11-23 01:01:19 +0100 | [diff] [blame] | 201 | CTR_RLC_NACKED, |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 202 | CTR_RLC_FINAL_BLOCK_RESENT, |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 203 | CTR_RLC_ASS_TIMEDOUT, |
Jacob Erlbeck | 7c8d39a | 2015-09-07 14:04:56 +0200 | [diff] [blame] | 204 | CTR_RLC_ASS_FAILED, |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 205 | CTR_RLC_ACK_TIMEDOUT, |
Jacob Erlbeck | 7c8d39a | 2015-09-07 14:04:56 +0200 | [diff] [blame] | 206 | CTR_RLC_ACK_FAILED, |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 207 | CTR_RLC_REL_TIMEDOUT, |
Jacob Erlbeck | be4a08b | 2015-08-25 15:19:31 +0200 | [diff] [blame] | 208 | CTR_RLC_LATE_BLOCK, |
Alexander Couzens | 2cb1547 | 2016-05-18 16:43:10 +0200 | [diff] [blame] | 209 | CTR_RLC_SENT_DUMMY, |
Alexander Couzens | f929e62 | 2016-05-22 00:02:56 +0200 | [diff] [blame] | 210 | CTR_RLC_SENT_CONTROL, |
Alexander Couzens | 7fdbf89 | 2016-05-21 19:45:23 +0200 | [diff] [blame] | 211 | CTR_RLC_DL_BYTES, |
| 212 | CTR_RLC_DL_PAYLOAD_BYTES, |
| 213 | CTR_RLC_UL_BYTES, |
| 214 | CTR_RLC_UL_PAYLOAD_BYTES, |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 215 | CTR_DECODE_ERRORS, |
Holger Hans Peter Freyther | 93e048f | 2013-10-27 10:00:47 +0100 | [diff] [blame] | 216 | CTR_SBA_ALLOCATED, |
| 217 | CTR_SBA_FREED, |
| 218 | CTR_SBA_TIMEDOUT, |
Holger Hans Peter Freyther | 1997787 | 2013-10-27 10:34:31 +0100 | [diff] [blame] | 219 | CTR_LLC_FRAME_TIMEDOUT, |
| 220 | CTR_LLC_FRAME_DROPPED, |
Holger Hans Peter Freyther | b3d5ee2 | 2013-11-13 16:43:26 +0100 | [diff] [blame] | 221 | CTR_LLC_FRAME_SCHED, |
Alexander Couzens | 7fdbf89 | 2016-05-21 19:45:23 +0200 | [diff] [blame] | 222 | CTR_LLC_DL_BYTES, |
| 223 | CTR_LLC_UL_BYTES, |
Holger Hans Peter Freyther | c1ae226 | 2013-10-27 10:50:35 +0100 | [diff] [blame] | 224 | CTR_RACH_REQUESTS, |
sivasankari | 67b89ca | 2016-12-29 16:25:30 +0530 | [diff] [blame] | 225 | CTR_11BIT_RACH_REQUESTS, |
sivasankari | da7250a | 2016-12-16 12:57:18 +0530 | [diff] [blame] | 226 | CTR_SPB_UL_FIRST_SEGMENT, |
| 227 | CTR_SPB_UL_SECOND_SEGMENT, |
| 228 | CTR_SPB_DL_FIRST_SEGMENT, |
| 229 | CTR_SPB_DL_SECOND_SEGMENT, |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 230 | CTR_IMMEDIATE_ASSIGN_UL_TBF, |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 231 | CTR_IMMEDIATE_ASSIGN_REJ, |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 232 | CTR_IMMEDIATE_ASSIGN_DL_TBF, |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 233 | CTR_CHANNEL_REQUEST_DESCRIPTION, |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 234 | CTR_PKT_UL_ASSIGNMENT, |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 235 | CTR_PKT_ACCESS_REJ, |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 236 | CTR_PKT_DL_ASSIGNMENT, |
| 237 | CTR_RLC_RECV_CONTROL, |
| 238 | CTR_PUA_POLL_TIMEDOUT, |
| 239 | CTR_PUA_POLL_FAILED, |
| 240 | CTR_PDA_POLL_TIMEDOUT, |
| 241 | CTR_PDA_POLL_FAILED, |
| 242 | CTR_PUAN_POLL_TIMEDOUT, |
| 243 | CTR_PUAN_POLL_FAILED, |
| 244 | CTR_PDAN_POLL_TIMEDOUT, |
| 245 | CTR_PDAN_POLL_FAILED, |
| 246 | CTR_GPRS_DL_CS1, |
| 247 | CTR_GPRS_DL_CS2, |
| 248 | CTR_GPRS_DL_CS3, |
| 249 | CTR_GPRS_DL_CS4, |
| 250 | CTR_EGPRS_DL_MCS1, |
| 251 | CTR_EGPRS_DL_MCS2, |
| 252 | CTR_EGPRS_DL_MCS3, |
| 253 | CTR_EGPRS_DL_MCS4, |
| 254 | CTR_EGPRS_DL_MCS5, |
| 255 | CTR_EGPRS_DL_MCS6, |
| 256 | CTR_EGPRS_DL_MCS7, |
| 257 | CTR_EGPRS_DL_MCS8, |
| 258 | CTR_EGPRS_DL_MCS9, |
| 259 | CTR_GPRS_UL_CS1, |
| 260 | CTR_GPRS_UL_CS2, |
| 261 | CTR_GPRS_UL_CS3, |
| 262 | CTR_GPRS_UL_CS4, |
| 263 | CTR_EGPRS_UL_MCS1, |
| 264 | CTR_EGPRS_UL_MCS2, |
| 265 | CTR_EGPRS_UL_MCS3, |
| 266 | CTR_EGPRS_UL_MCS4, |
| 267 | CTR_EGPRS_UL_MCS5, |
| 268 | CTR_EGPRS_UL_MCS6, |
| 269 | CTR_EGPRS_UL_MCS7, |
| 270 | CTR_EGPRS_UL_MCS8, |
| 271 | CTR_EGPRS_UL_MCS9, |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 272 | }; |
| 273 | |
Jacob Erlbeck | 502bd1f | 2015-03-20 14:26:05 +0100 | [diff] [blame] | 274 | enum { |
Jacob Erlbeck | f5898a0 | 2015-11-27 19:05:13 +0100 | [diff] [blame] | 275 | STAT_MS_PRESENT, |
| 276 | }; |
| 277 | |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 278 | BTS(); |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 279 | ~BTS(); |
Max | d5ffeb5 | 2019-03-18 15:48:38 +0100 | [diff] [blame] | 280 | void cleanup(); |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 281 | |
| 282 | static BTS* main_bts(); |
| 283 | |
| 284 | struct gprs_rlcmac_bts *bts_data(); |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 285 | SBAController *sba(); |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 286 | |
Holger Hans Peter Freyther | 9b30c7f | 2013-10-17 19:59:56 +0200 | [diff] [blame] | 287 | /** TODO: change the number to unsigned */ |
| 288 | void set_current_frame_number(int frame_number); |
Jacob Erlbeck | af75ce8 | 2015-08-26 13:22:28 +0200 | [diff] [blame] | 289 | void set_current_block_frame_number(int frame_number, unsigned max_delay); |
Holger Hans Peter Freyther | 9b30c7f | 2013-10-17 19:59:56 +0200 | [diff] [blame] | 290 | int current_frame_number() const; |
| 291 | |
Holger Hans Peter Freyther | f098489 | 2013-10-19 18:28:59 +0200 | [diff] [blame] | 292 | /** add paging to paging queue(s) */ |
Pau Espin Pedrol | fbfab29 | 2019-12-23 13:19:25 +0100 | [diff] [blame] | 293 | int add_paging(uint8_t chan_needed, const uint8_t *mi, uint8_t mi_len); |
Holger Hans Peter Freyther | f098489 | 2013-10-19 18:28:59 +0200 | [diff] [blame] | 294 | |
Daniel Willmann | fe6e2e4 | 2014-07-10 17:44:06 +0200 | [diff] [blame] | 295 | gprs_rlcmac_dl_tbf *dl_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts); |
| 296 | gprs_rlcmac_ul_tbf *ul_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts); |
Jacob Erlbeck | 3a10dbd | 2015-07-10 19:52:37 +0200 | [diff] [blame] | 297 | gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts); |
| 298 | gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts); |
Holger Hans Peter Freyther | 34bd8bd | 2013-10-19 21:10:38 +0200 | [diff] [blame] | 299 | |
Max | a76a7d0 | 2018-01-26 11:09:16 +0100 | [diff] [blame] | 300 | int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx) const; |
Holger Hans Peter Freyther | 70ddde6 | 2013-10-26 19:17:58 +0200 | [diff] [blame] | 301 | |
Holger Hans Peter Freyther | 40cfaa6 | 2013-10-26 19:49:16 +0200 | [diff] [blame] | 302 | int rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn); |
Philipp Maier | 1275a3f | 2017-02-21 19:35:23 +0100 | [diff] [blame] | 303 | |
Max | 5dd8d1b | 2017-03-08 12:06:42 +0100 | [diff] [blame] | 304 | uint32_t rfn_to_fn(int32_t rfn); |
Max | 5881858 | 2018-01-05 15:04:50 +0100 | [diff] [blame] | 305 | int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, bool is_11bit, |
bhargava | 959d1de | 2016-08-17 15:17:21 +0530 | [diff] [blame] | 306 | enum ph_burst_type burst_type); |
Vadim Yanitskiy | ffebd24 | 2019-10-05 23:45:31 +0700 | [diff] [blame] | 307 | int rcv_ptcch_rach(uint8_t trx_nr, uint8_t ts_nr, uint32_t fn, int16_t qta); |
Holger Hans Peter Freyther | 40cfaa6 | 2013-10-26 19:49:16 +0200 | [diff] [blame] | 308 | |
Pau Espin Pedrol | d7c3265 | 2019-12-23 12:41:34 +0100 | [diff] [blame] | 309 | void snd_dl_ass(gprs_rlcmac_tbf *tbf, bool poll, uint16_t pgroup); |
Holger Hans Peter Freyther | d9262b3 | 2013-10-26 20:12:59 +0200 | [diff] [blame] | 310 | |
Jacob Erlbeck | e43460b | 2015-05-13 13:33:12 +0200 | [diff] [blame] | 311 | GprsMsStorage &ms_store(); |
| 312 | GprsMs *ms_by_tlli(uint32_t tlli, uint32_t old_tlli = 0); |
Jacob Erlbeck | 076f5c7 | 2015-08-21 18:00:54 +0200 | [diff] [blame] | 313 | GprsMs *ms_by_imsi(const char *imsi); |
Jacob Erlbeck | 86b6f05 | 2015-11-27 15:17:34 +0100 | [diff] [blame] | 314 | GprsMs *ms_alloc(uint8_t ms_class, uint8_t egprs_ms_class = 0); |
Jacob Erlbeck | e43460b | 2015-05-13 13:33:12 +0200 | [diff] [blame] | 315 | |
Harald Welte | 717cdf5 | 2017-07-21 21:56:23 +0200 | [diff] [blame] | 316 | void send_gsmtap(enum pcu_gsmtap_category categ, bool uplink, uint8_t trx_no, |
| 317 | uint8_t ts_no, uint8_t channel, uint32_t fn, |
| 318 | const uint8_t *data, unsigned int len); |
| 319 | |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 320 | /* |
| 321 | * Statistics |
| 322 | */ |
| 323 | void tbf_dl_created(); |
| 324 | void tbf_dl_freed(); |
Jacob Erlbeck | 0316dc6 | 2016-01-21 20:12:04 +0100 | [diff] [blame] | 325 | void tbf_dl_aborted(); |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 326 | void tbf_ul_created(); |
| 327 | void tbf_ul_freed(); |
Jacob Erlbeck | 0316dc6 | 2016-01-21 20:12:04 +0100 | [diff] [blame] | 328 | void tbf_ul_aborted(); |
Holger Hans Peter Freyther | aa35ba7 | 2013-11-13 15:02:50 +0100 | [diff] [blame] | 329 | void tbf_reused(); |
Jacob Erlbeck | 5979fe9 | 2015-07-14 14:02:41 +0200 | [diff] [blame] | 330 | void tbf_alloc_algo_a(); |
| 331 | void tbf_alloc_algo_b(); |
Jacob Erlbeck | 9b3d7e0 | 2016-01-19 10:44:42 +0100 | [diff] [blame] | 332 | void tbf_failed_egprs_only(); |
Holger Hans Peter Freyther | e9429b5 | 2013-11-13 19:36:57 +0100 | [diff] [blame] | 333 | void rlc_sent(); |
| 334 | void rlc_resent(); |
Holger Hans Peter Freyther | ef93bdb | 2013-11-24 00:01:50 +0100 | [diff] [blame] | 335 | void rlc_restarted(); |
Holger Hans Peter Freyther | c70aae4 | 2013-11-19 17:09:37 +0100 | [diff] [blame] | 336 | void rlc_stalled(); |
Holger Hans Peter Freyther | 092478f | 2013-11-23 01:01:19 +0100 | [diff] [blame] | 337 | void rlc_nacked(); |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 338 | void rlc_final_block_resent(); |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 339 | void rlc_ass_timedout(); |
Jacob Erlbeck | 7c8d39a | 2015-09-07 14:04:56 +0200 | [diff] [blame] | 340 | void rlc_ass_failed(); |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 341 | void rlc_ack_timedout(); |
Jacob Erlbeck | 7c8d39a | 2015-09-07 14:04:56 +0200 | [diff] [blame] | 342 | void rlc_ack_failed(); |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 343 | void rlc_rel_timedout(); |
Jacob Erlbeck | be4a08b | 2015-08-25 15:19:31 +0200 | [diff] [blame] | 344 | void rlc_late_block(); |
Alexander Couzens | 2cb1547 | 2016-05-18 16:43:10 +0200 | [diff] [blame] | 345 | void rlc_sent_dummy(); |
Alexander Couzens | f929e62 | 2016-05-22 00:02:56 +0200 | [diff] [blame] | 346 | void rlc_sent_control(); |
Alexander Couzens | 7fdbf89 | 2016-05-21 19:45:23 +0200 | [diff] [blame] | 347 | void rlc_dl_bytes(int bytes); |
| 348 | void rlc_dl_payload_bytes(int bytes); |
| 349 | void rlc_ul_bytes(int bytes); |
| 350 | void rlc_ul_payload_bytes(int bytes); |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 351 | void decode_error(); |
Holger Hans Peter Freyther | 93e048f | 2013-10-27 10:00:47 +0100 | [diff] [blame] | 352 | void sba_allocated(); |
| 353 | void sba_freed(); |
| 354 | void sba_timedout(); |
Holger Hans Peter Freyther | b3d5ee2 | 2013-11-13 16:43:26 +0100 | [diff] [blame] | 355 | void llc_timedout_frame(); |
| 356 | void llc_dropped_frame(); |
| 357 | void llc_frame_sched(); |
Alexander Couzens | 7fdbf89 | 2016-05-21 19:45:23 +0200 | [diff] [blame] | 358 | void llc_dl_bytes(int bytes); |
| 359 | void llc_ul_bytes(int bytes); |
Holger Hans Peter Freyther | c1ae226 | 2013-10-27 10:50:35 +0100 | [diff] [blame] | 360 | void rach_frame(); |
sivasankari | 67b89ca | 2016-12-29 16:25:30 +0530 | [diff] [blame] | 361 | void rach_frame_11bit(); |
sivasankari | da7250a | 2016-12-16 12:57:18 +0530 | [diff] [blame] | 362 | void spb_uplink_first_segment(); |
| 363 | void spb_uplink_second_segment(); |
| 364 | void spb_downlink_first_segment(); |
| 365 | void spb_downlink_second_segment(); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 366 | void immediate_assignment_ul_tbf(); |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 367 | void immediate_assignment_reject(); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 368 | void immediate_assignment_dl_tbf(); |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 369 | void channel_request_description(); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 370 | void pkt_ul_assignment(); |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 371 | void pkt_access_reject(); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 372 | void pkt_dl_assignemnt(); |
| 373 | void rlc_rcvd_control(); |
| 374 | void pua_poll_timedout(); |
| 375 | void pua_poll_failed(); |
| 376 | void pda_poll_timedout(); |
| 377 | void pda_poll_failed(); |
| 378 | void pkt_ul_ack_nack_poll_timedout(); |
| 379 | void pkt_ul_ack_nack_poll_failed(); |
| 380 | void pkt_dl_ack_nack_poll_timedout(); |
| 381 | void pkt_dl_ack_nack_poll_failed(); |
| 382 | void gprs_dl_cs1(); |
| 383 | void gprs_dl_cs2(); |
| 384 | void gprs_dl_cs3(); |
| 385 | void gprs_dl_cs4(); |
| 386 | void egprs_dl_mcs1(); |
| 387 | void egprs_dl_mcs2(); |
| 388 | void egprs_dl_mcs3(); |
| 389 | void egprs_dl_mcs4(); |
| 390 | void egprs_dl_mcs5(); |
| 391 | void egprs_dl_mcs6(); |
| 392 | void egprs_dl_mcs7(); |
| 393 | void egprs_dl_mcs8(); |
| 394 | void egprs_dl_mcs9(); |
| 395 | void gprs_ul_cs1(); |
| 396 | void gprs_ul_cs2(); |
| 397 | void gprs_ul_cs3(); |
| 398 | void gprs_ul_cs4(); |
| 399 | void egprs_ul_mcs1(); |
| 400 | void egprs_ul_mcs2(); |
| 401 | void egprs_ul_mcs3(); |
| 402 | void egprs_ul_mcs4(); |
| 403 | void egprs_ul_mcs5(); |
| 404 | void egprs_ul_mcs6(); |
| 405 | void egprs_ul_mcs7(); |
| 406 | void egprs_ul_mcs8(); |
| 407 | void egprs_ul_mcs9(); |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 408 | |
Jacob Erlbeck | f5898a0 | 2015-11-27 19:05:13 +0100 | [diff] [blame] | 409 | void ms_present(int32_t n); |
| 410 | int32_t ms_present_get(); |
| 411 | |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 412 | /* |
| 413 | * Below for C interface for the VTY |
| 414 | */ |
| 415 | struct rate_ctr_group *rate_counters() const; |
Jacob Erlbeck | f5898a0 | 2015-11-27 19:05:13 +0100 | [diff] [blame] | 416 | struct osmo_stat_item_group *stat_items() const; |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 417 | |
Jacob Erlbeck | ed2dbf6 | 2015-12-28 19:15:40 +0100 | [diff] [blame] | 418 | LListHead<gprs_rlcmac_tbf>& ul_tbfs(); |
| 419 | LListHead<gprs_rlcmac_tbf>& dl_tbfs(); |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 420 | private: |
Holger Hans Peter Freyther | 9b30c7f | 2013-10-17 19:59:56 +0200 | [diff] [blame] | 421 | int m_cur_fn; |
Jacob Erlbeck | 60f7703 | 2015-08-24 14:35:14 +0200 | [diff] [blame] | 422 | int m_cur_blk_fn; |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 423 | struct gprs_rlcmac_bts m_bts; |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 424 | PollController m_pollController; |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 425 | SBAController m_sba; |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 426 | struct rate_ctr_group *m_ratectrs; |
Jacob Erlbeck | f5898a0 | 2015-11-27 19:05:13 +0100 | [diff] [blame] | 427 | struct osmo_stat_item_group *m_statg; |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 428 | |
Jacob Erlbeck | e43460b | 2015-05-13 13:33:12 +0200 | [diff] [blame] | 429 | GprsMsStorage m_ms_store; |
| 430 | |
Jacob Erlbeck | ed2dbf6 | 2015-12-28 19:15:40 +0100 | [diff] [blame] | 431 | /* list of uplink TBFs */ |
| 432 | LListHead<gprs_rlcmac_tbf> m_ul_tbfs; |
| 433 | /* list of downlink TBFs */ |
| 434 | LListHead<gprs_rlcmac_tbf> m_dl_tbfs; |
| 435 | |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 436 | /* disable copying to avoid slicing */ |
| 437 | BTS(const BTS&); |
| 438 | BTS& operator=(const BTS&); |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 439 | }; |
Holger Hans Peter Freyther | 9b30c7f | 2013-10-17 19:59:56 +0200 | [diff] [blame] | 440 | |
| 441 | inline int BTS::current_frame_number() const |
| 442 | { |
| 443 | return m_cur_fn; |
| 444 | } |
Holger Hans Peter Freyther | 111614a | 2013-10-19 20:04:57 +0200 | [diff] [blame] | 445 | |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 446 | inline SBAController *BTS::sba() |
| 447 | { |
| 448 | return &m_sba; |
| 449 | } |
Holger Hans Peter Freyther | 65be480 | 2013-10-26 18:39:36 +0200 | [diff] [blame] | 450 | |
Jacob Erlbeck | e43460b | 2015-05-13 13:33:12 +0200 | [diff] [blame] | 451 | inline GprsMsStorage &BTS::ms_store() |
| 452 | { |
| 453 | return m_ms_store; |
| 454 | } |
| 455 | |
| 456 | inline GprsMs *BTS::ms_by_tlli(uint32_t tlli, uint32_t old_tlli) |
| 457 | { |
| 458 | return ms_store().get_ms(tlli, old_tlli); |
| 459 | } |
| 460 | |
Jacob Erlbeck | 076f5c7 | 2015-08-21 18:00:54 +0200 | [diff] [blame] | 461 | inline GprsMs *BTS::ms_by_imsi(const char *imsi) |
| 462 | { |
| 463 | return ms_store().get_ms(0, 0, imsi); |
| 464 | } |
| 465 | |
Jacob Erlbeck | ed2dbf6 | 2015-12-28 19:15:40 +0100 | [diff] [blame] | 466 | inline LListHead<gprs_rlcmac_tbf>& BTS::ul_tbfs() |
| 467 | { |
| 468 | return m_ul_tbfs; |
| 469 | } |
| 470 | |
| 471 | inline LListHead<gprs_rlcmac_tbf>& BTS::dl_tbfs() |
| 472 | { |
| 473 | return m_dl_tbfs; |
| 474 | } |
| 475 | |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 476 | inline struct rate_ctr_group *BTS::rate_counters() const |
| 477 | { |
| 478 | return m_ratectrs; |
| 479 | } |
| 480 | |
Jacob Erlbeck | f5898a0 | 2015-11-27 19:05:13 +0100 | [diff] [blame] | 481 | inline struct osmo_stat_item_group *BTS::stat_items() const |
| 482 | { |
| 483 | return m_statg; |
| 484 | } |
| 485 | |
Alexander Couzens | 7fdbf89 | 2016-05-21 19:45:23 +0200 | [diff] [blame] | 486 | #define CREATE_COUNT_ADD_INLINE(func_name, ctr_name) \ |
| 487 | inline void BTS::func_name(int inc) {\ |
| 488 | rate_ctr_add(&m_ratectrs->ctr[ctr_name], inc); \ |
| 489 | } |
| 490 | |
Holger Hans Peter Freyther | 93e048f | 2013-10-27 10:00:47 +0100 | [diff] [blame] | 491 | #define CREATE_COUNT_INLINE(func_name, ctr_name) \ |
| 492 | inline void BTS::func_name() {\ |
| 493 | rate_ctr_inc(&m_ratectrs->ctr[ctr_name]); \ |
| 494 | } |
Holger Hans Peter Freyther | 1587764 | 2013-10-27 09:50:15 +0100 | [diff] [blame] | 495 | |
Holger Hans Peter Freyther | 93e048f | 2013-10-27 10:00:47 +0100 | [diff] [blame] | 496 | CREATE_COUNT_INLINE(tbf_dl_created, CTR_TBF_DL_ALLOCATED) |
| 497 | CREATE_COUNT_INLINE(tbf_dl_freed, CTR_TBF_DL_FREED) |
Jacob Erlbeck | 0316dc6 | 2016-01-21 20:12:04 +0100 | [diff] [blame] | 498 | CREATE_COUNT_INLINE(tbf_dl_aborted, CTR_TBF_DL_ABORTED) |
Holger Hans Peter Freyther | 93e048f | 2013-10-27 10:00:47 +0100 | [diff] [blame] | 499 | CREATE_COUNT_INLINE(tbf_ul_created, CTR_TBF_UL_ALLOCATED) |
| 500 | CREATE_COUNT_INLINE(tbf_ul_freed, CTR_TBF_UL_FREED) |
Jacob Erlbeck | 0316dc6 | 2016-01-21 20:12:04 +0100 | [diff] [blame] | 501 | CREATE_COUNT_INLINE(tbf_ul_aborted, CTR_TBF_UL_ABORTED) |
Holger Hans Peter Freyther | aa35ba7 | 2013-11-13 15:02:50 +0100 | [diff] [blame] | 502 | CREATE_COUNT_INLINE(tbf_reused, CTR_TBF_REUSED) |
Jacob Erlbeck | 5979fe9 | 2015-07-14 14:02:41 +0200 | [diff] [blame] | 503 | CREATE_COUNT_INLINE(tbf_alloc_algo_a, CTR_TBF_ALLOC_ALGO_A) |
| 504 | CREATE_COUNT_INLINE(tbf_alloc_algo_b, CTR_TBF_ALLOC_ALGO_B) |
Jacob Erlbeck | 9b3d7e0 | 2016-01-19 10:44:42 +0100 | [diff] [blame] | 505 | CREATE_COUNT_INLINE(tbf_failed_egprs_only, CTR_TBF_FAILED_EGPRS_ONLY) |
Holger Hans Peter Freyther | e9429b5 | 2013-11-13 19:36:57 +0100 | [diff] [blame] | 506 | CREATE_COUNT_INLINE(rlc_sent, CTR_RLC_SENT) |
| 507 | CREATE_COUNT_INLINE(rlc_resent, CTR_RLC_RESENT) |
Holger Hans Peter Freyther | ef93bdb | 2013-11-24 00:01:50 +0100 | [diff] [blame] | 508 | CREATE_COUNT_INLINE(rlc_restarted, CTR_RLC_RESTARTED) |
Holger Hans Peter Freyther | c70aae4 | 2013-11-19 17:09:37 +0100 | [diff] [blame] | 509 | CREATE_COUNT_INLINE(rlc_stalled, CTR_RLC_STALLED) |
Holger Hans Peter Freyther | 092478f | 2013-11-23 01:01:19 +0100 | [diff] [blame] | 510 | CREATE_COUNT_INLINE(rlc_nacked, CTR_RLC_NACKED) |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 511 | CREATE_COUNT_INLINE(rlc_final_block_resent, CTR_RLC_FINAL_BLOCK_RESENT); |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 512 | CREATE_COUNT_INLINE(rlc_ass_timedout, CTR_RLC_ASS_TIMEDOUT); |
Jacob Erlbeck | 7c8d39a | 2015-09-07 14:04:56 +0200 | [diff] [blame] | 513 | CREATE_COUNT_INLINE(rlc_ass_failed, CTR_RLC_ASS_FAILED); |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 514 | CREATE_COUNT_INLINE(rlc_ack_timedout, CTR_RLC_ACK_TIMEDOUT); |
Jacob Erlbeck | 7c8d39a | 2015-09-07 14:04:56 +0200 | [diff] [blame] | 515 | CREATE_COUNT_INLINE(rlc_ack_failed, CTR_RLC_ACK_FAILED); |
Jacob Erlbeck | c91c18e | 2015-07-07 09:33:29 +0200 | [diff] [blame] | 516 | CREATE_COUNT_INLINE(rlc_rel_timedout, CTR_RLC_REL_TIMEDOUT); |
Jacob Erlbeck | be4a08b | 2015-08-25 15:19:31 +0200 | [diff] [blame] | 517 | CREATE_COUNT_INLINE(rlc_late_block, CTR_RLC_LATE_BLOCK); |
Alexander Couzens | 2cb1547 | 2016-05-18 16:43:10 +0200 | [diff] [blame] | 518 | CREATE_COUNT_INLINE(rlc_sent_dummy, CTR_RLC_SENT_DUMMY); |
Alexander Couzens | f929e62 | 2016-05-22 00:02:56 +0200 | [diff] [blame] | 519 | CREATE_COUNT_INLINE(rlc_sent_control, CTR_RLC_SENT_CONTROL); |
Alexander Couzens | 7fdbf89 | 2016-05-21 19:45:23 +0200 | [diff] [blame] | 520 | CREATE_COUNT_ADD_INLINE(rlc_dl_bytes, CTR_RLC_DL_BYTES); |
| 521 | CREATE_COUNT_ADD_INLINE(rlc_dl_payload_bytes, CTR_RLC_DL_PAYLOAD_BYTES); |
| 522 | CREATE_COUNT_ADD_INLINE(rlc_ul_bytes, CTR_RLC_UL_BYTES); |
| 523 | CREATE_COUNT_ADD_INLINE(rlc_ul_payload_bytes, CTR_RLC_UL_PAYLOAD_BYTES); |
Holger Hans Peter Freyther | 93e048f | 2013-10-27 10:00:47 +0100 | [diff] [blame] | 524 | CREATE_COUNT_INLINE(decode_error, CTR_DECODE_ERRORS) |
| 525 | CREATE_COUNT_INLINE(sba_allocated, CTR_SBA_ALLOCATED) |
| 526 | CREATE_COUNT_INLINE(sba_freed, CTR_SBA_FREED) |
| 527 | CREATE_COUNT_INLINE(sba_timedout, CTR_SBA_TIMEDOUT) |
Holger Hans Peter Freyther | b3d5ee2 | 2013-11-13 16:43:26 +0100 | [diff] [blame] | 528 | CREATE_COUNT_INLINE(llc_timedout_frame, CTR_LLC_FRAME_TIMEDOUT); |
| 529 | CREATE_COUNT_INLINE(llc_dropped_frame, CTR_LLC_FRAME_DROPPED); |
| 530 | CREATE_COUNT_INLINE(llc_frame_sched, CTR_LLC_FRAME_SCHED); |
Alexander Couzens | 7fdbf89 | 2016-05-21 19:45:23 +0200 | [diff] [blame] | 531 | CREATE_COUNT_ADD_INLINE(llc_dl_bytes, CTR_LLC_DL_BYTES); |
| 532 | CREATE_COUNT_ADD_INLINE(llc_ul_bytes, CTR_LLC_UL_BYTES); |
Holger Hans Peter Freyther | c1ae226 | 2013-10-27 10:50:35 +0100 | [diff] [blame] | 533 | CREATE_COUNT_INLINE(rach_frame, CTR_RACH_REQUESTS); |
sivasankari | 67b89ca | 2016-12-29 16:25:30 +0530 | [diff] [blame] | 534 | CREATE_COUNT_INLINE(rach_frame_11bit, CTR_11BIT_RACH_REQUESTS); |
sivasankari | da7250a | 2016-12-16 12:57:18 +0530 | [diff] [blame] | 535 | CREATE_COUNT_INLINE(spb_uplink_first_segment, CTR_SPB_UL_FIRST_SEGMENT); |
| 536 | CREATE_COUNT_INLINE(spb_uplink_second_segment, CTR_SPB_UL_SECOND_SEGMENT); |
| 537 | CREATE_COUNT_INLINE(spb_downlink_first_segment, CTR_SPB_DL_FIRST_SEGMENT); |
| 538 | CREATE_COUNT_INLINE(spb_downlink_second_segment, CTR_SPB_DL_SECOND_SEGMENT); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 539 | CREATE_COUNT_INLINE(immediate_assignment_ul_tbf, CTR_IMMEDIATE_ASSIGN_UL_TBF); |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 540 | CREATE_COUNT_INLINE(immediate_assignment_reject, CTR_IMMEDIATE_ASSIGN_REJ); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 541 | CREATE_COUNT_INLINE(immediate_assignment_dl_tbf, CTR_IMMEDIATE_ASSIGN_DL_TBF); |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 542 | CREATE_COUNT_INLINE(channel_request_description, CTR_CHANNEL_REQUEST_DESCRIPTION); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 543 | CREATE_COUNT_INLINE(pkt_ul_assignment, CTR_PKT_UL_ASSIGNMENT); |
sivasankari | 168911b | 2016-11-25 19:53:36 +0530 | [diff] [blame] | 544 | CREATE_COUNT_INLINE(pkt_access_reject, CTR_PKT_ACCESS_REJ); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 545 | CREATE_COUNT_INLINE(pkt_dl_assignemnt, CTR_PKT_DL_ASSIGNMENT); |
| 546 | CREATE_COUNT_INLINE(rlc_rcvd_control, CTR_RLC_RECV_CONTROL); |
| 547 | CREATE_COUNT_INLINE(pua_poll_timedout, CTR_PUA_POLL_TIMEDOUT); |
| 548 | CREATE_COUNT_INLINE(pua_poll_failed, CTR_PUA_POLL_FAILED); |
| 549 | CREATE_COUNT_INLINE(pda_poll_timedout, CTR_PDA_POLL_TIMEDOUT); |
| 550 | CREATE_COUNT_INLINE(pda_poll_failed, CTR_PDA_POLL_FAILED); |
| 551 | CREATE_COUNT_INLINE(pkt_ul_ack_nack_poll_timedout, CTR_PUAN_POLL_TIMEDOUT); |
| 552 | CREATE_COUNT_INLINE(pkt_ul_ack_nack_poll_failed, CTR_PUAN_POLL_FAILED); |
| 553 | CREATE_COUNT_INLINE(pkt_dl_ack_nack_poll_timedout, CTR_PDAN_POLL_TIMEDOUT); |
| 554 | CREATE_COUNT_INLINE(pkt_dl_ack_nack_poll_failed, CTR_PDAN_POLL_FAILED); |
| 555 | CREATE_COUNT_INLINE(gprs_dl_cs1, CTR_GPRS_DL_CS1); |
| 556 | CREATE_COUNT_INLINE(gprs_dl_cs2, CTR_GPRS_DL_CS2); |
| 557 | CREATE_COUNT_INLINE(gprs_dl_cs3, CTR_GPRS_DL_CS3); |
| 558 | CREATE_COUNT_INLINE(gprs_dl_cs4, CTR_GPRS_DL_CS4); |
| 559 | CREATE_COUNT_INLINE(egprs_dl_mcs1, CTR_EGPRS_DL_MCS1); |
| 560 | CREATE_COUNT_INLINE(egprs_dl_mcs2, CTR_EGPRS_DL_MCS2); |
| 561 | CREATE_COUNT_INLINE(egprs_dl_mcs3, CTR_EGPRS_DL_MCS3); |
| 562 | CREATE_COUNT_INLINE(egprs_dl_mcs4, CTR_EGPRS_DL_MCS4); |
| 563 | CREATE_COUNT_INLINE(egprs_dl_mcs5, CTR_EGPRS_DL_MCS5); |
| 564 | CREATE_COUNT_INLINE(egprs_dl_mcs6, CTR_EGPRS_DL_MCS6); |
| 565 | CREATE_COUNT_INLINE(egprs_dl_mcs7, CTR_EGPRS_DL_MCS7); |
| 566 | CREATE_COUNT_INLINE(egprs_dl_mcs8, CTR_EGPRS_DL_MCS8); |
| 567 | CREATE_COUNT_INLINE(egprs_dl_mcs9, CTR_EGPRS_DL_MCS9); |
| 568 | CREATE_COUNT_INLINE(gprs_ul_cs1, CTR_GPRS_UL_CS1); |
| 569 | CREATE_COUNT_INLINE(gprs_ul_cs2, CTR_GPRS_UL_CS2); |
| 570 | CREATE_COUNT_INLINE(gprs_ul_cs3, CTR_GPRS_UL_CS3); |
| 571 | CREATE_COUNT_INLINE(gprs_ul_cs4, CTR_GPRS_UL_CS4); |
| 572 | CREATE_COUNT_INLINE(egprs_ul_mcs1, CTR_EGPRS_UL_MCS1); |
| 573 | CREATE_COUNT_INLINE(egprs_ul_mcs2, CTR_EGPRS_UL_MCS2); |
| 574 | CREATE_COUNT_INLINE(egprs_ul_mcs3, CTR_EGPRS_UL_MCS3); |
| 575 | CREATE_COUNT_INLINE(egprs_ul_mcs4, CTR_EGPRS_UL_MCS4); |
| 576 | CREATE_COUNT_INLINE(egprs_ul_mcs5, CTR_EGPRS_UL_MCS5); |
| 577 | CREATE_COUNT_INLINE(egprs_ul_mcs6, CTR_EGPRS_UL_MCS6); |
| 578 | CREATE_COUNT_INLINE(egprs_ul_mcs7, CTR_EGPRS_UL_MCS7); |
| 579 | CREATE_COUNT_INLINE(egprs_ul_mcs8, CTR_EGPRS_UL_MCS8); |
| 580 | CREATE_COUNT_INLINE(egprs_ul_mcs9, CTR_EGPRS_UL_MCS9); |
Holger Hans Peter Freyther | 1587764 | 2013-10-27 09:50:15 +0100 | [diff] [blame] | 581 | |
Holger Hans Peter Freyther | 93e048f | 2013-10-27 10:00:47 +0100 | [diff] [blame] | 582 | #undef CREATE_COUNT_INLINE |
Holger Hans Peter Freyther | 1587764 | 2013-10-27 09:50:15 +0100 | [diff] [blame] | 583 | |
Jacob Erlbeck | f5898a0 | 2015-11-27 19:05:13 +0100 | [diff] [blame] | 584 | #define CREATE_STAT_INLINE(func_name, func_name_get, stat_name) \ |
| 585 | inline void BTS::func_name(int32_t val) {\ |
| 586 | osmo_stat_item_set(m_statg->items[stat_name], val); \ |
| 587 | } \ |
| 588 | inline int32_t BTS::func_name_get() {\ |
| 589 | return osmo_stat_item_get_last(m_statg->items[stat_name]); \ |
| 590 | } |
| 591 | |
| 592 | CREATE_STAT_INLINE(ms_present, ms_present_get, STAT_MS_PRESENT); |
| 593 | |
| 594 | #undef CREATE_STAT_INLINE |
Holger Hans Peter Freyther | 1587764 | 2013-10-27 09:50:15 +0100 | [diff] [blame] | 595 | |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 596 | #endif |
| 597 | |
| 598 | #ifdef __cplusplus |
| 599 | extern "C" { |
| 600 | #endif |
Max | d5ffeb5 | 2019-03-18 15:48:38 +0100 | [diff] [blame] | 601 | void bts_cleanup(); |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 602 | struct gprs_rlcmac_bts *bts_main_data(); |
Holger Hans Peter Freyther | f537298 | 2013-10-27 09:02:31 +0100 | [diff] [blame] | 603 | struct rate_ctr_group *bts_main_data_stats(); |
Jacob Erlbeck | f5898a0 | 2015-11-27 19:05:13 +0100 | [diff] [blame] | 604 | struct osmo_stat_item_group *bts_main_data_stat_items(); |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 605 | #ifdef __cplusplus |
| 606 | } |
Holger Hans Peter Freyther | 17b0d83 | 2013-10-19 17:37:48 +0200 | [diff] [blame] | 607 | |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 608 | #endif |