net/mlx5: DR, init_next_match only if needed
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Sun, 19 Sep 2021 15:48:07 +0000 (18:48 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 30 Sep 2021 23:19:00 +0000 (16:19 -0700)
Allocate next steering table entry only if the remaining space requires to.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c

index 3497c2c..cb9cf67 100644 (file)
@@ -586,9 +586,11 @@ static void dr_ste_v1_set_actions_tx(struct mlx5dr_domain *dmn,
        } else if (action_type_set[DR_ACTION_TYP_L2_TO_TNL_L3]) {
                u8 *d_action;
 
-               dr_ste_v1_arr_init_next_match(&last_ste, added_stes, attr->gvmi);
-               action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
-               action_sz = DR_STE_ACTION_TRIPLE_SZ;
+               if (action_sz < DR_STE_ACTION_TRIPLE_SZ) {
+                       dr_ste_v1_arr_init_next_match(&last_ste, added_stes, attr->gvmi);
+                       action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
+                       action_sz = DR_STE_ACTION_TRIPLE_SZ;
+               }
                d_action = action + DR_STE_ACTION_SINGLE_SZ;
 
                dr_ste_v1_set_encap_l3(last_ste,