aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-02-19 17:31:24 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2021-02-19 17:32:14 +0100
commitdfbf3d2c0970088431b8cf7b3c133c23de50a736 (patch)
tree9e55b166a8024a16a51acce3e120ce828639c6d0
parent47a3b780dbc5a6bf302cb3325e2e38617f8e8a8c (diff)
find_multi_slots: Avoid multiple calls to mslot_class_get_rx()
-rw-r--r--src/gprs_rlcmac_ts_alloc.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 469ede38..1645b871 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -516,7 +516,8 @@ static bool skip_slot(uint8_t mslot_class, bool check_tr,
*/
int find_multi_slots(struct gprs_rlcmac_trx *trx, uint8_t mslot_class, uint8_t *ul_slots, uint8_t *dl_slots)
{
- uint8_t Tx = mslot_class_get_tx(mslot_class), /* Max number of Tx slots */
+ uint8_t Rx = mslot_class_get_rx(mslot_class), /* Max number of Rx slots */
+ Tx = mslot_class_get_tx(mslot_class), /* Max number of Tx slots */
Sum = mslot_class_get_sum(mslot_class), /* Max number of Tx + Rx slots */
max_slots, num_rx, num_tx, mask_sel, pdch_slots, ul_ts, dl_ts;
int16_t rx_window, tx_window;
@@ -534,7 +535,7 @@ int find_multi_slots(struct gprs_rlcmac_trx *trx, uint8_t mslot_class, uint8_t *
return -EINVAL;
}
- max_slots = OSMO_MAX(mslot_class_get_rx(mslot_class), Tx);
+ max_slots = OSMO_MAX(Rx, Tx);
if (*dl_slots == 0)
*dl_slots = 0xff;
@@ -590,7 +591,7 @@ int find_multi_slots(struct gprs_rlcmac_trx *trx, uint8_t mslot_class, uint8_t *
if ((tx_window & (1 << ((ul_ts+num_tx-1) % 8))) == 0)
continue;
- num_rx = OSMO_MIN(mslot_class_get_rx(mslot_class), Sum - num_tx);
+ num_rx = OSMO_MIN(Rx, Sum - num_tx);
rx_valid_win = (1 << num_rx) - 1;
/* Rotate group of RX slots: DDD-----, -DDD----, ..., DD-----D */