|
@@ -1742,13 +1742,18 @@ 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_tx = MLX4_EN_MAX_TX_RING_P_UP;
|
|
|
+ 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;
|
|
|
channel->tx_count = priv->tx_ring_num[TX] /
|
|
@@ -1777,7 +1782,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",
|