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

From
Jakub Kicinski <kuba@kernel.org>
Date
2025-05-17 01:48:50
Also in
lkml
Reply to
Oleksij Rempel, 2025-05-15
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
quoted hunk ↗ jump to hunk
+	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 :)
quoted hunk ↗ jump to hunk
+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
Thread (18 messages) 18 messages, 4 authors, last reply 2025-07-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help