tbf: Get rid of attribute poll_fn

That field is not needed anymore, and it works only under the assumption
that only 1 poll request can be active at a time per TBF, which is not
true.

Change-Id: I63a34a702f028b871530fb7caeb13e8ea1cc78ac
diff --git a/src/bts.cpp b/src/bts.cpp
index 0443df6..b61c6b4 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1086,10 +1086,8 @@
 		/* limit target TA in range 0..63 bits */
 		ta_target = ta_limit(ta_adj);
 
-		LOGP(DL1IF, LOGL_INFO, "PH-DATA-IND is updating TLLI=0x%08x: TA %u -> %u on "
-				"TRX = %d, TS = %d, FN = %d\n",
-				tbf->tlli(), tbf->ta(), ta_target,
-				tbf->trx->trx_no , tbf->poll_ts, tbf->poll_fn);
+		LOGP(DL1IF, LOGL_INFO, "PH-DATA-IND is updating %s: TA %u -> %u on "
+		     "TRX = %d\n", tbf_name(tbf), tbf->ta(), ta_target, tbf->trx->trx_no);
 		tbf->set_ta(ta_target);
 	}
 }
@@ -1103,10 +1101,8 @@
 		/* limit target TA in range 0..63 bits */
 		ta_target = ta_limit(ta);
 
-		LOGP(DL1IF, LOGL_INFO, "PH-RA-IND is updating TLLI=0x%08x: TA %u -> %u on "
-				"TRX = %d, TS = %d, FN = %d\n",
-				tbf->tlli(), tbf->ta(), ta_target,
-				tbf->trx->trx_no , tbf->poll_ts, tbf->poll_fn);
+		LOGP(DL1IF, LOGL_INFO, "PH-RA-IND is updating %s: TA %u -> %u on "
+		     "TRX = %d\n", tbf_name(tbf), tbf->ta(), ta_target, tbf->trx->trx_no);
 		tbf->set_ta(ta_target);
 	}
 }
diff --git a/src/pdch_ul_controller.c b/src/pdch_ul_controller.c
index 8fb5582..5911080 100644
--- a/src/pdch_ul_controller.c
+++ b/src/pdch_ul_controller.c
@@ -318,7 +318,7 @@
 			LOGPDCH(ulc->pdch, DRLCMAC, LOGL_NOTICE,
 				"Timeout for registered POLL (FN=%u): %s\n",
 				item->fn, tbf_name(item->tbf_poll.poll_tbf));
-			tbf_poll_timeout(item->tbf_poll.poll_tbf, item->tbf_poll.reason);
+			tbf_poll_timeout(item->tbf_poll.poll_tbf, item->fn, item->tbf_poll.reason);
 			break;
 		case PDCH_ULC_NODE_SBA:
 			sba = item->sba.sba;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 0ea0ceb..92dede5 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -125,7 +125,6 @@
 	first_ts(0),
 	first_common_ts(0),
 	control_ts(0xff),
-	poll_fn(0),
 	poll_ts(0),
 	fT(0),
 	num_fT_exp(0),
@@ -579,10 +578,9 @@
 	/* schedule polling */
 	if (pdch_ulc_reserve_tbf_poll(trx->pdch[ts].ulc, new_poll_fn, this, reason) < 0) {
 		LOGPTBFDL(this, LOGL_ERROR, "Failed scheduling poll on %s (FN=%d, TS=%d)\n",
-			  chan, poll_fn, ts);
+			  chan, new_poll_fn, ts);
 		return;
 	}
