[RFC,3/3] Use hardware checksum for UDPv6 and ICMPv6

Message ID 1358165707.27054.67.camel@shinybook.infradead.org
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

David Woodhouse Jan. 14, 2013, 12:15 p.m.
This actually enables the use of CHECKSUM_PARTIAL for outbound ICMPv6
frames. My check in the driver for non-hw-csum frames was *also*
triggering when I was running 'nc -u' over IPv6, and this appears to fix
that too. Is there a reason it wasn't happening already?

I only see the driver check trigger for ndisc and igmp frames now, and I
don't think we care very much about those?

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>


diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 5552d13..8a27090 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1370,7 +1370,12 @@  alloc_new_skb:
 			 *	Fill in the control structures
-			skb->ip_summed = CHECKSUM_NONE;
+			if ((sk->sk_protocol == IPPROTO_ICMPV6 ||
+			     sk->sk_protocol == IPPROTO_UDP) &&
+			    rt->dst.dev->features & NETIF_F_HW_CSUM)
+				skb->ip_summed = CHECKSUM_PARTIAL;
+			else
+				skb->ip_summed = CHECKSUM_NONE;
 			skb->csum = 0;
 			/* reserve for fragmentation and ipsec header */
 			skb_reserve(skb, hh_len + sizeof(struct frag_hdr) +