|
@@ -1016,6 +1016,9 @@ static bool i40e_set_new_dynamic_itr(struct i40e_ring_container *rc)
|
|
|
int bytes_per_usec;
|
|
|
unsigned int usecs, estimated_usecs;
|
|
|
|
|
|
+ if (!rc->ring || !ITR_IS_DYNAMIC(rc->ring->itr_setting))
|
|
|
+ return false;
|
|
|
+
|
|
|
if (rc->total_packets == 0 || !rc->itr)
|
|
|
return false;
|
|
|
|
|
@@ -2288,15 +2291,6 @@ static u32 i40e_buildreg_itr(const int type, const u16 itr)
|
|
|
|
|
|
/* a small macro to shorten up some long lines */
|
|
|
#define INTREG I40E_PFINT_DYN_CTLN
|
|
|
-static inline int get_rx_itr(struct i40e_vsi *vsi, int idx)
|
|
|
-{
|
|
|
- return vsi->rx_rings[idx]->itr_setting;
|
|
|
-}
|
|
|
-
|
|
|
-static inline int get_tx_itr(struct i40e_vsi *vsi, int idx)
|
|
|
-{
|
|
|
- return vsi->tx_rings[idx]->itr_setting;
|
|
|
-}
|
|
|
|
|
|
/**
|
|
|
* i40e_update_enable_itr - Update itr and re-enable MSIX interrupt
|
|
@@ -2309,9 +2303,7 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,
|
|
|
{
|
|
|
struct i40e_hw *hw = &vsi->back->hw;
|
|
|
bool rx = false, tx = false;
|
|
|
- u32 rxval, txval;
|
|
|
- int idx = q_vector->v_idx;
|
|
|
- int rx_itr_setting, tx_itr_setting;
|
|
|
+ u32 txval;
|
|
|
|
|
|
/* If we don't have MSIX, then we only need to re-enable icr0 */
|
|
|
if (!(vsi->back->flags & I40E_FLAG_MSIX_ENABLED)) {
|
|
@@ -2319,29 +2311,15 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- /* avoid dynamic calculation if in countdown mode OR if
|
|
|
- * all dynamic is disabled
|
|
|
- */
|
|
|
txval = i40e_buildreg_itr(I40E_ITR_NONE, 0);
|
|
|
|
|
|
- rx_itr_setting = get_rx_itr(vsi, idx);
|
|
|
- tx_itr_setting = get_tx_itr(vsi, idx);
|
|
|
-
|
|
|
- if (q_vector->itr_countdown > 0 ||
|
|
|
- (!ITR_IS_DYNAMIC(rx_itr_setting) &&
|
|
|
- !ITR_IS_DYNAMIC(tx_itr_setting))) {
|
|
|
+ /* avoid dynamic calculation if in countdown mode */
|
|
|
+ if (q_vector->itr_countdown > 0)
|
|
|
goto enable_int;
|
|
|
- }
|
|
|
|
|
|
- if (ITR_IS_DYNAMIC(rx_itr_setting)) {
|
|
|
- rx = i40e_set_new_dynamic_itr(&q_vector->rx);
|
|
|
- rxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr);
|
|
|
- }
|
|
|
-
|
|
|
- if (ITR_IS_DYNAMIC(tx_itr_setting)) {
|
|
|
- tx = i40e_set_new_dynamic_itr(&q_vector->tx);
|
|
|
- txval = i40e_buildreg_itr(I40E_TX_ITR, q_vector->tx.itr);
|
|
|
- }
|
|
|
+ /* these will return false if dynamic mode is disabled */
|
|
|
+ rx = i40e_set_new_dynamic_itr(&q_vector->rx);
|
|
|
+ tx = i40e_set_new_dynamic_itr(&q_vector->tx);
|
|
|
|
|
|
if (rx || tx) {
|
|
|
/* get the higher of the two ITR adjustments and
|
|
@@ -2349,25 +2327,20 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,
|
|
|
* when in adaptive mode (Rx and/or Tx)
|
|
|
*/
|
|
|
u16 itr = max(q_vector->tx.itr, q_vector->rx.itr);
|
|
|
+ u32 rxval;
|
|
|
|
|
|
q_vector->tx.itr = q_vector->rx.itr = itr;
|
|
|
- txval = i40e_buildreg_itr(I40E_TX_ITR, itr);
|
|
|
- tx = true;
|
|
|
- rxval = i40e_buildreg_itr(I40E_RX_ITR, itr);
|
|
|
- rx = true;
|
|
|
- }
|
|
|
|
|
|
- /* only need to enable the interrupt once, but need
|
|
|
- * to possibly update both ITR values
|
|
|
- */
|
|
|
- if (rx) {
|
|
|
/* set the INTENA_MSK_MASK so that this first write
|
|
|
* won't actually enable the interrupt, instead just
|
|
|
* updating the ITR (it's bit 31 PF and VF)
|
|
|
*/
|
|
|
- rxval |= BIT(31);
|
|
|
+ rxval = i40e_buildreg_itr(I40E_RX_ITR, itr) | BIT(31);
|
|
|
+
|
|
|
/* don't check _DOWN because interrupt isn't being enabled */
|
|
|
wr32(hw, INTREG(q_vector->reg_idx), rxval);
|
|
|
+
|
|
|
+ txval = i40e_buildreg_itr(I40E_TX_ITR, itr);
|
|
|
}
|
|
|
|
|
|
enable_int:
|