igb/igbvf: don't give up
authorMitch Williams <mitch.a.williams@intel.com>
Sat, 12 Dec 2015 00:45:38 +0000 (16:45 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 16 Feb 2016 00:17:57 +0000 (16:17 -0800)
The driver shouldn't just give up if it fails to get the hardware
mailbox lock. This can happen in a situation where the PF-VF
communication channel is heavily loaded and causes complete
communications failure between the PF and VF drivers.

Add a counter and a delay. The driver will now retry ten times, waiting
one millisecond between retries.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/igb/e1000_mbx.c
drivers/net/ethernet/intel/igbvf/mbx.c

index 162cc49345d09babbd7fab30ec0917215e1a9b64..10f5c9e016a965096b7d02250d340238edd68f48 100644 (file)
@@ -322,14 +322,20 @@ static s32 igb_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
 {
        s32 ret_val = -E1000_ERR_MBX;
        u32 p2v_mailbox;
+       int count = 10;
 
-       /* Take ownership of the buffer */
-       wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
+       do {
+               /* Take ownership of the buffer */
+               wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
 
-       /* reserve mailbox for vf use */
-       p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number));
-       if (p2v_mailbox & E1000_P2VMAILBOX_PFU)
-               ret_val = 0;
+               /* reserve mailbox for vf use */
+               p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number));
+               if (p2v_mailbox & E1000_P2VMAILBOX_PFU) {
+                       ret_val = 0;
+                       break;
+               }
+               udelay(1000);
+       } while (count-- > 0);
 
        return ret_val;
 }
index 7b6cb4c3764caff0432a543080d9d05d766bf475..01752f44ace2a0515a1c6ef35b900a32c719f07c 100644 (file)
@@ -234,13 +234,19 @@ static s32 e1000_check_for_rst_vf(struct e1000_hw *hw)
 static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
 {
        s32 ret_val = -E1000_ERR_MBX;
-
-       /* Take ownership of the buffer */
-       ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
-
-       /* reserve mailbox for VF use */
-       if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU)
-               ret_val = E1000_SUCCESS;
+       int count = 10;
+
+       do {
+               /* Take ownership of the buffer */
+               ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
+
+               /* reserve mailbox for VF use */
+               if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU) {
+                       ret_val = 0;
+                       break;
+               }
+               udelay(1000);
+       } while (count-- > 0);
 
        return ret_val;
 }