]> git.karo-electronics.de Git - linux-beck.git/commit
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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Jan 2017 18:27:12 +0000 (13:27 -0500)
commita551ee94ea723b4af9b827c7460f108bc13425ee
tree40f3b1b0e736e0ab695294cf8ae9d3c1fe8722ad
parent56d806222ace4c3aeae516cd7a855340fb2839d8
bnxt_en: Fix bnxt_reset() in the slow path task.

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>
drivers/net/ethernet/broadcom/bnxt/bnxt.c