Change in osmo-pcu[master]: Simplify tbf::set_polling()

pespin gerrit-no-reply at lists.osmocom.org
Fri Jul 30 11:44:17 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/25111 )


Change subject: Simplify tbf::set_polling()
......................................................................

Simplify tbf::set_polling()

When setting a POLL, it will always happen on PACCH, so all the CCCH
part makes no sense there. Let's drop it and move the logging of each
ase to the caller, where logging file+line is more useful.

Change-Id: I242f97fd6f927131ac64c1a7c9c3812b6389de04
---
M src/nacc_fsm.c
M src/tbf.cpp
M src/tbf_dl.cpp
M src/tbf_dl.h
M src/tbf_dl_ass_fsm.c
M src/tbf_ul_ack_fsm.c
M src/tbf_ul_ass_fsm.c
7 files changed, 20 insertions(+), 46 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/11/25111/1

diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c
index 9a5f5b5..738b2c5 100644
--- a/src/nacc_fsm.c
+++ b/src/nacc_fsm.c
@@ -207,6 +207,8 @@
 	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->ts, PDCH_ULC_POLL_CELL_CHG_CONTINUE);
+	LOGPTBFDL(tbf, LOGL_DEBUG, "Scheduled 'Packet Cell Change Continue' polling on PACCH (FN=%d, TS=%d)\n",
+		  *new_poll_fn, data->ts);
 	return msg;
 
 free_ret:
diff --git a/src/tbf.cpp b/src/tbf.cpp
index b43ffde..acd191b 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -529,49 +529,10 @@
 
 void gprs_rlcmac_tbf::set_polling(uint32_t new_poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason reason)
 {
-	const char *chan = "UNKNOWN";
-
-	if (state_fsm.state_flags & (1 << (GPRS_RLCMAC_FLAG_CCCH)))
-		chan = "CCCH";
-
-	if (state_fsm.state_flags & (1 << (GPRS_RLCMAC_FLAG_PACCH)))
-		chan = "PACCH";
-
-	if ((state_fsm.state_flags & (1 << (GPRS_RLCMAC_FLAG_PACCH))) &&
-	    (state_fsm.state_flags & (1 << (GPRS_RLCMAC_FLAG_CCCH))))
-		LOGPTBFDL(this, LOGL_ERROR,
-			  "Attempt to schedule polling on %s (FN=%d, TS=%d) with both CCCH and PACCH flags set - FIXME!\n",
-			  chan, new_poll_fn, ts);
-
 	/* 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, new_poll_fn, ts);
-		return;
-	}
-
-	switch (reason) {
-	case PDCH_ULC_POLL_UL_ASS:
-		LOGPTBFDL(this, LOGL_INFO, "Scheduled UL Assignment polling on %s (FN=%d, TS=%d)\n",
-			  chan, new_poll_fn, ts);
-		break;
-	case PDCH_ULC_POLL_DL_ASS:
-		LOGPTBFDL(this, LOGL_INFO, "Scheduled DL Assignment polling on %s (FN=%d, TS=%d)\n",
-			  chan, new_poll_fn, ts);
-		break;
-	case PDCH_ULC_POLL_UL_ACK:
-		LOGPTBFUL(this, LOGL_DEBUG, "Scheduled UL Acknowledgement polling on %s (FN=%d, TS=%d)\n",
-			  chan, new_poll_fn, ts);
-		break;
-	case PDCH_ULC_POLL_DL_ACK:
-		LOGPTBFDL(this, LOGL_DEBUG, "Scheduled DL Acknowledgement polling on %s (FN=%d, TS=%d)\n",
-			  chan, new_poll_fn, 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, new_poll_fn, ts);
-		break;
-	}
+	if (pdch_ulc_reserve_tbf_poll(trx->pdch[ts].ulc, new_poll_fn, this, reason) < 0)
+		LOGPTBFDL(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)
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 905bf05..65785f2 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -958,6 +958,9 @@
 		rc = check_polling(fn, ts, &new_poll_fn, &rrbp);
 		if (rc >= 0) {
 			set_polling(new_poll_fn, ts, PDCH_ULC_POLL_DL_ACK);
+			LOGPTBFDL(this, LOGL_DEBUG,
+				  "Scheduled DL Acknowledgement polling on PACCH (FN=%d, TS=%d)\n",
+				  new_poll_fn, ts);
 
 			m_tx_counter = 0;
 			/* start timer whenever we send the final block */
diff --git a/src/tbf_dl.h b/src/tbf_dl.h
index 27b6a2c..d20ad75 100644
--- a/src/tbf_dl.h
+++ b/src/tbf_dl.h
@@ -38,8 +38,6 @@
 	DL_PRIO_CONTROL,   /* a control block needs to be sent */
 };
 
-#define LOGPTBFDL(tbf, level, fmt, args...) LOGP(DTBFDL, level, "%s " fmt, tbf_name(tbf), ## args)
-
 struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
 	gprs_rlcmac_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms);
 	~gprs_rlcmac_dl_tbf();
@@ -153,6 +151,8 @@
 		  const uint8_t *data, const uint16_t len);
 
 void tbf_dl_trigger_ass(struct gprs_rlcmac_dl_tbf *tbf, struct gprs_rlcmac_tbf *old_tbf);
+
+#define LOGPTBFDL(tbf, level, fmt, args...) LOGP(DTBFDL, level, "%s " fmt, tbf_name(tbf), ## args)
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/tbf_dl_ass_fsm.c b/src/tbf_dl_ass_fsm.c
index cf09588..5ac1c1a 100644
--- a/src/tbf_dl_ass_fsm.c
+++ b/src/tbf_dl_ass_fsm.c
@@ -31,7 +31,7 @@
 #include <encoding.h>
 #include <bts.h>
 #include <tbf.h>
-#include <tbf_ul.h>
+#include <tbf_dl.h>
 
 #define X(s) (1 << (s))
 
@@ -137,6 +137,8 @@
 	bts_do_rate_ctr_inc(ms->bts, CTR_PKT_DL_ASSIGNMENT);
 
 	tbf_set_polling(ctx->tbf, new_poll_fn, d->ts, PDCH_ULC_POLL_DL_ASS);
+	LOGPTBFDL(ctx->tbf, LOGL_INFO, "Scheduled DL Assignment polling on PACCH (FN=%d, TS=%d)\n",
+		  new_poll_fn, d->ts);
 
 	talloc_free(mac_control_block);
 	return msg;
diff --git a/src/tbf_ul_ack_fsm.c b/src/tbf_ul_ack_fsm.c
index ea523a1..e90336a 100644
--- a/src/tbf_ul_ack_fsm.c
+++ b/src/tbf_ul_ack_fsm.c
@@ -91,8 +91,12 @@
 	if (ms_tlli(ms) != GSM_RESERVED_TMSI)
 		ul_tbf_contention_resolution_success(ctx->tbf);
 
-	if (final)
+	if (final) {
 		tbf_set_polling(tbf, new_poll_fn, d->ts, PDCH_ULC_POLL_UL_ACK);
+		LOGPTBFUL(tbf, LOGL_DEBUG,
+			  "Scheduled UL Acknowledgement polling on PACCH (FN=%d, TS=%d)\n",
+			  new_poll_fn, d->ts);
+	}
 
 	return msg;
 }
diff --git a/src/tbf_ul_ass_fsm.c b/src/tbf_ul_ass_fsm.c
index 00f4bfd..eab34ee 100644
--- a/src/tbf_ul_ass_fsm.c
+++ b/src/tbf_ul_ass_fsm.c
@@ -127,6 +127,8 @@
 	bts_do_rate_ctr_inc(ms->bts, CTR_PKT_UL_ASSIGNMENT);
 
 	tbf_set_polling(ctx->tbf, new_poll_fn, d->ts, PDCH_ULC_POLL_UL_ASS);
+	LOGPTBFDL(ctx->tbf, LOGL_INFO, "Scheduled UL Assignment polling on PACCH (FN=%d, TS=%d)\n",
+		  new_poll_fn, d->ts);
 
 	talloc_free(mac_control_block);
 	return msg;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/25111
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I242f97fd6f927131ac64c1a7c9c3812b6389de04
Gerrit-Change-Number: 25111
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210730/a284c5a0/attachment.htm>


More information about the gerrit-log mailing list