All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Nelson <snelson@pensando.io>
To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org
Cc: drivers@pensando.io, Shannon Nelson <snelson@pensando.io>,
	Allen Hubbe <allenbh@pensando.io>
Subject: [PATCH net-next 04/12] ionic: split adminq post and wait calls
Date: Thu,  1 Apr 2021 10:56:02 -0700	[thread overview]
Message-ID: <20210401175610.44431-5-snelson@pensando.io> (raw)
In-Reply-To: <20210401175610.44431-1-snelson@pensando.io>

Split the wait part out of adminq_post_wait() into a separate
function so that a caller can have finer grain control over
the sequencing of operations and locking.

Signed-off-by: Allen Hubbe <allenbh@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 drivers/net/ethernet/pensando/ionic/ionic.h      |  2 ++
 drivers/net/ethernet/pensando/ionic/ionic_main.c | 15 +++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h
index 084a924431d5..18e92103c711 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic.h
+++ b/drivers/net/ethernet/pensando/ionic/ionic.h
@@ -64,6 +64,8 @@ struct ionic_admin_ctx {
 	union ionic_adminq_comp comp;
 };
 
+int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
+int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int err);
 int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
 int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
 int ionic_set_dma_mask(struct ionic *ionic);
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
index c4b2906a2ae6..8c27fbe0e312 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
@@ -256,7 +256,7 @@ static void ionic_adminq_cb(struct ionic_queue *q,
 	complete_all(&ctx->work);
 }
 
-static int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
+int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
 {
 	struct ionic_desc_info *desc_info;
 	unsigned long irqflags;
@@ -295,14 +295,12 @@ static int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
 	return err;
 }
 
-int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
+int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int err)
 {
 	struct net_device *netdev = lif->netdev;
 	unsigned long remaining;
 	const char *name;
-	int err;
 
-	err = ionic_adminq_post(lif, ctx);
 	if (err) {
 		if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) {
 			name = ionic_opcode_to_str(ctx->cmd.cmd.opcode);
@@ -317,6 +315,15 @@ int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
 	return ionic_adminq_check_err(lif, ctx, (remaining == 0));
 }
 
+int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
+{
+	int err;
+
+	err = ionic_adminq_post(lif, ctx);
+
+	return ionic_adminq_wait(lif, ctx, err);
+}
+
 static void ionic_dev_cmd_clean(struct ionic *ionic)
 {
 	union __iomem ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs;
-- 
2.17.1


  parent reply	other threads:[~2021-04-01 19:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01 17:55 [PATCH net-next 00/12] ionic: add PTP and hw clock support Shannon Nelson
2021-04-01 17:55 ` [PATCH net-next 01/12] ionic: add new queue features to interface Shannon Nelson
2021-04-01 17:56 ` [PATCH net-next 02/12] ionic: add handling of larger descriptors Shannon Nelson
2021-04-04 22:50   ` Richard Cochran
2021-04-05 16:17     ` Shannon Nelson
2021-04-01 17:56 ` [PATCH net-next 03/12] ionic: add hw timestamp structs to interface Shannon Nelson
2021-04-01 17:56 ` Shannon Nelson [this message]
2021-04-01 17:56 ` [PATCH net-next 05/12] ionic: add hw timestamp support files Shannon Nelson
2021-04-04 23:05   ` Richard Cochran
2021-04-05  4:53     ` Leon Romanovsky
2021-04-05 16:16     ` Shannon Nelson
2021-04-05 18:17       ` Richard Cochran
2021-04-06 23:18         ` Shannon Nelson
2021-04-07  0:27           ` Richard Cochran
2021-04-07  4:55             ` Shannon Nelson
2021-04-04 23:21   ` Richard Cochran
2021-04-05 16:19     ` Shannon Nelson
2021-04-01 17:56 ` [PATCH net-next 06/12] ionic: link in the new hw timestamp code Shannon Nelson
2021-04-01 17:56 ` [PATCH net-next 07/12] ionic: add rx filtering for hw timestamp steering Shannon Nelson
2021-04-01 17:56 ` [PATCH net-next 08/12] ionic: set up hw timestamp queues Shannon Nelson
2021-04-01 17:56 ` [PATCH net-next 09/12] ionic: add and enable tx and rx timestamp handling Shannon Nelson
2021-04-04 23:41   ` Richard Cochran
2021-04-05 16:28     ` Shannon Nelson
2021-04-05 18:20       ` Richard Cochran
2021-04-06 23:06         ` Shannon Nelson
2021-04-07  0:29           ` Richard Cochran
2021-04-01 17:56 ` [PATCH net-next 10/12] ionic: add ethtool support for PTP Shannon Nelson
2021-04-01 17:56 ` [PATCH net-next 11/12] ionic: ethtool ptp stats Shannon Nelson
2021-04-01 17:56 ` [PATCH net-next 12/12] ionic: advertise support for hardware timestamps Shannon Nelson
2021-04-04 23:43   ` Richard Cochran
2021-04-05 16:33     ` Shannon Nelson
2021-04-05 18:23       ` Richard Cochran
2021-04-01 21:02 ` [PATCH net-next 00/12] ionic: add PTP and hw clock support Andrew Lunn
2021-04-01 21:11   ` Shannon Nelson
2021-04-02 21:30 ` patchwork-bot+netdevbpf

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=20210401175610.44431-5-snelson@pensando.io \
    --to=snelson@pensando.io \
    --cc=allenbh@pensando.io \
    --cc=davem@davemloft.net \
    --cc=drivers@pensando.io \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.