bnxt_en: Fix bnxt_reset() in the slow path task.
authorMichael Chan <michael.chan@broadcom.com>
Wed, 25 Jan 2017 07:55:07 +0000 (02:55 -0500)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 02:58:57 +0000 (02:58 +0000)
commitb0119c3d5726b6e0a8b27a9f377953d15f30f79b
tree5ee8724083c3682b227b60f460832849d3616338
parent4a57c9f95debd4ddf60147ce55602f061724a51d
bnxt_en: Fix bnxt_reset() in the slow path task.

[ Upstream commit a551ee94ea723b4af9b827c7460f108bc13425ee ]

In bnxt_sp_task(), we set a bit BNXT_STATE_IN_SP_TASK so that bnxt_close()
will synchronize and wait for bnxt_sp_task() to finish.  Some functions
in bnxt_sp_task() require us to clear BNXT_STATE_IN_SP_TASK and then
acquire rtnl_lock() to prevent race conditions.

There are some bugs related to this logic. This patch refactors the code
to have common bnxt_rtnl_lock_sp() and bnxt_rtnl_unlock_sp() to handle
the RTNL and the clearing/setting of the bit.  Multiple functions will
need the same logic.  We also need to move bnxt_reset() to the end of
bnxt_sp_task().  Functions that clear BNXT_STATE_IN_SP_TASK must be the
last functions to be called in bnxt_sp_task().  The common scheme will
handle the condition properly.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c