Skip to contentSkip to conversation

ip_gre: allow CSUM capable devices to handle packets

PATCH Applied Dmitry Kravkov 4 participants 20 messages Feb 18, 2013 – Feb 25, 2013

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

PATCH v2 2/2 ip_gre: propogate target device GSO capability to the tunnel device

In reply to Dmitry Kravkov

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +8 -2
index cdc31ac..31bc941 100644
@@ -1103,8 +1103,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
 	tunnel->hlen = addend;
 	/* TCP offload with GRE SEQ is not supported. */
 	if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-		dev->features		|= NETIF_F_GSO_SOFTWARE;
-		dev->hw_features	|= NETIF_F_GSO_SOFTWARE;
+		/* device supports enc gso offload*/
+		if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
+			dev->features		|= NETIF_F_TSO;
+			dev->hw_features	|= NETIF_F_TSO;
+		} else {
+			dev->features		|= NETIF_F_GSO_SOFTWARE;
+			dev->hw_features	|= NETIF_F_GSO_SOFTWARE;
+		}
 	}
 
 	return mtu;
Signature · 1 line
1.7.7.2
#0 lore raw

PATCH v2 1/2 ip_gre: allow CSUM capable devices to handle packets

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +2 -5
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb)
 			goto error;
 		skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
 		return skb;
-	} else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-		err = skb_checksum_help(skb);
-		if (unlikely(err))
-			goto error;
 	}
-	skb->ip_summed = CHECKSUM_NONE;
+	if (skb->ip_summed != CHECKSUM_PARTIAL)
+		skb->ip_summed = CHECKSUM_NONE;
 
 	return skb;
 
Signature · 1 line
1.7.7.2
#11 lore raw
In reply to Dmitry Kravkov
Quoted 30 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +2 -6
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb)
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
--
Quoted 3 lines

1.7.7.2

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Quoted 4 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

#3 lore raw

Re: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

In reply to Dmitry Kravkov
Quoted 18 lines · Dmitry Kravkov

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +0 -1
index cdc31ac..31bc941 100644
@@ -1103,8 +1103,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
        tunnel->hlen = addend;
        /* TCP offload with GRE SEQ is not supported. */
        if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               dev->features           |= NETIF_F_GSO_SOFTWARE;

net/ipv4/ip_gre.c static int ipgre_tunnel_bind_dev(struct net_device *dev) · line 1114

Quoted 10 lines
net/ipv4/ip_gre.c +8 -1
-               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               /* device supports enc gso offload*/
+               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
+                       dev->features           |= NETIF_F_TSO;
+                       dev->hw_features        |= NETIF_F_TSO;
+               } else {
+                       dev->features           |= NETIF_F_GSO_SOFTWARE;
+                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               }
        }

I am not sure about this change, Are you trying to limit GRE TSO to just IPV4 in case of GRE offload in hardware?

Quoted 10 lines
net/ipv4/ip_gre.c +0 -1
        return mtu;
--

1.7.7.2

--
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

#12 lore raw
In reply to pravin
Quoted 41 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:28 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct sk_buff

Quoted 15 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +0 -0
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff

*skb)

Quoted 14 lines
net/ipv4/ip_gre.c +2 -5
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
Quoted 7 lines
Quoted 4 lines

--
1.7.7.2

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Testing for o_flags&GRE_CSUM does not look too hurt here, since it will be used in ipgre_tunnel_xmit() later on This is the only problematic case, right?

Quoted 4 lines
Quoted 4 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

#4 lore raw

RE: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

In reply to pravin
Quoted 40 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:40 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

