Description: backport of dpdk 16.04-rc1 fix for LP: #1559981

Forwarded: n/a (already upstream)
Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Last-Update: 2016-03-23

From 3b1e3e4e362453df8cecbc6d481444be8b84326e Mon Sep 17 00:00:00 2001
From: Huawei Xie <huawei.xie@intel.com>
Date: Fri, 11 Dec 2015 00:07:32 +0800
Subject: [PATCH] virtio: fix descriptors pointing to the same buffer

The virtio_net_hdr desc all pointed to the same buffer. It doesn't cause
issue because in the simple TX mode we don't use the header. This patch
makes the header desc point to different buffer.

Fixes: b4ae9c505f2e ("virtio: optimize ring layout")

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/net/virtio/virtio_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: dpdk/drivers/net/virtio/virtio_rxtx.c
===================================================================
--- dpdk.orig/drivers/net/virtio/virtio_rxtx.c
+++ dpdk/drivers/net/virtio/virtio_rxtx.c
@@ -352,7 +352,7 @@ virtio_dev_vring_start(struct virtqueue
 				vq->vq_ring.desc[i + mid_idx].next = i;
 				vq->vq_ring.desc[i + mid_idx].addr =
 					vq->virtio_net_hdr_mem +
-						mid_idx * vq->hw->vtnet_hdr_size;
+						i * vq->hw->vtnet_hdr_size;
 				vq->vq_ring.desc[i + mid_idx].len =
 					vq->hw->vtnet_hdr_size;
 				vq->vq_ring.desc[i + mid_idx].flags =
