blob: f55f278360d09e4bce5043ac507cb5bd78f9c2a8 [file] [log] [blame]
Pau Espin Pedrolff7c5812022-12-14 18:49:06 +01001/* alloc_algo.h
2 *
3 * Copyright (C) 2022 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
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 Pedrola6a972e2023-04-20 19:23:50 +020021#include "tbf.h"
22
Pau Espin Pedrolff7c5812022-12-14 18:49:06 +010023struct gprs_rlcmac_bts;
Pau Espin Pedrola6a972e2023-04-20 19:23:50 +020024struct GprsMs;
Pau Espin Pedrolff7c5812022-12-14 18:49:06 +010025struct gprs_rlcmac_tbf;
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
Pau Espin Pedrola6a972e2023-04-20 19:23:50 +020031struct alloc_resources_req {
32 /* BTS where to allocate resources */
33 struct gprs_rlcmac_bts *bts;
34 /* MS for which to allocate resources */
35 struct GprsMs *ms;
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;
42 /* FIXME: this will be removed in the future, tbf struct will be filled
43 * in by caller of alloc_algorithm(). */
44 struct gprs_rlcmac_tbf *tbf;
45};
Pau Espin Pedrolff7c5812022-12-14 18:49:06 +010046
Pau Espin Pedrola6a972e2023-04-20 19:23:50 +020047int alloc_algorithm_a(const struct alloc_resources_req *req);
Pau Espin Pedrolff7c5812022-12-14 18:49:06 +010048
Pau Espin Pedrola6a972e2023-04-20 19:23:50 +020049int alloc_algorithm_b(const struct alloc_resources_req *req);
50
51int alloc_algorithm_dynamic(const struct alloc_resources_req *req);
Pau Espin Pedrolff7c5812022-12-14 18:49:06 +010052int gprs_alloc_max_dl_slots_per_ms(const struct gprs_rlcmac_bts *bts, uint8_t ms_class);
53
54#ifdef __cplusplus
55}
56#endif