sched: Pass the current TS to the control create functions

Currently the checks in that function are based on the different
internal TS values of a TBF. It is assumed that they match the TS
that the current RTS refers to.

This commit adds a TS parameter to create_ul_ass, create_dl_ass,
and create_ul_ack to make this more explicit.

Sponsored-by: On-Waves ehf
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 4939efd..140a0be 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -131,11 +131,11 @@
 			continue;
 
 		if (tbf == ul_ass_tbf)
-			msg = ul_ass_tbf->create_ul_ass(fn);
+			msg = ul_ass_tbf->create_ul_ass(fn, ts);
 		else if (tbf == dl_ass_tbf)
-			msg = dl_ass_tbf->create_dl_ass(fn);
+			msg = dl_ass_tbf->create_dl_ass(fn, ts);
 		else if (tbf == ul_ack_tbf)
-			msg = ul_ack_tbf->create_ul_ack(fn);
+			msg = ul_ack_tbf->create_ul_ack(fn, ts);
 		else
 			abort();
 
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 8018347..f73f1e0 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -855,16 +855,16 @@
 	return 0;
 }
 
-struct msgb *gprs_rlcmac_tbf::create_dl_ass(uint32_t fn)
+struct msgb *gprs_rlcmac_tbf::create_dl_ass(uint32_t fn, uint8_t ts)
 {
 	struct msgb *msg;
 	struct gprs_rlcmac_dl_tbf *new_dl_tbf = NULL;
 	int poll_ass_dl = 1;
 
-	if (direction == GPRS_RLCMAC_DL_TBF && control_ts != first_common_ts) {
+	if (direction == GPRS_RLCMAC_DL_TBF && ts != first_common_ts) {
 		LOGP(DRLCMAC, LOGL_NOTICE, "Cannot poll for downlink "
-			"assigment, because MS cannot reply. (control TS=%d, "
-			"first common TS=%d)\n", control_ts,
+			"assigment, because MS cannot reply. (TS=%d, "
+			"first common TS=%d)\n", ts,
 			first_common_ts);
 		poll_ass_dl = 0;
 	}
@@ -875,7 +875,7 @@
 				"assignment...\n", tbf_name(this));
 				return NULL;
 		}
-		if (bts->sba()->find(trx->trx_no, control_ts, (fn + 13) % 2715648)) {
+		if (bts->sba()->find(trx->trx_no, ts, (fn + 13) % 2715648)) {
 			LOGP(DRLCMACUL, LOGL_DEBUG, "Polling is already "
 				"scheduled for single block allocation...\n");
 			return NULL;
@@ -951,7 +951,7 @@
 	return msg;
 }
 
-struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn)
+struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn, uint8_t ts)
 {
 	struct msgb *msg;
 	struct gprs_rlcmac_ul_tbf *new_tbf = NULL;
@@ -962,7 +962,7 @@
 			"assignment...\n", tbf_name(this));
 			return NULL;
 	}
-	if (bts->sba()->find(trx->trx_no, control_ts, (fn + 13) % 2715648)) {
+	if (bts->sba()->find(trx->trx_no, ts, (fn + 13) % 2715648)) {
 		LOGP(DRLCMACUL, LOGL_DEBUG, "Polling is already scheduled for "
 			"single block allocation...\n");
 			return NULL;
diff --git a/src/tbf.h b/src/tbf.h
index 957baed..835d2c4 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -101,8 +101,8 @@
 
 	const char *name() const;
 
-	struct msgb *create_dl_ass(uint32_t fn);
-	struct msgb *create_ul_ass(uint32_t fn);
+	struct msgb *create_dl_ass(uint32_t fn, uint8_t ts);
+	struct msgb *create_ul_ass(uint32_t fn, uint8_t ts);
 
 	GprsMs *ms() const;
 	void set_ms(GprsMs *ms);
@@ -413,7 +413,7 @@
 struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf {
 	gprs_rlcmac_ul_tbf(BTS *bts);
 
-	struct msgb *create_ul_ack(uint32_t fn);
+	struct msgb *create_ul_ack(uint32_t fn, uint8_t ts);
 
 	/* blocks were acked */
 	int rcv_data_block_acknowledged(
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index 1d0b168..1ccfa27 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -87,7 +87,7 @@
 }
 
 
-struct msgb *gprs_rlcmac_ul_tbf::create_ul_ack(uint32_t fn)
+struct msgb *gprs_rlcmac_ul_tbf::create_ul_ack(uint32_t fn, uint8_t ts)
 {
 	int final = (state_is(GPRS_RLCMAC_FINISHED));
 	struct msgb *msg;
@@ -99,7 +99,7 @@
 				"final uplink ack...\n", tbf_name(this));
 			return NULL;
 		}
-		if (bts->sba()->find(trx->trx_no, control_ts, (fn + 13) % 2715648)) {
+		if (bts->sba()->find(trx->trx_no, ts, (fn + 13) % 2715648)) {
 			LOGP(DRLCMACUL, LOGL_DEBUG, "Polling is already "
 				"scheduled for single block allocation...\n");
 			return NULL;