DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Jiawen Wu <jiawenwu@trustnetic.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v4 3/6] net/ngbe: support probe and remove
Date: Fri, 9 Apr 2021 15:40:19 +0100	[thread overview]
Message-ID: <fec94228-17b4-1850-d14a-319ade56dfd3@intel.com> (raw)
In-Reply-To: <20210406093048.2923172-4-jiawenwu@trustnetic.com>

On 4/6/2021 10:30 AM, Jiawen Wu wrote:
> Add basic PCIe ethdev probe and remove.
> 
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>

<...>

> --- a/drivers/net/ngbe/ngbe_ethdev.c
> +++ b/drivers/net/ngbe/ngbe_ethdev.c
> @@ -1,10 +1,12 @@
> - /* SPDX-License-Identifier: BSD-3-Clause
> -  * Copyright(c) 2018-2020
> -  */
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2018-2020
> + */

Can you please fix this where it is introduced at first place?

<...>

> +static int
> +eth_ngbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
> +		struct rte_pci_device *pci_dev)
> +{
> +	struct rte_eth_dev *pf_ethdev;
> +	struct rte_eth_devargs eth_da;
> +	int retval;
> +
> +	if (pci_dev->device.devargs) {
> +		retval = rte_eth_devargs_parse(pci_dev->device.devargs->args,
> +				&eth_da);
> +		if (retval)
> +			return retval;
> +	} else {
> +		memset(&eth_da, 0, sizeof(eth_da));
> +	}
> +
> +	retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name,
> +			sizeof(struct ngbe_adapter),
> +			eth_dev_pci_specific_init, pci_dev,
> +			eth_ngbe_dev_init, NULL);
> +
> +	if (retval || eth_da.nb_representor_ports < 1)
> +		return retval;

no need to check the 'nb_representor_ports' here, the driver does not support 
the port anyway, it can return immediately.

Similarly 'rte_eth_devargs_parse()' call above can be removed, for same reason.

When port representor support added to driver, following check also may be added 
since new representator types are added recently.

         if (eth_da.type != RTE_ETH_REPRESENTOR_VF)
               return -ENOTSUP;

> +
> +	pf_ethdev = rte_eth_dev_allocated(pci_dev->device.name);
> +	if (pf_ethdev == NULL)
> +		return -ENODEV;
> +

Also above part can be removed completely, pf_ethdev is get to use in the 
existance of the port representor, no need to get it now.

> +	return 0;
> +}
> +
> +static int eth_ngbe_pci_remove(struct rte_pci_device *pci_dev)
> +{
> +	struct rte_eth_dev *ethdev;
> +
> +	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
> +	if (!ethdev)
> +		return -ENODEV;

This is not an error case, you can return success (0) here.

Same applies to txgbe too.

  reply	other threads:[~2021-04-09 14:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06  9:30 [dpdk-dev] [PATCH v4 0/6] net: ngbe PMD Jiawen Wu
2021-04-06  9:30 ` [dpdk-dev] [PATCH v4 1/6] net/ngbe: add build and doc infrastructure Jiawen Wu
2021-04-09 14:37   ` Ferruh Yigit
2021-04-12  6:33     ` Jiawen Wu
2021-04-06  9:30 ` [dpdk-dev] [PATCH v4 2/6] net/ngbe: add device IDs Jiawen Wu
2021-04-09 14:37   ` Ferruh Yigit
2021-04-06  9:30 ` [dpdk-dev] [PATCH v4 3/6] net/ngbe: support probe and remove Jiawen Wu
2021-04-09 14:40   ` Ferruh Yigit [this message]
2021-04-06  9:30 ` [dpdk-dev] [PATCH v4 4/6] net/ngbe: add device init and uninit Jiawen Wu
2021-04-06  9:30 ` [dpdk-dev] [PATCH v4 5/6] net/ngbe: add log type and error type Jiawen Wu
2021-04-06  9:30 ` [dpdk-dev] [PATCH v4 6/6] net/ngbe: define registers Jiawen Wu
2021-04-09 14:47 ` [dpdk-dev] [PATCH v4 0/6] net: ngbe PMD Ferruh Yigit
2021-04-29 10:52   ` Jiawen Wu
2021-04-29 11:21     ` Ferruh Yigit

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=fec94228-17b4-1850-d14a-319ade56dfd3@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=jiawenwu@trustnetic.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 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).