-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <shayd@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
- Loading branch information
Shay Drory
authored and
Saeed Mahameed
committed
Jun 15, 2021
1 parent
3af2649
commit c8ea212
Showing
2 changed files
with
46 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
/* Copyright (c) 2021 Mellanox Technologies Ltd */ | ||
|
||
#ifndef __LIB_MLX5_SF_H__ | ||
#define __LIB_MLX5_SF_H__ | ||
|
||
#include <linux/mlx5/driver.h> | ||
|
||
static inline u16 mlx5_sf_start_function_id(const struct mlx5_core_dev *dev) | ||
{ | ||
return MLX5_CAP_GEN(dev, sf_base_id); | ||
} | ||
|
||
#ifdef CONFIG_MLX5_SF | ||
|
||
static inline bool mlx5_sf_supported(const struct mlx5_core_dev *dev) | ||
{ | ||
return MLX5_CAP_GEN(dev, sf); | ||
} | ||
|
||
static inline u16 mlx5_sf_max_functions(const struct mlx5_core_dev *dev) | ||
{ | ||
if (!mlx5_sf_supported(dev)) | ||
return 0; | ||
if (MLX5_CAP_GEN(dev, max_num_sf)) | ||
return MLX5_CAP_GEN(dev, max_num_sf); | ||
else | ||
return 1 << MLX5_CAP_GEN(dev, log_max_sf); | ||
} | ||
|
||
#else | ||
|
||
static inline bool mlx5_sf_supported(const struct mlx5_core_dev *dev) | ||
{ | ||
return false; | ||
} | ||
|
||
static inline u16 mlx5_sf_max_functions(const struct mlx5_core_dev *dev) | ||
{ | ||
return 0; | ||
} | ||
|
||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters