Re: [PATCH net-next v3 6/7] net: mctp: usblib: Add initial kunit tx tests

From: Geert Uytterhoeven

Date: Fri Oct 23 2026 - 09:46:57 EST


Hi James,

On Wed, 14 Oct 2026 at 06:54, James Lee <james@xxxxxxxxxxxxxxxxxxxx> wrote:
> Add tests for the transmit path, where MCTP packets are handed to
> outgoing USB transfer data. Testing a spanning transfer that is expected
> to succeed, the failure paths when sends fail, and large sequential
> sends.
>
> Signed-off-by: James Lee <james@xxxxxxxxxxxxxxxxxxxx>
>
> ---
> v2:
> - Correct flex array reference
> - Simply return when mctp_usblib_test_tx_send() fails
> - Use skb_put_data() instead of manual assignment
> - Remember span parameter exists

Thanks for your patch, which is now commit 1e12f734afc10477 ("net:
mctp: usblib: Add initial kunit tx tests") upstream.

> --- a/drivers/net/mctp/mctp-usblib-test.c
> +++ b/drivers/net/mctp/mctp-usblib-test.c

> +
> +/* Test sending multiple packets in the same transfer, followed by one that
> + * spans multiple subsequent transfers.
> + */
> +static void mctp_usblib_test_tx_multi_push(struct kunit *test)
> +{
> + struct mctp_usblib_test_ctx *ctx;
> + size_t i, max_length, tx_length;
> + struct mctp_usblib_tx_ops ops;
> + u8 *buf, *flat_tx, *index;
> + struct mctp_usblib_tx *tx;
> + struct net_device *ndev;
> + struct sk_buff *skb;
> + const struct {
> + size_t len;
> + bool more;
> + } sends[] = {
> + { 1000, true },
> + { 500, false },
> + { 5000, false },
> + };
> + int rc;
> +
> + static_assert(!sends[ARRAY_SIZE(sends) - 1].more,
> + "The last push must claim there will be no more");

This fails with gcc-14 (the latest available in Ubuntu 24.04LTS)
and earlier:

drivers/net/mctp/mctp-usblib-test.c:819:23: error: expression in
static assertion is not constant
819 | static_assert(!sends[ARRAY_SIZE(sends) - 1].more,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds