Commit 5ec983e9 authored by Huy Nguyen's avatar Huy Nguyen Committed by Saeed Mahameed

net/mlx5e: Update xoff formula

Set minimum speed in xoff threshold formula to 40Gbps

Fixes: 0696d608 ("net/mlx5e: Receive buffer configuration")
Signed-off-by: default avatarHuy Nguyen <huyn@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 36acf63a
...@@ -122,7 +122,9 @@ static int port_set_buffer(struct mlx5e_priv *priv, ...@@ -122,7 +122,9 @@ static int port_set_buffer(struct mlx5e_priv *priv,
return err; 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) static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu)
{ {
u32 speed; u32 speed;
...@@ -130,10 +132,9 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) ...@@ -130,10 +132,9 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu)
int err; int err;
err = mlx5e_port_linkspeed(priv->mdev, &speed); err = mlx5e_port_linkspeed(priv->mdev, &speed);
if (err) { if (err)
mlx5_core_warn(priv->mdev, "cannot get port speed\n"); speed = SPEED_40000;
return 0; speed = max_t(u32, speed, SPEED_40000);
}
xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100; xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment