Pass gprc_rlcmac_pdch to tbf_set_polling

Change-Id: I5ecc57c72e7f60e31e64e76e724d7a5a95968c40
diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c
index cc75238..0719d2c 100644
--- a/src/nacc_fsm.c
+++ b/src/nacc_fsm.c
@@ -202,7 +202,7 @@
 	LOGP(DNACC, LOGL_DEBUG, "------------------------- TX : Packet Cell Change Continue -------------------------\n");
 	rate_ctr_inc(rate_ctr_group_get_ctr(bts_rate_counters(ms->bts), CTR_PKT_CELL_CHG_CONTINUE));
 	talloc_free(mac_control_block);
-	tbf_set_polling(tbf, *new_poll_fn, data->pdch->ts_no, PDCH_ULC_POLL_CELL_CHG_CONTINUE);
+	tbf_set_polling(tbf, data->pdch, *new_poll_fn, PDCH_ULC_POLL_CELL_CHG_CONTINUE);
 	LOGPTBF(tbf, LOGL_DEBUG,
 	     "Scheduled 'Packet Cell Change Continue' polling on PACCH (FN=%d, TS=%d)\n",
 	     *new_poll_fn, data->pdch->ts_no);
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 70e3e6c..9e03089 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -458,14 +458,6 @@
 	osmo_timer_schedule(&Tarr[t], sec, microsec);
 }
 
-void gprs_rlcmac_tbf::set_polling(uint32_t new_poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason reason)
-{
-	/* schedule polling */
-	if (pdch_ulc_reserve_tbf_poll(trx->pdch[ts].ulc, new_poll_fn, this, reason) < 0)
-		LOGPTBF(this, LOGL_ERROR, "Failed scheduling poll on PACCH (FN=%d, TS=%d)\n",
-			  new_poll_fn, ts);
-}
-
 void gprs_rlcmac_tbf::poll_timeout(struct gprs_rlcmac_pdch *pdch, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason)
 {
 	gprs_rlcmac_ul_tbf *ul_tbf;
@@ -843,9 +835,12 @@
 	return 0;
 }
 
-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_set_polling(struct gprs_rlcmac_tbf *tbf, const struct gprs_rlcmac_pdch *pdch, uint32_t new_poll_fn, enum pdch_ulc_tbf_poll_reason t)
 {
-	return tbf->set_polling(new_poll_fn, ts, t);
+	/* schedule polling */
+	if (pdch_ulc_reserve_tbf_poll(pdch->ulc, new_poll_fn, tbf, t) < 0)
+		LOGPTBF(tbf, LOGL_ERROR, "FN=%u Failed scheduling poll on PACCH %s\n",
+			  new_poll_fn, pdch_name(pdch));
 }
 
 void tbf_poll_timeout(struct gprs_rlcmac_tbf *tbf, struct gprs_rlcmac_pdch *pdch, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason)