net/ipv4/ip_gre.c static int ipgre_tunnel_bind_dev(struct net_device

Quoted 14 lines · Dmitry Kravkov

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +0 -0
index cdc31ac..31bc941 100644
@@ -1103,8 +1103,14 @@ static int ipgre_tunnel_bind_dev(struct net_device

*dev)

Quoted 4 lines
net/ipv4/ip_gre.c +0 -1
        tunnel->hlen = addend;
        /* TCP offload with GRE SEQ is not supported. */
        if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               dev->features           |= NETIF_F_GSO_SOFTWARE;

net/ipv4/ip_gre.c static int ipgre_tunnel_bind_dev(struct net_device *dev) · line 1114

Quoted 10 lines
net/ipv4/ip_gre.c +8 -1
-               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               /* device supports enc gso offload*/
+               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
+                       dev->features           |= NETIF_F_TSO;
+                       dev->hw_features        |= NETIF_F_TSO;
+               } else {
+                       dev->features           |= NETIF_F_GSO_SOFTWARE;
+                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               }
        }
Quoted 3 lines

I am not sure about this change, Are you trying to limit GRE TSO to just IPV4 in case of GRE offload in hardware?

You're right,
It probably should be fixed to:

	if (tdev && tdev->hw_enc_features & NETIF_F_GRE_GSO) {
		dev->features           |= tdev-> hw_enc_features & NETIF_F_GSO_MASK;
		dev->hw_features        |= tdev-> hw_enc_features & NETIF_F_GSO_MASK;
Quoted 10 lines
Quoted 10 lines
net/ipv4/ip_gre.c +0 -1
        return mtu;
--

1.7.7.2

--
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

#5 lore raw

Re: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

Quoted 40 lines · Dmitry Kravkov
Quoted 40 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:40 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

net/ipv4/ip_gre.c static int ipgre_tunnel_bind_dev(struct net_device

Quoted 14 lines · Dmitry Kravkov

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +0 -0
index cdc31ac..31bc941 100644
@@ -1103,8 +1103,14 @@ static int ipgre_tunnel_bind_dev(struct net_device

*dev)

Quoted 14 lines
net/ipv4/ip_gre.c +8 -2
        tunnel->hlen = addend;
        /* TCP offload with GRE SEQ is not supported. */
        if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               dev->features           |= NETIF_F_GSO_SOFTWARE;
-               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               /* device supports enc gso offload*/
+               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
+                       dev->features           |= NETIF_F_TSO;
+                       dev->hw_features        |= NETIF_F_TSO;
+               } else {
+                       dev->features           |= NETIF_F_GSO_SOFTWARE;
+                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               }
        }
Quoted 14 lines
Quoted 3 lines

I am not sure about this change, Are you trying to limit GRE TSO to just IPV4 in case of GRE offload in hardware?

You're right,
It probably should be fixed to:

        if (tdev && tdev->hw_enc_features & NETIF_F_GRE_GSO) {
                dev->features           |= tdev-> hw_enc_features & NETIF_F_GSO_MASK;
                dev->hw_features        |= tdev-> hw_enc_features & NETIF_F_GSO_MASK;
Quoted 5 lines
Quoted 5 lines
net/ipv4/ip_gre.c +0 -1
        return mtu;
--

1.7.7.2

I think if device features are set right, dev_hard_start_xmit() should do right thing without any of these changes. i.e. it will GSO ipv6 packets if hardware only supports GRE-ipv4 packets.
This patch changes that at encapsulated dev layer and disables rest of GSO if one type of TSO available which is not optimal.

Quoted 7 lines
Quoted 5 lines
Quoted 5 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

#13 lore raw
In reply to Dmitry Kravkov
Quoted 46 lines · Dmitry Kravkov
Quoted 46 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:28 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct sk_buff

Quoted 15 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +0 -0
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff

*skb)

Quoted 18 lines
net/ipv4/ip_gre.c +2 -6
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
--

1.7.7.2

Quoted 6 lines
Quoted 2 lines

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Testing for o_flags&GRE_CSUM does not look too hurt here, since it will be used in ipgre_tunnel_xmit() later on This is the only problematic case, right?

It does not work for me. I have GRE device with csum on. Ping works fine but Netperf is not working.
Looking at code, I am not sure how tcp will work if inner packet TCP checksum is calculated after GRE_CSUM calculation.

Thanks,
Pravin.

#14 lore raw
Quoted 59 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Wednesday, February 20, 2013 1:04 AM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

Quoted 49 lines · Dmitry Kravkov
Quoted 48 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:28 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct sk_buff

