mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
net/mlx5e: remove channel count limit for XOR8 RSS hash
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 49e6c93870 ("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>
This commit is contained in:
parent
6bbc313bcb
commit
f7c35c6685
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user