blob: 7fa5a2ec598770e7ffb73241f6632f16bc356cbc [file] [log] [blame]
Pau Espin Pedrolac3fd122021-01-13 18:54:38 +01001/*
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
23#include <osmocom/core/utils.h>
24
25#include "gprs_pcu.h"
26#include "bts.h"
27
28struct gprs_pcu *the_pcu;
29
30struct gprs_pcu *gprs_pcu_alloc(void *ctx)
31{
32 struct gprs_pcu *pcu;
33
34 pcu = (struct gprs_pcu *)talloc_zero(ctx, struct gprs_pcu);
35 OSMO_ASSERT(pcu);
36
37 pcu->vty.max_cs_ul = MAX_GPRS_CS;
38 pcu->vty.max_cs_dl = MAX_GPRS_CS;
39 pcu->vty.max_mcs_ul = MAX_EDGE_MCS;
40 pcu->vty.max_mcs_dl = MAX_EDGE_MCS;
41
42 return pcu;
43}
44
45
46void gprs_pcu_set_max_cs(struct gprs_pcu *pcu, uint8_t cs_dl, uint8_t cs_ul)
47{
48 the_pcu->vty.max_cs_dl = cs_dl;
49 the_pcu->vty.max_cs_ul = cs_ul;
50 /*TODO: once we support multiple bts, foreach(bts) apply */
51 struct gprs_rlcmac_bts *bts = bts_data(pcu->bts);
52 bts_recalc_max_cs(bts);
53}
54void gprs_pcu_set_max_mcs(struct gprs_pcu *pcu, uint8_t mcs_dl, uint8_t mcs_ul)
55{
56 the_pcu->vty.max_mcs_dl = mcs_dl;
57 the_pcu->vty.max_mcs_ul = mcs_ul;
58 /* TODO: once we support multiple bts, foreach(bts) apply */
59 struct gprs_rlcmac_bts *bts = bts_data(pcu->bts);
60 bts_recalc_max_mcs(bts);
61}