DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Elena Agostini <eagostini@nvidia.com>
Cc: dev@dpdk.org, stable@dpdk.org, david.marchand@redhat.com,
	bingz@nvidia.com
Subject: Re: [PATCH v1] bus/pci: get PCI address from rte_device
Date: Tue, 30 May 2023 15:47:37 +0200	[thread overview]
Message-ID: <11314359.MucGe3eQFb@thomas> (raw)
In-Reply-To: <20230530114202.850814-1-eagostini@nvidia.com>

30/05/2023 13:42, eagostini@nvidia.com:
> This patch introduces a get function to retrieve a PCI address
> from an rte_device handler.
[...]
> +const struct rte_pci_addr *
> +rte_pci_get_addr(const struct rte_device *dev)
> +{
> +	const struct rte_pci_device *pci_dev;
> +
> +	if (!dev) {

Please compare pointer with == NULL

> +		rte_errno = EINVAL;
> +		return NULL;
> +	}

Can we check the bus type here?

> +
> +	pci_dev = RTE_DEV_TO_PCI_CONST(dev);
> +
> +	return &pci_dev->addr;
> +}
[...]
> +/**
> + * Return PCI device address of an rte_device

You can replace rte_device with "generic device" and add a dot :)

> + *
> + * @param dev
> + *   A pointer to a rte_device structure describing the device
> + *   to use

Do it simpler: pointer to the generic device structure.

> + *
> + * @return
> + *   PCI address of the device on success, NULL if no driver
> + *   is found for the device.

Not exactly, it can return NULL if the device is not PCI.

> + */
> +const struct rte_pci_addr * rte_pci_get_addr(const struct rte_device *dev);




  reply	other threads:[~2023-05-30 13:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 11:42 eagostini
2023-05-30 13:47 ` Thomas Monjalon [this message]
2023-05-31  8:03 ` David Marchand
2023-05-31  8:44   ` Elena Agostini
2023-05-31  8:47     ` David Marchand
2023-05-31  8:51       ` Elena Agostini
2023-05-31  9:52         ` David Marchand
2023-10-18 11:00           ` David Marchand

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=11314359.MucGe3eQFb@thomas \
    --to=thomas@monjalon.net \
    --cc=bingz@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=eagostini@nvidia.com \
    --cc=stable@dpdk.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).