Commit b9c8bb06 authored by Brett Creeley's avatar Brett Creeley Committed by Jeff Kirsher

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: default avatarBrett Creeley <brett.creeley@intel.com>
Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent b4b418b3
...@@ -2228,12 +2228,18 @@ static int ...@@ -2228,12 +2228,18 @@ static int
ice_get_rc_coalesce(struct ethtool_coalesce *ec, enum ice_container_type c_type, ice_get_rc_coalesce(struct ethtool_coalesce *ec, enum ice_container_type c_type,
struct ice_ring_container *rc) struct ice_ring_container *rc)
{ {
struct ice_pf *pf = rc->ring->vsi->back; struct ice_pf *pf;
if (!rc->ring)
return -EINVAL;
pf = rc->ring->vsi->back;
switch (c_type) { switch (c_type) {
case ICE_RX_CONTAINER: case ICE_RX_CONTAINER:
ec->use_adaptive_rx_coalesce = ITR_IS_DYNAMIC(rc->itr_setting); ec->use_adaptive_rx_coalesce = ITR_IS_DYNAMIC(rc->itr_setting);
ec->rx_coalesce_usecs = rc->itr_setting & ~ICE_ITR_DYNAMIC; ec->rx_coalesce_usecs = rc->itr_setting & ~ICE_ITR_DYNAMIC;
ec->rx_coalesce_usecs_high = rc->ring->q_vector->intrl;
break; break;
case ICE_TX_CONTAINER: case ICE_TX_CONTAINER:
ec->use_adaptive_tx_coalesce = ITR_IS_DYNAMIC(rc->itr_setting); ec->use_adaptive_tx_coalesce = ITR_IS_DYNAMIC(rc->itr_setting);
...@@ -2342,6 +2348,23 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec, ...@@ -2342,6 +2348,23 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec,
switch (c_type) { switch (c_type) {
case ICE_RX_CONTAINER: case ICE_RX_CONTAINER:
if (ec->rx_coalesce_usecs_high > ICE_MAX_INTRL ||
(ec->rx_coalesce_usecs_high &&
ec->rx_coalesce_usecs_high < pf->hw.intrl_gran)) {
netdev_info(vsi->netdev,
"Invalid value, rx-usecs-high valid values are 0 (disabled), %d-%d\n",
pf->hw.intrl_gran, ICE_MAX_INTRL);
return -EINVAL;
}
if (ec->rx_coalesce_usecs_high != rc->ring->q_vector->intrl) {
rc->ring->q_vector->intrl = ec->rx_coalesce_usecs_high;
wr32(&pf->hw, GLINT_RATE(vsi->hw_base_vector +
rc->ring->q_vector->v_idx),
ice_intrl_usec_to_reg(ec->rx_coalesce_usecs_high,
pf->hw.intrl_gran));
}
if (ec->rx_coalesce_usecs != itr_setting && if (ec->rx_coalesce_usecs != itr_setting &&
ec->use_adaptive_rx_coalesce) { ec->use_adaptive_rx_coalesce) {
netdev_info(vsi->netdev, netdev_info(vsi->netdev,
...@@ -2364,6 +2387,12 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec, ...@@ -2364,6 +2387,12 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec,
} }
break; break;
case ICE_TX_CONTAINER: case ICE_TX_CONTAINER:
if (ec->tx_coalesce_usecs_high) {
netdev_info(vsi->netdev,
"setting tx-usecs-high is not supported\n");
return -EINVAL;
}
if (ec->tx_coalesce_usecs != itr_setting && if (ec->tx_coalesce_usecs != itr_setting &&
ec->use_adaptive_tx_coalesce) { ec->use_adaptive_tx_coalesce) {
netdev_info(vsi->netdev, netdev_info(vsi->netdev,
......
...@@ -1764,7 +1764,7 @@ int ice_vsi_cfg_lan_txqs(struct ice_vsi *vsi) ...@@ -1764,7 +1764,7 @@ int ice_vsi_cfg_lan_txqs(struct ice_vsi *vsi)
* This function converts a decimal interrupt rate limit in usecs to the format * This function converts a decimal interrupt rate limit in usecs to the format
* expected by firmware. * expected by firmware.
*/ */
static u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran) u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran)
{ {
u32 val = intrl / gran; u32 val = intrl / gran;
......
...@@ -80,4 +80,5 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi); ...@@ -80,4 +80,5 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi);
int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena); int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena);
u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran);
#endif /* !_ICE_LIB_H_ */ #endif /* !_ICE_LIB_H_ */
...@@ -142,6 +142,7 @@ enum ice_rx_dtype { ...@@ -142,6 +142,7 @@ enum ice_rx_dtype {
#define ICE_ITR_ADAPTIVE_BULK 0x0000 #define ICE_ITR_ADAPTIVE_BULK 0x0000
#define ICE_DFLT_INTRL 0 #define ICE_DFLT_INTRL 0
#define ICE_MAX_INTRL 236
/* Legacy or Advanced Mode Queue */ /* Legacy or Advanced Mode Queue */
#define ICE_TX_ADVANCED 0 #define ICE_TX_ADVANCED 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment