[PATCH] osmo-pcu[master]: Fix slot allocation based on direction configured

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/.

arvind.sirsikar gerrit-no-reply at lists.osmocom.org
Tue Sep 6 12:53:34 UTC 2016


Review at  https://gerrit.osmocom.org/819

Fix slot allocation based on direction configured

Earlier number of TS allocation for second  DL  TBF was less compared
Compared to first TBF. As the allocation was considering combined capacity
for TS allocation which was causing inconsistencies.
This patch controls the TS allocation based on direction configured.

Related: OS#1792

Change-Id: I4b4a99194ccae68bb3417bce538d16e944d5ec71
---
M src/bts.cpp
M src/bts.h
M src/gprs_rlcmac_ts_alloc.cpp
M src/pcu_main.cpp
M src/pcu_vty.c
M tests/alloc/AllocTest.cpp
M tests/alloc/AllocTest.ok
7 files changed, 69 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/19/819/1

diff --git a/src/bts.cpp b/src/bts.cpp
index e65d608..ccbf691 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -622,6 +622,17 @@
 	bitvec_free(immediate_assignment);
 }
 
+enum allocation_capacity BTS::get_ts_allocation_type()
+{
+	struct gprs_rlcmac_bts *bts = bts_data();
+
+	if (bts->capacity_type == 1)
+		return DL_ONLY;
+	else if (bts->capacity_type == 2)
+		return UL_ONLY;
+	else
+		return DL_UL_BOTH;
+}
 
 GprsMs *BTS::ms_alloc(uint8_t ms_class, uint8_t egprs_ms_class)
 {
diff --git a/src/bts.h b/src/bts.h
index 801342d..ae7c6c4 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -44,6 +44,11 @@
 #define LLC_CODEL_USE_DEFAULT (-1)
 #define MAX_GPRS_CS 9
 
+enum allocation_capacity {
+	DL_ONLY,
+	UL_ONLY,
+	DL_UL_BOTH
+};
 
 struct BTS;
 struct GprsMs;
@@ -191,6 +196,13 @@
 	/* 0 to support resegmentation in DL, 1 for no reseg */
 	uint8_t dl_arq_type;
 
+	/*
+	 * 1 to support dl based allocation
+	 * 2 for ul based allocation
+	 * 3 for combined capacity:default
+	 */
+	uint8_t capacity_type;
+
 	uint32_t ms_idle_sec;
 	uint8_t cs_adj_enabled;
 	uint8_t cs_adj_upper_limit;
@@ -279,6 +291,9 @@
 	void set_current_block_frame_number(int frame_number, unsigned max_delay);
 	int current_frame_number() const;
 
+	/* get TS allocation type */
+	enum allocation_capacity get_ts_allocation_type();
+
 	/** add paging to paging queue(s) */
 	int add_paging(uint8_t chan_needed, uint8_t *identity_lv);
 
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 57197b2..fdba76e 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -509,6 +509,8 @@
 	enum {MASK_TT, MASK_TR};
 	unsigned mask_sel;
 
+	allocation_capacity capacity_type = bts->bts->get_ts_allocation_type();
+
 	if (ms->ms_class() >= 32) {
 		LOGP(DRLCMAC, LOGL_ERROR, "Multislot class %d out of range.\n",
 			ms->ms_class());
@@ -775,8 +777,13 @@
 					rx_window & tx_window, 'C'),
 			capacity);
 #endif
-
-		if (capacity <= max_capacity)
+		if (capacity_type == UL_ONLY) {
+			if (tx_window < max_ul_slots)
+				continue;
+		} else if (capacity_type == DL_ONLY) {
+			if (rx_window < max_dl_slots)
+				continue;
+		} else if (capacity <= max_capacity)
 			continue;
 
 		max_capacity = capacity;
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index afdfdc7..273eab3 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -217,6 +217,8 @@
 	 */
 	bts->dl_arq_type = EGPRS_ARQ1;
 
