|
@@ -417,7 +417,6 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv)
|
|
unsigned long avg_pkt_size;
|
|
unsigned long avg_pkt_size;
|
|
unsigned long rx_packets;
|
|
unsigned long rx_packets;
|
|
unsigned long rx_bytes;
|
|
unsigned long rx_bytes;
|
|
- unsigned long rx_byte_diff;
|
|
|
|
unsigned long tx_packets;
|
|
unsigned long tx_packets;
|
|
unsigned long tx_pkt_diff;
|
|
unsigned long tx_pkt_diff;
|
|
unsigned long rx_pkt_diff;
|
|
unsigned long rx_pkt_diff;
|
|
@@ -441,25 +440,20 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv)
|
|
rx_pkt_diff = ((unsigned long) (rx_packets -
|
|
rx_pkt_diff = ((unsigned long) (rx_packets -
|
|
priv->last_moder_packets));
|
|
priv->last_moder_packets));
|
|
packets = max(tx_pkt_diff, rx_pkt_diff);
|
|
packets = max(tx_pkt_diff, rx_pkt_diff);
|
|
- rx_byte_diff = rx_bytes - priv->last_moder_bytes;
|
|
|
|
- rx_byte_diff = rx_byte_diff ? rx_byte_diff : 1;
|
|
|
|
rate = packets * HZ / period;
|
|
rate = packets * HZ / period;
|
|
avg_pkt_size = packets ? ((unsigned long) (rx_bytes -
|
|
avg_pkt_size = packets ? ((unsigned long) (rx_bytes -
|
|
priv->last_moder_bytes)) / packets : 0;
|
|
priv->last_moder_bytes)) / packets : 0;
|
|
|
|
|
|
/* Apply auto-moderation only when packet rate exceeds a rate that
|
|
/* Apply auto-moderation only when packet rate exceeds a rate that
|
|
* it matters */
|
|
* it matters */
|
|
- if (rate > MLX4_EN_RX_RATE_THRESH) {
|
|
|
|
|
|
+ if (rate > MLX4_EN_RX_RATE_THRESH && avg_pkt_size > MLX4_EN_AVG_PKT_SMALL) {
|
|
/* If tx and rx packet rates are not balanced, assume that
|
|
/* If tx and rx packet rates are not balanced, assume that
|
|
* traffic is mainly BW bound and apply maximum moderation.
|
|
* traffic is mainly BW bound and apply maximum moderation.
|
|
* Otherwise, moderate according to packet rate */
|
|
* Otherwise, moderate according to packet rate */
|
|
- if (2 * tx_pkt_diff > 3 * rx_pkt_diff &&
|
|
|
|
- rx_pkt_diff / rx_byte_diff <
|
|
|
|
- MLX4_EN_SMALL_PKT_SIZE)
|
|
|
|
- moder_time = priv->rx_usecs_low;
|
|
|
|
- else if (2 * rx_pkt_diff > 3 * tx_pkt_diff)
|
|
|
|
|
|
+ if (2 * tx_pkt_diff > 3 * rx_pkt_diff ||
|
|
|
|
+ 2 * rx_pkt_diff > 3 * tx_pkt_diff) {
|
|
moder_time = priv->rx_usecs_high;
|
|
moder_time = priv->rx_usecs_high;
|
|
- else {
|
|
|
|
|
|
+ } else {
|
|
if (rate < priv->pkt_rate_low)
|
|
if (rate < priv->pkt_rate_low)
|
|
moder_time = priv->rx_usecs_low;
|
|
moder_time = priv->rx_usecs_low;
|
|
else if (rate > priv->pkt_rate_high)
|
|
else if (rate > priv->pkt_rate_high)
|
|
@@ -471,9 +465,7 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv)
|
|
priv->rx_usecs_low;
|
|
priv->rx_usecs_low;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- /* When packet rate is low, use default moderation rather than
|
|
|
|
- * 0 to prevent interrupt storms if traffic suddenly increases */
|
|
|
|
- moder_time = priv->rx_usecs;
|
|
|
|
|
|
+ moder_time = priv->rx_usecs_low;
|
|
}
|
|
}
|
|
|
|
|
|
en_dbg(INTR, priv, "tx rate:%lu rx_rate:%lu\n",
|
|
en_dbg(INTR, priv, "tx rate:%lu rx_rate:%lu\n",
|