[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6122e3f-d221-4d95-a6b8-92e67aa51a5a@loongson.cn>
Date: Wed, 3 Apr 2024 16:09:21 +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/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.
Thanks,
Yanteng
Powered by blists - more mailing lists