blob: 293215497e53552df5a28193649f7ce8a1e2f221 [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>
Jacob Erlbeckf5898a02015-11-27 19:05:13 +010028#include <osmocom/core/stat_item.h>
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020029#include <osmocom/core/timer.h>
Max2efdf692016-02-22 11:39:30 +010030#include <osmocom/core/gsmtap.h>
bhargava959d1de2016-08-17 15:17:21 +053031#include <osmocom/gsm/l1sap.h>
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020032}
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +020033
34#include "poll_controller.h"
Holger Hans Peter Freythercedf8902013-10-19 20:47:12 +020035#include "sba.h"
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +020036#include "tbf.h"
Jacob Erlbecke43460b2015-05-13 13:33:12 +020037#include "gprs_ms_storage.h"
Jacob Erlbeck9e862e12015-12-14 15:19:12 +010038#include "gprs_coding_scheme.h"
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020039#endif
40
41#include <stdint.h>
42
Jacob Erlbeckd4ad7312015-07-17 16:39:09 +020043#define LLC_CODEL_DISABLE 0
44#define LLC_CODEL_USE_DEFAULT (-1)
Aravind Sirsikar99ab0a82016-06-15 17:46:41 +053045#define MAX_GPRS_CS 9
46
Jacob Erlbeckd4ad7312015-07-17 16:39:09 +020047
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +020048struct BTS;
Jacob Erlbecke2e004e2015-06-18 17:16:26 +020049struct GprsMs;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020050
51/*
52 * PDCH instance
53 */
54struct gprs_rlcmac_pdch {
Holger Hans Peter Freyther17b0d832013-10-19 17:37:48 +020055#ifdef __cplusplus
Holger Hans Peter Freyther24e98d02013-10-19 18:15:44 +020056 struct gprs_rlcmac_paging *dequeue_paging();
57 struct msgb *packet_paging_request();
58
Holger Hans Peter Freytherf0984892013-10-19 18:28:59 +020059 void add_paging(struct gprs_rlcmac_paging *pag);
Holger Hans Peter Freyther24e98d02013-10-19 18:15:44 +020060
Holger Hans Peter Freyther09ef27a2013-10-20 16:37:05 +020061 void free_resources();
Holger Hans Peter Freyther17b0d832013-10-19 17:37:48 +020062
63 bool is_enabled() const;
64
65 void enable();
66 void disable();
Holger Hans Peter Freyther9ae367f2013-10-26 16:42:38 +020067
68 /* dispatching of messages */
Jacob Erlbeck20f6fd12015-06-08 11:05:45 +020069 int rcv_block(uint8_t *data, uint8_t len, uint32_t fn,
70 struct pcu_l1_meas *meas);
Jacob Erlbeck9e862e12015-12-14 15:19:12 +010071 int rcv_block_gprs(uint8_t *data, uint32_t fn,
72 struct pcu_l1_meas *meas, GprsCodingScheme cs);
Jacob Erlbeck554a8352015-12-09 17:39:56 +010073 int rcv_data_block(uint8_t *data, uint32_t fn,
Jacob Erlbeck690a7342015-11-30 18:09:17 +010074 struct pcu_l1_meas *meas, GprsCodingScheme cs);
Holger Hans Peter Freyther65be4802013-10-26 18:39:36 +020075
76 gprs_rlcmac_bts *bts_data() const;
77 BTS *bts() const;
Holger Hans Peter Freyther05f8efc2013-10-26 18:53:16 +020078 uint8_t trx_no() const;
Daniel Willmann1e0c6102014-06-04 14:56:09 +020079
Daniel Willmannfe6e2e42014-07-10 17:44:06 +020080 struct gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi);
81 struct gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi);
Jacob Erlbeckccc34e42015-06-29 13:45:05 +020082
83 void attach_tbf(gprs_rlcmac_tbf *tbf);
84 void detach_tbf(gprs_rlcmac_tbf *tbf);
85
86 unsigned num_tbfs(enum gprs_rlcmac_tbf_direction dir) const;
Jacob Erlbeck23f93a12015-06-30 08:52:54 +020087
88 void reserve(enum gprs_rlcmac_tbf_direction dir);
89 void unreserve(enum gprs_rlcmac_tbf_direction dir);
90 unsigned num_reserved(enum gprs_rlcmac_tbf_direction dir) const;
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +020091
92 uint8_t assigned_usf() const;
Jacob Erlbeck47a57f62015-07-08 12:53:16 +020093 uint32_t assigned_tfi(enum gprs_rlcmac_tbf_direction dir) const;
Holger Hans Peter Freyther17b0d832013-10-19 17:37:48 +020094#endif
95
96 uint8_t m_is_enabled; /* TS is enabled */
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +020097 uint8_t tsc; /* TSC of this slot */
98 uint8_t next_ul_tfi; /* next uplink TBF/TFI to schedule (0..31) */
99 uint8_t next_dl_tfi; /* next downlink TBF/TFI to schedule (0..31) */
Holger Hans Peter Freyther705653b2013-11-26 16:39:28 +0100100 uint8_t next_ctrl_prio; /* next kind of ctrl message to schedule */
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200101 struct llist_head paging_list; /* list of paging messages */
102 uint32_t last_rts_fn; /* store last frame number of RTS */
Holger Hans Peter Freyther4ed1dae2013-10-20 10:14:03 +0200103
104 /* back pointers */
105 struct gprs_rlcmac_trx *trx;
106 uint8_t ts_no;
Holger Hans Peter Freytherd11290b2013-10-26 17:32:04 +0200107
108#ifdef __cplusplus
109private:
Holger Hans Peter Freyther05f8efc2013-10-26 18:53:16 +0200110 int rcv_control_block(bitvec *rlc_block, uint32_t fn);
Holger Hans Peter Freytherd11290b2013-10-26 17:32:04 +0200111
Holger Hans Peter Freythere1a075a2013-10-27 13:35:30 +0100112 void rcv_control_ack(Packet_Control_Acknowledgement_t *, uint32_t fn);
Holger Hans Peter Freyther5da20142013-10-27 11:41:01 +0100113 void rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *, uint32_t fn);
Jacob Erlbeckae9c5752016-01-13 13:55:44 +0100114 void rcv_control_egprs_dl_ack_nack(EGPRS_PD_AckNack_t *, uint32_t fn);
Holger Hans Peter Freyther7a344712013-10-27 11:37:53 +0100115 void rcv_resource_request(Packet_Resource_Request_t *t, uint32_t fn);
Holger Hans Peter Freythercb5c49b2013-10-27 11:19:13 +0100116 void rcv_measurement_report(Packet_Measurement_Report_t *t, uint32_t fn);
Jacob Erlbecked2dbf62015-12-28 19:15:40 +0100117 gprs_rlcmac_tbf *tbf_from_list_by_tfi(
118 LListHead<gprs_rlcmac_tbf> *tbf_list, uint8_t tfi,
Daniel Willmann2207c5e2014-07-10 17:44:06 +0200119 enum gprs_rlcmac_tbf_direction dir);
Jacob Erlbeck3a10dbd2015-07-10 19:52:37 +0200120 gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi,
121 enum gprs_rlcmac_tbf_direction dir);
Holger Hans Peter Freytherd11290b2013-10-26 17:32:04 +0200122#endif
Jacob Erlbeckccc34e42015-06-29 13:45:05 +0200123
124 uint8_t m_num_tbfs[2];
Jacob Erlbeck23f93a12015-06-30 08:52:54 +0200125 uint8_t m_num_reserved[2];
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +0200126 uint8_t m_assigned_usf; /* bit set */
Jacob Erlbeck47a57f62015-07-08 12:53:16 +0200127 uint32_t m_assigned_tfi[2]; /* bit set */
Jacob Erlbeck3a10dbd2015-07-10 19:52:37 +0200128 struct gprs_rlcmac_tbf *m_tbfs[2][32];
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200129};
130
131struct gprs_rlcmac_trx {
132 void *fl1h;
133 uint16_t arfcn;
134 struct gprs_rlcmac_pdch pdch[8];
Holger Hans Peter Freyther4ed1dae2013-10-20 10:14:03 +0200135
136 /* back pointers */
137 struct BTS *bts;
138 uint8_t trx_no;
Jacob Erlbeck23f93a12015-06-30 08:52:54 +0200139
140#ifdef __cplusplus
141 void reserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots);
142 void unreserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots);
143#endif
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200144};
145
Maxd71e8b32016-09-19 16:17:06 +0200146#ifdef __cplusplus
147extern "C" {
148#endif
149void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts,
150 uint8_t ta);
151#ifdef __cplusplus
152}
153#endif
154
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200155/**
156 * This is the data from C. As soon as our minimal compiler is gcc 4.7
157 * we can start to compile pcu_vty.c with c++ and remove the split.
158 */
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200159struct gprs_rlcmac_bts {
160 uint8_t bsic;
161 uint8_t fc_interval;
Jacob Erlbeck0288cdb2015-05-06 10:47:30 +0200162 uint16_t fc_bucket_time;
Jacob Erlbeck87d73412015-04-21 12:56:48 +0200163 uint32_t fc_bvc_bucket_size;
164 uint32_t fc_bvc_leak_rate;
165 uint32_t fc_ms_bucket_size;
166 uint32_t fc_ms_leak_rate;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200167 uint8_t cs1;
168 uint8_t cs2;
169 uint8_t cs3;
170 uint8_t cs4;
171 uint8_t initial_cs_dl, initial_cs_ul;
Jacob Erlbeck96ccea82016-01-07 15:00:43 +0100172 uint8_t initial_mcs_dl, initial_mcs_ul;
Jacob Erlbeckb33e6752015-06-04 19:04:30 +0200173 uint8_t max_cs_dl, max_cs_ul;
Jacob Erlbeck0d058052016-01-07 11:48:28 +0100174 uint8_t max_mcs_dl, max_mcs_ul;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200175 uint8_t force_cs; /* 0=use from BTS 1=use from VTY */
176 uint16_t force_llc_lifetime; /* overrides lifetime from SGSN */
Jacob Erlbeck0c1c8772015-03-20 12:02:42 +0100177 uint32_t llc_discard_csec;
Jacob Erlbeckd0261b72015-04-02 13:58:09 +0200178 uint32_t llc_idle_ack_csec;
Jacob Erlbeckd4ad7312015-07-17 16:39:09 +0200179 uint32_t llc_codel_interval_msec; /* 0=disabled, -1=use default interval */
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200180 uint8_t t3142;
181 uint8_t t3169;
182 uint8_t t3191;
183 uint16_t t3193_msec;
184 uint8_t t3195;
185 uint8_t n3101;
186 uint8_t n3103;
187 uint8_t n3105;
Max2efdf692016-02-22 11:39:30 +0100188 struct gsmtap_inst *gsmtap;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200189 struct gprs_rlcmac_trx trx[8];
190 int (*alloc_algorithm)(struct gprs_rlcmac_bts *bts,
Jacob Erlbecke2e004e2015-06-18 17:16:26 +0200191 struct GprsMs *ms,
Jacob Erlbeck5879c642015-07-10 10:41:36 +0200192 struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single,
193 int use_tbf);
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200194 uint32_t alloc_algorithm_curst; /* options to customize algorithm */
195 uint8_t force_two_phase;
196 uint8_t alpha, gamma;
Jacob Erlbeck953c7892015-09-28 18:12:57 +0200197 uint8_t egprs_enabled;
Jacob Erlbeck3bed5d12015-03-19 11:22:38 +0100198 uint32_t dl_tbf_idle_msec; /* hold time for idle DL TBFs */
Aravind Sirsikare6cadb42016-08-16 16:32:59 +0530199
200 /* 0 to support resegmentation in DL, 1 for no reseg */
201 uint8_t dl_arq_type;
202
Jacob Erlbecka098c192015-05-28 16:11:19 +0200203 uint32_t ms_idle_sec;
Jacob Erlbeck1751c622015-06-04 12:12:32 +0200204 uint8_t cs_adj_enabled;
205 uint8_t cs_adj_upper_limit;
206 uint8_t cs_adj_lower_limit;
Aravind Sirsikar99ab0a82016-06-15 17:46:41 +0530207 struct {int16_t low; int16_t high; } cs_lqual_ranges[MAX_GPRS_CS];
Jacob Erlbeck70b96aa2015-06-12 10:52:34 +0200208 uint16_t cs_downgrade_threshold; /* downgrade if less packets left (DL) */
Jacob Erlbeck36df7742016-01-19 15:53:30 +0100209 uint16_t ws_base;
210 uint16_t ws_pdch; /* increase WS by this value per PDCH */
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200211
Jacob Erlbeck77da3552015-07-16 18:33:46 +0200212 /* State for dynamic algorithm selection */
213 int multislot_disabled;
Holger Hans Peter Freyther34bd8bd2013-10-19 21:10:38 +0200214
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200215 /**
216 * Point back to the C++ object. This is used during the transition
217 * period.
218 */
219 struct BTS *bts;
Holger Hans Peter Freyther67ed34e2013-10-17 17:01:54 +0200220};
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200221
222#ifdef __cplusplus
223/**
224 * I represent a GSM BTS. I have one or more TRX, I know the current
225 * GSM time and I have controllers that help with allocating resources
226 * on my TRXs.
227 */
228struct BTS {
229public:
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100230 enum {
231 CTR_TBF_DL_ALLOCATED,
232 CTR_TBF_DL_FREED,
Jacob Erlbeck0316dc62016-01-21 20:12:04 +0100233 CTR_TBF_DL_ABORTED,
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100234 CTR_TBF_UL_ALLOCATED,
235 CTR_TBF_UL_FREED,
Jacob Erlbeck0316dc62016-01-21 20:12:04 +0100236 CTR_TBF_UL_ABORTED,
Holger Hans Peter Freytheraa35ba72013-11-13 15:02:50 +0100237 CTR_TBF_REUSED,
Jacob Erlbeck5979fe92015-07-14 14:02:41 +0200238 CTR_TBF_ALLOC_ALGO_A,
239 CTR_TBF_ALLOC_ALGO_B,
Jacob Erlbeck9b3d7e02016-01-19 10:44:42 +0100240 CTR_TBF_FAILED_EGPRS_ONLY,
Holger Hans Peter Freythere9429b52013-11-13 19:36:57 +0100241 CTR_RLC_SENT,
242 CTR_RLC_RESENT,
Holger Hans Peter Freytheref93bdb2013-11-24 00:01:50 +0100243 CTR_RLC_RESTARTED,
Holger Hans Peter Freytherc70aae42013-11-19 17:09:37 +0100244 CTR_RLC_STALLED,
Holger Hans Peter Freyther092478f2013-11-23 01:01:19 +0100245 CTR_RLC_NACKED,
sivasankari168911b2016-11-25 19:53:36 +0530246 CTR_RLC_FINAL_BLOCK_RESENT,
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200247 CTR_RLC_ASS_TIMEDOUT,
Jacob Erlbeck7c8d39a2015-09-07 14:04:56 +0200248 CTR_RLC_ASS_FAILED,
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200249 CTR_RLC_ACK_TIMEDOUT,
Jacob Erlbeck7c8d39a2015-09-07 14:04:56 +0200250 CTR_RLC_ACK_FAILED,
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200251 CTR_RLC_REL_TIMEDOUT,
Jacob Erlbeckbe4a08b2015-08-25 15:19:31 +0200252 CTR_RLC_LATE_BLOCK,
Alexander Couzens2cb15472016-05-18 16:43:10 +0200253 CTR_RLC_SENT_DUMMY,
Alexander Couzensf929e622016-05-22 00:02:56 +0200254 CTR_RLC_SENT_CONTROL,
Alexander Couzens7fdbf892016-05-21 19:45:23 +0200255 CTR_RLC_DL_BYTES,
256 CTR_RLC_DL_PAYLOAD_BYTES,
257 CTR_RLC_UL_BYTES,
258 CTR_RLC_UL_PAYLOAD_BYTES,
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100259 CTR_DECODE_ERRORS,
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100260 CTR_SBA_ALLOCATED,
261 CTR_SBA_FREED,
262 CTR_SBA_TIMEDOUT,
Holger Hans Peter Freyther19977872013-10-27 10:34:31 +0100263 CTR_LLC_FRAME_TIMEDOUT,
264 CTR_LLC_FRAME_DROPPED,
Holger Hans Peter Freytherb3d5ee22013-11-13 16:43:26 +0100265 CTR_LLC_FRAME_SCHED,
Alexander Couzens7fdbf892016-05-21 19:45:23 +0200266 CTR_LLC_DL_BYTES,
267 CTR_LLC_UL_BYTES,
Holger Hans Peter Freytherc1ae2262013-10-27 10:50:35 +0100268 CTR_RACH_REQUESTS,
sivasankari67b89ca2016-12-29 16:25:30 +0530269 CTR_11BIT_RACH_REQUESTS,
sivasankarida7250a2016-12-16 12:57:18 +0530270 CTR_SPB_UL_FIRST_SEGMENT,
271 CTR_SPB_UL_SECOND_SEGMENT,
272 CTR_SPB_DL_FIRST_SEGMENT,
273 CTR_SPB_DL_SECOND_SEGMENT,
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530274 CTR_IMMEDIATE_ASSIGN_UL_TBF,
sivasankari168911b2016-11-25 19:53:36 +0530275 CTR_IMMEDIATE_ASSIGN_REJ,
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530276 CTR_IMMEDIATE_ASSIGN_DL_TBF,
sivasankari168911b2016-11-25 19:53:36 +0530277 CTR_CHANNEL_REQUEST_DESCRIPTION,
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530278 CTR_PKT_UL_ASSIGNMENT,
sivasankari168911b2016-11-25 19:53:36 +0530279 CTR_PKT_ACCESS_REJ,
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530280 CTR_PKT_DL_ASSIGNMENT,
281 CTR_RLC_RECV_CONTROL,
282 CTR_PUA_POLL_TIMEDOUT,
283 CTR_PUA_POLL_FAILED,
284 CTR_PDA_POLL_TIMEDOUT,
285 CTR_PDA_POLL_FAILED,
286 CTR_PUAN_POLL_TIMEDOUT,
287 CTR_PUAN_POLL_FAILED,
288 CTR_PDAN_POLL_TIMEDOUT,
289 CTR_PDAN_POLL_FAILED,
290 CTR_GPRS_DL_CS1,
291 CTR_GPRS_DL_CS2,
292 CTR_GPRS_DL_CS3,
293 CTR_GPRS_DL_CS4,
294 CTR_EGPRS_DL_MCS1,
295 CTR_EGPRS_DL_MCS2,
296 CTR_EGPRS_DL_MCS3,
297 CTR_EGPRS_DL_MCS4,
298 CTR_EGPRS_DL_MCS5,
299 CTR_EGPRS_DL_MCS6,
300 CTR_EGPRS_DL_MCS7,
301 CTR_EGPRS_DL_MCS8,
302 CTR_EGPRS_DL_MCS9,
303 CTR_GPRS_UL_CS1,
304 CTR_GPRS_UL_CS2,
305 CTR_GPRS_UL_CS3,
306 CTR_GPRS_UL_CS4,
307 CTR_EGPRS_UL_MCS1,
308 CTR_EGPRS_UL_MCS2,
309 CTR_EGPRS_UL_MCS3,
310 CTR_EGPRS_UL_MCS4,
311 CTR_EGPRS_UL_MCS5,
312 CTR_EGPRS_UL_MCS6,
313 CTR_EGPRS_UL_MCS7,
314 CTR_EGPRS_UL_MCS8,
315 CTR_EGPRS_UL_MCS9,
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100316 };
317
Jacob Erlbeck502bd1f2015-03-20 14:26:05 +0100318 enum {
Jacob Erlbeckf5898a02015-11-27 19:05:13 +0100319 STAT_MS_PRESENT,
320 };
321
322 enum {
Jacob Erlbeck502bd1f2015-03-20 14:26:05 +0100323 TIMER_T3190_MSEC = 5000,
324 };
325
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200326 BTS();
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100327 ~BTS();
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200328
329 static BTS* main_bts();
330
331 struct gprs_rlcmac_bts *bts_data();
Holger Hans Peter Freythercedf8902013-10-19 20:47:12 +0200332 SBAController *sba();
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200333
Holger Hans Peter Freyther9b30c7f2013-10-17 19:59:56 +0200334 /** TODO: change the number to unsigned */
335 void set_current_frame_number(int frame_number);
Jacob Erlbeckaf75ce82015-08-26 13:22:28 +0200336 void set_current_block_frame_number(int frame_number, unsigned max_delay);
Holger Hans Peter Freyther9b30c7f2013-10-17 19:59:56 +0200337 int current_frame_number() const;
338
Holger Hans Peter Freytherf0984892013-10-19 18:28:59 +0200339 /** add paging to paging queue(s) */
340 int add_paging(uint8_t chan_needed, uint8_t *identity_lv);
341
Daniel Willmannfe6e2e42014-07-10 17:44:06 +0200342 gprs_rlcmac_dl_tbf *dl_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts);
343 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 +0200344 gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts);
345 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 +0200346
Holger Hans Peter Freyther70ddde62013-10-26 19:17:58 +0200347 int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx);
348
Holger Hans Peter Freyther40cfaa62013-10-26 19:49:16 +0200349 int rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn);
bhargava628dcfb2016-09-14 20:30:31 +0530350 uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type,
351 uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority);
bhargava959d1de2016-08-17 15:17:21 +0530352 int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit,
353 enum ph_burst_type burst_type);
Holger Hans Peter Freyther40cfaa62013-10-26 19:49:16 +0200354
Jacob Erlbeck71e55112015-05-21 11:10:15 +0200355 void trigger_dl_ass(gprs_rlcmac_dl_tbf *tbf, gprs_rlcmac_tbf *old_tbf);
Holger Hans Peter Freytherd9262b32013-10-26 20:12:59 +0200356 void snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi);
357
Jacob Erlbecke43460b2015-05-13 13:33:12 +0200358 GprsMsStorage &ms_store();
359 GprsMs *ms_by_tlli(uint32_t tlli, uint32_t old_tlli = 0);
Jacob Erlbeck076f5c72015-08-21 18:00:54 +0200360 GprsMs *ms_by_imsi(const char *imsi);
Jacob Erlbeck86b6f052015-11-27 15:17:34 +0100361 GprsMs *ms_alloc(uint8_t ms_class, uint8_t egprs_ms_class = 0);
Jacob Erlbecke43460b2015-05-13 13:33:12 +0200362
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100363 /*
364 * Statistics
365 */
366 void tbf_dl_created();
367 void tbf_dl_freed();
Jacob Erlbeck0316dc62016-01-21 20:12:04 +0100368 void tbf_dl_aborted();
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100369 void tbf_ul_created();
370 void tbf_ul_freed();
Jacob Erlbeck0316dc62016-01-21 20:12:04 +0100371 void tbf_ul_aborted();
Holger Hans Peter Freytheraa35ba72013-11-13 15:02:50 +0100372 void tbf_reused();
Jacob Erlbeck5979fe92015-07-14 14:02:41 +0200373 void tbf_alloc_algo_a();
374 void tbf_alloc_algo_b();
Jacob Erlbeck9b3d7e02016-01-19 10:44:42 +0100375 void tbf_failed_egprs_only();
Holger Hans Peter Freythere9429b52013-11-13 19:36:57 +0100376 void rlc_sent();
377 void rlc_resent();
Holger Hans Peter Freytheref93bdb2013-11-24 00:01:50 +0100378 void rlc_restarted();
Holger Hans Peter Freytherc70aae42013-11-19 17:09:37 +0100379 void rlc_stalled();
Holger Hans Peter Freyther092478f2013-11-23 01:01:19 +0100380 void rlc_nacked();
sivasankari168911b2016-11-25 19:53:36 +0530381 void rlc_final_block_resent();
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200382 void rlc_ass_timedout();
Jacob Erlbeck7c8d39a2015-09-07 14:04:56 +0200383 void rlc_ass_failed();
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200384 void rlc_ack_timedout();
Jacob Erlbeck7c8d39a2015-09-07 14:04:56 +0200385 void rlc_ack_failed();
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200386 void rlc_rel_timedout();
Jacob Erlbeckbe4a08b2015-08-25 15:19:31 +0200387 void rlc_late_block();
Alexander Couzens2cb15472016-05-18 16:43:10 +0200388 void rlc_sent_dummy();
Alexander Couzensf929e622016-05-22 00:02:56 +0200389 void rlc_sent_control();
Alexander Couzens7fdbf892016-05-21 19:45:23 +0200390 void rlc_dl_bytes(int bytes);
391 void rlc_dl_payload_bytes(int bytes);
392 void rlc_ul_bytes(int bytes);
393 void rlc_ul_payload_bytes(int bytes);
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100394 void decode_error();
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100395 void sba_allocated();
396 void sba_freed();
397 void sba_timedout();
Holger Hans Peter Freytherb3d5ee22013-11-13 16:43:26 +0100398 void llc_timedout_frame();
399 void llc_dropped_frame();
400 void llc_frame_sched();
Alexander Couzens7fdbf892016-05-21 19:45:23 +0200401 void llc_dl_bytes(int bytes);
402 void llc_ul_bytes(int bytes);
Holger Hans Peter Freytherc1ae2262013-10-27 10:50:35 +0100403 void rach_frame();
sivasankari67b89ca2016-12-29 16:25:30 +0530404 void rach_frame_11bit();
sivasankarida7250a2016-12-16 12:57:18 +0530405 void spb_uplink_first_segment();
406 void spb_uplink_second_segment();
407 void spb_downlink_first_segment();
408 void spb_downlink_second_segment();
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530409 void immediate_assignment_ul_tbf();
sivasankari168911b2016-11-25 19:53:36 +0530410 void immediate_assignment_reject();
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530411 void immediate_assignment_dl_tbf();
sivasankari168911b2016-11-25 19:53:36 +0530412 void channel_request_description();
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530413 void pkt_ul_assignment();
sivasankari168911b2016-11-25 19:53:36 +0530414 void pkt_access_reject();
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530415 void pkt_dl_assignemnt();
416 void rlc_rcvd_control();
417 void pua_poll_timedout();
418 void pua_poll_failed();
419 void pda_poll_timedout();
420 void pda_poll_failed();
421 void pkt_ul_ack_nack_poll_timedout();
422 void pkt_ul_ack_nack_poll_failed();
423 void pkt_dl_ack_nack_poll_timedout();
424 void pkt_dl_ack_nack_poll_failed();
425 void gprs_dl_cs1();
426 void gprs_dl_cs2();
427 void gprs_dl_cs3();
428 void gprs_dl_cs4();
429 void egprs_dl_mcs1();
430 void egprs_dl_mcs2();
431 void egprs_dl_mcs3();
432 void egprs_dl_mcs4();
433 void egprs_dl_mcs5();
434 void egprs_dl_mcs6();
435 void egprs_dl_mcs7();
436 void egprs_dl_mcs8();
437 void egprs_dl_mcs9();
438 void gprs_ul_cs1();
439 void gprs_ul_cs2();
440 void gprs_ul_cs3();
441 void gprs_ul_cs4();
442 void egprs_ul_mcs1();
443 void egprs_ul_mcs2();
444 void egprs_ul_mcs3();
445 void egprs_ul_mcs4();
446 void egprs_ul_mcs5();
447 void egprs_ul_mcs6();
448 void egprs_ul_mcs7();
449 void egprs_ul_mcs8();
450 void egprs_ul_mcs9();
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100451
Jacob Erlbeckf5898a02015-11-27 19:05:13 +0100452 void ms_present(int32_t n);
453 int32_t ms_present_get();
454
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100455 /*
456 * Below for C interface for the VTY
457 */
458 struct rate_ctr_group *rate_counters() const;
Jacob Erlbeckf5898a02015-11-27 19:05:13 +0100459 struct osmo_stat_item_group *stat_items() const;
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100460
Jacob Erlbecked2dbf62015-12-28 19:15:40 +0100461 LListHead<gprs_rlcmac_tbf>& ul_tbfs();
462 LListHead<gprs_rlcmac_tbf>& dl_tbfs();
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200463private:
Holger Hans Peter Freyther9b30c7f2013-10-17 19:59:56 +0200464 int m_cur_fn;
Jacob Erlbeck60f77032015-08-24 14:35:14 +0200465 int m_cur_blk_fn;
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200466 struct gprs_rlcmac_bts m_bts;
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +0200467 PollController m_pollController;
Holger Hans Peter Freythercedf8902013-10-19 20:47:12 +0200468 SBAController m_sba;
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100469 struct rate_ctr_group *m_ratectrs;
Jacob Erlbeckf5898a02015-11-27 19:05:13 +0100470 struct osmo_stat_item_group *m_statg;
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +0200471
Jacob Erlbecke43460b2015-05-13 13:33:12 +0200472 GprsMsStorage m_ms_store;
473
Jacob Erlbecked2dbf62015-12-28 19:15:40 +0100474 /* list of uplink TBFs */
475 LListHead<gprs_rlcmac_tbf> m_ul_tbfs;
476 /* list of downlink TBFs */
477 LListHead<gprs_rlcmac_tbf> m_dl_tbfs;
478
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +0200479private:
480 /* disable copying to avoid slicing */
481 BTS(const BTS&);
482 BTS& operator=(const BTS&);
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200483};
Holger Hans Peter Freyther9b30c7f2013-10-17 19:59:56 +0200484
485inline int BTS::current_frame_number() const
486{
487 return m_cur_fn;
488}
Holger Hans Peter Freyther111614a2013-10-19 20:04:57 +0200489
Holger Hans Peter Freythercedf8902013-10-19 20:47:12 +0200490inline SBAController *BTS::sba()
491{
492 return &m_sba;
493}
Holger Hans Peter Freyther65be4802013-10-26 18:39:36 +0200494
Jacob Erlbecke43460b2015-05-13 13:33:12 +0200495inline GprsMsStorage &BTS::ms_store()
496{
497 return m_ms_store;
498}
499
500inline GprsMs *BTS::ms_by_tlli(uint32_t tlli, uint32_t old_tlli)
501{
502 return ms_store().get_ms(tlli, old_tlli);
503}
504
Jacob Erlbeck076f5c72015-08-21 18:00:54 +0200505inline GprsMs *BTS::ms_by_imsi(const char *imsi)
506{
507 return ms_store().get_ms(0, 0, imsi);
508}
509
Jacob Erlbecked2dbf62015-12-28 19:15:40 +0100510inline LListHead<gprs_rlcmac_tbf>& BTS::ul_tbfs()
511{
512 return m_ul_tbfs;
513}
514
515inline LListHead<gprs_rlcmac_tbf>& BTS::dl_tbfs()
516{
517 return m_dl_tbfs;
518}
519
Holger Hans Peter Freyther65be4802013-10-26 18:39:36 +0200520inline BTS *gprs_rlcmac_pdch::bts() const
521{
522 return trx->bts;
523}
524
Jacob Erlbeckccc34e42015-06-29 13:45:05 +0200525inline unsigned gprs_rlcmac_pdch::num_tbfs(enum gprs_rlcmac_tbf_direction dir) const
526{
527 return m_num_tbfs[dir];
528}
529
Jacob Erlbeck23f93a12015-06-30 08:52:54 +0200530inline unsigned gprs_rlcmac_pdch::num_reserved(
531 enum gprs_rlcmac_tbf_direction dir) const
532{
533 return gprs_rlcmac_pdch::m_num_reserved[dir];
534}
535
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +0200536inline uint8_t gprs_rlcmac_pdch::assigned_usf() const
537{
538 return m_assigned_usf;
539}
540
Jacob Erlbeck47a57f62015-07-08 12:53:16 +0200541inline uint32_t gprs_rlcmac_pdch::assigned_tfi(
542 enum gprs_rlcmac_tbf_direction dir) const
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +0200543{
Jacob Erlbeck47a57f62015-07-08 12:53:16 +0200544 return m_assigned_tfi[dir];
Jacob Erlbeckcc9358f2015-06-30 14:10:13 +0200545}
546
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100547inline struct rate_ctr_group *BTS::rate_counters() const
548{
549 return m_ratectrs;
550}
551
Jacob Erlbeckf5898a02015-11-27 19:05:13 +0100552inline struct osmo_stat_item_group *BTS::stat_items() const
553{
554 return m_statg;
555}
556
Alexander Couzens7fdbf892016-05-21 19:45:23 +0200557#define CREATE_COUNT_ADD_INLINE(func_name, ctr_name) \
558 inline void BTS::func_name(int inc) {\
559 rate_ctr_add(&m_ratectrs->ctr[ctr_name], inc); \
560 }
561
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100562#define CREATE_COUNT_INLINE(func_name, ctr_name) \
563 inline void BTS::func_name() {\
564 rate_ctr_inc(&m_ratectrs->ctr[ctr_name]); \
565 }
Holger Hans Peter Freyther15877642013-10-27 09:50:15 +0100566
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100567CREATE_COUNT_INLINE(tbf_dl_created, CTR_TBF_DL_ALLOCATED)
568CREATE_COUNT_INLINE(tbf_dl_freed, CTR_TBF_DL_FREED)
Jacob Erlbeck0316dc62016-01-21 20:12:04 +0100569CREATE_COUNT_INLINE(tbf_dl_aborted, CTR_TBF_DL_ABORTED)
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100570CREATE_COUNT_INLINE(tbf_ul_created, CTR_TBF_UL_ALLOCATED)
571CREATE_COUNT_INLINE(tbf_ul_freed, CTR_TBF_UL_FREED)
Jacob Erlbeck0316dc62016-01-21 20:12:04 +0100572CREATE_COUNT_INLINE(tbf_ul_aborted, CTR_TBF_UL_ABORTED)
Holger Hans Peter Freytheraa35ba72013-11-13 15:02:50 +0100573CREATE_COUNT_INLINE(tbf_reused, CTR_TBF_REUSED)
Jacob Erlbeck5979fe92015-07-14 14:02:41 +0200574CREATE_COUNT_INLINE(tbf_alloc_algo_a, CTR_TBF_ALLOC_ALGO_A)
575CREATE_COUNT_INLINE(tbf_alloc_algo_b, CTR_TBF_ALLOC_ALGO_B)
Jacob Erlbeck9b3d7e02016-01-19 10:44:42 +0100576CREATE_COUNT_INLINE(tbf_failed_egprs_only, CTR_TBF_FAILED_EGPRS_ONLY)
Holger Hans Peter Freythere9429b52013-11-13 19:36:57 +0100577CREATE_COUNT_INLINE(rlc_sent, CTR_RLC_SENT)
578CREATE_COUNT_INLINE(rlc_resent, CTR_RLC_RESENT)
Holger Hans Peter Freytheref93bdb2013-11-24 00:01:50 +0100579CREATE_COUNT_INLINE(rlc_restarted, CTR_RLC_RESTARTED)
Holger Hans Peter Freytherc70aae42013-11-19 17:09:37 +0100580CREATE_COUNT_INLINE(rlc_stalled, CTR_RLC_STALLED)
Holger Hans Peter Freyther092478f2013-11-23 01:01:19 +0100581CREATE_COUNT_INLINE(rlc_nacked, CTR_RLC_NACKED)
sivasankari168911b2016-11-25 19:53:36 +0530582CREATE_COUNT_INLINE(rlc_final_block_resent, CTR_RLC_FINAL_BLOCK_RESENT);
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200583CREATE_COUNT_INLINE(rlc_ass_timedout, CTR_RLC_ASS_TIMEDOUT);
Jacob Erlbeck7c8d39a2015-09-07 14:04:56 +0200584CREATE_COUNT_INLINE(rlc_ass_failed, CTR_RLC_ASS_FAILED);
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200585CREATE_COUNT_INLINE(rlc_ack_timedout, CTR_RLC_ACK_TIMEDOUT);
Jacob Erlbeck7c8d39a2015-09-07 14:04:56 +0200586CREATE_COUNT_INLINE(rlc_ack_failed, CTR_RLC_ACK_FAILED);
Jacob Erlbeckc91c18e2015-07-07 09:33:29 +0200587CREATE_COUNT_INLINE(rlc_rel_timedout, CTR_RLC_REL_TIMEDOUT);
Jacob Erlbeckbe4a08b2015-08-25 15:19:31 +0200588CREATE_COUNT_INLINE(rlc_late_block, CTR_RLC_LATE_BLOCK);
Alexander Couzens2cb15472016-05-18 16:43:10 +0200589CREATE_COUNT_INLINE(rlc_sent_dummy, CTR_RLC_SENT_DUMMY);
Alexander Couzensf929e622016-05-22 00:02:56 +0200590CREATE_COUNT_INLINE(rlc_sent_control, CTR_RLC_SENT_CONTROL);
Alexander Couzens7fdbf892016-05-21 19:45:23 +0200591CREATE_COUNT_ADD_INLINE(rlc_dl_bytes, CTR_RLC_DL_BYTES);
592CREATE_COUNT_ADD_INLINE(rlc_dl_payload_bytes, CTR_RLC_DL_PAYLOAD_BYTES);
593CREATE_COUNT_ADD_INLINE(rlc_ul_bytes, CTR_RLC_UL_BYTES);
594CREATE_COUNT_ADD_INLINE(rlc_ul_payload_bytes, CTR_RLC_UL_PAYLOAD_BYTES);
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100595CREATE_COUNT_INLINE(decode_error, CTR_DECODE_ERRORS)
596CREATE_COUNT_INLINE(sba_allocated, CTR_SBA_ALLOCATED)
597CREATE_COUNT_INLINE(sba_freed, CTR_SBA_FREED)
598CREATE_COUNT_INLINE(sba_timedout, CTR_SBA_TIMEDOUT)
Holger Hans Peter Freytherb3d5ee22013-11-13 16:43:26 +0100599CREATE_COUNT_INLINE(llc_timedout_frame, CTR_LLC_FRAME_TIMEDOUT);
600CREATE_COUNT_INLINE(llc_dropped_frame, CTR_LLC_FRAME_DROPPED);
601CREATE_COUNT_INLINE(llc_frame_sched, CTR_LLC_FRAME_SCHED);
Alexander Couzens7fdbf892016-05-21 19:45:23 +0200602CREATE_COUNT_ADD_INLINE(llc_dl_bytes, CTR_LLC_DL_BYTES);
603CREATE_COUNT_ADD_INLINE(llc_ul_bytes, CTR_LLC_UL_BYTES);
Holger Hans Peter Freytherc1ae2262013-10-27 10:50:35 +0100604CREATE_COUNT_INLINE(rach_frame, CTR_RACH_REQUESTS);
sivasankari67b89ca2016-12-29 16:25:30 +0530605CREATE_COUNT_INLINE(rach_frame_11bit, CTR_11BIT_RACH_REQUESTS);
sivasankarida7250a2016-12-16 12:57:18 +0530606CREATE_COUNT_INLINE(spb_uplink_first_segment, CTR_SPB_UL_FIRST_SEGMENT);
607CREATE_COUNT_INLINE(spb_uplink_second_segment, CTR_SPB_UL_SECOND_SEGMENT);
608CREATE_COUNT_INLINE(spb_downlink_first_segment, CTR_SPB_DL_FIRST_SEGMENT);
609CREATE_COUNT_INLINE(spb_downlink_second_segment, CTR_SPB_DL_SECOND_SEGMENT);
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530610CREATE_COUNT_INLINE(immediate_assignment_ul_tbf, CTR_IMMEDIATE_ASSIGN_UL_TBF);
sivasankari168911b2016-11-25 19:53:36 +0530611CREATE_COUNT_INLINE(immediate_assignment_reject, CTR_IMMEDIATE_ASSIGN_REJ);
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530612CREATE_COUNT_INLINE(immediate_assignment_dl_tbf, CTR_IMMEDIATE_ASSIGN_DL_TBF);
sivasankari168911b2016-11-25 19:53:36 +0530613CREATE_COUNT_INLINE(channel_request_description, CTR_CHANNEL_REQUEST_DESCRIPTION);
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530614CREATE_COUNT_INLINE(pkt_ul_assignment, CTR_PKT_UL_ASSIGNMENT);
sivasankari168911b2016-11-25 19:53:36 +0530615CREATE_COUNT_INLINE(pkt_access_reject, CTR_PKT_ACCESS_REJ);
Mrinal Mishraf86307e2016-11-10 18:16:30 +0530616CREATE_COUNT_INLINE(pkt_dl_assignemnt, CTR_PKT_DL_ASSIGNMENT);
617CREATE_COUNT_INLINE(rlc_rcvd_control, CTR_RLC_RECV_CONTROL);
618CREATE_COUNT_INLINE(pua_poll_timedout, CTR_PUA_POLL_TIMEDOUT);
619CREATE_COUNT_INLINE(pua_poll_failed, CTR_PUA_POLL_FAILED);
620CREATE_COUNT_INLINE(pda_poll_timedout, CTR_PDA_POLL_TIMEDOUT);
621CREATE_COUNT_INLINE(pda_poll_failed, CTR_PDA_POLL_FAILED);
622CREATE_COUNT_INLINE(pkt_ul_ack_nack_poll_timedout, CTR_PUAN_POLL_TIMEDOUT);
623CREATE_COUNT_INLINE(pkt_ul_ack_nack_poll_failed, CTR_PUAN_POLL_FAILED);
624CREATE_COUNT_INLINE(pkt_dl_ack_nack_poll_timedout, CTR_PDAN_POLL_TIMEDOUT);
625CREATE_COUNT_INLINE(pkt_dl_ack_nack_poll_failed, CTR_PDAN_POLL_FAILED);
626CREATE_COUNT_INLINE(gprs_dl_cs1, CTR_GPRS_DL_CS1);
627CREATE_COUNT_INLINE(gprs_dl_cs2, CTR_GPRS_DL_CS2);
628CREATE_COUNT_INLINE(gprs_dl_cs3, CTR_GPRS_DL_CS3);
629CREATE_COUNT_INLINE(gprs_dl_cs4, CTR_GPRS_DL_CS4);
630CREATE_COUNT_INLINE(egprs_dl_mcs1, CTR_EGPRS_DL_MCS1);
631CREATE_COUNT_INLINE(egprs_dl_mcs2, CTR_EGPRS_DL_MCS2);
632CREATE_COUNT_INLINE(egprs_dl_mcs3, CTR_EGPRS_DL_MCS3);
633CREATE_COUNT_INLINE(egprs_dl_mcs4, CTR_EGPRS_DL_MCS4);
634CREATE_COUNT_INLINE(egprs_dl_mcs5, CTR_EGPRS_DL_MCS5);
635CREATE_COUNT_INLINE(egprs_dl_mcs6, CTR_EGPRS_DL_MCS6);
636CREATE_COUNT_INLINE(egprs_dl_mcs7, CTR_EGPRS_DL_MCS7);
637CREATE_COUNT_INLINE(egprs_dl_mcs8, CTR_EGPRS_DL_MCS8);
638CREATE_COUNT_INLINE(egprs_dl_mcs9, CTR_EGPRS_DL_MCS9);
639CREATE_COUNT_INLINE(gprs_ul_cs1, CTR_GPRS_UL_CS1);
640CREATE_COUNT_INLINE(gprs_ul_cs2, CTR_GPRS_UL_CS2);
641CREATE_COUNT_INLINE(gprs_ul_cs3, CTR_GPRS_UL_CS3);
642CREATE_COUNT_INLINE(gprs_ul_cs4, CTR_GPRS_UL_CS4);
643CREATE_COUNT_INLINE(egprs_ul_mcs1, CTR_EGPRS_UL_MCS1);
644CREATE_COUNT_INLINE(egprs_ul_mcs2, CTR_EGPRS_UL_MCS2);
645CREATE_COUNT_INLINE(egprs_ul_mcs3, CTR_EGPRS_UL_MCS3);
646CREATE_COUNT_INLINE(egprs_ul_mcs4, CTR_EGPRS_UL_MCS4);
647CREATE_COUNT_INLINE(egprs_ul_mcs5, CTR_EGPRS_UL_MCS5);
648CREATE_COUNT_INLINE(egprs_ul_mcs6, CTR_EGPRS_UL_MCS6);
649CREATE_COUNT_INLINE(egprs_ul_mcs7, CTR_EGPRS_UL_MCS7);
650CREATE_COUNT_INLINE(egprs_ul_mcs8, CTR_EGPRS_UL_MCS8);
651CREATE_COUNT_INLINE(egprs_ul_mcs9, CTR_EGPRS_UL_MCS9);
Holger Hans Peter Freyther15877642013-10-27 09:50:15 +0100652
Holger Hans Peter Freyther93e048f2013-10-27 10:00:47 +0100653#undef CREATE_COUNT_INLINE
Holger Hans Peter Freyther15877642013-10-27 09:50:15 +0100654
Jacob Erlbeckf5898a02015-11-27 19:05:13 +0100655#define CREATE_STAT_INLINE(func_name, func_name_get, stat_name) \
656 inline void BTS::func_name(int32_t val) {\
657 osmo_stat_item_set(m_statg->items[stat_name], val); \
658 } \
659 inline int32_t BTS::func_name_get() {\
660 return osmo_stat_item_get_last(m_statg->items[stat_name]); \
661 }
662
663CREATE_STAT_INLINE(ms_present, ms_present_get, STAT_MS_PRESENT);
664
665#undef CREATE_STAT_INLINE
Holger Hans Peter Freyther15877642013-10-27 09:50:15 +0100666
Holger Hans Peter Freyther65be4802013-10-26 18:39:36 +0200667inline gprs_rlcmac_bts *gprs_rlcmac_pdch::bts_data() const
668{
669 return trx->bts->bts_data();
670}
Holger Hans Peter Freyther05f8efc2013-10-26 18:53:16 +0200671
672inline uint8_t gprs_rlcmac_pdch::trx_no() const
673{
674 return trx->trx_no;
675}
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200676#endif
677
678#ifdef __cplusplus
679extern "C" {
680#endif
681 struct gprs_rlcmac_bts *bts_main_data();
Holger Hans Peter Freytherf5372982013-10-27 09:02:31 +0100682 struct rate_ctr_group *bts_main_data_stats();
Jacob Erlbeckf5898a02015-11-27 19:05:13 +0100683 struct osmo_stat_item_group *bts_main_data_stat_items();
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200684#ifdef __cplusplus
685}
Holger Hans Peter Freyther17b0d832013-10-19 17:37:48 +0200686
687inline bool gprs_rlcmac_pdch::is_enabled() const
688{
689 return m_is_enabled;
690}
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +0200691#endif