From: Rongzheng Wang <testwrzwrz@gmail.com>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Cc: Magnus Karlsson <magnus.karlsson@intel.com>,
Jason Xing <kerneljasonxing@gmail.com>,
Stanislav Fomichev <sdf@google.com>,
Jesper Dangaard Brouer <hawk@kernel.org>,
stable@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 1/2] xsk: defer software checksum until the skb is complete
Date: Mon, 26 Oct 2026 22:27:05 +0800 [thread overview]
Message-ID: <20261026142705.4564-1-testwrzwrz@gmail.com> (raw)
In-Reply-To: <at82NLzM7g8HGgum@boxer>
Hi Maciej,
Thanks for the review.
Yes. xsk_skb_metadata() is only called for the first descriptor when
skb is NULL; continuation fragments do not call it. So
skb->ip_summed == CHECKSUM_PARTIAL means the first fragment requested
the checksum.
I'll preserve unlikely() around pool->tx_sw_csum like this:
static int xsk_skb_sw_csum(struct sk_buff *skb,
struct xsk_buff_pool *pool)
{
if (unlikely(pool->tx_sw_csum &&
skb->ip_summed == CHECKSUM_PARTIAL))
return skb_checksum_help(skb);
return 0;
}
For the drop path: xsk_drop_skb() increments tx_invalid_descs and
consumes the skb; sendto() returns the error from skb_checksum_help().
Since the descriptors are already consumed, retrying is not useful. The
current metadata validation makes the malformed-packet path effectively
unreachable, so this is a defensive drop.
I verified the propagation in a local QEMU test kernel. For the test
only, I temporarily changed xsk_skb_sw_csum() to:
static int xsk_skb_sw_csum(struct sk_buff *skb,
struct xsk_buff_pool *pool)
{
if (unlikely(pool->tx_sw_csum &&
skb->ip_summed == CHECKSUM_PARTIAL))
return -EINVAL;
return 0;
}
and ran test_xdp_metadata. It failed at the first generate_packet()
sendto:
generate_packet:FAIL:sendto unexpected sendto: actual -1 < expected 0
Summary: 0/0 PASSED, 0 SKIPPED, 1/0 FAILED
TEST_RC=1
The normal kernel still passes. The test harness does not print errno,
so I can only state that sendto() returned -1; the injected error was
-EINVAL. I restored the source after the test.
Magnus suggested a distinct counter for malformed packets. I agree that
would be more precise than tx_invalid_descs, but I'd prefer to do that
in a separate patch instead of extending the UAPI in this stable fix.
I'll address the remaining feedback and send v3 as a new thread.
Thanks,
Rongzheng
next prev parent reply other threads:[~2026-10-26 14:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 9:12 [PATCH net] " Rongzheng Wang
2026-10-24 9:15 ` netdev-bot+sinfo
2026-10-24 11:35 ` 王荣峥
2026-10-24 12:25 ` Jason Xing
2026-10-24 14:11 ` [PATCH net v2 0/2] xsk: fix multi-buffer TX software checksum Rongzheng Wang
2026-10-24 14:11 ` [PATCH net v2 1/2] xsk: defer software checksum until the skb is complete Rongzheng Wang
2026-10-25 2:51 ` Jason Xing
2026-10-25 3:43 ` Rongzheng Wang
2026-10-26 11:15 ` Maciej Fijalkowski
2026-10-26 12:34 ` Magnus Karlsson
2026-10-26 14:27 ` Rongzheng Wang [this message]
2026-10-26 14:31 ` Magnus Karlsson
2026-10-24 14:11 ` [PATCH net v2 2/2] selftests/bpf: cover AF_XDP multi-buffer TX software checksum Rongzheng Wang
2026-10-25 14:46 ` netdev-bot+sashiko
2026-10-26 14:55 ` Rongzheng Wang
2026-10-24 14:15 ` [PATCH net v2 0/2] xsk: fix " netdev-bot+sinfo
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=20261026142705.4564-1-testwrzwrz@gmail.com \
--to=testwrzwrz@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=hawk@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=stable@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®