+	bts->capacity_type = 3;
+
 	msgb_set_talloc_ctx(tall_pcu_ctx);
 
 	osmo_init_logging(&gprs_log_info);
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 535d512..289594d 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -497,6 +497,25 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_pcu_ts_allocation_capacity,
+      cfg_pcu_dl_ts_alloc_capacity_cmd,
+      "capacity-type (dl|ul)",
+      "TS allocation configuration based on capacity\n"
+      "enable DL capacity based allocation support\n"
+      "enable UL capacity based allocation support")
+{
+	struct gprs_rlcmac_bts *bts = bts_main_data();
+
+	if (!strcmp(argv[0], "dl"))
+		bts->capacity_type = 1;
+	else if (!strcmp(argv[0], "ul"))
+		bts->capacity_type = 2;
+	else
+		bts->capacity_type = 3;
+
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_pcu_window_size,
       cfg_pcu_window_size_cmd,
       "window-size <0-1024> [<0-256>]",
@@ -972,6 +991,7 @@
 	install_element(PCU_NODE, &cfg_pcu_cs_lqual_ranges_cmd);
 	install_element(PCU_NODE, &cfg_pcu_mcs_cmd);
 	install_element(PCU_NODE, &cfg_pcu_dl_arq_cmd);
+	install_element(PCU_NODE, &cfg_pcu_dl_ts_alloc_capacity_cmd);
 	install_element(PCU_NODE, &cfg_pcu_no_mcs_cmd);
 	install_element(PCU_NODE, &cfg_pcu_mcs_max_cmd);
 	install_element(PCU_NODE, &cfg_pcu_no_mcs_max_cmd);
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index 0b4d1c1..de6d0c7 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -118,6 +118,7 @@
 
 	bts = the_bts.bts_data();
 	bts->alloc_algorithm = alloc_algorithm_a;
+	bts->capacity_type = 3;
 
 	struct gprs_rlcmac_trx *trx = &bts->trx[0];
 	for (i = 0; i < 8; i += 1)
@@ -196,6 +197,7 @@
 
 		bts = the_bts.bts_data();
 		bts->alloc_algorithm = alloc_algorithm_b;
+		bts->capacity_type = 3;
 
 		trx = &bts->trx[0];
 		trx->pdch[5].enable();
@@ -660,6 +662,7 @@
 
 	bts = the_bts.bts_data();
 	bts->alloc_algorithm = algo;
+	bts->capacity_type = 3;
 
 	trx = &bts->trx[0];
 	trx->pdch[3].enable();
@@ -698,6 +701,7 @@
 
 	bts = the_bts.bts_data();
 	bts->alloc_algorithm = algo;
+	bts->capacity_type = 3;
 
 	trx = &bts->trx[0];
 	trx->pdch[3].enable();
@@ -806,6 +810,7 @@
 
 	bts = the_bts.bts_data();
 	bts->alloc_algorithm = alloc_algorithm_b;
+	bts->capacity_type = 1;
 
 	trx = &bts->trx[0];
 	trx->pdch[4].enable();
@@ -821,7 +826,7 @@
 		numTs1++;
 	}
 	OSMO_ASSERT(numTs1 == 4);
-	printf("TBF1: numTs(%d)\n", numTs1);
+	printf("TBF1: numTs1(%d)\n", numTs1);
 
 	dl_tbf2 = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, egprs_ms_class, 0);
 	OSMO_ASSERT(dl_tbf2);
@@ -831,13 +836,9 @@
 		numTs2++;
 	}
 
-	/*
-	 * TODO: currently 2nd DL TBF gets 3 TS
-	 * This behaviour will be fixed in subsequent patch
-	 */
-	printf("TBF2: numTs(%d)\n", numTs2);
-	OSMO_ASSERT(numTs2 == 3);
-	OSMO_ASSERT(numTs2 != numTs1);
+	printf("TBF2: numTs2(%d)\n", numTs2);
+	OSMO_ASSERT(numTs2 == 4);
+	OSMO_ASSERT(numTs2 == numTs1);
 
 	tbf_free(dl_tbf1);
 	tbf_free(dl_tbf2);
@@ -861,6 +862,7 @@
 	test_successive_allocation();
 	test_many_connections();
 	test_2_consecutive_dl_tbfs();
+
 	return EXIT_SUCCESS;
 }
 
diff --git a/tests/alloc/AllocTest.ok b/tests/alloc/AllocTest.ok
index cbb65aa..abbd977 100644
--- a/tests/alloc/AllocTest.ok
+++ b/tests/alloc/AllocTest.ok
@@ -10794,5 +10794,5 @@
  TBF[31] class 15 reserves .......C
   Successfully allocated 160 TBFs
 Testing DL TS allocation for Multi UEs
-TBF1: numTs(4)
-TBF2: numTs(3)
+TBF1: numTs1(4)
+TBF2: numTs2(4)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b4a99194ccae68bb3417bce538d16e944d5ec71
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: arvind.sirsikar <arvind.sirsikar at radisys.com>



More information about the gerrit-log mailing list