From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 864F88D95 for ; Sun, 25 Oct 2015 16:35:29 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 25 Oct 2015 08:35:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,196,1444719600"; d="scan'208";a="819022529" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 25 Oct 2015 08:35:29 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t9PFZQUP016133; Sun, 25 Oct 2015 23:35:26 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t9PFZNvk018354; Sun, 25 Oct 2015 23:35:25 +0800 Received: (from hxie5@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t9PFZN3q018350; Sun, 25 Oct 2015 23:35:23 +0800 From: Huawei Xie To: dev@dpdk.org Date: Sun, 25 Oct 2015 23:35:04 +0800 Message-Id: <1445787304-18267-8-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1445787304-18267-1-git-send-email-huawei.xie@intel.com> References: <1443537953-23917-1-git-send-email-huawei.xie@intel.com> <1445787304-18267-1-git-send-email-huawei.xie@intel.com> Subject: [dpdk-dev] [PATCH v5 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2015 15:35:29 -0000 Changes in v4: Check merge-able feature when select simple rx/tx functions. simple rx/tx func is chose when merge-able rx is disabled and user specifies single segment and no offload support. Signed-off-by: Huawei Xie --- drivers/net/virtio/virtio_rxtx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 947fc46..0f1daf2 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -53,6 +53,7 @@ #include "virtio_logs.h" #include "virtio_ethdev.h" +#include "virtio_pci.h" #include "virtqueue.h" #include "virtio_rxtx.h" @@ -62,6 +63,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 @@ -459,6 +464,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) { uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX; + struct virtio_hw *hw = dev->data->dev_private; struct virtqueue *vq; uint16_t tx_free_thresh; int ret; @@ -471,6 +477,15 @@ 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 && + !vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { + 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