aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-02-05 16:11:36 +0100
committerMax <msuraev@sysmocom.de>2018-02-20 10:19:25 +0100
commitc5407c775adf176b127244f6c94ad189b39c2fc7 (patch)
tree5e4d3b7b91473b5f3a32d22042d4a3e37299c4f0
parent6dc90b8c86768a9b1beb429c610dcbae6488e21c (diff)
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
-rw-r--r--src/bts.h2
-rw-r--r--src/gprs_rlcmac_ts_alloc.cpp19
-rw-r--r--src/mslot_class.c16
-rw-r--r--src/mslot_class.h3
4 files changed, 21 insertions, 19 deletions
diff --git a/src/bts.h b/src/bts.h
index 9c753696..df81440c 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -28,6 +28,7 @@ extern "C" {
#include <osmocom/core/stat_item.h>
#include <osmocom/gsm/l1sap.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
+ #include <mslot_class.h>
}
#include <gsm_rlcmac.h>
@@ -45,7 +46,6 @@ extern "C" {
#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 29e41f5d..6791b037 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -62,23 +62,6 @@ static bool test_and_set_bit(uint32_t *bits, size_t elem)
return was_set;
}
-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 int find_possible_pdchs(const struct gprs_rlcmac_trx *trx, size_t max_slots, uint8_t mask,
const char *mask_reason = NULL)
{
@@ -187,7 +170,7 @@ static int find_least_busy_pdch(const struct gprs_rlcmac_trx *trx, enum gprs_rlc
/* 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 "
diff --git a/src/mslot_class.c b/src/mslot_class.c
index 6a7e25b7..d49d4119 100644
--- a/src/mslot_class.c
+++ b/src/mslot_class.c
@@ -229,6 +229,22 @@ int8_t find_free_usf(uint8_t usf_map)
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 c274337a..97b865b0 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,4 +54,5 @@ uint8_t mslot_class_max();
/* 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);