public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: enetc: add more checks to enetc_set_rxfh()
@ 2026-03-25  6:56 Wei Fang
  2026-03-25  6:56 ` [PATCH net 1/2] net: enetc: check whether the RSS algorithm is Toeplitz Wei Fang
  2026-03-25  6:56 ` [PATCH net 2/2] net: enetc: do not allow VF to configure the RSS key Wei Fang
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Fang @ 2026-03-25  6:56 UTC (permalink / raw)
  To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
	davem, edumazet, kuba, pabeni, alexandru.marginean
  Cc: netdev, linux-kernel, imx

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.

Wei Fang (2):
  net: enetc: check whether the RSS algorithm is Toeplitz
  net: enetc: do not allow VF to configure the RSS key

 drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 1/2] net: enetc: check whether the RSS algorithm is Toeplitz
  2026-03-25  6:56 [PATCH net 0/2] net: enetc: add more checks to enetc_set_rxfh() Wei Fang
@ 2026-03-25  6:56 ` Wei Fang
  2026-03-25  7:35   ` Clark Wang
  2026-03-25  6:56 ` [PATCH net 2/2] net: enetc: do not allow VF to configure the RSS key Wei Fang
  1 sibling, 1 reply; 6+ messages in thread
From: Wei Fang @ 2026-03-25  6:56 UTC (permalink / raw)
  To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
	davem, edumazet, kuba, pabeni, alexandru.marginean
  Cc: netdev, linux-kernel, imx

Both ENETC v1 and v4 only provide Toeplitz RSS support. This patch adds
a validation check to reject attempts to configure other RSS algorithms,
avoiding misleading configuration options for users.

Fixes: d382563f541b ("enetc: Add RFS and RSS support")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
index 2fe140ddebb2..a393647e6062 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
@@ -795,6 +795,10 @@ 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))
 		enetc_set_rss_key(si, rxfh->key);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/2] net: enetc: do not allow VF to configure the RSS key
  2026-03-25  6:56 [PATCH net 0/2] net: enetc: add more checks to enetc_set_rxfh() Wei Fang
  2026-03-25  6:56 ` [PATCH net 1/2] net: enetc: check whether the RSS algorithm is Toeplitz Wei Fang
@ 2026-03-25  6:56 ` Wei Fang
  2026-03-25  7:17   ` Clark Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Wei Fang @ 2026-03-25  6:56 UTC (permalink / raw)
  To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
	davem, edumazet, kuba, pabeni, alexandru.marginean
  Cc: netdev, linux-kernel, imx

VFs do not have privilege to configure the RSS key because the registers
are owned by the PF. Currently, if a VF attempts to onfigure the RSS key,
enetc_set_rxfh() simply skips the configuration and does not generate a
warning, which may mislead users into thinking the feature is supported.
To improve this situation, add a check to reject RSS key configuration
on VFs.

Fixes: d382563f541b ("enetc: Add RFS and RSS support")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
index a393647e6062..7c17acaf7a38 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
@@ -800,8 +800,12 @@ static int enetc_set_rxfh(struct net_device *ndev,
 		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)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH net 2/2] net: enetc: do not allow VF to configure the RSS key
  2026-03-25  6:56 ` [PATCH net 2/2] net: enetc: do not allow VF to configure the RSS key Wei Fang
@ 2026-03-25  7:17   ` Clark Wang
  2026-03-25  7:41     ` Wei Fang
  0 siblings, 1 reply; 6+ messages in thread
From: Clark Wang @ 2026-03-25  7:17 UTC (permalink / raw)
  To: Wei Fang, Claudiu Manoil, Vladimir Oltean, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, Alexandru Marginean
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev

> 
> VFs do not have privilege to configure the RSS key because the registers
> are owned by the PF. Currently, if a VF attempts to onfigure the RSS key,
Typo here: onfigure -> configure

> enetc_set_rxfh() simply skips the configuration and does not generate a
> warning, which may mislead users into thinking the feature is supported.
> To improve this situation, add a check to reject RSS key configuration
> on VFs.
> 
> Fixes: d382563f541b ("enetc: Add RFS and RSS support")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>

With the typo fixed, Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net 1/2] net: enetc: check whether the RSS algorithm is Toeplitz
  2026-03-25  6:56 ` [PATCH net 1/2] net: enetc: check whether the RSS algorithm is Toeplitz Wei Fang
@ 2026-03-25  7:35   ` Clark Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Clark Wang @ 2026-03-25  7:35 UTC (permalink / raw)
  To: Wei Fang, Claudiu Manoil, Vladimir Oltean, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, Alexandru Marginean
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev

> Both ENETC v1 and v4 only provide Toeplitz RSS support. This patch adds
> a validation check to reject attempts to configure other RSS algorithms,
> avoiding misleading configuration options for users.
> 
> Fixes: d382563f541b ("enetc: Add RFS and RSS support")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>

Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net 2/2] net: enetc: do not allow VF to configure the RSS key
  2026-03-25  7:17   ` Clark Wang
@ 2026-03-25  7:41     ` Wei Fang
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Fang @ 2026-03-25  7:41 UTC (permalink / raw)
  To: Clark Wang
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, Claudiu Manoil, Vladimir Oltean,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, Alexandru Marginean

> > VFs do not have privilege to configure the RSS key because the
> > registers are owned by the PF. Currently, if a VF attempts to onfigure
> > the RSS key,
> Typo here: onfigure -> configure
> 
> > enetc_set_rxfh() simply skips the configuration and does not generate
> > a warning, which may mislead users into thinking the feature is supported.
> > To improve this situation, add a check to reject RSS key configuration
> > on VFs.
> >
> > Fixes: d382563f541b ("enetc: Add RFS and RSS support")
> > Signed-off-by: Wei Fang <wei.fang@nxp.com>
> 
> With the typo fixed, Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>

Thanks for catching this.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-25  7:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25  6:56 [PATCH net 0/2] net: enetc: add more checks to enetc_set_rxfh() Wei Fang
2026-03-25  6:56 ` [PATCH net 1/2] net: enetc: check whether the RSS algorithm is Toeplitz Wei Fang
2026-03-25  7:35   ` Clark Wang
2026-03-25  6:56 ` [PATCH net 2/2] net: enetc: do not allow VF to configure the RSS key Wei Fang
2026-03-25  7:17   ` Clark Wang
2026-03-25  7:41     ` Wei Fang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox