net/mlx5e: Don't attach netdev profile while handling internal error
authorDmytro Linkin <dlinkin@nvidia.com>
Wed, 13 Oct 2021 11:39:24 +0000 (14:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 08:34:01 +0000 (10:34 +0200)
commit724aa4fd9e36087b7c8b7caaca0746ce871f7db8
treed8d5326ae8fbfb71fb475b23736f57f1b5651af0
parent9c7ae143a01b6421b2144ab89b20996cd25c9886
net/mlx5e: Don't attach netdev profile while handling internal error

[ Upstream commit bdf274750fca17b289404ef03453c4070725302c ]

As part of switchdev mode disablement, driver changes port netdevice
profile from uplink to nic. If this process is triggered by health
recovery flow (PCI reset, for ex.) profile attach would fail because all
fw commands aborted when internal error flag is set. As a result, nic
netdevice profile is not attached and driver fails to rollback to uplink
profile, which leave driver in broken state and cause crash later.

To handle broken state do netdevice profile initialization only instead
of full attachment and release mdev resources on driver suspend as
expected. Actual netdevice attachment is done during driver load.

Fixes: c4d7eb57687f ("net/mxl5e: Add change profile method")
Signed-off-by: Dmytro Linkin <dlinkin@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c