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
13struct 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
22struct mlx5_sf_peer_devlink_event_ctx {
23 u16 fn_id;
24 struct devlink *devlink;
25 int err;
26};
27
28void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev);
29void mlx5_sf_dev_table_destroy(struct mlx5_core_dev *dev);
30
31int mlx5_sf_driver_register(void);
32void mlx5_sf_driver_unregister(void);
33
34bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev);
35
36#else
37
38static inline void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev)
39{
40}
41
42static inline void mlx5_sf_dev_table_destroy(struct mlx5_core_dev *dev)
43{
44}
45
46static inline int mlx5_sf_driver_register(void)
47{
48 return 0;
49}
50
51static inline void mlx5_sf_driver_unregister(void)
52{
53}
54
55static inline bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev)
56{
57 return false;
58}
59
60#endif
61
62#endif
63

source code of linux/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.h