mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 20:46:48 +02:00
net: xilinx: axienet: Report an error for bad coalesce settings
Instead of silently ignoring invalid/unsupported settings, report an error. Additionally, relax the check for non-zero usecs to apply only when it will be used (i.e. when frames != 1). Signed-off-by: Sean Anderson <sean.anderson@linux.dev> Reviewed by: Shannon Nelson <shannon.nelson@amd.com> Link: https://patch.msgid.link/20250116232954.2696930-3-sean.anderson@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5cff9d1756
commit
9d301a53a5
|
|
@ -2059,14 +2059,25 @@ axienet_ethtools_set_coalesce(struct net_device *ndev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ecoalesce->rx_max_coalesced_frames)
|
||||
lp->coalesce_count_rx = ecoalesce->rx_max_coalesced_frames;
|
||||
if (ecoalesce->rx_coalesce_usecs)
|
||||
lp->coalesce_usec_rx = ecoalesce->rx_coalesce_usecs;
|
||||
if (ecoalesce->tx_max_coalesced_frames)
|
||||
lp->coalesce_count_tx = ecoalesce->tx_max_coalesced_frames;
|
||||
if (ecoalesce->tx_coalesce_usecs)
|
||||
lp->coalesce_usec_tx = ecoalesce->tx_coalesce_usecs;
|
||||
if (!ecoalesce->rx_max_coalesced_frames ||
|
||||
!ecoalesce->tx_max_coalesced_frames) {
|
||||
NL_SET_ERR_MSG(extack, "frames must be non-zero");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((ecoalesce->rx_max_coalesced_frames > 1 &&
|
||||
!ecoalesce->rx_coalesce_usecs) ||
|
||||
(ecoalesce->tx_max_coalesced_frames > 1 &&
|
||||
!ecoalesce->tx_coalesce_usecs)) {
|
||||
NL_SET_ERR_MSG(extack,
|
||||
"usecs must be non-zero when frames is greater than one");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
lp->coalesce_count_rx = ecoalesce->rx_max_coalesced_frames;
|
||||
lp->coalesce_usec_rx = ecoalesce->rx_coalesce_usecs;
|
||||
lp->coalesce_count_tx = ecoalesce->tx_max_coalesced_frames;
|
||||
lp->coalesce_usec_tx = ecoalesce->tx_coalesce_usecs;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user