examples/vhost: fix statistics
authorJianfeng Tan <jianfeng.tan@intel.com>
Wed, 2 Dec 2015 23:20:26 +0000 (07:20 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 7 Dec 2015 02:21:13 +0000 (03:21 +0100)
This issue was discovered under the case of software vm2vm
fowarding. When pkts are received from virtio device 0 and
tx_route to virtio device 1, tx of device 0 is not updated.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Tested-by: Qian Xu <qian.q.xu@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
examples/vhost/main.c

index 9bfda6d..dc3a012 100644 (file)
@@ -1050,8 +1050,8 @@ virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m)
                                        rte_atomic64_add(
                                        &dev_statistics[tdev->device_fh].rx_atomic,
                                        ret);
-                                       dev_statistics[tdev->device_fh].tx_total++;
-                                       dev_statistics[tdev->device_fh].tx += ret;
+                                       dev_statistics[dev->device_fh].tx_total++;
+                                       dev_statistics[dev->device_fh].tx += ret;
                                }
                        }