lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240403203526.GA1887417@bhelgaas>
Date: Wed, 3 Apr 2024 15:35:26 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
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
Subject: Re: [net-next PATCH 03/15] eth: fbnic: Allocate core device specific
 structures and devlink interface

On Wed, Apr 03, 2024 at 01:08:37PM -0700, Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@...com>
> 
> At the core of the fbnic device will be the devlink interface. This
> interface will eventually provide basic functionality in the event that
> there are any issues with the network interface.
> 
> Add support for allocating the MSI-X vectors and setting up the BAR
> mapping. With this we can start enabling various subsytems and start
> brining up additional interfaces such the AXI fabric and the firmware
> mailbox.

> +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);
> +	struct msix_entry *msix_entries;
> +	int i, num_irqs;
> +
> +	msix_entries = kcalloc(wanted_irqs, sizeof(*msix_entries), GFP_KERNEL);
> +	if (!msix_entries)
> +		return -ENOMEM;
> +
> +	for (i = 0; i < wanted_irqs; i++)
> +		msix_entries[i].entry = i;
> +
> +	num_irqs = pci_enable_msix_range(pdev, msix_entries,
> +					 FBNIC_NON_NAPI_VECTORS + 1,
> +					 wanted_irqs);

FWIW, deprecated in favor of pci_alloc_irq_vectors().

> +	if (num_irqs < 0) {
> +		dev_err(fbd->dev, "Failed to allocate MSI-X entries\n");
> +		kfree(msix_entries);
> +		return num_irqs;
> +	}
> +
> +	if (num_irqs < wanted_irqs)
> +		dev_warn(fbd->dev, "Allocated %d IRQs, expected %d\n",
> +			 num_irqs, wanted_irqs);
> +
> +	fbd->msix_entries = msix_entries;
> +	fbd->num_irqs = num_irqs;
> +
> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