diff options
author | Brett Creeley <brett.creeley@intel.com> | 2018-12-19 13:03:29 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2019-01-15 14:29:16 -0500 |
commit | 63f545ed1285a5f904c260ff22c958609c3c11c5 (patch) | |
tree | 28e93dc5f427de3efb9bd4e352a165ab90f33dab /drivers/net/ethernet/intel/ice/ice_main.c | |
parent | 9be1d6f8c33731acd67586a4e40c0f3d56a23366 (diff) |
ice: Add support for adaptive interrupt moderation
Currently the driver does not support adaptive/dynamic interrupt
moderation. This patch adds support for this. Also, adaptive/dynamic
interrupt moderation is turned on by default upon driver load.
In order to support adaptive interrupt moderation, two functions were
added, ice_update_itr() and ice_itr_divisor(). These are used to
determine the current packet load and to determine a divisor based
on link speed respectively.
This patch also adds the ICE_ITR_GRAN_S define that is used in the
hot-path when setting a new ITR value. The shift is used to pet two
birds with one hand, set the ITR value while re-enabling the
interrupt. Also, the ICE_ITR_GRAN_S is defined as 1 because the device
has a ITR granularity of 2usecs.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 093708b5c0ef..e59f8b29af49 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c | |||
@@ -1389,7 +1389,6 @@ static int ice_req_irq_msix_misc(struct ice_pf *pf) | |||
1389 | { | 1389 | { |
1390 | struct ice_hw *hw = &pf->hw; | 1390 | struct ice_hw *hw = &pf->hw; |
1391 | int oicr_idx, err = 0; | 1391 | int oicr_idx, err = 0; |
1392 | u8 itr_gran; | ||
1393 | u32 val; | 1392 | u32 val; |
1394 | 1393 | ||
1395 | if (!pf->int_name[0]) | 1394 | if (!pf->int_name[0]) |
@@ -1453,10 +1452,8 @@ skip_req_irq: | |||
1453 | PFINT_MBX_CTL_CAUSE_ENA_M); | 1452 | PFINT_MBX_CTL_CAUSE_ENA_M); |
1454 | wr32(hw, PFINT_MBX_CTL, val); | 1453 | wr32(hw, PFINT_MBX_CTL, val); |
1455 | 1454 | ||
1456 | itr_gran = hw->itr_gran; | ||
1457 | |||
1458 | wr32(hw, GLINT_ITR(ICE_RX_ITR, pf->hw_oicr_idx), | 1455 | wr32(hw, GLINT_ITR(ICE_RX_ITR, pf->hw_oicr_idx), |
1459 | ITR_TO_REG(ICE_ITR_8K, itr_gran)); | 1456 | ITR_REG_ALIGN(ICE_ITR_8K) >> ICE_ITR_GRAN_S); |
1460 | 1457 | ||
1461 | ice_flush(hw); | 1458 | ice_flush(hw); |
1462 | ice_irq_dynamic_ena(hw, NULL, NULL); | 1459 | ice_irq_dynamic_ena(hw, NULL, NULL); |
@@ -1998,6 +1995,23 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf) | |||
1998 | } | 1995 | } |
1999 | 1996 | ||
2000 | /** | 1997 | /** |
1998 | * ice_verify_itr_gran - verify driver's assumption of ITR granularity | ||
1999 | * @pf: pointer to the PF structure | ||
2000 | * | ||
2001 | * There is no error returned here because the driver will be able to handle a | ||
2002 | * different ITR granularity, but interrupt moderation will not be accurate if | ||
2003 | * the driver's assumptions are not verified. This assumption is made so we can | ||
2004 | * use constants in the hot path instead of accessing structure members. | ||
2005 | */ | ||
2006 | static void ice_verify_itr_gran(struct ice_pf *pf) | ||
2007 | { | ||
2008 | if (pf->hw.itr_gran != (ICE_ITR_GRAN_S << 1)) | ||
2009 | dev_warn(&pf->pdev->dev, | ||
2010 | "%d ITR granularity assumption is invalid, actual ITR granularity is %d. Interrupt moderation will be inaccurate!\n", | ||
2011 | (ICE_ITR_GRAN_S << 1), pf->hw.itr_gran); | ||
2012 | } | ||
2013 | |||
2014 | /** | ||
2001 | * ice_verify_cacheline_size - verify driver's assumption of 64 Byte cache lines | 2015 | * ice_verify_cacheline_size - verify driver's assumption of 64 Byte cache lines |
2002 | * @pf: pointer to the PF structure | 2016 | * @pf: pointer to the PF structure |
2003 | * | 2017 | * |
@@ -2163,6 +2177,7 @@ static int ice_probe(struct pci_dev *pdev, | |||
2163 | mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); | 2177 | mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); |
2164 | 2178 | ||
2165 | ice_verify_cacheline_size(pf); | 2179 | ice_verify_cacheline_size(pf); |
2180 | ice_verify_itr_gran(pf); | ||
2166 | 2181 | ||
2167 | return 0; | 2182 | return 0; |
2168 | 2183 | ||