DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/3] eal: PCI domain should be 32 bits
Date: Thu, 22 Jun 2017 09:23:41 -0700	[thread overview]
Message-ID: <20170622092341.7e1544c2@xeon-e3> (raw)
In-Reply-To: <3793478.bOXkPGkn7S@xps>

On Thu, 22 Jun 2017 18:05:42 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> 22/06/2017 17:56, Stephen Hemminger:
> > 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>
> > ---  
> [...]
> > --- a/lib/librte_eal/common/include/rte_pci.h
> > +++ b/lib/librte_eal/common/include/rte_pci.h
> > @@ -63,7 +63,7 @@ const char *pci_get_sysfs_path(void);
> >  
> >  /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
> >  #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> > -#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
> > +#define PCI_PRI_STR_SIZE sizeof("XXXXXXXX:XX:XX.X")  
> 
> I think you need to change PCI_PRI_FMT accordingly.

No. I don't want all outputs to have extra leading zeros on other platforms
The existing format works:

Example:
--- cut here ---

struct rte_pci_addr {
	uint32_t domain;                /**< Device domain */
	uint8_t bus;                    /**< Device bus */
	uint8_t devid;                  /**< Device ID */
	uint8_t function;               /**< Device function. */
};

#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8

int main(void)
{
	struct rte_pci_addr pci_addr = { 0, 5, 0, 0 };

	printf(PCI_PRI_FMT "\n",
		       pci_addr.domain,
		       pci_addr.bus, pci_addr.devid,
		       pci_addr.function);

	pci_addr.domain = 0xdeadbeef;
	
	printf(PCI_PRI_FMT "\n",
		       pci_addr.domain,
		       pci_addr.bus, pci_addr.devid,
		       pci_addr.function);
	
	return 0;
}

--- output ---
0000:05:00.0
deadbeef:05:00.0

  reply	other threads:[~2017-06-22 16:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 15:56 [dpdk-dev] [PATCH v2 0/3] 32 bit PCI domain support Stephen Hemminger
2017-06-22 15:56 ` [dpdk-dev] [PATCH v2 1/3] pci: remove unnecessary casts from strtoul Stephen Hemminger
2017-06-22 15:56 ` [dpdk-dev] [PATCH v2 2/3] eal: PCI domain should be 32 bits Stephen Hemminger
2017-06-22 16:05   ` Thomas Monjalon
2017-06-22 16:23     ` Stephen Hemminger [this message]
2017-06-22 15:56 ` [dpdk-dev] [PATCH v2 3/3] mlx5: handle 32 bit PCI domain Stephen Hemminger
2017-06-22 16:17   ` Thomas Monjalon
2017-06-22 16:41     ` Stephen Hemminger
2017-06-22 16:42     ` Stephen Hemminger
2017-06-22 17:04       ` Thomas Monjalon

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=20170622092341.7e1544c2@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=sthemmin@microsoft.com \
    --cc=thomas@monjalon.net \
    /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).