From 9d5acd39ef0579f27dcd2ce44316f3a4df973fa1 Mon Sep 17 00:00:00 2001 From: Nitin Shetty Date: Wed, 12 Jan 2022 00:06:57 +0530 Subject: [PATCH 299/500] net: gre: adding API to check GRE net device adding support to check if the net device is GRE. Change-Id: Ic50f41299b19939fb8313667e4b8c9c571432235 Signed-off-by: Nitin Shetty --- include/net/gre.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/include/net/gre.h +++ b/include/net/gre.h @@ -43,12 +43,24 @@ static inline bool netif_is_gretap(const !strcmp(dev->rtnl_link_ops->kind, "gretap"); } +static inline bool netif_is_gre(const struct net_device *dev) +{ + return dev->rtnl_link_ops && + !strcmp(dev->rtnl_link_ops->kind, "gre"); +} + static inline bool netif_is_ip6gretap(const struct net_device *dev) { return dev->rtnl_link_ops && !strcmp(dev->rtnl_link_ops->kind, "ip6gretap"); } +static inline bool netif_is_ip6gre(const struct net_device *dev) +{ + return dev->rtnl_link_ops && + !strcmp(dev->rtnl_link_ops->kind, "ip6gre"); +} + static inline int gre_calc_hlen(__be16 o_flags) { int addend = 4;