DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: viktorin@rehivetech.com, ruifeng.wang@arm.com,
	jerinj@marvell.com, drc@linux.vnet.ibm.com,
	bruce.richardson@intel.com, konstantin.ananyev@intel.com,
	ciara.power@intel.com,
	Nithin Dabilpuram <ndabilpuram@marvell.com>
Subject: [dpdk-dev] [PATCH v10 17/18] node: choose vector path at runtime
Date: Mon, 19 Oct 2020 15:48:57 +0200
Message-ID: <20201019134858.32507-18-david.marchand@redhat.com> (raw)
In-Reply-To: <20201019134858.32507-1-david.marchand@redhat.com>

From: Ciara Power <ciara.power@intel.com>

When choosing the vector path, max SIMD bitwidth is now checked to
ensure the vector path is suitable. To do this, the scalar function is
chosen by default in the struct, but at node initialisation time, this
function pointer is updated to the vector version if supported, and
if it is within the max SIMD bitwidth limit.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
v6:
  - Removed generic process function.
  - Change the process function pointer at node init time to vector
    function if suitable.
---
 lib/librte_node/ip4_lookup.c      | 15 ++++++++++-----
 lib/librte_node/ip4_lookup_neon.h |  2 +-
 lib/librte_node/ip4_lookup_sse.h  |  2 +-
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
index 293c77f39e..8835aab9dd 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -15,6 +15,7 @@
 #include <rte_mbuf.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
+#include <rte_vect.h>
 
 #include "rte_node_ip4_api.h"
 
@@ -34,10 +35,10 @@ static struct ip4_lookup_node_main ip4_lookup_nm;
 #include "ip4_lookup_neon.h"
 #elif defined(RTE_ARCH_X86)
 #include "ip4_lookup_sse.h"
-#else
+#endif
 
 static uint16_t
-ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node,
+ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
 			void **objs, uint16_t nb_objs)
 {
 	struct rte_ipv4_hdr *ipv4_hdr;
@@ -109,8 +110,6 @@ ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node,
 	return nb_objs;
 }
 
-#endif
-
 int
 rte_node_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop,
 		       enum rte_node_ip4_lookup_next next_node)
@@ -194,13 +193,19 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
 		init_once = 1;
 	}
 	*lpm_p = ip4_lookup_nm.lpm_tbl[graph->socket];
+
+#if defined(__ARM_NEON) || defined(RTE_ARCH_X86)
+	if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
+		node->process = ip4_lookup_node_process_vec;
+#endif
+
 	node_dbg("ip4_lookup", "Initialized ip4_lookup node");
 
 	return 0;
 }
 
 static struct rte_node_register ip4_lookup_node = {
-	.process = ip4_lookup_node_process,
+	.process = ip4_lookup_node_process_scalar,
 	.name = "ip4_lookup",
 
 	.init = ip4_lookup_node_init,
diff --git a/lib/librte_node/ip4_lookup_neon.h b/lib/librte_node/ip4_lookup_neon.h
index 5e5a7d87be..0ad2763b82 100644
--- a/lib/librte_node/ip4_lookup_neon.h
+++ b/lib/librte_node/ip4_lookup_neon.h
@@ -7,7 +7,7 @@
 
 /* ARM64 NEON */
 static uint16_t
-ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node,
+ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
 			void **objs, uint16_t nb_objs)
 {
 	struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
diff --git a/lib/librte_node/ip4_lookup_sse.h b/lib/librte_node/ip4_lookup_sse.h
index a071cc5919..264c986071 100644
--- a/lib/librte_node/ip4_lookup_sse.h
+++ b/lib/librte_node/ip4_lookup_sse.h
@@ -7,7 +7,7 @@
 
 /* X86 SSE */
 static uint16_t
-ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node,
+ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
 			void **objs, uint16_t nb_objs)
 {
 	struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
-- 
2.23.0


  parent reply	other threads:[~2020-10-19 13:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 13:48 [dpdk-dev] [PATCH v10 00/18] add max SIMD bitwidth to EAL David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 01/18] eal: control max SIMD bitwidth David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 02/18] doc: describe how to enable AVX512 David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 03/18] net/i40e: check max SIMD bitwidth David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 04/18] net/axgbe: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 05/18] net/bnxt: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 06/18] net/enic: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 07/18] net/fm10k: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 08/18] net/iavf: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 09/18] net/ice: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 10/18] net/ixgbe: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 11/18] net/mlx5: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 12/18] net/virtio: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 13/18] distributor: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 14/18] member: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 15/18] efd: " David Marchand
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 16/18] net: " David Marchand
2020-10-19 13:48 ` David Marchand [this message]
2020-10-19 13:48 ` [dpdk-dev] [PATCH v10 18/18] acl: " David Marchand
2020-10-19 14:41 ` [dpdk-dev] [PATCH v10 00/18] add max SIMD bitwidth to EAL David Marchand

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=20201019134858.32507-18-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.com \
    --cc=jerinj@marvell.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=ndabilpuram@marvell.com \
    --cc=ruifeng.wang@arm.com \
    --cc=viktorin@rehivetech.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git