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]
Date: Fri, 26 Apr 2024 13:12:43 +0800
From: Yanteng Si <siyanteng@...ngson.cn>
To: andrew@...n.ch, hkallweit1@...il.com, peppe.cavallaro@...com,
 alexandre.torgue@...s.st.com, joabreu@...opsys.com, fancer.lancer@...il.com
Cc: Jose.Abreu@...opsys.com, chenhuacai@...nel.org, linux@...linux.org.uk,
 guyinggang@...ngson.cn, netdev@...r.kernel.org, chris.chenfeiyang@...il.com,
 siyanteng01@...il.com
Subject: Re: [PATCH net-next v12 13/15] net: stmmac: dwmac-loongson: Add
 Loongson GNET support

Copy here a comment from v11 that didn't get a clear response.


In v11:

在 2024/4/25 21:11, Yanteng Si 写道:
> +static int loongson_dwmac_config_msi(struct pci_dev *pdev,
> +				     struct plat_stmmacenet_data *plat,
> +				     struct stmmac_resources *res,
> +				     struct device_node *np)
> +{
> +	int i, ret, vecs;
> +
> +	vecs = roundup_pow_of_two(CHANNEL_NUM * 2 + 1);
> +	ret = pci_alloc_irq_vectors(pdev, vecs, vecs, PCI_IRQ_MSI);
> +	if (ret < 0) {
> +		dev_info(&pdev->dev,
> +			 "MSI enable failed, Fallback to legacy interrupt\n");
> +		return loongson_dwmac_config_legacy(pdev, plat, res, np);
> +	}
> +
> +	res->irq = pci_irq_vector(pdev, 0);
> +	res->wol_irq = 0;
> +
> +	/* INT NAME | MAC | CH7 rx | CH7 tx | ... | CH0 rx | CH0 tx |
> +	 * --------- ----- -------- --------  ...  -------- --------
> +	 * IRQ NUM  |  0  |   1    |   2    | ... |   15   |   16   |
> +	 */
> +	for (i = 0; i < CHANNEL_NUM; i++) {
> +		res->rx_irq[CHANNEL_NUM - 1 - i] =
> +			pci_irq_vector(pdev, 1 + i * 2);
> +		res->tx_irq[CHANNEL_NUM - 1 - i] =
> +			pci_irq_vector(pdev, 2 + i * 2);
> +	}
> +
> +	plat->flags |= STMMAC_FLAG_MULTI_MSI_EN;
> +
> +	return 0;
> +}

* First,Serge wrote:


   Once again. Please replace this with simpler solution:

   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;
   +}

* Then, Yanteng wrote:

   Well, I'll try again.

* And then,Hiacai wrote:

   In full PCI system the below function works fine, because alloc irq
   vectors with PCI_IRQ_LEGACY do the same thing as fallback to call
   loongson_dwmac_config_legacy(). But for a DT-based system it doesn't
   work.

* Last, Yanteng wrote:

   Hi Serge,
   How about we stay the same in v12?


Thanks,
Yanteng


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