All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Geetha sowjanya <gakula@marvell.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com,
	edumazet@google.com, sgoutham@marvell.com, sbhatta@marvell.com,
	hkelam@marvell.com
Subject: Re: [net-next PATCH v3 2/9] octeontx2-pf: RVU representor driver
Date: Wed, 1 May 2024 17:06:37 +0100	[thread overview]
Message-ID: <20240501160637.GW2575892@kernel.org> (raw)
In-Reply-To: <20240428105312.9731-3-gakula@marvell.com>

On Sun, Apr 28, 2024 at 04:23:05PM +0530, Geetha sowjanya wrote:
> This patch adds basic driver for the RVU representor.
> Driver on probe does pci specific initialization and does hw
> resources configuration.
> Introduces RVU_ESWITCH kernel config to enable/disable
> this driver. Representor and NIC shares the code but representors
> netdev support subset of NIC functionality. Hence "otx2_rep_dev"
> api helps to skip the features initialization that are not supported
> by the representors.
> 
> Signed-off-by: Geetha sowjanya <gakula@marvell.com>

...

> +static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct otx2_nic *priv;
> +	struct otx2_hw *hw;
> +	int err;
> +
> +	err = pcim_enable_device(pdev);
> +	if (err) {
> +		dev_err(dev, "Failed to enable PCI device\n");
> +		return err;
> +	}
> +
> +	err = pci_request_regions(pdev, DRV_NAME);
> +	if (err) {
> +		dev_err(dev, "PCI request regions failed 0x%x\n", err);
> +		return err;
> +	}
> +
> +	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48));
> +	if (err) {
> +		dev_err(dev, "DMA mask config failed, abort\n");
> +		goto err_release_regions;
> +	}
> +
> +	pci_set_master(pdev);
> +
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		goto err_release_regions;

Hi Geetha,

This goto will result in the function returning err.
But err is 0 here. Perhaps it should be set to -ENOMEM?

Flagged by Smatch.

> +
> +	pci_set_drvdata(pdev, priv);
> +	priv->pdev = pdev;
> +	priv->dev = dev;
> +	priv->flags |= OTX2_FLAG_INTF_DOWN;
> +	priv->flags |= OTX2_FLAG_REP_MODE_ENABLED;
> +
> +	hw = &priv->hw;
> +	hw->pdev = pdev;
> +	hw->max_queues = OTX2_MAX_CQ_CNT;
> +	hw->rbuf_len = OTX2_DEFAULT_RBUF_LEN;
> +	hw->xqe_size = 128;
> +
> +	err = otx2_init_rsrc(pdev, priv);
> +	if (err)
> +		goto err_release_regions;
> +
> +	err = rvu_get_rep_cnt(priv);
> +	if (err)
> +		goto err_detach_rsrc;
> +
> +	err = rvu_rep_rsrc_init(priv);
> +	if (err)
> +		goto err_detach_rsrc;
> +
> +	return 0;
> +
> +err_detach_rsrc:
> +	if (priv->hw.lmt_info)
> +		free_percpu(priv->hw.lmt_info);
> +	if (test_bit(CN10K_LMTST, &priv->hw.cap_flag))
> +		qmem_free(priv->dev, priv->dync_lmt);
> +	otx2_detach_resources(&priv->mbox);
> +	otx2_disable_mbox_intr(priv);
> +	otx2_pfaf_mbox_destroy(priv);
> +	pci_free_irq_vectors(pdev);
> +err_release_regions:
> +	pci_set_drvdata(pdev, NULL);
> +	pci_release_regions(pdev);
> +	return err;
> +}

...

  reply	other threads:[~2024-05-01 16:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28 10:53 [net-next PATCH v3 0/9] Introduce RVU representors Geetha sowjanya
2024-04-28 10:53 ` [net-next PATCH v3 1/9] octeontx2-pf: Refactoring RVU driver Geetha sowjanya
2024-04-28 10:53 ` [net-next PATCH v3 2/9] octeontx2-pf: RVU representor driver Geetha sowjanya
2024-05-01 16:06   ` Simon Horman [this message]
2024-04-28 10:53 ` [net-next PATCH v3 3/9] octeontx2-pf: Create representor netdev Geetha sowjanya
2024-04-29 11:33   ` Jiri Pirko
2024-04-29 16:13     ` [EXTERNAL] " Geethasowjanya Akula
2024-04-30  6:57       ` Jiri Pirko
2024-04-30 15:17         ` Geethasowjanya Akula
2024-05-01 18:06   ` Simon Horman
2024-05-02  7:01     ` Dan Carpenter
2024-05-03  6:27     ` [EXTERNAL] " Geethasowjanya Akula
2024-05-01 18:18   ` Simon Horman
2024-04-28 10:53 ` [net-next PATCH v3 4/9] octeontx2-pf: Add basic net_device_ops Geetha sowjanya
2024-04-28 10:53 ` [net-next PATCH v3 5/9] octeontx2-af: Add packet path between representor and VF Geetha sowjanya
2024-04-28 10:53 ` [net-next PATCH v3 6/9] octeontx2-pf: Get VF stats via representor Geetha sowjanya
2024-04-28 10:53 ` [net-next PATCH v3 7/9] octeontx2-pf: Add support to sync link state between representor and VFs Geetha sowjanya
2024-04-28 10:53 ` [net-next PATCH v3 8/9] octeontx2-pf: Configure VF mtu via representor Geetha sowjanya
2024-04-28 10:53 ` [net-next PATCH v3 9/9] octeontx2-pf: Add representors for sdp MAC Geetha sowjanya
2024-04-29 11:31 ` [net-next PATCH v3 0/9] Introduce RVU representors Jiri Pirko
2024-04-29 13:51   ` [EXTERNAL] " Geethasowjanya Akula

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=20240501160637.GW2575892@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.