summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2016-09-26 12:52:30 +0200
committerDavid S. Miller <davem@davemloft.net>2016-09-28 04:48:00 -0400
commitc98501879b1b1af90c7325574f2672e9efca592c (patch)
treecc6f5e21ae1250962df15dc0e014a85975501c67 /include/net
parentb90eb754949931b2e4481b1df9a03f84d4be66ba (diff)
downloadlinux-c98501879b1b1af90c7325574f2672e9efca592c.tar.bz2
fib: introduce FIB info offload flag helpers
These helpers are to be used in case someone offloads the FIB entry. The result is that if the entry is offloaded to at least one device, the offload flag is set. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip_fib.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 116a9c0eb455..ffccf1787914 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -123,6 +123,7 @@ struct fib_info {
#ifdef CONFIG_IP_ROUTE_MULTIPATH
int fib_weight;
#endif
+ unsigned int fib_offload_cnt;
struct rcu_head rcu;
struct fib_nh fib_nh[0];
#define fib_dev fib_nh[0].nh_dev
@@ -174,6 +175,18 @@ struct fib_result_nl {
__be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
+static inline void fib_info_offload_inc(struct fib_info *fi)
+{
+ fi->fib_offload_cnt++;
+ fi->fib_flags |= RTNH_F_OFFLOAD;
+}
+
+static inline void fib_info_offload_dec(struct fib_info *fi)
+{
+ if (--fi->fib_offload_cnt == 0)
+ fi->fib_flags &= ~RTNH_F_OFFLOAD;
+}
+
#define FIB_RES_SADDR(net, res) \
((FIB_RES_NH(res).nh_saddr_genid == \
atomic_read(&(net)->ipv4.dev_addr_genid)) ? \