From: Jesse Brandeburg <jesse.brandeb...@intel.com>

The driver would occasionally miss that there were outstanding
descriptors to clean when exiting busy/napi poll. This issue has
been in the code since the introduction of the ice driver.

Attempt to "catch" any remaining work by triggering a software
interrupt when exiting napi poll or busy-poll. This will not
cause extra interrupts in the case of normal execution.

This issue was found when running sfnt-pingpong, with busy
poll enabled, and typically with larger I/O sizes like > 8192,
the program would occasionally report > 1 second maximums
to complete a ping pong.

Signed-off-by: Jesse Brandeburg <jesse.brandeb...@intel.com>
Tested-by: Tony Brelinski <tonyx.brelin...@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.ngu...@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_hw_autogen.h |  1 +
 drivers/net/ethernet/intel/ice/ice_txrx.c       | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h 
b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
index 67b5b9b9d009..de38a0fc9665 100644
--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
@@ -130,6 +130,7 @@
 #define GLINT_DYN_CTL_ITR_INDX_M               ICE_M(0x3, 3)
 #define GLINT_DYN_CTL_INTERVAL_S               5
 #define GLINT_DYN_CTL_INTERVAL_M               ICE_M(0xFFF, 5)
+#define GLINT_DYN_CTL_SW_ITR_INDX_ENA_M                BIT(24)
 #define GLINT_DYN_CTL_SW_ITR_INDX_M            ICE_M(0x3, 25)
 #define GLINT_DYN_CTL_WB_ON_ITR_M              BIT(30)
 #define GLINT_DYN_CTL_INTENA_MSK_M             BIT(31)
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c 
b/drivers/net/ethernet/intel/ice/ice_txrx.c
index 97c3efb932dc..1ce9ad02477d 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -1302,6 +1302,7 @@ static u32 ice_buildreg_itr(u16 itr_idx, u16 itr)
 static void ice_update_ena_itr(struct ice_q_vector *q_vector)
 {
        struct ice_vsi *vsi = q_vector->vsi;
+       bool wb_en = q_vector->wb_on_itr;
        u32 itr_val;
 
        if (test_bit(ICE_DOWN, vsi->state))
@@ -1310,7 +1311,7 @@ static void ice_update_ena_itr(struct ice_q_vector 
*q_vector)
        /* When exiting WB_ON_ITR, let ITR resume its normal
         * interrupts-enabled path.
         */
-       if (q_vector->wb_on_itr)
+       if (wb_en)
                q_vector->wb_on_itr = false;
 
        /* This will do nothing if dynamic updates are not enabled. */
@@ -1318,6 +1319,16 @@ static void ice_update_ena_itr(struct ice_q_vector 
*q_vector)
 
        /* net_dim() updates ITR out-of-band using a work item */
        itr_val = ice_buildreg_itr(ICE_ITR_NONE, 0);
+       /* trigger an immediate software interrupt when exiting
+        * busy poll, to make sure to catch any pending cleanups
+        * that might have been missed due to interrupt state
+        * transition.
+        */
+       if (wb_en) {
+               itr_val |= GLINT_DYN_CTL_SWINT_TRIG_M |
+                          GLINT_DYN_CTL_SW_ITR_INDX_M |
+                          GLINT_DYN_CTL_SW_ITR_INDX_ENA_M;
+       }
        wr32(&vsi->back->hw, GLINT_DYN_CTL(q_vector->reg_idx), itr_val);
 }
 
-- 
2.26.2

Reply via email to