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>2013-12-26 10:22:18 +0100
commit0dbe724de208691129180b5d8ec07620092fe7bc (patch)
tree1acfbf496def486c1590710e029dee8739ad1df0
parent73a45d67593f74dbbfb729c238e4ecc6f6cf8983 (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 f270874..c612f3e 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);