[PATCH] osmo-pcu[master]: Initialize logging before initializing rate_ctr

Max gerrit-no-reply at lists.osmocom.org
Wed Oct 25 16:01:51 UTC 2017


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4411

to look at the new patch set (#8).

Initialize logging before initializing rate_ctr

The library code for rate counter initialization might already want to
log something (particularly after
Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56 in libosmocore), so the
logging framework must be initialized before.

Before the rate counters were initialized implicitly in BTS
constructor which makes proper logging init impossible.

Fix this by using explicit init similar to the way we do it for vty.

Change-Id: Ibf557d21552d9ff1d6b595b0594f2c7b18db4692
---
M src/Makefile.am
M src/bts.cpp
M src/bts.h
A src/pcu_ctr.c
A src/pcu_ctr.h
M src/pcu_main.cpp
M src/pcu_vty.c
M tests/alloc/AllocTest.cpp
M tests/tbf/TbfTest.cpp
M tests/types/TypesTest.cpp
10 files changed, 194 insertions(+), 122 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/11/4411/8

diff --git a/src/Makefile.am b/src/Makefile.am
index 1543851..67291ae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,6 +47,7 @@
 	gprs_ms_storage.cpp \
 	gsm_timer.cpp \
 	pcu_l1_if.cpp \
+	pcu_ctr.c \
 	pcu_vty.c \
 	pcu_vty_functions.cpp \
 	tbf.cpp \
@@ -79,6 +80,7 @@
 	gprs_ms_storage.h \
 	pcu_l1_if.h \
 	gsm_timer.h \
+	pcu_ctr.h \
 	pcu_vty.h \
 	pcu_vty_functions.h \
 	tbf.h \
diff --git a/src/bts.cpp b/src/bts.cpp
index b768569..0f7462a 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -50,107 +50,6 @@
 
 static BTS s_bts;
 
-/**
- * For gcc-4.4 compat do not use extended initializer list but keep the
- * order from the enum here. Once we support GCC4.7 and up we can change
- * the code below.
- */
-static const struct rate_ctr_desc bts_ctr_description[] = {
-	{ "tbf.dl.alloc",		"TBF DL Allocated     "},
-	{ "tbf.dl.freed",		"TBF DL Freed         "},
-	{ "tbf.dl.aborted",		"TBF DL Aborted       "},
-	{ "tbf.ul.alloc",		"TBF UL Allocated     "},
-	{ "tbf.ul.freed",		"TBF UL Freed         "},
-	{ "tbf.ul.aborted",		"TBF UL Aborted       "},
-	{ "tbf.reused",			"TBF Reused           "},
-	{ "tbf.alloc.algo-a",		"TBF Alloc Algo A     "},
-	{ "tbf.alloc.algo-b",		"TBF Alloc Algo B     "},
-	{ "tbf.failed.egprs-only",	"TBF Failed EGPRS-only"},
-	{ "rlc.sent",			"RLC Sent             "},
-	{ "rlc.resent",			"RLC Resent           "},
-	{ "rlc.restarted",		"RLC Restarted        "},
-	{ "rlc.stalled",		"RLC Stalled          "},
-	{ "rlc.nacked",			"RLC Nacked           "},
-	{ "rlc.final_block_resent",	"RLC Final Blk resent "},
-	{ "rlc.ass.timedout",		"RLC Assign Timeout   "},
-	{ "rlc.ass.failed",		"RLC Assign Failed    "},
-	{ "rlc.ack.timedout",		"RLC Ack Timeout      "},
-	{ "rlc.ack.failed",		"RLC Ack Failed       "},
-	{ "rlc.rel.timedout",		"RLC Release Timeout  "},
-	{ "rlc.late-block",		"RLC Late Block       "},
-	{ "rlc.sent-dummy",		"RLC Sent Dummy       "},
-	{ "rlc.sent-control",		"RLC Sent Control     "},
-	{ "rlc.dl_bytes",		"RLC DL Bytes         "},
-	{ "rlc.dl_payload_bytes",	"RLC DL Payload Bytes "},
-	{ "rlc.ul_bytes",		"RLC UL Bytes         "},
-	{ "rlc.ul_payload_bytes",	"RLC UL Payload Bytes "},
-	{ "decode.errors",		"Decode Errors        "},
-	{ "sba.allocated",		"SBA Allocated        "},
-	{ "sba.freed",			"SBA Freed            "},
-	{ "sba.timedout",		"SBA Timeout          "},
-	{ "llc.timeout",		"Timedout Frames      "},
-	{ "llc.dropped",		"Dropped Frames       "},
-	{ "llc.scheduled",		"Scheduled Frames     "},
-	{ "llc.dl_bytes",               "RLC encapsulated PDUs"},
-	{ "llc.ul_bytes",               "full PDUs received   "},
-	{ "rach.requests",		"RACH requests        "},
-	{ "11bit_rach.requests",	"11BIT_RACH requests  "},
-	{ "spb.uplink_first_segment",   "First seg of UL SPB  "},
-	{ "spb.uplink_second_segment",  "Second seg of UL SPB "},
-	{ "spb.downlink_first_segment", "First seg of DL SPB  "},
-	{ "spb.downlink_second_segment","Second seg of DL SPB "},
-	{ "immediate.assignment_UL",	"Immediate Assign UL  "},
-	{ "immediate.assignment_rej",   "Immediate Assign Rej "},
-	{ "immediate.assignment_DL",	"Immediate Assign DL  "},
-	{ "channel.request_description","Channel Request Desc "},
-	{ "pkt.ul_assignment",		"Packet UL Assignment "},
-	{ "pkt.access_reject",          "Packet Access Reject "},
-	{ "pkt.dl_assignment",		"Packet DL Assignment "},
-	{ "ul.control",			"UL control Block     "},
-	{ "ul.assignment_poll_timeout",	"UL Assign Timeout    "},
-	{ "ul.assignment_failed",	"UL Assign Failed     "},
-	{ "dl.assignment_timeout",	"DL Assign Timeout    "},
-	{ "dl.assignment_failed",	"DL Assign Failed     "},
-	{ "pkt.ul_ack_nack_timeout",	"PUAN Poll Timeout    "},
-	{ "pkt.ul_ack_nack_failed",	"PUAN poll Failed     "},
-	{ "pkt.dl_ack_nack_timeout",	"PDAN poll Timeout    "},
-	{ "pkt.dl_ack_nack_failed",	"PDAN poll Failed     "},
-	{ "gprs.downlink_cs1",		"CS1 downlink         "},
-	{ "gprs.downlink_cs2",		"CS2 downlink         "},
-	{ "gprs.downlink_cs3",		"CS3 downlink         "},
-	{ "gprs.downlink_cs4",		"CS4 downlink         "},
-	{ "egprs.downlink_mcs1",	"MCS1 downlink        "},
-	{ "egprs.downlink_mcs2",	"MCS2 downlink        "},
-	{ "egprs.downlink_mcs3",	"MCS3 downlink        "},
-	{ "egprs.downlink_mcs4",	"MCS4 downlink        "},
-	{ "egprs.downlink_mcs5",	"MCS5 downlink        "},
-	{ "egprs.downlink_mcs6",	"MCS6 downlink        "},
-	{ "egprs.downlink_mcs7",	"MCS7 downlink        "},
-	{ "egprs.downlink_mcs8",	"MCS8 downlink        "},
-	{ "egprs.downlink_mcs9",	"MCS9 downlink        "},
-	{ "gprs.uplink_cs1",		"CS1 Uplink           "},
-	{ "gprs.uplink_cs2",		"CS2 Uplink           "},
-	{ "gprs.uplink_cs3",		"CS3 Uplink           "},
-	{ "gprs.uplink_cs4",		"CS4 Uplink           "},
-	{ "egprs.uplink_mcs1",		"MCS1 Uplink          "},
-	{ "egprs.uplink_mcs2",		"MCS2 Uplink          "},
-	{ "egprs.uplink_mcs3",		"MCS3 Uplink          "},
-	{ "egprs.uplink_mcs4",		"MCS4 Uplink          "},
-	{ "egprs.uplink_mcs5",		"MCS5 Uplink          "},
-	{ "egprs.uplink_mcs6",		"MCS6 Uplink          "},
-	{ "egprs.uplink_mcs7",		"MCS7 Uplink          "},
-	{ "egprs.uplink_mcs8",		"MCS8 Uplink          "},
-	{ "egprs.uplink_mcs9",		"MCS9 Uplink          "},
-};
-
-static const struct rate_ctr_group_desc bts_ctrg_desc = {
-	"bts",
-	"BTS Statistics",
-	OSMO_STATS_CLASS_GLOBAL,
-	ARRAY_SIZE(bts_ctr_description),
-	bts_ctr_description,
-};
-
 static const struct osmo_stat_item_desc bts_stat_item_description[] = {
 	{ "ms.present",		"MS Present           ",
 		OSMO_STAT_ITEM_NO_UNIT, 4, 0},
@@ -179,11 +78,6 @@
 	return BTS::main_bts()->bts_data();
 }
 
-struct rate_ctr_group *bts_main_data_stats()
-{
-	return BTS::main_bts()->rate_counters();
-}
-
 BTS::BTS()
 	: m_cur_fn(0)
 	, m_cur_blk_fn(-1)
@@ -207,8 +101,6 @@
 		}
 	}
 
