summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHuy Nguyen <huyn@mellanox.com>2019-03-07 14:49:50 -0600
committerSaeed Mahameed <saeedm@mellanox.com>2019-03-29 12:24:43 -0700
commit5ec983e924c7978aaec3cf8679ece9436508bb20 (patch)
tree6b7c48ff4dc8292eb451b8f732e75e9d35d0ed08 /drivers
parent36acf63a066f7e095ef2322118c2742a177daa65 (diff)
downloadlinux-stable-5ec983e924c7978aaec3cf8679ece9436508bb20.tar.gz
linux-stable-5ec983e924c7978aaec3cf8679ece9436508bb20.tar.bz2
linux-stable-5ec983e924c7978aaec3cf8679ece9436508bb20.zip
net/mlx5e: Update xoff formula
Set minimum speed in xoff threshold formula to 40Gbps Fixes: 0696d60853d5 ("net/mlx5e: Receive buffer configuration") Signed-off-by: Huy Nguyen <huyn@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c11
1 files 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 @@ out:
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;