net/mlx4_core: Use min3 to select number of MSI-X vectors
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
70957eaecc
commit
4762010f09
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue