* [PATCH net-next 1/2] IP_GRE: Fix GRE_CSUM case.
@ 2013-02-25 6:05 Pravin B Shelar
2013-02-25 11:40 ` Dmitry Kravkov
0 siblings, 1 reply; 3+ messages in thread
From: Pravin B Shelar @ 2013-02-25 6:05 UTC (permalink / raw)
To: davem; +Cc: netdev, dmitry, Pravin B Shelar
commit "ip_gre: allow CSUM capable devices to handle packets"
aa0e51cdda005cd37e2, broke GRE_CSUM case.
GRE_CSUM needs checksum computed for inner packet. Therefore
csum-calculation can not be offloaded if tunnel device requires
GRE_CSUM. Following patch fixes it by computing inner packet checksum
for GRE_CSUM type, for all other type of GRE devices csum is offloaded.
CC: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
net/ipv4/ip_gre.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 5ef4da7..9b4996d 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -735,7 +735,7 @@ 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 +745,12 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb)
goto error;
skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
return skb;
- }
- if (skb->ip_summed != CHECKSUM_PARTIAL)
+ } else if (skb->ip_summed == CHECKSUM_PARTIAL &&
+ tunnel->parms.o_flags&GRE_CSUM) {
+ err = skb_checksum_help(skb);
+ if (unlikely(err))
+ goto error;
+ } else if (skb->ip_summed != CHECKSUM_PARTIAL)
skb->ip_summed = CHECKSUM_NONE;
return skb;
@@ -776,7 +780,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.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH net-next 1/2] IP_GRE: Fix GRE_CSUM case.
2013-02-25 6:05 [PATCH net-next 1/2] IP_GRE: Fix GRE_CSUM case Pravin B Shelar
@ 2013-02-25 11:40 ` Dmitry Kravkov
2013-02-25 20:48 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Kravkov @ 2013-02-25 11:40 UTC (permalink / raw)
To: Pravin B Shelar, davem@davemloft.net; +Cc: netdev@vger.kernel.org
> -----Original Message-----
> From: Pravin B Shelar [mailto:pshelar@nicira.com]
> Sent: Monday, February 25, 2013 8:05 AM
> To: davem@davemloft.net
> Cc: netdev@vger.kernel.org; Dmitry Kravkov; Pravin B Shelar
> Subject: [PATCH net-next 1/2] IP_GRE: Fix GRE_CSUM case.
>
> commit "ip_gre: allow CSUM capable devices to handle packets"
> aa0e51cdda005cd37e2, broke GRE_CSUM case.
> GRE_CSUM needs checksum computed for inner packet. Therefore
> csum-calculation can not be offloaded if tunnel device requires
> GRE_CSUM. Following patch fixes it by computing inner packet checksum
> for GRE_CSUM type, for all other type of GRE devices csum is offloaded.
>
> CC: Dmitry Kravkov <dmitry@broadcom.com>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
> ---
> net/ipv4/ip_gre.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 5ef4da7..9b4996d 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -735,7 +735,7 @@ 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 +745,12 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb)
> goto error;
> skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
> return skb;
> - }
> - if (skb->ip_summed != CHECKSUM_PARTIAL)
> + } else if (skb->ip_summed == CHECKSUM_PARTIAL &&
> + tunnel->parms.o_flags&GRE_CSUM) {
> + err = skb_checksum_help(skb);
> + if (unlikely(err))
> + goto error;
> + } else if (skb->ip_summed != CHECKSUM_PARTIAL)
> skb->ip_summed = CHECKSUM_NONE;
>
> return skb;
> @@ -776,7 +780,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.1
Tested the series on two different devices
Acked-by: Dmitry Kravkov <dmitry@broadcom.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-next 1/2] IP_GRE: Fix GRE_CSUM case.
2013-02-25 11:40 ` Dmitry Kravkov
@ 2013-02-25 20:48 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-02-25 20:48 UTC (permalink / raw)
To: dmitry; +Cc: pshelar, netdev
From: "Dmitry Kravkov" <dmitry@broadcom.com>
Date: Mon, 25 Feb 2013 11:40:06 +0000
>> -----Original Message-----
>> From: Pravin B Shelar [mailto:pshelar@nicira.com]
>> Sent: Monday, February 25, 2013 8:05 AM
>> To: davem@davemloft.net
>> Cc: netdev@vger.kernel.org; Dmitry Kravkov; Pravin B Shelar
>> Subject: [PATCH net-next 1/2] IP_GRE: Fix GRE_CSUM case.
>>
>> commit "ip_gre: allow CSUM capable devices to handle packets"
>> aa0e51cdda005cd37e2, broke GRE_CSUM case.
>> GRE_CSUM needs checksum computed for inner packet. Therefore
>> csum-calculation can not be offloaded if tunnel device requires
>> GRE_CSUM. Following patch fixes it by computing inner packet checksum
>> for GRE_CSUM type, for all other type of GRE devices csum is offloaded.
>>
>> CC: Dmitry Kravkov <dmitry@broadcom.com>
>> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
...
> Tested the series on two different devices
>
> Acked-by: Dmitry Kravkov <dmitry@broadcom.com>
>
>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-25 20:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-25 6:05 [PATCH net-next 1/2] IP_GRE: Fix GRE_CSUM case Pravin B Shelar
2013-02-25 11:40 ` Dmitry Kravkov
2013-02-25 20:48 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox