DPDK patches and discussions
 help / color / mirror / Atom feed
From: beilei.xing@intel.com
To: jingjing.wu@intel.com, qi.z.zhang@intel.com
Cc: dev@dpdk.org, Beilei Xing <beilei.xing@intel.com>
Subject: [PATCH 15/15] common/idpf: add avx512 for single queue model
Date: Thu,  8 Dec 2022 07:53:09 +0000	[thread overview]
Message-ID: <20221208075309.37852-16-beilei.xing@intel.com> (raw)
In-Reply-To: <20221208075309.37852-1-beilei.xing@intel.com>

From: Beilei Xing <beilei.xing@intel.com>

Add avx512 vector path for single queue model.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/common/idpf/idpf_common_rxtx.h        | 20 +++++++++++++
 .../idpf/idpf_common_rxtx_avx512.c}           |  4 +--
 drivers/common/idpf/meson.build               | 30 +++++++++++++++++++
 drivers/common/idpf/version.map               |  3 ++
 drivers/net/idpf/idpf_rxtx.h                  | 13 --------
 drivers/net/idpf/meson.build                  | 17 -----------
 6 files changed, 55 insertions(+), 32 deletions(-)
 rename drivers/{net/idpf/idpf_rxtx_vec_avx512.c => common/idpf/idpf_common_rxtx_avx512.c} (99%)

diff --git a/drivers/common/idpf/idpf_common_rxtx.h b/drivers/common/idpf/idpf_common_rxtx.h
index ea6c6b78e9..8a6e04af56 100644
--- a/drivers/common/idpf/idpf_common_rxtx.h
+++ b/drivers/common/idpf/idpf_common_rxtx.h
@@ -47,6 +47,12 @@
 #define IDPF_TX_OFFLOAD_NOTSUP_MASK \
 		(RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK)
 
+/* used for Vector PMD */
+#define IDPF_VPMD_RX_MAX_BURST		32
+#define IDPF_VPMD_TX_MAX_BURST		32
+#define IDPF_VPMD_DESCS_PER_LOOP	4
+#define IDPF_RXQ_REARM_THRESH		64
+
 /* MTS */
 #define GLTSYN_CMD_SYNC_0_0	(PF_TIMESYNC_BASE + 0x0)
 #define PF_GLTSYN_SHTIME_0_0	(PF_TIMESYNC_BASE + 0x4)
@@ -193,6 +199,10 @@ union idpf_tx_offload {
 	};
 };
 
+struct idpf_tx_vec_entry {
+	struct rte_mbuf *mbuf;
+};
+
 struct idpf_rxq_ops {
 	void (*release_mbufs)(struct idpf_rx_queue *rxq);
 };
@@ -254,5 +264,15 @@ uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			uint16_t nb_pkts);
 __rte_internal
 int idpf_singleq_rx_vec_setup(struct idpf_rx_queue *rxq);
+__rte_internal
+int idpf_singleq_tx_vec_setup_avx512(struct idpf_tx_queue *txq);
+__rte_internal
+uint16_t idpf_singleq_recv_pkts_avx512(void *rx_queue,
+				       struct rte_mbuf **rx_pkts,
+				       uint16_t nb_pkts);
+__rte_internal
+uint16_t idpf_singleq_xmit_pkts_avx512(void *tx_queue,
+				       struct rte_mbuf **tx_pkts,
+				       uint16_t nb_pkts);
 
 #endif /* _IDPF_COMMON_RXTX_H_ */
diff --git a/drivers/net/idpf/idpf_rxtx_vec_avx512.c b/drivers/common/idpf/idpf_common_rxtx_avx512.c
similarity index 99%
rename from drivers/net/idpf/idpf_rxtx_vec_avx512.c
rename to drivers/common/idpf/idpf_common_rxtx_avx512.c
index 19047d23c1..de52c6e45f 100644
--- a/drivers/net/idpf/idpf_rxtx_vec_avx512.c
+++ b/drivers/common/idpf/idpf_common_rxtx_avx512.c
@@ -2,9 +2,9 @@
  * Copyright(c) 2022 Intel Corporation
  */
 
-#include "idpf_rxtx_vec_common.h"
-
 #include <rte_vect.h>
+#include <idpf_common_device.h>
+#include <idpf_common_rxtx.h>
 
 #ifndef __INTEL_COMPILER
 #pragma GCC diagnostic ignored "-Wcast-qual"
diff --git a/drivers/common/idpf/meson.build b/drivers/common/idpf/meson.build
index 5ee071fdb2..1dafafeb2f 100644
--- a/drivers/common/idpf/meson.build
+++ b/drivers/common/idpf/meson.build
@@ -9,4 +9,34 @@ sources = files(
     'idpf_common_virtchnl.c',
 )
 
+if arch_subdir == 'x86'
+    idpf_avx512_cpu_support = (
+        cc.get_define('__AVX512F__', args: machine_args) != '' and
+        cc.get_define('__AVX512BW__', args: machine_args) != ''
+    )
+
+    idpf_avx512_cc_support = (
+        not machine_args.contains('-mno-avx512f') and
+        cc.has_argument('-mavx512f') and
+        cc.has_argument('-mavx512bw')
+    )
+
+    if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true
+        cflags += ['-DCC_AVX512_SUPPORT']
+        avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+        if cc.has_argument('-march=skylake-avx512')
+            avx512_args += '-march=skylake-avx512'
+        endif
+        idpf_common_avx512_lib = static_library(
+            'idpf_common_avx512_lib',
+            'idpf_common_rxtx_avx512.c',
+	    dependencies: [
+	            static_rte_mbuf,
+	    ],
+            include_directories: includes,
+            c_args: avx512_args)
+        objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c')
+    endif
+endif
+
 subdir('base')
diff --git a/drivers/common/idpf/version.map b/drivers/common/idpf/version.map
index d022c72971..33747a5c69 100644
--- a/drivers/common/idpf/version.map
+++ b/drivers/common/idpf/version.map
@@ -44,6 +44,9 @@ INTERNAL {
 	idpf_singleq_xmit_pkts;
 	idpf_prep_pkts;
 	idpf_singleq_rx_vec_setup;
+	idpf_singleq_tx_vec_setup_avx512;
+	idpf_singleq_recv_pkts_avx512;
+	idpf_singleq_xmit_pkts_avx512;
 
 	local: *;
 };
diff --git a/drivers/net/idpf/idpf_rxtx.h b/drivers/net/idpf/idpf_rxtx.h
index a985dc2cf5..3a5084dfd6 100644
--- a/drivers/net/idpf/idpf_rxtx.h
+++ b/drivers/net/idpf/idpf_rxtx.h
@@ -19,23 +19,14 @@
 #define IDPF_DEFAULT_RX_FREE_THRESH	32
 
 /* used for Vector PMD */
-#define IDPF_VPMD_RX_MAX_BURST	32
-#define IDPF_VPMD_TX_MAX_BURST	32
-#define IDPF_VPMD_DESCS_PER_LOOP	4
-#define IDPF_RXQ_REARM_THRESH	64
 
 #define IDPF_DEFAULT_TX_RS_THRESH	32
 #define IDPF_DEFAULT_TX_FREE_THRESH	32
 
-struct idpf_tx_vec_entry {
-	struct rte_mbuf *mbuf;
-};
-
 int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
-int idpf_singleq_tx_vec_setup_avx512(struct idpf_tx_queue *txq);
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
@@ -48,10 +39,6 @@ int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
-uint16_t idpf_singleq_recv_pkts_avx512(void *rx_queue, struct rte_mbuf **rx_pkts,
-				       uint16_t nb_pkts);
-uint16_t idpf_singleq_xmit_pkts_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
-				       uint16_t nb_pkts);
 
 void idpf_stop_queues(struct rte_eth_dev *dev);
 
diff --git a/drivers/net/idpf/meson.build b/drivers/net/idpf/meson.build
index 6d98b80ad3..6ca5ada329 100644
--- a/drivers/net/idpf/meson.build
+++ b/drivers/net/idpf/meson.build
@@ -28,22 +28,5 @@ if arch_subdir == 'x86'
 
     if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true
         cflags += ['-DCC_AVX512_SUPPORT']
