Skip to content

Commit

Permalink
net/mlx5e: Update xoff formula
Browse files Browse the repository at this point in the history
Set minimum speed in xoff threshold formula to 40Gbps

Fixes: 0696d60 ("net/mlx5e: Receive buffer configuration")
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
  • Loading branch information
Huy Nguyen authored and Saeed Mahameed committed Mar 29, 2019
1 parent 36acf63 commit 5ec983e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,19 @@ 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;
u32 xoff;
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;

Expand Down

0 comments on commit 5ec983e

Please sign in to comment.