Skip to content

Commit 218c597

Browse files
github-cygwinPaolo Abeni
authored andcommitted
net: stmmac: fix up RX flow hash indirection table when setting channels
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: 0366f7e ("net: stmmac: add ethtool support for get/set channels") Signed-off-by: Corinna Vinschen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent c6b486f commit 218c597

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6950,7 +6950,7 @@ static void stmmac_napi_del(struct net_device *dev)
69506950
int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
69516951
{
69526952
struct stmmac_priv *priv = netdev_priv(dev);
6953-
int ret = 0;
6953+
int ret = 0, i;
69546954

69556955
if (netif_running(dev))
69566956
stmmac_release(dev);
@@ -6959,6 +6959,10 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
69596959

69606960
priv->plat->rx_queues_to_use = rx_cnt;
69616961
priv->plat->tx_queues_to_use = tx_cnt;
6962+
if (!netif_is_rxfh_configured(dev))
6963+
for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
6964+
priv->rss.table[i] = ethtool_rxfh_indir_default(i,
6965+
rx_cnt);
69626966

69636967
stmmac_napi_add(dev);
69646968

0 commit comments

Comments
 (0)