Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 1 | /* Copied from tbf.cpp |
| 2 | * |
| 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
| 4 | * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu> |
| 5 | * Copyright (C) 2013 by Holger Hans Peter Freyther |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * as published by the Free Software Foundation; either version 2 |
| 10 | * of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <bts.h> |
Oliver Smith | d3c7591 | 2021-07-09 16:37:16 +0200 | [diff] [blame] | 23 | #include <bts_pch_timer.h> |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 24 | #include <tbf.h> |
Pau Espin Pedrol | 9d1cdb1 | 2019-09-25 17:47:02 +0200 | [diff] [blame] | 25 | #include <tbf_ul.h> |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 26 | #include <rlc.h> |
| 27 | #include <encoding.h> |
| 28 | #include <gprs_rlcmac.h> |
| 29 | #include <gprs_debug.h> |
| 30 | #include <gprs_bssgp_pcu.h> |
| 31 | #include <decoding.h> |
Jacob Erlbeck | 20f6fd1 | 2015-06-08 11:05:45 +0200 | [diff] [blame] | 32 | #include <pcu_l1_if.h> |
Max | 1187a77 | 2018-01-26 13:31:42 +0100 | [diff] [blame] | 33 | #include <gprs_ms.h> |
| 34 | #include <llc.h> |
sivasankari | 8adfcd0 | 2017-01-16 15:41:21 +0530 | [diff] [blame] | 35 | #include "pcu_utils.h" |
| 36 | |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 37 | extern "C" { |
| 38 | #include <osmocom/core/msgb.h> |
| 39 | #include <osmocom/core/talloc.h> |
Max | 1187a77 | 2018-01-26 13:31:42 +0100 | [diff] [blame] | 40 | #include <osmocom/core/bitvec.h> |
| 41 | #include <osmocom/core/logging.h> |
| 42 | #include <osmocom/core/rate_ctr.h> |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 43 | #include <osmocom/core/stats.h> |
Max | 1187a77 | 2018-01-26 13:31:42 +0100 | [diff] [blame] | 44 | #include <osmocom/core/utils.h> |
| 45 | #include <osmocom/gprs/gprs_bssgp_bss.h> |
| 46 | #include <osmocom/gprs/protocol/gsm_08_18.h> |
| 47 | #include <osmocom/gsm/tlv.h> |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 48 | #include "coding_scheme.h" |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | #include <errno.h> |
| 52 | #include <string.h> |
| 53 | |
| 54 | /* After receiving these frames, we send ack/nack. */ |
| 55 | #define SEND_ACK_AFTER_FRAMES 20 |
| 56 | |
| 57 | extern void *tall_pcu_ctx; |
| 58 | |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 59 | static const struct rate_ctr_desc tbf_ul_gprs_ctr_description[] = { |
| 60 | { "gprs:uplink:cs1", "CS1 " }, |
| 61 | { "gprs:uplink:cs2", "CS2 " }, |
| 62 | { "gprs:uplink:cs3", "CS3 " }, |
| 63 | { "gprs:uplink:cs4", "CS4 " }, |
| 64 | }; |
| 65 | |
| 66 | static const struct rate_ctr_desc tbf_ul_egprs_ctr_description[] = { |
| 67 | { "egprs:uplink:mcs1", "MCS1 " }, |
| 68 | { "egprs:uplink:mcs2", "MCS2 " }, |
| 69 | { "egprs:uplink:mcs3", "MCS3 " }, |
| 70 | { "egprs:uplink:mcs4", "MCS4 " }, |
| 71 | { "egprs:uplink:mcs5", "MCS5 " }, |
| 72 | { "egprs:uplink:mcs6", "MCS6 " }, |
| 73 | { "egprs:uplink:mcs7", "MCS7 " }, |
| 74 | { "egprs:uplink:mcs8", "MCS8 " }, |
| 75 | { "egprs:uplink:mcs9", "MCS9 " }, |
| 76 | }; |
| 77 | |
| 78 | static const struct rate_ctr_group_desc tbf_ul_gprs_ctrg_desc = { |
| 79 | "tbf:gprs", |
| 80 | "Data Blocks", |
| 81 | OSMO_STATS_CLASS_SUBSCRIBER, |
| 82 | ARRAY_SIZE(tbf_ul_gprs_ctr_description), |
| 83 | tbf_ul_gprs_ctr_description, |
| 84 | }; |
| 85 | |
| 86 | static const struct rate_ctr_group_desc tbf_ul_egprs_ctrg_desc = { |
| 87 | "tbf:egprs", |
| 88 | "Data Blocks", |
| 89 | OSMO_STATS_CLASS_SUBSCRIBER, |
| 90 | ARRAY_SIZE(tbf_ul_egprs_ctr_description), |
| 91 | tbf_ul_egprs_ctr_description, |
| 92 | }; |
| 93 | |
Pau Espin Pedrol | 131deb0 | 2021-07-26 18:24:14 +0200 | [diff] [blame] | 94 | gprs_rlcmac_ul_tbf::~gprs_rlcmac_ul_tbf() |
| 95 | { |
Pau Espin Pedrol | ea8dbdd | 2021-07-29 18:39:16 +0200 | [diff] [blame] | 96 | osmo_fsm_inst_free(ul_ack_fsm.fi); |
| 97 | ul_ack_fsm.fi = NULL; |
| 98 | |
Pau Espin Pedrol | 131deb0 | 2021-07-26 18:24:14 +0200 | [diff] [blame] | 99 | rate_ctr_group_free(m_ul_egprs_ctrs); |
| 100 | rate_ctr_group_free(m_ul_gprs_ctrs); |
| 101 | /* ~gprs_rlcmac_tbf() is called automatically upon return */ |
| 102 | } |
| 103 | |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 104 | static int ul_tbf_dtor(struct gprs_rlcmac_ul_tbf *tbf) |
| 105 | { |
| 106 | tbf->~gprs_rlcmac_ul_tbf(); |
| 107 | return 0; |
| 108 | } |
| 109 | |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 110 | /* Generic function to alloc a UL TBF, later configured to be assigned either over CCCH or PACCH */ |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 111 | struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx, bool single_slot) |
| 112 | { |
| 113 | struct gprs_rlcmac_ul_tbf *tbf; |
| 114 | int rc; |
| 115 | |
| 116 | OSMO_ASSERT(ms != NULL); |
| 117 | |
Pau Espin Pedrol | 36177c6 | 2021-02-25 17:57:37 +0100 | [diff] [blame] | 118 | LOGPMS(ms, DTBF, LOGL_DEBUG, "********** UL-TBF starts here **********\n"); |
| 119 | LOGPMS(ms, DTBF, LOGL_INFO, "Allocating UL TBF\n"); |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 120 | |
| 121 | tbf = talloc(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf); |
| 122 | if (!tbf) |
| 123 | return NULL; |
| 124 | talloc_set_destructor(tbf, ul_tbf_dtor); |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 125 | new (tbf) gprs_rlcmac_ul_tbf(bts, ms); |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 126 | |
| 127 | rc = tbf->setup(use_trx, single_slot); |
| 128 | |
| 129 | /* if no resource */ |
| 130 | if (rc < 0) { |
| 131 | talloc_free(tbf); |
| 132 | return NULL; |
| 133 | } |
| 134 | |
| 135 | if (tbf->is_egprs_enabled()) |
| 136 | tbf->set_window_size(); |
| 137 | |
| 138 | tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf, |
| 139 | &tbf_ul_egprs_ctrg_desc, tbf->m_ctrs->idx); |
| 140 | tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf, |
| 141 | &tbf_ul_gprs_ctrg_desc, tbf->m_ctrs->idx); |
| 142 | if (!tbf->m_ul_egprs_ctrs || !tbf->m_ul_gprs_ctrs) { |
| 143 | LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate TBF UL counters\n"); |
| 144 | talloc_free(tbf); |
| 145 | return NULL; |
| 146 | } |
| 147 | |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 148 | llist_add_tail(tbf_trx_list(tbf), &tbf->trx->ul_tbfs); |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 149 | bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_UL_ALLOCATED); |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 150 | |
| 151 | return tbf; |
| 152 | } |
| 153 | |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 154 | /* Alloc a UL TBF to be assigned over PACCH */ |
Pau Espin Pedrol | 5922396 | 2021-10-18 12:24:38 +0200 | [diff] [blame] | 155 | gprs_rlcmac_ul_tbf *tbf_alloc_ul_pacch(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx) |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 156 | { |
| 157 | struct gprs_rlcmac_ul_tbf *tbf; |
| 158 | |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 159 | tbf = tbf_alloc_ul_tbf(bts, ms, use_trx, false); |
| 160 | if (!tbf) { |
Pau Espin Pedrol | 36177c6 | 2021-02-25 17:57:37 +0100 | [diff] [blame] | 161 | LOGPMS(ms, DTBF, LOGL_NOTICE, "No PDCH resource\n"); |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 162 | /* Caller will most probably send a Imm Ass Reject after return */ |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 163 | return NULL; |
| 164 | } |
| 165 | tbf->m_contention_resolution_done = 1; |
Pau Espin Pedrol | 33e8007 | 2021-07-22 19:20:50 +0200 | [diff] [blame] | 166 | osmo_fsm_inst_dispatch(tbf->state_fsm.fi, TBF_EV_ASSIGN_ADD_PACCH, NULL); |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 167 | |
| 168 | return tbf; |
| 169 | } |
| 170 | |
Pau Espin Pedrol | 858f038 | 2021-11-02 14:13:47 +0100 | [diff] [blame] | 171 | /* Alloc a UL TBF to be assigned over CCCH. Used by request of a "One phase |
| 172 | * packet access", where MS requested only 1 PDCH TS (TS 44.018 Table 9.1.8.1). */ |
Pau Espin Pedrol | 20271c4 | 2021-05-10 17:21:03 +0200 | [diff] [blame] | 173 | struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_ccch(struct gprs_rlcmac_bts *bts, struct GprsMs *ms) |
| 174 | { |
| 175 | struct gprs_rlcmac_ul_tbf *tbf; |
| 176 | |
| 177 | tbf = tbf_alloc_ul_tbf(bts, ms, -1, true); |
| 178 | if (!tbf) { |
| 179 | LOGP(DTBF, LOGL_NOTICE, "No PDCH resource for Uplink TBF\n"); |
| 180 | /* Caller will most probably send a Imm Ass Reject after return */ |
| 181 | return NULL; |
| 182 | } |
Pau Espin Pedrol | 33e8007 | 2021-07-22 19:20:50 +0200 | [diff] [blame] | 183 | osmo_fsm_inst_dispatch(tbf->state_fsm.fi, TBF_EV_ASSIGN_ADD_CCCH, NULL); |
Pau Espin Pedrol | 4b6f0bf | 2021-05-10 18:54:52 +0200 | [diff] [blame] | 184 | tbf->contention_resolution_start(); |
Pau Espin Pedrol | 20271c4 | 2021-05-10 17:21:03 +0200 | [diff] [blame] | 185 | OSMO_ASSERT(tbf->ms()); |
| 186 | |
| 187 | return tbf; |
| 188 | } |
| 189 | |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 190 | /* Create a temporary dummy TBF to Tx a ImmAssReject if allocating a new one during |
| 191 | * packet resource Request failed. This is similar as tbf_alloc_ul() but without |
| 192 | * calling tbf->setup() (in charge of TFI/USF allocation), and reusing resources |
| 193 | * from Packet Resource Request we received. See TS 44.060 sec 7.1.3.2.1 */ |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 194 | struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts, |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 195 | GprsMs *ms, uint8_t trx_no, uint8_t ts) |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 196 | { |
| 197 | struct gprs_rlcmac_ul_tbf *ul_tbf = NULL; |
| 198 | struct gprs_rlcmac_trx *trx = &bts->trx[trx_no]; |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 199 | OSMO_ASSERT(ms); |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 200 | |
| 201 | ul_tbf = talloc(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf); |
| 202 | if (!ul_tbf) |
| 203 | return ul_tbf; |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 204 | talloc_set_destructor(ul_tbf, ul_tbf_dtor); |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 205 | new (ul_tbf) gprs_rlcmac_ul_tbf(bts, ms); |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 206 | |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 207 | ul_tbf->control_ts = ts; |
| 208 | ul_tbf->trx = trx; |
| 209 | ul_tbf->m_ctrs = rate_ctr_group_alloc(ul_tbf, &tbf_ctrg_desc, next_tbf_ctr_group_id++); |
| 210 | ul_tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(ul_tbf, |
| 211 | &tbf_ul_egprs_ctrg_desc, |
| 212 | ul_tbf->m_ctrs->idx); |
| 213 | ul_tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(ul_tbf, |
| 214 | &tbf_ul_gprs_ctrg_desc, |
| 215 | ul_tbf->m_ctrs->idx); |
| 216 | if (!ul_tbf->m_ctrs || !ul_tbf->m_ul_egprs_ctrs || !ul_tbf->m_ul_gprs_ctrs) { |
| 217 | LOGPTBF(ul_tbf, LOGL_ERROR, "Cound not allocate TBF UL rate counters\n"); |
| 218 | talloc_free(ul_tbf); |
| 219 | return NULL; |
| 220 | } |
| 221 | |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 222 | ms_attach_tbf(ms, ul_tbf); |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 223 | llist_add(tbf_trx_list((struct gprs_rlcmac_tbf *)ul_tbf), &trx->ul_tbfs); |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 224 | bts_do_rate_ctr_inc(ul_tbf->bts, CTR_TBF_UL_ALLOCATED); |
Pau Espin Pedrol | 33e8007 | 2021-07-22 19:20:50 +0200 | [diff] [blame] | 225 | osmo_fsm_inst_dispatch(ul_tbf->state_fsm.fi, TBF_EV_ASSIGN_ADD_PACCH, NULL); |
Pau Espin Pedrol | 6ad11a6 | 2021-07-27 12:27:08 +0200 | [diff] [blame] | 226 | osmo_fsm_inst_dispatch(ul_tbf->ul_ass_fsm.fi, TBF_UL_ASS_EV_SCHED_ASS_REJ, NULL); |
Pau Espin Pedrol | 54742f2 | 2021-04-26 16:48:34 +0200 | [diff] [blame] | 227 | |
Pau Espin Pedrol | 442198c | 2020-10-23 22:30:04 +0200 | [diff] [blame] | 228 | return ul_tbf; |
| 229 | } |
| 230 | |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 231 | gprs_rlcmac_ul_tbf::gprs_rlcmac_ul_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms) : |
Pau Espin Pedrol | e9f77d3 | 2020-10-23 18:41:40 +0200 | [diff] [blame] | 232 | gprs_rlcmac_tbf(bts_, ms, GPRS_RLCMAC_UL_TBF), |
Pau Espin Pedrol | bddf1ad | 2019-09-26 14:41:18 +0200 | [diff] [blame] | 233 | m_rx_counter(0), |
| 234 | m_contention_resolution_done(0), |
Pau Espin Pedrol | bddf1ad | 2019-09-26 14:41:18 +0200 | [diff] [blame] | 235 | m_ul_gprs_ctrs(NULL), |
| 236 | m_ul_egprs_ctrs(NULL) |
| 237 | { |
Pau Espin Pedrol | 7bd92a3 | 2021-03-24 13:14:09 +0100 | [diff] [blame] | 238 | memset(&m_usf, USF_INVALID, sizeof(m_usf)); |
Pau Espin Pedrol | ea8dbdd | 2021-07-29 18:39:16 +0200 | [diff] [blame] | 239 | |
| 240 | memset(&ul_ack_fsm, 0, sizeof(ul_ack_fsm)); |
| 241 | ul_ack_fsm.tbf = this; |
| 242 | ul_ack_fsm.fi = osmo_fsm_inst_alloc(&tbf_ul_ack_fsm, this, &ul_ack_fsm, LOGL_INFO, NULL); |
| 243 | |
Pau Espin Pedrol | bddf1ad | 2019-09-26 14:41:18 +0200 | [diff] [blame] | 244 | } |
| 245 | |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 246 | /* |
| 247 | * Store received block data in LLC message(s) and forward to SGSN |
| 248 | * if complete. |
| 249 | */ |
| 250 | int gprs_rlcmac_ul_tbf::assemble_forward_llc(const gprs_rlc_data *_data) |
| 251 | { |
| 252 | const uint8_t *data = _data->block; |
| 253 | uint8_t len = _data->len; |
Jacob Erlbeck | f2ba4cb | 2016-01-07 18:59:28 +0100 | [diff] [blame] | 254 | const struct gprs_rlc_data_block_info *rdbi = &_data->block_info; |
Pau Espin Pedrol | 2ae8337 | 2020-05-18 11:35:35 +0200 | [diff] [blame] | 255 | enum CodingScheme cs = _data->cs_last; |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 256 | |
| 257 | Decoding::RlcData frames[16], *frame; |
| 258 | int i, num_frames = 0; |
| 259 | uint32_t dummy_tlli; |
| 260 | |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 261 | LOGPTBFUL(this, LOGL_DEBUG, "Assembling frames: (len=%d)\n", len); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 262 | |
| 263 | num_frames = Decoding::rlc_data_from_ul_data( |
Alexander Couzens | ce936f3 | 2016-05-24 14:45:41 +0200 | [diff] [blame] | 264 | rdbi, cs, data, &(frames[0]), ARRAY_SIZE(frames), |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 265 | &dummy_tlli); |
| 266 | |
| 267 | /* create LLC frames */ |
| 268 | for (i = 0; i < num_frames; i++) { |
| 269 | frame = frames + i; |
| 270 | |
Aravind Sirsikar | 22a9019 | 2016-09-15 17:24:49 +0530 | [diff] [blame] | 271 | if (frame->length) { |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 272 | bts_do_rate_ctr_add(bts, CTR_RLC_UL_PAYLOAD_BYTES, frame->length); |
Alexander Couzens | 7fdbf89 | 2016-05-21 19:45:23 +0200 | [diff] [blame] | 273 | |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 274 | LOGPTBFUL(this, LOGL_DEBUG, "Frame %d " |
Aravind Sirsikar | 22a9019 | 2016-09-15 17:24:49 +0530 | [diff] [blame] | 275 | "starts at offset %d, " |
| 276 | "length=%d, is_complete=%d\n", |
| 277 | i + 1, frame->offset, frame->length, |
| 278 | frame->is_complete); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 279 | |
Aravind Sirsikar | 22a9019 | 2016-09-15 17:24:49 +0530 | [diff] [blame] | 280 | m_llc.append_frame(data + frame->offset, frame->length); |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 281 | llc_consume(&m_llc, frame->length); |
Aravind Sirsikar | 22a9019 | 2016-09-15 17:24:49 +0530 | [diff] [blame] | 282 | } |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 283 | |
| 284 | if (frame->is_complete) { |
| 285 | /* send frame to SGSN */ |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 286 | LOGPTBFUL(this, LOGL_DEBUG, "complete UL frame len=%d\n", llc_frame_length(&m_llc)); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 287 | snd_ul_ud(); |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 288 | bts_do_rate_ctr_add(bts, CTR_LLC_UL_BYTES, llc_frame_length(&m_llc)); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 289 | m_llc.reset(); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | return 0; |
| 294 | } |
| 295 | |
Pau Espin Pedrol | 4b6f0bf | 2021-05-10 18:54:52 +0200 | [diff] [blame] | 296 | void gprs_rlcmac_ul_tbf::contention_resolution_start() |
| 297 | { |
| 298 | /* 3GPP TS 44.018 sec 11.1.2 Timers on the network side: "This timer is |
| 299 | * started when a temporary block flow is allocated with an IMMEDIATE |
| 300 | * ASSIGNMENT or an IMMEDIATE PACKET ASSIGNMENT or an EC IMMEDIATE |
| 301 | * ASSIGNMENT TYPE 1 message during a packet access procedure. It is |
| 302 | * stopped when the mobile station has correctly seized the temporary |
| 303 | * block flow." |
| 304 | * In our code base, it means we want to do contention resolution |
| 305 | * timeout only for one-phase packet access, since two-phase is handled |
| 306 | * through SBA structs, which are freed by the PDCH UL Controller if the |
| 307 | * single allocated block is lost. */ |
| 308 | T_START(this, T3141, 3141, "Contention resolution (UL-TBF, CCCH)", true); |
| 309 | } |
| 310 | void gprs_rlcmac_ul_tbf::contention_resolution_success() |
| 311 | { |
| 312 | if (m_contention_resolution_done) |
| 313 | return; |
| 314 | |
| 315 | /* 3GPP TS 44.060 sec 7a.2.1 Contention Resolution */ |
| 316 | /* 3GPP TS 44.018 3.5.2.1.4 Packet access completion: The one phase |
| 317 | packet access procedure is completed at a successful contention |
| 318 | resolution. The mobile station has entered the packet transfer mode. |
| 319 | Timer T3141 is stopped on the network side */ |
| 320 | t_stop(T3141, "Contention resolution success (UL-TBF, CCCH)"); |
| 321 | |
| 322 | /* now we must set this flag, so we are allowed to assign downlink |
| 323 | * TBF on PACCH. it is only allowed when TLLI is acknowledged. */ |
| 324 | m_contention_resolution_done = 1; |
| 325 | } |
| 326 | |
Alexander Couzens | 2fcfc29 | 2016-05-24 14:40:03 +0200 | [diff] [blame] | 327 | /*! \brief receive data from PDCH/L1 */ |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 328 | int gprs_rlcmac_ul_tbf::rcv_data_block_acknowledged( |
Jacob Erlbeck | f2ba4cb | 2016-01-07 18:59:28 +0100 | [diff] [blame] | 329 | const struct gprs_rlc_data_info *rlc, |
Jacob Erlbeck | fc1b3e6 | 2016-01-11 09:58:11 +0100 | [diff] [blame] | 330 | uint8_t *data, struct pcu_l1_meas *meas) |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 331 | { |
Pau Espin Pedrol | c33a024 | 2020-05-15 16:57:48 +0200 | [diff] [blame] | 332 | const struct gprs_rlc_data_block_info *rdbi; |
| 333 | struct gprs_rlc_data *block; |
| 334 | |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 335 | int8_t rssi = meas->have_rssi ? meas->rssi : 0; |
| 336 | |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 337 | const uint16_t ws = m_window.ws(); |
| 338 | |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 339 | LOGPTBFUL(this, LOGL_DEBUG, "UL DATA TFI=%d received (V(Q)=%d .. " |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 340 | "V(R)=%d)\n", rlc->tfi, this->m_window.v_q(), |
| 341 | this->m_window.v_r()); |
| 342 | |
| 343 | /* process RSSI */ |
| 344 | gprs_rlcmac_rssi(this, rssi); |
| 345 | |
| 346 | /* store measurement values */ |
Pau Espin Pedrol | f53815f | 2021-05-11 14:23:51 +0200 | [diff] [blame] | 347 | ms_update_l1_meas(ms(), meas); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 348 | |
Vadim Yanitskiy | cb98894 | 2020-11-08 13:27:35 +0700 | [diff] [blame] | 349 | uint32_t new_tlli = GSM_RESERVED_TMSI; |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 350 | unsigned int block_idx; |
| 351 | |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 352 | /* Increment RX-counter */ |
| 353 | this->m_rx_counter++; |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 354 | update_coding_scheme_counter_ul(rlc->cs); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 355 | /* Loop over num_blocks */ |
| 356 | for (block_idx = 0; block_idx < rlc->num_data_blocks; block_idx++) { |
| 357 | int num_chunks; |
| 358 | uint8_t *rlc_data; |
Pau Espin Pedrol | c33a024 | 2020-05-15 16:57:48 +0200 | [diff] [blame] | 359 | rdbi = &rlc->block_info[block_idx]; |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 360 | |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 361 | LOGPTBFUL(this, LOGL_DEBUG, |
| 362 | "Got %s RLC data block: CV=%d, BSN=%d, SPB=%d, PI=%d, E=%d, TI=%d, bitoffs=%d\n", |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 363 | mcs_name(rlc->cs), |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 364 | rdbi->cv, rdbi->bsn, rdbi->spb, |
| 365 | rdbi->pi, rdbi->e, rdbi->ti, |
| 366 | rlc->data_offs_bits[block_idx]); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 367 | |
| 368 | /* Check whether the block needs to be decoded */ |
| 369 | |
| 370 | if (!m_window.is_in_window(rdbi->bsn)) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 371 | LOGPTBFUL(this, LOGL_DEBUG, "BSN %d out of window %d..%d (it's normal)\n", |
| 372 | rdbi->bsn, |
| 373 | m_window.v_q(), m_window.mod_sns(m_window.v_q() + ws - 1)); |
Pau Espin Pedrol | 5891631 | 2021-05-11 14:40:41 +0200 | [diff] [blame] | 374 | continue; |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 375 | } else if (m_window.is_received(rdbi->bsn)) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 376 | LOGPTBFUL(this, LOGL_DEBUG, |
| 377 | "BSN %d already received\n", rdbi->bsn); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 378 | continue; |
Pau Espin Pedrol | 5891631 | 2021-05-11 14:40:41 +0200 | [diff] [blame] | 379 | } |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 380 | |
| 381 | /* Store block and meta info to BSN buffer */ |
| 382 | |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 383 | LOGPTBFUL(this, LOGL_DEBUG, "BSN %d storing in window (%d..%d)\n", |
| 384 | rdbi->bsn, m_window.v_q(), |
| 385 | m_window.mod_sns(m_window.v_q() + ws - 1)); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 386 | block = m_rlc.block(rdbi->bsn); |
Aravind Sirsikar | 550a541 | 2016-06-14 18:59:18 +0530 | [diff] [blame] | 387 | OSMO_ASSERT(rdbi->data_len <= sizeof(block->block)); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 388 | rlc_data = &(block->block[0]); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 389 | |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 390 | if (rdbi->spb) { |
| 391 | egprs_rlc_ul_reseg_bsn_state assemble_status; |
| 392 | |
| 393 | assemble_status = handle_egprs_ul_spb(rlc, |
| 394 | block, data, block_idx); |
| 395 | |
| 396 | if (assemble_status != EGPRS_RESEG_DEFAULT) |
| 397 | return 0; |
| 398 | } else { |
| 399 | block->block_info = *rdbi; |
| 400 | block->cs_last = rlc->cs; |
| 401 | block->len = |
| 402 | Decoding::rlc_copy_to_aligned_buffer(rlc, |
| 403 | block_idx, data, rlc_data); |
| 404 | } |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 405 | |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 406 | LOGPTBFUL(this, LOGL_DEBUG, |
| 407 | "data_length=%d, data=%s\n", |
| 408 | block->len, osmo_hexdump(rlc_data, block->len)); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 409 | /* Get/Handle TLLI */ |
| 410 | if (rdbi->ti) { |
| 411 | num_chunks = Decoding::rlc_data_from_ul_data( |
| 412 | rdbi, rlc->cs, rlc_data, NULL, 0, &new_tlli); |
| 413 | |
| 414 | if (num_chunks < 0) { |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 415 | bts_do_rate_ctr_inc(bts, CTR_DECODE_ERRORS); |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 416 | LOGPTBFUL(this, LOGL_NOTICE, |
| 417 | "Failed to decode TLLI of %s UL DATA TFI=%d.\n", |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 418 | mcs_name(rlc->cs), rlc->tfi); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 419 | m_window.invalidate_bsn(rdbi->bsn); |
| 420 | continue; |
| 421 | } |
| 422 | if (!this->is_tlli_valid()) { |
Vadim Yanitskiy | cb98894 | 2020-11-08 13:27:35 +0700 | [diff] [blame] | 423 | if (new_tlli == GSM_RESERVED_TMSI) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 424 | LOGPTBFUL(this, LOGL_NOTICE, |
Vadim Yanitskiy | cb98894 | 2020-11-08 13:27:35 +0700 | [diff] [blame] | 425 | "TLLI is 0x%08x within UL DATA?!?\n", |
| 426 | new_tlli); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 427 | m_window.invalidate_bsn(rdbi->bsn); |
| 428 | continue; |
| 429 | } |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 430 | LOGPTBFUL(this, LOGL_INFO, |
| 431 | "Decoded premier TLLI=0x%08x of UL DATA TFI=%d.\n", |
Vadim Yanitskiy | 3f27fb5 | 2020-04-20 11:26:12 +0700 | [diff] [blame] | 432 | new_tlli, rlc->tfi); |
Pau Espin Pedrol | d21e961 | 2020-06-26 14:20:37 +0200 | [diff] [blame] | 433 | update_ms(new_tlli, GPRS_RLCMAC_UL_TBF); |
Oliver Smith | d3c7591 | 2021-07-09 16:37:16 +0200 | [diff] [blame] | 434 | bts_pch_timer_stop(bts, ms_imsi(ms())); |
Vadim Yanitskiy | cb98894 | 2020-11-08 13:27:35 +0700 | [diff] [blame] | 435 | } else if (new_tlli != GSM_RESERVED_TMSI && new_tlli != tlli()) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 436 | LOGPTBFUL(this, LOGL_NOTICE, |
Pau Espin Pedrol | 305763d | 2020-11-06 20:03:24 +0100 | [diff] [blame] | 437 | "Decoded TLLI=%08x mismatch on UL DATA TFI=%d. (Ignoring due to contention resolution)\n", |
| 438 | new_tlli, rlc->tfi); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 439 | m_window.invalidate_bsn(rdbi->bsn); |
| 440 | continue; |
| 441 | } |
Pau Espin Pedrol | 5891631 | 2021-05-11 14:40:41 +0200 | [diff] [blame] | 442 | } else if (!is_tlli_valid()) { |
| 443 | LOGPTBFUL(this, LOGL_NOTICE, "Missing TLLI within UL DATA.\n"); |
| 444 | m_window.invalidate_bsn(rdbi->bsn); |
| 445 | continue; |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 446 | } |
| 447 | |
| 448 | m_window.receive_bsn(rdbi->bsn); |
| 449 | } |
| 450 | |
| 451 | /* Raise V(Q) if possible, and retrieve LLC frames from blocks. |
| 452 | * This is looped until there is a gap (non received block) or |
| 453 | * the window is empty.*/ |
| 454 | const uint16_t v_q_beg = m_window.v_q(); |
| 455 | const uint16_t count = m_window.raise_v_q(); |
| 456 | |
| 457 | /* Retrieve LLC frames from blocks that are ready */ |
| 458 | for (uint16_t i = 0; i < count; ++i) { |
Jacob Erlbeck | 93c55d0 | 2015-12-23 16:29:07 +0100 | [diff] [blame] | 459 | uint16_t index = m_window.mod_sns(v_q_beg + i); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 460 | assemble_forward_llc(m_rlc.block(index)); |
| 461 | } |
| 462 | |
Pau Espin Pedrol | c33a024 | 2020-05-15 16:57:48 +0200 | [diff] [blame] | 463 | /* Last frame in buffer: */ |
| 464 | block = m_rlc.block(m_window.mod_sns(m_window.v_r() - 1)); |
| 465 | rdbi = &block->block_info; |
| 466 | |
| 467 | /* Check if we already received all data TBF had to send: */ |
Pau Espin Pedrol | dc2aaac | 2021-05-14 12:50:46 +0200 | [diff] [blame] | 468 | if (this->state_is(TBF_ST_FLOW) /* still in flow state */ |
Pau Espin Pedrol | 9b63cd0 | 2021-05-11 14:54:40 +0200 | [diff] [blame] | 469 | && this->m_window.v_q() == this->m_window.v_r() /* if complete */ |
| 470 | && block->len) { /* if there was ever a last block received */ |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 471 | LOGPTBFUL(this, LOGL_DEBUG, |
| 472 | "No gaps in received block, last block: BSN=%d CV=%d\n", |
| 473 | rdbi->bsn, rdbi->cv); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 474 | if (rdbi->cv == 0) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 475 | LOGPTBFUL(this, LOGL_DEBUG, "Finished with UL TBF\n"); |
Pau Espin Pedrol | c32c4a3 | 2021-07-23 18:27:57 +0200 | [diff] [blame] | 476 | osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_LAST_UL_DATA_RECVD, NULL); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 477 | /* Reset N3103 counter. */ |
Max | 847ed9f | 2018-02-20 18:16:11 +0100 | [diff] [blame] | 478 | this->n_reset(N3103); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 479 | } |
| 480 | } |
| 481 | |
| 482 | /* If TLLI is included or if we received half of the window, we send |
| 483 | * an ack/nack */ |
Pau Espin Pedrol | 9b63cd0 | 2021-05-11 14:54:40 +0200 | [diff] [blame] | 484 | maybe_schedule_uplink_acknack(rlc, block->len && rdbi->cv == 0); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 485 | |
| 486 | return 0; |
| 487 | } |
| 488 | |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 489 | void gprs_rlcmac_ul_tbf::maybe_schedule_uplink_acknack( |
Pau Espin Pedrol | c33a024 | 2020-05-15 16:57:48 +0200 | [diff] [blame] | 490 | const gprs_rlc_data_info *rlc, bool countdown_finished) |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 491 | { |
Pau Espin Pedrol | 09afd6f | 2020-05-15 16:40:18 +0200 | [diff] [blame] | 492 | bool require_ack = false; |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 493 | bool have_ti = rlc->block_info[0].ti || |
| 494 | (rlc->num_data_blocks > 1 && rlc->block_info[1].ti); |
| 495 | |
Pau Espin Pedrol | 09afd6f | 2020-05-15 16:40:18 +0200 | [diff] [blame] | 496 | if (rlc->si) { |
| 497 | require_ack = true; |
| 498 | LOGPTBFUL(this, LOGL_NOTICE, |
| 499 | "Scheduling Ack/Nack, because MS is stalled.\n"); |
| 500 | } |
| 501 | if (have_ti) { |
| 502 | require_ack = true; |
| 503 | LOGPTBFUL(this, LOGL_DEBUG, |
| 504 | "Scheduling Ack/Nack, because TLLI is included.\n"); |
| 505 | } |
Pau Espin Pedrol | c33a024 | 2020-05-15 16:57:48 +0200 | [diff] [blame] | 506 | if (countdown_finished) { |
Pau Espin Pedrol | 09afd6f | 2020-05-15 16:40:18 +0200 | [diff] [blame] | 507 | require_ack = true; |
Pau Espin Pedrol | dc2aaac | 2021-05-14 12:50:46 +0200 | [diff] [blame] | 508 | if (state_is(TBF_ST_FLOW)) |
Pau Espin Pedrol | c33a024 | 2020-05-15 16:57:48 +0200 | [diff] [blame] | 509 | LOGPTBFUL(this, LOGL_DEBUG, |
| 510 | "Scheduling Ack/Nack, because some data is missing and last block has CV==0.\n"); |
Pau Espin Pedrol | dc2aaac | 2021-05-14 12:50:46 +0200 | [diff] [blame] | 511 | else if (state_is(TBF_ST_FINISHED)) |
Pau Espin Pedrol | c33a024 | 2020-05-15 16:57:48 +0200 | [diff] [blame] | 512 | LOGPTBFUL(this, LOGL_DEBUG, |
| 513 | "Scheduling final Ack/Nack, because all data was received and last block has CV==0.\n"); |
Pau Espin Pedrol | 09afd6f | 2020-05-15 16:40:18 +0200 | [diff] [blame] | 514 | } |
| 515 | if ((m_rx_counter % SEND_ACK_AFTER_FRAMES) == 0) { |
| 516 | require_ack = true; |
| 517 | LOGPTBFUL(this, LOGL_DEBUG, |
| 518 | "Scheduling Ack/Nack, because %d frames received.\n", |
| 519 | SEND_ACK_AFTER_FRAMES); |
| 520 | } |
| 521 | |
| 522 | if (!require_ack) |
| 523 | return; |
| 524 | |
Pau Espin Pedrol | ea8dbdd | 2021-07-29 18:39:16 +0200 | [diff] [blame] | 525 | osmo_fsm_inst_dispatch(this->ul_ack_fsm.fi, TBF_UL_ACK_EV_SCHED_ACK, NULL); |
Jacob Erlbeck | b3100e1 | 2015-12-14 13:36:13 +0100 | [diff] [blame] | 526 | } |
| 527 | |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 528 | /* Send Uplink unit-data to SGSN. */ |
| 529 | int gprs_rlcmac_ul_tbf::snd_ul_ud() |
| 530 | { |
| 531 | uint8_t qos_profile[3]; |
| 532 | struct msgb *llc_pdu; |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 533 | unsigned msg_len = NS_HDR_LEN + BSSGP_HDR_LEN + llc_frame_length(&m_llc); |
Pau Espin Pedrol | db5e339 | 2021-01-21 18:02:40 +0100 | [diff] [blame] | 534 | struct bssgp_bvc_ctx *bctx = bts->pcu->bssgp.bctx; |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 535 | |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 536 | LOGP(DBSSGP, LOGL_INFO, "LLC [PCU -> SGSN] %s len=%d\n", tbf_name(this), llc_frame_length(&m_llc)); |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 537 | if (!bctx) { |
| 538 | LOGP(DBSSGP, LOGL_ERROR, "No bctx\n"); |
| 539 | m_llc.reset_frame_space(); |
| 540 | return -EIO; |
| 541 | } |
Pau Espin Pedrol | 488aa29 | 2019-09-25 17:48:35 +0200 | [diff] [blame] | 542 | |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 543 | llc_pdu = msgb_alloc_headroom(msg_len, msg_len,"llc_pdu"); |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 544 | uint8_t *buf = msgb_push(llc_pdu, TL16V_GROSS_LEN(sizeof(uint8_t)*llc_frame_length(&m_llc))); |
| 545 | tl16v_put(buf, BSSGP_IE_LLC_PDU, sizeof(uint8_t)*llc_frame_length(&m_llc), m_llc.frame); |
Daniel Willmann | ca102af | 2014-08-08 12:14:12 +0200 | [diff] [blame] | 546 | qos_profile[0] = QOS_PROFILE >> 16; |
| 547 | qos_profile[1] = QOS_PROFILE >> 8; |
| 548 | qos_profile[2] = QOS_PROFILE; |
| 549 | bssgp_tx_ul_ud(bctx, tlli(), qos_profile, llc_pdu); |
| 550 | |
| 551 | m_llc.reset_frame_space(); |
| 552 | return 0; |
| 553 | } |
| 554 | |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 555 | egprs_rlc_ul_reseg_bsn_state gprs_rlcmac_ul_tbf::handle_egprs_ul_second_seg( |
| 556 | const struct gprs_rlc_data_info *rlc, struct gprs_rlc_data *block, |
| 557 | uint8_t *data, const uint8_t block_idx) |
| 558 | { |
| 559 | const gprs_rlc_data_block_info *rdbi = &rlc->block_info[block_idx]; |
| 560 | union split_block_status *spb_status = &block->spb_status; |
| 561 | uint8_t *rlc_data = &block->block[0]; |
| 562 | |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 563 | bts_do_rate_ctr_inc(bts, CTR_SPB_UL_SECOND_SEGMENT); |
sivasankari | da7250a | 2016-12-16 12:57:18 +0530 | [diff] [blame] | 564 | |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 565 | if (spb_status->block_status_ul & |
| 566 | EGPRS_RESEG_FIRST_SEG_RXD) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 567 | LOGPTBFUL(this, LOGL_DEBUG, |
| 568 | "Second seg is received first seg is already present set the status to complete\n"); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 569 | spb_status->block_status_ul = EGPRS_RESEG_DEFAULT; |
| 570 | |
| 571 | block->len += Decoding::rlc_copy_to_aligned_buffer(rlc, |
| 572 | block_idx, data, rlc_data + block->len); |
| 573 | block->block_info.data_len += rdbi->data_len; |
| 574 | } else if (spb_status->block_status_ul == EGPRS_RESEG_DEFAULT) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 575 | LOGPTBFUL(this, LOGL_DEBUG, |
| 576 | "Second seg is received first seg is not received set the status to second seg received\n"); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 577 | |
| 578 | block->len = Decoding::rlc_copy_to_aligned_buffer(rlc, |
| 579 | block_idx, data, |
| 580 | rlc_data + rlc->block_info[block_idx].data_len); |
| 581 | |
| 582 | spb_status->block_status_ul = EGPRS_RESEG_SECOND_SEG_RXD; |
| 583 | block->block_info = *rdbi; |
| 584 | } |
| 585 | return spb_status->block_status_ul; |
| 586 | } |
| 587 | |
| 588 | egprs_rlc_ul_reseg_bsn_state gprs_rlcmac_ul_tbf::handle_egprs_ul_first_seg( |
| 589 | const struct gprs_rlc_data_info *rlc, struct gprs_rlc_data *block, |
| 590 | uint8_t *data, const uint8_t block_idx) |
| 591 | { |
| 592 | const gprs_rlc_data_block_info *rdbi = &rlc->block_info[block_idx]; |
| 593 | uint8_t *rlc_data = &block->block[0]; |
| 594 | union split_block_status *spb_status = &block->spb_status; |
| 595 | |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 596 | bts_do_rate_ctr_inc(bts, CTR_SPB_UL_FIRST_SEGMENT); |
sivasankari | da7250a | 2016-12-16 12:57:18 +0530 | [diff] [blame] | 597 | |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 598 | if (spb_status->block_status_ul & EGPRS_RESEG_SECOND_SEG_RXD) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 599 | LOGPTBFUL(this, LOGL_DEBUG, |
| 600 | "First seg is received second seg is already present set the status to complete\n"); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 601 | |
| 602 | block->len += Decoding::rlc_copy_to_aligned_buffer(rlc, |
| 603 | block_idx, data, rlc_data); |
| 604 | |
| 605 | block->block_info.data_len = block->len; |
| 606 | spb_status->block_status_ul = EGPRS_RESEG_DEFAULT; |
| 607 | } else if (spb_status->block_status_ul == EGPRS_RESEG_DEFAULT) { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 608 | LOGPTBFUL(this, LOGL_DEBUG, |
| 609 | "First seg is received second seg is not received set the status to first seg received\n"); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 610 | |
| 611 | spb_status->block_status_ul = EGPRS_RESEG_FIRST_SEG_RXD; |
| 612 | block->len = Decoding::rlc_copy_to_aligned_buffer(rlc, |
| 613 | block_idx, data, rlc_data); |
| 614 | block->block_info = *rdbi; |
| 615 | } |
| 616 | return spb_status->block_status_ul; |
| 617 | } |
| 618 | |
| 619 | egprs_rlc_ul_reseg_bsn_state gprs_rlcmac_ul_tbf::handle_egprs_ul_spb( |
| 620 | const struct gprs_rlc_data_info *rlc, struct gprs_rlc_data *block, |
| 621 | uint8_t *data, const uint8_t block_idx) |
| 622 | { |
| 623 | const gprs_rlc_data_block_info *rdbi = &rlc->block_info[block_idx]; |
| 624 | |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 625 | LOGPTBFUL(this, LOGL_DEBUG, |
| 626 | "Got SPB(%d) cs(%s) data block with BSN (%d), TFI(%d).\n", |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 627 | rdbi->spb, mcs_name(rlc->cs), rdbi->bsn, rlc->tfi); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 628 | |
| 629 | egprs_rlc_ul_reseg_bsn_state assemble_status = EGPRS_RESEG_INVALID; |
| 630 | |
| 631 | /* Section 10.4.8b of 44.060*/ |
| 632 | if (rdbi->spb == 2) |
| 633 | assemble_status = handle_egprs_ul_first_seg(rlc, |
| 634 | block, data, block_idx); |
| 635 | else if (rdbi->spb == 3) |
| 636 | assemble_status = handle_egprs_ul_second_seg(rlc, |
| 637 | block, data, block_idx); |
| 638 | else { |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 639 | LOGPTBFUL(this, LOGL_ERROR, |
| 640 | "spb(%d) Not supported SPB for this EGPRS configuration\n", |
| 641 | rdbi->spb); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 642 | } |
| 643 | |
| 644 | /* |
| 645 | * When the block is successfully constructed out of segmented blocks |
| 646 | * upgrade the MCS to the type 2 |
| 647 | */ |
| 648 | if (assemble_status == EGPRS_RESEG_DEFAULT) { |
Pau Espin Pedrol | 2ae8337 | 2020-05-18 11:35:35 +0200 | [diff] [blame] | 649 | switch (rlc->cs) { |
Max | bea2edb | 2019-03-06 17:04:59 +0100 | [diff] [blame] | 650 | case MCS3 : |
| 651 | block->cs_last = MCS6; |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 652 | LOGPTBFUL(this, LOGL_DEBUG, "Upgrading to MCS6\n"); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 653 | break; |
Max | bea2edb | 2019-03-06 17:04:59 +0100 | [diff] [blame] | 654 | case MCS2 : |
| 655 | block->cs_last = MCS5; |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 656 | LOGPTBFUL(this, LOGL_DEBUG, "Upgrading to MCS5\n"); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 657 | break; |
Max | bea2edb | 2019-03-06 17:04:59 +0100 | [diff] [blame] | 658 | case MCS1 : |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 659 | LOGPTBFUL(this, LOGL_DEBUG, "Upgrading to MCS4\n"); |
Max | bea2edb | 2019-03-06 17:04:59 +0100 | [diff] [blame] | 660 | block->cs_last = MCS4; |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 661 | break; |
| 662 | default: |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 663 | LOGPTBFUL(this, LOGL_ERROR, |
| 664 | "cs(%s) Error in Upgrading to higher MCS\n", |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 665 | mcs_name(rlc->cs)); |
Aravind Sirsikar | 505a86d | 2016-07-26 18:26:21 +0530 | [diff] [blame] | 666 | break; |
| 667 | } |
| 668 | } |
| 669 | return assemble_status; |
| 670 | } |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 671 | |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 672 | void gprs_rlcmac_ul_tbf::update_coding_scheme_counter_ul(enum CodingScheme cs) |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 673 | { |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 674 | switch (cs) { |
| 675 | case CS1: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 676 | bts_do_rate_ctr_inc(bts, CTR_GPRS_UL_CS1); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 677 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_gprs_ctrs, TBF_CTR_GPRS_UL_CS1)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 678 | break; |
| 679 | case CS2: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 680 | bts_do_rate_ctr_inc(bts, CTR_GPRS_UL_CS2); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 681 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_gprs_ctrs, TBF_CTR_GPRS_UL_CS2)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 682 | break; |
| 683 | case CS3: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 684 | bts_do_rate_ctr_inc(bts, CTR_GPRS_UL_CS3); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 685 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_gprs_ctrs, TBF_CTR_GPRS_UL_CS3)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 686 | break; |
| 687 | case CS4: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 688 | bts_do_rate_ctr_inc(bts, CTR_GPRS_UL_CS4); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 689 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_gprs_ctrs, TBF_CTR_GPRS_UL_CS4)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 690 | break; |
| 691 | case MCS1: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 692 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS1); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 693 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS1)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 694 | break; |
| 695 | case MCS2: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 696 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS2); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 697 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS2)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 698 | break; |
| 699 | case MCS3: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 700 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS3); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 701 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS3)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 702 | break; |
| 703 | case MCS4: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 704 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS4); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 705 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS4)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 706 | break; |
| 707 | case MCS5: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 708 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS5); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 709 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS5)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 710 | break; |
| 711 | case MCS6: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 712 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS6); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 713 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS6)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 714 | break; |
| 715 | case MCS7: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 716 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS7); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 717 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS7)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 718 | break; |
| 719 | case MCS8: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 720 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS8); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 721 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS8)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 722 | break; |
| 723 | case MCS9: |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 724 | bts_do_rate_ctr_inc(bts, CTR_EGPRS_UL_MCS9); |
Pau Espin Pedrol | 9c1db17 | 2021-06-04 17:05:51 +0200 | [diff] [blame] | 725 | rate_ctr_inc(rate_ctr_group_get_ctr(m_ul_egprs_ctrs, TBF_CTR_EGPRS_UL_MCS9)); |
Max | fb59a93 | 2019-03-13 18:40:19 +0100 | [diff] [blame] | 726 | break; |
| 727 | default: |
| 728 | LOGPTBFUL(this, LOGL_ERROR, "attempting to update rate counters for unsupported (M)CS %s\n", |
| 729 | mcs_name(cs)); |
Mrinal Mishra | f86307e | 2016-11-10 18:16:30 +0530 | [diff] [blame] | 730 | } |
| 731 | } |
sivasankari | 8adfcd0 | 2017-01-16 15:41:21 +0530 | [diff] [blame] | 732 | |
Max | 9d7357e | 2017-12-14 15:02:33 +0100 | [diff] [blame] | 733 | void gprs_rlcmac_ul_tbf::set_window_size() |
sivasankari | 8adfcd0 | 2017-01-16 15:41:21 +0530 | [diff] [blame] | 734 | { |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 735 | const struct gprs_rlcmac_bts *b = bts; |
Max | 34513fe | 2018-12-11 16:47:30 +0100 | [diff] [blame] | 736 | uint16_t ws = egprs_window_size(b, ul_slots()); |
Max | 0524e38 | 2018-01-19 18:22:25 +0100 | [diff] [blame] | 737 | LOGPTBFUL(this, LOGL_INFO, "setting EGPRS UL window size to %u, base(%u) slots(%u) ws_pdch(%u)\n", |
Pau Espin Pedrol | 519d071 | 2021-01-14 14:30:03 +0100 | [diff] [blame] | 738 | ws, bts->pcu->vty.ws_base, pcu_bitcount(ul_slots()), bts->pcu->vty.ws_pdch); |
sivasankari | 8adfcd0 | 2017-01-16 15:41:21 +0530 | [diff] [blame] | 739 | m_window.set_ws(ws); |
| 740 | } |
Pau Espin Pedrol | 9767e44 | 2020-10-23 21:11:41 +0200 | [diff] [blame] | 741 | |
Pau Espin Pedrol | b3f2397 | 2020-10-23 21:00:23 +0200 | [diff] [blame] | 742 | gprs_rlc_window *gprs_rlcmac_ul_tbf::window() |
Pau Espin Pedrol | 9767e44 | 2020-10-23 21:11:41 +0200 | [diff] [blame] | 743 | { |
| 744 | return &m_window; |
| 745 | } |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 746 | |
Pau Espin Pedrol | 0b998b1 | 2021-03-24 14:45:43 +0100 | [diff] [blame] | 747 | void gprs_rlcmac_ul_tbf::usf_timeout() |
| 748 | { |
Pau Espin Pedrol | cfb61d9 | 2021-07-26 17:17:02 +0200 | [diff] [blame] | 749 | if (n_inc(N3101)) |
Pau Espin Pedrol | 55f600b | 2021-07-26 15:54:39 +0200 | [diff] [blame] | 750 | osmo_fsm_inst_dispatch(this->state_fsm.fi, TBF_EV_MAX_N3101, NULL); |
Pau Espin Pedrol | 0b998b1 | 2021-03-24 14:45:43 +0100 | [diff] [blame] | 751 | } |
| 752 | |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 753 | struct gprs_rlcmac_ul_tbf *as_ul_tbf(struct gprs_rlcmac_tbf *tbf) |
| 754 | { |
| 755 | if (tbf && tbf->direction == GPRS_RLCMAC_UL_TBF) |
| 756 | return static_cast<gprs_rlcmac_ul_tbf *>(tbf); |
| 757 | else |
| 758 | return NULL; |
| 759 | } |
Pau Espin Pedrol | 0b998b1 | 2021-03-24 14:45:43 +0100 | [diff] [blame] | 760 | |
| 761 | void tbf_usf_timeout(struct gprs_rlcmac_ul_tbf *tbf) |
| 762 | { |
| 763 | tbf->usf_timeout(); |
| 764 | } |
Pau Espin Pedrol | 49a2f40 | 2021-07-27 17:33:07 +0200 | [diff] [blame] | 765 | |
| 766 | |
| 767 | bool ul_tbf_contention_resolution_done(const struct gprs_rlcmac_ul_tbf *tbf) |
| 768 | { |
| 769 | return tbf->m_contention_resolution_done; |
| 770 | } |
Pau Espin Pedrol | ea8dbdd | 2021-07-29 18:39:16 +0200 | [diff] [blame] | 771 | |
| 772 | struct osmo_fsm_inst *tbf_ul_ack_fi(const struct gprs_rlcmac_ul_tbf *tbf) |
| 773 | { |
| 774 | return tbf->ul_ack_fsm.fi; |
| 775 | } |
| 776 | |
| 777 | void ul_tbf_contention_resolution_success(struct gprs_rlcmac_ul_tbf *tbf) |
| 778 | { |
| 779 | return tbf->contention_resolution_success(); |
| 780 | } |