All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics
@ 2014-11-14  0:38 Joe Stringer
  2014-11-14  0:38 ` [PATCHv2 net 1/4] net: Add vxlan_gso_check() helper Joe Stringer
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Joe Stringer @ 2014-11-14  0:38 UTC (permalink / raw)
  To: netdev
  Cc: sathya.perla, shahed.shaikh, amirv, Dept-GELinuxNICDev, therbert,
	gerlitz.or, linux-kernel

Most NICs that report NETIF_F_GSO_UDP_TUNNEL support VXLAN, and not other
UDP-based encapsulation protocols where the format and size of the header may
differ. This patch series implements a generic ndo_gso_check() for detecting
VXLAN, then reuses it for these NICs.

Implementation shamelessly stolen from Tom Herbert (with minor fixups):
http://thread.gmane.org/gmane.linux.network/332428/focus=333111

v2: Drop i40e/fm10k patches (code diverged; handling separately).
    Refactor common code into vxlan_gso_check() helper.
    Minor style fixes.

Joe Stringer (4):
  net: Add vxlan_gso_check() helper
  be2net: Implement ndo_gso_check()
  net/mlx4_en: Implement ndo_gso_check()
  qlcnic: Implement ndo_gso_check()

 drivers/net/ethernet/emulex/benet/be_main.c      |    6 ++++++
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c   |    6 ++++++
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    6 ++++++
 drivers/net/vxlan.c                              |   13 +++++++++++++
 include/net/vxlan.h                              |    2 ++
 5 files changed, 33 insertions(+)

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCHv2 net 1/4] net: Add vxlan_gso_check() helper
  2014-11-14  0:38 [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics Joe Stringer
@ 2014-11-14  0:38 ` Joe Stringer
  2014-11-16  9:35   ` Or Gerlitz
  2014-11-14  0:38 ` [PATCHv2 net 2/4] be2net: Implement ndo_gso_check() Joe Stringer
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Joe Stringer @ 2014-11-14  0:38 UTC (permalink / raw)
  To: netdev
  Cc: sathya.perla, shahed.shaikh, amirv, Dept-GELinuxNICDev, therbert,
	gerlitz.or, alexander.duyck, linux-kernel

Most NICs that report NETIF_F_GSO_UDP_TUNNEL support VXLAN, and not
other UDP-based encapsulation protocols where the format and size of the
header differs. This patch implements a generic ndo_gso_check() for
VXLAN which will only advertise GSO support when the skb looks like it
contains VXLAN (or no UDP tunnelling at all).

Implementation shamelessly stolen from Tom Herbert:
http://thread.gmane.org/gmane.linux.network/332428/focus=333111

Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
v2: Merge helpers for be2net, mlx4, qlcnic
    Use (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
v1: Initial post
---
 drivers/net/vxlan.c |   13 +++++++++++++
 include/net/vxlan.h |    2 ++
 2 files changed, 15 insertions(+)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index fa9dc45..6b65863 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1571,6 +1571,19 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
 	return false;
 }
 
