]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5e: remove channel count limit for XOR8 RSS hash
authorYael Chemla <ychemla@nvidia.com>
Mon, 11 May 2026 17:27:15 +0000 (20:27 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 14 May 2026 02:10:23 +0000 (19:10 -0700)
mlx5e_ethtool_set_channels() and mlx5e_rxfh_hfunc_check() rejected
channel counts that would produce an indirection table larger than 256
entries when the XOR8 hash function was active. This check was
introduced in commit 49e6c9387051 ("net/mlx5e: RSS, Block XOR hash
with over 128 channels").

XOR8 yields an 8-bit hash, so in practice only up to 256 entries in the
indirection table can be reached due to limited entropy. However, this
does not provide a strong justification for prohibiting larger
indirection tables. Remove the limitation.

Signed-off-by: Yael Chemla <ychemla@nvidia.com>
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260511172719.330490-2-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/rqt.c
drivers/net/ethernet/mellanox/mlx5/core/en/rqt.h
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

index 8d9a3b5ec973b39aaa1addc8f6c5e3a568a7ab1a..bcafb4bf94154ff01969fc851852d4234f5b0c04 100644 (file)
@@ -179,13 +179,6 @@ u32 mlx5e_rqt_size(struct mlx5_core_dev *mdev, unsigned int num_channels)
        return min_t(u32, rqt_size, max_cap_rqt_size);
 }
 
-#define MLX5E_MAX_RQT_SIZE_ALLOWED_WITH_XOR8_HASH 256
-
-unsigned int mlx5e_rqt_max_num_channels_allowed_for_xor8(void)
-{
-       return MLX5E_MAX_RQT_SIZE_ALLOWED_WITH_XOR8_HASH / MLX5E_UNIFORM_SPREAD_RQT_FACTOR;
-}
-
 void mlx5e_rqt_destroy(struct mlx5e_rqt *rqt)
 {
        mlx5_core_destroy_rqt(rqt->mdev, rqt->rqtn);
index 2f9e04a8418f143fbf3d01423721d85b2d5b5a2a..e0bc30308c77000038d151a7caa206c516a6fe9a 100644 (file)
@@ -38,7 +38,6 @@ static inline u32 mlx5e_rqt_get_rqtn(struct mlx5e_rqt *rqt)
 }
 
 u32 mlx5e_rqt_size(struct mlx5_core_dev *mdev, unsigned int num_channels);
-unsigned int mlx5e_rqt_max_num_channels_allowed_for_xor8(void);
 int mlx5e_rqt_redirect_direct(struct mlx5e_rqt *rqt, u32 rqn, u32 *vhca_id);
 int mlx5e_rqt_redirect_indir(struct mlx5e_rqt *rqt, u32 *rqns, u32 *vhca_ids,
                             unsigned int num_rqns,
index bb61e217907888a4e3c1ffd5aba99bfe727165b0..a6da0219723c4f4f24f2c3faf7ef69bcc3f1f8ec 100644 (file)
@@ -511,17 +511,6 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
 
        mutex_lock(&priv->state_lock);
 
-       if (mlx5e_rx_res_get_current_hash(priv->rx_res).hfunc == ETH_RSS_HASH_XOR) {
-               unsigned int xor8_max_channels = mlx5e_rqt_max_num_channels_allowed_for_xor8();
-
-               if (count > xor8_max_channels) {
-                       err = -EINVAL;
-                       netdev_err(priv->netdev, "%s: Requested number of channels (%d) exceeds the maximum allowed by the XOR8 RSS hfunc (%d)\n",
-                                  __func__, count, xor8_max_channels);
-                       goto out;
-               }
-       }
-
        /* If RXFH is configured, changing the channels number is allowed only if
         * it does not require resizing the RSS table. This is because the previous
         * configuration may no longer be compatible with the new RSS table.
@@ -1501,29 +1490,6 @@ static int mlx5e_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *
        return 0;
 }
 
-static int mlx5e_rxfh_hfunc_check(struct mlx5e_priv *priv,
-                                 const struct ethtool_rxfh_param *rxfh,
-                                 struct netlink_ext_ack *extack)
-{
-       unsigned int count;
-
-       count = priv->channels.params.num_channels;
-
-       if (rxfh->hfunc == ETH_RSS_HASH_XOR) {
-               unsigned int xor8_max_channels = mlx5e_rqt_max_num_channels_allowed_for_xor8();
-
-               if (count > xor8_max_channels) {
-                       NL_SET_ERR_MSG_FMT_MOD(
-                               extack,
-                               "Number of channels (%u) exceeds the max for XOR8 RSS (%u)",
-                               count, xor8_max_channels);
-                       return -EINVAL;
-               }
-       }
-
-       return 0;
-}
-
 static int mlx5e_set_rxfh(struct net_device *dev,
                          struct ethtool_rxfh_param *rxfh,
                          struct netlink_ext_ack *extack)
@@ -1535,16 +1501,11 @@ static int mlx5e_set_rxfh(struct net_device *dev,
 
        mutex_lock(&priv->state_lock);
 
-       err = mlx5e_rxfh_hfunc_check(priv, rxfh, extack);
-       if (err)
-               goto unlock;
-
        err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, rxfh->rss_context,
                                        rxfh->indir, rxfh->key,
                                        hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc,
                                        rxfh->input_xfrm == RXH_XFRM_NO_CHANGE ? NULL : &symmetric);
 
-unlock:
        mutex_unlock(&priv->state_lock);
        return err;
 }
@@ -1561,10 +1522,6 @@ static int mlx5e_create_rxfh_context(struct net_device *dev,
 
        mutex_lock(&priv->state_lock);
 
-       err = mlx5e_rxfh_hfunc_check(priv, rxfh, extack);
-       if (err)
-               goto unlock;
-
        err = mlx5e_rx_res_rss_init(priv->rx_res, rxfh->rss_context,
                                    priv->channels.params.num_channels);
        if (err)
@@ -1601,16 +1558,11 @@ static int mlx5e_modify_rxfh_context(struct net_device *dev,
 
        mutex_lock(&priv->state_lock);
 
-       err = mlx5e_rxfh_hfunc_check(priv, rxfh, extack);
-       if (err)
-               goto unlock;
-
        err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, rxfh->rss_context,
                                        rxfh->indir, rxfh->key,
                                        hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc,
                                        rxfh->input_xfrm == RXH_XFRM_NO_CHANGE ? NULL : &symmetric);
 
-unlock:
        mutex_unlock(&priv->state_lock);
        return err;
 }