diff options
author | Carolyn Wyborny <carolyn.wyborny@intel.com> | 2014-06-03 21:23:18 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-06-24 21:18:59 -0400 |
commit | 5c2cebda438b888147f6dfd6d1423432d837c0ea (patch) | |
tree | 9686b5b218e6c68bc919f95ac23ea37a343aeeca | |
parent | cde4cbc7800469c9b8424261b69c45a71a89caf4 (diff) |
i40e: Fix ethtool coalesce settings
This patch fixes the i40e_set_coalesce function to allow 0 as a disable
value. Also, added message to user about invalid value and provides valid
range.
Change-ID: I6c9ff11a9861f2045bd543745a3d132999ffbbd8
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 28 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 16 |
3 files changed, 40 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 817e179dc3f9..07811dd6eb89 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h | |||
@@ -617,6 +617,7 @@ static inline void i40e_dbg_init(void) {} | |||
617 | static inline void i40e_dbg_exit(void) {} | 617 | static inline void i40e_dbg_exit(void) {} |
618 | #endif /* CONFIG_DEBUG_FS*/ | 618 | #endif /* CONFIG_DEBUG_FS*/ |
619 | void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector); | 619 | void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector); |
620 | void i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector); | ||
620 | void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf); | 621 | void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf); |
621 | void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf); | 622 | void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf); |
622 | int i40e_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); | 623 | int i40e_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 4a488ffcd6b0..7da37581bc02 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |||
@@ -1105,17 +1105,36 @@ static int i40e_set_coalesce(struct net_device *netdev, | |||
1105 | if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq) | 1105 | if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq) |
1106 | vsi->work_limit = ec->tx_max_coalesced_frames_irq; | 1106 | vsi->work_limit = ec->tx_max_coalesced_frames_irq; |
1107 | 1107 | ||
1108 | vector = vsi->base_vector; | ||
1108 | if ((ec->rx_coalesce_usecs >= (I40E_MIN_ITR << 1)) && | 1109 | if ((ec->rx_coalesce_usecs >= (I40E_MIN_ITR << 1)) && |
1109 | (ec->rx_coalesce_usecs <= (I40E_MAX_ITR << 1))) | 1110 | (ec->rx_coalesce_usecs <= (I40E_MAX_ITR << 1))) { |
1110 | vsi->rx_itr_setting = ec->rx_coalesce_usecs; | 1111 | vsi->rx_itr_setting = ec->rx_coalesce_usecs; |
1111 | else | 1112 | } else if (ec->rx_coalesce_usecs == 0) { |
1113 | vsi->rx_itr_setting = ec->rx_coalesce_usecs; | ||
1114 | i40e_irq_dynamic_disable(vsi, vector); | ||
1115 | if (ec->use_adaptive_rx_coalesce) | ||
1116 | netif_info(pf, drv, netdev, | ||
1117 | "Rx-secs=0, need to disable adaptive-Rx for a complete disable\n"); | ||
1118 | } else { | ||
1119 | netif_info(pf, drv, netdev, | ||
1120 | "Invalid value, Rx-usecs range is 0, 8-8160\n"); | ||
1112 | return -EINVAL; | 1121 | return -EINVAL; |
1122 | } | ||
1113 | 1123 | ||
1114 | if ((ec->tx_coalesce_usecs >= (I40E_MIN_ITR << 1)) && | 1124 | if ((ec->tx_coalesce_usecs >= (I40E_MIN_ITR << 1)) && |
1115 | (ec->tx_coalesce_usecs <= (I40E_MAX_ITR << 1))) | 1125 | (ec->tx_coalesce_usecs <= (I40E_MAX_ITR << 1))) { |
1116 | vsi->tx_itr_setting = ec->tx_coalesce_usecs; | 1126 | vsi->tx_itr_setting = ec->tx_coalesce_usecs; |
1117 | else | 1127 | } else if (ec->tx_coalesce_usecs == 0) { |
1128 | vsi->tx_itr_setting = ec->tx_coalesce_usecs; | ||
1129 | i40e_irq_dynamic_disable(vsi, vector); | ||
1130 | if (ec->use_adaptive_tx_coalesce) | ||
1131 | netif_info(pf, drv, netdev, | ||
1132 | "Tx-secs=0, need to disable adaptive-Tx for a complete disable\n"); | ||
1133 | } else { | ||
1134 | netif_info(pf, drv, netdev, | ||
1135 | "Invalid value, Tx-usecs range is 0, 8-8160\n"); | ||
1118 | return -EINVAL; | 1136 | return -EINVAL; |
1137 | } | ||
1119 | 1138 | ||
1120 | if (ec->use_adaptive_rx_coalesce) | 1139 | if (ec->use_adaptive_rx_coalesce) |
1121 | vsi->rx_itr_setting |= I40E_ITR_DYNAMIC; | 1140 | vsi->rx_itr_setting |= I40E_ITR_DYNAMIC; |
@@ -1127,7 +1146,6 @@ static int i40e_set_coalesce(struct net_device *netdev, | |||
1127 | else | 1146 | else |
1128 | vsi->tx_itr_setting &= ~I40E_ITR_DYNAMIC; | 1147 | vsi->tx_itr_setting &= ~I40E_ITR_DYNAMIC; |
1129 | 1148 | ||
1130 | vector = vsi->base_vector; | ||
1131 | for (i = 0; i < vsi->num_q_vectors; i++, vector++) { | 1149 | for (i = 0; i < vsi->num_q_vectors; i++, vector++) { |
1132 | q_vector = vsi->q_vectors[i]; | 1150 | q_vector = vsi->q_vectors[i]; |
1133 | q_vector->rx.itr = ITR_TO_REG(vsi->rx_itr_setting); | 1151 | q_vector->rx.itr = ITR_TO_REG(vsi->rx_itr_setting); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index b4278a22382c..71efc68c5d99 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -2768,6 +2768,22 @@ void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector) | |||
2768 | } | 2768 | } |
2769 | 2769 | ||
2770 | /** | 2770 | /** |
2771 | * i40e_irq_dynamic_disable - Disable default interrupt generation settings | ||
2772 | * @vsi: pointer to a vsi | ||
2773 | * @vector: enable a particular Hw Interrupt vector | ||
2774 | **/ | ||
2775 | void i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector) | ||
2776 | { | ||
2777 | struct i40e_pf *pf = vsi->back; | ||
2778 | struct i40e_hw *hw = &pf->hw; | ||
2779 | u32 val; | ||
2780 | |||
2781 | val = I40E_ITR_NONE << I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT; | ||
2782 | wr32(hw, I40E_PFINT_DYN_CTLN(vector - 1), val); | ||
2783 | i40e_flush(hw); | ||
2784 | } | ||
2785 | |||
2786 | /** | ||
2771 | * i40e_msix_clean_rings - MSIX mode Interrupt Handler | 2787 | * i40e_msix_clean_rings - MSIX mode Interrupt Handler |
2772 | * @irq: interrupt number | 2788 | * @irq: interrupt number |
2773 | * @data: pointer to a q_vector | 2789 | * @data: pointer to a q_vector |