[v2] l3fwd-power: add Rx interrupt timeout

Message ID f98eb89eb043810e5b4c523a51408a2c053cf490.1588243784.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] l3fwd-power: add Rx interrupt timeout |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS

Commit Message

Anatoly Burakov April 30, 2020, 10:49 a.m. UTC
  Currently, thread waiting on an interrupt does not have a timeout, so
it will not ever wake up until traffic arrives. This means that, when
time comes to exit the application, it will not quit unless there
happens to be traffic coming in and waking up the thread from sleep.

Fix it so that the interrupt thread sleeps for 10ms before waking up
and attempting to poll again. Additionally, remove the log message
to avoid spamming about entering interrupt mode.

Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 examples/l3fwd-power/main.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
  

Comments

Hunt, David April 30, 2020, 1:08 p.m. UTC | #1
On 30/4/2020 11:49 AM, Anatoly Burakov wrote:
> Currently, thread waiting on an interrupt does not have a timeout, so
> it will not ever wake up until traffic arrives. This means that, when
> time comes to exit the application, it will not quit unless there
> happens to be traffic coming in and waking up the thread from sleep.
>
> Fix it so that the interrupt thread sleeps for 10ms before waking up
> and attempting to poll again. Additionally, remove the log message
> to avoid spamming about entering interrupt mode.
>
> Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
> Cc: stable@dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---


Acked-by: David Hunt <david.hunt@intel.com>
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 293b3da4ae..21fb15e1a2 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -829,11 +829,7 @@  sleep_until_rx_interrupt(int num)
 	uint8_t queue_id;
 	void *data;
 
-	RTE_LOG(INFO, L3FWD_POWER,
-		"lcore %u sleeps until interrupt triggers\n",
-		rte_lcore_id());
-
-	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, -1);
+	n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, 10);
 	for (i = 0; i < n; i++) {
 		data = event[i].epdata.data;
 		port_id = ((uintptr_t)data) >> CHAR_BIT;
@@ -1306,7 +1302,8 @@  main_loop(__rte_unused void *dummy)
 					/**
 					 * start receiving packets immediately
 					 */
-					goto start_rx;
+					if (likely(!is_done()))
+						goto start_rx;
 				}
 			}
 			stats[lcore_id].sleep_time += lcore_idle_hint;