Commit 0afd20e5 authored by Jacob Keller's avatar Jacob Keller Committed by Jeff Kirsher

fm10k: implement request_lport_map pointer

If the fm10k interface is brought up, but the switch manager software is
not running, the driver will continuously request the lport map every
few seconds in the base driver watchdog routine. Eventually after
several minutes the switch mailbox Tx fifo will fill up and the mailbox
will timeout, resulting in a reset. This reset will appear as if for no
reason, and occurs regularly every few minutes until the switch manager
software is loaded.

Prevent this from happening by only requesting the lport map after we've
verified the switch mailbox is tx_ready. In order to simplify code logic
and reduce code duplication, implement this as a new function pointer
"mac.ops.request_lport_map" which the VF will not implement. Otherwise,
we have to duplicate the tx_ready check outside of
fm10k_get_host_state_generic, or re-implement most of
fm10k_get_host_state_generic in the pf version.

The resulting code is simpler and easier to understand, and prevents the
PF from continuously requesting lport map and filling the Tx fifo of
a switch mailbox that isn't ready.
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarKrishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 9d7dbf06
...@@ -519,8 +519,12 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready) ...@@ -519,8 +519,12 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready)
goto out; goto out;
/* interface cannot receive traffic without logical ports */ /* interface cannot receive traffic without logical ports */
if (mac->dglort_map == FM10K_DGLORTMAP_NONE) if (mac->dglort_map == FM10K_DGLORTMAP_NONE) {
if (hw->mac.ops.request_lport_map)
ret_val = hw->mac.ops.request_lport_map(hw);
goto out; goto out;
}
/* if we passed all the tests above then the switch is ready and we no /* if we passed all the tests above then the switch is ready and we no
* longer need to check for link * longer need to check for link
......
...@@ -1622,25 +1622,15 @@ static s32 fm10k_request_lport_map_pf(struct fm10k_hw *hw) ...@@ -1622,25 +1622,15 @@ static s32 fm10k_request_lport_map_pf(struct fm10k_hw *hw)
**/ **/
static s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready) static s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)
{ {
s32 ret_val = 0;
u32 dma_ctrl2; u32 dma_ctrl2;
/* verify the switch is ready for interaction */ /* verify the switch is ready for interaction */
dma_ctrl2 = fm10k_read_reg(hw, FM10K_DMA_CTRL2); dma_ctrl2 = fm10k_read_reg(hw, FM10K_DMA_CTRL2);
if (!(dma_ctrl2 & FM10K_DMA_CTRL2_SWITCH_READY)) if (!(dma_ctrl2 & FM10K_DMA_CTRL2_SWITCH_READY))
goto out; return 0;
/* retrieve generic host state info */ /* retrieve generic host state info */
ret_val = fm10k_get_host_state_generic(hw, switch_ready); return fm10k_get_host_state_generic(hw, switch_ready);
if (ret_val)
goto out;
/* interface cannot receive traffic without logical ports */
if (hw->mac.dglort_map == FM10K_DGLORTMAP_NONE)
ret_val = fm10k_request_lport_map_pf(hw);
out:
return ret_val;
} }
/* This structure defines the attibutes to be parsed below */ /* This structure defines the attibutes to be parsed below */
...@@ -1816,6 +1806,7 @@ static const struct fm10k_mac_ops mac_ops_pf = { ...@@ -1816,6 +1806,7 @@ static const struct fm10k_mac_ops mac_ops_pf = {
.set_dma_mask = fm10k_set_dma_mask_pf, .set_dma_mask = fm10k_set_dma_mask_pf,
.get_fault = fm10k_get_fault_pf, .get_fault = fm10k_get_fault_pf,
.get_host_state = fm10k_get_host_state_pf, .get_host_state = fm10k_get_host_state_pf,
.request_lport_map = fm10k_request_lport_map_pf,
}; };
static const struct fm10k_iov_ops iov_ops_pf = { static const struct fm10k_iov_ops iov_ops_pf = {
......
...@@ -526,6 +526,7 @@ struct fm10k_mac_ops { ...@@ -526,6 +526,7 @@ struct fm10k_mac_ops {
s32 (*stop_hw)(struct fm10k_hw *); s32 (*stop_hw)(struct fm10k_hw *);
s32 (*get_bus_info)(struct fm10k_hw *); s32 (*get_bus_info)(struct fm10k_hw *);
s32 (*get_host_state)(struct fm10k_hw *, bool *); s32 (*get_host_state)(struct fm10k_hw *, bool *);
s32 (*request_lport_map)(struct fm10k_hw *);
s32 (*update_vlan)(struct fm10k_hw *, u32, u8, bool); s32 (*update_vlan)(struct fm10k_hw *, u32, u8, bool);
s32 (*read_mac_addr)(struct fm10k_hw *); s32 (*read_mac_addr)(struct fm10k_hw *);
s32 (*update_uc_addr)(struct fm10k_hw *, u16, const u8 *, s32 (*update_uc_addr)(struct fm10k_hw *, u16, const u8 *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment