[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <24ac80b6-ee09-4aee-b9f7-162a3377baa3@lunn.ch>
Date: Sat, 13 Jul 2024 20:50:07 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Alexander Duyck <alexander.duyck@...il.com>
Cc: netdev@...r.kernel.org, Alexander Duyck <alexanderduyck@...com>,
kuba@...nel.org, davem@...emloft.net, pabeni@...hat.com,
edumazet@...gle.com, kernel-team@...a.com
Subject: Re: [net-next PATCH v5 03/15] eth: fbnic: Allocate core device
specific structures and devlink interface
> +int fbnic_alloc_irqs(struct fbnic_dev *fbd)
> +{
> + unsigned int wanted_irqs = FBNIC_NON_NAPI_VECTORS;
> + struct pci_dev *pdev = to_pci_dev(fbd->dev);
> + int num_irqs;
> +
> + wanted_irqs += 1;
> + num_irqs = pci_alloc_irq_vectors(pdev, FBNIC_NON_NAPI_VECTORS + 1,
> + wanted_irqs, PCI_IRQ_MSIX);
nit picking, but this is a bit odd. Why not:
> + unsigned int wanted_irqs = FBNIC_NON_NAPI_VECTORS + 1;
> + num_irqs = pci_alloc_irq_vectors(pdev, wanted_irqs,
> + wanted_irqs, PCI_IRQ_MSIX);
> + if (num_irqs < 0) {
> + dev_err(fbd->dev, "Failed to allocate MSI-X entries\n");
> + return num_irqs;
> + }
> +
> + if (num_irqs < wanted_irqs)
> + dev_warn(fbd->dev, "Allocated %d IRQs, expected %d\n",
> + num_irqs, wanted_irqs);
https://elixir.bootlin.com/linux/latest/source/drivers/pci/msi/api.c#L206
* Return: number of allocated vectors (which might be smaller than
* @max_vecs), -ENOSPC if less than @min_vecs interrupt vectors are
* available, other errnos otherwise.
So i don't think this is possible.
Andrew
Powered by blists - more mailing lists