Skip to content

Commit

Permalink
IP_GRE: Fix GRE_CSUM case.
Browse files Browse the repository at this point in the history
commit "ip_gre: allow CSUM capable devices to handle packets"
aa0e51c, 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>
Acked-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pravin B Shelar authored and David S. Miller committed Feb 25, 2013
1 parent 8dc98eb commit 8f10098
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ static int ipgre_rcv(struct sk_buff *skb)
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;

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8f10098

Please sign in to comment.