blob: 22a33b4aa6fa1c42e222003924042cb38d554430 [file] [log] [blame]
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +04001/* gprs_rlcmac.h
2 *
3 * Copyright (C) 2012 Ivan Klyuchnikov
Holger Hans Peter Freytherd6bd91e2013-08-24 21:16:55 +02004 * Copyright (C) 2013 by Holger Hans Peter Freyther
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +04005 *
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 Kluchnikov8ee60512012-03-05 19:24:57 +040015 */
Pau Espin Pedrol585cfb22019-12-10 17:09:51 +010016
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040017#ifndef GPRS_RLCMAC_H
18#define GPRS_RLCMAC_H
19
Maxe9fe0e32017-09-28 15:56:05 +020020#include <stdbool.h>
Pau Espin Pedrol8a35e642021-01-18 17:14:14 +010021#include <stdint.h>
Maxe9fe0e32017-09-28 15:56:05 +020022
Pau Espin Pedrold7c32652019-12-23 12:41:34 +010023#include <pcu_l1_if.h>
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040024
Pau Espin Pedrol8a35e642021-01-18 17:14:14 +010025#ifdef __cplusplus
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040026extern "C" {
Pau Espin Pedrol8a35e642021-01-18 17:14:14 +010027#endif
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040028#include <osmocom/core/linuxlist.h>
Ivan Kluchnikov61a33f72012-04-12 15:22:06 +040029#include <osmocom/core/timer.h>
Alexander Couzensccde5c92017-02-04 03:10:08 +010030#include <osmocom/core/bitvec.h>
Pau Espin Pedrol8a35e642021-01-18 17:14:14 +010031#include <osmocom/gsm/gsm48.h>
Oliver Smithcfb63212019-09-05 17:13:33 +020032#include <osmocom/pcu/pcuif_proto.h>
Pau Espin Pedrolb2653fe2020-03-26 15:14:01 +010033#include "gsm_rlcmac.h"
Pau Espin Pedrol8a35e642021-01-18 17:14:14 +010034#ifdef __cplusplus
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040035}
Andreas Eversberg8b761a32012-07-20 21:50:31 +020036#endif
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040037
Andreas Eversberge6228b32012-07-03 13:36:03 +020038/* 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 Kluchnikovc5d8c272012-06-04 21:55:02 +040043
Max7426c5f2019-02-18 20:42:42 +010044#define DUMMY_VEC "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"
Andreas Eversberg5dac2f02012-06-27 15:52:04 +020045
46struct gprs_rlcmac_tbf;
Holger Hans Peter Freytherb6acfda2013-10-17 19:41:11 +020047struct gprs_rlcmac_bts;
Jacob Erlbecke2e004e2015-06-18 17:16:26 +020048struct GprsMs;
Andreas Eversberg5dac2f02012-06-27 15:52:04 +020049
Andreas Eversberg8b761a32012-07-20 21:50:31 +020050#ifdef __cplusplus
Andreas Eversberg5dac2f02012-06-27 15:52:04 +020051/*
Andreas Eversberg2b914642012-07-19 13:06:26 +020052 * paging entry
53 */
54struct gprs_rlcmac_paging {
55 struct llist_head list;
56 uint8_t chan_needed;
57 uint8_t identity_lv[9];
58};
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040059
Andreas Eversberg07e97cf2012-08-07 16:00:56 +020060/*
Andreas Eversberg3b1332c2012-10-03 14:20:53 +020061 * coding scheme info
62 */
63struct gprs_rlcmac_cs {
64 uint8_t block_length;
65 uint8_t block_data;
66 uint8_t block_payload;
67};
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040068
Max46fbfce2017-11-01 19:22:25 +010069/* TS allocation internal functions */
70int find_multi_slots(struct gprs_rlcmac_trx *trx, uint8_t mslot_class, uint8_t *ul_slots, uint8_t *dl_slots);
71
Daniel Willmann418a4232014-08-08 11:21:04 +020072int gprs_rlcmac_received_lost(struct gprs_rlcmac_dl_tbf *tbf, uint16_t received,
Andreas Eversberg050ace22013-03-16 16:22:02 +010073 uint16_t lost);
74
Daniel Willmann418a4232014-08-08 11:21:04 +020075int gprs_rlcmac_lost_rep(struct gprs_rlcmac_dl_tbf *tbf);
Andreas Eversberg050ace22013-03-16 16:22:02 +010076
Pau Espin Pedrolb69928c2020-08-18 20:29:40 +020077int gprs_rlcmac_meas_rep(GprsMs *ms, Packet_Measurement_Report_t *pmr);
Andreas Eversberg050ace22013-03-16 16:22:02 +010078
79int gprs_rlcmac_rssi(struct gprs_rlcmac_tbf *tbf, int8_t rssi);
80
81int gprs_rlcmac_rssi_rep(struct gprs_rlcmac_tbf *tbf);
82
Daniel Willmann418a4232014-08-08 11:21:04 +020083int gprs_rlcmac_dl_bw(struct gprs_rlcmac_dl_tbf *tbf, uint16_t octets);
Andreas Eversberg050ace22013-03-16 16:22:02 +010084
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040085/* TS 44.060 Section 10.4.7 Table 10.4.7.1: Payload Type field */
86enum gprs_rlcmac_block_type {
87 GPRS_RLCMAC_DATA_BLOCK = 0x0,
Pau Espin Pedrol585cfb22019-12-10 17:09:51 +010088 GPRS_RLCMAC_CONTROL_BLOCK = 0x1,
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040089 GPRS_RLCMAC_CONTROL_BLOCK_OPT = 0x2,
90 GPRS_RLCMAC_RESERVED = 0x3
91};
92
Andreas Eversberg3e372d52012-07-06 09:28:15 +020093int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf);
Ivan Kluchnikova9e6dc52012-06-17 08:30:06 +040094
Oliver Smithcfb63212019-09-05 17:13:33 +020095struct msgb *gprs_rlcmac_app_info_msg(const struct gsm_pcu_if_app_info_req *req);
96
Holger Hans Peter Freytherb19d7262013-10-17 18:12:18 +020097int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts,
Max878bd1f2016-07-20 13:05:05 +020098 uint8_t trx, uint8_t ts,
Andreas Eversberge6228b32012-07-03 13:36:03 +020099 uint32_t fn, uint8_t block_nr);
100
Andreas Eversberga1503fa2012-07-22 08:58:09 +0200101extern "C" {
102#endif
Pau Espin Pedrold1049dc2021-01-18 17:14:14 +0100103int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, uint16_t pgroup);
Andreas Eversberga1503fa2012-07-22 08:58:09 +0200104#ifdef __cplusplus
105}
Andreas Eversberg8b761a32012-07-20 21:50:31 +0200106#endif
Andreas Eversberg2b914642012-07-19 13:06:26 +0200107
Pau Espin Pedrol8a35e642021-01-18 17:14:14 +0100108
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +0400109#endif // GPRS_RLCMAC_H