aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_ethtool.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index b04e4337df47..fd3e379de6da 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -422,15 +422,19 @@ static int i40e_set_ringparam(struct net_device *netdev,
422 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) 422 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
423 return -EINVAL; 423 return -EINVAL;
424 424
425 new_tx_count = clamp_t(u32, ring->tx_pending, 425 if (ring->tx_pending > I40E_MAX_NUM_DESCRIPTORS ||
426 I40E_MIN_NUM_DESCRIPTORS, 426 ring->tx_pending < I40E_MIN_NUM_DESCRIPTORS ||
427 I40E_MAX_NUM_DESCRIPTORS); 427 ring->rx_pending > I40E_MAX_NUM_DESCRIPTORS ||
428 new_tx_count = ALIGN(new_tx_count, I40E_REQ_DESCRIPTOR_MULTIPLE); 428 ring->rx_pending < I40E_MIN_NUM_DESCRIPTORS) {
429 429 netdev_info(netdev,
430 new_rx_count = clamp_t(u32, ring->rx_pending, 430 "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n",
431 I40E_MIN_NUM_DESCRIPTORS, 431 ring->tx_pending, ring->rx_pending,
432 I40E_MAX_NUM_DESCRIPTORS); 432 I40E_MIN_NUM_DESCRIPTORS, I40E_MAX_NUM_DESCRIPTORS);
433 new_rx_count = ALIGN(new_rx_count, I40E_REQ_DESCRIPTOR_MULTIPLE); 433 return -EINVAL;
434 }
435
436 new_tx_count = ALIGN(ring->tx_pending, I40E_REQ_DESCRIPTOR_MULTIPLE);
437 new_rx_count = ALIGN(ring->rx_pending, I40E_REQ_DESCRIPTOR_MULTIPLE);
434 438
435 /* if nothing to do return success */ 439 /* if nothing to do return success */
436 if ((new_tx_count == vsi->tx_rings[0]->count) && 440 if ((new_tx_count == vsi->tx_rings[0]->count) &&