Replace PollController with newly added PDCH UL Controller

TbfTest is updated to submit empty blocks to have somehow meaningful
output (at least as meaningful test results as before, not much). That's
because we must update bts->curr_fn to have polls expire.

Related: OS#5020
Change-Id: I683ca738ce5a133c49c36a1d94439a942d64a831
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 87ca5bd..7237f58 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -550,8 +550,7 @@
 int gprs_rlcmac_tbf::check_polling(uint32_t fn, uint8_t ts,
 	uint32_t *poll_fn_, unsigned int *rrbp_) const
 {
-	uint32_t new_poll_fn = next_fn(fn, 13);
-
+	int rc;
 	if (!is_control_ts(ts)) {
 		LOGPTBF(this, LOGL_DEBUG, "Polling cannot be "
 			"scheduled in this TS %d (first control TS %d)\n",
@@ -562,15 +561,13 @@
 		LOGPTBF(this, LOGL_DEBUG, "Polling is already scheduled\n");
 		return -EBUSY;
 	}
-	if (!pdch_ulc_fn_is_free(trx->pdch[ts].ulc, new_poll_fn)) {
-		LOGPTBF(this, LOGL_DEBUG, "Polling is already scheduled "
-			"for single block allocation at FN %d TS %d ...\n",
-			new_poll_fn, ts);
-		return -EBUSY;
-	}
 
-	*poll_fn_ = new_poll_fn;
-	*rrbp_ = 0;
+	if ((rc = pdch_ulc_get_next_free_rrbp_fn(trx->pdch[ts].ulc, fn, poll_fn_, rrbp_)) < 0) {
+		LOGPTBF(this, LOGL_DEBUG,
+			"(bts=%u,trx=%u,ts=%u) FN=%u No suitable free RRBP offset found!\n",
+			trx->bts->nr, trx->trx_no, ts, fn);
+		return rc;
+	}
 
 	return 0;
 }
@@ -591,6 +588,11 @@
 			  chan, new_poll_fn, ts);
 
 	/* schedule polling */
+	if (pdch_ulc_reserve_tbf_poll(trx->pdch[ts].ulc, new_poll_fn, this) < 0) {
+		LOGPTBFDL(this, LOGL_ERROR, "Failed scheduling poll on %s (FN=%d, TS=%d)\n",
+			  chan, poll_fn, ts);
+		return;
+	}
 	poll_state = GPRS_RLCMAC_POLL_SCHED;
 	poll_fn = new_poll_fn;
 	poll_ts = ts;
@@ -1230,3 +1232,8 @@
 {
 	return tbf->set_polling(new_poll_fn, ts, t);
 }
+
+void tbf_poll_timeout(struct gprs_rlcmac_tbf *tbf)
+{
+	tbf->poll_timeout();
+}