Skip to content

Commit c8ea212

Browse files
shayshyiSaeed Mahameed
authored andcommitted
net/mlx5: Separate between public and private API of sf.h
Move mlx5_sf_max_functions() and friends from the privete sf/sf.h to the public lib/sf.h. This is done in order to have one direction include paths. Signed-off-by: Shay Drory <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 3af2649 commit c8ea212

File tree

2 files changed

+46
-36
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

2 files changed

+46
-36
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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

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

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,7 @@
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

0 commit comments

Comments
 (0)