OSDN Git Service

mlxsw: spectrum_router: Make RIF deletion more robust
authorIdo Schimmel <idosch@mellanox.com>
Wed, 19 Dec 2018 06:08:48 +0000 (06:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Dec 2018 20:28:07 +0000 (12:28 -0800)
commit965fa8e600d28d98e7e0c7340517a9c139843ee3
tree93761e57cf0247eac0a78a93f945e0f02958543e
parent21ffedb6db5ac80b2081f425be358a976f5c14b7
mlxsw: spectrum_router: Make RIF deletion more robust

In the past we had multiple instances where RIFs were not properly
deleted.

One of the reasons for leaking a RIF was that at the time when IP
addresses were flushed from the respective netdev (prompting the
destruction of the RIF), the netdev was no longer a mlxsw upper. This
caused the inet{,6}addr notification blocks to ignore the NETDEV_DOWN
event and leak the RIF.

Instead of checking whether the netdev is our upper when an IP address
is removed, we can instead check if the netdev has a RIF configured.

To look up a RIF we need to access mlxsw private data, so the patch
stores the notification blocks inside a mlxsw struct. This then allows
us to use container_of() and extract the required private data.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c