Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
0002 /*
0003  * Copyright (c) 2019-2020, Mellanox Technologies inc. All rights reserved.
0004  */
0005 
0006 #ifndef _MLX5_IB_DEVX_H
0007 #define _MLX5_IB_DEVX_H
0008 
0009 #include "mlx5_ib.h"
0010 
0011 #define MLX5_MAX_DESTROY_INBOX_SIZE_DW MLX5_ST_SZ_DW(delete_fte_in)
0012 struct devx_obj {
0013     struct mlx5_ib_dev  *ib_dev;
0014     u64         obj_id;
0015     u32         dinlen; /* destroy inbox length */
0016     u32         dinbox[MLX5_MAX_DESTROY_INBOX_SIZE_DW];
0017     u32         flags;
0018     union {
0019         struct mlx5_ib_mkey mkey;
0020         struct mlx5_core_dct    core_dct;
0021         struct mlx5_core_cq core_cq;
0022         u32         flow_counter_bulk_size;
0023     };
0024     struct list_head event_sub; /* holds devx_event_subscription entries */
0025 };
0026 #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
0027 int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, bool is_user);
0028 void mlx5_ib_devx_destroy(struct mlx5_ib_dev *dev, u16 uid);
0029 int mlx5_ib_devx_init(struct mlx5_ib_dev *dev);
0030 void mlx5_ib_devx_cleanup(struct mlx5_ib_dev *dev);
0031 #else
0032 static inline int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, bool is_user)
0033 {
0034     return -EOPNOTSUPP;
0035 }
0036 static inline void mlx5_ib_devx_destroy(struct mlx5_ib_dev *dev, u16 uid) {}
0037 static inline int mlx5_ib_devx_init(struct mlx5_ib_dev *dev)
0038 {
0039     return 0;
0040 }
0041 static inline void mlx5_ib_devx_cleanup(struct mlx5_ib_dev *dev)
0042 {
0043 }
0044 #endif
0045 #endif /* _MLX5_IB_DEVX_H */