net/mlx4_en: Limit the number of TX rings
authorInbar Karmy <inbark@mellanox.com>
Tue, 10 Oct 2017 09:28:33 +0000 (12:28 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Oct 2017 20:11:22 +0000 (13:11 -0700)
Limit the number of TX rings per UP by the number of cores
in the system.

Signed-off-by: Inbar Karmy <inbark@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
drivers/net/ethernet/mellanox/mlx4/en_main.c
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

index 3d4e4a5d00d1c5f81267c4a4a9675bc667709211..e9432bc1c1bcc41f324b5169a4284aff298bf0fb 100644 (file)
@@ -1748,7 +1748,7 @@ static void mlx4_en_get_channels(struct net_device *dev,
        struct mlx4_en_priv *priv = netdev_priv(dev);
 
        channel->max_rx = MAX_RX_RINGS;
-       channel->max_tx = MLX4_EN_MAX_TX_RING_P_UP;
+       channel->max_tx = priv->mdev->profile.max_num_tx_rings_p_up;
 
        channel->rx_count = priv->rx_ring_num;
        channel->tx_count = priv->tx_ring_num[TX] /
@@ -1777,7 +1777,7 @@ static int mlx4_en_set_channels(struct net_device *dev,
        mutex_lock(&mdev->state_lock);
        xdp_count = priv->tx_ring_num[TX_XDP] ? channel->rx_count : 0;
        if (channel->tx_count * priv->prof->num_up + xdp_count >
-           MAX_TX_RINGS) {
+           priv->mdev->profile.max_num_tx_rings_p_up * priv->prof->num_up) {
                err = -EINVAL;
                en_err(priv,
                       "Total number of TX and XDP rings (%d) exceeds the maximum supported (%d)\n",
index 686e18de9a97b3e2ef96d9daa405ba1177546228..2c2965497ed35c5b74d0baeed8ff89ae7f0e52d6 100644 (file)
@@ -153,7 +153,7 @@ static void mlx4_en_get_profile(struct mlx4_en_dev *mdev)
        int i;
 
        params->udp_rss = udp_rss;
-       params->num_tx_rings_p_up = mlx4_low_memory_profile() ?
+       params->max_num_tx_rings_p_up = mlx4_low_memory_profile() ?
                MLX4_EN_MIN_TX_RING_P_UP :
                min_t(int, num_online_cpus(), MLX4_EN_MAX_TX_RING_P_UP);
 
@@ -170,8 +170,8 @@ static void mlx4_en_get_profile(struct mlx4_en_dev *mdev)
                params->prof[i].tx_ring_size = MLX4_EN_DEF_TX_RING_SIZE;
                params->prof[i].rx_ring_size = MLX4_EN_DEF_RX_RING_SIZE;
                params->prof[i].num_up = MLX4_EN_NUM_UP_LOW;
-               params->prof[i].num_tx_rings_p_up = params->num_tx_rings_p_up;
-               params->prof[i].tx_ring_num[TX] = params->num_tx_rings_p_up *
+               params->prof[i].num_tx_rings_p_up = params->max_num_tx_rings_p_up;
+               params->prof[i].tx_ring_num[TX] = params->max_num_tx_rings_p_up *
                        params->prof[i].num_up;
                params->prof[i].rss_rings = 0;
                params->prof[i].inline_thold = inline_thold;
index 9c218f1cfc6caf50aca61c853422f8c1767a75c8..e4c7a80ef5a8111742a4a05d49a790e908d06d85 100644 (file)
@@ -3305,7 +3305,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
        priv->pflags = MLX4_EN_PRIV_FLAGS_BLUEFLAME;
        priv->ctrl_flags = cpu_to_be32(MLX4_WQE_CTRL_CQ_UPDATE |
                        MLX4_WQE_CTRL_SOLICITED);
-       priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up;
+       priv->num_tx_rings_p_up = mdev->profile.max_num_tx_rings_p_up;
        priv->tx_work_limit = MLX4_EN_DEFAULT_TX_WORK;
        netdev_rss_key_fill(priv->rss_key, sizeof(priv->rss_key));
 
index fdb3ad0cbe5427c450ef4695d605402f3d8e7148..245e9ea09ab298bc6680d178c7322d72602d6c67 100644 (file)
@@ -399,7 +399,7 @@ struct mlx4_en_profile {
        u32 active_ports;
        u32 small_pkt_int;
        u8 no_reset;
-       u8 num_tx_rings_p_up;
+       u8 max_num_tx_rings_p_up;
        struct mlx4_en_port_profile prof[MLX4_MAX_PORTS + 1];
 };