aboutsummaryrefslogtreecommitdiff
path: root/include/net/vrf.h
diff options
context:
space:
mode:
authorDavid Ahern2015-08-16 17:13:27 -0600
committerDavid S. Miller2015-08-17 15:58:57 -0700
commitdc028da54ed353edd44dca88b7eb19fd5126c354 (patch)
treecd11c264faf0bfbdbba0b6da9e7b058eab38c968 /include/net/vrf.h
parent808d28c468a89e8680396d98aea96024b6f5afdc (diff)
inet: Move VRF table lookup to inlined function
Table lookup compiles out when VRF is not enabled. Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/vrf.h')
-rw-r--r--include/net/vrf.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/net/vrf.h b/include/net/vrf.h
index 0484d29d4589..40e3793c7a05 100644
--- a/include/net/vrf.h
+++ b/include/net/vrf.h
@@ -81,6 +81,25 @@ static inline int vrf_dev_table(const struct net_device *dev)
return tb_id;
}
+static inline int vrf_dev_table_ifindex(struct net *net, int ifindex)
+{
+ struct net_device *dev;
+ int tb_id = 0;
+
+ if (!ifindex)
+ return 0;
+
+ rcu_read_lock();
+
+ dev = dev_get_by_index_rcu(net, ifindex);
+ if (dev)
+ tb_id = vrf_dev_table_rcu(dev);
+
+ rcu_read_unlock();
+
+ return tb_id;
+}
+
/* called with rtnl */
static inline int vrf_dev_table_rtnl(const struct net_device *dev)
{
@@ -125,6 +144,11 @@ static inline int vrf_dev_table(const struct net_device *dev)
return 0;
}
+static inline int vrf_dev_table_ifindex(struct net *net, int ifindex)
+{
+ return 0;
+}
+
static inline int vrf_dev_table_rtnl(const struct net_device *dev)
{
return 0;