net/mlx5: Use shared code for checking lag is supported
Move shared function to check lag is supported to lag header file. Signed-off-by: Roi Dayan <roid@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
9d0cd5d25f
commit
02ceda65f0
|
@ -36,6 +36,7 @@
|
|||
#include <linux/mlx5/vport.h>
|
||||
#include "mlx5_core.h"
|
||||
#include "devlink.h"
|
||||
#include "lag/lag.h"
|
||||
|
||||
/* intf dev list mutex */
|
||||
static DEFINE_MUTEX(mlx5_intf_mutex);
|
||||
|
@ -587,10 +588,7 @@ static int next_phys_dev_lag(struct device *dev, const void *data)
|
|||
if (!mdev)
|
||||
return 0;
|
||||
|
||||
if (!MLX5_CAP_GEN(mdev, vport_group_manager) ||
|
||||
!MLX5_CAP_GEN(mdev, lag_master) ||
|
||||
(MLX5_CAP_GEN(mdev, num_lag_ports) > MLX5_MAX_PORTS ||
|
||||
MLX5_CAP_GEN(mdev, num_lag_ports) <= 1))
|
||||
if (!mlx5_lag_is_supported(mdev))
|
||||
return 0;
|
||||
|
||||
return _next_phys_dev(mdev, data);
|
||||
|
|
|
@ -1268,16 +1268,6 @@ recheck:
|
|||
mlx5_ldev_put(ldev);
|
||||
}
|
||||
|
||||
bool mlx5_lag_is_supported(struct mlx5_core_dev *dev)
|
||||
{
|
||||
if (!MLX5_CAP_GEN(dev, vport_group_manager) ||
|
||||
!MLX5_CAP_GEN(dev, lag_master) ||
|
||||
MLX5_CAP_GEN(dev, num_lag_ports) < 2 ||
|
||||
MLX5_CAP_GEN(dev, num_lag_ports) > MLX5_MAX_PORTS)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void mlx5_lag_add_mdev(struct mlx5_core_dev *dev)
|
||||
{
|
||||
int err;
|
||||
|
|
|
@ -74,8 +74,6 @@ struct mlx5_lag {
|
|||
struct lag_mpesw lag_mpesw;
|
||||
};
|
||||
|
||||
bool mlx5_lag_is_supported(struct mlx5_core_dev *dev);
|
||||
|
||||
static inline struct mlx5_lag *
|
||||
mlx5_lag_dev(struct mlx5_core_dev *dev)
|
||||
{
|
||||
|
@ -115,4 +113,14 @@ void mlx5_lag_remove_devices(struct mlx5_lag *ldev);
|
|||
int mlx5_deactivate_lag(struct mlx5_lag *ldev);
|
||||
void mlx5_lag_add_devices(struct mlx5_lag *ldev);
|
||||
|
||||
static inline bool mlx5_lag_is_supported(struct mlx5_core_dev *dev)
|
||||
{
|
||||
if (!MLX5_CAP_GEN(dev, vport_group_manager) ||
|
||||
!MLX5_CAP_GEN(dev, lag_master) ||
|
||||
MLX5_CAP_GEN(dev, num_lag_ports) < 2 ||
|
||||
MLX5_CAP_GEN(dev, num_lag_ports) > MLX5_MAX_PORTS)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* __MLX5_LAG_H__ */
|
||||
|
|
Loading…
Reference in New Issue