Re: [PATCH net-next 7/8] net: ip_tunnel: remove 'csum_help' argument to iptunnel_handle_offloads
From: Alexander Duyck <hidden>
Date: 2016-01-11 16:39:33
Subsystem:
networking [general], the rest · Maintainers:
"David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
On Mon, Jan 11, 2016 at 5:24 AM, Edward Cree [off-list ref] wrote:
On 09/01/16 02:05, Alexander Duyck wrote:quoted
If we clear skb->encapsulation if we don't have CHECKSUM_PARTIAL set then we don't have the issue. Really the addition of the line clearing skb->encapsulation should probably be added to the first patch so that we don't leave skb->encapsulation set when we aren't requesting offloads.Next version of series will have (in this patch) if (skb->ip_summed != CHECKSUM_PARTIAL) { skb->ip_summed = CHECKSUM_NONE; skb->encapsulation = 0; } Will that do, or does it need to be squeezed into an earlier patch in the series (which one?)
Your first patch is probably the best place for it. Then when you start setting false it doesn't introduce any errors. Also I was doing a bit more work on the lco_csum function and think I have come up with something a bit more elegant that allows for the function to be easily used in the GSO routine for UDP tunnels. Here is a snippet from the patch I am working with below. Odds are the formatting will get trashed due to my mail client. What I will do is email you the full patch and the GSO patch I have as RFCs to look over and possibly incorporate into your own. Signed-off-by: Alexander Duyck <redacted> ---
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6b6bd42d6134..94244ab47e1b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h@@ -2161,6 +2161,11 @@ static inline intskb_checksum_start_offset(const struct sk_buff *skb)
return skb->csum_start - skb_headroom(skb);
}
+static inline unsigned char *skb_checksum_start(const struct sk_buff *skb)
+{
+ return skb->head + skb->csum_start;
+}
+
static inline int skb_transport_offset(const struct sk_buff *skb)
{
return skb_transport_header(skb) - skb->data;@@ -3578,6 +3583,17 @@ static inline __sum16 gso_make_checksum(structsk_buff *skb, __wsum res)
return csum_fold(partial);
}
+static inline __wsum lco_csum(struct sk_buff *skb)
+{
+ unsigned char *csum_start = skb_checksum_start(skb);
+ unsigned char *l4_hdr = skb_transport_header(skb);
+ __wsum partial;
+
+ partial = ~csum_unfold(*(__force __sum16 *)(csum_start +
+ skb->csum_offset));
+ return csum_partial(l4_hdr, csum_start - l4_hdr, partial);
+}
+
static inline bool skb_is_gso(const struct sk_buff *skb)
{
return skb_shinfo(skb)->gso_size;