bts: Add counter availablePDCHAllocatedTime

We basically want to probe whether it's possible to allocate TBFs, or
whether we know it will fail due to all main resources being already in
use (TFI, USF).

Having bts_all_pdch_allocated() return false doesn't mean though that an
MS will be able to allocate a TBF for sure. That's because further
restrictions are applied based on MS: whether it was already attached to
a specific TRX, whether the ms_class allows for a certain multislot
combination, etc. However, it should provide a general idea on whether
for sure the PCU is unable to provide more allocations. More fine
grained state about failures can still be followed by looking at
tbf:alloc:failed:* rate counters.

Related: SYS#4878
Depends: Iabb17a08e6e1a86f168cdb008fba05ecd4776bdd (libosmocore)
Change-Id: Ie0f0c451558817bddc3fe1a0f0df531f14c9f1d3
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index 1f2bbda..6f3de43 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -152,6 +152,8 @@
 
 	OSMO_ASSERT(i == count);
 
+	OSMO_ASSERT(bts_all_pdch_allocated(bts));
+
 	for (i = 0; i < count; ++i)
 		if (tbfs[i])
 			tbf_free(tbfs[i]);
@@ -479,6 +481,7 @@
 			tbf_free(ms_ul_tbf(old_ms));
 		tbf = tbf_alloc_ul_tbf(bts, old_ms, trx_no, false);
 		if (tbf == NULL) {
+			OSMO_ASSERT(trx_no != -1 || bts_all_pdch_allocated(bts));
 			ms_unref(old_ms);
 			return NULL;
 		}
@@ -490,6 +493,7 @@
 			tbf_free(ms_dl_tbf(old_ms));
 		tbf = tbf_alloc_dl_tbf(bts, old_ms, trx_no, false);
 		if (tbf == NULL) {
+			OSMO_ASSERT(trx_no != -1 || bts_all_pdch_allocated(bts));
 			ms_unref(old_ms);
 			return NULL;
 		}