alloc: Introduce a backpointer from the tbf to the trx and simplify code

Kill all the level of indirections where one needs to have the BTS
the TBF to find the TRX.
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 949041a..0cc0f37 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -98,12 +98,12 @@
 }
 
 
-static void assign_uplink_tbf_usf(struct gprs_rlcmac_bts *bts,
+static void assign_uplink_tbf_usf(
 				struct gprs_rlcmac_pdch *pdch,
 				int ts,
 				struct gprs_rlcmac_tbf *tbf, int8_t usf)
 {
-	bts->trx[tbf->trx_no].ul_tbf[tbf->tfi] = tbf;
+	tbf->trx->ul_tbf[tbf->tfi] = tbf;
 	pdch->ul_tbf[tbf->tfi] = tbf;
 	tbf->pdch[ts] = pdch;
 	tbf->dir.ul.usf[ts] = usf;
@@ -126,7 +126,7 @@
 		"%d\n", tbf->ms_class);
 
 	for (ts = 0; ts < 8; ts++) {
-		pdch = &bts->trx[tbf->trx_no].pdch[ts];
+		pdch = &tbf->trx->pdch[ts];
 		if (!pdch->enable) {
 			LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, because "
 				"not enabled\n", ts);
@@ -148,10 +148,10 @@
 		}
 		LOGP(DRLCMAC, LOGL_DEBUG, "- Assign uplink "
 			"TS=%d USF=%d\n", ts, usf);
-		assign_uplink_tbf_usf(bts, pdch, ts, tbf, usf);
+		assign_uplink_tbf_usf(pdch, ts, tbf, usf);
 	} else {
 		LOGP(DRLCMAC, LOGL_DEBUG, "- Assign downlink TS=%d\n", ts);
-		bts->trx[tbf->trx_no].dl_tbf[tbf->tfi] = tbf;
+		tbf->trx->dl_tbf[tbf->tfi] = tbf;
 		pdch->dl_tbf[tbf->tfi] = tbf;
 		tbf->pdch[ts] = pdch;
 	}
@@ -280,7 +280,7 @@
 	 * This must be done for uplink TBF also, because it is the basis
 	 * for calculating control slot and uplink slot(s). */
 	for (ts = 0, i = 0; ts < 8; ts++) {
-		pdch = &bts->trx[tbf->trx_no].pdch[ts];
+		pdch = &tbf->trx->pdch[ts];
 		/* check if enabled */
 		if (!pdch->enable) {
 			LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, because "
@@ -436,7 +436,7 @@
 	 * slot. */
 	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
 		for (ts = tx_win_min, i = 0; i < tx_range; ts = (ts + 1) & 7) {
-			pdch = &bts->trx[tbf->trx_no].pdch[ts];
+			pdch = &tbf->trx->pdch[ts];
 			/* check if enabled */
 			if (!pdch->enable) {
 				LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, "
@@ -508,7 +508,7 @@
 		/* assign the first common ts, which is used for control or
 		 * single slot. */
 		for (ts = tx_win_min, i = 0; i < tx_range; ts = (ts + 1) & 7) {
-			pdch = &bts->trx[tbf->trx_no].pdch[ts];
+			pdch = &tbf->trx->pdch[ts];
 			/* check if enabled */
 			if (!pdch->enable) {
 				LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, "
@@ -541,8 +541,8 @@
 					continue;
 				LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning DL TS "
 					"%d\n", ts);
-				pdch = &bts->trx[tbf->trx_no].pdch[ts];
-				bts->trx[tbf->trx_no].dl_tbf[tbf->tfi] = tbf;
+				pdch = &tbf->trx->pdch[ts];
+				tbf->trx->dl_tbf[tbf->tfi] = tbf;
 				pdch->dl_tbf[tbf->tfi] = tbf;
 				tbf->pdch[ts] = pdch;
 				slotcount++;
@@ -563,8 +563,8 @@
 			if ((tx_window & (1 << ts))) {
 				LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning UL TS "
 					"%d\n", ts);
-				pdch = &bts->trx[tbf->trx_no].pdch[ts];
-				assign_uplink_tbf_usf(bts, pdch, ts, tbf, usf[ts]);
+				pdch = &tbf->trx->pdch[ts];
+				assign_uplink_tbf_usf(pdch, ts, tbf, usf[ts]);
 				slotcount++;
 				if (slotcount == 1)
 					tbf->first_ts = ts;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index ddb3fbb..9afa85d 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -503,6 +503,7 @@
 	tbf->direction = dir;
 	tbf->tfi = tfi;
 	tbf->trx_no = trx;
+	tbf->trx = &bts->trx[trx];
 	tbf->arfcn = bts->trx[trx].arfcn;
 	tbf->ms_class = ms_class;
 	tbf->ws = 64;
diff --git a/src/tbf.h b/src/tbf.h
index 0b97f80..f75121c 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -103,6 +103,7 @@
 	uint8_t tfi;
 	uint32_t tlli;
 	uint8_t tlli_valid;
+	struct gprs_rlcmac_trx *trx;
 	uint8_t trx_no;
 	uint16_t arfcn;
 	uint8_t tsc;