diff options
Diffstat (limited to 'drivers/net/mlx4/en_netdev.c')
-rw-r--r-- | drivers/net/mlx4/en_netdev.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index 93f4abd990a9..c48b0f4b17b7 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c | |||
@@ -414,6 +414,7 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv) | |||
414 | unsigned long avg_pkt_size; | 414 | unsigned long avg_pkt_size; |
415 | unsigned long rx_packets; | 415 | unsigned long rx_packets; |
416 | unsigned long rx_bytes; | 416 | unsigned long rx_bytes; |
417 | unsigned long rx_byte_diff; | ||
417 | unsigned long tx_packets; | 418 | unsigned long tx_packets; |
418 | unsigned long tx_pkt_diff; | 419 | unsigned long tx_pkt_diff; |
419 | unsigned long rx_pkt_diff; | 420 | unsigned long rx_pkt_diff; |
@@ -437,6 +438,8 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv) | |||
437 | rx_pkt_diff = ((unsigned long) (rx_packets - | 438 | rx_pkt_diff = ((unsigned long) (rx_packets - |
438 | priv->last_moder_packets)); | 439 | priv->last_moder_packets)); |
439 | packets = max(tx_pkt_diff, rx_pkt_diff); | 440 | packets = max(tx_pkt_diff, rx_pkt_diff); |
441 | rx_byte_diff = rx_bytes - priv->last_moder_bytes; | ||
442 | rx_byte_diff = rx_byte_diff ? rx_byte_diff : 1; | ||
440 | rate = packets * HZ / period; | 443 | rate = packets * HZ / period; |
441 | avg_pkt_size = packets ? ((unsigned long) (rx_bytes - | 444 | avg_pkt_size = packets ? ((unsigned long) (rx_bytes - |
442 | priv->last_moder_bytes)) / packets : 0; | 445 | priv->last_moder_bytes)) / packets : 0; |
@@ -447,10 +450,13 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv) | |||
447 | /* If tx and rx packet rates are not balanced, assume that | 450 | /* If tx and rx packet rates are not balanced, assume that |
448 | * traffic is mainly BW bound and apply maximum moderation. | 451 | * traffic is mainly BW bound and apply maximum moderation. |
449 | * Otherwise, moderate according to packet rate */ | 452 | * Otherwise, moderate according to packet rate */ |
450 | if (2 * tx_pkt_diff > 3 * rx_pkt_diff || | 453 | if (2 * tx_pkt_diff > 3 * rx_pkt_diff && |
451 | 2 * rx_pkt_diff > 3 * tx_pkt_diff) { | 454 | rx_pkt_diff / rx_byte_diff < |
455 | MLX4_EN_SMALL_PKT_SIZE) | ||
456 | moder_time = priv->rx_usecs_low; | ||
457 | else if (2 * rx_pkt_diff > 3 * tx_pkt_diff) | ||
452 | moder_time = priv->rx_usecs_high; | 458 | moder_time = priv->rx_usecs_high; |
453 | } else { | 459 | else { |
454 | if (rate < priv->pkt_rate_low) | 460 | if (rate < priv->pkt_rate_low) |
455 | moder_time = priv->rx_usecs_low; | 461 | moder_time = priv->rx_usecs_low; |
456 | else if (rate > priv->pkt_rate_high) | 462 | else if (rate > priv->pkt_rate_high) |
@@ -616,8 +622,7 @@ int mlx4_en_start_port(struct net_device *dev) | |||
616 | 622 | ||
617 | /* Configure ring */ | 623 | /* Configure ring */ |
618 | tx_ring = &priv->tx_ring[i]; | 624 | tx_ring = &priv->tx_ring[i]; |
619 | err = mlx4_en_activate_tx_ring(priv, tx_ring, cq->mcq.cqn, | 625 | err = mlx4_en_activate_tx_ring(priv, tx_ring, cq->mcq.cqn); |
620 | priv->rx_ring[0].srq.srqn); | ||
621 | if (err) { | 626 | if (err) { |
622 | en_err(priv, "Failed allocating Tx ring\n"); | 627 | en_err(priv, "Failed allocating Tx ring\n"); |
623 | mlx4_en_deactivate_cq(priv, cq); | 628 | mlx4_en_deactivate_cq(priv, cq); |
@@ -1005,9 +1010,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
1005 | if (err) | 1010 | if (err) |
1006 | goto out; | 1011 | goto out; |
1007 | 1012 | ||
1008 | /* Populate Rx default RSS mappings */ | ||
1009 | mlx4_en_set_default_rss_map(priv, &priv->rss_map, priv->rx_ring_num * | ||
1010 | RSS_FACTOR, priv->rx_ring_num); | ||
1011 | /* Allocate page for receive rings */ | 1013 | /* Allocate page for receive rings */ |
1012 | err = mlx4_alloc_hwq_res(mdev->dev, &priv->res, | 1014 | err = mlx4_alloc_hwq_res(mdev->dev, &priv->res, |
1013 | MLX4_EN_PAGE_SIZE, MLX4_EN_PAGE_SIZE); | 1015 | MLX4_EN_PAGE_SIZE, MLX4_EN_PAGE_SIZE); |