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