BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maciej Fijalkowski" <maciej.fijalkowski@intel.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 10/13] selftests: xsk: add a hardware mode to xskxceiver
Date: Sat, 03 Oct 2026 01:33:55 +0000	[thread overview]
Message-ID: <20261003013355.8333E1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261001202124.692591-11-maciej.fijalkowski@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests/xsk: malformed IP/UDP headers for multi-fragment verbatim packets in hw mode
--

commit 13a458bdc3c40c143ae3519294c27c39c89b28b0
Author: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

selftests: xsk: add a hardware mode to xskxceiver

This commit introduces a hardware mode (--hw) to xskxceiver for running
AF_XDP tests over a physical link. It wraps packets in UDP/IPv4 headers and
adds new command line options to configure hardware runs.

> diff --git a/tools/testing/selftests/net/lib/xsk/test_xsk.c b/tools/testing/selftests/net/lib/xsk/test_xsk.c
> --- a/tools/testing/selftests/net/lib/xsk/test_xsk.c
> +++ b/tools/testing/selftests/net/lib/xsk/test_xsk.c
[ ... ]
> @@ -1268,8 +1366,8 @@ static int __send_pkts(struct ifobject *ifobject, struct xsk_socket_info *xsk,
>  				tx_desc->options = 0;
>  			}
>  			if (pkt->valid)
> -				pkt_generate(xsk, umem, tx_desc->addr, tx_desc->len, pkt->pkt_nb,
> -					     bytes_written);
> +				pkt_generate(xsk, umem, tx_desc->addr, tx_desc->len, pkt->len,
> +					     pkt->pkt_nb, bytes_written);

[Severity: Medium]
When generating multi-fragment verbatim packets in hardware mode, does this
pass the incorrect length to pkt_generate()?

If pkt_stream->verbatim is true, pkt->len represents only the length of the
current fragment, not the entire logical packet. Passing it as total_len here
propagates to gen_pkt_hdr(), where it truncates the UDP and IPv4 length fields:

tools/testing/selftests/net/lib/xsk/test_xsk.c:gen_pkt_hdr() {
    ...
    struct udphdr udp = {
        ...
        .len = htons(total_len - sizeof(*eth_hdr) - sizeof(struct iphdr)),
    };
    struct iphdr ip = {
        ...
        .tot_len = htons(total_len - sizeof(*eth_hdr)),
    };
    ...
}

This causes malformed packets with truncated L3/L4 lengths while the physical
frame contains all fragments, which might be dropped by NIC parsers or
switches and lead to spurious hardware test failures (for example, in
testapp_too_many_frags).

Could the total logical packet length be passed here instead of just the
fragment length?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261001202124.692591-1-maciej.fijalkowski@intel.com?part=10

  reply	other threads:[~2026-10-03  1:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 20:21 [PATCH net-next 00/13] selftests: net: migrate AF_XDP test suite over to net Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 01/13] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 02/13] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 03/13] selftests/bpf: drop the test_progs AF_XDP wrapper Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 04/13] selftests: net: add a generic rule for BPF skeletons Maciej Fijalkowski
2026-10-03  1:33   ` sashiko-bot
2026-10-01 20:21 ` [PATCH net-next 05/13] selftests: xsk: move the AF_XDP test suite to selftests/net Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 06/13] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 07/13] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 08/13] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 09/13] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-10-02 18:07   ` Vyavahare, Tushar
2026-10-03  1:33   ` sashiko-bot
2026-10-01 20:21 ` [PATCH net-next 10/13] selftests: xsk: add a hardware mode to xskxceiver Maciej Fijalkowski
2026-10-03  1:33   ` sashiko-bot [this message]
2026-10-01 20:21 ` [PATCH net-next 11/13] selftests: xsk: share test case definitions with hardware runner Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 12/13] selftests: drv-net: test AF_XDP zero-copy with an SKB peer Maciej Fijalkowski
2026-10-01 20:21 ` [PATCH net-next 13/13] selftests: xsk: document generic and hardware endpoint runs Maciej Fijalkowski
2026-10-05 18:06 ` [PATCH net-next 00/13] selftests: net: migrate AF_XDP test suite over to net Stanislav Fomichev
2026-10-06 17:42   ` Maciej Fijalkowski
2026-10-06 22:04     ` Stanislav Fomichev
2026-10-07 12:22       ` Maciej Fijalkowski
2026-10-07 17:26         ` Stanislav Fomichev

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=20261003013355.8333E1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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