diff mbox series

[v2,net] net: stmmac: fix up RX flow hash indirection table when setting channels

Message ID 20230403121120.489138-1-vinschen@redhat.com (mailing list archive)
State Accepted
Commit 218c597325f4faf7b7a6049233a30d7842b5b2dc
Delegated to: Netdev Maintainers
Headers show
Series [v2,net] net: stmmac: fix up RX flow hash indirection table when setting channels | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers fail 2 blamed authors not CCed: davem@davemloft.net boon.leong.ong@intel.com; 8 maintainers not CCed: pabeni@redhat.com boon.leong.ong@intel.com kuba@kernel.org edumazet@google.com linux-stm32@st-md-mailman.stormreply.com linux-arm-kernel@lists.infradead.org mcoquelin.stm32@gmail.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Corinna Vinschen April 3, 2023, 12:11 p.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org April 4, 2023, 1:30 p.m. UTC | #1
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!
diff mbox series

Patch

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);