Pau Espin Pedrol | ff7c581 | 2022-12-14 18:49:06 +0100 | [diff] [blame] | 1 | /* alloc_algo.h |
| 2 | * |
Vadim Yanitskiy | 5fd0022 | 2023-05-18 17:22:26 +0700 | [diff] [blame] | 3 | * Copyright (C) 2022 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> |
Pau Espin Pedrol | ff7c581 | 2022-12-14 18:49:06 +0100 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #pragma once |
| 17 | |
| 18 | #include <stdbool.h> |
| 19 | #include <stdint.h> |
| 20 | |
Pau Espin Pedrol | a6a972e | 2023-04-20 19:23:50 +0200 | [diff] [blame] | 21 | #include "tbf.h" |
| 22 | |
Pau Espin Pedrol | ff7c581 | 2022-12-14 18:49:06 +0100 | [diff] [blame] | 23 | struct gprs_rlcmac_bts; |
Pau Espin Pedrol | a6a972e | 2023-04-20 19:23:50 +0200 | [diff] [blame] | 24 | struct GprsMs; |
Pau Espin Pedrol | ff7c581 | 2022-12-14 18:49:06 +0100 | [diff] [blame] | 25 | struct gprs_rlcmac_tbf; |
| 26 | |
| 27 | #ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | |
Pau Espin Pedrol | a6a972e | 2023-04-20 19:23:50 +0200 | [diff] [blame] | 31 | struct alloc_resources_req { |
| 32 | /* BTS where to allocate resources */ |
| 33 | struct gprs_rlcmac_bts *bts; |
| 34 | /* MS for which to allocate resources */ |
Pau Espin Pedrol | d6c555e | 2023-04-20 20:10:53 +0200 | [diff] [blame] | 35 | const struct GprsMs *ms; |
Pau Espin Pedrol | a6a972e | 2023-04-20 19:23:50 +0200 | [diff] [blame] | 36 | /* Direction of the TBF for which we are allocating resources */ |
| 37 | enum gprs_rlcmac_tbf_direction direction; |
| 38 | /* Whether to allocate only a single (1) TS */ |
| 39 | bool single; |
| 40 | /* Whether to allocate on a specific TRX (>=0) or not (-1) */ |
| 41 | int8_t use_trx; |
Pau Espin Pedrol | a6a972e | 2023-04-20 19:23:50 +0200 | [diff] [blame] | 42 | }; |
Pau Espin Pedrol | ff7c581 | 2022-12-14 18:49:06 +0100 | [diff] [blame] | 43 | |
Pau Espin Pedrol | d6c555e | 2023-04-20 20:10:53 +0200 | [diff] [blame] | 44 | struct alloc_resources_res { |
| 45 | struct gprs_rlcmac_trx *trx; |
| 46 | struct gprs_rlcmac_pdch *first_common_ts; |
| 47 | uint8_t reserved_ul_slots; |
| 48 | uint8_t reserved_dl_slots; |
| 49 | uint8_t ass_slots_mask; |
| 50 | bool upgrade_to_multislot; |
| 51 | uint8_t tfi; |
| 52 | int usf[8]; |
| 53 | }; |
Pau Espin Pedrol | ff7c581 | 2022-12-14 18:49:06 +0100 | [diff] [blame] | 54 | |
Pau Espin Pedrol | d6c555e | 2023-04-20 20:10:53 +0200 | [diff] [blame] | 55 | int alloc_algorithm_a(const struct alloc_resources_req *req, |
| 56 | struct alloc_resources_res *res); |
Pau Espin Pedrol | a6a972e | 2023-04-20 19:23:50 +0200 | [diff] [blame] | 57 | |
Pau Espin Pedrol | d6c555e | 2023-04-20 20:10:53 +0200 | [diff] [blame] | 58 | int alloc_algorithm_b(const struct alloc_resources_req *req, |
| 59 | struct alloc_resources_res *res); |
| 60 | |
| 61 | int alloc_algorithm_dynamic(const struct alloc_resources_req *req, |
| 62 | struct alloc_resources_res *res); |
Pau Espin Pedrol | ff7c581 | 2022-12-14 18:49:06 +0100 | [diff] [blame] | 63 | int gprs_alloc_max_dl_slots_per_ms(const struct gprs_rlcmac_bts *bts, uint8_t ms_class); |
| 64 | |
| 65 | #ifdef __cplusplus |
| 66 | } |
| 67 | #endif |