From: Jakub Kicinski <kuba@kernel.org>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v7] net: txgbe: Add build support for txgbe
Date: Tue, 21 Jun 2022 22:37:16 -0700 [thread overview]
Message-ID: <20220621223716.5b936d93@kernel.org> (raw)
In-Reply-To: <20220621023209.599386-1-jiawenwu@trustnetic.com>
On Tue, 21 Jun 2022 10:32:09 +0800 Jiawen Wu wrote:
> + if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
> + !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
> + pci_using_dac = 1;
dma_set_mask_and_coherent() ...
> + } else {
> + err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
... but really this entire dance is unnecessary. Please see commit
c38f30683956 ("vmxnet3: Remove useless DMA-32 fallback configuration")
for references to why that's the case.
> + if (err) {
> + err = dma_set_coherent_mask(&pdev->dev,
> + DMA_BIT_MASK(32));
> + if (err) {
> + dev_err(&pdev->dev,
> + "No usable DMA configuration, aborting\n");
> + goto err_dma;
> + }
> + }
> + pci_using_dac = 0;
> + }
> +
> + err = pci_request_selected_regions(pdev,
> + pci_select_bars(pdev, IORESOURCE_MEM),
> + txgbe_driver_name);
> + if (err) {
> + dev_err(&pdev->dev,
> + "pci_request_selected_regions failed 0x%x\n", err);
> + goto err_dma;
> + }
> +
> + pci_enable_pcie_error_reporting(pdev);
> + pci_set_master(pdev);
> +
> + netdev = devm_alloc_etherdev_mqs(&pdev->dev,
> + sizeof(struct txgbe_adapter),
> + TXGBE_MAX_TX_QUEUES,
> + TXGBE_MAX_RX_QUEUES);
> + if (!netdev) {
> + err = -ENOMEM;
> + goto err_alloc_etherdev;
> + }
> +
> + SET_NETDEV_DEV(netdev, &pdev->dev);
> +
> + adapter = netdev_priv(netdev);
> + adapter->netdev = netdev;
> + adapter->pdev = pdev;
> +
> + adapter->io_addr = devm_ioremap(&pdev->dev,
> + pci_resource_start(pdev, 0),
> + pci_resource_len(pdev, 0));
> + if (!adapter->io_addr) {
> + err = -EIO;
> + goto err_alloc_etherdev;
See, now this jumps to err_alloc_etherdev which I can't wrap my head
around. Please name the labels after the target, not the source...
> + }
> +
> + if (pci_using_dac)
> + netdev->features |= NETIF_F_HIGHDMA;
> +
> + pci_set_drvdata(pdev, adapter);
> +
> + return 0;
> +
> +err_alloc_etherdev:
... so for example:
err_pci_release_regions:
> + pci_release_selected_regions(pdev,
> + pci_select_bars(pdev, IORESOURCE_MEM));
> +err_dma:
and
err_pci_disable_dev:
> + pci_disable_device(pdev);
> + return err;
prev parent reply other threads:[~2022-06-22 5:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 2:32 [PATCH net-next v7] net: txgbe: Add build support for txgbe Jiawen Wu
2022-06-22 5:33 ` Jakub Kicinski
2022-06-22 20:59 ` Bjorn Helgaas
2022-06-22 5:37 ` Jakub Kicinski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220621223716.5b936d93@kernel.org \
--to=kuba@kernel.org \
--cc=jiawenwu@trustnetic.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).