Skip to content

Commit

Permalink
net: bridge: use netif_is_bridge_port()
Browse files Browse the repository at this point in the history
Replace the br_port_exists() macro with its twin from netdevice.h

CC: Roopa Prabhu <roopa@cumulusnetworks.com>
CC: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julian Wiedmann authored and David S. Miller committed Mar 29, 2019
1 parent acb10ea commit 35f861e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ int nbp_backup_change(struct net_bridge_port *p,
ASSERT_RTNL();

if (backup_dev) {
if (!br_port_exists(backup_dev))
if (!netif_is_bridge_port(backup_dev))
return -ENOENT;

backup_p = br_port_get_rtnl(backup_dev);
Expand Down
6 changes: 3 additions & 3 deletions net/bridge/br_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,7 @@ int br_multicast_list_adjacent(struct net_device *dev,
int count = 0;

rcu_read_lock();
if (!br_ip_list || !br_port_exists(dev))
if (!br_ip_list || !netif_is_bridge_port(dev))
goto unlock;

port = br_port_get_rcu(dev);
Expand Down Expand Up @@ -2236,7 +2236,7 @@ bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto)
bool ret = false;

rcu_read_lock();
if (!br_port_exists(dev))
if (!netif_is_bridge_port(dev))
goto unlock;

port = br_port_get_rcu(dev);
Expand Down Expand Up @@ -2272,7 +2272,7 @@ bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto)
bool ret = false;

rcu_read_lock();
if (!br_port_exists(dev))
if (!netif_is_bridge_port(dev))
goto unlock;

port = br_port_get_rcu(dev);
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/br_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static size_t br_get_link_af_size_filtered(const struct net_device *dev,
size_t vinfo_sz = 0;

rcu_read_lock();
if (br_port_exists(dev)) {
if (netif_is_bridge_port(dev)) {
p = br_port_get_rcu(dev);
vg = nbp_vlan_group_rcu(p);
} else if (dev->priv_flags & IFF_EBRIDGE) {
Expand Down
6 changes: 2 additions & 4 deletions net/bridge/br_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,20 @@ struct net_bridge_port {
#define br_auto_port(p) ((p)->flags & BR_AUTO_MASK)
#define br_promisc_port(p) ((p)->flags & BR_PROMISC)

#define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)

static inline struct net_bridge_port *br_port_get_rcu(const struct net_device *dev)
{
return rcu_dereference(dev->rx_handler_data);
}

static inline struct net_bridge_port *br_port_get_rtnl(const struct net_device *dev)
{
return br_port_exists(dev) ?
return netif_is_bridge_port(dev) ?
rtnl_dereference(dev->rx_handler_data) : NULL;
}

static inline struct net_bridge_port *br_port_get_rtnl_rcu(const struct net_device *dev)
{
return br_port_exists(dev) ?
return netif_is_bridge_port(dev) ?
rcu_dereference_rtnl(dev->rx_handler_data) : NULL;
}

Expand Down

0 comments on commit 35f861e

Please sign in to comment.