diff mbox

[net-next,2/2] gre: add GSO support

Message ID 1347607533.8555.269.camel@edumazet-glaptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Sept. 14, 2012, 7:25 a.m. UTC
From: Eric Dumazet <edumazet@google.com>

Add GSO support to GRE tunnels.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Maciej Żenczykowski <maze@google.com>
---
 net/ipv4/ip_gre.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Maciej Żenczykowski Sept. 14, 2012, 5:12 p.m. UTC | #1
Thanks!

So I'm guessing it should be easy to add support like this to IPIP and
SIT now as well
(not sure if they're missing, but I'd assume so)?

On Fri, Sep 14, 2012 at 12:25 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Add GSO support to GRE tunnels.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Maciej Żenczykowski <maze@google.com>
> ---
>  net/ipv4/ip_gre.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index b062a98..f233c1d 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -745,6 +745,10 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
>         __be32 dst;
>         int    mtu;
>
> +       if (skb->ip_summed == CHECKSUM_PARTIAL &&
> +           skb_checksum_help(skb))
> +               goto tx_error;
> +
>         if (dev->type == ARPHRD_ETHER)
>                 IPCB(skb)->flags = 0;
>
> @@ -1296,6 +1300,11 @@ static void ipgre_dev_free(struct net_device *dev)
>         free_netdev(dev);
>  }
>
> +#define GRE_FEATURES (NETIF_F_SG |             \
> +                     NETIF_F_FRAGLIST |        \
> +                     NETIF_F_HIGHDMA |         \
> +                     NETIF_F_HW_CSUM)
> +
>  static void ipgre_tunnel_setup(struct net_device *dev)
>  {
>         dev->netdev_ops         = &ipgre_netdev_ops;
> @@ -1309,6 +1318,9 @@ static void ipgre_tunnel_setup(struct net_device *dev)
>         dev->addr_len           = 4;
>         dev->features           |= NETIF_F_NETNS_LOCAL;
>         dev->priv_flags         &= ~IFF_XMIT_DST_RELEASE;
> +
> +       dev->features           |= GRE_FEATURES;
> +       dev->hw_features        |= GRE_FEATURES;
>  }
>
>  static int ipgre_tunnel_init(struct net_device *dev)
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 19, 2012, 7:41 p.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 14 Sep 2012 09:25:33 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> Add GSO support to GRE tunnels.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Maciej Żenczykowski <maze@google.com>

Also applied, thanks again.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index b062a98..f233c1d 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -745,6 +745,10 @@  static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 	__be32 dst;
 	int    mtu;
 
+	if (skb->ip_summed == CHECKSUM_PARTIAL &&
+	    skb_checksum_help(skb))
+		goto tx_error;
+
 	if (dev->type == ARPHRD_ETHER)
 		IPCB(skb)->flags = 0;
 
@@ -1296,6 +1300,11 @@  static void ipgre_dev_free(struct net_device *dev)
 	free_netdev(dev);
 }
 
+#define GRE_FEATURES (NETIF_F_SG |		\
+		      NETIF_F_FRAGLIST |	\
+		      NETIF_F_HIGHDMA |		\
+		      NETIF_F_HW_CSUM)
+
 static void ipgre_tunnel_setup(struct net_device *dev)
 {
 	dev->netdev_ops		= &ipgre_netdev_ops;
@@ -1309,6 +1318,9 @@  static void ipgre_tunnel_setup(struct net_device *dev)
 	dev->addr_len		= 4;
 	dev->features		|= NETIF_F_NETNS_LOCAL;
 	dev->priv_flags		&= ~IFF_XMIT_DST_RELEASE;
+
+	dev->features		|= GRE_FEATURES;
+	dev->hw_features	|= GRE_FEATURES;
 }
 
 static int ipgre_tunnel_init(struct net_device *dev)