net/mlx5: Simplify mlx5_sriov_is_enabled() by using pci core API
It is desired to get rid of num_vfs stored inside mlx5_core_sriov to safely support vports more than vfs. To reduce dependency on mlx5_core_sriov num_vfs, start using pci_num_vf() from pci core. Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Bodong Wang <bodong@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
2aca178760
commit
eb5cc431f1
drivers/net/ethernet/mellanox/mlx5/core
@ -111,7 +111,6 @@ void mlx5_sriov_cleanup(struct mlx5_core_dev *dev);
|
|||||||
int mlx5_sriov_attach(struct mlx5_core_dev *dev);
|
int mlx5_sriov_attach(struct mlx5_core_dev *dev);
|
||||||
void mlx5_sriov_detach(struct mlx5_core_dev *dev);
|
void mlx5_sriov_detach(struct mlx5_core_dev *dev);
|
||||||
int mlx5_core_sriov_configure(struct pci_dev *dev, int num_vfs);
|
int mlx5_core_sriov_configure(struct pci_dev *dev, int num_vfs);
|
||||||
bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev);
|
|
||||||
int mlx5_core_enable_hca(struct mlx5_core_dev *dev, u16 func_id);
|
int mlx5_core_enable_hca(struct mlx5_core_dev *dev, u16 func_id);
|
||||||
int mlx5_core_disable_hca(struct mlx5_core_dev *dev, u16 func_id);
|
int mlx5_core_disable_hca(struct mlx5_core_dev *dev, u16 func_id);
|
||||||
int mlx5_create_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
|
int mlx5_create_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
|
||||||
@ -176,6 +175,11 @@ int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw);
|
|||||||
void mlx5e_init(void);
|
void mlx5e_init(void);
|
||||||
void mlx5e_cleanup(void);
|
void mlx5e_cleanup(void);
|
||||||
|
|
||||||
|
static inline bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev)
|
||||||
|
{
|
||||||
|
return pci_num_vf(dev->pdev) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int mlx5_lag_is_lacp_owner(struct mlx5_core_dev *dev)
|
static inline int mlx5_lag_is_lacp_owner(struct mlx5_core_dev *dev)
|
||||||
{
|
{
|
||||||
/* LACP owner conditions:
|
/* LACP owner conditions:
|
||||||
|
@ -36,13 +36,6 @@
|
|||||||
#include "mlx5_core.h"
|
#include "mlx5_core.h"
|
||||||
#include "eswitch.h"
|
#include "eswitch.h"
|
||||||
|
|
||||||
bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev)
|
|
||||||
{
|
|
||||||
struct mlx5_core_sriov *sriov = &dev->priv.sriov;
|
|
||||||
|
|
||||||
return !!sriov->num_vfs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int sriov_restore_guids(struct mlx5_core_dev *dev, int vf)
|
static int sriov_restore_guids(struct mlx5_core_dev *dev, int vf)
|
||||||
{
|
{
|
||||||
struct mlx5_core_sriov *sriov = &dev->priv.sriov;
|
struct mlx5_core_sriov *sriov = &dev->priv.sriov;
|
||||||
|
Loading…
Reference in New Issue
Block a user