From: John Hurley Date: Wed, 7 Nov 2018 18:32:48 +0000 (+0000) Subject: net: add netif_is_geneve() X-Git-Tag: v5.0-rc1~129^2~368^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d10bd167667655362a7e2b407a96aad5979bfca;p=thirdparty%2Fkernel%2Flinux.git net: add netif_is_geneve() 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 Reviewed-by: Jakub Kicinski Signed-off-by: David S. Miller --- diff --git a/include/net/geneve.h b/include/net/geneve.h index a7600ed55ea31..fc6a7e0a874a9 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);