Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f32ac2e authored by Danit Goldberg's avatar Danit Goldberg Committed by Doug Ledford
Browse files

IB/mlx5: Use unlimited rate when static rate is not supported



Before the change, if the user passed a static rate value different
than zero and the FW doesn't support static rate,
it would end up configuring rate of 2.5 GBps.

Fix this by using rate 0; unlimited, in cases where FW
doesn't support static rate configuration.

Cc: <stable@vger.kernel.org> # 3.10
Fixes: e126ba97 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Reviewed-by: default avatarMajd Dibbiny <majd@mellanox.com>
Signed-off-by: default avatarDanit Goldberg <danitg@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 002bf228
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -2455,18 +2455,18 @@ enum {

static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 rate)
{
	if (rate == IB_RATE_PORT_CURRENT) {
	if (rate == IB_RATE_PORT_CURRENT)
		return 0;
	} else if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_300_GBPS) {

	if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_300_GBPS)
		return -EINVAL;
	} else {
		while (rate != IB_RATE_2_5_GBPS &&

	while (rate != IB_RATE_PORT_CURRENT &&
	       !(1 << (rate + MLX5_STAT_RATE_OFFSET) &
		 MLX5_CAP_GEN(dev->mdev, stat_rate_support)))
		--rate;
	}

	return rate + MLX5_STAT_RATE_OFFSET;
	return rate ? rate + MLX5_STAT_RATE_OFFSET : rate;
}

static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev,