Commit 4762010f authored by yuval.shaia@oracle.com's avatar yuval.shaia@oracle.com Committed by David S. Miller

net/mlx4_core: Use min3 to select number of MSI-X vectors

Signed-off-by: default avatarYuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 70957eae
...@@ -2862,12 +2862,10 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) ...@@ -2862,12 +2862,10 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
int port = 0; int port = 0;
if (msi_x) { if (msi_x) {
int nreq = dev->caps.num_ports * num_online_cpus() + 1; int nreq = min3(dev->caps.num_ports *
(int)num_online_cpus() + 1,
nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, dev->caps.num_eqs - dev->caps.reserved_eqs,
nreq); MAX_MSIX);
if (nreq > MAX_MSIX)
nreq = MAX_MSIX;
entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
if (!entries) if (!entries)
......
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