[dpdk-dev] [PATCH v4 3/3] ipfrag: add unit test case

Pavan Nikhilesh Bhagavatula pbhagavatula at marvell.com
Wed Apr 15 20:58:58 CEST 2020


>Initial IP fragmentation unit test.
>
>Signed-off-by: Aaron Conole <aconole at redhat.com>
>---
> MAINTAINERS            |   1 +
> app/test/meson.build   |   2 +
> app/test/test_ipfrag.c | 276
>+++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 279 insertions(+)
> create mode 100644 app/test/test_ipfrag.c
>
>diff --git a/MAINTAINERS b/MAINTAINERS
>index fe59f0224f..a77c7c17ce 100644
>--- a/MAINTAINERS
>+++ b/MAINTAINERS
>@@ -1228,6 +1228,7 @@ F: app/test/test_crc.c
> IP fragmentation & reassembly
> M: Konstantin Ananyev <konstantin.ananyev at intel.com>
> F: lib/librte_ip_frag/
>+F: app/test/test_ipfrag.c
> F: doc/guides/prog_guide/ip_fragment_reassembly_lib.rst
> F: examples/ip_fragmentation/
> F: doc/guides/sample_app_ug/ip_frag.rst
>diff --git a/app/test/meson.build b/app/test/meson.build
>index 04b59cffa4..4b3c3852a2 100644
>--- a/app/test/meson.build
>+++ b/app/test/meson.build
>@@ -58,6 +58,7 @@ test_sources = files('commands.c',
> 	'test_hash_perf.c',
> 	'test_hash_readwrite_lf_perf.c',
> 	'test_interrupts.c',
>+        'test_ipfrag.c',
> 	'test_ipsec.c',
> 	'test_ipsec_sad.c',
> 	'test_kni.c',
>@@ -187,6 +188,7 @@ fast_tests = [
>         ['flow_classify_autotest', false],
>         ['hash_autotest', true],
>         ['interrupt_autotest', true],
>+        ['ipfrag_autotest', false],
>         ['logs_autotest', true],
>         ['lpm_autotest', true],
>         ['lpm6_autotest', true],
>diff --git a/app/test/test_ipfrag.c b/app/test/test_ipfrag.c
>new file mode 100644
>index 0000000000..6a13e334d5
>--- /dev/null
>+++ b/app/test/test_ipfrag.c
>@@ -0,0 +1,276 @@
>+/* SPDX-License-Identifier: BSD-3-Clause
>+ * Copyright(c) 2020 Red Hat, Inc.
>+ */
>+
>+#include <time.h>
>+
>+#include <rte_common.h>
>+#include <rte_cycles.h>
>+#include <rte_hexdump.h>
>+#include <rte_ip.h>
>+#include <rte_ip_frag.h>
>+#include <rte_mbuf.h>
>+#include <rte_memcpy.h>
>+#include <rte_random.h>
>+
>+#include "test.h"
>+
>+#ifndef ARRAY_SIZE
>+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>+#endif

Please use RTE_DIM recently we had a major cleanup of ARRAY_SIZE across DPDK.

Thanks, 
Pavan.

>+
>+static struct rte_mempool *pkt_pool,
>+			  *direct_pool,
>+			  *indirect_pool;
>+



More information about the dev mailing list