netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: fix up RX flow hash indirection table when setting channels
@ 2023-03-31  9:23 Corinna Vinschen
  2023-04-01  4:46 ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2023-03-31  9:23 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev

stmmac_reinit_queues() fails to fix up the RX hash.  Even if the number
of channels gets restricted, the output of `ethtool -x' indicates that
all RX queues are used:

  $ ethtool -l enp0s29f2
  Channel parameters for enp0s29f2:
  Pre-set maximums:
  RX:		8
  TX:		8
  Other:		n/a
  Combined:	n/a
  Current hardware settings:
  RX:		8
  TX:		8
  Other:		n/a
  Combined:	n/a
  $ ethtool -x enp0s29f2
  RX flow hash indirection table for enp0s29f2 with 8 RX ring(s):
      0:      0     1     2     3     4     5     6     7
      8:      0     1     2     3     4     5     6     7
  [...]
  $ ethtool -L enp0s29f2 rx 3
  $ ethtool -x enp0s29f2
  RX flow hash indirection table for enp0s29f2 with 3 RX ring(s):
      0:      0     1     2     3     4     5     6     7
      8:      0     1     2     3     4     5     6     7
  [...]

Fix this by setting the indirection table according to the number
of specified queues.  The result is now as expected:

  $ ethtool -L enp0s29f2 rx 3
  $ ethtool -x enp0s29f2
  RX flow hash indirection table for enp0s29f2 with 3 RX ring(s):
      0:      0     1     2     0     1     2     0     1
      8:      2     0     1     2     0     1     2     0
  [...]

Tested on Intel Elkhart Lake.

Fixes: 0366f7e06a6b ("net: stmmac: add ethtool support for get/set channels")
Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c5e74097d9ab..2218b1882f39 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6948,7 +6948,7 @@ static void stmmac_napi_del(struct net_device *dev)
 int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
-	int ret = 0;
+	int ret = 0, i;
 
 	if (netif_running(dev))
 		stmmac_release(dev);
@@ -6957,6 +6957,8 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
 
 	priv->plat->rx_queues_to_use = rx_cnt;
 	priv->plat->tx_queues_to_use = tx_cnt;
+	for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
+		priv->rss.table[i] = ethtool_rxfh_indir_default(i, rx_cnt);
 
 	stmmac_napi_add(dev);
 
-- 
2.39.2


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

* Re: [PATCH net] net: stmmac: fix up RX flow hash indirection table when setting channels
  2023-03-31  9:23 [PATCH net] net: stmmac: fix up RX flow hash indirection table when setting channels Corinna Vinschen
@ 2023-04-01  4:46 ` Jakub Kicinski
  2023-04-03 12:11   ` [PATCH v2 " Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2023-04-01  4:46 UTC (permalink / raw)
  To: Corinna Vinschen; +Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev

On Fri, 31 Mar 2023 11:23:47 +0200 Corinna Vinschen wrote:
>  	priv->plat->rx_queues_to_use = rx_cnt;
>  	priv->plat->tx_queues_to_use = tx_cnt;
> +	for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
> +		priv->rss.table[i] = ethtool_rxfh_indir_default(i, rx_cnt);

You need to check if (!netif_is_rxfh_configured())
if user set the config to not RSS to all queues we shouldn't reset.

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

* [PATCH v2 net] net: stmmac: fix up RX flow hash indirection table when setting channels
  2023-04-01  4:46 ` Jakub Kicinski
