simple rx/tx func is enabled when user specifies single segment, no offload 
support.
merge-able should be disabled to use simple rxtx.

Signed-off-by: Huawei Xie <huawei.xie at intel.com>
---
 drivers/net/virtio/virtio_rxtx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 947fc46..71f8cd4 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -62,6 +62,10 @@
 #define  VIRTIO_DUMP_PACKET(m, len) do { } while (0)
 #endif

+
+#define VIRTIO_SIMPLE_FLAGS ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS | \
+       ETH_TXQ_FLAGS_NOOFFLOADS)
+
 static int use_simple_rxtx;

 static void
@@ -471,6 +475,14 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,
                return -EINVAL;
        }

+       /* Use simple rx/tx func if single segment and no offloads */
+       if ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) == VIRTIO_SIMPLE_FLAGS) {
+               PMD_INIT_LOG(INFO, "Using simple rx/tx path");
+               dev->tx_pkt_burst = virtio_xmit_pkts_simple;
+               dev->rx_pkt_burst = virtio_recv_pkts_vec;
+               use_simple_rxtx = 1;
+       }
+
        ret = virtio_dev_queue_setup(dev, VTNET_TQ, queue_idx, vtpci_queue_idx,
                        nb_desc, socket_id, &vq);
        if (ret < 0) {
-- 
1.8.1.4

Reply via email to