pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/30608 )
Change subject: Rename gprs_rlcmac_ts_allc.cpp -> s_alloc_algo.cpp & create own .h file ......................................................................
Rename gprs_rlcmac_ts_allc.cpp -> s_alloc_algo.cpp & create own .h file
First commit towards trying to have alloc algorithm as isolated as possible from others parts of the code trying to avoid state changes on data structures.
Change-Id: I33a6c178c64a769f05d3880a69c38acb154afa62 --- M debian/copyright M src/Makefile.am M src/gprs_bssgp_pcu.c M src/gprs_rlcmac.h M src/pcu_main.cpp M src/pcu_vty.c R src/ts_alloc_algo.cpp A src/ts_alloc_algo.h M tests/alloc/AllocTest.cpp M tests/app_info/AppInfoTest.cpp M tests/edge/EdgeTest.cpp M tests/emu/pcu_emu.cpp M tests/tbf/TbfTest.cpp M tests/types/TypesTest.cpp 14 files changed, 58 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/08/30608/1
diff --git a/debian/copyright b/debian/copyright index c714f1f..31b06fa 100644 --- a/debian/copyright +++ b/debian/copyright @@ -46,7 +46,7 @@ src/encoding.cpp src/encoding.h src/gprs_rlcmac.cpp - src/gprs_rlcmac_ts_alloc.cpp + src/ts_alloc.cpp Copyright: 2012 Ivan Klyuchnikov 2012 Andreas Eversberg jolly@eversberg.eu 2013 by Holger Hans Peter Freyther @@ -56,9 +56,11 @@ Files: src/gprs_rlcmac.h src/gprs_bssgp_pcu.cpp src/gprs_bssgp_pcu.h + src/ts_alloc.h src/bts.h Copyright: 2012 Ivan Klyuchnikov 2013 by Holger Hans Peter Freyther + 2022 by by Sysmocom s.f.m.c. GmbH License: GPL-2.0+
Files: src/rlc.h diff --git a/src/Makefile.am b/src/Makefile.am index e7e94e0..301337b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,7 +49,7 @@ gprs_rlcmac.cpp \ gprs_rlcmac_sched.cpp \ gprs_rlcmac_meas.cpp \ - gprs_rlcmac_ts_alloc.cpp \ + ts_alloc_algo.cpp \ gprs_ms.c \ gprs_ms_storage.cpp \ gprs_pcu.c \ @@ -111,6 +111,7 @@ tbf_ul_ass_fsm.h \ tbf_dl.h \ tbf_dl_ass_fsm.h \ + ts_alloc_algo.h \ bts.h \ bts_pch_timer.h \ pdch.h \ diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c index 8fd6d85..06ac3b0 100644 --- a/src/gprs_bssgp_pcu.c +++ b/src/gprs_bssgp_pcu.c @@ -36,6 +36,7 @@ #include "llc.h" #include "gprs_rlcmac.h" #include "bts_pch_timer.h" +#include "ts_alloc_algo.h"
/* Tuning parameters for BSSGP flow control */ #define FC_DEFAULT_LIFE_TIME_SECS 10 /* experimental value, 10s */ diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index 468712e..22a33b4 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -100,17 +100,7 @@
extern "C" { #endif -int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, - int8_t use_trx); - -int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, - int8_t use_trx); - -int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, - int8_t use_trx); - int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, uint16_t pgroup); -int gprs_alloc_max_dl_slots_per_ms(const struct gprs_rlcmac_bts *bts, uint8_t ms_class); #ifdef __cplusplus } #endif diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp index 86b5398..3cf4c12 100644 --- a/src/pcu_main.cpp +++ b/src/pcu_main.cpp @@ -28,6 +28,7 @@ #include <bts.h> #include <osmocom/pcu/pcuif_proto.h> #include "gprs_bssgp_pcu.h" +#include "ts_alloc_algo.h"
extern "C" { #include "pcu_vty.h" diff --git a/src/pcu_vty.c b/src/pcu_vty.c index 244a58a..97311e5 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -23,6 +23,7 @@ #include "bts.h" #include "tbf.h" #include "pcu_vty_functions.h" +#include "ts_alloc_algo.h"
#define X(x) (1 << x)
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/ts_alloc_algo.cpp similarity index 99% rename from src/gprs_rlcmac_ts_alloc.cpp rename to src/ts_alloc_algo.cpp index 704b696..f02b325 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/ts_alloc_algo.cpp @@ -1,8 +1,9 @@ -/* gprs_rlcmac.cpp +/* ts_alloc_algo.cpp * * Copyright (C) 2012 Ivan Klyuchnikov * Copyright (C) 2012 Andreas Eversberg jolly@eversberg.eu * Copyright (C) 2013 by Holger Hans Peter Freyther + * Copyright (C) 2022 by sysmocom - s.m.f.c. GmbH info@sysmocom.de * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -29,6 +30,7 @@
extern "C" { #include "mslot_class.h" +#include "ts_alloc_algo.h" #include <osmocom/core/linuxlist.h> #include <osmocom/core/logging.h> #include <osmocom/core/utils.h> diff --git a/src/ts_alloc_algo.h b/src/ts_alloc_algo.h new file mode 100644 index 0000000..adcf53f --- /dev/null +++ b/src/ts_alloc_algo.h @@ -0,0 +1,40 @@ +/* ts_alloc_algo.h + * + * Copyright (C) 2022 by sysmocom - s.m.f.c. GmbH info@sysmocom.de + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#pragma once + +#include <stdbool.h> +#include <stdint.h> + +struct gprs_rlcmac_bts; +struct gprs_rlcmac_tbf; + +#ifdef __cplusplus +extern "C" { +#endif + +int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, + int8_t use_trx); + +int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, + int8_t use_trx); + +int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, + int8_t use_trx); +int gprs_alloc_max_dl_slots_per_ms(const struct gprs_rlcmac_bts *bts, uint8_t ms_class); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 4b4fbd5..788aa21 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -27,6 +27,7 @@
extern "C" { #include "mslot_class.h" +#include "ts_alloc_algo.h" #include <osmocom/core/application.h> #include <osmocom/core/msgb.h> #include <osmocom/core/talloc.h> diff --git a/tests/app_info/AppInfoTest.cpp b/tests/app_info/AppInfoTest.cpp index 6806f20..5f7e9e0 100644 --- a/tests/app_info/AppInfoTest.cpp +++ b/tests/app_info/AppInfoTest.cpp @@ -24,6 +24,8 @@ #include <osmocom/core/utils.h> #include <osmocom/core/msgb.h> #include <osmocom/core/application.h> + +#include "ts_alloc_algo.h" }
using namespace std; diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp index 02a3568..53efe03 100644 --- a/tests/edge/EdgeTest.cpp +++ b/tests/edge/EdgeTest.cpp @@ -31,6 +31,7 @@ extern "C" { #include "pcu_vty.h" #include "coding_scheme.h" +#include "ts_alloc_algo.h"
#include <osmocom/core/application.h> #include <osmocom/core/msgb.h> diff --git a/tests/emu/pcu_emu.cpp b/tests/emu/pcu_emu.cpp index 7c9baa9..1ab356a 100644 --- a/tests/emu/pcu_emu.cpp +++ b/tests/emu/pcu_emu.cpp @@ -22,6 +22,7 @@ extern "C" { #include <osmocom/core/talloc.h> #include <pcu_vty.h> +#include <ts_alloc_algo.h> }
#include "gprs_tests.h" diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 80dfc2f..0661f20 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -36,6 +36,7 @@ extern "C" { #include "pcu_vty.h" #include "coding_scheme.h" +#include "ts_alloc_algo.h"
#include <osmocom/core/application.h> #include <osmocom/core/msgb.h> diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp index 1e714e1..50b06eb 100644 --- a/tests/types/TypesTest.cpp +++ b/tests/types/TypesTest.cpp @@ -30,6 +30,7 @@ #include "decoding.h" #include "gprs_rlcmac.h" #include "egprs_rlc_compression.h" +#include "ts_alloc_algo.h"
extern "C" { #include <osmocom/core/application.h>