examples/vhost: fix out of sequence packets
authorJianfeng Tan <jianfeng.tan@intel.com>
Tue, 19 Jan 2016 19:18:11 +0000 (03:18 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 28 Feb 2016 21:35:59 +0000 (22:35 +0100)
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>
examples/vhost/main.c

index a97300b..a45cddb 100644 (file)
@@ -1422,8 +1422,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*/