net/mlx5: DR, Copy all 64B whenever replacing STE in the head of miss-list
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Tue, 22 Sep 2020 01:24:09 +0000 (04:24 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Sat, 30 Jan 2021 02:12:58 +0000 (18:12 -0800)
Till now the code assumed that need to copy reduced size of the
ste because the rest is the mask part which shouldn't be changed.
This is not true for all types of HW (like STEv1).
Take all 64B from the new STE and write them in the replaced STE place.
This change will make it easier to handle all STE HW types because we have
all the data that is about to be written into HW.

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Signed-off-by: Alex Vesker <valex@nvidia.com>
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.c

index 8ac3ccdda84c67284842b978ac2c9b2154c156ea..9cd5c50c5d42dca310b2db9e1512a912118d14f0 100644 (file)
@@ -211,13 +211,17 @@ dr_ste_remove_head_ste(struct mlx5dr_ste_ctx *ste_ctx,
  * |_ste_| --> |_next_ste_| -->|__| -->|__| -->/0
  */
 static void
-dr_ste_replace_head_ste(struct mlx5dr_ste *ste, struct mlx5dr_ste *next_ste,
+dr_ste_replace_head_ste(struct mlx5dr_matcher_rx_tx *nic_matcher,
+                       struct mlx5dr_ste *ste,
+                       struct mlx5dr_ste *next_ste,
                        struct mlx5dr_ste_send_info *ste_info_head,
                        struct list_head *send_ste_list,
                        struct mlx5dr_ste_htbl *stats_tbl)
 
 {
        struct mlx5dr_ste_htbl *next_miss_htbl;
+       u8 hw_ste[DR_STE_SIZE] = {};
+       int sb_idx;
 
        next_miss_htbl = next_ste->htbl;
 
@@ -230,13 +234,19 @@ dr_ste_replace_head_ste(struct mlx5dr_ste *ste, struct mlx5dr_ste *next_ste,
        /* Move data from next into ste */
        dr_ste_replace(ste, next_ste);
 
+       /* Copy all 64 hw_ste bytes */
+       memcpy(hw_ste, ste->hw_ste, DR_STE_SIZE_REDUCED);
+       sb_idx = ste->ste_chain_location - 1;
+       mlx5dr_ste_set_bit_mask(hw_ste,
+                               nic_matcher->ste_builder[sb_idx].bit_mask);
+
        /* Del the htbl that contains the next_ste.
         * The origin htbl stay with the same number of entries.
         */
        mlx5dr_htbl_put(next_miss_htbl);
 
-       mlx5dr_send_fill_and_append_ste_send_info(ste, DR_STE_SIZE_REDUCED,
-                                                 0, ste->hw_ste,
+       mlx5dr_send_fill_and_append_ste_send_info(ste, DR_STE_SIZE,
+                                                 0, hw_ste,
                                                  ste_info_head,
                                                  send_ste_list,
                                                  true /* Copy data */);
@@ -316,7 +326,8 @@ void mlx5dr_ste_free(struct mlx5dr_ste *ste,
                                               stats_tbl);
                } else {
                        /* First but not only entry in the list */
-                       dr_ste_replace_head_ste(ste, next_ste, &ste_info_head,
+                       dr_ste_replace_head_ste(nic_matcher, ste,
+                                               next_ste, &ste_info_head,
                                                &send_ste_list, stats_tbl);
                        put_on_origin_table = false;
                }