From: Andrew Lunn <andrew@lunn.ch>
To: Dimitris Michailidis <d.michailidis@fungible.com>
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 2/8] net/fungible: Add service module for Fungible drivers
Date: Thu, 30 Dec 2021 20:00:22 +0100 [thread overview]
Message-ID: <Yc4Bxu8f9S5w3VsM@lunn.ch> (raw)
In-Reply-To: <CAOkoqZnoOgGDGcnDeOQxjZ_eYh8eyFHK_E+w7E6QHWAvaembKw@mail.gmail.com>
On Thu, Dec 30, 2021 at 10:24:10AM -0800, Dimitris Michailidis wrote:
> On Thu, Dec 30, 2021 at 9:28 AM Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > > +/* Wait for the CSTS.RDY bit to match @enabled. */
> > > +static int fun_wait_ready(struct fun_dev *fdev, bool enabled)
> > > +{
> > > + unsigned int cap_to = NVME_CAP_TIMEOUT(fdev->cap_reg);
> > > + unsigned long timeout = ((cap_to + 1) * HZ / 2) + jiffies;
> > > + u32 bit = enabled ? NVME_CSTS_RDY : 0;
> >
> > Reverse Christmas tree, since this is a network driver.
>
> The longer line in the middle depends on the previous line, I'd need to
> remove the initializers to sort these by length.
Yes.
> > Please also consider using include/linux/iopoll.h. The signal handling
> > might make that not possible, but signal handling in driver code is in
> > itself very unusual.
>
> This initialization is based on NVMe, hence the use of NVMe registers,
> and this function is based on nvme_wait_ready(). The check sequence
> including signal handling comes from there.
>
> iopoll is possible with the signal check removed, though I see I'd need a
> shorter delay than the 100ms used here and it doesn't check for reads of
> all 1s, which happen occasionally. My preference though would be to keep
> this close to the NVMe version. Let me know.
I knew it would be hard to directly use iopoll, which is why i only
said 'consider'. The problem is, this implementation has the same bug
nearly everybody makes when writing their own implementation of what
iopoll does, which is why i always point people at iopoll.
msleep(100) guarantees that it will not return within 100ms. That is
all. Consider what happens when msleep(100) actually sleeps for
1000.
Andrew
next prev parent reply other threads:[~2021-12-30 19:00 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-30 16:39 [PATCH net-next 0/8] new Fungible Ethernet driver Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 1/8] PCI: add Fungible vendor ID to pci_ids.h Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 2/8] net/fungible: Add service module for Fungible drivers Dimitris Michailidis
2021-12-30 17:28 ` Andrew Lunn
2021-12-30 18:24 ` Dimitris Michailidis
2021-12-30 19:00 ` Andrew Lunn [this message]
2021-12-30 20:13 ` Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 3/8] net/funeth: probing and netdev ops Dimitris Michailidis
2021-12-30 17:40 ` Andrew Lunn
2021-12-30 18:33 ` Dimitris Michailidis
2021-12-30 19:02 ` Andrew Lunn
2021-12-30 20:05 ` Dimitris Michailidis
2021-12-31 11:14 ` Heiner Kallweit
2022-01-03 22:11 ` Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 4/8] net/funeth: ethtool operations Dimitris Michailidis
2021-12-30 18:04 ` Andrew Lunn
2021-12-30 20:22 ` Jakub Kicinski
2021-12-30 20:30 ` Dimitris Michailidis
2021-12-30 20:43 ` Jakub Kicinski
2021-12-30 20:56 ` Dimitris Michailidis
2021-12-30 20:27 ` Dimitris Michailidis
2021-12-30 22:25 ` Andrew Lunn
2021-12-31 1:23 ` Dimitris Michailidis
2021-12-31 2:24 ` Andrew Lunn
2021-12-31 3:23 ` Dimitris Michailidis
2021-12-30 20:28 ` Jakub Kicinski
2021-12-30 20:31 ` Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 5/8] net/funeth: devlink support Dimitris Michailidis
2021-12-30 17:41 ` Jakub Kicinski
2021-12-30 16:39 ` [PATCH net-next 6/8] net/funeth: add the data path Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 7/8] net/funeth: add kTLS TX control part Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 8/8] net/fungible: Kconfig, Makefiles, and MAINTAINERS Dimitris Michailidis
2021-12-30 17:43 ` Jakub Kicinski
2021-12-30 20:54 ` Dimitris Michailidis
2021-12-30 21:16 ` Dimitris Michailidis
2021-12-30 22:17 ` Jakub Kicinski
2021-12-30 22:27 ` Andrew Lunn
2021-12-30 22:59 ` Dimitris Michailidis
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=Yc4Bxu8f9S5w3VsM@lunn.ch \
--to=andrew@lunn.ch \
--cc=d.michailidis@fungible.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/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).