netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers
@ 2018-11-07 18:32 John Hurley
  2018-11-07 18:32 ` [PATCH net-next 1/3] net: add netif_is_geneve() John Hurley
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: John Hurley @ 2018-11-07 18:32 UTC (permalink / raw)
  To: netdev, davem, oss-drivers, jakub.kicinski; +Cc: John Hurley

A recent patch introduced the function netif_is_vxlan() to verify the
tunnel type of a given netdev as vxlan.

Add a similar function to detect geneve netdevs and make use of this
function in the NFP driver. Also make use of the vxlan helper where
applicable.

John Hurley (3):
  net: add netif_is_geneve()
  nfp: flower: use geneve and vxlan helpers
  nfp: flower: include geneve as supported offload tunnel type

 drivers/net/ethernet/netronome/nfp/flower/action.c      | 8 +++-----
 drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c | 2 ++
 include/net/geneve.h                                    | 6 ++++++
 3 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.7.4

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

* [PATCH net-next 1/3] net: add netif_is_geneve()
  2018-11-07 18:32 [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers John Hurley
@ 2018-11-07 18:32 ` John Hurley
  2018-11-07 18:32 ` [PATCH net-next 2/3] nfp: flower: use geneve and vxlan helpers John Hurley
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: John Hurley @ 2018-11-07 18:32 UTC (permalink / raw)
  To: netdev, davem, oss-drivers, jakub.kicinski; +Cc: John Hurley

Add a helper function to determine if the type of a netdev is geneve based
on its rtnl_link_ops. This allows drivers that may wish to offload tunnels
to check the underlying type of the device.

A recent patch added a similar helper to vxlan.h

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 include/net/geneve.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/net/geneve.h b/include/net/geneve.h
index a7600ed..fc6a7e0 100644
--- a/include/net/geneve.h
+++ b/include/net/geneve.h
@@ -60,6 +60,12 @@ struct genevehdr {
 	struct geneve_opt options[];
 };
 
+static inline bool netif_is_geneve(const struct net_device *dev)
+{
+	return dev->rtnl_link_ops &&
+	       !strcmp(dev->rtnl_link_ops->kind, "geneve");
+}
+
 #ifdef CONFIG_INET
 struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
 					u8 name_assign_type, u16 dst_port);
-- 
2.7.4

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

* [PATCH net-next 2/3] nfp: flower: use geneve and vxlan helpers
  2018-11-07 18:32 [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers John Hurley
  2018-11-07 18:32 ` [PATCH net-next 1/3] net: add netif_is_geneve() John Hurley
@ 2018-11-07 18:32 ` John Hurley
  2018-11-07 18:32 ` [PATCH net-next 3/3] nfp: flower: include geneve as supported offload tunnel type John Hurley
  2018-11-08  7:00 ` [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: John Hurley @ 2018-11-07 18:32 UTC (permalink / raw)
  To: netdev, davem, oss-drivers, jakub.kicinski; +Cc: John Hurley

Make use of the recently added VXLAN and geneve helper functions to
determine the type of the netdev from its rtnl_link_ops.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/flower/action.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c
index 244dc26..2f67cd55 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/action.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/action.c
@@ -11,6 +11,7 @@
 #include <net/tc_act/tc_pedit.h>
 #include <net/tc_act/tc_vlan.h>
 #include <net/tc_act/tc_tunnel_key.h>
+#include <net/vxlan.h>
 
 #include "cmsg.h"
 #include "main.h"
@@ -94,13 +95,10 @@ nfp_fl_pre_lag(struct nfp_app *app, const struct tc_action *action,
 static bool nfp_fl_netdev_is_tunnel_type(struct net_device *out_dev,
 					 enum nfp_flower_tun_type tun_type)
 {
-	if (!out_dev->rtnl_link_ops)
-		return false;
-
-	if (!strcmp(out_dev->rtnl_link_ops->kind, "vxlan"))
+	if (netif_is_vxlan(out_dev))
 		return tun_type == NFP_FL_TUNNEL_VXLAN;
 
-	if (!strcmp(out_dev->rtnl_link_ops->kind, "geneve"))
+	if (netif_is_geneve(out_dev))
 		return tun_type == NFP_FL_TUNNEL_GENEVE;
 
 	return false;
-- 
2.7.4

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

* [PATCH net-next 3/3] nfp: flower: include geneve as supported offload tunnel type
  2018-11-07 18:32 [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers John Hurley
  2018-11-07 18:32 ` [PATCH net-next 1/3] net: add netif_is_geneve() John Hurley
  2018-11-07 18:32 ` [PATCH net-next 2/3] nfp: flower: use geneve and vxlan helpers John Hurley
@ 2018-11-07 18:32 ` John Hurley
  2018-11-08  7:00 ` [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: John Hurley @ 2018-11-07 18:32 UTC (permalink / raw)
  To: netdev, davem, oss-drivers, jakub.kicinski; +Cc: John Hurley

Offload of geneve decap rules is supported in NFP. Include geneve in the
check for supported types.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
index 8e5bec0..170f314 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
@@ -190,6 +190,8 @@ static bool nfp_tun_is_netdev_to_offload(struct net_device *netdev)
 		return true;
 	if (netif_is_vxlan(netdev))
 		return true;
+	if (netif_is_geneve(netdev))
+		return true;
 
 	return false;
 }
-- 
2.7.4

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

* Re: [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers
  2018-11-07 18:32 [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers John Hurley
                   ` (2 preceding siblings ...)
  2018-11-07 18:32 ` [PATCH net-next 3/3] nfp: flower: include geneve as supported offload tunnel type John Hurley
@ 2018-11-08  7:00 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-11-08  7:00 UTC (permalink / raw)
  To: john.hurley; +Cc: netdev, oss-drivers, jakub.kicinski

From: John Hurley <john.hurley@netronome.com>
Date: Wed,  7 Nov 2018 18:32:47 +0000

> A recent patch introduced the function netif_is_vxlan() to verify the
> tunnel type of a given netdev as vxlan.
> 
> Add a similar function to detect geneve netdevs and make use of this
> function in the NFP driver. Also make use of the vxlan helper where
> applicable.

Series applied.

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

end of thread, other threads:[~2018-11-08 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 18:32 [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers John Hurley
2018-11-07 18:32 ` [PATCH net-next 1/3] net: add netif_is_geneve() John Hurley
2018-11-07 18:32 ` [PATCH net-next 2/3] nfp: flower: use geneve and vxlan helpers John Hurley
2018-11-07 18:32 ` [PATCH net-next 3/3] nfp: flower: include geneve as supported offload tunnel type John Hurley
2018-11-08  7:00 ` [PATCH net-next 0/3] nfp: add and use tunnel netdev helpers David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).