Debian Codegraph @

drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.h

raw
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2020 Mellanox Technologies Ltd */
3
4 #ifndef __MLX5_SF_DEV_H__
5 #define __MLX5_SF_DEV_H__
6
7 #ifdef CONFIG_MLX5_SF
8
9 #include <linux/auxiliary_bus.h>
10
11 #define MLX5_SF_DEV_ID_NAME "sf"
12
13 struct mlx5_sf_dev {
14 struct auxiliary_device adev;
15 struct mlx5_core_dev *parent_mdev;
16 struct mlx5_core_dev *mdev;
17 phys_addr_t bar_base_addr;
18 u32 sfnum;
19 u16 fn_id;
20 };
21
22 struct mlx5_sf_peer_devlink_event_ctx {
23 u16 fn_id;
24 struct devlink *devlink;
25 int err;
26 };
27
28 int mlx5_sf_dev_notifier_init(struct mlx5_core_dev *dev);
29 void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev);
30 void mlx5_sf_dev_notifier_cleanup(struct mlx5_core_dev *dev);
31 void mlx5_sf_dev_table_destroy(struct mlx5_core_dev *dev);
32
33 int mlx5_sf_driver_register(void);
34 void mlx5_sf_driver_unregister(void);
35
36 bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev);
37
38 #else
39
40 static inline int mlx5_sf_dev_notifier_init(struct mlx5_core_dev *dev)
41 {
42 return 0;
43 }
44
45 static inline void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev)
46 {
47 }
48
49 static inline void mlx5_sf_dev_notifier_cleanup(struct mlx5_core_dev *dev)
50 {
51 }
52
53 static inline void mlx5_sf_dev_table_destroy(struct mlx5_core_dev *dev)
54 {
55 }
56
57 static inline int mlx5_sf_driver_register(void)
58 {
59 return 0;
60 }
61
62 static inline void mlx5_sf_driver_unregister(void)
63 {
64 }
65
66 static inline bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev)
67 {
68 return false;
69 }
70
71 #endif
72
73 #endif