aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kubeček <mkubecek@suse.cz>2013-11-15 00:18:40 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-15 17:55:48 -0500
commitbe9eac48274a2d9b142d6dd8567b9b2362939346 (patch)
treeeb43db7c1721c7b40d7d9e7ec9958b10bcaf3d4a
parentf9de11a165943a55e0fbda714caf60eaeb276a42 (diff)
macvlan: introduce macvlan_dev_real_dev() helper function
Introduce helper function macvlan_dev_real_dev which returns the underlying device of a macvlan device, similar to vlan_dev_real_dev() for 802.1q VLAN devices. v2: IFF_MACVLAN flag and equivalent of is_macvlan_dev() were introduced in the meantime v3: do BUG() if compiled without macvlan support Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/if_macvlan.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index c2702856295e..84ba5ac39e03 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -119,4 +119,21 @@ extern int macvlan_link_register(struct rtnl_link_ops *ops);
119extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, 119extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
120 struct net_device *dev); 120 struct net_device *dev);
121 121
122#if IS_ENABLED(CONFIG_MACVLAN)
123static inline struct net_device *
124macvlan_dev_real_dev(const struct net_device *dev)
125{
126 struct macvlan_dev *macvlan = netdev_priv(dev);
127
128 return macvlan->lowerdev;
129}
130#else
131static inline struct net_device *
132macvlan_dev_real_dev(const struct net_device *dev)
133{
134 BUG();
135 return NULL;
136}
137#endif
138
122#endif /* _LINUX_IF_MACVLAN_H */ 139#endif /* _LINUX_IF_MACVLAN_H */