]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
fm10k: implement request_lport_map pointer
authorJacob Keller <jacob.e.keller@intel.com>
Tue, 7 Jun 2016 23:08:59 +0000 (16:08 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 26 Feb 2017 06:04:26 +0000 (22:04 -0800)
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: 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>
Orabug: 25394529
(cherry picked from commit 0afd20e5573c4aa976f1b935b6df73592b46ded5)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
drivers/net/ethernet/intel/fm10k/fm10k_common.c
drivers/net/ethernet/intel/fm10k/fm10k_pf.c
drivers/net/ethernet/intel/fm10k/fm10k_type.h

index 5bbf19cfe29b64a971746ca5fa573366f4f80720..d6baaea8bc7c1039a1fdf77c250049cfaed2cd34 100644 (file)
@@ -519,8 +519,12 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready)
                goto out;
 
        /* 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;
+       }
 
        /* if we passed all the tests above then the switch is ready and we no
         * longer need to check for link
index 8acd65d0288620d97bb6c45ea212795c7e249938..2a33ddc5e0cf5a2dc540b8c18d7e080c78e5f605 100644 (file)
@@ -1635,25 +1635,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)
 {
-       s32 ret_val = 0;
        u32 dma_ctrl2;
 
        /* verify the switch is ready for interaction */
        dma_ctrl2 = fm10k_read_reg(hw, FM10K_DMA_CTRL2);
        if (!(dma_ctrl2 & FM10K_DMA_CTRL2_SWITCH_READY))
-               goto out;
+               return 0;
 
        /* retrieve generic host state info */
-       ret_val = 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;
+       return fm10k_get_host_state_generic(hw, switch_ready);
 }
 
 /* This structure defines the attibutes to be parsed below */
@@ -1914,6 +1904,7 @@ static const struct fm10k_mac_ops mac_ops_pf = {
        .get_host_state         = fm10k_get_host_state_pf,
        .adjust_systime         = fm10k_adjust_systime_pf,
        .read_systime           = fm10k_read_systime_pf,
+       .request_lport_map      = fm10k_request_lport_map_pf,
 };
 
 static const struct fm10k_iov_ops iov_ops_pf = {
index 9d0bc4ecd1516d20f5531cbb489d6b5ca6d1100d..cff3736c40ebcd4006185ba848d1827052483f2c 100644 (file)
@@ -537,6 +537,7 @@ struct fm10k_mac_ops {
        s32 (*stop_hw)(struct fm10k_hw *);
        s32 (*get_bus_info)(struct fm10k_hw *);
        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 (*read_mac_addr)(struct fm10k_hw *);
        s32 (*update_uc_addr)(struct fm10k_hw *, u16, const u8 *,