-        avx512_args = [cflags, '-mavx512f', '-mavx512bw']
-        if cc.has_argument('-march=skylake-avx512')
-            avx512_args += '-march=skylake-avx512'
-        endif
-        idpf_avx512_lib = static_library(
-            'idpf_avx512_lib',
-            'idpf_rxtx_vec_avx512.c',
-            dependencies: [
-                    static_rte_common_idpf,
-                    static_rte_ethdev,
-                    static_rte_bus_pci,
-                    static_rte_kvargs,
-                    static_rte_hash,
-            ],
-            include_directories: includes,
-            c_args: avx512_args)
-        objs += idpf_avx512_lib.extract_objects('idpf_rxtx_vec_avx512.c')
     endif
 endif
-- 
2.26.2


  parent reply	other threads:[~2022-12-08  7:55 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08  7:52 [PATCH 00/15] net/idpf: refactor idpf pmd beilei.xing
2022-12-08  7:52 ` [PATCH 01/15] common/idpf: add adapter structure beilei.xing
2022-12-08  7:52 ` [PATCH 02/15] common/idpf: add vport structure beilei.xing
2022-12-08  7:52 ` [PATCH 03/15] common/idpf: move vc functions to common module beilei.xing
2022-12-08  7:52 ` [PATCH 04/15] common/idpf: introduce adapter init and deinit beilei.xing
2022-12-08  7:52 ` [PATCH 05/15] common/idpf: add vport init/deinit beilei.xing
2022-12-08  7:53 ` [PATCH 06/15] common/idpf: add config RSS beilei.xing
2022-12-08  7:53 ` [PATCH 07/15] common/idpf: add irq map/unmap beilei.xing
2022-12-08  7:53 ` [PATCH 08/15] common/idpf: move ptype table to adapter structure beilei.xing
2022-12-08  7:53 ` [PATCH 09/15] common/idpf: init create vport info beilei.xing
2022-12-08  7:53 ` [PATCH 10/15] common/idpf: add vector flags in vport beilei.xing
2022-12-08  7:53 ` [PATCH 11/15] common/idpf: add rxq and txq struct beilei.xing
2022-12-08  7:53 ` [PATCH 12/15] common/idpf: add help functions for queue setup and release beilei.xing
2022-12-08  7:53 ` [PATCH 13/15] common/idpf: add scalar data path beilei.xing
2022-12-08  7:53 ` [PATCH 14/15] common/idpf: add vec queue setup beilei.xing
2022-12-08  7:53 ` beilei.xing [this message]
2023-01-06  9:16 ` [PATCH v2 00/15] net/idpf: introduce idpf common modle beilei.xing
2023-01-06  9:16   ` [PATCH v2 01/15] common/idpf: add adapter structure beilei.xing
2023-01-06  9:16   ` [PATCH v2 02/15] common/idpf: add vport structure beilei.xing
2023-01-06  9:16   ` [PATCH v2 03/15] common/idpf: move vc functions to common module beilei.xing
2023-01-06  9:16   ` [PATCH v2 04/15] common/idpf: introduce adapter init and deinit beilei.xing
2023-01-06  9:16   ` [PATCH v2 05/15] common/idpf: add vport init/deinit beilei.xing
2023-01-08 12:10     ` Zhang, Qi Z
2023-01-09  1:34       ` Xing, Beilei
2023-01-06  9:16   ` [PATCH v2 06/15] common/idpf: add config RSS beilei.xing
2023-01-06  9:16   ` [PATCH v2 07/15] common/idpf: add irq map/unmap beilei.xing
2023-01-17  1:14     ` Zhang, Qi Z
2023-01-06  9:16   ` [PATCH v2 08/15] common/idpf: move ptype table to adapter structure beilei.xing
2023-01-06  9:16   ` [PATCH v2 09/15] common/idpf: init create vport info beilei.xing
2023-01-06  9:16   ` [PATCH v2 10/15] common/idpf: add vector flags in vport beilei.xing
2023-01-06  9:16   ` [PATCH v2 11/15] common/idpf: add rxq and txq struct beilei.xing
2023-01-06  9:16   ` [PATCH v2 12/15] common/idpf: add help functions for queue setup and release beilei.xing
2023-01-06  9:16   ` [PATCH v2 13/15] common/idpf: add scalar data path beilei.xing
2023-01-06  9:16   ` [PATCH v2 14/15] common/idpf: add vec queue setup beilei.xing
2023-01-06  9:16   ` [PATCH v2 15/15] common/idpf: add avx512 for single queue model beilei.xing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221208075309.37852-16-beilei.xing@intel.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).