Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp831699pxu; Mon, 23 Nov 2020 05:25:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqRGKALKx6FPKi+xmu8CXjDDiXvcg/ndeS2kiYOl72Fr+DX41z661UmsgeaGFCzJiJsc41 X-Received: by 2002:a17:906:b101:: with SMTP id u1mr23433456ejy.457.1606137936554; Mon, 23 Nov 2020 05:25:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606137936; cv=none; d=google.com; s=arc-20160816; b=lArERT21XwwYzumOqcaEx0wrGJP/AWn1oL4Oa4GDruKasJtQFy8v0zEMgQEYCEyc5P 7ewyRaHCeCOnDGrh2No/4gqRZaybXybyDwA0zigCNPm4me/8vHvue5Oi1+ZEpXafLL3R XsMYygFEEIhQovSc0+8JQ2DVX82YfEIgwlFrIG2a7geuqgmT7+6i/XpFSV3svyGqVKTf 7zyYzdpmRopbtvQ4kMRDwE69l7rR/n702J0Nz7onA7DV5Pw0kfvcPXMqYW0hzH0QnJfQ AjBP/77s861zRIleCp4u/EDez2LoU9GgZqaCk9KaHHOrWgjxuCVq/bYkajSOPlgDQ2zA +a6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gGgFvHk5vhNHPd+SgLTRboaCS6qBtdfFtUK91zEAoNg=; b=Y6XMkNJhzzKdFXERUDfVKHZDGMwiI5n9Ose+eSNc0dXweoj0DSyPLu5AQBFGsZbYj1 2DrpcWyCHq2WQvssSCrkguklFw2DFb4j5YbWwtMoilpO/15j6EYNLiOA8gkx6rPc6agb xq4cIi4s5JS7YyeM0FCkiEebF+u5kT3dpjQpeQ3nn3do+S4RV+aDdp77csxkn2anIjBR 2PoGsiED2ODocBXG2x2W3PWKNIJGP9RKFhcaV4uCZd8V2jYuos7wLnw66a57HAawEu/Z WkgX8V1HGsT3JTvAtyqHopQ26sP+xM+M9iHGujCwJ8fvDVec5zPNTjAw5cLi2uQyOka+ 9HdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aQt9Puaf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ec3si6641031ejb.731.2020.11.23.05.25.13; Mon, 23 Nov 2020 05:25:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aQt9Puaf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388992AbgKWNWg (ORCPT + 99 others); Mon, 23 Nov 2020 08:22:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:48450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731119AbgKWMgS (ORCPT ); Mon, 23 Nov 2020 07:36:18 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8FEF32065E; Mon, 23 Nov 2020 12:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134978; bh=w4sMYw8FTXTLU3YoJ5gQCC6GLOnwx2Ikq5d/cEpGdpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aQt9Puaftd6Jtb/xsQ2mYEBAVWxxcRmNoyXslCd3VTgjAMA/VV0VZN7NwxLjOaX+7 GcjwIEWH6TlxBgRtgjR/m01ZiMHgbJrXY0EB2nlu/l1Md7y5y/DsinNg6qXQcIKMvH Uw03Rqi466JVN9PXmHMefVieA+WUVgwOFqFSNn30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladyslav Tarasiuk , Moshe Shemesh , Saeed Mahameed Subject: [PATCH 5.4 030/158] net/mlx5: Disable QoS when min_rates on all VFs are zero Date: Mon, 23 Nov 2020 13:20:58 +0100 Message-Id: <20201123121821.390172508@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladyslav Tarasiuk [ Upstream commit 470b74758260e4abc2508cf1614573c00a00465c ] Currently when QoS is enabled for VF and any min_rate is configured, the driver sets bw_share value to at least 1 and doesn’t allow to set it to 0 to make minimal rate unlimited. It means there is always a minimal rate configured for every VF, even if user tries to remove it. In order to make QoS disable possible, check whether all vports have configured min_rate = 0. If this is true, set their bw_share to 0 to disable min_rate limitations. Fixes: c9497c98901c ("net/mlx5: Add support for setting VF min rate") Signed-off-by: Vladyslav Tarasiuk Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -2369,12 +2369,15 @@ static u32 calculate_vports_min_rate_div max_guarantee = evport->info.min_rate; } - return max_t(u32, max_guarantee / fw_max_bw_share, 1); + if (max_guarantee) + return max_t(u32, max_guarantee / fw_max_bw_share, 1); + return 0; } -static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider) +static int normalize_vports_min_rate(struct mlx5_eswitch *esw) { u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share); + u32 divider = calculate_vports_min_rate_divider(esw); struct mlx5_vport *evport; u32 vport_max_rate; u32 vport_min_rate; @@ -2387,9 +2390,9 @@ static int normalize_vports_min_rate(str continue; vport_min_rate = evport->info.min_rate; vport_max_rate = evport->info.max_rate; - bw_share = MLX5_MIN_BW_SHARE; + bw_share = 0; - if (vport_min_rate) + if (divider) bw_share = MLX5_RATE_TO_BW_SHARE(vport_min_rate, divider, fw_max_bw_share); @@ -2414,7 +2417,6 @@ int mlx5_eswitch_set_vport_rate(struct m struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); u32 fw_max_bw_share; u32 previous_min_rate; - u32 divider; bool min_rate_supported; bool max_rate_supported; int err = 0; @@ -2439,8 +2441,7 @@ int mlx5_eswitch_set_vport_rate(struct m previous_min_rate = evport->info.min_rate; evport->info.min_rate = min_rate; - divider = calculate_vports_min_rate_divider(esw); - err = normalize_vports_min_rate(esw, divider); + err = normalize_vports_min_rate(esw); if (err) { evport->info.min_rate = previous_min_rate; goto unlock;