diff options
author | Szymon Sliwa <szs@semihalf.com> | 2018-03-14 11:54:55 +0000 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2018-03-14 14:45:34 +0000 |
commit | 1f15facc74b1313dd680cf20eb6f490cc743b2a1 (patch) | |
tree | 66456030f263a847b3d5b3bd3110e4cb393b342f | |
parent | 298c69510ff4b64a262d465eb8877c4e7f4e60e0 (diff) |
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 <szs@semihalf.com>
-rw-r--r-- | src/plugins/dpdk/device/dpdk_priv.h | 2 |
1 files changed, 2 insertions, 0 deletions
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) { |