Commit be08989c authored by David S. Miller's avatar David S. Miller

Merge branch 'nfp-add-and-use-tunnel-netdev-helpers'

John Hurley says:

====================
nfp: add and use tunnel netdev helpers

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.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents cea0604d e963e109
......@@ -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;
......
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment