File tree Expand file tree Collapse file tree 2 files changed +46
-36
lines changed
drivers/net/ethernet/mellanox/mlx5/core Expand file tree Collapse file tree 2 files changed +46
-36
lines changed Original file line number Diff line number Diff line change 1+ /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2+ /* Copyright (c) 2021 Mellanox Technologies Ltd */
3+
4+ #ifndef __LIB_MLX5_SF_H__
5+ #define __LIB_MLX5_SF_H__
6+
7+ #include <linux/mlx5/driver.h>
8+
9+ static inline u16 mlx5_sf_start_function_id (const struct mlx5_core_dev * dev )
10+ {
11+ return MLX5_CAP_GEN (dev , sf_base_id );
12+ }
13+
14+ #ifdef CONFIG_MLX5_SF
15+
16+ static inline bool mlx5_sf_supported (const struct mlx5_core_dev * dev )
17+ {
18+ return MLX5_CAP_GEN (dev , sf );
19+ }
20+
21+ static inline u16 mlx5_sf_max_functions (const struct mlx5_core_dev * dev )
22+ {
23+ if (!mlx5_sf_supported (dev ))
24+ return 0 ;
25+ if (MLX5_CAP_GEN (dev , max_num_sf ))
26+ return MLX5_CAP_GEN (dev , max_num_sf );
27+ else
28+ return 1 << MLX5_CAP_GEN (dev , log_max_sf );
29+ }
30+
31+ #else
32+
33+ static inline bool mlx5_sf_supported (const struct mlx5_core_dev * dev )
34+ {
35+ return false;
36+ }
37+
38+ static inline u16 mlx5_sf_max_functions (const struct mlx5_core_dev * dev )
39+ {
40+ return 0 ;
41+ }
42+
43+ #endif
44+
45+ #endif
Original file line number Diff line number Diff line change 55#define __MLX5_SF_H__
66
77#include <linux/mlx5/driver.h>
8-
9- static inline u16 mlx5_sf_start_function_id (const struct mlx5_core_dev * dev )
10- {
11- return MLX5_CAP_GEN (dev , sf_base_id );
12- }
13-
14- #ifdef CONFIG_MLX5_SF
15-
16- static inline bool mlx5_sf_supported (const struct mlx5_core_dev * dev )
17- {
18- return MLX5_CAP_GEN (dev , sf );
19- }
20-
21- static inline u16 mlx5_sf_max_functions (const struct mlx5_core_dev * dev )
22- {
23- if (!mlx5_sf_supported (dev ))
24- return 0 ;
25- if (MLX5_CAP_GEN (dev , max_num_sf ))
26- return MLX5_CAP_GEN (dev , max_num_sf );
27- else
28- return 1 << MLX5_CAP_GEN (dev , log_max_sf );
29- }
30-
31- #else
32-
33- static inline bool mlx5_sf_supported (const struct mlx5_core_dev * dev )
34- {
35- return false;
36- }
37-
38- static inline u16 mlx5_sf_max_functions (const struct mlx5_core_dev * dev )
39- {
40- return 0 ;
41- }
42-
43- #endif
8+ #include "lib/sf.h"
449
4510#ifdef CONFIG_MLX5_SF_MANAGER
4611
You can’t perform that action at this time.
0 commit comments