netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 18:28:12 +0100	[thread overview]
Message-ID: <Yc3sLEjF6O1CaMZZ@lunn.ch> (raw)
In-Reply-To: <20211230163909.160269-3-dmichail@fungible.com>

> +/* 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.

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.

> +
> +	do {
> +		u32 csts = readl(fdev->bar + NVME_REG_CSTS);
> +
> +		if (csts == ~0) {
> +			dev_err(fdev->dev, "CSTS register read %#x\n", csts);
> +			return -EIO;
> +		}
> +
> +		if ((csts & NVME_CSTS_RDY) == bit)
> +			return 0;
> +
> +		msleep(100);
> +		if (fatal_signal_pending(current))
> +			return -EINTR;
> +	} while (time_is_after_eq_jiffies(timeout));
> +
> +	dev_err(fdev->dev,
> +		"Timed out waiting for device to indicate RDY %u; aborting %s\n",
> +		enabled, enabled ? "initialization" : "reset");
> +	return -ETIMEDOUT;
> +}

  Andrew

  reply	other threads:[~2021-12-30 17:28 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 [this message]
2021-12-30 18:24     ` Dimitris Michailidis
2021-12-30 19:00       ` Andrew Lunn
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=Yc3sLEjF6O1CaMZZ@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).