If a virtio net device is managed by kernel driver, the primary process would be aware of it and skip it.
For secondary process, however, it isn't aware of that. Instead, the 'hw' would be NULL. If we keep going on with the rx_func_get(), a crash would happen. For such case, we simply return 1 to let EAL skip this device. Thus, the crashed could be fixed. Fixes: c1f86306a026 ("virtio: add new driver") Cc: sta...@dpdk.org Signed-off-by: Yuanhan Liu <yuanhan....@linux.intel.com> --- drivers/net/virtio/virtio_ethdev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 079fd6c..f2a803b 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1304,6 +1304,15 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, eth_dev->tx_pkt_burst = &virtio_xmit_pkts; if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + /* + * if a virtio net device is managed by kernel driver, + * the secondary process won't be aware of it. Instead, + * it sees hw being set with NULL. For such case, here + * we returns 1 to let EAL skip this device. + */ + if (!hw) + return 1; + rx_func_get(eth_dev); return 0; } -- 1.9.0