aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_rlcmac_ts_alloc.cpp
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2014-01-04 15:42:38 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-15 10:39:08 +0100
commit1cd9d886e6328ad9a85f849f2c027bb4bb8d410e (patch)
tree0571264e9aa0667446a5ff4d6f8e241b4ebddbc1 /src/gprs_rlcmac_ts_alloc.cpp
parentfe2dcc8aecf4d2f9bab186e2619507659b85517e (diff)
alloc_algorithm_b: Add seperate function to shrink rx window when TS are removed
After reduce_rx_window() and update_rx_win_max() was called, one or more TS might be removed. tx_win_min and tx_win_max must be adjusted to the new range of allocated slots.
Diffstat (limited to 'src/gprs_rlcmac_ts_alloc.cpp')
-rw-r--r--src/gprs_rlcmac_ts_alloc.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index e1e2498d..58dd2e9b 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -320,25 +320,29 @@ static int reduce_rx_window(const int ms_type, const struct gprs_rlcmac_tbf *old
return -EBUSY;
}
+ return 0;
+}
+
+/* shrink range of rx_win_min and rx_win_max */
+static void shrink_rx_window(uint8_t *rx_win_min, uint8_t *rx_win_max, int rx_window)
+{
/* calculate new min/max */
for (uint8_t ts_no = *rx_win_min; ts_no <= *rx_win_max; ts_no++) {
- if ((*rx_window & (1 << ts_no)))
+ if ((rx_window & (1 << ts_no)))
break;
*rx_win_min = ts_no + 1;
- LOGP(DRLCMAC, LOGL_DEBUG, "- TS has been deleted, so "
+ LOGP(DRLCMAC, LOGL_DEBUG, "- TS is unused, so "
"raising start of DL window to %d\n",
*rx_win_min);
}
for (uint8_t ts_no = *rx_win_max; ts_no >= *rx_win_min; ts_no--) {
- if ((*rx_window & (1 << ts_no)))
+ if ((rx_window & (1 << ts_no)))
break;
*rx_win_max = ts_no - 1;
- LOGP(DRLCMAC, LOGL_DEBUG, "- TS has been deleted, so "
+ LOGP(DRLCMAC, LOGL_DEBUG, "- TS is unused, so "
"lowering end of DL window to %d\n",
*rx_win_max);
}
-
- return 0;
}
/*
@@ -590,8 +594,10 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
&rx_window, &rx_win_min, &rx_win_max);
if (rc < 0)
return rc;
+ shrink_rx_window(&rx_win_min, &rx_win_max, rx_window);
rx_win_max = update_rx_win_max(ms_class->type, Tt, Tr,
rx_win_min, rx_win_max);
+ shrink_rx_window(&rx_win_min, &rx_win_max, rx_window);
LOGP(DRLCMAC, LOGL_DEBUG, "- RX-Window is: %d..%d\n", rx_win_min,
rx_win_max);