diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2013-02-24 15:05:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-25 15:47:41 -0500 |
commit | 8f10098fb978c3cdd8ee7d72f7aa4330873f4544 (patch) | |
tree | cbd52a954ee36b237b6d230088a1116ced5fdc78 /net/ipv4 | |
parent | 8dc98eb2e8ccfbfb90348f8dc42f4a528a8a9961 (diff) |
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>
Acked-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | 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 b8bada00d516..406512934507 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -735,7 +735,7 @@ drop: | |||
735 | return 0; | 735 | return 0; |
736 | } | 736 | } |
737 | 737 | ||
738 | static struct sk_buff *handle_offloads(struct sk_buff *skb) | 738 | static struct sk_buff *handle_offloads(struct ip_tunnel *tunnel, struct sk_buff *skb) |
739 | { | 739 | { |
740 | int err; | 740 | int err; |
741 | 741 | ||
@@ -745,8 +745,12 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb) | |||
745 | goto error; | 745 | goto error; |
746 | skb_shinfo(skb)->gso_type |= SKB_GSO_GRE; | 746 | skb_shinfo(skb)->gso_type |= SKB_GSO_GRE; |
747 | return skb; | 747 | return skb; |
748 | } | 748 | } else if (skb->ip_summed == CHECKSUM_PARTIAL && |
749 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 749 | tunnel->parms.o_flags&GRE_CSUM) { |
750 | err = skb_checksum_help(skb); | ||
751 | if (unlikely(err)) | ||
752 | goto error; | ||
753 | } else if (skb->ip_summed != CHECKSUM_PARTIAL) | ||
750 | skb->ip_summed = CHECKSUM_NONE; | 754 | skb->ip_summed = CHECKSUM_NONE; |
751 | 755 | ||
752 | return skb; | 756 | return skb; |
@@ -776,7 +780,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
776 | int err; | 780 | int err; |
777 | int pkt_len; | 781 | int pkt_len; |
778 | 782 | ||
779 | skb = handle_offloads(skb); | 783 | skb = handle_offloads(tunnel, skb); |
780 | if (IS_ERR(skb)) { | 784 | if (IS_ERR(skb)) { |
781 | dev->stats.tx_dropped++; | 785 | dev->stats.tx_dropped++; |
782 | return NETDEV_TX_OK; | 786 | return NETDEV_TX_OK; |