diff --git a/src/tbf.h b/src/tbf.h
index 1d5d4f1..b033590 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -140,7 +140,7 @@
 bool tbf_is_egprs_enabled(const struct gprs_rlcmac_tbf *tbf);
 void tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf);
 int tbf_check_polling(const struct gprs_rlcmac_tbf *tbf, const struct gprs_rlcmac_pdch *pdch, uint32_t fn, 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_set_polling(struct gprs_rlcmac_tbf *tbf, const struct gprs_rlcmac_pdch *pdch, uint32_t new_poll_fn, enum pdch_ulc_tbf_poll_reason t);
 void tbf_poll_timeout(struct gprs_rlcmac_tbf *tbf, struct gprs_rlcmac_pdch *pdch, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason);
 void tbf_update_state_fsm_name(struct gprs_rlcmac_tbf *tbf);
 const char* tbf_rlcmac_diag(const struct gprs_rlcmac_tbf *tbf);
@@ -188,7 +188,6 @@
 	void t_stop(enum tbf_timers t, const char *reason);
 	void t_start(enum tbf_timers t, int T, const char *reason, bool force,
 		     const char *file, unsigned line);
-	void set_polling(uint32_t poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason reason);
 	void poll_timeout(struct gprs_rlcmac_pdch *pdch, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason);
 
 	/** tlli handling */
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 25aea48..f799cb0 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -805,7 +805,7 @@
 
 		rc = tbf_check_polling(this, pdch, fn, &new_poll_fn, &rrbp);
 		if (rc >= 0) {
-			set_polling(new_poll_fn, pdch->ts_no, PDCH_ULC_POLL_DL_ACK);
+			tbf_set_polling(this, pdch, new_poll_fn, PDCH_ULC_POLL_DL_ACK);
 			LOGPTBFDL(this, LOGL_DEBUG,
 				  "Scheduled DL Acknowledgement polling on PACCH (FN=%d, TS=%d)\n",
 				  new_poll_fn, pdch->ts_no);
diff --git a/src/tbf_dl_ass_fsm.c b/src/tbf_dl_ass_fsm.c
index 6a1bc92..dec7042 100644
--- a/src/tbf_dl_ass_fsm.c
+++ b/src/tbf_dl_ass_fsm.c
@@ -113,7 +113,7 @@
 	LOGP(DTBF, LOGL_DEBUG, "------------------------- TX : Packet Downlink Assignment -------------------------\n");
 	bts_do_rate_ctr_inc(ms->bts, CTR_PKT_DL_ASSIGNMENT);
 
-	tbf_set_polling(ctx->tbf, new_poll_fn, d->pdch->ts_no, PDCH_ULC_POLL_DL_ASS);
+	tbf_set_polling(ctx->tbf, d->pdch, new_poll_fn, PDCH_ULC_POLL_DL_ASS);
 	LOGPTBF(ctx->tbf, LOGL_INFO, "Scheduled DL Assignment polling on PACCH (FN=%d, TS=%d)\n",
 		  new_poll_fn, d->pdch->ts_no);
 
diff --git a/src/tbf_ul_ack_fsm.c b/src/tbf_ul_ack_fsm.c
index a188b08..e2299d4 100644
--- a/src/tbf_ul_ack_fsm.c
+++ b/src/tbf_ul_ack_fsm.c
@@ -93,7 +93,7 @@
 		osmo_fsm_inst_dispatch(tbf_state_fi(ul_tbf_as_tbf(ctx->tbf)), TBF_EV_CONTENTION_RESOLUTION_MS_SUCCESS, NULL);
 
 	if (final) {
-		tbf_set_polling(ul_tbf_as_tbf(tbf), new_poll_fn, d->pdch->ts_no, PDCH_ULC_POLL_UL_ACK);
+		tbf_set_polling(ul_tbf_as_tbf(tbf), d->pdch, new_poll_fn, PDCH_ULC_POLL_UL_ACK);
 		LOGPTBFUL(tbf, LOGL_DEBUG,
 			"Scheduled UL Acknowledgement polling on PACCH (FN=%d, TS=%d)\n",
 			new_poll_fn, d->pdch->ts_no);
diff --git a/src/tbf_ul_ass_fsm.c b/src/tbf_ul_ass_fsm.c
index 8f2b70c..e15f21c 100644
--- a/src/tbf_ul_ass_fsm.c
+++ b/src/tbf_ul_ass_fsm.c
@@ -128,7 +128,7 @@
 	LOGP(DTBF, LOGL_DEBUG, "------------------------- TX : Packet Uplink Assignment -------------------------\n");
 	bts_do_rate_ctr_inc(ms->bts, CTR_PKT_UL_ASSIGNMENT);
 
-	tbf_set_polling(ctx->tbf, new_poll_fn, d->pdch->ts_no, PDCH_ULC_POLL_UL_ASS);
+	tbf_set_polling(ctx->tbf, d->pdch, new_poll_fn, PDCH_ULC_POLL_UL_ASS);
 	LOGPTBF(ctx->tbf, LOGL_INFO, "Scheduled UL Assignment polling on PACCH (FN=%d, TS=%d)\n",
 		  new_poll_fn, d->pdch->ts_no);