From: Daniel Zahka <daniel.zahka@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 2/6] netdevsim: psp: remove unnecessary UDP checksum computation
Date: Fri, 08 May 2026 07:53:45 -0700 [thread overview]
Message-ID: <20260508-nsim-psp-crypto-v1-2-4b50ed09b794@gmail.com> (raw)
In-Reply-To: <20260508-nsim-psp-crypto-v1-0-4b50ed09b794@gmail.com>
The PSP spec requires the implementations accept 0 checksum in psp-udp
header. Let's take advantage of that to trim netdevsim's psp code
down. psp_dev_encapsulate() already sets uh->check to 0.
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
drivers/net/netdevsim/psp.c | 32 --------------------------------
1 file changed, 32 deletions(-)
diff --git a/drivers/net/netdevsim/psp.c b/drivers/net/netdevsim/psp.c
index 5073bda60883..75740e2a731f 100644
--- a/drivers/net/netdevsim/psp.c
+++ b/drivers/net/netdevsim/psp.c
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-#include <linux/ip.h>
#include <linux/skbuff.h>
-#include <net/ip6_checksum.h>
#include <net/psp.h>
#include <net/sock.h>
@@ -81,36 +79,6 @@ nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
skb->len - skb_inner_transport_offset(skb));
u64_stats_update_end(&ns->psp.syncp);
} else {
- struct ipv6hdr *ip6h __maybe_unused;
- struct iphdr *iph;
- struct udphdr *uh;
- __wsum csum;
-
- /* Do not decapsulate. Receive the skb with the udp and psp
- * headers still there as if this is a normal udp packet.
- * psp_dev_encapsulate() sets udp checksum to 0, so we need to
- * provide a valid checksum here, so the skb isn't dropped.
- */
- uh = udp_hdr(skb);
- csum = skb_checksum(skb, skb_transport_offset(skb),
- ntohs(uh->len), 0);
-
- switch (skb->protocol) {
- case htons(ETH_P_IP):
- iph = ip_hdr(skb);
- uh->check = udp_v4_check(ntohs(uh->len), iph->saddr,
- iph->daddr, csum);
- break;
-#if IS_ENABLED(CONFIG_IPV6)
- case htons(ETH_P_IPV6):
- ip6h = ipv6_hdr(skb);
- uh->check = udp_v6_check(ntohs(uh->len), &ip6h->saddr,
- &ip6h->daddr, csum);
- break;
-#endif
- }
-
- uh->check = uh->check ?: CSUM_MANGLED_0;
skb->ip_summed = CHECKSUM_NONE;
}
--
2.52.0
next prev parent reply other threads:[~2026-05-08 14:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 14:53 [PATCH net-next 0/6] netdevsim: psp: implement real crypto operations from the PSP spec Daniel Zahka
2026-05-08 14:53 ` [PATCH net-next 1/6] netdevsim: psp: reset spi on key rotation and check for exhaustion on alloc Daniel Zahka
2026-05-11 16:53 ` Willem de Bruijn
2026-05-08 14:53 ` Daniel Zahka [this message]
2026-05-11 17:01 ` [PATCH net-next 2/6] netdevsim: psp: remove unnecessary UDP checksum computation Willem de Bruijn
2026-05-11 17:46 ` Daniel Zahka
2026-05-11 19:01 ` Willem de Bruijn
2026-05-11 19:43 ` Daniel Zahka
2026-05-08 14:53 ` [PATCH net-next 3/6] netdevsim: psp: move rx processing into nsim_poll() Daniel Zahka
2026-05-11 20:03 ` Willem de Bruijn
2026-05-12 0:25 ` Daniel Zahka
2026-05-12 0:51 ` Willem de Bruijn
2026-05-08 14:53 ` [PATCH net-next 4/6] netdevsim: psp: implement kdf from psp spec Daniel Zahka
2026-05-11 19:49 ` Willem de Bruijn
2026-05-11 23:55 ` Daniel Zahka
2026-05-12 0:48 ` Willem de Bruijn
2026-05-08 14:53 ` [PATCH net-next 5/6] netdevsim: psp: add real aes-gcm encryption and decryption Daniel Zahka
2026-05-11 20:10 ` Willem de Bruijn
2026-05-08 14:53 ` [PATCH net-next 6/6] netdevsim: psp: count rx authentication and length errors Daniel Zahka
2026-05-11 20:19 ` Willem de Bruijn
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=20260508-nsim-psp-crypto-v1-2-4b50ed09b794@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@gmail.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