-	poll_fn = new_poll_fn;
 	poll_ts = ts;
 
 	switch (reason) {
@@ -590,32 +588,32 @@
 		ul_ass_state = GPRS_RLCMAC_UL_ASS_WAIT_ACK;
 
 		LOGPTBFDL(this, LOGL_INFO, "Scheduled UL Assignment polling on %s (FN=%d, TS=%d)\n",
-			  chan, poll_fn, poll_ts);
+			  chan, new_poll_fn, poll_ts);
 		break;
 	case PDCH_ULC_POLL_DL_ASS:
 		dl_ass_state = GPRS_RLCMAC_DL_ASS_WAIT_ACK;
 
 		LOGPTBFDL(this, LOGL_INFO, "Scheduled DL Assignment polling on %s (FN=%d, TS=%d)\n",
-			  chan, poll_fn, poll_ts);
+			  chan, new_poll_fn, poll_ts);
 		break;
 	case PDCH_ULC_POLL_UL_ACK:
 		ul_ack_state = GPRS_RLCMAC_UL_ACK_WAIT_ACK;
 
 		LOGPTBFUL(this, LOGL_DEBUG, "Scheduled UL Acknowledgement polling on %s (FN=%d, TS=%d)\n",
-			  chan, poll_fn, poll_ts);
+			  chan, new_poll_fn, poll_ts);
 		break;
 	case PDCH_ULC_POLL_DL_ACK:
 		LOGPTBFDL(this, LOGL_DEBUG, "Scheduled DL Acknowledgement polling on %s (FN=%d, TS=%d)\n",
-			  chan, poll_fn, poll_ts);
+			  chan, new_poll_fn, poll_ts);
 		break;
 	case PDCH_ULC_POLL_CELL_CHG_CONTINUE:
 		LOGPTBFDL(this, LOGL_DEBUG, "Scheduled 'Packet Cell Change Continue' polling on %s (FN=%d, TS=%d)\n",
-			  chan, poll_fn, poll_ts);
+			  chan, new_poll_fn, poll_ts);
 		break;
 	}
 }
 
-void gprs_rlcmac_tbf::poll_timeout(enum pdch_ulc_tbf_poll_reason reason)
+void gprs_rlcmac_tbf::poll_timeout(uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason)
 {
 	uint16_t pgroup;
 	gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(this);
@@ -1211,7 +1209,7 @@
 	return tbf->set_polling(new_poll_fn, ts, t);
 }
 
-void tbf_poll_timeout(struct gprs_rlcmac_tbf *tbf, enum pdch_ulc_tbf_poll_reason reason)
+void tbf_poll_timeout(struct gprs_rlcmac_tbf *tbf, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason)
 {
-	tbf->poll_timeout(reason);
+	tbf->poll_timeout(poll_fn, reason);
 }
diff --git a/src/tbf.h b/src/tbf.h
index cb5aac4..b0bec31 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -193,7 +193,7 @@
 int tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf);
 int tbf_check_polling(const struct gprs_rlcmac_tbf *tbf, uint32_t fn, uint8_t ts, uint32_t *poll_fn, unsigned int *rrbp);
 void tbf_set_polling(struct gprs_rlcmac_tbf *tbf, uint32_t new_poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason t);
-void tbf_poll_timeout(struct gprs_rlcmac_tbf *tbf, enum pdch_ulc_tbf_poll_reason reason);
+void tbf_poll_timeout(struct gprs_rlcmac_tbf *tbf, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason);
 #ifdef __cplusplus
 }
 #endif
@@ -251,7 +251,7 @@
 	int check_polling(uint32_t fn, uint8_t ts,
 		uint32_t *poll_fn, unsigned int *rrbp) const;
 	void set_polling(uint32_t poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason reason);
-	void poll_timeout(enum pdch_ulc_tbf_poll_reason reason);
+	void poll_timeout(uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason);
 
 	/** tlli handling */
 	uint32_t tlli() const;
@@ -292,7 +292,6 @@
 
 	gprs_llc m_llc;
 
-	uint32_t poll_fn; /* frame number to poll */
 	uint8_t poll_ts; /* TS to poll */
 
 	gprs_rlc m_rlc;
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 19415f1..c122bba 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -990,11 +990,11 @@
 			rlc.rrbp = rrbp;
 			rlc.es_p = 1; /* Polling */
 
-			m_last_dl_poll_fn = poll_fn;
+			m_last_dl_poll_fn = new_poll_fn;
 
 			LOGPTBFDL(this, LOGL_INFO,
 				  "Scheduled Ack/Nack polling on FN=%d, TS=%d\n",
-				  poll_fn, poll_ts);
+				  new_poll_fn, poll_ts);
 		}
 	}