Skip to contentSkip to conversation

ip: skip IP checksum for skbs with CHECKSUM_UNNECESSARY set

RFC PATCH In review Octavian Purdila 4 participants 7 messages Aug 22, 2008 – Aug 23, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 ip: skip IP checksum for skbs with CHECKSUM_UNNECESSARY set

We are working on a completely in hardware LRO implementation and this patch would simplify the hardware implementation. Is this acceptable?

net/ipv4/ip_input.c +2 -1
@@ -415,7 +415,8 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
 
        iph = ip_hdr(skb);
 
-       if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
+       if (!skb_csum_unnecessary(skb) &&
+           unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
                goto inhdr_error;
 
        len = ntohs(iph->tot_len);
#1 lore raw
Quoted 18 lines · On Fri, 22 Aug 2008 22:24:31 +0300 Octavian Purdila <[email protected]>…

We are working on a completely in hardware LRO implementation and this patch would simplify the hardware implementation. Is this acceptable?

net/ipv4/ip_input.c +2 -2
@@ -415,7 +415,8 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
 
        iph = ip_hdr(skb);
 
-       if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
+       if (!skb_csum_unnecessary(skb) &&
+           unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
                goto inhdr_error;
 
        len = ntohs(iph->tot_len);
 
--
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

The overhead of the additional conditional might outweigh any benefit.

maintainer
#6 lore raw
In reply to Octavian Purdila

From: Octavian Purdila <[email protected]>
Date: Fri, 22 Aug 2008 22:24:31 +0300

Quoted 2 lines

We are working on a completely in hardware LRO implementation and this patch would simplify the hardware implementation. Is this acceptable?

This is not worth the bother, otherwise we would have done it a long time ago.

Please provide a correct IP header checksum in your hw LRO implementation.

maintainer
#2 lore raw
In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>
Date: Fri, 22 Aug 2008 18:33:20 -0400

Quoted 18 lines
Quoted 15 lines · On Fri, 22 Aug 2008 22:24:31 +0300 Octavian Purdila <[email protected]>…

We are working on a completely in hardware LRO implementation and this patch would simplify the hardware implementation. Is this acceptable?

net/ipv4/ip_input.c +2 -1
@@ -415,7 +415,8 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
 
        iph = ip_hdr(skb);
 
-       if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
+       if (!skb_csum_unnecessary(skb) &&
+           unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
                goto inhdr_error;
 
Quoted 8 lines
Quoted 6 lines
net/ipv4/ip_input.c +0 -1
        len = ntohs(iph->tot_len);
 
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

The overhead of the additional conditional might outweigh any benefit.

I don't think they want this for performance, they want to not have to compute the IP header checksum in their HW LRO implementation, which is just as silly :-)

#3 lore raw
Quoted 30 lines · On Fri, 22 Aug 2008 17:36:25 -0700 (PDT) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Fri, 22 Aug 2008 18:33:20 -0400

Quoted 18 lines
Quoted 15 lines · On Fri, 22 Aug 2008 22:24:31 +0300 Octavian Purdila <[email protected]>…

We are working on a completely in hardware LRO implementation and this patch would simplify the hardware implementation. Is this acceptable?

net/ipv4/ip_input.c +2 -1
@@ -415,7 +415,8 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
 
        iph = ip_hdr(skb);
 
-       if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
+       if (!skb_csum_unnecessary(skb) &&
+           unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
                goto inhdr_error;
 
Quoted 8 lines
Quoted 6 lines
net/ipv4/ip_input.c +0 -1
        len = ntohs(iph->tot_len);
 
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

The overhead of the additional conditional might outweigh any benefit.

Quoted 3 lines

I don't think they want this for performance, they want to not have to compute the IP header checksum in their HW LRO implementation, which is just as silly :-)

And braindead for any other uses (like filtering or forwarding).

#4 lore raw
In reply to David Miller
Quoted 4 lines · David Miller

I don't think they want this for performance, they want to not have to compute the IP header checksum in their HW LRO implementation, which is just as silly :-)

I sure hope they're not planning on leaving out the IP header checksum verification too :)

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#5 lore raw

From: Herbert Xu <[email protected]>
Date: Sat, 23 Aug 2008 15:15:17 +1000

Quoted 3 lines
Quoted 3 lines

I don't think they want this for performance, they want to not have to compute the IP header checksum in their HW LRO implementation, which is just as silly :-)

Yes, this was the intention, it seemed like a reasonable trade-off between FPGA space & complexity / software complexity at the time. Thanks for the input, will do it in hardware then.

Quoted 2 lines

I sure hope they're not planning on leaving out the IP header checksum verification too :)

Of course not :)

tavi