[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <922ae0f3-f2e1-495d-85b0-2b0740bbff09@redhat.com>
Date: Tue, 4 Mar 2025 10:27:20 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Jaakko Karrenpalo <jkarrenpalo@...il.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Simon Horman <horms@...nel.org>,
Lukasz Majewski <lukma@...x.de>, MD Danish Anwar <danishanwar@...com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Jaakko Karrenpalo <jaakko.karrenpalo@...abb.com>
Subject: Re: [PATCH net-next v3 2/2] net: hsr: Add KUnit test for PRP
On 2/27/25 6:09 AM, Jaakko Karrenpalo wrote:
> Add unit tests for the PRP duplicate detection
>
> Signed-off-by: Jaakko Karrenpalo <jkarrenpalo@...il.com>
> ---
> Changes in v2:
> - Changed KUnit tests to compile as built-in only
> Changes in v3:
> - Changed the KUnit tests to compile as a module
>
> net/hsr/Kconfig | 18 +++
> net/hsr/Makefile | 2 +
> net/hsr/hsr_framereg.c | 4 +
> net/hsr/prp_dup_discard_test.c | 212 +++++++++++++++++++++++++++++++++
> 4 files changed, 236 insertions(+)
> create mode 100644 net/hsr/prp_dup_discard_test.c
>
> diff --git a/net/hsr/Kconfig b/net/hsr/Kconfig
> index 1b048c17b6c8..fcacdf4f0ffc 100644
> --- a/net/hsr/Kconfig
> +++ b/net/hsr/Kconfig
> @@ -38,3 +38,21 @@ config HSR
> relying on this code in a safety critical system!
>
> If unsure, say N.
> +
> +if HSR
> +
> +config PRP_DUP_DISCARD_KUNIT_TEST
> + tristate "PRP duplicate discard KUnit tests" if !KUNIT_ALL_TESTS
> + depends on KUNIT
> + default KUNIT_ALL_TESTS
> + help
> + Covers the PRP duplicate discard algorithm.
> + Only useful for kernel devs running KUnit test harness and are not
> + for inclusion into a production build.
> +
> + For more information on KUnit and unit tests in general please refer
> + to the KUnit documentation in Documentation/dev-tools/kunit/.
> +
> + If unsure, say N.
> +
> +endif
> diff --git a/net/hsr/Makefile b/net/hsr/Makefile
> index 75df90d3b416..34e581db5c41 100644
> --- a/net/hsr/Makefile
> +++ b/net/hsr/Makefile
> @@ -8,3 +8,5 @@ obj-$(CONFIG_HSR) += hsr.o
> hsr-y := hsr_main.o hsr_framereg.o hsr_device.o \
> hsr_netlink.o hsr_slave.o hsr_forward.o
> hsr-$(CONFIG_DEBUG_FS) += hsr_debugfs.o
> +
> +obj-$(CONFIG_PRP_DUP_DISCARD_KUNIT_TEST) += prp_dup_discard_test.o
> diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
> index 79e066422044..3192e1253715 100644
> --- a/net/hsr/hsr_framereg.c
> +++ b/net/hsr/hsr_framereg.c
> @@ -588,6 +588,10 @@ int prp_register_frame_out(struct hsr_port *port, struct hsr_frame_info *frame)
> return 0;
> }
>
> +#ifdef CONFIG_PRP_DUP_DISCARD_KUNIT_TEST_MODULE
The more idiomatic way to express the above is:
#if IS_MODULE(CONFIG_PRP_DUP_DISCARD_KUNIT_TEST)
Otherwise LGTM,
Paolo
Powered by blists - more mailing lists