Quoted 15 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +0 -0
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff

*skb)

Quoted 15 lines
net/ipv4/ip_gre.c +2 -6
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
--
Quoted 3 lines

1.7.7.2

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Quoted 7 lines
Quoted 1 line

Testing for o_flags&GRE_CSUM does not look too hurt here, since it will be

used in ipgre_tunnel_xmit() later on

Quoted 2 lines

This is the only problematic case, right?

It does not work for me. I have GRE device with csum on. Ping works fine but Netperf is not working.

I will test this mode also ...

Quoted 2 lines

Looking at code, I am not sure how tcp will work if inner packet TCP checksum is calculated after GRE_CSUM calculation.

Not sure if there is HW that supports it today

Quoted 2 lines

Thanks,
Pravin.

#15 lore raw
In reply to pravin
Quoted 50 lines · pravin
Quoted 49 lines · Dmitry Kravkov
Quoted 48 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:28 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct sk_buff

Quoted 15 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +0 -0
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff

*skb)

Quoted 15 lines
net/ipv4/ip_gre.c +2 -6
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
--
Quoted 3 lines

1.7.7.2

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Quoted 8 lines
Quoted 3 lines

Testing for o_flags&GRE_CSUM does not look too hurt here, since it will be used in ipgre_tunnel_xmit() later on This is the only problematic case, right?

It does not work for me. I have GRE device with csum on. Ping works fine but Netperf is not working.
Looking at code, I am not sure how tcp will work if inner packet TCP checksum is calculated after GRE_CSUM calculation.

Fixes handling when CSUM or SEQ flags are set - via skb_checksum_help()
---
Tested with each mode (separately)

 net/ipv4/ip_gre.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
net/ipv4/ip_gre.c +2 -1
index 5ef4da7..0de54cd 100644
@@ -735,7 +735,8 @@ drop:
 	return 0;
 }
 
-static struct sk_buff *handle_offloads(struct sk_buff *skb)
+static struct sk_buff *handle_offloads(struct ip_tunnel *tunnel,
+				       struct sk_buff *skb)
 {
 	int err;
 
@@ -745,8 +746,15 @@ static struct sk_buff *handle_offloads(struct

sk_buff *skb)
goto error;
skb_shinfo(skb)->gso_type |= SKB_GSO_GRE; return skb;
+ } else if (tunnel->parms.o_flags&(GRE_SEQ|GRE_CSUM) &&
+ skb->ip_summed == CHECKSUM_PARTIAL) {
+ err = skb_checksum_help(skb);
+ if (unlikely(err))
+ goto error;
}
- if (skb->ip_summed != CHECKSUM_PARTIAL)
+
+ if (skb->ip_summed != CHECKSUM_PARTIAL ||
+ tunnel->parms.o_flags&(GRE_SEQ|GRE_CSUM))
skb->ip_summed = CHECKSUM_NONE;

return skb;
@@ -776,7 +784,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
int err;
int pkt_len;

- skb = handle_offloads(skb);
+ skb = handle_offloads(tunnel, skb);
if (IS_ERR(skb)) {
dev->stats.tx_dropped++;
return NETDEV_TX_OK;

Signature · 1 line
1.7.7.2
Quoted 3 lines

Thanks,
Pravin.

#6 lore raw

Re: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

In reply to pravin
Quoted 24 lines · pravin
Quoted 23 lines · Dmitry Kravkov

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +4 -2
index cdc31ac..31bc941 100644
@@ -1103,8 +1103,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
        tunnel->hlen = addend;
        /* TCP offload with GRE SEQ is not supported. */
        if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               dev->features           |= NETIF_F_GSO_SOFTWARE;
-               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               /* device supports enc gso offload*/
+               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
+                       dev->features           |= NETIF_F_TSO;
+                       dev->hw_features        |= NETIF_F_TSO;
Quoted 8 lines

net/ipv4/ip_gre.c static int ipgre_tunnel_bind_dev(struct net_device *dev) · line 1114

Quoted 5 lines
net/ipv4/ip_gre.c +4 -0
+               } else {
+                       dev->features           |= NETIF_F_GSO_SOFTWARE;
+                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               }
        }

