From 1f15facc74b1313dd680cf20eb6f490cc743b2a1 Mon Sep 17 00:00:00 2001 From: Szymon Sliwa Date: Wed, 14 Mar 2018 11:54:55 +0000 Subject: [PATCH] Prevent calling rte_eth_xstats_get not initialized dev DPDK API forbids calling rte_eth_xstats_get on a port which has not been setup up yet. Citing the DPDK docs (reformated): " The functions exported by the application Ethernet API to setup a device designated by its port identifier must be invoked in the following order: rte_eth_dev_configure() rte_eth_tx_queue_setup() rte_eth_rx_queue_setup() rte_eth_dev_start() Then, the network application can invoke, in any order, the functions exported by the Ethernet API to get the MAC address of a given device, to get the speed and the status of a device physical link, to receive/transmit [burst of] packets, and so on. " original can be found here: http://dpdk.org/doc/api/rte__ethdev_8h.html#a36ba70a5a6fce2c2c1f774828ba78f8d Change-Id: I91854b8b0dd12dd028b4b36665cca49f16eac24c Signed-off-by: Szymon Sliwa --- src/plugins/dpdk/device/dpdk_priv.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h index a95d03cfba4..7c4091c1be5 100644 --- a/src/plugins/dpdk/device/dpdk_priv.h +++ b/src/plugins/dpdk/device/dpdk_priv.h @@ -62,6 +62,8 @@ typedef struct static inline void dpdk_get_xstats (dpdk_device_t * xd) { + if (!(xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)) + return; int len; if ((len = rte_eth_xstats_get (xd->device_index, NULL, 0)) > 0) { -- 2.16.6