net/mlx5e: TC, Destroy nic flow counter if exists
authorRoi Dayan <roid@nvidia.com>
Mon, 1 Nov 2021 16:02:00 +0000 (18:02 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 17 Nov 2021 04:31:49 +0000 (20:31 -0800)
Counter is only added if counter flag exists.
So check the counter fag exists for deleting the counter.
This is the same as in add/del fdb flow.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

index e620100eabe001959d8f7ac5d8adf135f1458a5d..3e542b030fc12231eee1359410ceb60bf5142321 100644 (file)
@@ -1133,7 +1133,8 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
        if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
                mlx5e_detach_mod_hdr(priv, flow);
 
-       mlx5_fc_destroy(priv->mdev, attr->counter);
+       if (attr->action & MLX5_FLOW_CONTEXT_ACTION_COUNT)
+               mlx5_fc_destroy(priv->mdev, attr->counter);
 
        if (flow_flag_test(flow, HAIRPIN))
                mlx5e_hairpin_flow_del(priv, flow);