diff options
author | Ido Schimmel <idosch@mellanox.com> | 2017-03-10 10:53:37 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-10 20:36:06 +0300 |
commit | f4a761d2030289229e5e7837a8afd35e48af464c (patch) | |
tree | 9a4e7a6e9deb41a822d86cafb3f00c339cf3f197 /drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |
parent | 186962ebb7ecd74d305cf167e99bf1885b89ea8c (diff) | |
download | linux-f4a761d2030289229e5e7837a8afd35e48af464c.tar.xz |
mlxsw: spectrum: Destroy RIFs based on last removed address
We only use the RIF reference count to determine when the last IP
address was removed, but instead we can just test 'in_dev->ifa_list'.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index fd6c40ead96a..cb0e77ad4c0a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3392,16 +3392,16 @@ void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port) } static bool mlxsw_sp_rif_should_config(struct mlxsw_sp_rif *r, + const struct in_device *in_dev, unsigned long event) { switch (event) { case NETDEV_UP: if (!r) return true; - r->ref_count++; return false; case NETDEV_DOWN: - if (r && --r->ref_count == 0) + if (r && !in_dev->ifa_list) return true; /* It is possible we already removed the RIF ourselves * if it was assigned to a netdev that is now a bridge @@ -3484,7 +3484,6 @@ mlxsw_sp_rif_alloc(u16 rif, struct net_device *l3_dev, struct mlxsw_sp_fid *f) INIT_LIST_HEAD(&r->neigh_list); ether_addr_copy(r->addr, l3_dev->dev_addr); r->mtu = l3_dev->mtu; - r->ref_count = 1; r->dev = l3_dev; r->rif = rif; r->f = f; @@ -3858,7 +3857,7 @@ static int mlxsw_sp_inetaddr_event(struct notifier_block *unused, goto out; r = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); - if (!mlxsw_sp_rif_should_config(r, event)) + if (!mlxsw_sp_rif_should_config(r, ifa->ifa_dev, event)) goto out; if (mlxsw_sp_port_dev_check(dev)) |