Re: [PATCH net-next v4 3/4] net: selftests: add checksum mode support and SW checksum handling

From: Jakub Kicinski
Date: Fri May 16 2025 - 21:49:03 EST


On Thu, 15 May 2025 10:30:59 +0200 Oleksij Rempel wrote:
> +enum net_test_checksum_mode {
> + NET_TEST_CHECKSUM_COMPLETE,

Why COMPLETE? that means skb has checksum of the complete data.
If packet requires no checksumming you should probably use CHECKSUM_NONE

> + switch (iph->protocol) {
> + case IPPROTO_TCP:
> + if (!pskb_may_pull(skb,
> + transport_offset + sizeof(struct tcphdr)))

Why are you so diligently checking if you can pull for the SW sum but
not for the HW sum? Both of them update the same header fields :)

> +static int net_test_setup_hw_csum(struct sk_buff *skb, struct iphdr *iph)
> +{
> + u16 csum_offset;
> +
> + skb->ip_summed = CHECKSUM_PARTIAL;
> + skb->csum = 0;
> +
> + switch (iph->protocol) {
> + case IPPROTO_TCP:
> + if (!tcp_hdr(skb))
> + return -EINVAL;
> + tcp_hdr(skb)->check = 0;

this filed should be filled with pseudo header checksum for HW offload,
not with 0, like the existing code did
--
pw-bot: cr