diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-06-18 17:16:26 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-06-29 10:53:32 +0200 |
commit | e2e004e7a91a3cd680c11364d9cb8cd21c714a8b (patch) | |
tree | ef0260a7139092f77de07ff39765440fdbae8b30 /src/gprs_rlcmac_ts_alloc.cpp | |
parent | ace7b570a047b7ee36557091c10918240c4b8ff3 (diff) |
tbf: Pass the MS object around instead of old_tbf
Currently the old TBF (either uplink or downlink) is passed around at
TBF allocation mainly to get information about the MS. To implement
more complex allocation algorithms, the MS object itself will be
needed anyway.
This commit replaces the old_tbf arguments by MS object arguments.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/gprs_rlcmac_ts_alloc.cpp')
-rw-r--r-- | src/gprs_rlcmac_ts_alloc.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index e8bedadd..bae1ea5f 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -23,6 +23,7 @@ #include <gprs_debug.h> #include <bts.h> #include <tbf.h> +#include <gprs_ms.h> #include <errno.h> @@ -139,7 +140,7 @@ static void assign_dlink_tbf( * Assign single slot for uplink and downlink */ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, - struct gprs_rlcmac_tbf *old_tbf, + GprsMs *ms, struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single) { struct gprs_rlcmac_pdch *pdch; @@ -261,16 +262,21 @@ inc_window: return rx_window; } -static int reduce_rx_window(const int ms_type, const struct gprs_rlcmac_tbf *old_tbf, +static int reduce_rx_window(const int ms_type, const GprsMs *ms, const int Tt, const int Tr, int *rx_window, uint8_t *rx_win_min, uint8_t *rx_win_max) { + gprs_rlcmac_ul_tbf *ul_tbf; + if (ms_type != 1) return 0; - if (!old_tbf) + if (!ms) return 0; - if (old_tbf->direction != GPRS_RLCMAC_UL_TBF) + + ul_tbf = ms->ul_tbf(); + + if (!ul_tbf) return 0; uint8_t collide = 0, ul_usage = 0; @@ -278,7 +284,7 @@ static int reduce_rx_window(const int ms_type, const struct gprs_rlcmac_tbf *old /* calculate mask of colliding slots */ for (uint8_t ts_no = 0; ts_no < 8; ts_no++) { int j; - if (!old_tbf->pdch[ts_no]) + if (!ul_tbf->pdch[ts_no]) continue; ul_usage |= (1 << ts_no); @@ -525,7 +531,7 @@ static int select_first_ts(gprs_rlcmac_trx *trx, uint8_t tx_win_min, * */ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, - struct gprs_rlcmac_tbf *old_tbf, + GprsMs *ms, struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single) { const struct gprs_ms_multislot_class *ms_class; @@ -592,7 +598,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, /* reduce window, if existing uplink slots collide RX window */ - int rc = reduce_rx_window(ms_class->type, old_tbf, Tt, Tr, + int rc = reduce_rx_window(ms_class->type, ms, Tt, Tr, &rx_window, &rx_win_min, &rx_win_max); if (rc < 0) return rc; |