aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_ethtool.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index d9c9f86a30df..9aa422691954 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1099,7 +1099,7 @@ static int mlx4_en_set_ringparam(struct net_device *dev,
1099 memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); 1099 memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile));
1100 new_prof.tx_ring_size = tx_size; 1100 new_prof.tx_ring_size = tx_size;
1101 new_prof.rx_ring_size = rx_size; 1101 new_prof.rx_ring_size = rx_size;
1102 err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); 1102 err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, true);
1103 if (err) 1103 if (err)
1104 goto out; 1104 goto out;
1105 1105
@@ -1732,8 +1732,6 @@ static void mlx4_en_get_channels(struct net_device *dev,
1732{ 1732{
1733 struct mlx4_en_priv *priv = netdev_priv(dev); 1733 struct mlx4_en_priv *priv = netdev_priv(dev);
1734 1734
1735 memset(channel, 0, sizeof(*channel));
1736
1737 channel->max_rx = MAX_RX_RINGS; 1735 channel->max_rx = MAX_RX_RINGS;
1738 channel->max_tx = MLX4_EN_MAX_TX_RING_P_UP; 1736 channel->max_tx = MLX4_EN_MAX_TX_RING_P_UP;
1739 1737
@@ -1752,10 +1750,7 @@ static int mlx4_en_set_channels(struct net_device *dev,
1752 int xdp_count; 1750 int xdp_count;
1753 int err = 0; 1751 int err = 0;
1754 1752
1755 if (channel->other_count || channel->combined_count || 1753 if (!channel->tx_count || !channel->rx_count)
1756 channel->tx_count > MLX4_EN_MAX_TX_RING_P_UP ||
1757 channel->rx_count > MAX_RX_RINGS ||
1758 !channel->tx_count || !channel->rx_count)
1759 return -EINVAL; 1754 return -EINVAL;
1760 1755
1761 tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); 1756 tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
@@ -1779,7 +1774,7 @@ static int mlx4_en_set_channels(struct net_device *dev,
1779 new_prof.tx_ring_num[TX_XDP] = xdp_count; 1774 new_prof.tx_ring_num[TX_XDP] = xdp_count;
1780 new_prof.rx_ring_num = channel->rx_count; 1775 new_prof.rx_ring_num = channel->rx_count;
1781 1776
1782 err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); 1777 err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, true);
1783 if (err) 1778 if (err)
1784 goto out; 1779 goto out;
1785 1780