+bool vxlan_gso_check(struct sk_buff *skb)
+{
+	if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) &&
+	    (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
+	     skb->inner_protocol != htons(ETH_P_TEB) ||
+	     (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
+	      sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
+		return false;
+
+	return true;
+}
+EXPORT_SYMBOL_GPL(vxlan_gso_check);
+
 #if IS_ENABLED(CONFIG_IPV6)
 static int vxlan6_xmit_skb(struct vxlan_sock *vs,
 			   struct dst_entry *dst, struct sk_buff *skb,
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index d5f59f3..afadf8e 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -45,6 +45,8 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
 		   __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
 		   __be16 src_port, __be16 dst_port, __be32 vni, bool xnet);
 
+bool vxlan_gso_check(struct sk_buff *skb);
+
 /* IP header + UDP + VXLAN + Ethernet header */
 #define VXLAN_HEADROOM (20 + 8 + 8 + 14)
 /* IPv6 header + UDP + VXLAN + Ethernet header */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCHv2 net 2/4] be2net: Implement ndo_gso_check()
  2014-11-14  0:38 [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics Joe Stringer
  2014-11-14  0:38 ` [PATCHv2 net 1/4] net: Add vxlan_gso_check() helper Joe Stringer
@ 2014-11-14  0:38 ` Joe Stringer
  2014-11-14  9:43   ` Sathya Perla
  2014-11-14  0:38 ` [PATCHv2 net 3/4] net/mlx4_en: " Joe Stringer
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Joe Stringer @ 2014-11-14  0:38 UTC (permalink / raw)
  To: netdev
  Cc: sathya.perla, shahed.shaikh, amirv, Dept-GELinuxNICDev, therbert,
	gerlitz.or, alexander.duyck, linux-kernel

Use vxlan_gso_check() to advertise offload support for this NIC.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
v2: Refactor out vxlan helper.
---
 drivers/net/ethernet/emulex/benet/be_main.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 9a18e79..3e8475c 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -4421,6 +4421,11 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family,
 		 "Disabled VxLAN offloads for UDP port %d\n",
 		 be16_to_cpu(port));
 }
