Commit 1fa18370 authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: complain about out-of-range descriptor request

Instead of silently clamping the descriptor change request into
the proper range, fail the request and complain in the log file.

Change-Id: Id55ef59255d93c04bedffa8e25fe7ea796c90f32
Signed-off-by: default avatarShannon Nelson <shannon.nelson@intel.com>
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 639dc377
...@@ -422,15 +422,19 @@ static int i40e_set_ringparam(struct net_device *netdev, ...@@ -422,15 +422,19 @@ static int i40e_set_ringparam(struct net_device *netdev,
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
return -EINVAL; return -EINVAL;
new_tx_count = clamp_t(u32, ring->tx_pending, if (ring->tx_pending > I40E_MAX_NUM_DESCRIPTORS ||
I40E_MIN_NUM_DESCRIPTORS, ring->tx_pending < I40E_MIN_NUM_DESCRIPTORS ||
I40E_MAX_NUM_DESCRIPTORS); ring->rx_pending > I40E_MAX_NUM_DESCRIPTORS ||
new_tx_count = ALIGN(new_tx_count, I40E_REQ_DESCRIPTOR_MULTIPLE); ring->rx_pending < I40E_MIN_NUM_DESCRIPTORS) {
netdev_info(netdev,
new_rx_count = clamp_t(u32, ring->rx_pending, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n",
I40E_MIN_NUM_DESCRIPTORS, ring->tx_pending, ring->rx_pending,
I40E_MAX_NUM_DESCRIPTORS); I40E_MIN_NUM_DESCRIPTORS, I40E_MAX_NUM_DESCRIPTORS);
new_rx_count = ALIGN(new_rx_count, I40E_REQ_DESCRIPTOR_MULTIPLE); return -EINVAL;
}
new_tx_count = ALIGN(ring->tx_pending, I40E_REQ_DESCRIPTOR_MULTIPLE);
new_rx_count = ALIGN(ring->rx_pending, I40E_REQ_DESCRIPTOR_MULTIPLE);
/* if nothing to do return success */ /* if nothing to do return success */
if ((new_tx_count == vsi->tx_rings[0]->count) && if ((new_tx_count == vsi->tx_rings[0]->count) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment