DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nick Connolly <nick.connolly@mayadata.io>
To: Tal Shnaiderman <talshn@nvidia.com>,
	"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: Tue, 26 Jan 2021 18:18:32 +0000	[thread overview]
Message-ID: <ee5d1820-e490-6e63-abe7-a1cca2117212@mayadata.io> (raw)
In-Reply-To: <DM6PR12MB3945CF6872F465C48D9BAAE3A4BC9@DM6PR12MB3945.namprd12.prod.outlook.com>

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.

Thanks,
Nick

  reply	other threads:[~2021-01-26 18:18 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 [this message]
2021-01-26 22:41     ` Thomas Monjalon
2021-01-27 14:22       ` Nick Connolly
2021-01-27 15:13     ` Tal Shnaiderman
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=ee5d1820-e490-6e63-abe7-a1cca2117212@mayadata.io \
    --to=nick.connolly@mayadata.io \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=pallavi.kadam@intel.com \
    --cc=talshn@nvidia.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).