Commit dc9e9d61 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-enetc-add-more-checks-to-enetc_set_rxfh'

Wei Fang says:

====================
net: enetc: add more checks to enetc_set_rxfh()

ENETC only supports Toeplitz algorithm, and VFs do not support setting
the RSS key, but enetc_set_rxfh() does not check these constraints and
silently accepts unsupported configurations. This may mislead users or
tools into believing that the requested RSS settings have been
successfully applied. So add checks to reject unsupported hash functions
and RSS key updates on VFs, and return "-EOPNOTSUPP" to user space.
====================

Link: https://patch.msgid.link/20260326075233.3628047-1-wei.fang@nxp.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents eeee5a71 a142d139
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -795,9 +795,17 @@ static int enetc_set_rxfh(struct net_device *ndev,
	struct enetc_si *si = priv->si;
	int err = 0;

	if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
	    rxfh->hfunc != ETH_RSS_HASH_TOP)
		return -EOPNOTSUPP;

	/* set hash key, if PF */
	if (rxfh->key && enetc_si_is_pf(si))
	if (rxfh->key) {
		if (!enetc_si_is_pf(si))
			return -EOPNOTSUPP;

		enetc_set_rss_key(si, rxfh->key);
	}

	/* set RSS table */
	if (rxfh->indir)