From c2b559ed8683ffb5a7bdd9e71b3803b231623c86 Mon Sep 17 00:00:00 2001 From: Yevgeny Petrilin Date: Mon, 29 Dec 2008 18:38:21 -0800 Subject: [PATCH] mlx4_en: Verify number of RX rings doesn't exceed MAX_RX_RINGS Required in cases were dev->caps.num_comp_vectors > MAX_RX_RINGS. For current values this would happen on machines that have more then 16 cores. Signed-off-by: Yevgeny Petrilin Signed-off-by: David S. Miller --- drivers/net/mlx4/en_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c index c1c05852a95e..34f3a191fbdf 100644 --- a/drivers/net/mlx4/en_main.c +++ b/drivers/net/mlx4/en_main.c @@ -170,7 +170,8 @@ static void *mlx4_en_add(struct mlx4_dev *dev) mlx4_info(mdev, "Using %d tx rings for port:%d\n", mdev->profile.prof[i].tx_ring_num, i); if (!mdev->profile.prof[i].rx_ring_num) { - mdev->profile.prof[i].rx_ring_num = dev->caps.num_comp_vectors; + mdev->profile.prof[i].rx_ring_num = + min_t(int, dev->caps.num_comp_vectors, MAX_RX_RINGS); mlx4_info(mdev, "Defaulting to %d rx rings for port:%d\n", mdev->profile.prof[i].rx_ring_num, i); } else -- 2.20.1