net/mlx5: Return ready to use ASO WQE
authorLeon Romanovsky <leonro@nvidia.com>
Fri, 2 Dec 2022 20:10:22 +0000 (22:10 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 6 Dec 2022 12:49:44 +0000 (13:49 +0100)
There is no need in hiding returned ASO WQE type by providing void*,
use the real type instead. Do it together with zeroing that memory,
so ASO WQE will be ready to use immediately.

Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c
drivers/net/ethernet/mellanox/mlx5/core/lib/aso.c
drivers/net/ethernet/mellanox/mlx5/core/lib/aso.h

index be74e14..25cd449 100644 (file)
@@ -162,7 +162,6 @@ mlx5e_tc_meter_modify(struct mlx5_core_dev *mdev,
                           MLX5_ACCESS_ASO_OPC_MOD_FLOW_METER);
 
        aso_ctrl = &aso_wqe->aso_ctrl;
-       memset(aso_ctrl, 0, sizeof(*aso_ctrl));
        aso_ctrl->data_mask_mode = MLX5_ASO_DATA_MASK_MODE_BYTEWISE_64BYTE << 6;
        aso_ctrl->condition_1_0_operand = MLX5_ASO_ALWAYS_TRUE |
                                          MLX5_ASO_ALWAYS_TRUE << 4;
index 0f9e4f0..5a80fb7 100644 (file)
@@ -353,12 +353,15 @@ void mlx5_aso_build_wqe(struct mlx5_aso *aso, u8 ds_cnt,
        cseg->general_id = cpu_to_be32(obj_id);
 }
 
-void *mlx5_aso_get_wqe(struct mlx5_aso *aso)
+struct mlx5_aso_wqe *mlx5_aso_get_wqe(struct mlx5_aso *aso)
 {
+       struct mlx5_aso_wqe *wqe;
        u16 pi;
 
        pi = mlx5_wq_cyc_ctr2ix(&aso->wq, aso->pc);
-       return mlx5_wq_cyc_get_wqe(&aso->wq, pi);
+       wqe = mlx5_wq_cyc_get_wqe(&aso->wq, pi);
+       memset(wqe, 0, sizeof(*wqe));
+       return wqe;
 }
 
 void mlx5_aso_post_wqe(struct mlx5_aso *aso, bool with_data,
index 2d40dcf..4312614 100644 (file)
@@ -77,7 +77,7 @@ enum {
 
 struct mlx5_aso;
 
-void *mlx5_aso_get_wqe(struct mlx5_aso *aso);
+struct mlx5_aso_wqe *mlx5_aso_get_wqe(struct mlx5_aso *aso);
 void mlx5_aso_build_wqe(struct mlx5_aso *aso, u8 ds_cnt,
                        struct mlx5_aso_wqe *aso_wqe,
                        u32 obj_id, u32 opc_mode);