[PATCH] osmo-pcu[master]: Simplify TS alloc: don't use PDCH for free TFI

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

Max gerrit-no-reply at lists.osmocom.org
Wed Jan 31 16:50:51 UTC 2018


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

Simplify TS alloc: don't use PDCH for free TFI

Don't use PDCH from free TFI lookup routine. This allows for simpler
function which can be moved to mslot_class.c alongside with other
similar helpers.

Change-Id: Ie154866900453d232a890f7b9a30911b451525a1
Related: OS#2282
---
M src/bts.h
M src/gprs_rlcmac_ts_alloc.cpp
M src/mslot_class.c
M src/mslot_class.h
4 files changed, 21 insertions(+), 19 deletions(-)


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

diff --git a/src/bts.h b/src/bts.h
index 5679b98..f69f738 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -30,6 +30,7 @@
 #include <osmocom/core/gsmtap.h>
 #include <osmocom/gsm/l1sap.h>
 #include <osmocom/gsm/protocol/gsm_04_08.h>
+	#include <mslot_class.h>
 }
 
 #include "poll_controller.h"
@@ -44,7 +45,6 @@
 #define LLC_CODEL_DISABLE 0
 #define LLC_CODEL_USE_DEFAULT (-1)
 #define MAX_GPRS_CS 9
-#define NO_FREE_TFI 0xffffffff
 
 /* see bts->gsmtap_categ_mask */
 enum pcu_gsmtap_category {
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 3579f55..1f08e92 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -36,23 +36,6 @@
 /* Consider a PDCH as idle if has at most this number of TBFs assigned to it */
 #define PDCH_IDLE_TBF_THRESH	1
 
-static inline int8_t find_free_tfi(const struct gprs_rlcmac_pdch *pdch, enum gprs_rlcmac_tbf_direction dir)
-{
-	uint32_t tfi_map = pdch->assigned_tfi(dir);
-	int8_t tfi;
-
-	if (tfi_map == NO_FREE_TFI)
-		return -1;
-
-	/* look for USF, don't use USF=7 */
-	for (tfi = 0; tfi < 32; tfi++) {
-		if (!(tfi_map & (1 << tfi)))
-			return tfi;
-	}
-
-	return -1;
-}
-
 static uint8_t find_possible_pdchs(const struct gprs_rlcmac_trx *trx, uint8_t max_slots, uint8_t mask,
 				   const char *mask_reason = NULL)
 {
@@ -161,7 +144,7 @@
 			/* We have found a candidate */
 			/* Make sure that a TFI is available */
 			if (free_tfi) {
-				tfi = find_free_tfi(pdch, dir);
+				tfi = find_free_tfi(pdch->assigned_tfi(dir));
 				if (tfi < 0) {
 					LOGP(DRLCMAC, LOGL_DEBUG,
 					     "- Skipping TS %d, because no TFI available\n", ts);
diff --git a/src/mslot_class.c b/src/mslot_class.c
index 8a0dd93..2a482f1 100644
--- a/src/mslot_class.c
+++ b/src/mslot_class.c
@@ -230,6 +230,22 @@
 	return -1;
 }
 
+/* look for USF, don't use USF=7 */
+int8_t find_free_tfi(uint32_t tfi_map)
+{
+	int8_t tfi;
+
+	if (tfi_map == NO_FREE_TFI)
+		return -1;
+
+	for (tfi = 0; tfi < 32; tfi++) {
+		if (!(tfi_map & (1 << tfi)))
+			return tfi;
+	}
+
+	return -1;
+}
+
 void masked_override_with(char *buf, uint8_t mask, char set_char)
 {
 	int i;
diff --git a/src/mslot_class.h b/src/mslot_class.h
index 80b2ef6..045fb31 100644
--- a/src/mslot_class.h
+++ b/src/mslot_class.h
@@ -36,6 +36,8 @@
 
 #define DEFAULT_MSLOT_CLASS 12
 
+#define NO_FREE_TFI 0xffffffff
+
 enum { MASK_TT = 0, MASK_TR = 1 };
 
 /* multislot class selection routines */
@@ -52,6 +54,7 @@
 /* multislot allocation helper routines */
 void mslot_fill_rx_mask(uint8_t mslot_class, uint8_t num_tx, uint8_t *rx_mask);
 int8_t find_free_usf(uint8_t usf_map);
+int8_t find_free_tfi(uint32_t tfi_map);
 void masked_override_with(char *buf, uint8_t mask, char set_char);
 void ts_format(char *buf, uint8_t dl_mask, uint8_t ul_mask);
 uint16_t mslot_wrap_window(uint16_t win);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie154866900453d232a890f7b9a30911b451525a1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list