diff options
author | Brett Creeley <brett.creeley@intel.com> | 2018-09-19 20:23:19 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-10-02 10:19:30 -0400 |
commit | 9e4ab4c29a62d2ccbf4be42707669be2f42d391c (patch) | |
tree | 54327122a0cddba67d650678f355f808e4966844 /drivers/net/ethernet/intel/ice/ice_common.c | |
parent | ca4929b6df7c729c375c486c0ca53decb0eae9f5 (diff) |
ice: Add support for dynamic interrupt moderation
Currently there is no support for dynamic interrupt moderation. This
patch adds some initial code to support this. The following changes
were made:
1. Currently we are using multiple members to store the interrupt
granularity (itr_gran_25/50/100/200). This is not necessary because
we can query the device to determine what the interrupt granularity
should be set to, done by a new function ice_get_itr_intrl_gran.
2. Added intrl to ice_q_vector structure to support interrupt rate
limiting.
3. Added the function ice_intrl_usecs_to_reg for converting to a value
in usecs that the device understands.
4. Added call to write to the GLINT_RATE register. Disable intrl by
default for now.
5. Changed rx/tx_itr_setting to itr_setting because having both seems
redundant because a ring is either Tx or Rx.
6. Initialize itr_setting for both Tx/Rx rings in ice_vsi_alloc_rings()
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_common.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_common.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 9ff291375869..68fbbb92d504 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c | |||
@@ -598,6 +598,39 @@ void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf) | |||
598 | } | 598 | } |
599 | 599 | ||
600 | /** | 600 | /** |
601 | * ice_get_itr_intrl_gran - determine int/intrl granularity | ||
602 | * @hw: pointer to the hw struct | ||
603 | * | ||
604 | * Determines the itr/intrl granularities based on the maximum aggregate | ||
605 | * bandwidth according to the device's configuration during power-on. | ||
606 | */ | ||
607 | static enum ice_status ice_get_itr_intrl_gran(struct ice_hw *hw) | ||
608 | { | ||
609 | u8 max_agg_bw = (rd32(hw, GL_PWR_MODE_CTL) & | ||
610 | GL_PWR_MODE_CTL_CAR_MAX_BW_M) >> | ||
611 | GL_PWR_MODE_CTL_CAR_MAX_BW_S; | ||
612 | |||
613 | switch (max_agg_bw) { | ||
614 | case ICE_MAX_AGG_BW_200G: | ||
615 | case ICE_MAX_AGG_BW_100G: | ||
616 | case ICE_MAX_AGG_BW_50G: | ||
617 | hw->itr_gran = ICE_ITR_GRAN_ABOVE_25; | ||
618 | hw->intrl_gran = ICE_INTRL_GRAN_ABOVE_25; | ||
619 | break; | ||
620 | case ICE_MAX_AGG_BW_25G: | ||
621 | hw->itr_gran = ICE_ITR_GRAN_MAX_25; | ||
622 | hw->intrl_gran = ICE_INTRL_GRAN_MAX_25; | ||
623 | break; | ||
624 | default: | ||
625 | ice_debug(hw, ICE_DBG_INIT, | ||
626 | "Failed to determine itr/intrl granularity\n"); | ||
627 | return ICE_ERR_CFG; | ||
628 | } | ||
629 | |||
630 | return 0; | ||
631 | } | ||
632 | |||
633 | /** | ||
601 | * ice_init_hw - main hardware initialization routine | 634 | * ice_init_hw - main hardware initialization routine |
602 | * @hw: pointer to the hardware structure | 635 | * @hw: pointer to the hardware structure |
603 | */ | 636 | */ |
@@ -621,11 +654,9 @@ enum ice_status ice_init_hw(struct ice_hw *hw) | |||
621 | if (status) | 654 | if (status) |
622 | return status; | 655 | return status; |
623 | 656 | ||
624 | /* set these values to minimum allowed */ | 657 | status = ice_get_itr_intrl_gran(hw); |
625 | hw->itr_gran_200 = ICE_ITR_GRAN_MIN_200; | 658 | if (status) |
626 | hw->itr_gran_100 = ICE_ITR_GRAN_MIN_100; | 659 | return status; |
627 | hw->itr_gran_50 = ICE_ITR_GRAN_MIN_50; | ||
628 | hw->itr_gran_25 = ICE_ITR_GRAN_MIN_25; | ||
629 | 660 | ||
630 | status = ice_init_all_ctrlq(hw); | 661 | status = ice_init_all_ctrlq(hw); |
631 | if (status) | 662 | if (status) |