From: Paolo Abeni <pabeni@redhat.com>
To: Jaakko Karrenpalo <jkarrenpalo@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
Lukasz Majewski <lukma@denx.de>,
MD Danish Anwar <danishanwar@ti.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Jaakko Karrenpalo <jaakko.karrenpalo@fi.abb.com>
Subject: Re: [PATCH net-next v3 2/2] net: hsr: Add KUnit test for PRP
Date: Tue, 4 Mar 2025 10:27:20 +0100 [thread overview]
Message-ID: <922ae0f3-f2e1-495d-85b0-2b0740bbff09@redhat.com> (raw)
In-Reply-To: <20250227050923.10241-2-jkarrenpalo@gmail.com>
On 2/27/25 6:09 AM, Jaakko Karrenpalo wrote:
> Add unit tests for the PRP duplicate detection
>
> Signed-off-by: Jaakko Karrenpalo <jkarrenpalo@gmail.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
next prev parent reply other threads:[~2025-03-04 9:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 5:09 [PATCH net-next v3 1/2] net: hsr: Fix PRP duplicate detection Jaakko Karrenpalo
2025-02-27 5:09 ` [PATCH net-next v3 2/2] net: hsr: Add KUnit test for PRP Jaakko Karrenpalo
2025-03-03 13:09 ` Simon Horman
2025-03-04 9:27 ` Paolo Abeni [this message]
2025-03-03 13:09 ` [PATCH net-next v3 1/2] net: hsr: Fix PRP duplicate detection Simon Horman
2025-03-04 9:30 ` Paolo Abeni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=922ae0f3-f2e1-495d-85b0-2b0740bbff09@redhat.com \
--to=pabeni@redhat.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jaakko.karrenpalo@fi.abb.com \
--cc=jkarrenpalo@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukma@denx.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®