diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-01-13 18:54:38 +0100 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2021-01-18 10:37:05 +0000 |
commit | ac3fd120268a38fb4794982823c6abc8e964cfe8 (patch) | |
tree | bc88fdd84f73ace721b35db63efac5935848a952 /tests/alloc/MslotTest.cpp | |
parent | 695ce771676732045ac89ac03b43ba071befeafb (diff) |
Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.
This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.
This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.
The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.
Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
Diffstat (limited to 'tests/alloc/MslotTest.cpp')
-rw-r--r-- | tests/alloc/MslotTest.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/alloc/MslotTest.cpp b/tests/alloc/MslotTest.cpp index 8910e52a..e3546410 100644 --- a/tests/alloc/MslotTest.cpp +++ b/tests/alloc/MslotTest.cpp @@ -62,7 +62,7 @@ static inline void test_all_classes(struct gprs_rlcmac_trx *trx, bool clear_mask static inline void test_multislot_total_ascending(bool seq) { - BTS the_bts; + BTS the_bts(the_pcu); struct gprs_rlcmac_bts *bts; struct gprs_rlcmac_trx *trx; int i; @@ -83,7 +83,7 @@ static inline void test_multislot_total_ascending(bool seq) static inline void test_multislot_total_descending(bool seq) { - BTS the_bts; + BTS the_bts(the_pcu); struct gprs_rlcmac_bts *bts; struct gprs_rlcmac_trx *trx; int i; @@ -104,7 +104,7 @@ static inline void test_multislot_total_descending(bool seq) static inline void test_multislot_middle(bool seq) { - BTS the_bts; + BTS the_bts(the_pcu); struct gprs_rlcmac_bts *bts; struct gprs_rlcmac_trx *trx; @@ -123,7 +123,7 @@ static inline void test_multislot_middle(bool seq) static inline void test_multislot_ends(bool seq) { - BTS the_bts; + BTS the_bts(the_pcu); struct gprs_rlcmac_bts *bts; struct gprs_rlcmac_trx *trx; @@ -160,6 +160,8 @@ int main(int argc, char **argv) log_set_print_filename(osmo_stderr_target, 0); log_set_log_level(osmo_stderr_target, LOGL_DEBUG); + the_pcu = gprs_pcu_alloc(tall_pcu_ctx); + test_multislot_total_ascending(true); test_multislot_total_ascending(false); @@ -174,6 +176,8 @@ int main(int argc, char **argv) test_window_wrapper(); + talloc_free(the_pcu); + return EXIT_SUCCESS; } |