aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox
diff options
context:
space:
mode:
authorYevgeny Petrilin <yevgenyp@mellanox.co.il>2012-04-22 22:18:33 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-23 22:34:02 -0400
commita19a848a456aee35508b548819003907d033003b (patch)
treec156cb70fecfcfcbc43b4603eb6a31e15f63fe06 /drivers/net/ethernet/mellanox
parentda882c1f2ecadb0ed582628ec1585e36b137c0f0 (diff)
mlx4_en: Added Ethtool support for TX Interrupt coalescing
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c19
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c6
2 files changed, 21 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index e15a1fb4cd14..72901ce2b088 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -359,8 +359,8 @@ static int mlx4_en_get_coalesce(struct net_device *dev,
359{ 359{
360 struct mlx4_en_priv *priv = netdev_priv(dev); 360 struct mlx4_en_priv *priv = netdev_priv(dev);
361 361
362 coal->tx_coalesce_usecs = 0; 362 coal->tx_coalesce_usecs = priv->tx_usecs;
363 coal->tx_max_coalesced_frames = 0; 363 coal->tx_max_coalesced_frames = priv->tx_frames;
364 coal->rx_coalesce_usecs = priv->rx_usecs; 364 coal->rx_coalesce_usecs = priv->rx_usecs;
365 coal->rx_max_coalesced_frames = priv->rx_frames; 365 coal->rx_max_coalesced_frames = priv->rx_frames;
366 366
@@ -388,6 +388,21 @@ static int mlx4_en_set_coalesce(struct net_device *dev,
388 MLX4_EN_RX_COAL_TIME : 388 MLX4_EN_RX_COAL_TIME :
389 coal->rx_coalesce_usecs; 389 coal->rx_coalesce_usecs;
390 390
391 /* Setting TX coalescing parameters */
392 if (coal->tx_coalesce_usecs != priv->tx_usecs ||
393 coal->tx_max_coalesced_frames != priv->tx_frames) {
394 priv->tx_usecs = coal->tx_coalesce_usecs;
395 priv->tx_frames = coal->tx_max_coalesced_frames;
396 for (i = 0; i < priv->tx_ring_num; i++) {
397 priv->tx_cq[i].moder_cnt = priv->tx_frames;
398 priv->tx_cq[i].moder_time = priv->tx_usecs;
399 if (mlx4_en_set_cq_moder(priv, &priv->tx_cq[i])) {
400 en_warn(priv, "Failed changing moderation "
401 "for TX cq %d\n", i);
402 }
403 }
404 }
405
391 /* Set adaptive coalescing params */ 406 /* Set adaptive coalescing params */
392 priv->pkt_rate_low = coal->pkt_rate_low; 407 priv->pkt_rate_low = coal->pkt_rate_low;
393 priv->rx_usecs_low = coal->rx_coalesce_usecs_low; 408 priv->rx_usecs_low = coal->rx_coalesce_usecs_low;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 35003ada04ec..bfcfd8ae5f73 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -429,6 +429,8 @@ static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv)
429 */ 429 */
430 priv->rx_frames = MLX4_EN_RX_COAL_TARGET; 430 priv->rx_frames = MLX4_EN_RX_COAL_TARGET;
431 priv->rx_usecs = MLX4_EN_RX_COAL_TIME; 431 priv->rx_usecs = MLX4_EN_RX_COAL_TIME;
432 priv->tx_frames = MLX4_EN_TX_COAL_PKTS;
433 priv->tx_usecs = MLX4_EN_TX_COAL_TIME;
432 en_dbg(INTR, priv, "Default coalesing params for mtu:%d - " 434 en_dbg(INTR, priv, "Default coalesing params for mtu:%d - "
433 "rx_frames:%d rx_usecs:%d\n", 435 "rx_frames:%d rx_usecs:%d\n",
434 priv->dev->mtu, priv->rx_frames, priv->rx_usecs); 436 priv->dev->mtu, priv->rx_frames, priv->rx_usecs);
@@ -445,8 +447,8 @@ static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv)
445 447
446 for (i = 0; i < priv->tx_ring_num; i++) { 448 for (i = 0; i < priv->tx_ring_num; i++) {
447 cq = &priv->tx_cq[i]; 449 cq = &priv->tx_cq[i];
448 cq->moder_cnt = MLX4_EN_TX_COAL_PKTS; 450 cq->moder_cnt = priv->tx_frames;
449 cq->moder_time = MLX4_EN_TX_COAL_TIME; 451 cq->moder_time = priv->tx_usecs;
450 } 452 }
451 453
452 /* Reset auto-moderation params */ 454 /* Reset auto-moderation params */