Commit e8711402 authored by Leon Romanovsky's avatar Leon Romanovsky
Browse files

net/mlx5: Simplify eswitch mode check



Provide mlx5_core device instead of "priv" pointer while checking
eswith mode.

Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
parent 601c10c8
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -138,13 +138,6 @@ static int mlx5_ib_create_counters(struct ib_counters *counters,
}


static bool is_mdev_switchdev_mode(const struct mlx5_core_dev *mdev)
{
	return MLX5_ESWITCH_MANAGER(mdev) &&
	       mlx5_ib_eswitch_mode(mdev->priv.eswitch) ==
		       MLX5_ESWITCH_OFFLOADS;
}

static const struct mlx5_ib_counters *get_counters(struct mlx5_ib_dev *dev,
						   u8 port_num)
{
+0 −5
Original line number Diff line number Diff line
@@ -102,11 +102,6 @@ static const struct mlx5_eswitch_rep_ops rep_ops = {
	.get_proto_dev = mlx5_ib_vport_get_proto_dev,
};

u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
{
	return mlx5_eswitch_mode(esw);
}

struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
					  u16 vport_num)
{
+0 −6
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@
extern const struct mlx5_ib_profile raw_eth_profile;

#ifdef CONFIG_MLX5_ESWITCH
u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
					  u16 vport_num);
struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw);
@@ -26,11 +25,6 @@ struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
					  u16 vport_num);
#else /* CONFIG_MLX5_ESWITCH */
static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
{
	return MLX5_ESWITCH_NONE;
}

static inline
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
					  u16 vport_num)
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ static bool is_eth_rep_supported(struct mlx5_core_dev *dev)
	if (!MLX5_ESWITCH_MANAGER(dev))
		return false;

	if (mlx5_eswitch_mode(dev->priv.eswitch) != MLX5_ESWITCH_OFFLOADS)
	if (!is_mdev_switchdev_mode(dev))
		return false;

	return true;
@@ -144,7 +144,7 @@ static bool is_ib_rep_supported(struct mlx5_core_dev *dev)
	if (!MLX5_ESWITCH_MANAGER(dev))
		return false;

	if (mlx5_eswitch_mode(dev->priv.eswitch) != MLX5_ESWITCH_OFFLOADS)
	if (!is_mdev_switchdev_mode(dev))
		return false;

	if (mlx5_core_mp_enabled(dev))
+1 −1
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ static int mlx5_devlink_fs_mode_validate(struct devlink *devlink, u32 id,
		u8 eswitch_mode;
		bool smfs_cap;

		eswitch_mode = mlx5_eswitch_mode(dev->priv.eswitch);
		eswitch_mode = mlx5_eswitch_mode(dev);
		smfs_cap = mlx5_fs_dr_is_supported(dev);

		if (!smfs_cap) {
Loading