Commit 9d301a53 authored by Sean Anderson's avatar Sean Anderson Committed by Jakub Kicinski
Browse files

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: default avatarSean 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: default avatarJakub Kicinski <kuba@kernel.org>
parent 5cff9d17
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -2059,13 +2059,24 @@ axienet_ethtools_set_coalesce(struct net_device *ndev,
		return -EINVAL;
	}

	if (ecoalesce->rx_max_coalesced_frames)
	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;
	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;

	return 0;