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/src/bts.h b/src/bts.h
index f947a55..6bf62c7 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -32,6 +32,7 @@
 #include <osmocom/core/rate_ctr.h>
 #include <osmocom/core/stat_item.h>
 #include <osmocom/core/tdef.h>
+#include <osmocom/core/time_cc.h>
 #include <osmocom/gprs/gprs_ns2.h>
 #include <osmocom/gsm/l1sap.h>
 #include <osmocom/gsm/protocol/gsm_04_08.h>
@@ -84,6 +85,7 @@
 
 
 enum {
+	CTR_PDCH_ALL_ALLOCATED,
 	CTR_TBF_DL_ALLOCATED,
 	CTR_TBF_DL_FREED,
 	CTR_TBF_DL_ABORTED,
@@ -278,6 +280,8 @@
 
 	/* List of struct bts_pch_timer for active PCH pagings */
 	struct llist_head pch_timer;
+
+	struct osmo_time_cc all_allocated_pdch;
 };
 
 #ifdef __cplusplus
@@ -381,6 +385,7 @@
 bool bts_cs_dl_is_supported(const struct gprs_rlcmac_bts *bts, enum CodingScheme cs);
 const struct llist_head* bts_ms_list(struct gprs_rlcmac_bts *bts);
 uint8_t bts_get_ms_pwr_alpha(const struct gprs_rlcmac_bts *bts);
+bool bts_all_pdch_allocated(const struct gprs_rlcmac_bts *bts);
 #ifdef __cplusplus
 }
 #endif