@ 2023-04-03 12:11   ` Corinna Vinschen
  2023-04-04 13:30     ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2023-04-03 12:11 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, netdev

stmmac_reinit_queues() fails to fix up the RX hash.  Even if the number
of channels gets restricted, the output of `ethtool -x' indicates that
all RX queues are used:

  $ ethtool -l enp0s29f2
  Channel parameters for enp0s29f2:
  Pre-set maximums:
  RX:		8
  TX:		8
  Other:		n/a
  Combined:	n/a
  Current hardware settings:
  RX:		8
  TX:		8
  Other:		n/a
  Combined:	n/a
  $ ethtool -x enp0s29f2
  RX flow hash indirection table for enp0s29f2 with 8 RX ring(s):
      0:      0     1     2     3     4     5     6     7
      8:      0     1     2     3     4     5     6     7
  [...]
  $ ethtool -L enp0s29f2 rx 3
  $ ethtool -x enp0s29f2
  RX flow hash indirection table for enp0s29f2 with 3 RX ring(s):
      0:      0     1     2     3     4     5     6     7
      8:      0     1     2     3     4     5     6     7
  [...]

Fix this by setting the indirection table according to the number
of specified queues.  The result is now as expected:

  $ ethtool -L enp0s29f2 rx 3
  $ ethtool -x enp0s29f2
  RX flow hash indirection table for enp0s29f2 with 3 RX ring(s):
      0:      0     1     2     0     1     2     0     1
      8:      2     0     1     2     0     1     2     0
  [...]

Tested on Intel Elkhart Lake.

Fixes: 0366f7e06a6b ("net: stmmac: add ethtool support for get/set channels")
Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c5e74097d9ab..f2eac201174b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6948,7 +6948,7 @@ static void stmmac_napi_del(struct net_device *dev)
 int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
-	int ret = 0;
+	int ret = 0, i;
 
 	if (netif_running(dev))
 		stmmac_release(dev);
@@ -6957,6 +6957,10 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
 
 	priv->plat->rx_queues_to_use = rx_cnt;
 	priv->plat->tx_queues_to_use = tx_cnt;
+	if (!netif_is_rxfh_configured(dev))
+		for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
+			priv->rss.table[i] = ethtool_rxfh_indir_default(i,
+									rx_cnt);
 
 	stmmac_napi_add(dev);
 
-- 
2.39.2


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

* Re: [PATCH v2 net] net: stmmac: fix up RX flow hash indirection table when setting channels
  2023-04-03 12:11   ` [PATCH v2 " Corinna Vinschen
@ 2023-04-04 13:30     ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-04-04 13:30 UTC (permalink / raw)
  To: Corinna Vinschen; +Cc: peppe.cavallaro, alexandre.torgue, joabreu, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Mon,  3 Apr 2023 14:11:20 +0200 you wrote:
> stmmac_reinit_queues() fails to fix up the RX hash.  Even if the number
> of channels gets restricted, the output of `ethtool -x' indicates that
> all RX queues are used:
> 
>   $ ethtool -l enp0s29f2
>   Channel parameters for enp0s29f2:
>   Pre-set maximums:
>   RX:		8
>   TX:		8
>   Other:		n/a
>   Combined:	n/a
>   Current hardware settings:
>   RX:		8
>   TX:		8
>   Other:		n/a
>   Combined:	n/a
>   $ ethtool -x enp0s29f2
>   RX flow hash indirection table for enp0s29f2 with 8 RX ring(s):
>       0:      0     1     2     3     4     5     6     7
>       8:      0     1     2     3     4     5     6     7
>   [...]
>   $ ethtool -L enp0s29f2 rx 3
>   $ ethtool -x enp0s29f2
>   RX flow hash indirection table for enp0s29f2 with 3 RX ring(s):
>       0:      0     1     2     3     4     5     6     7
>       8:      0     1     2     3     4     5     6     7
>   [...]
> 
> [...]

Here is the summary with links:
  - [v2,net] net: stmmac: fix up RX flow hash indirection table when setting channels
    https://git.kernel.org/netdev/net/c/218c597325f4

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-04-04 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-31  9:23 [PATCH net] net: stmmac: fix up RX flow hash indirection table when setting channels Corinna Vinschen
2023-04-01  4:46 ` Jakub Kicinski
2023-04-03 12:11   ` [PATCH v2 " Corinna Vinschen
2023-04-04 13:30     ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).