The interrupt and legacy main loops carry an identical block that arms the Rx queue interrupts of the lcore, sleeps until one triggers and disarms them again. Move it to a helper so the following fixes touch a single place.
No functional change. Signed-off-by: Maxime Leroy <[email protected]> --- examples/l3fwd-power/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 705cab8f2d..764899217c 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -910,6 +910,14 @@ static int event_register(struct lcore_conf *qconf) return 0; } +static void +rx_interrupt_wait(struct lcore_conf *qconf) +{ + turn_on_off_intr(qconf, 1); + sleep_until_rx_interrupt(qconf->n_rx_queue, rte_lcore_id()); + turn_on_off_intr(qconf, 0); +} + /* Main processing loop. 8< */ static int main_intr_loop(__rte_unused void *dummy) { @@ -1054,11 +1062,7 @@ static int main_intr_loop(__rte_unused void *dummy) else { /* suspend until rx interrupt triggers */ if (intr_en) { - turn_on_off_intr(qconf, 1); - sleep_until_rx_interrupt( - qconf->n_rx_queue, - lcore_id); - turn_on_off_intr(qconf, 0); + rx_interrupt_wait(qconf); /** * start receiving packets immediately */ @@ -1372,11 +1376,7 @@ main_legacy_loop(__rte_unused void *dummy) else { /* suspend until rx interrupt triggers */ if (intr_en) { - turn_on_off_intr(qconf, 1); - sleep_until_rx_interrupt( - qconf->n_rx_queue, - lcore_id); - turn_on_off_intr(qconf, 0); + rx_interrupt_wait(qconf); /** * start receiving packets immediately */ -- 2.43.0

