Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2461790yba; Mon, 15 Apr 2019 12:08:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAbMXCSEFpPU9o2Ubj3EvBQx7NIxwTHcPjT0nUxGsW/m7vLRgqyotCmUhdR7x7t7VECQFB X-Received: by 2002:a17:902:ea0d:: with SMTP id cu13mr76448915plb.92.1555355318754; Mon, 15 Apr 2019 12:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555355318; cv=none; d=google.com; s=arc-20160816; b=0oNFQbMAOnxU7FgGNyAJIoX1CIYR79m/bl+rnu98M6G9TFFdcgy4zvLoUPwdZxCrTd zR9SS1aNVlk5xcbf5aa7nU0D/Uud9xVy4nre7mgcog//b3hssocnJqYJwRpij5b9WVU0 ehl7XA1lF8WJrQtSWJSgAv4Is7MdcrTtoe3xWcLF/LFowVriAwXCe7GlQsAtrPd4iZOP dboY9Nl+1yyy/p4nOs6yAYyrCgEnMuNBqnub0seLrbFq9T7HHY9glxKRuwpMPqyiZRbx ilY3E1W3wZztmag2rnAIRJlay6+kPQtoaP9pET6PfRrtYDcG+nX8VVLBc8w+9C652k4G 6+XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y6GonkIqKiD05ivJnq1gh8kCU72myX9cMwkzagmOygs=; b=uvvkX61Zj9QKxT6CtkugnoFGYgTLKWw5NAdM5Y0e0TU1QF0GObt2E6KEFXsHfq8oEy TQ8ecN1tIGmTF3Cogk9/tD78QxSBnwQjnr5W/pXoCrzSass0hgi++/8isd0opK8nXPG7 PRRLNxLzWJJ59Q8ui6k+H6A4Fz+e5ZlNxDsmLPSvtQZzALhlA0dOxqTqHcZuGfw05gxq AEnAIOy4BhtjaVSltcLpuEpd7q2Kpzwkki3aSjmrXGDodxF/4bb5XixQ8XfthdR0Cg5D 2nu+7sJOtsOb1DAGBpzbzWMAr8/nphkaygpUNEwCcwB8RUlq+VHyyeUzpJNdjPSykxbS JpgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Fm/xtMSj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t185si23122536pgd.485.2019.04.15.12.08.22; Mon, 15 Apr 2019 12:08:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Fm/xtMSj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730077AbfDOTG6 (ORCPT + 99 others); Mon, 15 Apr 2019 15:06:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:41514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730058AbfDOTGw (ORCPT ); Mon, 15 Apr 2019 15:06:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 36FEE20880; Mon, 15 Apr 2019 19:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355211; bh=EgYgkLnUqtVpIAwaB9qjdHKIqfOCQFk2iDa5+b95ydg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fm/xtMSjFOtmZqCXvlnB+pHRTblBKnMXSa5duQP28Vq0j6IEQ9GMj/Ey5w2F0ebA9 H6cFOFAirg3nxzwR481p+lA5Bg+ml1nX/KdYhJRoh8lfSy49wdN7/8wH18CZPpB0f2 OXGrjqAX3e1XryJAQevDTRPvbOQ6RcqWQ505sVq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huy Nguyen , Saeed Mahameed , Sasha Levin Subject: [PATCH 4.19 035/101] net/mlx5e: Update xoff formula Date: Mon, 15 Apr 2019 20:58:33 +0200 Message-Id: <20190415183742.320063071@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183740.341577907@linuxfoundation.org> References: <20190415183740.341577907@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 5ec983e924c7978aaec3cf8679ece9436508bb20 ] Set minimum speed in xoff threshold formula to 40Gbps Fixes: 0696d60853d5 ("net/mlx5e: Receive buffer configuration") Signed-off-by: Huy Nguyen Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- .../net/ethernet/mellanox/mlx5/core/en/port_buffer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c index eac245a93f91..f00de0c987cd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c @@ -122,7 +122,9 @@ static int port_set_buffer(struct mlx5e_priv *priv, return err; } -/* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B]) */ +/* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B]) + * minimum speed value is 40Gbps + */ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) { u32 speed; @@ -130,10 +132,9 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) int err; err = mlx5e_port_linkspeed(priv->mdev, &speed); - if (err) { - mlx5_core_warn(priv->mdev, "cannot get port speed\n"); - return 0; - } + if (err) + speed = SPEED_40000; + speed = max_t(u32, speed, SPEED_40000); xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100; -- 2.19.1