-	m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
-	OSMO_ASSERT(m_ratectrs);
 	m_statg = osmo_stat_item_group_alloc(tall_pcu_ctx, &bts_statg_desc, 0);
 	OSMO_ASSERT(m_statg);
 }
@@ -219,7 +111,8 @@
 	 * m_ms_store's destructor */
 	m_ms_store.cleanup();
 
-	rate_ctr_group_free(m_ratectrs);
+	if (m_bts.ctrs)
+		rate_ctr_group_free(m_bts.ctrs);
 	osmo_stat_item_group_free(m_statg);
 }
 
diff --git a/src/bts.h b/src/bts.h
index d65cd2f..607b4c1 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -231,6 +231,9 @@
 	/* State for dynamic algorithm selection */
 	int multislot_disabled;
 
+	/* Statistics */
+	struct rate_ctr_group *ctrs;
+
 	/**
 	 * Point back to the C++ object. This is used during the transition
 	 * period.
@@ -482,7 +485,6 @@
 	/*
 	 * Below for C interface for the VTY
 	 */
-	struct rate_ctr_group *rate_counters() const;
 	struct osmo_stat_item_group *stat_items() const;
 
 	LListHead<gprs_rlcmac_tbf>& ul_tbfs();
@@ -493,7 +495,6 @@
 	struct gprs_rlcmac_bts m_bts;
 	PollController m_pollController;
 	SBAController m_sba;
-	struct rate_ctr_group *m_ratectrs;
 	struct osmo_stat_item_group *m_statg;
 
 	GprsMsStorage m_ms_store;
@@ -570,11 +571,6 @@
 	return m_assigned_tfi[dir];
 }
 
-inline struct rate_ctr_group *BTS::rate_counters() const
-{
-	return m_ratectrs;
-}
-
 inline struct osmo_stat_item_group *BTS::stat_items() const
 {
 	return m_statg;
@@ -582,12 +578,14 @@
 
 #define CREATE_COUNT_ADD_INLINE(func_name, ctr_name) \
 	inline void BTS::func_name(int inc) {\
-		rate_ctr_add(&m_ratectrs->ctr[ctr_name], inc); \
+		OSMO_ASSERT(m_bts.ctrs); \
+		rate_ctr_add(&m_bts.ctrs->ctr[ctr_name], inc); \
 	}
 
 #define CREATE_COUNT_INLINE(func_name, ctr_name) \
 	inline void BTS::func_name() {\
-		rate_ctr_inc(&m_ratectrs->ctr[ctr_name]); \
+		OSMO_ASSERT(m_bts.ctrs); \
+		rate_ctr_inc(&m_bts.ctrs->ctr[ctr_name]); \
 	}
 
 CREATE_COUNT_INLINE(tbf_dl_created, CTR_TBF_DL_ALLOCATED)
@@ -705,8 +703,6 @@
 extern "C" {
 #endif
 	struct gprs_rlcmac_bts *bts_main_data();
-	struct rate_ctr_group *bts_main_data_stats();
-	struct osmo_stat_item_group *bts_main_data_stat_items();
 #ifdef __cplusplus
 }
 
diff --git a/src/pcu_ctr.c b/src/pcu_ctr.c
new file mode 100644
index 0000000..d3ed801
--- /dev/null
+++ b/src/pcu_ctr.c
@@ -0,0 +1,41 @@
+/* pcu_ctr.c
+ *
+ * Copyright (C) 2013 by Holger Hans Peter Freyther
+ * Copyright (C) 2017 by sysmocom - s.f.m.c. GmbH <info at sysmocom.de>
+ * Author: Max Suraev <msuraev at 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#include "pcu_ctr.h"
+
+#include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/stats.h>
+#include <osmocom/core/utils.h>
+
+extern void *tall_pcu_ctx;
+
+struct rate_ctr_group *pcu_ctr_init()
+{
+	const struct rate_ctr_group_desc bts_ctrg_desc = {
+		"bts",
+		"BTS Statistics",
+		OSMO_STATS_CLASS_GLOBAL,
+		ARRAY_SIZE(bts_ctr_description),
+		bts_ctr_description,
+	};
+
+	return rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
+}
diff --git a/src/pcu_ctr.h b/src/pcu_ctr.h
new file mode 100644
index 0000000..af735e9
--- /dev/null
+++ b/src/pcu_ctr.h
@@ -0,0 +1,120 @@
+/* pcu_ctr.h
+ *
+ * Copyright (C) 2012 Ivan Klyuchnikov
+ * Copyright (C) 2013 by Holger Hans Peter Freyther
+ * Copyright (C) 2017 by sysmocom - s.f.m.c. GmbH
+ * Author: Max Suraev <msuraev at 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#pragma once
+
+#include <osmocom/core/utils.h>
+#include <osmocom/core/rate_ctr.h>
+
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+static const struct rate_ctr_desc bts_ctr_description[] = {
+	{ "tbf.dl.alloc",		"TBF DL Allocated     "},
+	{ "tbf.dl.freed",		"TBF DL Freed         "},
+	{ "tbf.dl.aborted",		"TBF DL Aborted       "},
+	{ "tbf.ul.alloc",		"TBF UL Allocated     "},
+	{ "tbf.ul.freed",		"TBF UL Freed         "},
+	{ "tbf.ul.aborted",		"TBF UL Aborted       "},
+	{ "tbf.reused",			"TBF Reused           "},
+	{ "tbf.alloc.algo-a",		"TBF Alloc Algo A     "},
+	{ "tbf.alloc.algo-b",		"TBF Alloc Algo B     "},
+	{ "tbf.failed.egprs-only",	"TBF Failed EGPRS-only"},
+	{ "rlc.sent",			"RLC Sent             "},
+	{ "rlc.resent",			"RLC Resent           "},
+	{ "rlc.restarted",		"RLC Restarted        "},
+	{ "rlc.stalled",		"RLC Stalled          "},
+	{ "rlc.nacked",			"RLC Nacked           "},
+	{ "rlc.final_block_resent",	"RLC Final Blk resent "},
+	{ "rlc.ass.timedout",		"RLC Assign Timeout   "},
+	{ "rlc.ass.failed",		"RLC Assign Failed    "},
+	{ "rlc.ack.timedout",		"RLC Ack Timeout      "},
+	{ "rlc.ack.failed",		"RLC Ack Failed       "},
+	{ "rlc.rel.timedout",		"RLC Release Timeout  "},
+	{ "rlc.late-block",		"RLC Late Block       "},
+	{ "rlc.sent-dummy",		"RLC Sent Dummy       "},
+	{ "rlc.sent-control",		"RLC Sent Control     "},
+	{ "rlc.dl_bytes",		"RLC DL Bytes         "},
+	{ "rlc.dl_payload_bytes",	"RLC DL Payload Bytes "},
+	{ "rlc.ul_bytes",		"RLC UL Bytes         "},
+	{ "rlc.ul_payload_bytes",	"RLC UL Payload Bytes "},
+	{ "decode.errors",		"Decode Errors        "},
+	{ "sba.allocated",		"SBA Allocated        "},
+	{ "sba.freed",			"SBA Freed            "},
+	{ "sba.timedout",		"SBA Timeout          "},
+	{ "llc.timeout",		"Timedout Frames      "},
+	{ "llc.dropped",		"Dropped Frames       "},
+	{ "llc.scheduled",		"Scheduled Frames     "},
+	{ "llc.dl_bytes",               "RLC encapsulated PDUs"},
+	{ "llc.ul_bytes",               "full PDUs received   "},
+	{ "rach.requests",		"RACH requests        "},
+	{ "11bit_rach.requests",	"11BIT_RACH requests  "},
+	{ "spb.uplink_first_segment",   "First seg of UL SPB  "},
+	{ "spb.uplink_second_segment",  "Second seg of UL SPB "},
+	{ "spb.downlink_first_segment", "First seg of DL SPB  "},
+	{ "spb.downlink_second_segment","Second seg of DL SPB "},
+	{ "immediate.assignment_UL",	"Immediate Assign UL  "},
+	{ "immediate.assignment_rej",   "Immediate Assign Rej "},
+	{ "immediate.assignment_DL",	"Immediate Assign DL  "},
+	{ "channel.request_description","Channel Request Desc "},
+	{ "pkt.ul_assignment",		"Packet UL Assignment "},
+	{ "pkt.access_reject",          "Packet Access Reject "},
+	{ "pkt.dl_assignment",		"Packet DL Assignment "},
+	{ "ul.control",			"UL control Block     "},
+	{ "ul.assignment_poll_timeout",	"UL Assign Timeout    "},
+	{ "ul.assignment_failed",	"UL Assign Failed     "},
+	{ "dl.assignment_timeout",	"DL Assign Timeout    "},
+	{ "dl.assignment_failed",	"DL Assign Failed     "},
+	{ "pkt.ul_ack_nack_timeout",	"PUAN Poll Timeout    "},
+	{ "pkt.ul_ack_nack_failed",	"PUAN poll Failed     "},
+	{ "pkt.dl_ack_nack_timeout",	"PDAN poll Timeout    "},
+	{ "pkt.dl_ack_nack_failed",	"PDAN poll Failed     "},
+	{ "gprs.downlink_cs1",		"CS1 downlink         "},
+	{ "gprs.downlink_cs2",		"CS2 downlink         "},
+	{ "gprs.downlink_cs3",		"CS3 downlink         "},
+	{ "gprs.downlink_cs4",		"CS4 downlink         "},
+	{ "egprs.downlink_mcs1",	"MCS1 downlink        "},
+	{ "egprs.downlink_mcs2",	"MCS2 downlink        "},
+	{ "egprs.downlink_mcs3",	"MCS3 downlink        "},
+	{ "egprs.downlink_mcs4",	"MCS4 downlink        "},
+	{ "egprs.downlink_mcs5",	"MCS5 downlink        "},
+	{ "egprs.downlink_mcs6",	"MCS6 downlink        "},
+	{ "egprs.downlink_mcs7",	"MCS7 downlink        "},
+	{ "egprs.downlink_mcs8",	"MCS8 downlink        "},
+	{ "egprs.downlink_mcs9",	"MCS9 downlink        "},
+	{ "gprs.uplink_cs1",		"CS1 Uplink           "},
+	{ "gprs.uplink_cs2",		"CS2 Uplink           "},
+	{ "gprs.uplink_cs3",		"CS3 Uplink           "},
+	{ "gprs.uplink_cs4",		"CS4 Uplink           "},
+	{ "egprs.uplink_mcs1",		"MCS1 Uplink          "},
+	{ "egprs.uplink_mcs2",		"MCS2 Uplink          "},
+	{ "egprs.uplink_mcs3",		"MCS3 Uplink          "},
+	{ "egprs.uplink_mcs4",		"MCS4 Uplink          "},
+	{ "egprs.uplink_mcs5",		"MCS5 Uplink          "},
+	{ "egprs.uplink_mcs6",		"MCS6 Uplink          "},
+	{ "egprs.uplink_mcs7",		"MCS7 Uplink          "},
+	{ "egprs.uplink_mcs8",		"MCS8 Uplink          "},
+	{ "egprs.uplink_mcs9",		"MCS9 Uplink          "},
+};
+
+struct rate_ctr_group *pcu_ctr_init();
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index b7574f9..c7dd3ed 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -30,6 +30,7 @@
 #include <bts.h>
 extern "C" {
 #include "pcu_vty.h"
+#include "pcu_ctr.h"
 #include <osmocom/vty/telnet_interface.h>
 #include <osmocom/vty/logging.h>
 #include <osmocom/vty/ports.h>
@@ -251,6 +252,7 @@
 
 	vty_init(&pcu_vty_info);
 	pcu_vty_init(&gprs_log_info);
+	bts->ctrs = pcu_ctr_init();
 
 	handle_options(argc, argv);
 	if ((!!spoof_mcc) + (!!spoof_mnc) == 1) {
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 5ec16ea..c94f7d2 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -9,6 +9,7 @@
 #include <osmocom/vty/misc.h>
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/stats.h>
 #include <osmocom/pcu/pcuif_proto.h>
 #include "pcu_vty.h"
 #include "gprs_rlcmac.h"
@@ -836,7 +837,9 @@
       "show bts statistics",
       SHOW_STR "BTS related functionality\nStatistics\n")
 {
-	vty_out_rate_ctr_group(vty, "", bts_main_data_stats());
+	struct gprs_rlcmac_bts *bts = bts_main_data();
+
+	vty_out_rate_ctr_group(vty, "", bts->ctrs);
 	return CMD_SUCCESS;
 }
 
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index a88f477..48ca24f 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -30,6 +30,7 @@
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/utils.h>
+#include <pcu_ctr.h>
 }
 
 /* globals used by the code */
@@ -117,6 +118,7 @@
 	printf("Testing alloc_a direction(%d)\n", dir);
 
 	bts = the_bts.bts_data();
+	bts->ctrs = pcu_ctr_init();
 	bts->alloc_algorithm = alloc_algorithm_a;
 
 	struct gprs_rlcmac_trx *trx = &bts->trx[0];
@@ -195,6 +197,7 @@
 		printf("Testing UL then DL assignment.\n");
 
 		bts = the_bts.bts_data();
+		bts->ctrs = pcu_ctr_init();
 		bts->alloc_algorithm = alloc_algorithm_b;
 
 		trx = &bts->trx[0];
@@ -237,6 +240,7 @@
 		printf("Testing DL then UL assignment followed by update\n");
 
 		bts = the_bts.bts_data();
+		bts->ctrs = pcu_ctr_init();
 		bts->alloc_algorithm = alloc_algorithm_b;
 
 		trx = &bts->trx[0];
@@ -284,6 +288,7 @@
 		printf("Testing jolly example\n");
 
 		bts = the_bts.bts_data();
+		bts->ctrs = pcu_ctr_init();
 		bts->alloc_algorithm = alloc_algorithm_b;
 
 		trx = &bts->trx[0];
@@ -345,6 +350,7 @@
 		gprs_rlcmac_tbf *ul_tbf, *dl_tbf;
 
 		bts = the_bts.bts_data();
+		bts->ctrs = pcu_ctr_init();
 		bts->alloc_algorithm = alloc_algorithm_b;
 
 		trx = &bts->trx[0];
@@ -389,6 +395,7 @@
 		gprs_rlcmac_dl_tbf *dl_tbf;
 
 		bts = the_bts.bts_data();
+		bts->ctrs = pcu_ctr_init();
 		bts->alloc_algorithm = alloc_algorithm_b;
 
 		trx = &bts->trx[0];
@@ -482,6 +489,7 @@
 	uint8_t trx_no = -1;
 
 	bts = the_bts->bts_data();
+	bts->ctrs = pcu_ctr_init();
 
 	gprs_rlcmac_tbf *tbf = NULL;
 
@@ -663,6 +671,7 @@
 	printf("Going to test assignment with many TBF, %s\n", text);
 
 	bts = the_bts.bts_data();
+	bts->ctrs = pcu_ctr_init();
 	bts->alloc_algorithm = algo;
 
 	trx = &bts->trx[0];
@@ -701,6 +710,7 @@
 	printf("Going to test assignment with many connections, %s\n", text);
 
 	bts = the_bts.bts_data();
+	bts->ctrs = pcu_ctr_init();
 	bts->alloc_algorithm = algo;
 
 	trx = &bts->trx[0];
@@ -809,6 +819,7 @@
 	printf("Testing DL TS allocation for Multi UEs\n");
 
 	bts = the_bts.bts_data();
+	bts->ctrs = pcu_ctr_init();
 	bts->alloc_algorithm = alloc_algorithm_b;
 
 	trx = &bts->trx[0];
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 0db7fde..604366e 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -30,7 +30,7 @@
 
 extern "C" {
 #include "pcu_vty.h"
-
+#include "pcu_ctr.h"
 #include <osmocom/core/application.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/talloc.h>
@@ -74,6 +74,7 @@
 
 	printf("=== start %s ===\n", __func__);
 
+	the_bts.bts_data()->ctrs = pcu_ctr_init();
 	the_bts.bts_data()->alloc_algorithm = alloc_algorithm_a;
 	the_bts.bts_data()->trx[0].pdch[2].enable();
 	the_bts.bts_data()->trx[0].pdch[3].enable();
@@ -148,6 +149,7 @@
 	gprs_rlcmac_trx *trx;
 
 	bts = the_bts->bts_data();
+	bts->ctrs = pcu_ctr_init();
 	bts->alloc_algorithm = alloc_algorithm_a;
 	bts->initial_cs_dl = cs;
 	bts->initial_cs_ul = cs;
diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index 7d09108..25d689b 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -30,6 +30,7 @@
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/utils.h>
+#include <pcu_ctr.h>
 }
 
 #define OSMO_ASSERT_STR_EQ(a, b) \
@@ -351,6 +352,7 @@
 		int bsn_begin, bsn_end, num_blocks;
 		Ack_Nack_Description_t desc;
 
+		dummy_bts.bts_data()->ctrs = pcu_ctr_init();
 		dl_win.m_v_b.reset();
 
 		OSMO_ASSERT(dl_win.window_empty());

-- 
To view, visit https://gerrit.osmocom.org/4411
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ibf557d21552d9ff1d6b595b0594f2c7b18db4692
Gerrit-PatchSet: 8
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list