The following patch adds non datapath AVX512 testing for
MFEX in c format.
Signed-off-by: Kumar Amber <[email protected]>
---
lib/dpif-netdev-private-extract.c | 4 +-
tests/automake.mk | 1 +
tests/library.at | 7 ++++
tests/test-mfex.c | 70 +++++++++++++++++++++++++++++++
4 files changed, 80 insertions(+), 2 deletions(-)
create mode 100644 tests/test-mfex.c
diff --git a/lib/dpif-netdev-private-extract.c
b/lib/dpif-netdev-private-extract.c
index a29bdcfa7..a011c190e 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/tests/automake.mk b/tests/automake.mk
index 507da2ee8..52f72ec32 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -471,6 +471,7 @@ tests_ovstest_SOURCES = \
tests/test-jsonrpc.c \
tests/test-list.c \
tests/test-lockfile.c \
+ tests/test-mfex.c \
tests/test-multipath.c \
tests/test-mpsc-queue.c \
tests/test-netflow.c \
diff --git a/tests/library.at b/tests/library.at
index db4997d8f..db4af092f 100644
--- a/tests/library.at
+++ b/tests/library.at
@@ -274,3 +274,10 @@ AT_CLEANUP
AT_SETUP([id-fpool module])
AT_CHECK([ovstest test-id-fpool check], [0], [])
AT_CLEANUP
+
+AT_SETUP([dpif-mfex])
+AT_KEYWORDS([mfex])
+AT_SKIP_IF([! $PYTHON3 -c "import scapy"], [], [])
+AT_CHECK([$PYTHON3 $srcdir/mfex_fuzzy.py $srcdir 512 0], [], [])
+AT_CHECK([ovstest test-mfex $srcdir/pcap/fuzzy.pcap])
+AT_CLEANUP
diff --git a/tests/test-mfex.c b/tests/test-mfex.c
new file mode 100644
index 000000000..c61243e99
--- /dev/null
+++ b/tests/test-mfex.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2021 Intel.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <config.h>
+#include <pcap.h>
+#undef NDEBUG
+#include "dpif-netdev-private-dpcls.h"
+#include "dpif-netdev-private-extract.h"
+#include "dpif-netdev-private-thread.h"
+#include "packets.h"
+#include "ovstest.h"
+#include "util.h"
+
+static void
+test_mfex_main(int argc, char *argv[])
+{
+
+ struct dp_packet_batch packets;
+ struct netdev_flow_key keys[NETDEV_MAX_BURST];
+ struct dp_packet *buf;
+ struct pcap_pkthdr header;
+ char error_buffer[PCAP_ERRBUF_SIZE];
+ const u_char *packet_char;
+ pcap_t *handle;
+ struct dp_netdev_pmd_thread *pmd = xzalloc(sizeof (*pmd));
+
+ if (argc < 2) {
+ ovs_fatal(errno, "Pcap file name not provided");
+ }
+
+ handle = pcap_open_offline(argv[1], error_buffer);
+ if (!handle) {
+ ovs_fatal(errno, "failed to open pcap file");
+ }
+
+ pmd->miniflow_extract_opt = NULL;
+ dp_packet_batch_init(&packets);
+ dpif_miniflow_extract_init();
+
+ while ((packet_char = pcap_next(handle, &header))) {
+ buf = dp_packet_new(header.caplen);
+ dp_packet_put(buf, packet_char, header.caplen);
+ buf->mbuf.data_len = (uint16_t) header.caplen;
+ dp_packet_batch_add(&packets, buf);
+
+ if (dp_packet_batch_size(&packets) == NETDEV_MAX_BURST) {
+ dpif_miniflow_extract_autovalidator(&packets, &keys[0],
+ NETDEV_MAX_BURST, 1, pmd);
+ dp_packet_delete_batch(&packets, true);
+ }
+ }
+
+ free(pmd);
+ pcap_close(handle);
+}
+
+OVSTEST_REGISTER("test-mfex", test_mfex_main);
--
2.25.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev