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

Commit 5366c5ff authored by Ido Shamay's avatar Ido Shamay Committed by Greg Kroah-Hartman
Browse files

net/mlx4: Check if Granular QoS per VF has been enabled before updating QP qos_vport




[ Upstream commit 269f9883fe254d109afdfc657875c456d6fabb08 ]

The Granular QoS per VF feature must be enabled in FW before it can be
used.

Thus, the driver cannot modify a QP's qos_vport value (via the UPDATE_QP FW
command) if the feature has not been enabled -- the FW returns an error if
this is attempted.

Fixes: 08068cd5 ("net/mlx4: Added qos_vport QP configuration in VST mode")
Signed-off-by: default avatarIdo Shamay <idos@mellanox.com>
Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eec6e0a4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -487,6 +487,12 @@ int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
	}

	if (attr & MLX4_UPDATE_QP_QOS_VPORT) {
		if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_QOS_VPP)) {
			mlx4_warn(dev, "Granular QoS per VF is not enabled\n");
			err = -EOPNOTSUPP;
			goto out;
		}

		qp_mask |= 1ULL << MLX4_UPD_QP_MASK_QOS_VPP;
		cmd->qp_context.qos_vport = params->qos_vport;
	}
+11 −5
Original line number Diff line number Diff line
@@ -5214,6 +5214,13 @@ void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave)
	mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex);
}

static void update_qos_vpp(struct mlx4_update_qp_context *ctx,
			   struct mlx4_vf_immed_vlan_work *work)
{
	ctx->qp_mask |= cpu_to_be64(1ULL << MLX4_UPD_QP_MASK_QOS_VPP);
	ctx->qp_context.qos_vport = work->qos_vport;
}

void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
{
	struct mlx4_vf_immed_vlan_work *work =
@@ -5328,11 +5335,10 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
					qp->sched_queue & 0xC7;
				upd_context->qp_context.pri_path.sched_queue |=
					((work->qos & 0x7) << 3);
				upd_context->qp_mask |=
					cpu_to_be64(1ULL <<
						    MLX4_UPD_QP_MASK_QOS_VPP);
				upd_context->qp_context.qos_vport =
					work->qos_vport;

				if (dev->caps.flags2 &
				    MLX4_DEV_CAP_FLAG2_QOS_VPP)
					update_qos_vpp(upd_context, work);
			}

			err = mlx4_cmd(dev, mailbox->dma,