OSDN Git Service

qed: prevent a fw assert during device shutdown
authorVenkata Sudheer Kumar Bhavaraju <vbhavaraju@marvell.com>
Wed, 9 Feb 2022 19:28:14 +0000 (11:28 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Feb 2022 15:27:44 +0000 (15:27 +0000)
commitca2d5f1ff05955da9506055e88c4bbb71da190f1
tree04222fd40920a60b936abde6b8d9aa542761a090
parent57ea56b05b7fddd460a74931e214ee2114fe97fc
qed: prevent a fw assert during device shutdown

Device firmware can assert if the device shutdown path in driver
encounters an async. events from mfw (processed in
qed_mcp_handle_events()) after qed_mcp_unload_req() returns.
A call to qed_mcp_unload_req() currently marks the device as inactive
and thus stops any new events, but there is a windows where in-flight
events might still be received by the driver.

To prevent this race condition, atomically set QED_MCP_BYPASS_PROC_BIT
in qed_mcp_unload_req() to make sure qed_mcp_handle_events() ignores all
events. Wait for any event that might already be in-process to complete
by monitoring QED_MCP_IN_PROCESSING_BIT.

Signed-off-by: Pravin Kumar Ganesh Dhende <pdhende@marvell.com>
Signed-off-by: Venkata Sudheer Kumar Bhavaraju <vbhavaraju@marvell.com>
Signed-off-by: Alok Prasad <palok@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_mcp.c
drivers/net/ethernet/qlogic/qed/qed_mcp.h