aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2015-12-16 04:27:37 +0100
committerDamjan Marion <damarion@cisco.com>2015-12-16 10:01:02 +0100
commitbce6b6a6bfbedb4209a7f20c65ebcb018e0432ff (patch)
tree595a9425a4be886a2d44665403e79f4ea20fa3c1 /vnet
parent7210e9470eeeb0ff1a259db1f448011da3774d8c (diff)
Introduce support for DPDK 2.2
Change-Id: Id2c7c4a949363a448a6715463dd81f701f046b93 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/dpdk/device.c19
-rw-r--r--vnet/vnet/devices/dpdk/dpdk_priv.h22
2 files changed, 32 insertions, 9 deletions
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c
index a19c3131ef9..781fff46782 100644
--- a/vnet/vnet/devices/dpdk/device.c
+++ b/vnet/vnet/devices/dpdk/device.c
@@ -988,15 +988,16 @@ static u8 * format_dpdk_device (u8 * s, va_list * args)
rte_eth_dev_rss_hash_conf_get(xd->device_index, &rss_conf);
pci = di.pci_dev;
- s = format(s, "%Upci id: device %04x:%04x subsystem %04x:%04x\n"
- "%Upci address: %04x:%02x:%02x.%02x\n",
- format_white_space, indent + 2,
- pci->id.vendor_id, pci->id.device_id,
- pci->id.subsystem_vendor_id,
- pci->id.subsystem_device_id,
- format_white_space, indent + 2,
- pci->addr.domain, pci->addr.bus,
- pci->addr.devid, pci->addr.function);
+ if (pci)
+ s = format(s, "%Upci id: device %04x:%04x subsystem %04x:%04x\n"
+ "%Upci address: %04x:%02x:%02x.%02x\n",
+ format_white_space, indent + 2,
+ pci->id.vendor_id, pci->id.device_id,
+ pci->id.subsystem_vendor_id,
+ pci->id.subsystem_device_id,
+ format_white_space, indent + 2,
+ pci->addr.domain, pci->addr.bus,
+ pci->addr.devid, pci->addr.function);
s = format(s, "%Umax rx packet len: %d\n",
format_white_space, indent + 2, di.max_rx_pktlen);
s = format(s, "%Upromiscuous: unicast %s all-multicast %s\n",
diff --git a/vnet/vnet/devices/dpdk/dpdk_priv.h b/vnet/vnet/devices/dpdk/dpdk_priv.h
index e452e02d90d..314e280636a 100644
--- a/vnet/vnet/devices/dpdk/dpdk_priv.h
+++ b/vnet/vnet/devices/dpdk/dpdk_priv.h
@@ -22,6 +22,22 @@
#define DPDK_NB_RX_DESC_40GE (4096-128)
#define DPDK_NB_TX_DESC_40GE 2048
+#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
+#define foreach_dpdk_counter \
+ _ (tx_frames_ok, opackets) \
+ _ (tx_bytes_ok, obytes) \
+ _ (tx_errors, oerrors) \
+ _ (tx_loopback_frames_ok, olbpackets) \
+ _ (tx_loopback_bytes_ok, olbbytes) \
+ _ (rx_frames_ok, ipackets) \
+ _ (rx_bytes_ok, ibytes) \
+ _ (rx_errors, ierrors) \
+ _ (rx_missed, imissed) \
+ _ (rx_multicast_frames_ok, imcasts) \
+ _ (rx_no_bufs, rx_nombuf) \
+ _ (rx_loopback_frames_ok, ilbpackets) \
+ _ (rx_loopback_bytes_ok, ilbbytes)
+#else
#define foreach_dpdk_counter \
_ (tx_frames_ok, opackets) \
_ (tx_bytes_ok, obytes) \
@@ -44,6 +60,7 @@
_ (rx_pause_xoff, rx_pause_xoff) \
_ (rx_loopback_frames_ok, ilbpackets) \
_ (rx_loopback_bytes_ok, ilbbytes)
+#endif
#define foreach_dpdk_q_counter \
_ (rx_frames_ok, q_ipackets) \
@@ -412,10 +429,15 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
xd->stats.imissed -
xd->last_stats.imissed);
}
+#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
+ rxerrors = xd->stats.ierrors;
+ last_rxerrors = xd->last_stats.ierrors;
+#else
rxerrors = xd->stats.ibadcrc
+ xd->stats.ibadlen + xd->stats.ierrors;
last_rxerrors = xd->last_stats.ibadcrc
+ xd->last_stats.ibadlen + xd->last_stats.ierrors;
+#endif
if (PREDICT_FALSE (rxerrors != last_rxerrors))
{