I am not sure about this change, Are you trying to limit GRE TSO to just IPV4 in case of GRE offload in hardware?

This mostly reverts previous patch, but also disables GSO when CSUM is set.

---
 net/ipv4/ip_gre.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
net/ipv4/ip_gre.c +0 -0
index 0de54cd..aae2d4b 100644
@@ -1107,16 +1107,10 @@ static int ipgre_tunnel_bind_dev(struct

net_device *dev)
mtu = 68;

tunnel->hlen = addend;
- /* TCP offload with GRE SEQ is not supported. */
- if (!(tunnel->parms.o_flags & GRE_SEQ)) {
- /* device supports enc gso offload*/
- if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
- dev->features |= NETIF_F_TSO;
- dev->hw_features |= NETIF_F_TSO;
- } else {
- dev->features |= NETIF_F_GSO_SOFTWARE;
- dev->hw_features |= NETIF_F_GSO_SOFTWARE;
- }
+ /* TCP offload with GRE SEQ or CSUM is not supported. */
+ if (!(tunnel->parms.o_flags & (GRE_SEQ|GRE_CSUM))) {
+ dev->features |= NETIF_F_GSO_SOFTWARE;
+ dev->hw_features |= NETIF_F_GSO_SOFTWARE;
}

return mtu;

Signature · 1 line
1.7.7.2
Quoted 11 lines
Quoted 10 lines
net/ipv4/ip_gre.c +0 -1
        return mtu;
--

1.7.7.2

--
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

#16 lore raw
In reply to Dmitry Kravkov
Quoted 89 lines · Dmitry Kravkov
Quoted 50 lines · pravin
Quoted 49 lines · Dmitry Kravkov
Quoted 48 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:28 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct sk_buff

Quoted 15 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +0 -0
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff

*skb)

Quoted 15 lines
net/ipv4/ip_gre.c +2 -6
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
--
Quoted 3 lines

1.7.7.2

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Quoted 8 lines
Quoted 3 lines

Testing for o_flags&GRE_CSUM does not look too hurt here, since it will be used in ipgre_tunnel_xmit() later on This is the only problematic case, right?

It does not work for me. I have GRE device with csum on. Ping works fine but Netperf is not working.
Looking at code, I am not sure how tcp will work if inner packet TCP checksum is calculated after GRE_CSUM calculation.

Fixes handling when CSUM or SEQ flags are set - via skb_checksum_help()
---
Tested with each mode (separately)

 net/ipv4/ip_gre.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
net/ipv4/ip_gre.c +4 -1
index 5ef4da7..0de54cd 100644
@@ -735,7 +735,8 @@ drop:
        return 0;
 }
 
-static struct sk_buff *handle_offloads(struct sk_buff *skb)
+static struct sk_buff *handle_offloads(struct ip_tunnel *tunnel,
+                                      struct sk_buff *skb)
 {
        int err;
 
@@ -745,8 +746,15 @@ static struct sk_buff *handle_offloads(struct
 sk_buff *skb)
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
+       } else if (tunnel->parms.o_flags&(GRE_SEQ|GRE_CSUM) &&
+                  skb->ip_summed == CHECKSUM_PARTIAL) {

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct · line 760

Quoted 10 lines
net/ipv4/ip_gre.c +6 -1
+               err = skb_checksum_help(skb);
+               if (unlikely(err))
+                       goto error;
        }
-       if (skb->ip_summed != CHECKSUM_PARTIAL)
+
+       if (skb->ip_summed != CHECKSUM_PARTIAL ||
+           tunnel->parms.o_flags&(GRE_SEQ|GRE_CSUM))
                skb->ip_summed = CHECKSUM_NONE;
 

We can simplify this by dropping check of o_flags.

Quoted 21 lines
        return skb;
net/ipv4/ip_gre.c +1 -1
@@ -776,7 +784,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff
 *skb, struct net_device *dev
        int    err;
        int    pkt_len;
 