+
+static bool be_gso_check(struct sk_buff *skb, struct net_device *dev)
+{
+	return vxlan_gso_check(skb);
+}
 #endif
 
 static const struct net_device_ops be_netdev_ops = {
@@ -4450,6 +4455,7 @@ static const struct net_device_ops be_netdev_ops = {
 #ifdef CONFIG_BE2NET_VXLAN
 	.ndo_add_vxlan_port	= be_add_vxlan_port,
 	.ndo_del_vxlan_port	= be_del_vxlan_port,
+	.ndo_gso_check		= be_gso_check,
 #endif
 };
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCHv2 net 3/4] net/mlx4_en: Implement ndo_gso_check()
  2014-11-14  0:38 [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics Joe Stringer
  2014-11-14  0:38 ` [PATCHv2 net 1/4] net: Add vxlan_gso_check() helper Joe Stringer
  2014-11-14  0:38 ` [PATCHv2 net 2/4] be2net: Implement ndo_gso_check() Joe Stringer
@ 2014-11-14  0:38 ` Joe Stringer
  2014-11-16  9:32   ` Or Gerlitz
  2014-11-14  0:38 ` [PATCHv2 net 4/4] qlcnic: " Joe Stringer
  2014-11-14 22:13 ` [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics David Miller
  4 siblings, 1 reply; 12+ messages in thread
From: Joe Stringer @ 2014-11-14  0:38 UTC (permalink / raw)
  To: netdev
  Cc: sathya.perla, shahed.shaikh, amirv, Dept-GELinuxNICDev, therbert,
	gerlitz.or, alexander.duyck, linux-kernel

Use vxlan_gso_check() to advertise offload support for this NIC.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
v2: Refactor out vxlan helper.
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 02266e3..c5fcc56 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2355,6 +2355,11 @@ static void mlx4_en_del_vxlan_port(struct  net_device *dev,
 
 	queue_work(priv->mdev->workqueue, &priv->vxlan_del_task);
 }
+
+static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev)
+{
+	return vxlan_gso_check(skb);
+}
 #endif
 
 static const struct net_device_ops mlx4_netdev_ops = {
@@ -2386,6 +2391,7 @@ static const struct net_device_ops mlx4_netdev_ops = {
 #ifdef CONFIG_MLX4_EN_VXLAN
 	.ndo_add_vxlan_port	= mlx4_en_add_vxlan_port,
 	.ndo_del_vxlan_port	= mlx4_en_del_vxlan_port,
+	.ndo_gso_check		= mlx4_en_gso_check,
 #endif
 };
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCHv2 net 4/4] qlcnic: Implement ndo_gso_check()
  2014-11-14  0:38 [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics Joe Stringer
                   ` (2 preceding siblings ...)
  2014-11-14  0:38 ` [PATCHv2 net 3/4] net/mlx4_en: " Joe Stringer
@ 2014-11-14  0:38 ` Joe Stringer
  2014-11-14  5:08   ` Shahed Shaikh
  2014-11-14 22:13 ` [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics David Miller
  4 siblings, 1 reply; 12+ messages in thread
From: Joe Stringer @ 2014-11-14  0:38 UTC (permalink / raw)
  To: netdev
  Cc: sathya.perla, shahed.shaikh, amirv, Dept-GELinuxNICDev, therbert,
	gerlitz.or, alexander.duyck, linux-kernel

Use vxlan_gso_check() to advertise offload support for this NIC.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
v2: Refactor out vxlan helper.
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index f5e29f7..a913b3a 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -503,6 +503,11 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev,
 
 	adapter->flags |= QLCNIC_DEL_VXLAN_PORT;
 }
+
+static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev)
+{
+	return vxlan_gso_check(skb);
+}
 #endif
 
 static const struct net_device_ops qlcnic_netdev_ops = {
@@ -526,6 +531,7 @@ static const struct net_device_ops qlcnic_netdev_ops = {
 #ifdef CONFIG_QLCNIC_VXLAN
 	.ndo_add_vxlan_port	= qlcnic_add_vxlan_port,
 	.ndo_del_vxlan_port	= qlcnic_del_vxlan_port,
+	.ndo_gso_check		= qlcnic_gso_check,
 #endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller = qlcnic_poll_controller,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* RE: [PATCHv2 net 4/4] qlcnic: Implement ndo_gso_check()
  2014-11-14  0:38 ` [PATCHv2 net 4/4] qlcnic: " Joe Stringer
@ 2014-11-14  5:08   ` Shahed Shaikh
  0 siblings, 0 replies; 12+ messages in thread
From: Shahed Shaikh @ 2014-11-14  5:08 UTC (permalink / raw)
  To: Joe Stringer, netdev
  Cc: sathya.perla, amirv, Dept-GE Linux NIC Dev,
	Tom Herbert (Partner - google),
	gerlitz.or, alexander.duyck, linux-kernel

> -----Original Message-----
> From: Joe Stringer [mailto:joestringer@nicira.com]
> Sent: Friday, November 14, 2014 6:08 AM
> To: netdev
> Cc: sathya.perla@emulex.com; Shahed Shaikh; amirv@mellanox.com; Dept-
> GE Linux NIC Dev; Tom Herbert (Partner - google); gerlitz.or@gmail.com;
> alexander.duyck@gmail.com; linux-kernel
> Subject: [PATCHv2 net 4/4] qlcnic: Implement ndo_gso_check()
> 
> Use vxlan_gso_check() to advertise offload support for this NIC.
> 
> Signed-off-by: Joe Stringer <joestringer@nicira.com>
> ---
> v2: Refactor out vxlan helper.
> ---
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    6 ++++++
>  1 file changed, 6 insertions(+)

Acked-by: Shahed Shaikh <shahed.shaikh@qlogic.com>

Thanks Joe.

-Shahed
> 
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> index f5e29f7..a913b3a 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> @@ -503,6 +503,11 @@ static void qlcnic_del_vxlan_port(struct net_device
> *netdev,
> 
>  	adapter->flags |= QLCNIC_DEL_VXLAN_PORT;  }
> +
> +static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device
> +*dev) {
> +	return vxlan_gso_check(skb);
> +}
>  #endif
> 
>  static const struct net_device_ops qlcnic_netdev_ops = { @@ -526,6 +531,7
> @@ static const struct net_device_ops qlcnic_netdev_ops = {  #ifdef
> CONFIG_QLCNIC_VXLAN
>  	.ndo_add_vxlan_port	= qlcnic_add_vxlan_port,
>  	.ndo_del_vxlan_port	= qlcnic_del_vxlan_port,
> +	.ndo_gso_check		= qlcnic_gso_check,
>  #endif
>  #ifdef CONFIG_NET_POLL_CONTROLLER
>  	.ndo_poll_controller = qlcnic_poll_controller,
> --
> 1.7.10.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCHv2 net 2/4] be2net: Implement ndo_gso_check()
  2014-11-14  0:38 ` [PATCHv2 net 2/4] be2net: Implement ndo_gso_check() Joe Stringer
@ 2014-11-14  9:43   ` Sathya Perla
  0 siblings, 0 replies; 12+ messages in thread
From: Sathya Perla @ 2014-11-14  9:43 UTC (permalink / raw)
  To: Joe Stringer, netdev
  Cc: shahed.shaikh, amirv, Dept-GELinuxNICDev, therbert, gerlitz.or,
	alexander.duyck, linux-kernel

> -----Original Message-----
> From: Joe Stringer [mailto:joestringer@nicira.com]
> 
> Use vxlan_gso_check() to advertise offload support for this NIC.
> 
> Signed-off-by: Joe Stringer <joestringer@nicira.com>

Acked-by: Sathya Perla <sperla@emulex.com>

Thanks!

> ---
> v2: Refactor out vxlan helper.
> ---
>  drivers/net/ethernet/emulex/benet/be_main.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c
> b/drivers/net/ethernet/emulex/benet/be_main.c
> index 9a18e79..3e8475c 100644
> --- a/drivers/net/ethernet/emulex/benet/be_main.c
> +++ b/drivers/net/ethernet/emulex/benet/be_main.c
> @@ -4421,6 +4421,11 @@ static void be_del_vxlan_port(struct net_device
> *netdev, sa_family_t sa_family,
>  		 "Disabled VxLAN offloads for UDP port %d\n",
>  		 be16_to_cpu(port));
>  }
> +
> +static bool be_gso_check(struct sk_buff *skb, struct net_device *dev)
> +{
> +	return vxlan_gso_check(skb);
> +}
>  #endif
> 
>  static const struct net_device_ops be_netdev_ops = {
> @@ -4450,6 +4455,7 @@ static const struct net_device_ops be_netdev_ops
> = {
>  #ifdef CONFIG_BE2NET_VXLAN
>  	.ndo_add_vxlan_port	= be_add_vxlan_port,
>  	.ndo_del_vxlan_port	= be_del_vxlan_port,
> +	.ndo_gso_check		= be_gso_check,
>  #endif
>  };
> 
> --
> 1.7.10.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics
  2014-11-14  0:38 [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics Joe Stringer
                   ` (3 preceding siblings ...)
  2014-11-14  0:38 ` [PATCHv2 net 4/4] qlcnic: " Joe Stringer
@ 2014-11-14 22:13 ` David Miller
  2014-11-17 17:50   ` Joe Stringer
  4 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2014-11-14 22:13 UTC (permalink / raw)
  To: joestringer
  Cc: netdev, sathya.perla, shahed.shaikh, amirv, Dept-GELinuxNICDev,
	therbert, gerlitz.or, linux-kernel

From: Joe Stringer <joestringer@nicira.com>
Date: Thu, 13 Nov 2014 16:38:11 -0800

> Most NICs that report NETIF_F_GSO_UDP_TUNNEL support VXLAN, and not other
> UDP-based encapsulation protocols where the format and size of the header may
> differ. This patch series implements a generic ndo_gso_check() for detecting
> VXLAN, then reuses it for these NICs.
> 
> Implementation shamelessly stolen from Tom Herbert (with minor fixups):
> http://thread.gmane.org/gmane.linux.network/332428/focus=333111
> 
> v2: Drop i40e/fm10k patches (code diverged; handling separately).
>     Refactor common code into vxlan_gso_check() helper.
>     Minor style fixes.

Series applied, thanks Joe.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net 3/4] net/mlx4_en: Implement ndo_gso_check()
  2014-11-14  0:38 ` [PATCHv2 net 3/4] net/mlx4_en: " Joe Stringer
@ 2014-11-16  9:32   ` Or Gerlitz
  0 siblings, 0 replies; 12+ messages in thread
From: Or Gerlitz @ 2014-11-16  9:32 UTC (permalink / raw)
  To: Joe Stringer
  Cc: Linux Netdev List, sathya.perla, shahed.shaikh, Amir Vadai,
	dept-gelinuxnicdev, Tom Herbert, alexander.duyck, Linux Kernel

On Fri, Nov 14, 2014 at 2:38 AM, Joe Stringer <joestringer@nicira.com> wrote:
> Use vxlan_gso_check() to advertise offload support for this NIC.
>
> Signed-off-by: Joe Stringer <joestringer@nicira.com>

FWIW (since the patches is applied already...)

Acked-by: Or Gerlitz <ogerlitz@mellanox.com>

thanks for addressing this piece.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net 1/4] net: Add vxlan_gso_check() helper
  2014-11-14  0:38 ` [PATCHv2 net 1/4] net: Add vxlan_gso_check() helper Joe Stringer
@ 2014-11-16  9:35   ` Or Gerlitz
  2014-11-18  0:26     ` Joe Stringer
  0 siblings, 1 reply; 12+ messages in thread
From: Or Gerlitz @ 2014-11-16  9:35 UTC (permalink / raw)
  To: Joe Stringer; +Cc: Linux Netdev List

On Fri, Nov 14, 2014 at 2:38 AM, Joe Stringer <joestringer@nicira.com> wrote:
> Most NICs that report NETIF_F_GSO_UDP_TUNNEL support VXLAN, and not
> other UDP-based encapsulation protocols where the format and size of the
> header differs. This patch implements a generic ndo_gso_check() for
> VXLAN which will only advertise GSO support when the skb looks like it
> contains VXLAN (or no UDP tunnelling at all).
>
> Implementation shamelessly stolen from Tom Herbert:
> http://thread.gmane.org/gmane.linux.network/332428/focus=333111
>
> Signed-off-by: Joe Stringer <joestringer@nicira.com>
> ---
> v2: Merge helpers for be2net, mlx4, qlcnic
>     Use (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
> v1: Initial post
> ---
>  drivers/net/vxlan.c |   13 +++++++++++++
>  include/net/vxlan.h |    2 ++
>  2 files changed, 15 insertions(+)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index fa9dc45..6b65863 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -1571,6 +1571,19 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
>         return false;
>  }
>
> +bool vxlan_gso_check(struct sk_buff *skb)
> +{
> +       if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) &&
> +           (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
> +            skb->inner_protocol != htons(ETH_P_TEB) ||
> +            (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
> +             sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
> +               return false;
> +
> +       return true;
> +}
> +EXPORT_SYMBOL_GPL(vxlan_gso_check);

Joe, any chance you can make the extra step and inline that in
vxlan.h? this is fast path call... you will only need to move struct
vxlanhdr there too.

Or.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics
  2014-11-14 22:13 ` [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics David Miller
@ 2014-11-17 17:50   ` Joe Stringer
  0 siblings, 0 replies; 12+ messages in thread
From: Joe Stringer @ 2014-11-17 17:50 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, sathya.perla, shahed.shaikh, amirv, Dept-GELinuxNICDev,
	therbert, gerlitz.or, linux-kernel

On Friday, November 14, 2014 14:13:21 David Miller wrote:
> From: Joe Stringer <joestringer@nicira.com>
> Date: Thu, 13 Nov 2014 16:38:11 -0800
> 
> > Most NICs that report NETIF_F_GSO_UDP_TUNNEL support VXLAN, and not other
> > UDP-based encapsulation protocols where the format and size of the header
> > may differ. This patch series implements a generic ndo_gso_check() for
> > detecting VXLAN, then reuses it for these NICs.
> > 
> > Implementation shamelessly stolen from Tom Herbert (with minor fixups):
> > http://thread.gmane.org/gmane.linux.network/332428/focus=333111
> > 
> > v2: Drop i40e/fm10k patches (code diverged; handling separately).
> > 
> >     Refactor common code into vxlan_gso_check() helper.
> >     Minor style fixes.
> 
> Series applied, thanks Joe.

Thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net 1/4] net: Add vxlan_gso_check() helper
  2014-11-16  9:35   ` Or Gerlitz
@ 2014-11-18  0:26     ` Joe Stringer
  0 siblings, 0 replies; 12+ messages in thread
From: Joe Stringer @ 2014-11-18  0:26 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: Linux Netdev List

On Sunday, November 16, 2014 01:35:52 Or Gerlitz wrote:
> On Fri, Nov 14, 2014 at 2:38 AM, Joe Stringer <joestringer@nicira.com> 
wrote:
> > Most NICs that report NETIF_F_GSO_UDP_TUNNEL support VXLAN, and not
> > other UDP-based encapsulation protocols where the format and size of the
> > header differs. This patch implements a generic ndo_gso_check() for
> > VXLAN which will only advertise GSO support when the skb looks like it
> > contains VXLAN (or no UDP tunnelling at all).
> > 
> > Implementation shamelessly stolen from Tom Herbert:
> > http://thread.gmane.org/gmane.linux.network/332428/focus=333111
> > 
> > Signed-off-by: Joe Stringer <joestringer@nicira.com>
> > ---
> > v2: Merge helpers for be2net, mlx4, qlcnic
> > 
> >     Use (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
> > 
> > v1: Initial post
> > ---
> > 
> >  drivers/net/vxlan.c |   13 +++++++++++++
> >  include/net/vxlan.h |    2 ++
> >  2 files changed, 15 insertions(+)
> > 
> > diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> > index fa9dc45..6b65863 100644
> > --- a/drivers/net/vxlan.c
> > +++ b/drivers/net/vxlan.c
> > @@ -1571,6 +1571,19 @@ static bool route_shortcircuit(struct net_device
> > *dev, struct sk_buff *skb)
> > 
> >         return false;
> >  
> >  }
> > 
> > +bool vxlan_gso_check(struct sk_buff *skb)
> > +{
> > +       if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) &&
> > +           (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
> > +            skb->inner_protocol != htons(ETH_P_TEB) ||
> > +            (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
> > +             sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
> > +               return false;
> > +
> > +       return true;
> > +}
> > +EXPORT_SYMBOL_GPL(vxlan_gso_check);
> 
> Joe, any chance you can make the extra step and inline that in
> vxlan.h? this is fast path call... you will only need to move struct
> vxlanhdr there too.

Thanks for looking this over, I sent a patch.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-11-18  0:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14  0:38 [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics Joe Stringer
2014-11-14  0:38 ` [PATCHv2 net 1/4] net: Add vxlan_gso_check() helper Joe Stringer
2014-11-16  9:35   ` Or Gerlitz
2014-11-18  0:26     ` Joe Stringer
2014-11-14  0:38 ` [PATCHv2 net 2/4] be2net: Implement ndo_gso_check() Joe Stringer
2014-11-14  9:43   ` Sathya Perla
2014-11-14  0:38 ` [PATCHv2 net 3/4] net/mlx4_en: " Joe Stringer
2014-11-16  9:32   ` Or Gerlitz
2014-11-14  0:38 ` [PATCHv2 net 4/4] qlcnic: " Joe Stringer
2014-11-14  5:08   ` Shahed Shaikh
2014-11-14 22:13 ` [PATCHv2 net 0/4] Implement ndo_gso_check() for vxlan nics David Miller
2014-11-17 17:50   ` Joe Stringer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.