Skip to content

Commit 5933fea

Browse files
Mahesh Bandewardavem330
authored andcommitted
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: Mahesh Bandewar <maheshb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 764e433 commit 5933fea

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

drivers/net/ipvlan/ipvlan.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,6 @@ static inline struct ipvl_port *ipvlan_port_get_rtnl(const struct net_device *d)
107107
return rtnl_dereference(d->rx_handler_data);
108108
}
109109

110-
static inline bool ipvlan_dev_master(struct net_device *d)
111-
{
112-
return d->priv_flags & IFF_IPVLAN_MASTER;
113-
}
114-
115-
static inline bool ipvlan_dev_slave(struct net_device *d)
116-
{
117-
return d->priv_flags & IFF_IPVLAN_SLAVE;
118-
}
119-
120110
void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev);
121111
void ipvlan_set_port_mode(struct ipvl_port *port, u32 nval);
122112
void ipvlan_init_secret(void);

drivers/net/ipvlan/ipvlan_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,11 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
446446
if (!phy_dev)
447447
return -ENODEV;
448448

449-
if (ipvlan_dev_slave(phy_dev)) {
449+
if (netif_is_ipvlan(phy_dev)) {
450450
struct ipvl_dev *tmp = netdev_priv(phy_dev);
451451

452452
phy_dev = tmp->phy_dev;
453-
} else if (!ipvlan_dev_master(phy_dev)) {
453+
} else if (!netif_is_ipvlan_port(phy_dev)) {
454454
err = ipvlan_port_create(phy_dev);
455455
if (err < 0)
456456
return err;
@@ -560,7 +560,7 @@ static int ipvlan_device_event(struct notifier_block *unused,
560560
struct ipvl_port *port;
561561
LIST_HEAD(lst_kill);
562562

563-
if (!ipvlan_dev_master(dev))
563+
if (!netif_is_ipvlan_port(dev))
564564
return NOTIFY_DONE;
565565

566566
port = ipvlan_port_get_rtnl(dev);
@@ -651,7 +651,7 @@ static int ipvlan_addr6_event(struct notifier_block *unused,
651651
struct net_device *dev = (struct net_device *)if6->idev->dev;
652652
struct ipvl_dev *ipvlan = netdev_priv(dev);
653653

654-
if (!ipvlan_dev_slave(dev))
654+
if (!netif_is_ipvlan(dev))
655655
return NOTIFY_DONE;
656656

657657
if (!ipvlan || !ipvlan->port)
@@ -723,7 +723,7 @@ static int ipvlan_addr4_event(struct notifier_block *unused,
723723
struct ipvl_dev *ipvlan = netdev_priv(dev);
724724
struct in_addr ip4_addr;
725725

726-
if (!ipvlan_dev_slave(dev))
726+
if (!netif_is_ipvlan(dev))
727727
return NOTIFY_DONE;
728728

729729
if (!ipvlan || !ipvlan->port)

include/linux/netdevice.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3646,6 +3646,16 @@ static inline bool netif_is_macvlan_port(struct net_device *dev)
36463646
return dev->priv_flags & IFF_MACVLAN_PORT;
36473647
}
36483648

3649+
static inline bool netif_is_ipvlan(struct net_device *dev)
3650+
{
3651+
return dev->priv_flags & IFF_IPVLAN_SLAVE;
3652+
}
3653+
3654+
static inline bool netif_is_ipvlan_port(struct net_device *dev)
3655+
{
3656+
return dev->priv_flags & IFF_IPVLAN_MASTER;
3657+
}
3658+
36493659
static inline bool netif_is_bond_master(struct net_device *dev)
36503660
{
36513661
return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;

0 commit comments

Comments
 (0)