-       skb = handle_offloads(skb);
+       skb = handle_offloads(tunnel, skb);
        if (IS_ERR(skb)) {
                dev->stats.tx_dropped++;
                return NETDEV_TX_OK;

--
1.7.7.2

Quoted 3 lines

Thanks,
Pravin.

#7 lore raw

Re: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

In reply to Dmitry Kravkov
Quoted 67 lines · Dmitry Kravkov
Quoted 24 lines · pravin
Quoted 23 lines · Dmitry Kravkov

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +4 -2
index cdc31ac..31bc941 100644
@@ -1103,8 +1103,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
        tunnel->hlen = addend;
        /* TCP offload with GRE SEQ is not supported. */
        if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               dev->features           |= NETIF_F_GSO_SOFTWARE;
-               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               /* device supports enc gso offload*/
+               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
+                       dev->features           |= NETIF_F_TSO;
+                       dev->hw_features        |= NETIF_F_TSO;
Quoted 8 lines

net/ipv4/ip_gre.c static int ipgre_tunnel_bind_dev(struct net_device *dev) · line 1114

Quoted 5 lines
net/ipv4/ip_gre.c +4 -0
+               } else {
+                       dev->features           |= NETIF_F_GSO_SOFTWARE;
+                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               }
        }

I am not sure about this change, Are you trying to limit GRE TSO to just IPV4 in case of GRE offload in hardware?

This mostly reverts previous patch, but also disables GSO when CSUM is set.

---
 net/ipv4/ip_gre.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
net/ipv4/ip_gre.c +4 -10
index 0de54cd..aae2d4b 100644
@@ -1107,16 +1107,10 @@ static int ipgre_tunnel_bind_dev(struct
 net_device *dev)
                mtu = 68;
 
        tunnel->hlen = addend;
-       /* TCP offload with GRE SEQ is not supported. */
-       if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               /* device supports enc gso offload*/
-               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
-                       dev->features           |= NETIF_F_TSO;
-                       dev->hw_features        |= NETIF_F_TSO;
-               } else {
-                       dev->features           |= NETIF_F_GSO_SOFTWARE;
-                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
-               }
+       /* TCP offload with GRE SEQ or CSUM is not supported. */
+       if (!(tunnel->parms.o_flags & (GRE_SEQ|GRE_CSUM))) {
+               dev->features           |= NETIF_F_GSO_SOFTWARE;
+               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
        }
 
Quoted 1 line
        return mtu;

This narrows down definition of NETIF_F_GRE_GSO. Is it required for hardware offload?

Quoted 18 lines

--
1.7.7.2

Quoted 11 lines
Quoted 10 lines
net/ipv4/ip_gre.c +0 -1
        return mtu;
--

1.7.7.2

--
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

#17 lore raw
In reply to pravin
Quoted 83 lines · pravin
Quoted 82 lines · Dmitry Kravkov
Quoted 50 lines · pravin
Quoted 49 lines · Dmitry Kravkov
Quoted 48 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:28 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct sk_buff

Quoted 15 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +0 -0
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff

*skb)

Quoted 15 lines
net/ipv4/ip_gre.c +2 -6
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
--
Quoted 3 lines

1.7.7.2

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Quoted 8 lines
Quoted 3 lines

Testing for o_flags&GRE_CSUM does not look too hurt here, since it will be used in ipgre_tunnel_xmit() later on This is the only problematic case, right?

It does not work for me. I have GRE device with csum on. Ping works fine but Netperf is not working.
Looking at code, I am not sure how tcp will work if inner packet TCP checksum is calculated after GRE_CSUM calculation.

Fixes handling when CSUM or SEQ flags are set - via skb_checksum_help()
---
Tested with each mode (separately)

 net/ipv4/ip_gre.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
net/ipv4/ip_gre.c +2 -1
index 5ef4da7..0de54cd 100644
@@ -735,7 +735,8 @@ drop:
        return 0;
 }
 
