Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 1 | /* gprs_rlcmac.h |
| 2 | * |
| 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
Holger Hans Peter Freyther | d6bd91e | 2013-08-24 21:16:55 +0200 | [diff] [blame] | 4 | * Copyright (C) 2013 by Holger Hans Peter Freyther |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 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. |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 15 | */ |
Pau Espin Pedrol | 585cfb2 | 2019-12-10 17:09:51 +0100 | [diff] [blame] | 16 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 17 | #ifndef GPRS_RLCMAC_H |
| 18 | #define GPRS_RLCMAC_H |
| 19 | |
Max | e9fe0e3 | 2017-09-28 15:56:05 +0200 | [diff] [blame] | 20 | #include <stdbool.h> |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 21 | #include <stdint.h> |
Max | e9fe0e3 | 2017-09-28 15:56:05 +0200 | [diff] [blame] | 22 | |
Pau Espin Pedrol | d7c3265 | 2019-12-23 12:41:34 +0100 | [diff] [blame] | 23 | #include <pcu_l1_if.h> |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 24 | |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 25 | #ifdef __cplusplus |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 26 | extern "C" { |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 27 | #endif |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 28 | #include <osmocom/core/linuxlist.h> |
Ivan Kluchnikov | 61a33f7 | 2012-04-12 15:22:06 +0400 | [diff] [blame] | 29 | #include <osmocom/core/timer.h> |
Alexander Couzens | ccde5c9 | 2017-02-04 03:10:08 +0100 | [diff] [blame] | 30 | #include <osmocom/core/bitvec.h> |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 31 | #include <osmocom/gsm/gsm48.h> |
Oliver Smith | cfb6321 | 2019-09-05 17:13:33 +0200 | [diff] [blame] | 32 | #include <osmocom/pcu/pcuif_proto.h> |
Pau Espin Pedrol | b2653fe | 2020-03-26 15:14:01 +0100 | [diff] [blame] | 33 | #include "gsm_rlcmac.h" |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 34 | #ifdef __cplusplus |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 35 | } |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 36 | #endif |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 37 | |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 38 | /* This special feature will delay assignment of downlink TBF by one second, |
| 39 | * in case there is already a TBF. |
| 40 | * This is usefull to debug downlink establishment during packet idle mode. |
| 41 | */ |
| 42 | //#define DEBUG_DL_ASS_IDLE |
Ivan Kluchnikov | c5d8c27 | 2012-06-04 21:55:02 +0400 | [diff] [blame] | 43 | |
Max | 7426c5f | 2019-02-18 20:42:42 +0100 | [diff] [blame] | 44 | #define DUMMY_VEC "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b" |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 45 | |
| 46 | struct gprs_rlcmac_tbf; |
Holger Hans Peter Freyther | b6acfda | 2013-10-17 19:41:11 +0200 | [diff] [blame] | 47 | struct gprs_rlcmac_bts; |
Jacob Erlbeck | e2e004e | 2015-06-18 17:16:26 +0200 | [diff] [blame] | 48 | struct GprsMs; |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 49 | |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 50 | #ifdef __cplusplus |
Andreas Eversberg | 5dac2f0 | 2012-06-27 15:52:04 +0200 | [diff] [blame] | 51 | /* |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 52 | * paging entry |
| 53 | */ |
| 54 | struct gprs_rlcmac_paging { |
| 55 | struct llist_head list; |
| 56 | uint8_t chan_needed; |
| 57 | uint8_t identity_lv[9]; |
| 58 | }; |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 59 | |
Andreas Eversberg | 07e97cf | 2012-08-07 16:00:56 +0200 | [diff] [blame] | 60 | /* |
Andreas Eversberg | 3b1332c | 2012-10-03 14:20:53 +0200 | [diff] [blame] | 61 | * coding scheme info |
| 62 | */ |
| 63 | struct gprs_rlcmac_cs { |
| 64 | uint8_t block_length; |
| 65 | uint8_t block_data; |
| 66 | uint8_t block_payload; |
| 67 | }; |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 68 | |
Max | 46fbfce | 2017-11-01 19:22:25 +0100 | [diff] [blame] | 69 | /* TS allocation internal functions */ |
| 70 | int find_multi_slots(struct gprs_rlcmac_trx *trx, uint8_t mslot_class, uint8_t *ul_slots, uint8_t *dl_slots); |
| 71 | |
Daniel Willmann | 418a423 | 2014-08-08 11:21:04 +0200 | [diff] [blame] | 72 | int gprs_rlcmac_received_lost(struct gprs_rlcmac_dl_tbf *tbf, uint16_t received, |
Andreas Eversberg | 050ace2 | 2013-03-16 16:22:02 +0100 | [diff] [blame] | 73 | uint16_t lost); |
| 74 | |
Daniel Willmann | 418a423 | 2014-08-08 11:21:04 +0200 | [diff] [blame] | 75 | int gprs_rlcmac_lost_rep(struct gprs_rlcmac_dl_tbf *tbf); |
Andreas Eversberg | 050ace2 | 2013-03-16 16:22:02 +0100 | [diff] [blame] | 76 | |
Pau Espin Pedrol | b69928c | 2020-08-18 20:29:40 +0200 | [diff] [blame] | 77 | int gprs_rlcmac_meas_rep(GprsMs *ms, Packet_Measurement_Report_t *pmr); |
Andreas Eversberg | 050ace2 | 2013-03-16 16:22:02 +0100 | [diff] [blame] | 78 | |
| 79 | int gprs_rlcmac_rssi(struct gprs_rlcmac_tbf *tbf, int8_t rssi); |
| 80 | |
| 81 | int gprs_rlcmac_rssi_rep(struct gprs_rlcmac_tbf *tbf); |
| 82 | |
Daniel Willmann | 418a423 | 2014-08-08 11:21:04 +0200 | [diff] [blame] | 83 | int gprs_rlcmac_dl_bw(struct gprs_rlcmac_dl_tbf *tbf, uint16_t octets); |
Andreas Eversberg | 050ace2 | 2013-03-16 16:22:02 +0100 | [diff] [blame] | 84 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 85 | /* TS 44.060 Section 10.4.7 Table 10.4.7.1: Payload Type field */ |
| 86 | enum gprs_rlcmac_block_type { |
| 87 | GPRS_RLCMAC_DATA_BLOCK = 0x0, |
Pau Espin Pedrol | 585cfb2 | 2019-12-10 17:09:51 +0100 | [diff] [blame] | 88 | GPRS_RLCMAC_CONTROL_BLOCK = 0x1, |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 89 | GPRS_RLCMAC_CONTROL_BLOCK_OPT = 0x2, |
| 90 | GPRS_RLCMAC_RESERVED = 0x3 |
| 91 | }; |
| 92 | |
Andreas Eversberg | 3e372d5 | 2012-07-06 09:28:15 +0200 | [diff] [blame] | 93 | int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf); |
Ivan Kluchnikov | a9e6dc5 | 2012-06-17 08:30:06 +0400 | [diff] [blame] | 94 | |
Oliver Smith | cfb6321 | 2019-09-05 17:13:33 +0200 | [diff] [blame] | 95 | struct msgb *gprs_rlcmac_app_info_msg(const struct gsm_pcu_if_app_info_req *req); |
| 96 | |
Holger Hans Peter Freyther | b19d726 | 2013-10-17 18:12:18 +0200 | [diff] [blame] | 97 | int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, |
Max | 878bd1f | 2016-07-20 13:05:05 +0200 | [diff] [blame] | 98 | uint8_t trx, uint8_t ts, |
Andreas Eversberg | e6228b3 | 2012-07-03 13:36:03 +0200 | [diff] [blame] | 99 | uint32_t fn, uint8_t block_nr); |
| 100 | |
Andreas Eversberg | a1503fa | 2012-07-22 08:58:09 +0200 | [diff] [blame] | 101 | extern "C" { |
| 102 | #endif |
Pau Espin Pedrol | c85e093 | 2021-02-25 18:08:10 +0100 | [diff] [blame] | 103 | int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, |
Max | e9fe0e3 | 2017-09-28 15:56:05 +0200 | [diff] [blame] | 104 | int8_t use_trx); |
Andreas Eversberg | a1503fa | 2012-07-22 08:58:09 +0200 | [diff] [blame] | 105 | |
Pau Espin Pedrol | c85e093 | 2021-02-25 18:08:10 +0100 | [diff] [blame] | 106 | int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, |
Max | e9fe0e3 | 2017-09-28 15:56:05 +0200 | [diff] [blame] | 107 | int8_t use_trx); |
Jacob Erlbeck | 400ec02 | 2015-07-14 13:31:48 +0200 | [diff] [blame] | 108 | |
Pau Espin Pedrol | c85e093 | 2021-02-25 18:08:10 +0100 | [diff] [blame] | 109 | int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, |
Max | e9fe0e3 | 2017-09-28 15:56:05 +0200 | [diff] [blame] | 110 | int8_t use_trx); |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 111 | |
Pau Espin Pedrol | d1049dc | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 112 | int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, uint16_t pgroup); |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 113 | int gprs_alloc_max_dl_slots_per_ms(const struct gprs_rlcmac_bts *bts, uint8_t ms_class); |
Andreas Eversberg | a1503fa | 2012-07-22 08:58:09 +0200 | [diff] [blame] | 114 | #ifdef __cplusplus |
| 115 | } |
Andreas Eversberg | 8b761a3 | 2012-07-20 21:50:31 +0200 | [diff] [blame] | 116 | #endif |
Andreas Eversberg | 2b91464 | 2012-07-19 13:06:26 +0200 | [diff] [blame] | 117 | |
Pau Espin Pedrol | 8a35e64 | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 118 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 119 | #endif // GPRS_RLCMAC_H |