devx.h (1293B)
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2/* 3 * Copyright (c) 2019-2020, Mellanox Technologies inc. All rights reserved. 4 */ 5 6#ifndef _MLX5_IB_DEVX_H 7#define _MLX5_IB_DEVX_H 8 9#include "mlx5_ib.h" 10 11#define MLX5_MAX_DESTROY_INBOX_SIZE_DW MLX5_ST_SZ_DW(delete_fte_in) 12struct devx_obj { 13 struct mlx5_ib_dev *ib_dev; 14 u64 obj_id; 15 u32 dinlen; /* destroy inbox length */ 16 u32 dinbox[MLX5_MAX_DESTROY_INBOX_SIZE_DW]; 17 u32 flags; 18 union { 19 struct mlx5_ib_mkey mkey; 20 struct mlx5_core_dct core_dct; 21 struct mlx5_core_cq core_cq; 22 u32 flow_counter_bulk_size; 23 }; 24 struct list_head event_sub; /* holds devx_event_subscription entries */ 25}; 26#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) 27int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, bool is_user); 28void mlx5_ib_devx_destroy(struct mlx5_ib_dev *dev, u16 uid); 29int mlx5_ib_devx_init(struct mlx5_ib_dev *dev); 30void mlx5_ib_devx_cleanup(struct mlx5_ib_dev *dev); 31#else 32static inline int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, bool is_user) 33{ 34 return -EOPNOTSUPP; 35} 36static inline void mlx5_ib_devx_destroy(struct mlx5_ib_dev *dev, u16 uid) {} 37static inline int mlx5_ib_devx_init(struct mlx5_ib_dev *dev) 38{ 39 return 0; 40} 41static inline void mlx5_ib_devx_cleanup(struct mlx5_ib_dev *dev) 42{ 43} 44#endif 45#endif /* _MLX5_IB_DEVX_H */