-static struct sk_buff *handle_offloads(struct sk_buff *skb)
+static struct sk_buff *handle_offloads(struct ip_tunnel *tunnel,
+                                      struct sk_buff *skb)
 {
        int err;
 
Quoted 11 lines

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct · line 755

Quoted 11 lines
net/ipv4/ip_gre.c +5 -0
@@ -745,8 +746,15 @@ static struct sk_buff *handle_offloads(struct
 sk_buff *skb)
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
+       } else if (tunnel->parms.o_flags&(GRE_SEQ|GRE_CSUM) &&
+                  skb->ip_summed == CHECKSUM_PARTIAL) {
+               err = skb_checksum_help(skb);
+               if (unlikely(err))
+                       goto error;
        }

one more thing, there is no need to do csum for GRE_SEQ case.

Quoted 29 lines

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct · line 760

Quoted 6 lines
net/ipv4/ip_gre.c +3 -1
-       if (skb->ip_summed != CHECKSUM_PARTIAL)
+
+       if (skb->ip_summed != CHECKSUM_PARTIAL ||
+           tunnel->parms.o_flags&(GRE_SEQ|GRE_CSUM))
                skb->ip_summed = CHECKSUM_NONE;
 

We can simplify this by dropping check of o_flags.

Quoted 21 lines
        return skb;
net/ipv4/ip_gre.c +1 -1
@@ -776,7 +784,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff
 *skb, struct net_device *dev
        int    err;
        int    pkt_len;
 
-       skb = handle_offloads(skb);
+       skb = handle_offloads(tunnel, skb);
        if (IS_ERR(skb)) {
                dev->stats.tx_dropped++;
                return NETDEV_TX_OK;

--
1.7.7.2

Quoted 3 lines

Thanks,
Pravin.

#8 lore raw

Re: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

In reply to pravin
Quoted 68 lines · pravin
Quoted 67 lines · Dmitry Kravkov
Quoted 24 lines · pravin
Quoted 23 lines · Dmitry Kravkov

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +4 -2
index cdc31ac..31bc941 100644
@@ -1103,8 +1103,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
        tunnel->hlen = addend;
        /* TCP offload with GRE SEQ is not supported. */
        if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               dev->features           |= NETIF_F_GSO_SOFTWARE;
-               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               /* device supports enc gso offload*/
+               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
+                       dev->features           |= NETIF_F_TSO;
+                       dev->hw_features        |= NETIF_F_TSO;
Quoted 8 lines

net/ipv4/ip_gre.c static int ipgre_tunnel_bind_dev(struct net_device *dev) · line 1114

Quoted 5 lines
net/ipv4/ip_gre.c +4 -0
+               } else {
+                       dev->features           |= NETIF_F_GSO_SOFTWARE;
+                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               }
        }

I am not sure about this change, Are you trying to limit GRE TSO to just IPV4 in case of GRE offload in hardware?

This mostly reverts previous patch, but also disables GSO when CSUM is set.

---
 net/ipv4/ip_gre.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
net/ipv4/ip_gre.c +4 -10
index 0de54cd..aae2d4b 100644
@@ -1107,16 +1107,10 @@ static int ipgre_tunnel_bind_dev(struct
 net_device *dev)
                mtu = 68;
 
        tunnel->hlen = addend;
-       /* TCP offload with GRE SEQ is not supported. */
-       if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               /* device supports enc gso offload*/
-               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
-                       dev->features           |= NETIF_F_TSO;
-                       dev->hw_features        |= NETIF_F_TSO;
-               } else {
-                       dev->features           |= NETIF_F_GSO_SOFTWARE;
-                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
-               }
+       /* TCP offload with GRE SEQ or CSUM is not supported. */
+       if (!(tunnel->parms.o_flags & (GRE_SEQ|GRE_CSUM))) {
+               dev->features           |= NETIF_F_GSO_SOFTWARE;
+               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
        }
 
Quoted 4 lines
Quoted 1 line
        return mtu;

This narrows down definition of NETIF_F_GRE_GSO. Is it required for hardware offload?

This is required to prevent dev_hard_xmit() to perform soft GSO. W/o it device receives divided packets.

