Pau Espin Pedrol | ac3fd12 | 2021-01-13 18:54:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 by Holger Hans Peter Freyther |
| 3 | * Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> |
| 4 | * Author: Pau Espin Pedrol <pespin@sysmocom.de> |
| 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU Affero General Public License as published by |
| 10 | * the Free Software Foundation; either version 3 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Affero General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | * |
| 21 | */ |
| 22 | #pragma once |
| 23 | |
| 24 | #include <stdint.h> |
| 25 | #include <stdbool.h> |
| 26 | |
| 27 | #include <osmocom/core/gsmtap_util.h> |
| 28 | |
| 29 | #include "gprs_bssgp_pcu.h" |
Pau Espin Pedrol | 97296b2 | 2021-01-14 13:08:02 +0100 | [diff] [blame^] | 30 | #include "coding_scheme.h" |
Pau Espin Pedrol | ac3fd12 | 2021-01-13 18:54:38 +0100 | [diff] [blame] | 31 | |
| 32 | #define LLC_CODEL_DISABLE 0 |
| 33 | #define LLC_CODEL_USE_DEFAULT (-1) |
| 34 | |
| 35 | #define MAX_EDGE_MCS 9 |
| 36 | #define MAX_GPRS_CS 4 |
| 37 | |
| 38 | /* see bts->gsmtap_categ_mask */ |
| 39 | enum pcu_gsmtap_category { |
| 40 | PCU_GSMTAP_C_DL_UNKNOWN = 0, /* unknown or undecodable downlink blocks */ |
| 41 | PCU_GSMTAP_C_DL_DUMMY = 1, /* downlink dummy blocks */ |
| 42 | PCU_GSMTAP_C_DL_CTRL = 2, /* downlink control blocks */ |
| 43 | PCU_GSMTAP_C_DL_DATA_GPRS = 3, /* downlink GPRS data blocks */ |
| 44 | PCU_GSMTAP_C_DL_DATA_EGPRS = 4, /* downlink EGPRS data blocks */ |
| 45 | PCU_GSMTAP_C_DL_PTCCH = 5, /* downlink PTCCH blocks */ |
| 46 | PCU_GSMTAP_C_DL_AGCH = 6, /* downlink AGCH blocks */ |
| 47 | PCU_GSMTAP_C_DL_PCH = 7, /* downlink PCH blocks */ |
| 48 | |
| 49 | PCU_GSMTAP_C_UL_UNKNOWN = 15, /* unknown or undecodable uplink blocks */ |
| 50 | PCU_GSMTAP_C_UL_DUMMY = 16, /* uplink dummy blocks */ |
| 51 | PCU_GSMTAP_C_UL_CTRL = 17, /* uplink control blocks */ |
| 52 | PCU_GSMTAP_C_UL_DATA_GPRS = 18, /* uplink GPRS data blocks */ |
| 53 | PCU_GSMTAP_C_UL_DATA_EGPRS = 19, /* uplink EGPRS data blocks */ |
| 54 | PCU_GSMTAP_C_UL_RACH = 20, /* uplink RACH bursts */ |
| 55 | PCU_GSMTAP_C_UL_PTCCH = 21, /* uplink PTCCH bursts */ |
| 56 | }; |
| 57 | |
| 58 | struct BTS; |
| 59 | struct gprs_rlcmac_bts; |
| 60 | struct GprsMs; |
| 61 | struct gprs_rlcmac_tbf; |
| 62 | |
| 63 | typedef int (*alloc_algorithm_func_t)(struct gprs_rlcmac_bts *bts, |
| 64 | struct GprsMs *ms, |
| 65 | struct gprs_rlcmac_tbf *tbf, |
| 66 | bool single, int8_t use_tbf); |
| 67 | |
| 68 | struct gprs_pcu { |
| 69 | |
| 70 | /* Path to be used for the pcu-bts socket */ |
| 71 | char *pcu_sock_path; |
| 72 | |
| 73 | struct { /* Config Values set by VTY */ |
| 74 | bool force_initial_cs; /* false=use from BTS true=use from VTY */ |
| 75 | bool force_initial_mcs; /* false=use from BTS true=use from VTY */ |
| 76 | uint8_t max_cs_dl, max_cs_ul; |
| 77 | uint8_t max_mcs_dl, max_mcs_ul; |
Pau Espin Pedrol | 03de898 | 2021-01-14 12:48:50 +0100 | [diff] [blame] | 78 | uint8_t force_two_phase; |
Pau Espin Pedrol | a281495 | 2021-01-14 12:53:53 +0100 | [diff] [blame] | 79 | uint8_t alpha, gamma; |
Pau Espin Pedrol | 05f9f59 | 2021-01-14 12:56:58 +0100 | [diff] [blame] | 80 | bool dl_tbf_preemptive_retransmission; |
Pau Espin Pedrol | 97296b2 | 2021-01-14 13:08:02 +0100 | [diff] [blame^] | 81 | enum egprs_arq_type dl_arq_type; /* EGPRS_ARQ1 to support resegmentation in DL, EGPRS_ARQ2 for no reseg */ |
Pau Espin Pedrol | ac3fd12 | 2021-01-13 18:54:38 +0100 | [diff] [blame] | 82 | } vty; |
| 83 | |
| 84 | struct gsmtap_inst *gsmtap; |
| 85 | uint32_t gsmtap_categ_mask; |
| 86 | |
| 87 | struct BTS *bts; |
| 88 | |
| 89 | struct gprs_ns2_inst *nsi; |
| 90 | |
| 91 | alloc_algorithm_func_t alloc_algorithm; |
| 92 | |
| 93 | struct gprs_bssgp_pcu bssgp; |
Pau Espin Pedrol | 924aaad | 2021-01-14 12:01:42 +0100 | [diff] [blame] | 94 | |
| 95 | struct osmo_tdef *T_defs; /* timers controlled by PCU */ |
Pau Espin Pedrol | ac3fd12 | 2021-01-13 18:54:38 +0100 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | |
| 99 | extern struct gprs_pcu *the_pcu; |
| 100 | |
| 101 | struct gprs_pcu *gprs_pcu_alloc(void *ctx); |
| 102 | |
| 103 | void gprs_pcu_set_max_cs(struct gprs_pcu *pcu, uint8_t cs_dl, uint8_t cs_ul); |
| 104 | void gprs_pcu_set_max_mcs(struct gprs_pcu *pcu, uint8_t mcs_dl, uint8_t mcs_ul); |