Commit 5933fea7 authored by Mahesh Bandewar's avatar Mahesh Bandewar Committed by David S. Miller

ipvlan: move the device check function into netdevice.h

Move the port check [ipvlan_dev_master()] and device check
[ipvlan_dev_slave()] functions to netdevice.h and rename them
netif_is_ipvlan_port() and netif_is_ipvlan() resp. to be
consistent with macvlan api naming.
Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 764e433b
...@@ -107,16 +107,6 @@ static inline struct ipvl_port *ipvlan_port_get_rtnl(const struct net_device *d) ...@@ -107,16 +107,6 @@ static inline struct ipvl_port *ipvlan_port_get_rtnl(const struct net_device *d)
return rtnl_dereference(d->rx_handler_data); return rtnl_dereference(d->rx_handler_data);
} }
static inline bool ipvlan_dev_master(struct net_device *d)
{
return d->priv_flags & IFF_IPVLAN_MASTER;
}
static inline bool ipvlan_dev_slave(struct net_device *d)
{
return d->priv_flags & IFF_IPVLAN_SLAVE;
}
void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev); void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev);
void ipvlan_set_port_mode(struct ipvl_port *port, u32 nval); void ipvlan_set_port_mode(struct ipvl_port *port, u32 nval);
void ipvlan_init_secret(void); void ipvlan_init_secret(void);
......
...@@ -446,11 +446,11 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev, ...@@ -446,11 +446,11 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
if (!phy_dev) if (!phy_dev)
return -ENODEV; return -ENODEV;
if (ipvlan_dev_slave(phy_dev)) { if (netif_is_ipvlan(phy_dev)) {
struct ipvl_dev *tmp = netdev_priv(phy_dev); struct ipvl_dev *tmp = netdev_priv(phy_dev);
phy_dev = tmp->phy_dev; phy_dev = tmp->phy_dev;
} else if (!ipvlan_dev_master(phy_dev)) { } else if (!netif_is_ipvlan_port(phy_dev)) {
err = ipvlan_port_create(phy_dev); err = ipvlan_port_create(phy_dev);
if (err < 0) if (err < 0)
return err; return err;
...@@ -560,7 +560,7 @@ static int ipvlan_device_event(struct notifier_block *unused, ...@@ -560,7 +560,7 @@ static int ipvlan_device_event(struct notifier_block *unused,
struct ipvl_port *port; struct ipvl_port *port;
LIST_HEAD(lst_kill); LIST_HEAD(lst_kill);
if (!ipvlan_dev_master(dev)) if (!netif_is_ipvlan_port(dev))
return NOTIFY_DONE; return NOTIFY_DONE;
port = ipvlan_port_get_rtnl(dev); port = ipvlan_port_get_rtnl(dev);
...@@ -651,7 +651,7 @@ static int ipvlan_addr6_event(struct notifier_block *unused, ...@@ -651,7 +651,7 @@ static int ipvlan_addr6_event(struct notifier_block *unused,
struct net_device *dev = (struct net_device *)if6->idev->dev; struct net_device *dev = (struct net_device *)if6->idev->dev;
struct ipvl_dev *ipvlan = netdev_priv(dev); struct ipvl_dev *ipvlan = netdev_priv(dev);
if (!ipvlan_dev_slave(dev)) if (!netif_is_ipvlan(dev))
return NOTIFY_DONE; return NOTIFY_DONE;
if (!ipvlan || !ipvlan->port) if (!ipvlan || !ipvlan->port)
...@@ -723,7 +723,7 @@ static int ipvlan_addr4_event(struct notifier_block *unused, ...@@ -723,7 +723,7 @@ static int ipvlan_addr4_event(struct notifier_block *unused,
struct ipvl_dev *ipvlan = netdev_priv(dev); struct ipvl_dev *ipvlan = netdev_priv(dev);
struct in_addr ip4_addr; struct in_addr ip4_addr;
if (!ipvlan_dev_slave(dev)) if (!netif_is_ipvlan(dev))
return NOTIFY_DONE; return NOTIFY_DONE;
if (!ipvlan || !ipvlan->port) if (!ipvlan || !ipvlan->port)
......
...@@ -3646,6 +3646,16 @@ static inline bool netif_is_macvlan_port(struct net_device *dev) ...@@ -3646,6 +3646,16 @@ static inline bool netif_is_macvlan_port(struct net_device *dev)
return dev->priv_flags & IFF_MACVLAN_PORT; return dev->priv_flags & IFF_MACVLAN_PORT;
} }
static inline bool netif_is_ipvlan(struct net_device *dev)
{
return dev->priv_flags & IFF_IPVLAN_SLAVE;
}
static inline bool netif_is_ipvlan_port(struct net_device *dev)
{
return dev->priv_flags & IFF_IPVLAN_MASTER;
}
static inline bool netif_is_bond_master(struct net_device *dev) static inline bool netif_is_bond_master(struct net_device *dev)
{ {
return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment