tbf: Maintain the number of TBF per PDCH

Currently the PDCH object do not know anything about the TBFs using
them. To make the slot allocation load dependant, at least some
numbers are required.

This commit adds TBF counters (one per direction) and the related methods
attach_tbf, detach_tbf, and num_tbfs to gprs_rlcmac_pdch.

Sponsored-by: On-Waves ehf
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 9bdc1f7..ddc3b91 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -209,14 +209,17 @@
 {
 	int ts;
 
-	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
+	if (tbf->direction == GPRS_RLCMAC_UL_TBF)
 		tbf->trx->ul_tbf[tbf->tfi()] = NULL;
-		for (ts = 0; ts < 8; ts++)
-			tbf->pdch[ts] = NULL;
-	} else {
+	else
 		tbf->trx->dl_tbf[tbf->tfi()] = NULL;
-		for (ts = 0; ts < 8; ts++)
-			tbf->pdch[ts] = NULL;
+
+	for (ts = 0; ts < 8; ts++) {
+		if (!tbf->pdch[ts])
+			continue;
+
+		tbf->pdch[ts]->detach_tbf(tbf);
+		tbf->pdch[ts] = NULL;
 	}
 }