From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: Jijie Shao <shaojijie@huawei.com>
Cc: shenjian15@huawei.com, wangpeiyang1@huawei.com,
liuyonglong@huawei.com, chenhao418@huawei.com,
jonathan.cameron@huawei.com,
shameerali.kolothum.thodi@huawei.com, salil.mehta@huawei.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org
Subject: Re: [PATCH RFC net-next 1/2] net: selftest: add net_selftest_custom() interface
Date: Fri, 25 Apr 2025 22:15:38 +0200 [thread overview]
Message-ID: <31a7c481-0b0c-4a46-9eb9-983f88ca137e@engleder-embedded.com> (raw)
In-Reply-To: <20250421134358.1241851-2-shaojijie@huawei.com>
On 21.04.25 15:43, Jijie Shao wrote:
> In net/core/selftests.c,
> net_selftest() supports loopback tests.
> However, the loopback content of this interface is a fixed common test
> and cannot be expanded to add the driver's own test.
>
> In this patch, the net_selftest_custom() interface is added
> to support driver customized loopback tests and
> extra common loopback tests.
>
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
> include/net/selftests.h | 61 +++++++++++++
> net/core/selftests.c | 188 +++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 245 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/selftests.h b/include/net/selftests.h
> index e65e8d230d33..a36e6ee0a41f 100644
> --- a/include/net/selftests.h
> +++ b/include/net/selftests.h
> @@ -4,6 +4,48 @@
>
> #include <linux/ethtool.h>
>
> +#define NET_TEST_NETIF_CARRIER BIT(0)
> +#define NET_TEST_FULL_DUPLEX BIT(1)
> +#define NET_TEST_TCP BIT(2)
> +#define NET_TEST_UDP BIT(3)
> +#define NET_TEST_UDP_MAX_MTU BIT(4)
> +
> +#define NET_EXTRA_CARRIER_TEST BIT(0)
> +#define NET_EXTRA_FULL_DUPLEX_TEST BIT(1)
> +#define NET_EXTRA_PHY_TEST BIT(2)
What is the difference between NET_TEST_NETIF_CARRIER and
NET_EXTRA_CARRIER_TEST? Aren't these the same tests?
> +struct net_test_entry {
> + char name[ETH_GSTRING_LEN];
> +
> + /* can set to NULL */
> + int (*enable)(struct net_device *ndev, bool enable);
> +
> + /* can set to NULL */
> + int (*fn)(struct net_device *ndev);
> +
> + /* if flag is set, fn() will be ignored,
> + * and will do test according to the flag,
> + * such as NET_TEST_UDP...
> + */
> + unsigned long flags;
Looks limited, this interface does not scale as the bits in flags are
limited.
> +};
> +
> +#define NET_TEST_E(_name, _enable, _flags) { \
> + .name = _name, \
> + .enable = _enable, \
> + .fn = NULL, \
> + .flags = _flags }
> +
> +#define NET_TEST_ENTRY_MAX_COUNT 10
I expect that you have to eliminate this limitation too.
> +struct net_test {
> + /* extra tests will be added based on this flag */
> + unsigned long extra_flags;
Why this extra_flags to trigger tests? AFAIU the same tests can be
triggered with entries.
> +
> + struct net_test_entry entries[NET_TEST_ENTRY_MAX_COUNT];
> + /* the count of entries, must <= NET_TEST_ENTRY_MAX_COUNT */
> + u32 count;
> +};
You try to make net selftests more usable for drivers. I also tried
that, but Andrew Lunn argumented for controlling the selftests some
user space interface is expected. IMO the situation has not changed.
https://lore.kernel.org/netdev/20250227203138.60420-3-gerhard@engleder-embedded.com/T/#md5e4ac1ca41adbdb43755d3c189aa8b8228bf8c9
Gerhard
next prev parent reply other threads:[~2025-04-25 21:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 13:43 [PATCH RFC net-next 0/2] net: hibmcge: add support for selftest Jijie Shao
2025-04-21 13:43 ` [PATCH RFC net-next 1/2] net: selftest: add net_selftest_custom() interface Jijie Shao
2025-04-25 20:15 ` Gerhard Engleder [this message]
2025-04-21 13:43 ` [PATCH RFC net-next 2/2] net: hibmcge: add support for selftest Jijie Shao
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=31a7c481-0b0c-4a46-9eb9-983f88ca137e@engleder-embedded.com \
--to=gerhard@engleder-embedded.com \
--cc=andrew+netdev@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=salil.mehta@huawei.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=wangpeiyang1@huawei.com \
/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®