aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShesha Sreenivasamurthy <shesha@cisco.com>2016-04-11 22:52:48 -0700
committerShesha Sreenivasamurthy <shesha@cisco.com>2016-04-13 11:16:09 -0700
commit25fd944a088b4bcadf699f46c66d5042af9a5242 (patch)
tree367017af1a6cb894be844e5991228e30f34684fb
parentb2707897416967feffd127a5907f49bd1aa2813f (diff)
VHOST counters reversed
VHOST counters are reversed. RX packet count are shown as TX and vise-versa in "show hardware" statistics. Change-Id: Ie1d41f1f0845edf495cdf34ca65466fc307940c6 Signed-off-by: Shesha Sreenivasamurthy <shesha@cisco.com>
-rw-r--r--vnet/vnet/devices/dpdk/device.c6
-rw-r--r--vnet/vnet/devices/dpdk/dpdk_priv.h11
2 files changed, 10 insertions, 7 deletions
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c
index b7fb4be3b40..748fb829115 100644
--- a/vnet/vnet/devices/dpdk/device.c
+++ b/vnet/vnet/devices/dpdk/device.c
@@ -321,11 +321,12 @@ u32 tx_burst_vector_internal (vlib_main_t * vm,
(uint16_t) (tx_head-tx_tail));
if (PREDICT_TRUE(rv > 0))
{
- dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
+ dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_TXQ]);
vring->packets += rv;
vring->bytes += bytes;
if (dpdk_vhost_user_want_interrupt(xd, offset + VIRTIO_RXQ)) {
+ vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
vring->n_since_last_int += rv;
f64 now = vlib_time_now (vm);
@@ -358,11 +359,12 @@ u32 tx_burst_vector_internal (vlib_main_t * vm,
if (PREDICT_TRUE(rv > 0))
{
- dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
+ dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_TXQ]);
vring->packets += rv;
vring->bytes += bytes;
if (dpdk_vhost_user_want_interrupt(xd, offset + VIRTIO_RXQ)) {
+ vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
vring->n_since_last_int += rv;
f64 now = vlib_time_now (vm);
diff --git a/vnet/vnet/devices/dpdk/dpdk_priv.h b/vnet/vnet/devices/dpdk/dpdk_priv.h
index 2e4909f99b8..e284503eff2 100644
--- a/vnet/vnet/devices/dpdk/dpdk_priv.h
+++ b/vnet/vnet/devices/dpdk/dpdk_priv.h
@@ -105,12 +105,10 @@ dpdk_rx_burst ( dpdk_main_t * dm, dpdk_device_t * xd, u16 queue_id)
f64 now = vlib_time_now (vm);
- dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_TXQ]);
- vring->packets += n_buffers;
- vring->bytes += bytes;
-
+ dpdk_vu_vring *vring = NULL;
/* send pending interrupts if needed */
if (dpdk_vhost_user_want_interrupt(xd, offset + VIRTIO_TXQ)) {
+ vring = &(xd->vu_intf->vrings[offset + VIRTIO_TXQ]);
vring->n_since_last_int += n_buffers;
if ((vring->n_since_last_int && (vring->int_deadline < now))
@@ -118,8 +116,11 @@ dpdk_rx_burst ( dpdk_main_t * dm, dpdk_device_t * xd, u16 queue_id)
dpdk_vhost_user_send_interrupt(vm, xd, offset + VIRTIO_TXQ);
}
+ vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
+ vring->packets += n_buffers;
+ vring->bytes += bytes;
+
if (dpdk_vhost_user_want_interrupt(xd, offset + VIRTIO_RXQ)) {
- vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]);
if (vring->n_since_last_int && (vring->int_deadline < now))
dpdk_vhost_user_send_interrupt(vm, xd, offset + VIRTIO_RXQ);
}