Skip to content

Commit 6264101

Browse files
nmkwangregkh
authored andcommitted
fm10k: request reset when mbx->state changes
[ Upstream commit 2f3fc1e6200309ccf87f61dea56e57e563c4f800 ] Multiple IES API resets can cause a race condition where the mailbox interrupt request bits can be cleared before being handled. This can leave certain mailbox messages from the PF to be untreated and the PF will enter in some inactive state. If this situation occurs, the IES API will initiate a mailbox version reset which, then, trigger a mailbox state change. Once this mailbox transition occurs (from OPEN to CONNECT state), a request for reset will be returned. This ensures that PF will undergo a reset whenever IES API encounters an unknown global mailbox interrupt event or whenever the IES API terminates. Signed-off-by: Ngai-Mint Kwan <ngai-mint.kwan@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Krishneil Singh <krishneil.k.singh@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2bb04f1 commit 6264101

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

drivers/net/ethernet/intel/fm10k/fm10k_mbx.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,9 +2002,10 @@ static void fm10k_sm_mbx_create_reply(struct fm10k_hw *hw,
20022002
* function can also be used to respond to an error as the connection
20032003
* resetting would also be a means of dealing with errors.
20042004
**/
2005-
static void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
2006-
struct fm10k_mbx_info *mbx)
2005+
static s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
2006+
struct fm10k_mbx_info *mbx)
20072007
{
2008+
s32 err = 0;
20082009
const enum fm10k_mbx_state state = mbx->state;
20092010

20102011
switch (state) {
@@ -2017,6 +2018,7 @@ static void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
20172018
case FM10K_STATE_OPEN:
20182019
/* flush any incomplete work */
20192020
fm10k_sm_mbx_connect_reset(mbx);
2021+
err = FM10K_ERR_RESET_REQUESTED;
20202022
break;
20212023
case FM10K_STATE_CONNECT:
20222024
/* Update remote value to match local value */
@@ -2026,6 +2028,8 @@ static void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
20262028
}
20272029

20282030
fm10k_sm_mbx_create_reply(hw, mbx, mbx->tail);
2031+
2032+
return err;
20292033
}
20302034

20312035
/**
@@ -2106,7 +2110,7 @@ static s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,
21062110

21072111
switch (FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, SM_VER)) {
21082112
case 0:
2109-
fm10k_sm_mbx_process_reset(hw, mbx);
2113+
err = fm10k_sm_mbx_process_reset(hw, mbx);
21102114
break;
21112115
case FM10K_SM_MBX_VERSION:
21122116
err = fm10k_sm_mbx_process_version_1(hw, mbx);

drivers/net/ethernet/intel/fm10k/fm10k_pci.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,7 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
10721072
struct fm10k_hw *hw = &interface->hw;
10731073
struct fm10k_mbx_info *mbx = &hw->mbx;
10741074
u32 eicr;
1075+
s32 err = 0;
10751076

10761077
/* unmask any set bits related to this interrupt */
10771078
eicr = fm10k_read_reg(hw, FM10K_EICR);
@@ -1087,12 +1088,15 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
10871088

10881089
/* service mailboxes */
10891090
if (fm10k_mbx_trylock(interface)) {
1090-
mbx->ops.process(hw, mbx);
1091+
err = mbx->ops.process(hw, mbx);
10911092
/* handle VFLRE events */
10921093
fm10k_iov_event(interface);
10931094
fm10k_mbx_unlock(interface);
10941095
}
10951096

1097+
if (err == FM10K_ERR_RESET_REQUESTED)
1098+
interface->flags |= FM10K_FLAG_RESET_REQUESTED;
1099+
10961100
/* if switch toggled state we should reset GLORTs */
10971101
if (eicr & FM10K_EICR_SWITCHNOTREADY) {
10981102
/* force link down for at least 4 seconds */

0 commit comments

Comments
 (0)