LCOV - code coverage report
Current view: top level - drivers/net/mlx5/hws - mlx5dr_context.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 4 0.0 %
Date: 2024-12-01 18:57:19 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 26 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_CONTEXT_H_
       6                 :            : #define MLX5DR_CONTEXT_H_
       7                 :            : 
       8                 :            : enum mlx5dr_context_flags {
       9                 :            :         MLX5DR_CONTEXT_FLAG_HWS_SUPPORT = 1 << 0,
      10                 :            :         MLX5DR_CONTEXT_FLAG_PRIVATE_PD = 1 << 1,
      11                 :            :         MLX5DR_CONTEXT_FLAG_BWC_SUPPORT = 1 << 2,
      12                 :            : };
      13                 :            : 
      14                 :            : enum mlx5dr_context_shared_stc_type {
      15                 :            :         MLX5DR_CONTEXT_SHARED_STC_DECAP_L3 = 0,
      16                 :            :         MLX5DR_CONTEXT_SHARED_STC_DOUBLE_POP = 1,
      17                 :            :         MLX5DR_CONTEXT_SHARED_STC_MAX = 2,
      18                 :            : };
      19                 :            : 
      20                 :            : struct mlx5dr_context_common_res {
      21                 :            :         struct mlx5dr_action_default_stc *default_stc;
      22                 :            :         struct mlx5dr_action_shared_stc *shared_stc[MLX5DR_CONTEXT_SHARED_STC_MAX];
      23                 :            :         struct mlx5dr_cmd_forward_tbl *default_miss;
      24                 :            : };
      25                 :            : 
      26                 :            : struct mlx5dr_context_shared_gvmi_res {
      27                 :            :         struct mlx5dr_devx_obj *end_ft;
      28                 :            :         struct mlx5dr_devx_obj *aliased_end_ft;
      29                 :            :         uint32_t refcount;
      30                 :            : };
      31                 :            : 
      32                 :            : struct mlx5dr_context {
      33                 :            :         struct ibv_context *ibv_ctx;
      34                 :            :         /* When local_ibv_ctx is not NULL means we are using shared_ibv for resources */
      35                 :            :         struct ibv_context *local_ibv_ctx;
      36                 :            :         struct mlx5dr_cmd_query_caps *caps;
      37                 :            :         struct ibv_pd *pd;
      38                 :            :         uint32_t pd_num;
      39                 :            :         struct mlx5dr_pool *stc_pool[MLX5DR_TABLE_TYPE_MAX];
      40                 :            :         struct mlx5dr_context_common_res common_res[MLX5DR_TABLE_TYPE_MAX];
      41                 :            :         struct mlx5dr_context_shared_gvmi_res gvmi_res[MLX5DR_TABLE_TYPE_MAX];
      42                 :            :         struct mlx5dr_pattern_cache *pattern_cache;
      43                 :            :         struct mlx5dr_definer_cache *definer_cache;
      44                 :            :         pthread_spinlock_t ctrl_lock;
      45                 :            :         enum mlx5dr_context_flags flags;
      46                 :            :         struct mlx5dr_send_engine *send_queue;
      47                 :            :         size_t queues;
      48                 :            :         rte_spinlock_t *bwc_send_queue_locks;
      49                 :            :         LIST_HEAD(table_head, mlx5dr_table) head;
      50                 :            : };
      51                 :            : 
      52                 :            : static inline bool mlx5dr_context_shared_gvmi_used(struct mlx5dr_context *ctx)
      53                 :            : {
      54   [ #  #  #  #  :          0 :         return ctx->local_ibv_ctx ? true : false;
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
      55                 :            : }
      56                 :            : 
      57                 :            : static inline bool mlx5dr_context_bwc_supported(struct mlx5dr_context *ctx)
      58                 :            : {
      59   [ #  #  #  #  :          0 :         return ctx->flags & MLX5DR_CONTEXT_FLAG_BWC_SUPPORT;
                   #  # ]
      60                 :            : }
      61                 :            : 
      62                 :            : static inline struct ibv_context *
      63                 :            : mlx5dr_context_get_local_ibv(struct mlx5dr_context *ctx)
      64                 :            : {
      65   [ #  #  #  # ]:          0 :         if (mlx5dr_context_shared_gvmi_used(ctx))
      66                 :            :                 return ctx->local_ibv_ctx;
      67                 :            : 
      68                 :          0 :         return ctx->ibv_ctx;
      69                 :            : }
      70                 :            : 
      71                 :            : bool mlx5dr_context_cap_dynamic_reparse(struct mlx5dr_context *ctx);
      72                 :            : 
      73                 :            : uint8_t mlx5dr_context_get_reparse_mode(struct mlx5dr_context *ctx);
      74                 :            : 
      75                 :            : #endif /* MLX5DR_CONTEXT_H_ */

Generated by: LCOV version 1.14