#18 lore raw
In reply to pravin
Quoted 84 lines · pravin
Quoted 83 lines · pravin
Quoted 82 lines · Dmitry Kravkov
Quoted 50 lines · pravin
Quoted 49 lines · Dmitry Kravkov
Quoted 48 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:28 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct sk_buff

Quoted 15 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +0 -0
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff

*skb)

Quoted 15 lines
net/ipv4/ip_gre.c +2 -6
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
--
Quoted 3 lines

1.7.7.2

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Quoted 8 lines
Quoted 3 lines

Testing for o_flags&GRE_CSUM does not look too hurt here, since it will be used in ipgre_tunnel_xmit() later on This is the only problematic case, right?

It does not work for me. I have GRE device with csum on. Ping works fine but Netperf is not working.
Looking at code, I am not sure how tcp will work if inner packet TCP checksum is calculated after GRE_CSUM calculation.

Fixes handling when CSUM or SEQ flags are set - via skb_checksum_help()
---
Tested with each mode (separately)

 net/ipv4/ip_gre.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
net/ipv4/ip_gre.c +2 -1
index 5ef4da7..0de54cd 100644
@@ -735,7 +735,8 @@ drop:
        return 0;
 }
 
-static struct sk_buff *handle_offloads(struct sk_buff *skb)
+static struct sk_buff *handle_offloads(struct ip_tunnel *tunnel,
+                                      struct sk_buff *skb)
 {
        int err;
 
Quoted 13 lines
Quoted 11 lines

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct · line 755

Quoted 11 lines
net/ipv4/ip_gre.c +5 -0
@@ -745,8 +746,15 @@ static struct sk_buff *handle_offloads(struct
 sk_buff *skb)
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
+       } else if (tunnel->parms.o_flags&(GRE_SEQ|GRE_CSUM) &&
+                  skb->ip_summed == CHECKSUM_PARTIAL) {
+               err = skb_checksum_help(skb);
+               if (unlikely(err))
+                       goto error;
        }

one more thing, there is no need to do csum for GRE_SEQ case.

If csum is not performed TCP csum become incorrect for offload capable and incapable devices.

#9 lore raw

Re: [PATCH net-next v2 2/2] ip_gre: propogate target device GSO capability to the tunnel device

In reply to Dmitry Kravkov
Quoted 69 lines · Dmitry Kravkov
Quoted 68 lines · pravin
Quoted 67 lines · Dmitry Kravkov
Quoted 24 lines · pravin
Quoted 23 lines · Dmitry Kravkov

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +4 -2
index cdc31ac..31bc941 100644
@@ -1103,8 +1103,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
        tunnel->hlen = addend;
        /* TCP offload with GRE SEQ is not supported. */
        if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               dev->features           |= NETIF_F_GSO_SOFTWARE;
-               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               /* device supports enc gso offload*/
+               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
+                       dev->features           |= NETIF_F_TSO;
+                       dev->hw_features        |= NETIF_F_TSO;
Quoted 8 lines

net/ipv4/ip_gre.c static int ipgre_tunnel_bind_dev(struct net_device *dev) · line 1114

Quoted 5 lines
net/ipv4/ip_gre.c +4 -0
+               } else {
+                       dev->features           |= NETIF_F_GSO_SOFTWARE;
+                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
+               }
        }

I am not sure about this change, Are you trying to limit GRE TSO to just IPV4 in case of GRE offload in hardware?

This mostly reverts previous patch, but also disables GSO when CSUM is set.

---
 net/ipv4/ip_gre.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
net/ipv4/ip_gre.c +4 -10
index 0de54cd..aae2d4b 100644
@@ -1107,16 +1107,10 @@ static int ipgre_tunnel_bind_dev(struct
 net_device *dev)
                mtu = 68;
 
        tunnel->hlen = addend;
