Skip to content

Commit 1d3398f

Browse files
Gal PressmanSaeed Mahameed
authored andcommitted
net/mlx5e: Modify TIRs hash only when it's needed
We don't need to modify our TIRs unless the user requested a change in the hash function/key, for example when changing indirection only. Tested: # Modify TIRs hash is needed ethtool -X ethX hkey <new key> ethtool -X ethX hfunc <new func> # Modify TIRs hash is not needed ethtool -X ethX equal <new indirection table> All cases are verified with TCP Multi-Stream traffic over IPv4 & IPv6. Fixes: bdfc028 ("net/mlx5e: Fix ethtool RX hash func configuration change") Signed-off-by: Gal Pressman <galp@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent 3e621b1 commit 1d3398f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,7 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
996996
{
997997
struct mlx5e_priv *priv = netdev_priv(dev);
998998
int inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
999+
bool hash_changed = false;
9991000
void *in;
10001001

10011002
if ((hfunc != ETH_RSS_HASH_NO_CHANGE) &&
@@ -1017,14 +1018,21 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
10171018
mlx5e_redirect_rqt(priv, rqtn, MLX5E_INDIR_RQT_SIZE, 0);
10181019
}
10191020

1020-
if (key)
1021+
if (hfunc != ETH_RSS_HASH_NO_CHANGE &&
1022+
hfunc != priv->params.rss_hfunc) {
1023+
priv->params.rss_hfunc = hfunc;
1024+
hash_changed = true;
1025+
}
1026+
1027+
if (key) {
10211028
memcpy(priv->params.toeplitz_hash_key, key,
10221029
sizeof(priv->params.toeplitz_hash_key));
1030+
hash_changed = hash_changed ||
1031+
priv->params.rss_hfunc == ETH_RSS_HASH_TOP;
1032+
}
10231033

1024-
if (hfunc != ETH_RSS_HASH_NO_CHANGE)
1025-
priv->params.rss_hfunc = hfunc;
1026-
1027-
mlx5e_modify_tirs_hash(priv, in, inlen);
1034+
if (hash_changed)
1035+
mlx5e_modify_tirs_hash(priv, in, inlen);
10281036

10291037
mutex_unlock(&priv->state_lock);
10301038

0 commit comments

Comments
 (0)