[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1358165551.27054.64.camel@shinybook.infradead.org>
Date: Mon, 14 Jan 2013 12:12:31 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: netdev@...r.kernel.org
Subject: [RFC PATCH 2/3] Prepare to allow for hardware checksum of ICMPv6
If netif_skb_features() has to filter out non-TCP and non-UDP frames
anyway for devices with limited checksum support, there's no reason we
shouldn't generate them in our *own* stack. This allows ICMPv6 to do
so...
Signed-off-by: David Woodhouse <David.Woodhouse@...el.com>
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index b4a9fd5..e474df9 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -235,12 +235,19 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, struc
icmp6h->icmp6_cksum = 0;
if (skb_queue_len(&sk->sk_write_queue) == 1) {
- skb->csum = csum_partial(icmp6h,
- sizeof(struct icmp6hdr), skb->csum);
- icmp6h->icmp6_cksum = csum_ipv6_magic(&fl6->saddr,
- &fl6->daddr,
- len, fl6->flowi6_proto,
- skb->csum);
+ if (skb->ip_summed == CHECKSUM_PARTIAL) {
+ skb->csum_start = skb_transport_header(skb) - skb->head;
+ skb->csum_offset = offsetof(struct icmp6hdr, icmp6_cksum);
+ icmp6h->icmp6_cksum = ~csum_ipv6_magic(&fl6->saddr, &fl6->daddr,
+ len, fl6->flowi6_proto, 0);
+ } else {
+ skb->csum = csum_partial(icmp6h,
+ sizeof(struct icmp6hdr), skb->csum);
+ icmp6h->icmp6_cksum = csum_ipv6_magic(&fl6->saddr,
+ &fl6->daddr,
+ len, fl6->flowi6_proto,
+ skb->csum);
+ }
} else {
__wsum tmp_csum = 0;
--
dwmw2
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (6171 bytes)
Powered by blists - more mailing lists