[PATCH] event/dlb2: remove unnecessary timer call

Bruce Richardson bruce.richardson at intel.com
Wed Dec 13 12:48:22 CET 2023


We only need to consult the timer value when the driver waits for a
timeout, so skip making the call to get the current timer/TSC value if
the timeout is zero, as no wait will ever be done.

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/event/dlb2/dlb2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 050ace0904..f395ef0cb7 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -3966,7 +3966,8 @@ dlb2_hw_dequeue_sparse(struct dlb2_eventdev *dlb2,
 	else
 		timeout = dlb2->global_dequeue_wait_ticks;
 
-	start_ticks = rte_get_timer_cycles();
+	if (timeout != 0)
+		start_ticks = rte_get_timer_cycles();
 
 	use_scalar = use_scalar || (max_num & 0x3);
 
@@ -4114,7 +4115,8 @@ dlb2_hw_dequeue(struct dlb2_eventdev *dlb2,
 	else
 		timeout = dlb2->global_dequeue_wait_ticks;
 
-	start_ticks = rte_get_timer_cycles();
+	if (timeout != 0)
+		start_ticks = rte_get_timer_cycles();
 
 	while (num < max_num) {
 		struct dlb2_dequeue_qe qes[DLB2_NUM_QES_PER_CACHE_LINE];
-- 
2.40.1



More information about the dev mailing list