From mboxrd@z Thu Jan 1 00:00:00 1970 From: Huawei Xie Subject: [PATCH 8/8] virtio: rxtx_func_get Date: Tue, 29 Sep 2015 22:45:53 +0800 Message-ID: <1443537953-23917-9-git-send-email-huawei.xie@intel.com> References: <1443537953-23917-1-git-send-email-huawei.xie@intel.com> To: dev@dpdk.org 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) In-Reply-To: <1443537953-23917-1-git-send-email-huawei.xie@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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