Commit 63de273f authored by David S. Miller's avatar David S. Miller
Browse files

Merge tag 'mlx5e-updates-2018-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux



Saeed Mahameed says:

====================
mlx5e-updates-2018-12-14 (VF Lag)

From Aviv Heller,

Subsequent patches introduce VF LAG, which provdies load-balancing and
high-availability capabilities for VFs associated with different
physical ports of the same Connect-X card.

This series consists of the following:
 - mlx5 devcom, driver infrastructure that facilitates operations that involve
   both core devices (physical functions) of the same card, to synchronize and
   communicate between two driver instances of the same card.
 - Infrastructure for TC rule duplication.
 - Changes to LAG logic to enable its use when SR-IOV is enabled
 - PFs in switchdev mode is the only mode currently supported.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents bedf3b33 95824666
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -48,13 +48,21 @@ static const struct mlx5_ib_profile rep_profile = {
static int
mlx5_ib_nic_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
{
	struct mlx5_ib_dev *ibdev;

	ibdev = mlx5_ib_rep_to_dev(rep);
	if (!__mlx5_ib_add(ibdev, ibdev->profile))
		return -EINVAL;
	return 0;
}

static void
mlx5_ib_nic_rep_unload(struct mlx5_eswitch_rep *rep)
{
	rep->rep_if[REP_IB].priv = NULL;
	struct mlx5_ib_dev *ibdev;

	ibdev = mlx5_ib_rep_to_dev(rep);
	__mlx5_ib_remove(ibdev, ibdev->profile, MLX5_IB_STAGE_MAX);
}

static int
@@ -89,6 +97,7 @@ mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep)
	dev = mlx5_ib_rep_to_dev(rep);
	__mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
	rep->rep_if[REP_IB].priv = NULL;
	ib_dealloc_device(&dev->ib_dev);
}

