aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-12-25 21:03:42 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-15 10:39:08 +0100
commitdd4af8045f3306b8b59a1ba8319dc903ce00e550 (patch)
tree76da8755aeca4d7f730a42d37622eea7fe30d5bd
parente45c19b3e8f54c3d57757fc42dc6e6b0018cdd9f (diff)
alloc: Move upating of the rx window max for Type==1 to a new method
-rw-r--r--src/gprs_rlcmac_ts_alloc.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index f2708744..c612f3e6 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -334,6 +334,25 @@ static int reduce_rx_window(const int ms_type, const struct gprs_rlcmac_tbf *old
return 0;
}
+/*
+ * reduce window, to allow at least one uplink TX slot
+ * this is only required for Type 1
+ */
+static uint8_t update_rx_win_max(const int ms_type, const int Tt,
+ const int Tr, uint8_t rx_win_min, uint8_t rx_win_max)
+{
+ if (ms_type != 1)
+ return rx_win_max;
+
+ if (rx_win_max - rx_win_min + 1 + Tt + 1 + Tr > 8) {
+ rx_win_max = rx_win_min + 7 - Tt - 1 - Tr;
+ LOGP(DRLCMAC, LOGL_DEBUG, "- Reduce RX window due to time "
+ "contraints to %d slots\n", rx_win_max - rx_win_min + 1);
+ }
+
+ return rx_win_max;
+}
+
/* Slot Allocation: Algorithm B
*
@@ -415,16 +434,8 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
&rx_window, &rx_win_min, &rx_win_max);
if (rc < 0)
return rc;
-
- /* reduce window, to allow at least one uplink TX slot
- * this is only required for Type 1 */
- if (Type == 1 && rx_win_max - rx_win_min + 1 + Tt + 1 + Tr > 8) {
- rx_win_max = rx_win_min + 7 - Tt - 1 - Tr;
- LOGP(DRLCMAC, LOGL_DEBUG, "- Reduce RX window due to time "
- "contraints to %d slots\n",
- rx_win_max - rx_win_min + 1);
- }
-
+ rx_win_max = update_rx_win_max(ms_class->type, Tt, Tr,
+ rx_win_min, rx_win_max);
LOGP(DRLCMAC, LOGL_DEBUG, "- RX-Window is: %d..%d\n", rx_win_min,
rx_win_max);