From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <hxie5@shecgisg003.sh.intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id C6BA18E79
 for <dev@dpdk.org>; Sun, 18 Oct 2015 08:29:35 +0200 (CEST)
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by fmsmga101.fm.intel.com with ESMTP; 17 Oct 2015 23:29:35 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.17,696,1437462000"; d="scan'208";a="829246095"
Received: from shvmail01.sh.intel.com ([10.239.29.42])
 by orsmga002.jf.intel.com with ESMTP; 17 Oct 2015 23:29:34 -0700
Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com
 [10.239.29.90])
 by shvmail01.sh.intel.com with ESMTP id t9I6TWTZ027282;
 Sun, 18 Oct 2015 14:29:32 +0800
Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1])
 by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id
 t9I6TUAj003301; Sun, 18 Oct 2015 14:29:32 +0800
Received: (from hxie5@localhost)
 by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t9I6TUbo003297;
 Sun, 18 Oct 2015 14:29:30 +0800
From: Huawei Xie <huawei.xie@intel.com>
To: dev@dpdk.org
Date: Sun, 18 Oct 2015 14:29:04 +0800
Message-Id: <1445149744-3217-8-git-send-email-huawei.xie@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1445149744-3217-1-git-send-email-huawei.xie@intel.com>
References: <1443537953-23917-1-git-send-email-huawei.xie@intel.com>
 <1445149744-3217-1-git-send-email-huawei.xie@intel.com>
Subject: [dpdk-dev] [PATCH v2 7/7] virtio: pick simple rx/tx func
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sun, 18 Oct 2015 06:29:36 -0000

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@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