The patch adds the flag based switch between choice of using
miniflow_extract in normal pipeline or select mfex_autovalidator
in debug and test builds.

The compile time flag used to select autoval can be done using option:

 ./configure CFLAGS="--enable-mfex-default-autovalidator"

Signed-off-by: Kumar Amber <kumar.am...@intel.com>
---
 lib/dpif-netdev-private-extract.c |  4 ++--
 lib/flow.c                        | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-netdev-private-extract.c 
b/lib/dpif-netdev-private-extract.c
index 8538d069f..0d7091caa 100644
--- a/lib/dpif-netdev-private-extract.c
+++ b/lib/dpif-netdev-private-extract.c
@@ -124,8 +124,8 @@ dpif_miniflow_extract_init(void)
     /* For the first call, this will be choosen based on the
      * compile time flag.
      */
-    VLOG_INFO("Default MFEX Extract implementation is %s.\n",
-              mfex_impls[mfex_idx].name);
+    VLOG_DBG("Default MFEX Extract implementation is %s.\n",
+             mfex_impls[mfex_idx].name);
     atomic_store_relaxed(mfex_func, (uintptr_t) mfex_impls
                          [mfex_idx].extract_func);
 }
diff --git a/lib/flow.c b/lib/flow.c
index 127de2d7a..ddec31523 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -37,6 +37,7 @@
 #include "dp-packet.h"
 #include "dpif-netdev-private-thread.h"
 #include "dpif-netdev-private-dpcls.h"
+#include "dpif-netdev-private-extract.h"
 #include "openflow/openflow.h"
 #include "packets.h"
 #include "odp-util.h"
@@ -1121,7 +1122,30 @@ miniflow_extract_(struct dp_packet *packet, struct 
netdev_flow_key *key)
 void
 miniflow_extract(struct dp_packet *packet, struct netdev_flow_key *key)
 {
+#ifdef MFEX_AUTOVALIDATOR_DEFAULT
+    static struct ovsthread_once once_enable = OVSTHREAD_ONCE_INITIALIZER;
+    if (ovsthread_once_start(&once_enable)) {
+        dpif_miniflow_extract_init();
+        ovsthread_once_done(&once_enable);
+    }
+    struct dp_packet_batch packets;
+    const struct pkt_metadata *md = &packet->md;
+    dp_packet_batch_init(&packets);
+    dp_packet_batch_add(&packets, packet);
+    const uint32_t recirc_depth = *recirc_depth_get();
+    /* Currently AVX512 DPIF dont support recirculation
+     * Once the support will be added the condition would
+     * be removed.
+     */
+    if (recirc_depth) {
+        miniflow_extract_(packet, key);
+    } else {
+        dpif_miniflow_extract_autovalidator(&packets, key, 1,
+                                    odp_to_u32(md->in_port.odp_port), NULL);
+    }
+#else
     miniflow_extract_(packet, key);
+#endif
 }
 static ovs_be16
 parse_dl_type(const void **datap, size_t *sizep, ovs_be16 *first_vlan_tci_p)
-- 
2.25.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to