Change in osmo-pcu[master]: Move fc_* fields from BTS to PCU

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Jan 18 14:44:58 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/22188 )

Change subject: Move fc_* fields from BTS to PCU
......................................................................

Move fc_* fields from BTS to PCU

Change-Id: I816d49e732d0fc7a3c9aa1f0e9a83b83d25e6a32
---
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_pcu.c
M src/gprs_pcu.h
M src/pcu_vty.c
M tests/emu/pcu_emu.cpp
7 files changed, 34 insertions(+), 66 deletions(-)

Approvals:
  Jenkins Builder: Verified
  lynxis lazus: Looks good to me, approved
  laforge: Looks good to me, approved



diff --git a/src/bts.cpp b/src/bts.cpp
index 4a9910f..9f987ff 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -193,7 +193,6 @@
 static void bts_init(struct gprs_rlcmac_bts *bts, BTS* bts_obj)
 {
 	memset(bts, 0, sizeof(*bts));
-	bts->fc_interval = 1;
 	bts->initial_cs_dl = bts->initial_cs_ul = 1;
 	bts->initial_mcs_dl = bts->initial_mcs_ul = 1;
 	bts->cs_mask = 1 << 0;  /* CS-1 always enabled by default */
diff --git a/src/bts.h b/src/bts.h
index 2902074..db5f3e8 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -85,12 +85,6 @@
 struct gprs_rlcmac_bts {
 	bool active;
 	uint8_t bsic;
-	uint8_t fc_interval;
-	uint16_t fc_bucket_time;
-	uint32_t fc_bvc_bucket_size;
-	uint32_t fc_bvc_leak_rate;
-	uint32_t fc_ms_bucket_size;
-	uint32_t fc_ms_leak_rate;
 	uint8_t cs_mask; /* Allowed CS mask from BTS */
 	uint16_t mcs_mask;  /* Allowed MCS mask from BTS */
 	uint8_t initial_cs_dl, initial_cs_ul;
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 89edd2b..c1a7a7d 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -673,7 +673,7 @@
 	uint32_t leak_rate, uint32_t fallback)
 {
 	uint32_t bucket_size = 0;
-	uint16_t bucket_time = bts->fc_bucket_time;
+	uint16_t bucket_time = the_pcu->vty.fc_bucket_time;
 
 	if (bucket_time == 0)
 		bucket_time = bts->force_llc_lifetime;
@@ -811,10 +811,10 @@
 
 	max_cs_dl = max_coding_scheme_dl(bts);
 
-	bucket_size = bts->fc_bvc_bucket_size;
-	leak_rate = bts->fc_bvc_leak_rate;
-	ms_bucket_size = bts->fc_ms_bucket_size;
-	ms_leak_rate = bts->fc_ms_leak_rate;
+	bucket_size = the_pcu->vty.fc_bvc_bucket_size;
+	leak_rate = the_pcu->vty.fc_bvc_leak_rate;
+	ms_bucket_size = the_pcu->vty.fc_ms_bucket_size;
+	ms_leak_rate = the_pcu->vty.fc_ms_leak_rate;
 
 	/* FIXME: This calculation is mostly wrong. It should be done based on
 	   currently established TBF (and whether the related (egprs)_ms_class
@@ -940,7 +940,7 @@
 	LOGP(DBSSGP, LOGL_DEBUG, "Sending flow control info on BVCI %d\n",
 		the_pcu->bssgp.bctx->bvci);
 	gprs_bssgp_tx_fc_bvc();
-	osmo_timer_schedule(&the_pcu->bssgp.bvc_timer, the_pcu->bssgp.bts->fc_interval, 0);
+	osmo_timer_schedule(&the_pcu->bssgp.bvc_timer, the_pcu->vty.fc_interval, 0);
 }
 
 static int ns_create_nsvc(struct gprs_rlcmac_bts *bts,
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index 01ead33..209fca6 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -46,6 +46,7 @@
 	pcu = (struct gprs_pcu *)talloc_zero(ctx, struct gprs_pcu);
 	OSMO_ASSERT(pcu);
 
+	pcu->vty.fc_interval = 1;
 	pcu->vty.max_cs_ul = MAX_GPRS_CS;
 	pcu->vty.max_cs_dl = MAX_GPRS_CS;
 	pcu->vty.max_mcs_ul = MAX_EDGE_MCS;
diff --git a/src/gprs_pcu.h b/src/gprs_pcu.h
index ff73cc9..87c8cdf 100644
--- a/src/gprs_pcu.h
+++ b/src/gprs_pcu.h
@@ -71,6 +71,12 @@
 	char *pcu_sock_path;
 
 	struct { /* Config Values set by VTY */
+		uint8_t fc_interval;
+		uint16_t fc_bucket_time;
+		uint32_t fc_bvc_bucket_size;
+		uint32_t fc_bvc_leak_rate;
+		uint32_t fc_ms_bucket_size;
+		uint32_t fc_ms_leak_rate;
 		bool force_initial_cs;	/* false=use from BTS true=use from VTY */
 		bool force_initial_mcs;	/* false=use from BTS true=use from VTY */
 		uint8_t max_cs_dl, max_cs_ul;
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index b0c941d..d107548 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -106,20 +106,20 @@
 	unsigned int i;
 
 	vty_out(vty, "pcu%s", VTY_NEWLINE);
-	vty_out(vty, " flow-control-interval %d%s", bts->fc_interval,
+	vty_out(vty, " flow-control-interval %d%s", the_pcu->vty.fc_interval,
 		VTY_NEWLINE);
-	if (bts->fc_bvc_bucket_size)
+	if (the_pcu->vty.fc_bvc_bucket_size)
 		vty_out(vty, " flow-control force-bvc-bucket-size %d%s",
-			bts->fc_bvc_bucket_size, VTY_NEWLINE);
-	if (bts->fc_bvc_leak_rate)
+			the_pcu->vty.fc_bvc_bucket_size, VTY_NEWLINE);
+	if (the_pcu->vty.fc_bvc_leak_rate)
 		vty_out(vty, " flow-control force-bvc-leak-rate %d%s",
-			bts->fc_bvc_leak_rate, VTY_NEWLINE);
-	if (bts->fc_ms_bucket_size)
+			the_pcu->vty.fc_bvc_leak_rate, VTY_NEWLINE);
+	if (the_pcu->vty.fc_ms_bucket_size)
 		vty_out(vty, " flow-control force-ms-bucket-size %d%s",
-			bts->fc_ms_bucket_size, VTY_NEWLINE);
-	if (bts->fc_ms_leak_rate)
+			the_pcu->vty.fc_ms_bucket_size, VTY_NEWLINE);
+	if (the_pcu->vty.fc_ms_leak_rate)
 		vty_out(vty, " flow-control force-ms-leak-rate %d%s",
-			bts->fc_ms_leak_rate, VTY_NEWLINE);
+			the_pcu->vty.fc_ms_leak_rate, VTY_NEWLINE);
 	if (the_pcu->vty.force_initial_cs) {
 		if (bts->initial_cs_ul == bts->initial_cs_dl)
 			vty_out(vty, " cs %d%s", bts->initial_cs_dl,
@@ -292,10 +292,7 @@
 	   "Interval time in seconds\n",
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_interval = atoi(argv[0]);
-
+	the_pcu->vty.fc_interval = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 #define FC_STR "BSSGP Flow Control configuration\n"
@@ -308,10 +305,7 @@
 	   FC_STR FC_BMAX_STR("BVC") "Bucket size in octets\n",
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_bvc_bucket_size = atoi(argv[0]);
-
+	the_pcu->vty.fc_bvc_bucket_size = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -321,10 +315,7 @@
 	   NO_STR FC_STR FC_BMAX_STR("BVC"),
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_bvc_bucket_size = 0;
-
+	the_pcu->vty.fc_bvc_bucket_size = 0;
 	return CMD_SUCCESS;
 }
 
@@ -334,9 +325,7 @@
 	   FC_STR FC_LR_STR("BVC") "Leak rate in bit/s\n",
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_bvc_leak_rate = atoi(argv[0]);
+	the_pcu->vty.fc_bvc_leak_rate = atoi(argv[0]);
 
 	return CMD_SUCCESS;
 }
@@ -347,10 +336,7 @@
 	   NO_STR FC_STR FC_LR_STR("BVC"),
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_bvc_leak_rate = 0;
-
+	the_pcu->vty.fc_bvc_leak_rate = 0;
 	return CMD_SUCCESS;
 }
 
@@ -360,10 +346,7 @@
 	   FC_STR FC_BMAX_STR("default MS") "Bucket size in octets\n",
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_ms_bucket_size = atoi(argv[0]);
-
+	the_pcu->vty.fc_ms_bucket_size = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -373,10 +356,7 @@
 	   NO_STR FC_STR FC_BMAX_STR("default MS"),
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_ms_bucket_size = 0;
-
+	the_pcu->vty.fc_ms_bucket_size = 0;
 	return CMD_SUCCESS;
 }
 
@@ -386,10 +366,7 @@
 	   FC_STR FC_LR_STR("default MS") "Leak rate in bit/s\n",
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_ms_leak_rate = atoi(argv[0]);
-
+	the_pcu->vty.fc_ms_leak_rate = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -399,10 +376,7 @@
 	   NO_STR FC_STR FC_LR_STR("default MS"),
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_ms_leak_rate = 0;
-
+	the_pcu->vty.fc_ms_leak_rate = 0;
 	return CMD_SUCCESS;
 }
 
@@ -413,10 +387,7 @@
 	   FC_STR FC_BTIME_STR "Time in centi-seconds\n",
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_bucket_time = atoi(argv[0]);
-
+	the_pcu->vty.fc_bucket_time = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -426,10 +397,7 @@
 	   NO_STR FC_STR FC_BTIME_STR,
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->fc_bucket_time = 0;
-
+	the_pcu->vty.fc_bucket_time = 0;
 	return CMD_SUCCESS;
 }
 
diff --git a/tests/emu/pcu_emu.cpp b/tests/emu/pcu_emu.cpp
index 96aacda..2336e67 100644
--- a/tests/emu/pcu_emu.cpp
+++ b/tests/emu/pcu_emu.cpp
@@ -66,7 +66,6 @@
 static void init_main_bts()
 {
 	struct gprs_rlcmac_bts *bts = bts_main_data();
-	bts->fc_interval = 100;
 	bts->initial_cs_dl = bts->initial_cs_ul = 1;
 	bts->cs_mask = 1 << 0; /* CS-1 always enabled by default */
 	bts->n3101 = 10;
@@ -78,6 +77,7 @@
 {
 	if (!pcu->alloc_algorithm)
 		pcu->alloc_algorithm = alloc_algorithm_b;
+	pcu->vty.fc_interval = 100;
 	pcu->vty.alpha = 0; /* a = 0.0 */
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/22188
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I816d49e732d0fc7a3c9aa1f0e9a83b83d25e6a32
Gerrit-Change-Number: 22188
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210118/63f196c4/attachment.htm>


More information about the gerrit-log mailing list