LCOV - code coverage report
Current view: top level - drivers/net/mlx5/hws - mlx5dr_matcher.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 4 0.0 %
Date: 2024-01-22 16:13:49 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 38 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright (c) 2022 NVIDIA Corporation & Affiliates
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef MLX5DR_MATCHER_H_
       6                 :            : #define MLX5DR_MATCHER_H_
       7                 :            : 
       8                 :            : /* Max supported match template */
       9                 :            : #define MLX5DR_MATCHER_MAX_MT_ROOT 1
      10                 :            : 
      11                 :            : /* We calculated that concatenating a collision table to the main table with
      12                 :            :  * 3% of the main table rows will be enough resources for high insertion
      13                 :            :  * success probability.
      14                 :            :  *
      15                 :            :  * The calculation: log2(2^x * 3 / 100) = log2(2^x) + log2(3/100) = x - 5.05 ~ 5
      16                 :            :  */
      17                 :            : #define MLX5DR_MATCHER_ASSURED_ROW_RATIO 5
      18                 :            : /* Thrashold to determine if amount of rules require a collision table */
      19                 :            : #define MLX5DR_MATCHER_ASSURED_RULES_TH 10
      20                 :            : /* Required depth of an assured collision table */
      21                 :            : #define MLX5DR_MATCHER_ASSURED_COL_TBL_DEPTH 4
      22                 :            : /* Required depth of the main large table */
      23                 :            : #define MLX5DR_MATCHER_ASSURED_MAIN_TBL_DEPTH 2
      24                 :            : 
      25                 :            : enum mlx5dr_matcher_flags {
      26                 :            :         MLX5DR_MATCHER_FLAGS_RANGE_DEFINER      = 1 << 0,
      27                 :            :         MLX5DR_MATCHER_FLAGS_HASH_DEFINER       = 1 << 1,
      28                 :            :         MLX5DR_MATCHER_FLAGS_COLLISION          = 1 << 2,
      29                 :            : };
      30                 :            : 
      31                 :            : struct mlx5dr_match_template {
      32                 :            :         struct rte_flow_item *items;
      33                 :            :         struct mlx5dr_definer *definer;
      34                 :            :         struct mlx5dr_definer *range_definer;
      35                 :            :         struct mlx5dr_definer_fc *fc;
      36                 :            :         struct mlx5dr_definer_fc *fcr;
      37                 :            :         uint16_t fc_sz;
      38                 :            :         uint16_t fcr_sz;
      39                 :            :         uint64_t item_flags;
      40                 :            :         uint8_t vport_item_id;
      41                 :            :         enum mlx5dr_match_template_flags flags;
      42                 :            : };
      43                 :            : 
      44                 :            : struct mlx5dr_matcher_match_ste {
      45                 :            :         struct mlx5dr_pool_chunk ste;
      46                 :            :         struct mlx5dr_devx_obj *rtc_0;
      47                 :            :         struct mlx5dr_devx_obj *rtc_1;
      48                 :            :         struct mlx5dr_pool *pool;
      49                 :            :         /* Currently not support FDB aliased */
      50                 :            :         struct mlx5dr_devx_obj *aliased_rtc_0;
      51                 :            : };
      52                 :            : 
      53                 :            : struct mlx5dr_matcher_action_ste {
      54                 :            :         struct mlx5dr_pool_chunk ste;
      55                 :            :         struct mlx5dr_pool_chunk stc;
      56                 :            :         struct mlx5dr_devx_obj *rtc_0;
      57                 :            :         struct mlx5dr_devx_obj *rtc_1;
      58                 :            :         struct mlx5dr_pool *pool;
      59                 :            :         uint8_t max_stes;
      60                 :            : };
      61                 :            : 
      62                 :            : struct mlx5dr_matcher {
      63                 :            :         struct mlx5dr_table *tbl;
      64                 :            :         struct mlx5dr_matcher_attr attr;
      65                 :            :         struct mlx5dv_flow_matcher *dv_matcher;
      66                 :            :         struct mlx5dr_match_template *mt;
      67                 :            :         uint8_t num_of_mt;
      68                 :            :         struct mlx5dr_action_template *at;
      69                 :            :         uint8_t num_of_at;
      70                 :            :         /* enum mlx5dr_matcher_flags */
      71                 :            :         uint8_t flags;
      72                 :            :         struct mlx5dr_devx_obj *end_ft;
      73                 :            :         struct mlx5dr_matcher *col_matcher;
      74                 :            :         struct mlx5dr_matcher_match_ste match_ste;
      75                 :            :         struct mlx5dr_matcher_action_ste action_ste;
      76                 :            :         struct mlx5dr_definer *hash_definer;
      77                 :            :         LIST_ENTRY(mlx5dr_matcher) next;
      78                 :            : };
      79                 :            : 
      80                 :            : static inline bool
      81                 :            : mlx5dr_matcher_mt_is_jumbo(struct mlx5dr_match_template *mt)
      82                 :            : {
      83   [ #  #  #  #  :          0 :         return mlx5dr_definer_is_jumbo(mt->definer);
                   #  # ]
      84                 :            : }
      85                 :            : 
      86                 :            : static inline bool
      87                 :            : mlx5dr_matcher_mt_is_range(struct mlx5dr_match_template *mt)
      88                 :            : {
      89   [ #  #  #  # ]:          0 :         return (!!mt->range_definer);
      90                 :            : }
      91                 :            : 
      92                 :            : static inline bool mlx5dr_matcher_req_fw_wqe(struct mlx5dr_matcher *matcher)
      93                 :            : {
      94                 :            :         /* Currently HWS doesn't support hash different from match or range */
      95   [ #  #  #  #  :          0 :         return unlikely(matcher->flags &
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
      96                 :            :                         (MLX5DR_MATCHER_FLAGS_HASH_DEFINER |
      97                 :            :                          MLX5DR_MATCHER_FLAGS_RANGE_DEFINER));
      98                 :            : }
      99                 :            : 
     100                 :            : int mlx5dr_matcher_conv_items_to_prm(uint64_t *match_buf,
     101                 :            :                                      struct rte_flow_item *items,
     102                 :            :                                      uint8_t *match_criteria,
     103                 :            :                                      bool is_value);
     104                 :            : 
     105                 :            : int mlx5dr_matcher_create_aliased_obj(struct mlx5dr_context *ctx,
     106                 :            :                                       struct ibv_context *ibv_owner,
     107                 :            :                                       struct ibv_context *ibv_allowed,
     108                 :            :                                       uint16_t vhca_id_to_be_accessed,
     109                 :            :                                       uint32_t aliased_object_id,
     110                 :            :                                       uint16_t object_type,
     111                 :            :                                       struct mlx5dr_devx_obj **obj);
     112                 :            : 
     113                 :            : static inline bool mlx5dr_matcher_is_insert_by_idx(struct mlx5dr_matcher *matcher)
     114                 :            : {
     115   [ #  #  #  #  :          0 :         return matcher->attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX;
          #  #  #  #  #  
                #  #  # ]
     116                 :            : }
     117                 :            : 
     118                 :            : int mlx5dr_matcher_free_rtc_pointing(struct mlx5dr_context *ctx,
     119                 :            :                                      uint32_t fw_ft_type,
     120                 :            :                                      enum mlx5dr_table_type type,
     121                 :            :                                      struct mlx5dr_devx_obj *devx_obj);
     122                 :            : 
     123                 :            : #endif /* MLX5DR_MATCHER_H_ */

Generated by: LCOV version 1.14