[dpdk-dev] examples/vhost: fix out of sequence packets

Message ID 1453231091-117603-1-git-send-email-jianfeng.tan@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Jianfeng Tan Jan. 19, 2016, 7:18 p.m. UTC
  Issue description: when packets go through vhost example to virtio
device and come back to another virtio device or physical NIC, the
sequence of packets will be changed.

Reported-by: Thomas Long <thomas.long@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 examples/vhost/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Yuanhan Liu Jan. 20, 2016, 2:47 a.m. UTC | #1
On Wed, Jan 20, 2016 at 03:18:11AM +0800, Jianfeng Tan wrote:
> Issue description: when packets go through vhost example to virtio
> device and come back to another virtio device or physical NIC, the
> sequence of packets will be changed.
> 
> Reported-by: Thomas Long <thomas.long@intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>

Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>

	--yliu
  
Thomas Monjalon Feb. 28, 2016, 9:31 p.m. UTC | #2
2016-01-20 10:47, Yuanhan Liu:
> On Wed, Jan 20, 2016 at 03:18:11AM +0800, Jianfeng Tan wrote:
> > Issue description: when packets go through vhost example to virtio
> > device and come back to another virtio device or physical NIC, the
> > sequence of packets will be changed.
> > 
> > Reported-by: Thomas Long <thomas.long@intel.com>
> > Signed-off-by: Jianfeng Tan <jianfeng.tan@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 2dcdacb..aa9aa5a 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1336,8 +1336,8 @@  switch_worker(__attribute__((unused)) void *arg)
 							rte_pktmbuf_free(pkts_burst[--tx_count]);
 					}
 				}
-				while (tx_count)
-					virtio_tx_route(vdev, pkts_burst[--tx_count], (uint16_t)dev->device_fh);
+				for (i = 0; i < tx_count; ++i)
+					virtio_tx_route(vdev, pkts_burst[i], (uint16_t)dev->device_fh);
 			}
 
 			/*move to the next device in the list*/