From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 420C469C8 for ; Tue, 29 Sep 2015 16:47:37 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 29 Sep 2015 07:47:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,608,1437462000"; d="scan'208";a="815499458" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 29 Sep 2015 07:47:10 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t8TEl8M9025617; Tue, 29 Sep 2015 22:47:08 +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 t8TEl64q024010; Tue, 29 Sep 2015 22:47:08 +0800 Received: (from hxie5@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t8TEl6hx024006; Tue, 29 Sep 2015 22:47:06 +0800 From: Huawei Xie To: dev@dpdk.org Date: Tue, 29 Sep 2015 22:45:53 +0800 Message-Id: <1443537953-23917-9-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1443537953-23917-1-git-send-email-huawei.xie@intel.com> References: <1443537953-23917-1-git-send-email-huawei.xie@intel.com> Subject: [dpdk-dev] [PATCH 8/8] virtio: rxtx_func_get 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: Tue, 29 Sep 2015 14:47:37 -0000 Select simplified rx/tx when mergable isn't enabled and there is no offload flags specified. Signed-off-by: Huawei Xie --- drivers/net/virtio/virtio_ethdev.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 3b7b841..a08529c 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -369,6 +369,8 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, vq->virtio_net_hdr_mz = NULL; vq->virtio_net_hdr_mem = 0; + vq->use_simple_rxtx = (dev->rx_pkt_burst == virtio_recv_pkts_vec); + if (queue_type == VTNET_TQ) { /* * For each xmit packet, allocate a virtio_net_hdr @@ -1156,13 +1158,21 @@ virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle, } static void -rx_func_get(struct rte_eth_dev *eth_dev) +rxtx_func_get(struct rte_eth_dev *eth_dev) { struct virtio_hw *hw = eth_dev->data->dev_private; + if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) eth_dev->rx_pkt_burst = &virtio_recv_mergeable_pkts; else eth_dev->rx_pkt_burst = &virtio_recv_pkts; + +#ifdef RTE_LIBRTE_VIRTIO_SIMPLE + if (!vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { + eth_dev->rx_pkt_burst = &virtio_recv_pkts_vec; + eth_dev->tx_pkt_burst = &virtio_xmit_pkts_simple; + } +#endif } /* @@ -1184,7 +1194,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) eth_dev->tx_pkt_burst = &virtio_xmit_pkts; if (rte_eal_process_type() == RTE_PROC_SECONDARY) { - rx_func_get(eth_dev); + rxtx_func_get(eth_dev); return 0; } @@ -1214,7 +1224,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); virtio_negotiate_features(hw); - rx_func_get(eth_dev); + rxtx_func_get(eth_dev); /* Setting up rx_header size for the device */ if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) -- 1.8.1.4