From: Lukas Wunner <lukas@wunner.de>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
linux-pci@vger.kernel.org,
Gregory Price <gregory.price@memverge.com>,
Ira Weiny <ira.weiny@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
"Li, Ming" <ming4.li@intel.com>,
linux-cxl@vger.kernel.org
Subject: Re: [PATCH 2/2] PCI/DOE: Provide synchronous API
Date: Sat, 3 Dec 2022 14:51:50 +0100 [thread overview]
Message-ID: <20221203135150.GA22097@wunner.de> (raw)
In-Reply-To: <20221130153330.000049b3@Huawei.com>
On Wed, Nov 30, 2022 at 03:33:30PM +0000, Jonathan Cameron wrote:
> On Mon, 28 Nov 2022 05:25:52 +0100 Lukas Wunner <lukas@wunner.de> wrote:
> > + * NOTE there is no need for the caller to initialize work or doe_mb.
>
> Cut and paste from original, but what's the "caller" of a struct? I'd just
> drop this NOTE as it's better explained below.
Okay, will drop this note when respinning, it just duplicates the
code comment inside the pci_doe_task declaration.
> > struct pci_doe_mb *pcim_doe_create_mb(struct pci_dev *pdev, u16 cap_offset);
> > bool pci_doe_supports_prot(struct pci_doe_mb *doe_mb, u16 vid, u8 type);
> > -int pci_doe_submit_task(struct pci_doe_mb *doe_mb, struct pci_doe_task *task);
> > +int pci_doe(struct pci_doe_mb *doe_mb, u16 vendor, u8 type,
>
> Whilst there is clearly a verb hidden in that doe, the fact that the
> whole spec section is called the same is confusing.
>
> pci_doe_query_response() maybe or pci_doe_do() perhaps?
Going forward the PCI core will allocate DOE mailboxes on device
enumeration. And the API will then consist of just two calls:
One call to get a pointer to a pci_doe_mb for a (pci_dev, vendor, protocol)
triple which I intend to call pci_find_doe_mailbox().
And one call to perform a synchronous query/response over a pci_doe_mb.
That's the pci_doe() I'm introducing here.
I initially went for pci_doe_exchange(), then realized that the "e" in
"doe" already stands for "exchange", so that would be redundant.
We generally try to use the same terms as the PCIe Base Spec to make it
easy for an uninitiated reader to connect the spec to the implementation.
The spec talks about "performing data object exchanges", but
pci_doe_perform() didn't seem very appealing to me.
I ended up just using pci_doe() for simplicity and because it makes it
easy to stay within 80 chars if the function name is short.
Passing in the request and response pointers directly instead of
populating a struct is likewise an attempt to make things as simple
as possible for driver authors. It's modeled after the SPI and I2C
APIs which offer similar primitives to perform read/write exchanges
with devices.
(Side note: pci_find_doe_mailbox() will return the *first* mailbox found
for a given (pci_dev, vendor, protocol) triple. Conceivably, there may
be devices with multiple mailboxes supporting the same protocols. We may
have to add a pci_find_next_doe_mailbox(), should such devices appear.
Those names match what we already have for capabilities, i.e.
pci_find_ext_capability() and pci_find_next_ext_capability().)
Thanks,
Lukas
prev parent reply other threads:[~2022-12-03 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 4:15 [PATCH 0/2] DOE WARN splat be gone Lukas Wunner
2022-11-28 4:25 ` [PATCH 1/2] PCI/DOE: Silence WARN splat upon task submission Lukas Wunner
2022-11-30 15:36 ` Jonathan Cameron
2022-11-30 18:52 ` Ira Weiny
2022-11-28 4:25 ` [PATCH 2/2] PCI/DOE: Provide synchronous API Lukas Wunner
2022-11-30 15:33 ` Jonathan Cameron
2022-11-30 18:50 ` Ira Weiny
2022-12-03 13:51 ` Lukas Wunner [this message]
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=20221203135150.GA22097@wunner.de \
--to=lukas@wunner.de \
--cc=Jonathan.Cameron@Huawei.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=gregory.price@memverge.com \
--cc=helgaas@kernel.org \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=ming4.li@intel.com \
--cc=vishal.l.verma@intel.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