diff options
Diffstat (limited to 'net/bridge/br_private.h')
-rw-r--r-- | net/bridge/br_private.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index b862071bf601..46e0bec1d7c5 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -151,11 +151,19 @@ struct net_bridge_port #endif }; -#define br_port_get_rcu(dev) \ - ((struct net_bridge_port *) rcu_dereference(dev->rx_handler_data)) -#define br_port_get(dev) ((struct net_bridge_port *) dev->rx_handler_data) #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) +{ + struct net_bridge_port *port = rcu_dereference(dev->rx_handler_data); + return br_port_exists(dev) ? port : NULL; +} + +static inline struct net_bridge_port *br_port_get(struct net_device *dev) +{ + return br_port_exists(dev) ? dev->rx_handler_data : NULL; +} + struct br_cpu_netstats { u64 rx_packets; u64 rx_bytes; |