i40e: poll firmware slower
authorKamil Krawczyk <kamil.krawczyk@intel.com>
Sat, 25 Oct 2014 03:24:30 +0000 (03:24 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 11 Nov 2014 13:44:16 +0000 (05:44 -0800)
The code was polling the firmware tail register for completion every
10 microseconds, which is way faster than the firmware can respond.
This changes the poll interval to 1ms, which reduces polling CPU
utilization, and the number of times we loop.

The maximum delay is still 100ms.

Change-ID: I4bbfa6b66d802890baf8b4154061e55942b90958
Signed-off-by: Kamil Krawczyk <kamil.krawczyk@intel.com>
Acked-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_adminq.c
drivers/net/ethernet/intel/i40e/i40e_adminq.h
drivers/net/ethernet/intel/i40evf/i40e_adminq.c
drivers/net/ethernet/intel/i40evf/i40e_adminq.h

index 72f5d25a222f0769ea514d5789407a543e66c3c2..f7f6206368dfeef5d88d60f6580190eaa4194c36 100644 (file)
@@ -853,7 +853,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
         */
        if (!details->async && !details->postpone) {
                u32 total_delay = 0;
-               u32 delay_len = 10;
 
                do {
                        /* AQ designers suggest use of head for better
@@ -861,9 +860,8 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
                         */
                        if (i40e_asq_done(hw))
                                break;
-                       /* ugh! delay while spin_lock */
-                       udelay(delay_len);
-                       total_delay += delay_len;
+                       usleep_range(1000, 2000);
+                       total_delay++;
                } while (total_delay < hw->aq.asq_cmd_timeout);
        }
 
index ba38a89c79d6e4ffc10d6d8c1132ca8517a62ebb..df0bd09ed5d82f4cfc4a3454c2639fd2aa1f959c 100644 (file)
@@ -141,7 +141,7 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc)
 
 /* general information */
 #define I40E_AQ_LARGE_BUF      512
-#define I40E_ASQ_CMD_TIMEOUT   100000  /* usecs */
+#define I40E_ASQ_CMD_TIMEOUT   100  /* msecs */
 
 void i40e_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
                                       u16 opcode);
index f206be9178422afc01a955f481f8e523cbb3093c..500ca21627087962dd3270ced4c27e567b4a4bc7 100644 (file)
@@ -801,7 +801,6 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,
         */
        if (!details->async && !details->postpone) {
                u32 total_delay = 0;
-               u32 delay_len = 10;
 
                do {
                        /* AQ designers suggest use of head for better
@@ -809,9 +808,8 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,
                         */
                        if (i40evf_asq_done(hw))
                                break;
-                       /* ugh! delay while spin_lock */
-                       udelay(delay_len);
-                       total_delay += delay_len;
+                       usleep_range(1000, 2000);
+                       total_delay++;
                } while (total_delay < hw->aq.asq_cmd_timeout);
        }
 
index 91a5c5bd80f32242b61920e3f02934fdfb6be251..f40cfac4b022fbfcdc4d317a47759de1c7baf3f9 100644 (file)
@@ -141,7 +141,7 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc)
 
 /* general information */
 #define I40E_AQ_LARGE_BUF      512
-#define I40E_ASQ_CMD_TIMEOUT   100000  /* usecs */
+#define I40E_ASQ_CMD_TIMEOUT   100  /* msecs */
 
 void i40evf_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
                                       u16 opcode);