Commit 5a49ef98 authored by Parav Pandit's avatar Parav Pandit Committed by Greg Kroah-Hartman

RDMA/core: Add GIDs while changing MAC addr only for registered ndev

[ Upstream commit d52ef88a ]

Currently when MAC address is changed, regardless of the netdev reg_state,
GID entries are removed and added to reflect the new MAC address and new
default GID entries.

When a bonding device is used and the underlying PCI device is removed
several netdevice events are generated. Two events of the interest are
CHANGEADDR and UNREGISTER event on lower(slave) netdevice of the bond
netdevice.

Sometimes CHANGEADDR event is generated when netdev state is
UNREGISTERING (after UNREGISTER event is generated). In this scenario, GID
entries for default GIDs are added and never deleted because GID entries
are deleted only when netdev state is < UNREGISTERED.

This leads to non zero reference count on the netdevice. Due to this, PCI
device unbind operation is getting stuck.

To avoid it, when changing mac address, add GID entries only if netdev is
in REGISTERED state.

Fixes: 03db3a2d ("IB/core: Add RoCE GID table management")
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 7c736fee
...@@ -767,8 +767,10 @@ static int netdevice_event(struct notifier_block *this, unsigned long event, ...@@ -767,8 +767,10 @@ static int netdevice_event(struct notifier_block *this, unsigned long event,
case NETDEV_CHANGEADDR: case NETDEV_CHANGEADDR:
cmds[0] = netdev_del_cmd; cmds[0] = netdev_del_cmd;
if (ndev->reg_state == NETREG_REGISTERED) {
cmds[1] = add_default_gid_cmd; cmds[1] = add_default_gid_cmd;
cmds[2] = add_cmd; cmds[2] = add_cmd;
}
break; break;
case NETDEV_CHANGEUPPER: case NETDEV_CHANGEUPPER:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment