Skip to content

Commit 9478d12

Browse files
David Aherndavem330
authored andcommitted
net: Move netif_index_is_l3_master to l3mdev.h
Change CONFIG dependency to CONFIG_NET_L3_MASTER_DEV as well. Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ec53951 commit 9478d12

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

include/linux/netdevice.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3840,27 +3840,6 @@ static inline bool netif_is_ovs_master(const struct net_device *dev)
38403840
return dev->priv_flags & IFF_OPENVSWITCH;
38413841
}
38423842

3843-
static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
3844-
{
3845-
bool rc = false;
3846-
3847-
#if IS_ENABLED(CONFIG_NET_VRF)
3848-
struct net_device *dev;
3849-
3850-
if (ifindex == 0)
3851-
return false;
3852-
3853-
rcu_read_lock();
3854-
3855-
dev = dev_get_by_index_rcu(net, ifindex);
3856-
if (dev)
3857-
rc = netif_is_l3_master(dev);
3858-
3859-
rcu_read_unlock();
3860-
#endif
3861-
return rc;
3862-
}
3863-
38643843
/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
38653844
static inline void netif_keep_dst(struct net_device *dev)
38663845
{

include/net/l3mdev.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,25 @@ static inline struct rtable *l3mdev_get_rtable(const struct net_device *dev,
8181
return NULL;
8282
}
8383

84+
static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
85+
{
86+
struct net_device *dev;
87+
bool rc = false;
88+
89+
if (ifindex == 0)
90+
return false;
91+
92+
rcu_read_lock();
93+
94+
dev = dev_get_by_index_rcu(net, ifindex);
95+
if (dev)
96+
rc = netif_is_l3_master(dev);
97+
98+
rcu_read_unlock();
99+
100+
return rc;
101+
}
102+
84103
#else
85104

86105
static inline int l3mdev_master_ifindex_rcu(struct net_device *dev)
@@ -120,6 +139,11 @@ static inline struct rtable *l3mdev_get_rtable(const struct net_device *dev,
120139
return NULL;
121140
}
122141

142+
static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
143+
{
144+
return false;
145+
}
146+
123147
#endif
124148

125149
#endif /* _NET_L3MDEV_H_ */

include/net/route.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <net/inetpeer.h>
2929
#include <net/flow.h>
3030
#include <net/inet_sock.h>
31+
#include <net/l3mdev.h>
3132
#include <linux/in_route.h>
3233
#include <linux/rtnetlink.h>
3334
#include <linux/rcupdate.h>

0 commit comments

Comments
 (0)