diff mbox series

[net-next,05/15] net/mlx5: fs, move hardware fte deletion function reset

Message ID 20240911201757.1505453-6-saeed@kernel.org (mailing list archive)
State Accepted
Commit 940390d976902e184e1186d0f7dab3ba884dec84
Delegated to: Netdev Maintainers
Headers show
Series [net-next,01/15] net/mlx5: HWS, updated API functions comments to kernel doc | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
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 No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
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-09-12--00-00 (tests: 764)

Commit Message

Saeed Mahameed Sept. 11, 2024, 8:17 p.m. UTC
From: Mark Bloch <mbloch@nvidia.com>

Downstream patches will need this as we might not want to reset
it when a pending rule is connected to the FTE.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Keller, Jacob E Sept. 12, 2024, 7:01 p.m. UTC | #1
On 9/11/2024 1:17 PM, Saeed Mahameed wrote:
> From: Mark Bloch <mbloch@nvidia.com>
> 
> Downstream patches will need this as we might not want to reset
> it when a pending rule is connected to the FTE.
> 

At first I didn't quite understand the motivation here but...

> Signed-off-by: Mark Bloch <mbloch@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> index e32725487702..899d91577a54 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> @@ -683,6 +683,8 @@ static void del_hw_fte(struct fs_node *node)
>  				       fte->index, fg->id);
>  		node->active = false;
>  	}
> +	/* Avoid double call to del_hw_fte */
> +	fte->node.del_hw_func = NULL;
>  }
>  
>  static void del_sw_fte(struct fs_node *node)
> @@ -2265,8 +2267,6 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
>  		tree_remove_node(&handle->rule[i]->node, true);
>  	if (list_empty(&fte->node.children)) {
>  		fte->node.del_hw_func(&fte->node);
> -		/* Avoid double call to del_hw_fte */
> -		fte->node.del_hw_func = NULL;

I see. You were previously clearing del_hw_func after calling the
function. Now, it gets cleared by the del_hw_func implementation?

That does feel slightly brittle to me when thinking about this as an
API. On the other hand, it also seems reasonable to ensure that the
function gets cleared whenever you call it since it should only be
called once?

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  		up_write_ref_node(&fte->node, false);
>  		tree_put_node(&fte->node, false);
>  	} else if (fte->dests_size) {
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index e32725487702..899d91577a54 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -683,6 +683,8 @@  static void del_hw_fte(struct fs_node *node)
 				       fte->index, fg->id);
 		node->active = false;
 	}
+	/* Avoid double call to del_hw_fte */
+	fte->node.del_hw_func = NULL;
 }
 
 static void del_sw_fte(struct fs_node *node)
@@ -2265,8 +2267,6 @@  void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
 		tree_remove_node(&handle->rule[i]->node, true);
 	if (list_empty(&fte->node.children)) {
 		fte->node.del_hw_func(&fte->node);
-		/* Avoid double call to del_hw_fte */
-		fte->node.del_hw_func = NULL;
 		up_write_ref_node(&fte->node, false);
 		tree_put_node(&fte->node, false);
 	} else if (fte->dests_size) {