From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A137A0597; Wed, 8 Apr 2020 03:18:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 83B0D1C0AD; Wed, 8 Apr 2020 03:18:15 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 0818F1C069 for ; Wed, 8 Apr 2020 03:18:12 +0200 (CEST) IronPort-SDR: Y+4m8s1+p0yi2bZ2eCTRS6xcNrruh+Chx/YF856vQTueTPgT5/u3JqH7ZH9bTFDmP3r9L483K+ kJXD37O6SbSA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2020 18:18:12 -0700 IronPort-SDR: Zq3Uwj557KaSeozBjmPEqKfELojig/yKdQ+BzOou1mQF9eJglDWkKEgj9cEB1LUC0jR4a4h8WT cXQkoI3/O4ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,357,1580803200"; d="scan'208";a="275288465" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.58]) by fmsmga004.fm.intel.com with ESMTP; 07 Apr 2020 18:18:10 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, xiaolong.ye@intel.com, zhihong.wang@intel.com Cc: harry.van.haaren@intel.com, dev@dpdk.org, Marvin Liu Date: Wed, 8 Apr 2020 16:53:12 +0800 Message-Id: <20200408085313.4487-7-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200408085313.4487-1-yong.liu@intel.com> References: <20200313174230.74661-1-yong.liu@intel.com> <20200408085313.4487-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH v3 6/7] net/virtio: add election for vectorized datapath X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Packed ring vectorized datapath will be selected when criterian matched. 1. AVX512 is enabled in dpdk config and supported by compiler 2. Host cpu has AVX512F flag 3. Ring size is power of two 4. virtio VERSION_1 and IN_ORDER features are negotiated 5. LRO and mergeable are disabled in Rx datapath Signed-off-by: Marvin Liu diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index f9d0ea70d..21570e5cf 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1518,9 +1518,12 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) if (vtpci_packed_queue(hw)) { PMD_INIT_LOG(INFO, "virtio: using packed ring %s Tx path on port %u", - hw->use_inorder_tx ? "inorder" : "standard", + hw->packed_vec_tx ? "vectorized" : "standard", eth_dev->data->port_id); - eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed; + if (hw->packed_vec_tx) + eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed_vec; + else + eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed; } else { if (hw->use_inorder_tx) { PMD_INIT_LOG(INFO, "virtio: using inorder Tx path on port %u", @@ -1534,7 +1537,13 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) } if (vtpci_packed_queue(hw)) { - if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { + if (hw->packed_vec_rx) { + PMD_INIT_LOG(INFO, + "virtio: using packed ring vectorized Rx path on port %u", + eth_dev->data->port_id); + eth_dev->rx_pkt_burst = + &virtio_recv_pkts_packed_vec; + } else if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { PMD_INIT_LOG(INFO, "virtio: using packed ring mergeable buffer Rx path on port %u", eth_dev->data->port_id); @@ -2159,6 +2168,34 @@ virtio_dev_configure(struct rte_eth_dev *dev) hw->use_simple_rx = 1; + if (vtpci_packed_queue(hw)) { +#if defined(RTE_ARCH_X86) && defined(CC_AVX512_SUPPORT) + unsigned int vq_size; + vq_size = VTPCI_OPS(hw)->get_queue_num(hw, 0); + if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) || + !rte_is_power_of_2(vq_size) || + !vtpci_with_feature(hw, VIRTIO_F_IN_ORDER) || + !vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) { + hw->packed_vec_rx = 0; + hw->packed_vec_tx = 0; + PMD_DRV_LOG(INFO, "disabled packed ring vectorized " + "path for requirements are not met"); + } + + if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { + hw->packed_vec_rx = 0; + PMD_DRV_LOG(ERR, "disabled packed ring vectorized rx " + "path for mrg_rxbuf enabled"); + } + + if (rx_offloads & DEV_RX_OFFLOAD_TCP_LRO) { + hw->packed_vec_rx = 0; + PMD_DRV_LOG(ERR, "disabled packed ring vectorized rx " + "path for TCP_LRO enabled"); + } +#endif + } + if (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER)) { hw->use_inorder_tx = 1; hw->use_inorder_rx = 1; -- 2.17.1