Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8d39436 authored by Inbar Karmy's avatar Inbar Karmy Committed by David S. Miller
Browse files

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: default avatarInbar Karmy <inbark@mellanox.com>
Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7e1dc5e9
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;