[dpdk-dev,v3] examples/vhost: fix statistics error

Message ID 1449098426-128162-1-git-send-email-jianfeng.tan@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Jianfeng Tan Dec. 2, 2015, 11:20 p.m. UTC
  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>
---
 examples/vhost/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Yuanhan Liu Dec. 3, 2015, 6:28 a.m. UTC | #1
On Thu, Dec 03, 2015 at 07:20:26AM +0800, Jianfeng Tan wrote:
> 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>

Thanks.

	--yliu
> ---
>  examples/vhost/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index 9bfda6d..dc3a012 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -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;
>  				}
>  			}
>  
> -- 
> 2.1.4
  
Thomas Monjalon Dec. 7, 2015, 1:49 a.m. UTC | #2
2015-12-03 14:28, Yuanhan Liu:
> On Thu, Dec 03, 2015 at 07:20:26AM +0800, Jianfeng Tan wrote:
> > 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>

Applied, thanks
  

Patch

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 9bfda6d..dc3a012 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -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;
 				}
 			}