DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Chang, Cunyin" <cunyin.chang@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [dpdk-dev] [PATCH 2/3] eal: PCI domain should be 32 bits
Date: Thu, 22 Jun 2017 09:28:31 +0000	[thread overview]
Message-ID: <2BFA8F2383C3784C90698C10BC0963195EEEF678@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20170621163545.25713-3-stephen@networkplumber.org>

I think the series patches does not cover all area which need to adapt to u32 PCI domain,
We still need some other work to do:
we need define another macro such as PCI_PRI_FMT. Something like:
#define PCI_XXX_PRI_FMT "%.5" PRIx32 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8

PCI_PRI_STR_SIZE also need to be modified:
#define PCI_PRI_STR_SIZE sizeof("XXXXX:XX:XX.X")

The macro PCI_PRI_FMT will not works if
The domain exceed 16bits. It will impact the following functions:
1  RTE_LOG function, there a lots of RTE_LOG such as:
RTE_LOG(WARNING, EAL,
			"Requested device " PCI_PRI_FMT " cannot be used\n",
			addr->domain, addr->bus, addr->devid, addr->function);
2  pci_dump_one_device().
3 rte_eal_pci_device_name()
4 pci_update_device()
5 pci_ioport_map()
6 pci_get_uio_dev()
7 pci_uio_map_resource_by_index()
8 pci_uio_ioport_map()
9 pci_vfio_map_resource()
10 pci_vfio_unmap_resource()
All the above functions will related with the macro PCI_PRI_FMT, so I think they need to be modified too.

There are some other code need modify:
In function rte_eal_compare_pci_addr(), we need do the following work:
dev_addr = ((uint64_t)addr->domain << 24) | ((uint64_t)addr->bus << 16) |
				((uint64_t)addr->devid << 8) | (uint64_t)addr->function;
dev_addr2 = ((uint64_t)addr2->domain << 24) | ((uint64_t)addr2->bus << 16) |
				((uint64_t)addr2->devid << 8) | (uint64_t)addr2->function;

In function eal_parse_pci_BDF(), we need do the following work:
GET_PCIADDR_FIELD(input, dev_addr->domain, UINT32_MAX, ':');

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Thursday, June 22, 2017 12:36 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Stephen
> Hemminger <sthemmin@microsoft.com>
> Subject: [dpdk-dev] [PATCH 2/3] eal: PCI domain should be 32 bits
> 
> In some environments, the PCI domain can be larger than 16 bits.
> For example, a PCI device passed through in Azure gets a synthetic domain id
> which is internally generated based on GUID. The PCI standard does not
> restrict domain to be 16 bits.
> 
> This change breaks ABI for API's that expose PCI address structure.
> 
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> ---
>  lib/librte_eal/common/include/rte_pci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_pci.h
> b/lib/librte_eal/common/include/rte_pci.h
> index 0284a6208aa5..8b549aadfbe6 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -112,7 +112,7 @@ struct rte_pci_id {
>   * A structure describing the location of a PCI device.
>   */
>  struct rte_pci_addr {
> -	uint16_t domain;                /**< Device domain */
> +	uint32_t domain;                /**< Device domain */
>  	uint8_t bus;                    /**< Device bus */
>  	uint8_t devid;                  /**< Device ID */
>  	uint8_t function;               /**< Device function. */
> --
> 2.11.0

  reply	other threads:[~2017-06-22  9:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 16:35 [dpdk-dev] [PATCH 0/3] 32 bit PCI domain patches Stephen Hemminger
2017-06-21 16:35 ` [dpdk-dev] [PATCH 1/3] pci: remove unnecessary casts from strtoul Stephen Hemminger
2017-06-21 16:35 ` [dpdk-dev] [PATCH 2/3] eal: PCI domain should be 32 bits Stephen Hemminger
2017-06-22  9:28   ` Chang, Cunyin [this message]
2017-06-22 15:51     ` Stephen Hemminger
2017-06-23  0:41       ` Chang, Cunyin
2017-06-23 17:47         ` Stephen Hemminger
2017-06-26  4:29           ` Chang, Cunyin
2017-06-21 16:35 ` [dpdk-dev] [PATCH 3/3] mlx5: handle 32 bit PCI domain Stephen Hemminger

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=2BFA8F2383C3784C90698C10BC0963195EEEF678@SHSMSX103.ccr.corp.intel.com \
    --to=cunyin.chang@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=sthemmin@microsoft.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).