static void *mlx5_ib_vport_get_proto_dev(struct mlx5_eswitch_rep *rep)
+17 −25
Original line number Diff line number Diff line
@@ -445,7 +445,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
	if (!ndev)
		goto out;

	if (mlx5_lag_is_active(dev->mdev)) {
	if (dev->lag_active) {
		rcu_read_lock();
		upper = netdev_master_upper_dev_get_rcu(ndev);
		if (upper) {
@@ -1848,7 +1848,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,
	context->lib_caps = req.lib_caps;
	print_lib_caps(dev, context->lib_caps);

	if (mlx5_lag_is_active(dev->mdev)) {
	if (dev->lag_active) {
		u8 port = mlx5_core_native_port_num(dev->mdev);

		atomic_set(&context->tx_port_affinity,
@@ -4841,7 +4841,7 @@ static int mlx5_eth_lag_init(struct mlx5_ib_dev *dev)
	struct mlx5_flow_table *ft;
	int err;

	if (!ns || !mlx5_lag_is_active(mdev))
	if (!ns || !mlx5_lag_is_roce(mdev))
		return 0;

	err = mlx5_cmd_create_vport_lag(mdev);
@@ -4855,6 +4855,7 @@ static int mlx5_eth_lag_init(struct mlx5_ib_dev *dev)
	}

	dev->flow_db->lag_demux_ft = ft;
	dev->lag_active = true;
	return 0;

err_destroy_vport_lag:
@@ -4866,7 +4867,9 @@ static void mlx5_eth_lag_cleanup(struct mlx5_ib_dev *dev)
{
	struct mlx5_core_dev *mdev = dev->mdev;

	if (dev->flow_db->lag_demux_ft) {
	if (dev->lag_active) {
		dev->lag_active = false;

		mlx5_destroy_flow_table(dev->flow_db->lag_demux_ft);
		dev->flow_db->lag_demux_ft = NULL;

@@ -6173,7 +6176,7 @@ int mlx5_ib_stage_ib_reg_init(struct mlx5_ib_dev *dev)
	const char *name;

	rdma_set_device_sysfs_group(&dev->ib_dev, &mlx5_attr_group);
	if (!mlx5_lag_is_active(dev->mdev))
	if (!mlx5_lag_is_roce(dev->mdev))
		name = "mlx5_%d";
	else
		name = "mlx5_bond_%d";
@@ -6207,18 +6210,6 @@ static void mlx5_ib_stage_delay_drop_cleanup(struct mlx5_ib_dev *dev)
	cancel_delay_drop(dev);
}

static int mlx5_ib_stage_rep_reg_init(struct mlx5_ib_dev *dev)
{
	mlx5_ib_register_vport_reps(dev);

	return 0;
}

static void mlx5_ib_stage_rep_reg_cleanup(struct mlx5_ib_dev *dev)
{
	mlx5_ib_unregister_vport_reps(dev);
}

static int mlx5_ib_stage_dev_notifier_init(struct mlx5_ib_dev *dev)
{
	dev->mdev_events.notifier_call = mlx5_ib_event;
@@ -6257,8 +6248,6 @@ void __mlx5_ib_remove(struct mlx5_ib_dev *dev,
		if (profile->stage[stage].cleanup)
			profile->stage[stage].cleanup(dev);
	}

	ib_dealloc_device((struct ib_device *)dev);
}

void *__mlx5_ib_add(struct mlx5_ib_dev *dev,
@@ -6392,9 +6381,6 @@ static const struct mlx5_ib_profile nic_rep_profile = {
	STAGE_CREATE(MLX5_IB_STAGE_POST_IB_REG_UMR,
		     mlx5_ib_stage_post_ib_reg_umr_init,
		     NULL),
	STAGE_CREATE(MLX5_IB_STAGE_REP_REG,
		     mlx5_ib_stage_rep_reg_init,
		     mlx5_ib_stage_rep_reg_cleanup),
};

static void *mlx5_ib_add_slave_port(struct mlx5_core_dev *mdev)
@@ -6462,8 +6448,9 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
	if (MLX5_ESWITCH_MANAGER(mdev) &&
	    mlx5_ib_eswitch_mode(mdev->priv.eswitch) == SRIOV_OFFLOADS) {
		dev->rep = mlx5_ib_vport_rep(mdev->priv.eswitch, 0);

		return __mlx5_ib_add(dev, &nic_rep_profile);
		dev->profile = &nic_rep_profile;
		mlx5_ib_register_vport_reps(dev);
		return dev;
	}

	return __mlx5_ib_add(dev, &pf_profile);
@@ -6485,7 +6472,12 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
	}

	dev = context;
	if (dev->profile == &nic_rep_profile)
		mlx5_ib_unregister_vport_reps(dev);
	else
		__mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);

	ib_dealloc_device((struct ib_device *)dev);
}

static struct mlx5_interface mlx5_ib_interface = {
+1 −1
Original line number Diff line number Diff line
@@ -790,7 +790,6 @@ enum mlx5_ib_stages {
	MLX5_IB_STAGE_POST_IB_REG_UMR,
	MLX5_IB_STAGE_DELAY_DROP,
	MLX5_IB_STAGE_CLASS_ATTR,
	MLX5_IB_STAGE_REP_REG,
	MLX5_IB_STAGE_MAX,
};

@@ -937,6 +936,7 @@ struct mlx5_ib_dev {
	struct mlx5_ib_delay_drop	delay_drop;
	const struct mlx5_ib_profile	*profile;
	struct mlx5_eswitch_rep		*rep;
	int				lag_active;

	struct mlx5_ib_lb_state		lb;
	u8			umr_fence;
+1 −1
Original line number Diff line number Diff line
@@ -3258,7 +3258,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
		    (ibqp->qp_type == IB_QPT_RAW_PACKET) ||
		    (ibqp->qp_type == IB_QPT_XRC_INI) ||
		    (ibqp->qp_type == IB_QPT_XRC_TGT)) {
			if (mlx5_lag_is_active(dev->mdev)) {
			if (dev->lag_active) {
				u8 p = mlx5_core_native_port_num(dev->mdev);
				tx_affinity = get_tx_affinity(dev, pd, base, p);
				context->flags |= cpu_to_be32(tx_affinity << 24);
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
		health.o mcg.o cq.o alloc.o qp.o port.o mr.o pd.o \
		mad.o transobj.o vport.o sriov.o fs_cmd.o fs_core.o \
		fs_counters.o rl.o lag.o dev.o events.o wq.o lib/gid.o \
		diag/fs_tracepoint.o diag/fw_tracer.o
		lib/devcom.o diag/fs_tracepoint.o diag/fw_tracer.o

#
# Netdev basic
Loading