Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ice: Add ability to update rx-usecs-high

Currently the driver allows rx-usecs-high values to be set,
but when querying the device for rx-usecs-high the value
does not stick. This is because it was not yet implemented.
Add code to allow the user to change rx-usecs-high and
use this to set the q_vector's intrl value.

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>

authored by

Brett Creeley and committed by
Jeff Kirsher
b9c8bb06 b4b418b3

+33 -2
+30 -1
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 2228 2228 ice_get_rc_coalesce(struct ethtool_coalesce *ec, enum ice_container_type c_type, 2229 2229 struct ice_ring_container *rc) 2230 2230 { 2231 - struct ice_pf *pf = rc->ring->vsi->back; 2231 + struct ice_pf *pf; 2232 + 2233 + if (!rc->ring) 2234 + return -EINVAL; 2235 + 2236 + pf = rc->ring->vsi->back; 2232 2237 2233 2238 switch (c_type) { 2234 2239 case ICE_RX_CONTAINER: 2235 2240 ec->use_adaptive_rx_coalesce = ITR_IS_DYNAMIC(rc->itr_setting); 2236 2241 ec->rx_coalesce_usecs = rc->itr_setting & ~ICE_ITR_DYNAMIC; 2242 + ec->rx_coalesce_usecs_high = rc->ring->q_vector->intrl; 2237 2243 break; 2238 2244 case ICE_TX_CONTAINER: 2239 2245 ec->use_adaptive_tx_coalesce = ITR_IS_DYNAMIC(rc->itr_setting); ··· 2348 2342 2349 2343 switch (c_type) { 2350 2344 case ICE_RX_CONTAINER: 2345 + if (ec->rx_coalesce_usecs_high > ICE_MAX_INTRL || 2346 + (ec->rx_coalesce_usecs_high && 2347 + ec->rx_coalesce_usecs_high < pf->hw.intrl_gran)) { 2348 + netdev_info(vsi->netdev, 2349 + "Invalid value, rx-usecs-high valid values are 0 (disabled), %d-%d\n", 2350 + pf->hw.intrl_gran, ICE_MAX_INTRL); 2351 + return -EINVAL; 2352 + } 2353 + 2354 + if (ec->rx_coalesce_usecs_high != rc->ring->q_vector->intrl) { 2355 + rc->ring->q_vector->intrl = ec->rx_coalesce_usecs_high; 2356 + wr32(&pf->hw, GLINT_RATE(vsi->hw_base_vector + 2357 + rc->ring->q_vector->v_idx), 2358 + ice_intrl_usec_to_reg(ec->rx_coalesce_usecs_high, 2359 + pf->hw.intrl_gran)); 2360 + } 2361 + 2351 2362 if (ec->rx_coalesce_usecs != itr_setting && 2352 2363 ec->use_adaptive_rx_coalesce) { 2353 2364 netdev_info(vsi->netdev, ··· 2387 2364 } 2388 2365 break; 2389 2366 case ICE_TX_CONTAINER: 2367 + if (ec->tx_coalesce_usecs_high) { 2368 + netdev_info(vsi->netdev, 2369 + "setting tx-usecs-high is not supported\n"); 2370 + return -EINVAL; 2371 + } 2372 + 2390 2373 if (ec->tx_coalesce_usecs != itr_setting && 2391 2374 ec->use_adaptive_tx_coalesce) { 2392 2375 netdev_info(vsi->netdev,
+1 -1
drivers/net/ethernet/intel/ice/ice_lib.c
··· 1764 1764 * This function converts a decimal interrupt rate limit in usecs to the format 1765 1765 * expected by firmware. 1766 1766 */ 1767 - static u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran) 1767 + u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran) 1768 1768 { 1769 1769 u32 val = intrl / gran; 1770 1770
+1
drivers/net/ethernet/intel/ice/ice_lib.h
··· 80 80 81 81 int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena); 82 82 83 + u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran); 83 84 #endif /* !_ICE_LIB_H_ */
+1
drivers/net/ethernet/intel/ice/ice_txrx.h
··· 142 142 #define ICE_ITR_ADAPTIVE_BULK 0x0000 143 143 144 144 #define ICE_DFLT_INTRL 0 145 + #define ICE_MAX_INTRL 236 145 146 146 147 /* Legacy or Advanced Mode Queue */ 147 148 #define ICE_TX_ADVANCED 0