[PATCH net-next V2 5/7] net/mlx5e: Do not re-apply TIR loopback configuration if not necessary

Tariq Toukan posted 7 patches 3 months, 1 week ago
[PATCH net-next V2 5/7] net/mlx5e: Do not re-apply TIR loopback configuration if not necessary
Posted by Tariq Toukan 3 months, 1 week ago
On old firmware, (tis_tir_td_order=0), TIR of a transport domain should
either be created after all SQs of the same domain, or TIR.self_lb_en
should be reapplied using MODIFY_TIR, for self loopback filtering to
function correctly.

This is not necessary anymnore on new FW (tis_tir_td_order=1), thus
there's no need for calling modify_tir operations after creating a new
set of SQs to maintain the self loopback prevention functional.

Skip these operations.

This saves O(max_num_channels) MODIFY_TIR firmware commands in
operations like interface up or channels configuration change.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
index 022a0cf7063c..5a2ac7b6f260 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
@@ -282,5 +282,8 @@ int mlx5e_modify_tirs_lb(struct mlx5_core_dev *mdev, bool enable_uc_lb,
 int mlx5e_refresh_tirs(struct mlx5_core_dev *mdev, bool enable_uc_lb,
 		       bool enable_mc_lb)
 {
+	if (MLX5_CAP_GEN(mdev, tis_tir_td_order))
+		return 0; /* refresh not needed */
+
 	return mlx5e_modify_tirs_lb(mdev, enable_uc_lb, enable_mc_lb);
 }
-- 
2.31.1
Re: [PATCH net-next V2 5/7] net/mlx5e: Do not re-apply TIR loopback configuration if not necessary
Posted by Simon Horman 3 months, 1 week ago
On Thu, Oct 30, 2025 at 03:32:37PM +0200, Tariq Toukan wrote:
> On old firmware, (tis_tir_td_order=0), TIR of a transport domain should
> either be created after all SQs of the same domain, or TIR.self_lb_en
> should be reapplied using MODIFY_TIR, for self loopback filtering to
> function correctly.
> 
> This is not necessary anymnore on new FW (tis_tir_td_order=1), thus
> there's no need for calling modify_tir operations after creating a new
> set of SQs to maintain the self loopback prevention functional.
> 
> Skip these operations.
> 
> This saves O(max_num_channels) MODIFY_TIR firmware commands in
> operations like interface up or channels configuration change.
> 
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> Reviewed-by: Carolina Jubran <cjubran@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>