Thread (276 messages) 276 messages, 29 authors, 2020-10-16

Re: [dpdk-dev] [PATCH v7 17/18] node: choose vector path at runtime

From: Power, Ciara <hidden>
Date: 2020-10-15 15:33:56

quoted hunk ↗ jump to hunk
-----Original Message-----
From: Power, Ciara <redacted>
Sent: Thursday 15 October 2020 16:23
To: dev@dpdk.org
Cc: viktorin@rehivetech.com; ruifeng.wang@arm.com; jerinj@marvell.com;
drc@linux.vnet.ibm.com; Richardson, Bruce [off-list ref];
Ananyev, Konstantin [off-list ref];
david.marchand@redhat.com; Power, Ciara [off-list ref]; Nithin
Dabilpuram [off-list ref]; Pavan Nikhilesh
[off-list ref]; Kiran Kumar K [off-list ref]
Subject: [PATCH v7 17/18] node: choose vector path at runtime

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.

Cc: Nithin Dabilpuram <redacted>
Cc: Pavan Nikhilesh <redacted>
Cc: Jerin Jacob <redacted>
Cc: Kiran Kumar K <redacted>

Signed-off-by: Ciara Power <redacted>

---
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      | 14 +++++++++-----
lib/librte_node/ip4_lookup_neon.h |  2 +-  lib/librte_node/ip4_lookup_sse.h
|  2 +-
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c index
293c77f39e..934a6d7eab 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -34,10 +34,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 +109,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 +192,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_get_max_simd_bitwidth() >= RTE_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.22.0

Adding Ack missed from v6:

Acked-by: Nithin Dabilpuram <redacted>

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help