Rename gprs_rlcmac_ts_alloc.cpp -> 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 name also because the alloc_algo not only allocated TS, but TFIs
and USFs.

Change-Id: I33a6c178c64a769f05d3880a69c38acb154afa62
This commit is contained in:
Pau Espin 2022-12-14 18:49:06 +01:00
parent 9935d0d21d
commit ff7c581011
14 changed files with 58 additions and 13 deletions

4
debian/copyright vendored
View File

@ -46,7 +46,7 @@ Files: src/tbf.cpp
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 @@ License: GPL-2.0+
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

View File

@ -39,6 +39,7 @@ AM_LDFLAGS = -lrt
noinst_LTLIBRARIES = libgprs.la
libgprs_la_SOURCES = \
alloc_algo.cpp \
gprs_debug.c \
csn1.c \
csn1_dec.c \
@ -49,7 +50,6 @@ libgprs_la_SOURCES = \
gprs_rlcmac.cpp \
gprs_rlcmac_sched.cpp \
gprs_rlcmac_meas.cpp \
gprs_rlcmac_ts_alloc.cpp \
gprs_ms.c \
gprs_ms_storage.cpp \
gprs_pcu.c \
@ -89,6 +89,7 @@ bin_PROGRAMS = \
noinst_PROGRAMS =
noinst_HEADERS = \
alloc_algo.h \
gprs_debug.h \
csn1.h \
gsm_rlcmac.h \

View File

@ -1,8 +1,9 @@
/* gprs_rlcmac.cpp
/* 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 "alloc_algo.h"
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>

40
src/alloc_algo.h Normal file
View File

@ -0,0 +1,40 @@
/* 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

View File

@ -36,6 +36,7 @@
#include "llc.h"
#include "gprs_rlcmac.h"
#include "bts_pch_timer.h"
#include "alloc_algo.h"
/* Tuning parameters for BSSGP flow control */
#define FC_DEFAULT_LIFE_TIME_SECS 10 /* experimental value, 10s */

View File

@ -100,17 +100,7 @@ int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts,
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

View File

@ -28,6 +28,7 @@
#include <bts.h>
#include <osmocom/pcu/pcuif_proto.h>
#include "gprs_bssgp_pcu.h"
#include "alloc_algo.h"
extern "C" {
#include "pcu_vty.h"

View File

@ -23,6 +23,7 @@
#include "bts.h"
#include "tbf.h"
#include "pcu_vty_functions.h"
#include "alloc_algo.h"
#define X(x) (1 << x)

View File

@ -27,6 +27,7 @@
extern "C" {
#include "mslot_class.h"
#include "alloc_algo.h"
#include <osmocom/core/application.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>

View File

@ -24,6 +24,8 @@ extern "C" {
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/application.h>
#include "alloc_algo.h"
}
using namespace std;

View File

@ -31,6 +31,7 @@
extern "C" {
#include "pcu_vty.h"
#include "coding_scheme.h"
#include "alloc_algo.h"
#include <osmocom/core/application.h>
#include <osmocom/core/msgb.h>

View File

@ -22,6 +22,7 @@
extern "C" {
#include <osmocom/core/talloc.h>
#include <pcu_vty.h>
#include <alloc_algo.h>
}
#include "gprs_tests.h"

View File

@ -36,6 +36,7 @@
extern "C" {
#include "pcu_vty.h"
#include "coding_scheme.h"
#include "alloc_algo.h"
#include <osmocom/core/application.h>
#include <osmocom/core/msgb.h>

View File

@ -30,6 +30,7 @@
#include "decoding.h"
#include "gprs_rlcmac.h"
#include "egprs_rlc_compression.h"
#include "alloc_algo.h"
extern "C" {
#include <osmocom/core/application.h>