Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04c6faa1 authored by David S. Miller's avatar David S. Miller
Browse files

Merge tag 'mlx5-fixes-2018-06-26' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux



Saeed Mahameed says:

====================
mlx5-fixes-2018-06-26

Fixes for mlx5 core and netdev driver:

Two fixes from Alex Vesker to address command interface issues
 - Race in command interface polling mode
 - Incorrect raw command length parsing

From Shay Agroskin, Fix wrong size allocation for QoS ETC TC regitster.

From Or Gerlitz and Eli Cohin, Address backward compatability issues for when
Eswitch capability is not advertised for the PF host driver
    - Fix required capability for manipulating MPFS
    - E-Switch, Disallow vlan/spoofcheck setup if not being esw manager
    - Avoid dealing with vport IB/eth representors if not being e-switch manager
    - E-Switch, Avoid setup attempt if not being e-switch manager
    - Don't attempt to dereference the ppriv struct if not being eswitch manager
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 933e671f d412c31d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6113,7 +6113,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
	dev->num_ports = max(MLX5_CAP_GEN(mdev, num_ports),
			     MLX5_CAP_GEN(mdev, num_vhca_ports));

	if (MLX5_VPORT_MANAGER(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);

+4 −4
Original line number Diff line number Diff line
@@ -807,6 +807,7 @@ static void cmd_work_handler(struct work_struct *work)
	unsigned long flags;
	bool poll_cmd = ent->polling;
	int alloc_ret;
	int cmd_mode;

	sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;
	down(sem);
@@ -853,6 +854,7 @@ static void cmd_work_handler(struct work_struct *work)
	set_signature(ent, !cmd->checksum_disabled);
	dump_command(dev, ent, 1);
	ent->ts1 = ktime_get_ns();
	cmd_mode = cmd->mode;

	if (ent->callback)
		schedule_delayed_work(&ent->cb_timeout_work, cb_timeout);
@@ -877,7 +879,7 @@ static void cmd_work_handler(struct work_struct *work)
	iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell);
	mmiowb();
	/* if not in polling don't use ent after this point */
	if (cmd->mode == CMD_MODE_POLLING || poll_cmd) {
	if (cmd_mode == CMD_MODE_POLLING || poll_cmd) {
		poll_timeout(ent);
		/* make sure we read the descriptor after ownership is SW */
		rmb();
@@ -1276,7 +1278,7 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf,
{
	struct mlx5_core_dev *dev = filp->private_data;
	struct mlx5_cmd_debug *dbg = &dev->cmd.dbg;
	char outlen_str[8];
	char outlen_str[8] = {0};
	int outlen;
	void *ptr;
	int err;
@@ -1291,8 +1293,6 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf,
	if (copy_from_user(outlen_str, buf, count))
		return -EFAULT;

	outlen_str[7] = 0;

	err = sscanf(outlen_str, "%d", &outlen);
	if (err < 0)
		return err;
+6 −6
Original line number Diff line number Diff line
@@ -2846,7 +2846,7 @@ void mlx5e_activate_priv_channels(struct mlx5e_priv *priv)
	mlx5e_activate_channels(&priv->channels);
	netif_tx_start_all_queues(priv->netdev);

	if (MLX5_VPORT_MANAGER(priv->mdev))
	if (MLX5_ESWITCH_MANAGER(priv->mdev))
		mlx5e_add_sqs_fwd_rules(priv);

	mlx5e_wait_channels_min_rx_wqes(&priv->channels);
@@ -2857,7 +2857,7 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv)
{
	mlx5e_redirect_rqts_to_drop(priv);

	if (MLX5_VPORT_MANAGER(priv->mdev))
	if (MLX5_ESWITCH_MANAGER(priv->mdev))
		mlx5e_remove_sqs_fwd_rules(priv);

	/* FIXME: This is a W/A only for tx timeout watch dog false alarm when
@@ -4597,7 +4597,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
	mlx5e_set_netdev_dev_addr(netdev);

#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
	if (MLX5_VPORT_MANAGER(mdev))
	if (MLX5_ESWITCH_MANAGER(mdev))
		netdev->switchdev_ops = &mlx5e_switchdev_ops;
#endif

@@ -4753,7 +4753,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)

	mlx5e_enable_async_events(priv);

	if (MLX5_VPORT_MANAGER(priv->mdev))
	if (MLX5_ESWITCH_MANAGER(priv->mdev))
		mlx5e_register_vport_reps(priv);

	if (netdev->reg_state != NETREG_REGISTERED)
@@ -4788,7 +4788,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)

	queue_work(priv->wq, &priv->set_rx_mode_work);

	if (MLX5_VPORT_MANAGER(priv->mdev))
	if (MLX5_ESWITCH_MANAGER(priv->mdev))
		mlx5e_unregister_vport_reps(priv);

	mlx5e_disable_async_events(priv);
@@ -4972,7 +4972,7 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
		return NULL;

#ifdef CONFIG_MLX5_ESWITCH
	if (MLX5_VPORT_MANAGER(mdev)) {
	if (MLX5_ESWITCH_MANAGER(mdev)) {
		rpriv = mlx5e_alloc_nic_rep_priv(mdev);
		if (!rpriv) {
			mlx5_core_warn(mdev, "Failed to alloc NIC rep priv data\n");
+6 −2
Original line number Diff line number Diff line
@@ -823,7 +823,7 @@ bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv)
	struct mlx5e_rep_priv *rpriv = priv->ppriv;
	struct mlx5_eswitch_rep *rep;

	if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager))
	if (!MLX5_ESWITCH_MANAGER(priv->mdev))
		return false;

	rep = rpriv->rep;
@@ -837,8 +837,12 @@ bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv)
static bool mlx5e_is_vf_vport_rep(struct mlx5e_priv *priv)
{
	struct mlx5e_rep_priv *rpriv = priv->ppriv;
	struct mlx5_eswitch_rep *rep = rpriv->rep;
	struct mlx5_eswitch_rep *rep;

	if (!MLX5_ESWITCH_MANAGER(priv->mdev))
		return false;

	rep = rpriv->rep;
	if (rep && rep->vport != FDB_UPLINK_VPORT)
		return true;

+5 −7
Original line number Diff line number Diff line
@@ -1594,17 +1594,15 @@ static void esw_disable_vport(struct mlx5_eswitch *esw, int vport_num)
}

/* Public E-Switch API */
#define ESW_ALLOWED(esw) ((esw) && MLX5_VPORT_MANAGER((esw)->dev))
#define ESW_ALLOWED(esw) ((esw) && MLX5_ESWITCH_MANAGER((esw)->dev))


int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode)
{
	int err;
	int i, enabled_events;

	if (!ESW_ALLOWED(esw))
		return 0;

	if (!MLX5_CAP_GEN(esw->dev, eswitch_flow_table) ||
	if (!ESW_ALLOWED(esw) ||
	    !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ft_support)) {
		esw_warn(esw->dev, "E-Switch FDB is not supported, aborting ...\n");
		return -EOPNOTSUPP;
@@ -1806,7 +1804,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
	u64 node_guid;
	int err = 0;

	if (!ESW_ALLOWED(esw))
	if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
		return -EPERM;
	if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
		return -EINVAL;
@@ -1883,7 +1881,7 @@ int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
{
	struct mlx5_vport *evport;

	if (!ESW_ALLOWED(esw))
	if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
		return -EPERM;
	if (!LEGAL_VPORT(esw, vport))
		return -EINVAL;
Loading