diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index 338362c6..1819b5b5 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -551,9 +551,11 @@ static int find_multi_slots(struct gprs_rlcmac_bts *bts, } /* Only consider common slots for UL */ if (tx_window & rx_window & (1 << ts)) { - c = 32 - pdch->num_reserved(GPRS_RLCMAC_UL_TBF); - c = OSMO_MAX(c, 1); - capacity += c; + if (find_free_usf(pdch) >= 0) { + c = 32 - pdch->num_reserved(GPRS_RLCMAC_UL_TBF); + c = OSMO_MAX(c, 1); + capacity += c; + } } } diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 10352cfc..874f9070 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -565,18 +565,18 @@ static void test_successive_allocation() test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_UL_AND_DL, 32, "algorithm A (UL and DL)"); test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_UL_AND_DL, - 30, "algorithm B class 10 (UL and DL)"); + 32, "algorithm B class 10 (UL and DL)"); test_successive_allocation(alloc_algorithm_b, 12, 12, TEST_MODE_UL_AND_DL, - 30, "algorithm B class 12 (UL and DL)"); + 32, "algorithm B class 12 (UL and DL)"); test_successive_allocation(alloc_algorithm_b, 1, 12, TEST_MODE_UL_AND_DL, 32, "algorithm B class 1-12 (UL and DL)"); test_successive_allocation(alloc_algorithm_b, 1, 29, TEST_MODE_UL_AND_DL, - 27, "algorithm B class 1-29 (UL and DL)"); + 32, "algorithm B class 1-29 (UL and DL)"); test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_DL_AND_UL, 32, "algorithm A (DL and UL)"); test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_DL_AND_UL, - 15, "algorithm B class 10 (DL and UL)"); + 32, "algorithm B class 10 (DL and UL)"); test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_DL_AFTER_UL, 32, "algorithm A (DL after UL)"); @@ -586,12 +586,12 @@ static void test_successive_allocation() test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_UL_AFTER_DL, 32, "algorithm A (UL after DL)"); test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_UL_AFTER_DL, - 30, "algorithm B class 10 (UL after DL)"); + 32, "algorithm B class 10 (UL after DL)"); test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_UL_ONLY, 32, "algorithm A (UL only)"); test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_UL_ONLY, - 30, "algorithm B class 10 (UL only)"); + 32, "algorithm B class 10 (UL only)"); test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_DL_ONLY, 32, "algorithm A (DL ONLY)"); diff --git a/tests/alloc/AllocTest.err b/tests/alloc/AllocTest.err index 49ae1541..af9b1340 100644 --- a/tests/alloc/AllocTest.err +++ b/tests/alloc/AllocTest.err @@ -3,17 +3,17 @@ No TFI available. No TFI available. - Failed to allocate a TS, no USF available No TFI available. -No USF available -No USF available -No TFI available. -No USF available -No TFI available. -No USF available No TFI available. No TFI available. No TFI available. -No USF available -No TFI available. -No USF available +No TFI available. +No TFI available. +No TFI available. +No TFI available. +No TFI available. +No TFI available. +No TFI available. +No TFI available. +No TFI available. No TFI available. No TFI available. diff --git a/tests/alloc/AllocTest.ok b/tests/alloc/AllocTest.ok index 8e9620a3..cfd0441c 100644 --- a/tests/alloc/AllocTest.ok +++ b/tests/alloc/AllocTest.ok @@ -8649,11 +8649,13 @@ Going to test assignment with many TBF, algorithm B class 10 (UL and DL) TBF[23] class 10 reserves .....DDC TBF[24] class 10 reserves ...DCD.. TBF[25] class 10 reserves .....DCD - TBF[26] class 10 reserves ...CD... - TBF[27] class 10 reserves .....DDC - TBF[28] class 10 reserves ...CD... - TBF[29] class 10 reserves ...DDC.. - Successfully allocated 30 UL TBFs + TBF[26] class 10 reserves ...DDCD. + TBF[27] class 10 reserves ...CD... + TBF[28] class 10 reserves .....DDC + TBF[29] class 10 reserves ...CD... + TBF[30] class 10 reserves ...CD... + TBF[31] class 10 reserves ...CD... + Successfully allocated 32 UL TBFs Going to test assignment with many TBF, algorithm B class 12 (UL and DL) TBF[0] class 12 reserves ...DDCD. TBF[1] class 12 reserves .....DCD @@ -8681,11 +8683,13 @@ Going to test assignment with many TBF, algorithm B class 12 (UL and DL) TBF[23] class 12 reserves .....DDC TBF[24] class 12 reserves ...DCD.. TBF[25] class 12 reserves .....DCD - TBF[26] class 12 reserves ...CD... - TBF[27] class 12 reserves .....DDC + TBF[26] class 12 reserves ...DDCD. + TBF[27] class 12 reserves ....DDDC TBF[28] class 12 reserves ...CD... - TBF[29] class 12 reserves ...DDC.. - Successfully allocated 30 UL TBFs + TBF[29] class 12 reserves ...CD... + TBF[30] class 12 reserves ...CD... + TBF[31] class 12 reserves ...CD... + Successfully allocated 32 UL TBFs Going to test assignment with many TBF, algorithm B class 1-12 (UL and DL) TBF[0] class 1 reserves ...C.... TBF[1] class 2 reserves ....DC.. @@ -8748,7 +8752,12 @@ Going to test assignment with many TBF, algorithm B class 1-29 (UL and DL) TBF[24] class 25 reserves ....DDCD TBF[25] class 26 reserves ...DCDD. TBF[26] class 27 reserves ....DCDD - Successfully allocated 27 UL TBFs + TBF[27] class 28 reserves ...DDDDC + TBF[28] class 29 reserves ...DDDDC + TBF[29] class 1 reserves ...C.... + TBF[30] class 2 reserves ......DC + TBF[31] class 3 reserves ...C.... + Successfully allocated 32 UL TBFs Going to test assignment with many TBF, algorithm A (DL and UL) TBF[0] class 1 reserves ...C.... TBF[1] class 1 reserves ....C... @@ -8799,7 +8808,24 @@ Going to test assignment with many TBF, algorithm B class 10 (DL and UL) TBF[12] class 10 reserves ...DCD.. TBF[13] class 10 reserves .....DCD TBF[14] class 10 reserves ...DCD.. - Successfully allocated 15 UL TBFs + TBF[15] class 10 reserves ...DDCD. + TBF[16] class 10 reserves ...DDCD. + TBF[17] class 10 reserves ...DDCD. + TBF[18] class 10 reserves ...DDCD. + TBF[19] class 10 reserves ...DDCD. + TBF[20] class 10 reserves ...DDCD. + TBF[21] class 10 reserves .....DDC + TBF[22] class 10 reserves .....DDC + TBF[23] class 10 reserves .....DDC + TBF[24] class 10 reserves .....DDC + TBF[25] class 10 reserves .....DDC + TBF[26] class 10 reserves ...CD... + TBF[27] class 10 reserves .....DDC + TBF[28] class 10 reserves ...CD... + TBF[29] class 10 reserves ...CD... + TBF[30] class 10 reserves .....DDC + TBF[31] class 10 reserves ...CD... + Successfully allocated 32 UL TBFs Going to test assignment with many TBF, algorithm A (DL after UL) TBF[0] class 1 reserves ...C.... TBF[1] class 1 reserves ....C... @@ -8929,11 +8955,13 @@ Going to test assignment with many TBF, algorithm B class 10 (UL after DL) TBF[23] class 10 reserves .......U TBF[24] class 10 reserves ....U... TBF[25] class 10 reserves ......U. - TBF[26] class 10 reserves ...U.... - TBF[27] class 10 reserves .......U - TBF[28] class 10 reserves ...U.... - TBF[29] class 10 reserves .....U.. - Successfully allocated 30 UL TBFs + TBF[26] class 10 reserves .....U.. + TBF[27] class 10 reserves ...U.... + TBF[28] class 10 reserves .......U + TBF[29] class 10 reserves ...U.... + TBF[30] class 10 reserves ...U.... + TBF[31] class 10 reserves ...U.... + Successfully allocated 32 UL TBFs Going to test assignment with many TBF, algorithm A (UL only) TBF[0] class 1 reserves ...U.... TBF[1] class 1 reserves ....U... @@ -8995,11 +9023,13 @@ Going to test assignment with many TBF, algorithm B class 10 (UL only) TBF[23] class 10 reserves .......U TBF[24] class 10 reserves ....U... TBF[25] class 10 reserves ......U. - TBF[26] class 10 reserves ...U.... - TBF[27] class 10 reserves .......U - TBF[28] class 10 reserves ...U.... - TBF[29] class 10 reserves .....U.. - Successfully allocated 30 UL TBFs + TBF[26] class 10 reserves .....U.. + TBF[27] class 10 reserves ...U.... + TBF[28] class 10 reserves .......U + TBF[29] class 10 reserves ...U.... + TBF[30] class 10 reserves ...U.... + TBF[31] class 10 reserves ...U.... + Successfully allocated 32 UL TBFs Going to test assignment with many TBF, algorithm A (DL ONLY) TBF[0] class 1 reserves ...C.... TBF[1] class 1 reserves ....C...