[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <05c3033f-935c-4ac0-9bc4-2653ce5ced3d@loongson.cn>
Date: Fri, 5 Apr 2024 18:17:30 +0800
From: Yanteng Si <siyanteng@...ngson.cn>
To: Serge Semin <fancer.lancer@...il.com>
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
在 2024/4/3 20:03, Serge Semin 写道:
> 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.
I just tried it, the network card doesn't work, the reason is not clear.
Considering that the overall change is a little big, I want to send the
current
working state as the patch v9.
However, I will continue to analyze the reasons for the failure and
submit them
as a separate patch in the future. Is that OK?
Thanks,
Yanteng
Powered by blists - more mailing lists