[PATCH net-next mlxsw v2 1/7] net: bridge: Publish bridge accessor functions
Ido Schimmel
idosch at mellanox.com
Wed Apr 25 17:01:14 AEST 2018
On Wed, Apr 25, 2018 at 01:08:44AM +0200, Petr Machata wrote:
> +struct net_device *br_fdb_find_port(const struct net_device *br_dev,
> + const unsigned char *addr,
> + __u16 vid)
> +{
> + struct net_bridge_fdb_entry *f;
> + struct net_device *dev = NULL;
> + struct net_bridge *br;
> +
> + if (!netif_is_bridge_master(br_dev))
> + return NULL;
> +
> + br = netdev_priv(br_dev);
> +
> + spin_lock_bh(&br->hash_lock);
> + f = br_fdb_find(br, addr, vid);
> + if (f)
> + dev = f->dst->dev;
What about the case where f->dst is NULL? Such as when the FDB entry
points to the bridge device itself?
Also, I believe a reference should be taken on the resulting device.
> + spin_unlock_bh(&br->hash_lock);
> +
> + return dev;
> +}
> +EXPORT_SYMBOL_GPL(br_fdb_find_port);
More information about the Linux-mlxsw
mailing list