diff mbox series

[ovs-dev,v1,02/10] dpif-netdev-avx512: Refactor avx512 dpif and create new APIs.

Message ID 20220321061441.1833575-3-kumar.amber@intel.com
State Deferred
Headers show
Series DPIF + MFEX Inner Vxlan AVX512 Opts | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Kumar Amber March 21, 2022, 6:14 a.m. UTC
This Patch creates new APIs for avx512 dpif.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>
Signed-off-by: Cian Ferriter <cian.ferriter@intel.com>
Co-authored-by: Cian Ferriter <cian.ferriter@intel.com>
---
 lib/dpif-netdev-avx512.c       | 32 +++++++++++++++++++++++++++-----
 lib/dpif-netdev-private-dpif.c |  4 ++--
 lib/dpif-netdev-private-dpif.h | 12 ++++++++----
 3 files changed, 37 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c
index b7131ba3f..ef672adcf 100644
--- a/lib/dpif-netdev-avx512.c
+++ b/lib/dpif-netdev-avx512.c
@@ -59,8 +59,13 @@  struct dpif_userdata {
         struct pkt_flow_meta pkt_meta[NETDEV_MAX_BURST];
 };
 
+static int32_t
+dp_netdev_input_avx512__(struct dp_netdev_pmd_thread *pmd,
+                         struct dp_packet_batch *packets,
+                         bool md_is_valid, odp_port_t in_port);
+
 int32_t
-dp_netdev_input_outer_avx512_probe(void)
+dp_netdev_input_avx512_probe(void)
 {
     bool avx512f_available = cpu_has_isa(OVS_CPU_ISA_X86_AVX512F);
     bool bmi2_available = cpu_has_isa(OVS_CPU_ISA_X86_BMI2);
@@ -72,10 +77,10 @@  dp_netdev_input_outer_avx512_probe(void)
     return 0;
 }
 
-int32_t
-dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
-                             struct dp_packet_batch *packets,
-                             odp_port_t in_port)
+static inline int32_t ALWAYS_INLINE
+dp_netdev_input_avx512__(struct dp_netdev_pmd_thread *pmd,
+                         struct dp_packet_batch *packets,
+                         bool md_is_valid OVS_UNUSED, odp_port_t in_port)
 {
     /* Allocate DPIF userdata. */
     if (OVS_UNLIKELY(!pmd->netdev_input_func_userdata)) {
@@ -380,5 +385,22 @@  dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
     return 0;
 }
 
+int32_t
+dp_netdev_input_avx512(struct dp_netdev_pmd_thread *pmd,
+                       struct dp_packet_batch *packets,
+                       odp_port_t in_port)
+{
+    int ret = dp_netdev_input_avx512__(pmd, packets, false, in_port);
+    return ret;
+}
+
+int32_t
+dp_netdev_input_avx512_recirc(struct dp_netdev_pmd_thread *pmd,
+                              struct dp_packet_batch *packets)
+{
+    int ret = dp_netdev_input_avx512__(pmd, packets, true, 0);
+    return ret;
+}
+
 #endif
 #endif
diff --git a/lib/dpif-netdev-private-dpif.c b/lib/dpif-netdev-private-dpif.c
index 4fe67a3c5..afce6947a 100644
--- a/lib/dpif-netdev-private-dpif.c
+++ b/lib/dpif-netdev-private-dpif.c
@@ -42,8 +42,8 @@  static struct dpif_netdev_impl_info_t dpif_impls[] = {
 
 #if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__)
     /* Only available on x86_64 bit builds with SSE 4.2 used for OVS core. */
-    [DPIF_NETDEV_IMPL_AVX512] = { .input_func = dp_netdev_input_outer_avx512,
-      .probe = dp_netdev_input_outer_avx512_probe,
+    [DPIF_NETDEV_IMPL_AVX512] = { .input_func = dp_netdev_input_avx512,
+      .probe = dp_netdev_input_avx512_probe,
       .name = "dpif_avx512", },
 #endif
 };
diff --git a/lib/dpif-netdev-private-dpif.h b/lib/dpif-netdev-private-dpif.h
index 0e29a02db..0d18b748e 100644
--- a/lib/dpif-netdev-private-dpif.h
+++ b/lib/dpif-netdev-private-dpif.h
@@ -74,12 +74,16 @@  dp_netdev_input(struct dp_netdev_pmd_thread *pmd,
 
 /* AVX512 enabled DPIF implementation and probe functions. */
 int32_t
-dp_netdev_input_outer_avx512_probe(void);
+dp_netdev_input_avx512_probe(void);
 
 int32_t
-dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
-                             struct dp_packet_batch *packets,
-                             odp_port_t in_port);
+dp_netdev_input_avx512(struct dp_netdev_pmd_thread *pmd,
+                       struct dp_packet_batch *packets,
+                       odp_port_t in_port);
+
+int32_t
+dp_netdev_input_avx512_recirc(struct dp_netdev_pmd_thread *pmd,
+                              struct dp_packet_batch *packets);
 
 int32_t
 dp_netdev_recirculate(struct dp_netdev_pmd_thread *,