examples/l3fwd-power: fix Rx interrupt disabling
authorXiao Zhang <xiao.zhang@intel.com>
Tue, 10 Sep 2019 16:10:14 +0000 (00:10 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 27 Oct 2019 17:34:34 +0000 (18:34 +0100)
Interrupt will not be received when disabling RX interrupt without
synchronization mechanism sometimes which leads to wake up issue.
Add spinlock to fix it.

Fixes: b736d64787 ("examples/l3fwd-power: disable Rx interrupt when waking up")
Cc: stable@dpdk.org
Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
Reviewed-by: Marvin Liu <yong.liu@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
examples/l3fwd-power/main.c

index a03f64a..d049d8a 100644 (file)
@@ -880,7 +880,9 @@ sleep_until_rx_interrupt(int num)
                port_id = ((uintptr_t)data) >> CHAR_BIT;
                queue_id = ((uintptr_t)data) &
                        RTE_LEN2MASK(CHAR_BIT, uint8_t);
+               rte_spinlock_lock(&(locks[port_id]));
                rte_eth_dev_rx_intr_disable(port_id, queue_id);
+               rte_spinlock_unlock(&(locks[port_id]));
                RTE_LOG(INFO, L3FWD_POWER,
                        "lcore %u is waked up from rx interrupt on"
                        " port %d queue %d\n",