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 B9DA6A04B7; Tue, 13 Oct 2020 12:44:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C0851DB08; Tue, 13 Oct 2020 12:39:12 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 602C01DB02 for ; Tue, 13 Oct 2020 12:39:10 +0200 (CEST) IronPort-SDR: aUPkxuJji/n91+4PZ5FmqZwC5yOmPEGKsfTXgNUQdH+ZXfLb13c0zlWrA/qwezF1kKUicMoEI9 4QYqmwCBqJvA== X-IronPort-AV: E=McAfee;i="6000,8403,9772"; a="165998435" X-IronPort-AV: E=Sophos;i="5.77,370,1596524400"; d="scan'208";a="165998435" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2020 03:39:10 -0700 IronPort-SDR: QKsAsjUgOtAjiq2tANM7CR00lN/dhRLnlj2YqgPleiJRqm0I+y2+50sP44jgixA2MjxNWYOWRV ZjSJSsxmzYXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,370,1596524400"; d="scan'208";a="463443180" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.239]) by orsmga004.jf.intel.com with ESMTP; 13 Oct 2020 03:39:07 -0700 From: Ciara Power 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, --dry-run@dpdk.org, Ciara Power , Nithin Dabilpuram , Pavan Nikhilesh , Kiran Kumar K Date: Tue, 13 Oct 2020 11:38:17 +0100 Message-Id: <20201013103817.305423-18-ciara.power@intel.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20201013103817.305423-1-ciara.power@intel.com> References: <20200807155859.63888-1-ciara.power@intel.com> <20201013103817.305423-1-ciara.power@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 17/17] node: choose vector path at runtime 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" When choosing the vector path, max SIMD bitwidth is now checked to ensure the vector path is suitable. To do this, rather than the scalar/vector lookup functions being called directly from the apps, a generic function is called which will then call the scalar or vector lookup function. Cc: Nithin Dabilpuram Cc: Pavan Nikhilesh Cc: Jerin Jacob Cc: Kiran Kumar K Signed-off-by: Ciara Power --- lib/librte_node/ip4_lookup.c | 13 +++++++++++-- lib/librte_node/ip4_lookup_neon.h | 2 +- lib/librte_node/ip4_lookup_sse.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c index 293c77f39e..b3edbc1f4d 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,7 +109,16 @@ ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node, return nb_objs; } +static uint16_t +ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node, + void **objs, uint16_t nb_objs) +{ +#if defined(RTE_MACHINE_CPUFLAG_NEON) || defined(RTE_ARCH_X86) + if (rte_get_max_simd_bitwidth() >= RTE_SIMD_128) + return ip4_lookup_node_process_vec(graph, node, objs, nb_objs); #endif + return ip4_lookup_node_process_scalar(graph, node, objs, nb_objs); +} int rte_node_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop, 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