-       /* TCP offload with GRE SEQ is not supported. */
-       if (!(tunnel->parms.o_flags & GRE_SEQ)) {
-               /* device supports enc gso offload*/
-               if (tdev->hw_enc_features & NETIF_F_GRE_GSO) {
-                       dev->features           |= NETIF_F_TSO;
-                       dev->hw_features        |= NETIF_F_TSO;
-               } else {
-                       dev->features           |= NETIF_F_GSO_SOFTWARE;
-                       dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
-               }
+       /* TCP offload with GRE SEQ or CSUM is not supported. */
+       if (!(tunnel->parms.o_flags & (GRE_SEQ|GRE_CSUM))) {
+               dev->features           |= NETIF_F_GSO_SOFTWARE;
+               dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
        }
 
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
        return mtu;

This narrows down definition of NETIF_F_GRE_GSO. Is it required for hardware offload?

This is required to prevent dev_hard_xmit() to perform soft GSO. W/o it device receives divided packets.

If NIC features are set correctly dev_hard_xmit() will not perform GSO.

Quoted 7 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

#19 lore raw
In reply to Dmitry Kravkov
Quoted 98 lines · Dmitry Kravkov
Quoted 84 lines · pravin
Quoted 83 lines · pravin
Quoted 82 lines · Dmitry Kravkov
Quoted 50 lines · pravin
Quoted 49 lines · Dmitry Kravkov
Quoted 48 lines

-----Original Message-----
From: pravin [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:28 PM
To: Dmitry Kravkov
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next v2 1/2] ip_gre: allow CSUM capable devices to handle packets

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct sk_buff

Quoted 15 lines · Dmitry Kravkov

If device is not able to handle checksumming it will be handled in dev_xmit

---
Changes from v1: fixed email address

 net/ipv4/ip_gre.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_gre.c +0 -0
index a56f118..cdc31ac 100644
@@ -745,12 +745,9 @@ static struct sk_buff *handle_offloads(struct sk_buff

*skb)

Quoted 15 lines
net/ipv4/ip_gre.c +2 -6
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
-       } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               err = skb_checksum_help(skb);
-               if (unlikely(err))
-                       goto error;
        }
-       skb->ip_summed = CHECKSUM_NONE;
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
 
        return skb;
 
--
Quoted 3 lines

1.7.7.2

This patch breaks GRE tunnel with GRE_CSUM. since GRE_CSUM need complete IP packet to checksum entire GRE payload.

Quoted 8 lines
Quoted 3 lines

Testing for o_flags&GRE_CSUM does not look too hurt here, since it will be used in ipgre_tunnel_xmit() later on This is the only problematic case, right?

It does not work for me. I have GRE device with csum on. Ping works fine but Netperf is not working.
Looking at code, I am not sure how tcp will work if inner packet TCP checksum is calculated after GRE_CSUM calculation.

Fixes handling when CSUM or SEQ flags are set - via skb_checksum_help()
---
Tested with each mode (separately)

 net/ipv4/ip_gre.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
net/ipv4/ip_gre.c +2 -1
index 5ef4da7..0de54cd 100644
@@ -735,7 +735,8 @@ drop:
        return 0;
 }
 
-static struct sk_buff *handle_offloads(struct sk_buff *skb)
+static struct sk_buff *handle_offloads(struct ip_tunnel *tunnel,
+                                      struct sk_buff *skb)
 {
        int err;
 
Quoted 13 lines
Quoted 11 lines

net/ipv4/ip_gre.c static struct sk_buff *handle_offloads(struct · line 755

Quoted 11 lines
net/ipv4/ip_gre.c +5 -0
@@ -745,8 +746,15 @@ static struct sk_buff *handle_offloads(struct
 sk_buff *skb)
                        goto error;
                skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
                return skb;
+       } else if (tunnel->parms.o_flags&(GRE_SEQ|GRE_CSUM) &&
+                  skb->ip_summed == CHECKSUM_PARTIAL) {
+               err = skb_checksum_help(skb);
+               if (unlikely(err))
+                       goto error;
        }

one more thing, there is no need to do csum for GRE_SEQ case.

Quoted 4 lines

If csum is not performed TCP csum become incorrect for offload capable and incapable devices.

that csum computation is only required for GRE_CSUM case, not for GRE_SEQ. I have send out patches to fix GRE issues, please have a look.

Quoted 6 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