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_lib.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_lib.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_lib.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index 98e8b7096e47..acf3478a3f3b 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c | |||
@@ -1139,6 +1139,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi) | |||
1139 | ring->vsi = vsi; | 1139 | ring->vsi = vsi; |
1140 | ring->dev = &pf->pdev->dev; | 1140 | ring->dev = &pf->pdev->dev; |
1141 | ring->count = vsi->num_desc; | 1141 | ring->count = vsi->num_desc; |
1142 | ring->itr_setting = ICE_DFLT_TX_ITR; | ||
1142 | vsi->tx_rings[i] = ring; | 1143 | vsi->tx_rings[i] = ring; |
1143 | } | 1144 | } |
1144 | 1145 | ||
@@ -1158,6 +1159,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi) | |||
1158 | ring->netdev = vsi->netdev; | 1159 | ring->netdev = vsi->netdev; |
1159 | ring->dev = &pf->pdev->dev; | 1160 | ring->dev = &pf->pdev->dev; |
1160 | ring->count = vsi->num_desc; | 1161 | ring->count = vsi->num_desc; |
1162 | ring->itr_setting = ICE_DFLT_RX_ITR; | ||
1161 | vsi->rx_rings[i] = ring; | 1163 | vsi->rx_rings[i] = ring; |
1162 | } | 1164 | } |
1163 | 1165 | ||
@@ -1596,6 +1598,23 @@ err_cfg_txqs: | |||
1596 | } | 1598 | } |
1597 | 1599 | ||
1598 | /** | 1600 | /** |
1601 | * ice_intrl_usec_to_reg - convert interrupt rate limit to register value | ||
1602 | * @intrl: interrupt rate limit in usecs | ||
1603 | * @gran: interrupt rate limit granularity in usecs | ||
1604 | * | ||
1605 | * This function converts a decimal interrupt rate limit in usecs to the format | ||
1606 | * expected by firmware. | ||
1607 | */ | ||
1608 | static u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran) | ||
1609 | { | ||
1610 | u32 val = intrl / gran; | ||
1611 | |||
1612 | if (val) | ||
1613 | return val | GLINT_RATE_INTRL_ENA_M; | ||
1614 | return 0; | ||
1615 | } | ||
1616 | |||
1617 | /** | ||
1599 | * ice_vsi_cfg_msix - MSIX mode Interrupt Config in the HW | 1618 | * ice_vsi_cfg_msix - MSIX mode Interrupt Config in the HW |
1600 | * @vsi: the VSI being configured | 1619 | * @vsi: the VSI being configured |
1601 | */ | 1620 | */ |
@@ -1611,23 +1630,27 @@ void ice_vsi_cfg_msix(struct ice_vsi *vsi) | |||
1611 | for (i = 0; i < vsi->num_q_vectors; i++, vector++) { | 1630 | for (i = 0; i < vsi->num_q_vectors; i++, vector++) { |
1612 | struct ice_q_vector *q_vector = vsi->q_vectors[i]; | 1631 | struct ice_q_vector *q_vector = vsi->q_vectors[i]; |
1613 | 1632 | ||
1614 | itr_gran = hw->itr_gran_200; | 1633 | itr_gran = hw->itr_gran; |
1634 | |||
1635 | q_vector->intrl = ICE_DFLT_INTRL; | ||
1615 | 1636 | ||
1616 | if (q_vector->num_ring_rx) { | 1637 | if (q_vector->num_ring_rx) { |
1617 | q_vector->rx.itr = | 1638 | q_vector->rx.itr = |
1618 | ITR_TO_REG(vsi->rx_rings[rxq]->rx_itr_setting, | 1639 | ITR_TO_REG(vsi->rx_rings[rxq]->itr_setting, |
1619 | itr_gran); | 1640 | itr_gran); |
1620 | q_vector->rx.latency_range = ICE_LOW_LATENCY; | 1641 | q_vector->rx.latency_range = ICE_LOW_LATENCY; |
1621 | } | 1642 | } |
1622 | 1643 | ||
1623 | if (q_vector->num_ring_tx) { | 1644 | if (q_vector->num_ring_tx) { |
1624 | q_vector->tx.itr = | 1645 | q_vector->tx.itr = |
1625 | ITR_TO_REG(vsi->tx_rings[txq]->tx_itr_setting, | 1646 | ITR_TO_REG(vsi->tx_rings[txq]->itr_setting, |
1626 | itr_gran); | 1647 | itr_gran); |
1627 | q_vector->tx.latency_range = ICE_LOW_LATENCY; | 1648 | q_vector->tx.latency_range = ICE_LOW_LATENCY; |
1628 | } | 1649 | } |
1629 | wr32(hw, GLINT_ITR(ICE_RX_ITR, vector), q_vector->rx.itr); | 1650 | wr32(hw, GLINT_ITR(ICE_RX_ITR, vector), q_vector->rx.itr); |
1630 | wr32(hw, GLINT_ITR(ICE_TX_ITR, vector), q_vector->tx.itr); | 1651 | wr32(hw, GLINT_ITR(ICE_TX_ITR, vector), q_vector->tx.itr); |
1652 | wr32(hw, GLINT_RATE(vector), | ||
1653 | ice_intrl_usec_to_reg(q_vector->intrl, hw->intrl_gran)); | ||
1631 | 1654 | ||
1632 | /* Both Transmit Queue Interrupt Cause Control register | 1655 | /* Both Transmit Queue Interrupt Cause Control register |
1633 | * and Receive Queue Interrupt Cause control register | 1656 | * and Receive Queue Interrupt Cause control register |