blob: ebfcd5e1981b22cdf4661ec1712fb3a5ce6b43ed [file] [log] [blame]
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +02001/* 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
25extern "C" {
26#include <osmocom/core/linuxlist.h>
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +010027#include <osmocom/core/rate_ctr.h>
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020028#include <osmocom/core/timer.h>
29}
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +020030
31#include "poll_controller.h"
Holger Hans Peter Freythercedf8902013-10-19 20:47:12 +020032#include "sba.h"
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +020033#include "tbf.h"
Jacob Erlbecke43460b2015-05-13 13:33:12 +020034#include "gprs_ms_storage.h"
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020035#endif
36
37#include <stdint.h>
38
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +020039struct BTS;
Jacob Erlbecke2e004e2015-06-18 17:16:26 +020040struct GprsMs;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020041
42/*
43 * PDCH instance
44 */
45struct gprs_rlcmac_pdch {
Holger Hans Peter Freyther17b0d832013-10-19 17:37:48 +020046#ifdef __cplusplus
Holger Hans Peter Freyther24e98d02013-10-19 18:15:44 +020047 struct gprs_rlcmac_paging *dequeue_paging();
48 struct msgb *packet_paging_request();
49
Holger Hans Peter Freytherf0984892013-10-19 18:28:59 +020050 void add_paging(struct gprs_rlcmac_paging *pag);
Holger Hans Peter Freyther24e98d02013-10-19 18:15:44 +020051
Holger Hans Peter Freyther09ef27a2013-10-20 16:37:05 +020052 void free_resources();
Holger Hans Peter Freyther17b0d832013-10-19 17:37:48 +020053
54 bool is_enabled() const;
55
56 void enable();
57 void disable();
Holger Hans Peter Freyther9ae367f2013-10-26 16:42:38 +020058
59 /* dispatching of messages */
Jacob Erlbeck20f6fd12015-06-08 11:05:45 +020060 int rcv_block(uint8_t *data, uint8_t len, uint32_t fn,
61 struct pcu_l1_meas *meas);
Holger Hans Peter Freyther65be4802013-10-26 18:39:36 +020062
63 gprs_rlcmac_bts *bts_data() const;
64 BTS *bts() const;
Holger Hans Peter Freyther05f8efc2013-10-26 18:53:16 +020065 uint8_t trx_no() const;
Daniel Willmann1e0c6102014-06-04 14:56:09 +020066
Daniel Willmannfe6e2e42014-07-10 17:44:06 +020067 struct gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi);
68 struct gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi);
Jacob Erlbeckccc34e42015-06-29 13:45:05 +020069
70 void attach_tbf(gprs_rlcmac_tbf *tbf);
71 void detach_tbf(gprs_rlcmac_tbf *tbf);
72
73 unsigned num_tbfs(enum gprs_rlcmac_tbf_direction dir) const;
Jacob Erlbeck23f93a12015-06-30 08:52:54 +020074
75 void reserve(enum gprs_rlcmac_tbf_direction dir);
76 void unreserve(enum gprs_rlcmac_tbf_direction dir);
77 unsigned num_reserved(enum gprs_rlcmac_tbf_direction dir) const;
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +020078
79 uint8_t assigned_usf() const;
Jacob Erlbeck47a57f62015-07-08 12:53:16 +020080 uint32_t assigned_tfi(enum gprs_rlcmac_tbf_direction dir) const;
Holger Hans Peter Freyther17b0d832013-10-19 17:37:48 +020081#endif
82
83 uint8_t m_is_enabled; /* TS is enabled */
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020084 uint8_t tsc; /* TSC of this slot */
85 uint8_t next_ul_tfi; /* next uplink TBF/TFI to schedule (0..31) */
86 uint8_t next_dl_tfi; /* next downlink TBF/TFI to schedule (0..31) */
Holger Hans Peter Freyther705653b2013-11-26 16:39:28 +010087 uint8_t next_ctrl_prio; /* next kind of ctrl message to schedule */
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020088 struct llist_head paging_list; /* list of paging messages */
89 uint32_t last_rts_fn; /* store last frame number of RTS */
Holger Hans Peter Freyther4ed1dae2013-10-20 10:14:03 +020090
91 /* back pointers */
92 struct gprs_rlcmac_trx *trx;
93 uint8_t ts_no;
Holger Hans Peter Freytherd11290b2013-10-26 17:32:04 +020094
95#ifdef __cplusplus
96private:
Jacob Erlbeck20f6fd12015-06-08 11:05:45 +020097 int rcv_data_block_acknowledged(uint8_t *data, uint8_t len,
98 struct pcu_l1_meas *meas);
Holger Hans Peter Freyther05f8efc2013-10-26 18:53:16 +020099 int rcv_control_block(bitvec *rlc_block, uint32_t fn);
Holger Hans Peter Freytherd11290b2013-10-26 17:32:04 +0200100
Holger Hans Peter Freythere1a075a2013-10-27 13:35:30 +0100101 void rcv_control_ack(Packet_Control_Acknowledgement_t *, uint32_t fn);
Holger Hans Peter Freyther5da20142013-10-27 11:41:01 +0100102 void rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *, uint32_t fn);
Holger Hans Peter Freyther7a344712013-10-27 11:37:53 +0100103 void rcv_resource_request(Packet_Resource_Request_t *t, uint32_t fn);
Holger Hans Peter Freythercb5c49b2013-10-27 11:19:13 +0100104 void rcv_measurement_report(Packet_Measurement_Report_t *t, uint32_t fn);
Daniel Willmann2207c5e2014-07-10 17:44:06 +0200105 gprs_rlcmac_tbf *tbf_from_list_by_tfi(struct llist_head *tbf_list, uint8_t tfi,
106 enum gprs_rlcmac_tbf_direction dir);
Jacob Erlbeck3a10dbd2015-07-10 19:52:37 +0200107 gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi,
108 enum gprs_rlcmac_tbf_direction dir);
Holger Hans Peter Freytherd11290b2013-10-26 17:32:04 +0200109#endif
Jacob Erlbeckccc34e42015-06-29 13:45:05 +0200110
111 uint8_t m_num_tbfs[2];
Jacob Erlbeck23f93a12015-06-30 08:52:54 +0200112 uint8_t m_num_reserved[2];
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +0200113 uint8_t m_assigned_usf; /* bit set */
Jacob Erlbeck47a57f62015-07-08 12:53:16 +0200114 uint32_t m_assigned_tfi[2]; /* bit set */
Jacob Erlbeck3a10dbd2015-07-10 19:52:37 +0200115 struct gprs_rlcmac_tbf *m_tbfs[2][32];
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200116};
117
118struct gprs_rlcmac_trx {
119 void *fl1h;
120 uint16_t arfcn;
121 struct gprs_rlcmac_pdch pdch[8];
Holger Hans Peter Freyther4ed1dae2013-10-20 10:14:03 +0200122
123 /* back pointers */
124 struct BTS *bts;
125 uint8_t trx_no;
Jacob Erlbeck23f93a12015-06-30 08:52:54 +0200126
127#ifdef __cplusplus
128 void reserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots);
129 void unreserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots);
130#endif
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200131};
132
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200133/**
134 * This is the data from C. As soon as our minimal compiler is gcc 4.7
135 * we can start to compile pcu_vty.c with c++ and remove the split.
136 */
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200137struct gprs_rlcmac_bts {
138 uint8_t bsic;
139 uint8_t fc_interval;
Jacob Erlbeck0288cdb2015-05-06 10:47:30 +0200140 uint16_t fc_bucket_time;
Jacob Erlbeck87d73412015-04-21 12:56:48 +0200141 uint32_t fc_bvc_bucket_size;
142 uint32_t fc_bvc_leak_rate;
143 uint32_t fc_ms_bucket_size;
144 uint32_t fc_ms_leak_rate;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200145 uint8_t cs1;
146 uint8_t cs2;
147 uint8_t cs3;
148 uint8_t cs4;
149 uint8_t initial_cs_dl, initial_cs_ul;
Jacob Erlbeckb33e6752015-06-04 19:04:30 +0200150 uint8_t max_cs_dl, max_cs_ul;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200151 uint8_t force_cs; /* 0=use from BTS 1=use from VTY */
152 uint16_t force_llc_lifetime; /* overrides lifetime from SGSN */
Jacob Erlbeck0c1c8772015-03-20 12:02:42 +0100153 uint32_t llc_discard_csec;
Jacob Erlbeckd0261b72015-04-02 13:58:09 +0200154 uint32_t llc_idle_ack_csec;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200155 uint8_t t3142;
156 uint8_t t3169;
157 uint8_t t3191;
158 uint16_t t3193_msec;
159 uint8_t t3195;
160 uint8_t n3101;
161 uint8_t n3103;
162 uint8_t n3105;
163 struct gprs_rlcmac_trx trx[8];
164 int (*alloc_algorithm)(struct gprs_rlcmac_bts *bts,
Jacob Erlbecke2e004e2015-06-18 17:16:26 +0200165 struct GprsMs *ms,
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200166 struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single,
167 int use_tbf);
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200168 uint32_t alloc_algorithm_curst; /* options to customize algorithm */
169 uint8_t force_two_phase;
170 uint8_t alpha, gamma;
Jacob Erlbeck3bed5d12015-03-19 11:22:38 +0100171 uint32_t dl_tbf_idle_msec; /* hold time for idle DL TBFs */
Jacob Erlbecka098c192015-05-28 16:11:19 +0200172 uint32_t ms_idle_sec;
Jacob Erlbeck1751c622015-06-04 12:12:32 +0200173 uint8_t cs_adj_enabled;
174 uint8_t cs_adj_upper_limit;
175 uint8_t cs_adj_lower_limit;
Jacob Erlbeck94cde132015-06-09 09:44:36 +0200176 struct {int16_t low; int16_t high;} cs_lqual_ranges[4];
Jacob Erlbeck70b96aa2015-06-12 10:52:34 +0200177 uint16_t cs_downgrade_threshold; /* downgrade if less packets left (DL) */
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200178
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +0200179 /* TBF handling, make private or move into TBFController */
180 /* list of uplink TBFs */
181 struct llist_head ul_tbfs;
182 /* list of downlink TBFs */
183 struct llist_head dl_tbfs;
184
185
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200186 /**
187 * Point back to the C++ object. This is used during the transition
188 * period.
189 */
190 struct BTS *bts;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200191};
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200192
193#ifdef __cplusplus
194/**
195 * I represent a GSM BTS. I have one or more TRX, I know the current
196 * GSM time and I have controllers that help with allocating resources
197 * on my TRXs.
198 */
199struct BTS {
200public:
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100201 enum {
202 CTR_TBF_DL_ALLOCATED,
203 CTR_TBF_DL_FREED,
204 CTR_TBF_UL_ALLOCATED,
205 CTR_TBF_UL_FREED,
Holger Hans Peter Freytheraa35ba72013-11-13 15:02:50 +0100206 CTR_TBF_REUSED,
Holger Hans Peter Freythere9429b52013-11-13 19:36:57 +0100207 CTR_RLC_SENT,
208 CTR_RLC_RESENT,
Holger Hans Peter Freytheref93bdb2013-11-24 00:01:50 +0100209 CTR_RLC_RESTARTED,
Holger Hans Peter Freytherc70aae42013-11-19 17:09:37 +0100210 CTR_RLC_STALLED,
Holger Hans Peter Freyther092478f2013-11-23 01:01:19 +0100211 CTR_RLC_NACKED,
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200212 CTR_RLC_ASS_TIMEDOUT,
213 CTR_RLC_ACK_TIMEDOUT,
214 CTR_RLC_REL_TIMEDOUT,
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100215 CTR_DECODE_ERRORS,
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100216 CTR_SBA_ALLOCATED,
217 CTR_SBA_FREED,
218 CTR_SBA_TIMEDOUT,
Holger Hans Peter Freyther19977872013-10-27 10:34:31 +0100219 CTR_LLC_FRAME_TIMEDOUT,
220 CTR_LLC_FRAME_DROPPED,
Holger Hans Peter Freytherb3d5ee22013-11-13 16:43:26 +0100221 CTR_LLC_FRAME_SCHED,
Holger Hans Peter Freytherc1ae2262013-10-27 10:50:35 +0100222 CTR_RACH_REQUESTS,
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100223 };
224
Jacob Erlbeck502bd1f2015-03-20 14:26:05 +0100225 enum {
226 TIMER_T3190_MSEC = 5000,
227 };
228
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200229 BTS();
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100230 ~BTS();
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200231
232 static BTS* main_bts();
233
234 struct gprs_rlcmac_bts *bts_data();
Holger Hans Peter Freythercedf8902013-10-19 20:47:12 +0200235 SBAController *sba();
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200236
Holger Hans Peter Freyther9b30c7f2013-10-17 19:59:56 +0200237 /** TODO: change the number to unsigned */
238 void set_current_frame_number(int frame_number);
239 int current_frame_number() const;
240
Holger Hans Peter Freytherf0984892013-10-19 18:28:59 +0200241 /** add paging to paging queue(s) */
242 int add_paging(uint8_t chan_needed, uint8_t *identity_lv);
243
Daniel Willmannfe6e2e42014-07-10 17:44:06 +0200244 gprs_rlcmac_dl_tbf *dl_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts);
245 gprs_rlcmac_ul_tbf *ul_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts);
Jacob Erlbeck3a10dbd2015-07-10 19:52:37 +0200246 gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts);
247 gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts);
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +0200248
Holger Hans Peter Freyther70ddde62013-10-26 19:17:58 +0200249 int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx);
250
Holger Hans Peter Freyther40cfaa62013-10-26 19:49:16 +0200251 int rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn);
Holger Hans Peter Freyther02beed52013-10-26 20:56:20 +0200252 int rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta);
Holger Hans Peter Freyther40cfaa62013-10-26 19:49:16 +0200253
Jacob Erlbeck71e55112015-05-21 11:10:15 +0200254 void trigger_dl_ass(gprs_rlcmac_dl_tbf *tbf, gprs_rlcmac_tbf *old_tbf);
Holger Hans Peter Freytherd9262b32013-10-26 20:12:59 +0200255 void snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi);
256
Jacob Erlbecke43460b2015-05-13 13:33:12 +0200257 GprsMsStorage &ms_store();
258 GprsMs *ms_by_tlli(uint32_t tlli, uint32_t old_tlli = 0);
Jacob Erlbeckcb1b4942015-06-19 10:59:58 +0200259 GprsMs *ms_alloc(uint8_t ms_class);
Jacob Erlbecke43460b2015-05-13 13:33:12 +0200260
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100261 /*
262 * Statistics
263 */
264 void tbf_dl_created();
265 void tbf_dl_freed();
266 void tbf_ul_created();
267 void tbf_ul_freed();
Holger Hans Peter Freytheraa35ba72013-11-13 15:02:50 +0100268 void tbf_reused();
Holger Hans Peter Freythere9429b52013-11-13 19:36:57 +0100269 void rlc_sent();
270 void rlc_resent();
Holger Hans Peter Freytheref93bdb2013-11-24 00:01:50 +0100271 void rlc_restarted();
Holger Hans Peter Freytherc70aae42013-11-19 17:09:37 +0100272 void rlc_stalled();
Holger Hans Peter Freyther092478f2013-11-23 01:01:19 +0100273 void rlc_nacked();
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200274 void rlc_ass_timedout();
275 void rlc_ack_timedout();
276 void rlc_rel_timedout();
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100277 void decode_error();
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100278 void sba_allocated();
279 void sba_freed();
280 void sba_timedout();
Holger Hans Peter Freytherb3d5ee22013-11-13 16:43:26 +0100281 void llc_timedout_frame();
282 void llc_dropped_frame();
283 void llc_frame_sched();
Holger Hans Peter Freytherc1ae2262013-10-27 10:50:35 +0100284 void rach_frame();
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100285
286 /*
287 * Below for C interface for the VTY
288 */
289 struct rate_ctr_group *rate_counters() const;
290
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200291private:
Holger Hans Peter Freyther9b30c7f2013-10-17 19:59:56 +0200292 int m_cur_fn;
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200293 struct gprs_rlcmac_bts m_bts;
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +0200294 PollController m_pollController;
Holger Hans Peter Freythercedf8902013-10-19 20:47:12 +0200295 SBAController m_sba;
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100296 struct rate_ctr_group *m_ratectrs;
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +0200297
Jacob Erlbecke43460b2015-05-13 13:33:12 +0200298 GprsMsStorage m_ms_store;
299
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +0200300private:
301 /* disable copying to avoid slicing */
302 BTS(const BTS&);
303 BTS& operator=(const BTS&);
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200304};
Holger Hans Peter Freyther9b30c7f2013-10-17 19:59:56 +0200305
306inline int BTS::current_frame_number() const
307{
308 return m_cur_fn;
309}
Holger Hans Peter Freyther111614a2013-10-19 20:04:57 +0200310
Holger Hans Peter Freythercedf8902013-10-19 20:47:12 +0200311inline SBAController *BTS::sba()
312{
313 return &m_sba;
314}
Holger Hans Peter Freyther65be4802013-10-26 18:39:36 +0200315
Jacob Erlbecke43460b2015-05-13 13:33:12 +0200316inline GprsMsStorage &BTS::ms_store()
317{
318 return m_ms_store;
319}
320
321inline GprsMs *BTS::ms_by_tlli(uint32_t tlli, uint32_t old_tlli)
322{
323 return ms_store().get_ms(tlli, old_tlli);
324}
325
Holger Hans Peter Freyther65be4802013-10-26 18:39:36 +0200326inline BTS *gprs_rlcmac_pdch::bts() const
327{
328 return trx->bts;
329}
330
Jacob Erlbeckccc34e42015-06-29 13:45:05 +0200331inline unsigned gprs_rlcmac_pdch::num_tbfs(enum gprs_rlcmac_tbf_direction dir) const
332{
333 return m_num_tbfs[dir];
334}
335
Jacob Erlbeck23f93a12015-06-30 08:52:54 +0200336inline unsigned gprs_rlcmac_pdch::num_reserved(
337 enum gprs_rlcmac_tbf_direction dir) const
338{
339 return gprs_rlcmac_pdch::m_num_reserved[dir];
340}
341
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +0200342inline uint8_t gprs_rlcmac_pdch::assigned_usf() const
343{
344 return m_assigned_usf;
345}
346
Jacob Erlbeck47a57f62015-07-08 12:53:16 +0200347inline uint32_t gprs_rlcmac_pdch::assigned_tfi(
348 enum gprs_rlcmac_tbf_direction dir) const
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +0200349{
Jacob Erlbeck47a57f62015-07-08 12:53:16 +0200350 return m_assigned_tfi[dir];
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +0200351}
352
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100353inline struct rate_ctr_group *BTS::rate_counters() const
354{
355 return m_ratectrs;
356}
357
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100358#define CREATE_COUNT_INLINE(func_name, ctr_name) \
359 inline void BTS::func_name() {\
360 rate_ctr_inc(&m_ratectrs->ctr[ctr_name]); \
361 }
Holger Hans Peter Freyther15877642013-10-27 09:50:15 +0100362
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100363CREATE_COUNT_INLINE(tbf_dl_created, CTR_TBF_DL_ALLOCATED)
364CREATE_COUNT_INLINE(tbf_dl_freed, CTR_TBF_DL_FREED)
365CREATE_COUNT_INLINE(tbf_ul_created, CTR_TBF_UL_ALLOCATED)
366CREATE_COUNT_INLINE(tbf_ul_freed, CTR_TBF_UL_FREED)
Holger Hans Peter Freytheraa35ba72013-11-13 15:02:50 +0100367CREATE_COUNT_INLINE(tbf_reused, CTR_TBF_REUSED)
Holger Hans Peter Freythere9429b52013-11-13 19:36:57 +0100368CREATE_COUNT_INLINE(rlc_sent, CTR_RLC_SENT)
369CREATE_COUNT_INLINE(rlc_resent, CTR_RLC_RESENT)
Holger Hans Peter Freytheref93bdb2013-11-24 00:01:50 +0100370CREATE_COUNT_INLINE(rlc_restarted, CTR_RLC_RESTARTED)
Holger Hans Peter Freytherc70aae42013-11-19 17:09:37 +0100371CREATE_COUNT_INLINE(rlc_stalled, CTR_RLC_STALLED)
Holger Hans Peter Freyther092478f2013-11-23 01:01:19 +0100372CREATE_COUNT_INLINE(rlc_nacked, CTR_RLC_NACKED)
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200373CREATE_COUNT_INLINE(rlc_ass_timedout, CTR_RLC_ASS_TIMEDOUT);
374CREATE_COUNT_INLINE(rlc_ack_timedout, CTR_RLC_ACK_TIMEDOUT);
375CREATE_COUNT_INLINE(rlc_rel_timedout, CTR_RLC_REL_TIMEDOUT);
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100376CREATE_COUNT_INLINE(decode_error, CTR_DECODE_ERRORS)
377CREATE_COUNT_INLINE(sba_allocated, CTR_SBA_ALLOCATED)
378CREATE_COUNT_INLINE(sba_freed, CTR_SBA_FREED)
379CREATE_COUNT_INLINE(sba_timedout, CTR_SBA_TIMEDOUT)
Holger Hans Peter Freytherb3d5ee22013-11-13 16:43:26 +0100380CREATE_COUNT_INLINE(llc_timedout_frame, CTR_LLC_FRAME_TIMEDOUT);
381CREATE_COUNT_INLINE(llc_dropped_frame, CTR_LLC_FRAME_DROPPED);
382CREATE_COUNT_INLINE(llc_frame_sched, CTR_LLC_FRAME_SCHED);
Holger Hans Peter Freytherc1ae2262013-10-27 10:50:35 +0100383CREATE_COUNT_INLINE(rach_frame, CTR_RACH_REQUESTS);
Holger Hans Peter Freyther15877642013-10-27 09:50:15 +0100384
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100385#undef CREATE_COUNT_INLINE
Holger Hans Peter Freyther15877642013-10-27 09:50:15 +0100386
Holger Hans Peter Freyther15877642013-10-27 09:50:15 +0100387
Holger Hans Peter Freyther65be4802013-10-26 18:39:36 +0200388inline gprs_rlcmac_bts *gprs_rlcmac_pdch::bts_data() const
389{
390 return trx->bts->bts_data();
391}
Holger Hans Peter Freyther05f8efc2013-10-26 18:53:16 +0200392
393inline uint8_t gprs_rlcmac_pdch::trx_no() const
394{
395 return trx->trx_no;
396}
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200397#endif
398
399#ifdef __cplusplus
400extern "C" {
401#endif
402 struct gprs_rlcmac_bts *bts_main_data();
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100403 struct rate_ctr_group *bts_main_data_stats();
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200404#ifdef __cplusplus
405}
Holger Hans Peter Freyther17b0d832013-10-19 17:37:48 +0200406
407inline bool gprs_rlcmac_pdch::is_enabled() const
408{
409 return m_is_enabled;
410}
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200411#endif