summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorInbar Karmy <inbark@mellanox.com>2017-10-10 12:28:34 +0300
committerDavid S. Miller <davem@davemloft.net>2017-10-10 13:11:22 -0700
commitb8d394367a631c2d749b3114e04dfb4d09624ddf (patch)
treeda2c277a0934e8a19585282ee7e3c92a1c82466d /drivers
parent7e1dc5e926d57a5bc4ac97d6e061e2fe29c266c0 (diff)
downloadlinux-b8d394367a631c2d749b3114e04dfb4d09624ddf.tar.bz2
net/mlx4_en: Limit the number of RX rings
Limit the number of RX rings 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index e9432bc1c1bc..bf1f04164885 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1742,12 +1742,17 @@ static int mlx4_en_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
return err;
}
+static int mlx4_en_get_max_num_rx_rings(struct net_device *dev)
+{
+ return min_t(int, num_online_cpus(), MAX_RX_RINGS);
+}
+
static void mlx4_en_get_channels(struct net_device *dev,
struct ethtool_channels *channel)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
- channel->max_rx = MAX_RX_RINGS;
+ channel->max_rx = mlx4_en_get_max_num_rx_rings(dev);
channel->max_tx = priv->mdev->profile.max_num_tx_rings_p_up;
channel->rx_count = priv->rx_ring_num;