Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3388476lkq; Mon, 23 Nov 2020 04:33:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwALic6hU6KQ6hq5S8QXPwBCUrUnPbVxkAAN+VRcSIThqBA1cbO8Ym6+LP5BZQGlwZVwads X-Received: by 2002:a05:6402:cbb:: with SMTP id cn27mr10088400edb.275.1606134825660; Mon, 23 Nov 2020 04:33:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606134825; cv=none; d=google.com; s=arc-20160816; b=D0daxcOKvw88RPxoTUQXGuQnyv5BC68Jk9iWg7lBLPJiyzXbPo+Ug0MyLlC6u812sC wes+YsV7/50DCJO2n0bMj6dLVXKmX6nFnKr6AOt+hAUZRol9SKJp4YJ2BnRJXa/DKsC5 L5RI5JpzKNbLqCG7TEwPY3ze/uyfTwW8bWTbmjd/An5QpNZvpngjZZx8C56rSQCcGx/v jy4nJAx32XEnbrnzTZBij3WF/eflRHCKh+Z5bhtT4bHlwJlOp6Na6FEZEaj0zIK4TEOf cNXPubrW/YRGx2ZkbnHBG7ThMUZlijb7yx9v8A2Td7GuNNqHbQaNZbEhwacKX1rHwUut JO5A== 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=uaEEzbmhbABf0YLsKwMIm7LXh/x+zZZGbJqCORoUZMI=; b=hyI9NJEySE3EgqoWgTJyGjO4RhCew52yLhs9svHQ4k4XGp7Zd9P4OvHOA3kCF5yZ+f 7Lh85gNDjJrPE8iCMZ4dV+sMObH5+aD9OaZyY5NFA0g/cUDu13KvUgtWiwBotK8896HZ JFSgVGr6QeesLWs/aezaMtcJduka82hRb1fZ4bosei+0n5Z2AL24vdTXX2zP2AR/Qjw+ cbiiegMKVIwD8ev4BVKbFeJ4hCEuiuUsGGQz+2hPTEzK8ksgqMu9Oj1zHkfssbSWRqXO bNmF2hJgffMf194qOsbyjLAkJgg3fVG2t5PaY+hQ1i6J2AG8LMy4oXV8iP1ki8XkMwi5 evEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MNP9opU7; 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 91si8533092edy.541.2020.11.23.04.33.23; Mon, 23 Nov 2020 04:33:45 -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=MNP9opU7; 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 S1729898AbgKWMa0 (ORCPT + 99 others); Mon, 23 Nov 2020 07:30:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:41048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730174AbgKWMaV (ORCPT ); Mon, 23 Nov 2020 07:30:21 -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 DEFCF20781; Mon, 23 Nov 2020 12:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134620; bh=clg1+zrT/LuJy0gXr7l9ya3nSm9jjmNISWBbNCRAF7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNP9opU7FCvPbyT+kZ4N8AJ/Xux15t6KrDziLcYBTP1fcVuuxeLNq7NCgHAHWJgVb 4EmD0ldYQlNb9bgJoddry/wSjYBuYSLIoDTQLb7BXsvyC1MW8pbJQuBKTf0pL6QQWb EhX0f6xWG+pRANla28cGm8bua+phzH0eBToHUjgU= 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 4.19 23/91] net/mlx5: Disable QoS when min_rates on all VFs are zero Date: Mon, 23 Nov 2020 13:21:43 +0100 Message-Id: <20201123121810.440243791@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@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 @@ -1999,12 +1999,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; @@ -2018,9 +2021,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); @@ -2045,7 +2048,6 @@ int mlx5_eswitch_set_vport_rate(struct m struct mlx5_vport *evport; u32 fw_max_bw_share; u32 previous_min_rate; - u32 divider; bool min_rate_supported; bool max_rate_supported; int err = 0; @@ -2071,8 +2073,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;