tbf: Move TFI selection into alloc_algorithm

Currently the TFI and the TRX have to be determined before the actual TBF
allocation function is called, passing TFI and TRX number as
parameters. This does fit to TFI reuse for different slots, since
this were tightly coupled with the slot selection.

This commit just moves the TFI selection into the alloc_algorithm
functions. The tfi parameter is removed from the the TFI alloc
functions. The trx parameter is changed into use_trx to optionally
limit the trx selection (same semantics like in tfi_find_free).

Sponsored-by: On-Waves ehf
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index cf03d33..cdd02ba 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -139,12 +139,11 @@
 				const uint8_t ms_class,
 				struct gprs_rlcmac_dl_tbf **tbf)
 {
-	uint8_t trx, ss;
+	uint8_t ss;
 	int8_t use_trx;
 	uint16_t ta = 0;
 	struct gprs_rlcmac_ul_tbf *ul_tbf = NULL, *old_ul_tbf;
 	struct gprs_rlcmac_dl_tbf *dl_tbf = NULL;
-	int8_t tfi; /* must be signed */
 	GprsMs *ms;
 
 	/* check for uplink data, so we copy our informations */
@@ -170,10 +169,8 @@
 
 	// Create new TBF (any TRX)
 #warning "Copy and paste with alloc_ul_tbf"
-	tfi = bts->bts->tfi_find_free(GPRS_RLCMAC_DL_TBF, &trx, use_trx);
-	if (tfi >= 0)
-		/* set number of downlink slots according to multislot class */
-		dl_tbf = tbf_alloc_dl_tbf(bts, ms, tfi, trx, ms_class, ss);
+	/* set number of downlink slots according to multislot class */
+	dl_tbf = tbf_alloc_dl_tbf(bts, ms, use_trx, ms_class, ss);
 
 	if (!dl_tbf) {
 		LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");
@@ -842,16 +839,12 @@
 
 void gprs_rlcmac_dl_tbf::reuse_tbf()
 {
-	uint8_t trx;
 	struct gprs_rlcmac_dl_tbf *new_tbf = NULL;
-	int8_t tfi; /* must be signed */
 
 	bts->tbf_reused();
 
-	tfi = bts->tfi_find_free(GPRS_RLCMAC_DL_TBF, &trx, this->trx->trx_no);
-	if (tfi >= 0)
-		new_tbf = tbf_alloc_dl_tbf(bts->bts_data(), ms(), tfi, trx,
-			ms_class(), 0);
+	new_tbf = tbf_alloc_dl_tbf(bts->bts_data(), ms(),
+		this->trx->trx_no, ms_class(), 0);
 
 	if (!new_tbf) {
 		LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");