diff mbox series

[net,08/10] net/mlx5e: RSS, Unconfigure RXFH after changing channels number

Message ID 20240220032948.35305-3-saeed@kernel.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net,01/10] Revert "net/mlx5: Block entering switchdev mode with ns inconsistency" | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
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: 956 this patch: 956
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 1 blamed authors not CCed: jacob.e.keller@intel.com; 1 maintainers not CCed: jacob.e.keller@intel.com
netdev/build_clang success Errors and warnings before: 973 this patch: 973
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: 973 this patch: 973
netdev/checkpatch warning WARNING: line length of 81 exceeds 80 columns WARNING: line length of 84 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-21--00-00 (tests: 1452)

Commit Message

Saeed Mahameed Feb. 20, 2024, 3:29 a.m. UTC
From: Carolina Jubran <cjubran@nvidia.com>

Changing the channels number after configuring the receive
flow hash indirection table may alter the RSS table size.
The previous configuration may no longer be compatible with
the current receive flow hash indirection table.

Whenever the channels number is modified,
unconfigure the receive flow hash indirection table
and revert it to a uniform table.

Fixes: 74a8dadac17e ("net/mlx5e: Preparations for supporting larger number of channels")
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/en_ethtool.c   | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Feb. 21, 2024, 2:46 a.m. UTC | #1
On Mon, 19 Feb 2024 19:29:46 -0800 Saeed Mahameed wrote:
> +	/* Changing the channels number can affect the size of the RXFH indir table.
> +	 * Therefore, if the RXFH was previously configured,
> +	 * unconfigure it to ensure that the RXFH is reverted to a uniform table.
> +	 */
> +	rxfh_configured = netif_is_rxfh_configured(priv->netdev);
> +	if (rxfh_configured)
> +		priv->netdev->priv_flags &= ~IFF_RXFH_CONFIGURED;

The sole purpose of this flag is to prevent drivers from resetting
configuration set by the user. The user can:

	ethtool -X $ifc default

if they no longer care.
Tariq Toukan Feb. 21, 2024, 7:55 p.m. UTC | #2
On 21/02/2024 4:46, Jakub Kicinski wrote:
> On Mon, 19 Feb 2024 19:29:46 -0800 Saeed Mahameed wrote:
>> +	/* Changing the channels number can affect the size of the RXFH indir table.
>> +	 * Therefore, if the RXFH was previously configured,
>> +	 * unconfigure it to ensure that the RXFH is reverted to a uniform table.
>> +	 */
>> +	rxfh_configured = netif_is_rxfh_configured(priv->netdev);
>> +	if (rxfh_configured)
>> +		priv->netdev->priv_flags &= ~IFF_RXFH_CONFIGURED;
> 
> The sole purpose of this flag is to prevent drivers from resetting
> configuration set by the user. The user can:
> 
> 	ethtool -X $ifc default
> 
> if they no longer care.
> 

Thanks Jakub, somehow I missed this ethtool option.
We will definitely send a modified solution.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index cc51ce16df14..ae459570c9ef 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -435,6 +435,7 @@  int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
 	struct mlx5e_params *cur_params = &priv->channels.params;
 	unsigned int count = ch->combined_count;
 	struct mlx5e_params new_params;
+	bool rxfh_configured;
 	bool arfs_enabled;
 	int rss_cnt;
 	bool opened;
@@ -492,10 +493,25 @@  int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
 	if (arfs_enabled)
 		mlx5e_arfs_disable(priv->fs);
 
+	/* Changing the channels number can affect the size of the RXFH indir table.
+	 * Therefore, if the RXFH was previously configured,
+	 * unconfigure it to ensure that the RXFH is reverted to a uniform table.
+	 */
+	rxfh_configured = netif_is_rxfh_configured(priv->netdev);
+	if (rxfh_configured)
+		priv->netdev->priv_flags &= ~IFF_RXFH_CONFIGURED;
+
 	/* Switch to new channels, set new parameters and close old ones */
 	err = mlx5e_safe_switch_params(priv, &new_params,
 				       mlx5e_num_channels_changed_ctx, NULL, true);
-
+	if (rxfh_configured) {
+		/* Revert the RXFH configured */
+		if (err)
+			priv->netdev->priv_flags |= IFF_RXFH_CONFIGURED;
+		else
+			netdev_warn(priv->netdev, "%s: RXFH table entries reverting to default\n",
+				    __func__);
+	}
 	if (arfs_enabled) {
 		int err2 = mlx5e_arfs_enable(priv->fs);