DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tal Shnaiderman <talshn@nvidia.com>
To: Nick Connolly <nick.connolly@mayadata.io>,
	"dmitry.kozliuk@gmail.com" <dmitry.kozliuk@gmail.com>,
	"pallavi.kadam@intel.com" <pallavi.kadam@intel.com>,
	NBU-Contact-Thomas Monjalon <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] bus/pci: nvme on Windows requires class id and bus
Date: Wed, 27 Jan 2021 15:13:35 +0000
Message-ID: <DM6PR12MB39454497184512CC9C13C639A4BB9@DM6PR12MB3945.namprd12.prod.outlook.com> (raw)
In-Reply-To: <ee5d1820-e490-6e63-abe7-a1cca2117212@mayadata.io>

> Subject: Re: [PATCH] bus/pci: nvme on Windows requires class id and bus
> 
> External email: Use caution opening links or attachments
> 
> 
> Hi Tal,
> 
> Thanks for the comments.
> 
> >> +       /* Try and find PCI class ID */
> >> +       for (cp = buf; !(cp[0] == 0 && cp[1] == 0); cp++)
> > How about
> > for (cp = buf; cp[0] || cp[1]; cp++)
> That would be my preferred idiom, but the DPDK coding style (1.9.1) says 'do
> not use ! for tests unless it is a boolean' (but somewhat confusingly does so
> in a section on NULL pointers).  I interpreted it as a general prohibition on
> conditionals without an explicit operator (except for booleans).  I'd love to be
> corrected here!
> 
> >> +               if (*cp == '&' && sscanf_s(cp, "&CC_%" PRIx32,
> >> + &class_id) == 1)
> > Could there be a case where PCI\\VEN_v(4)&DEV_d(4)&CC_c(2)s(2) exist
> but PCI\\VEN_v(4)&DEV_d(4)&CC_c(2)s(2)p(2) doesn't? In that case the
> parsing would be incorrect.
> The MSDN documentation says that the most specific string will be returned
> first, in this case &CC_c(2)s(2)p(2), so if there is a 6-digit class ID we will
> return it.  That left me wondering what to do if we only encounter a 4-digit
> class ID.  If we ignore it, then we won't be able to match on the class ID.  We
> could parse it as 4-digits and supply zero for the p(2) field, but that left me
> wondering why Windows wouldn't have already done that for us.  What I see
> on my own systems is that there is always a 6-digit class ID defined, even if
> the pci-ids repository doesn't list any values for p(2) (e.g.
> https://pci-ids.ucw.cz/read/PD/07/80 reports as &CC_078000).
> 
> My conclusion was that was probably best just to return the first class ID that
> Windows reports even if it's only 4-digits.  That way the device can still be
> found and will match the CC_ info displayed in device manager.

I'd shift the class_id value to the right in case the returned value is 4 digit, just to verify the result would be "c(2)s(2) 0" and not "0 s(2)p(2)", however when testing your change I couldn't find a case where only 4 digits matched.

Either than that LGTM.
> 
> Thanks,
> Nick

  parent reply	other threads:[~2021-01-27 15:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 17:08 Nick Connolly
2021-01-26 17:45 ` Tal Shnaiderman
2021-01-26 18:18   ` Nick Connolly
2021-01-26 22:41     ` Thomas Monjalon
2021-01-27 14:22       ` Nick Connolly
2021-01-27 15:13     ` Tal Shnaiderman [this message]
2021-01-28 17:00 ` [dpdk-dev] [PATCH v2] " Nick Connolly
2021-01-28 17:04 ` [dpdk-dev] [PATCH v3] " Nick Connolly
2021-01-31 15:56   ` Tal Shnaiderman
2021-02-02 13:07     ` Nick Connolly
2021-02-02 13:44 ` [dpdk-dev] [PATCH v4] " Nick Connolly
2021-02-02 13:54 ` [dpdk-dev] [PATCH v5] " Nick Connolly
2021-02-02 14:04   ` Tal Shnaiderman
2021-02-23 18:18 ` [dpdk-dev] [PATCH v6] " Nick Connolly
2021-02-28 14:38   ` Dmitry Kozlyuk
2021-03-01  9:24     ` Nick Connolly
2021-03-01  9:56 ` [dpdk-dev] [PATCH v7] " Nick Connolly
2021-03-16 13:45   ` 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=DM6PR12MB39454497184512CC9C13C639A4BB9@DM6PR12MB3945.namprd12.prod.outlook.com \
    --to=talshn@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=nick.connolly@mayadata.io \
    --cc=pallavi.kadam@intel.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git