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: <7myfmz72mdp74k3pjtv6gmturdtm7pkghcwpom62hl52eafval@wmbtdwm5kitp>
Date: Wed, 3 Apr 2024 15:03:55 +0300
From: Serge Semin <fancer.lancer@...il.com>
To: Yanteng Si <siyanteng@...ngson.cn>
Cc: hkallweit1@...il.com, andrew@...n.ch, peppe.cavallaro@...com, 
	alexandre.torgue@...s.st.com, joabreu@...opsys.com, Jose.Abreu@...opsys.com, 
	chenhuacai@...ngson.cn, linux@...linux.org.uk, guyinggang@...ngson.cn, 
	netdev@...r.kernel.org, chris.chenfeiyang@...il.com
Subject: Re: [PATCH net-next v8 07/11] net: stmmac: dwmac-loongson: Add
 multi-channel supports for loongson

On Wed, Apr 03, 2024 at 04:09:21PM +0800, Yanteng Si wrote:
> 
> 在 2024/3/23 02:47, Serge Semin 写道:
> > +static int loongson_dwmac_config_multi_msi(struct pci_dev *pdev,
> > +					   struct plat_stmmacenet_data *plat,
> > +					   struct stmmac_resources *res)
> > +{
> > +	int i, ret, vecs;
> > +
> > +	/* INT NAME | MAC | CH7 rx | CH7 tx | ... | CH0 rx | CH0 tx |
> > +	 * --------- ----- -------- --------  ...  -------- --------
> > +	 * IRQ NUM  |  0  |   1    |   2    | ... |   15   |   16   |
> > +	 */
> > +	vecs = plat->rx_queues_to_use + plat->tx_queues_to_use + 1;
> > +	ret = pci_alloc_irq_vectors(pdev, 1, vecs, PCI_IRQ_MSI | PCI_IRQ_LEGACY);
> > +	if (ret < 0) {
> > +		dev_err(&pdev->dev, "Failed to allocate PCI IRQs\n");
> > +		return ret;
> > +	} else if (ret >= vecs) {
> > +		for (i = 0; i < plat->rx_queues_to_use; i++) {
> > +			res->rx_irq[CHANNELS_NUM - 1 - i] =
> > +				pci_irq_vector(pdev, 1 + i * 2);
> > +		}
> > +		for (i = 0; i < plat->tx_queues_to_use; i++) {
> > +			res->tx_irq[CHANNELS_NUM - 1 - i] =
> > +				pci_irq_vector(pdev, 2 + i * 2);
> > +		}
> > +
> > +		plat->flags |= STMMAC_FLAG_MULTI_MSI_EN;
> > +	}
> > +
> > +	res->irq = pci_irq_vector(pdev, 0);
> > +
> > +	return 0;
> > +}
> > 
> > Thus in case if for some reason you were able to allocate less MSI
> > IRQs than required you'll still be able to use them. The legacy IRQ
> > will be also available in case if MSI failed to be allocated.
> 
> Great, we will consider doing this in the future, but at this stage, we
> don't want to add too much complexity.

This comment isn't about complexity. Moreover the code in my comment
is simpler since the function is more coherent and doesn't have the
redundant dependencies from the node-pointer and the
loongson_dwmac_config_legacy() function. In addition it provides more
flexible solution in case if there were less MSI vectors allocated
then required.

-Serge(y)

> 
> 
> Thanks,
> 
> Yanteng
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