netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Nelson <snelson@pensando.io>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: Shannon Nelson <snelson@pensando.io>
Subject: [PATCH v2 net-next 5/5] ionic: add lif_quiesce to wait for queue activity to stop
Date: Mon, 30 Sep 2019 14:49:20 -0700	[thread overview]
Message-ID: <20190930214920.18764-6-snelson@pensando.io> (raw)
In-Reply-To: <20190930214920.18764-1-snelson@pensando.io>

Even though we've already turned off the queue activity with
the ionic_qcq_disable(), we need to wait for any device queues
that are processing packets to drain down before we try to
flush our packets and tear down the queues.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 372329389c84..fc4ab73bd608 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -242,6 +242,29 @@ static int ionic_qcq_disable(struct ionic_qcq *qcq)
 	return ionic_adminq_post_wait(lif, &ctx);
 }
 
+static int ionic_lif_quiesce(struct ionic_lif *lif)
+{
+	int err;
+	struct device *dev = lif->ionic->dev;
+	struct ionic_admin_ctx ctx = {
+		.work = COMPLETION_INITIALIZER_ONSTACK(ctx.work),
+		.cmd.lif_setattr = {
+			.opcode = IONIC_CMD_LIF_SETATTR,
+			.attr = IONIC_LIF_ATTR_STATE,
+			.index = lif->index,
+			.state = IONIC_LIF_DISABLE
+		},
+	};
+
+	err = ionic_adminq_post_wait(lif, &ctx);
+	if (err) {
+		dev_err(dev, "failed to quiesce lif, error = %d\n", err);
+		return err;
+	}
+
+	return (0);
+}
+
 static void ionic_lif_qcq_deinit(struct ionic_lif *lif, struct ionic_qcq *qcq)
 {
 	struct ionic_dev *idev = &lif->ionic->idev;
@@ -1589,6 +1612,7 @@ int ionic_stop(struct net_device *netdev)
 	netif_tx_disable(netdev);
 
 	ionic_txrx_disable(lif);
+	ionic_lif_quiesce(lif);
 	ionic_txrx_deinit(lif);
 	ionic_txrx_free(lif);
 
-- 
2.17.1


  parent reply	other threads:[~2019-09-30 21:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30 21:49 [PATCH v2 net-next 0/5] ionic: driver updates Shannon Nelson
2019-09-30 21:49 ` [PATCH v2 net-next 1/5] ionic: simplify returns in devlink info Shannon Nelson
2019-09-30 23:26   ` Jakub Kicinski
2019-09-30 21:49 ` [PATCH v2 net-next 2/5] ionic: use wait_on_bit_lock() rather than open code Shannon Nelson
2019-09-30 23:27   ` Jakub Kicinski
2019-09-30 21:49 ` [PATCH v2 net-next 3/5] ionic: report users coalesce request Shannon Nelson
2019-09-30 21:49 ` [PATCH v2 net-next 4/5] ionic: implement ethtool set-fec Shannon Nelson
2019-09-30 21:49 ` Shannon Nelson [this message]
2019-09-30 23:32   ` [PATCH v2 net-next 5/5] ionic: add lif_quiesce to wait for queue activity to stop Jakub Kicinski
2019-09-30 23:48 ` [PATCH v2 net-next 0/5] ionic: driver updates David Miller
2019-10-01  1:54   ` Shannon Nelson

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=20190930214920.18764-6-snelson@pensando.io \
    --to=snelson@pensando.io \
    --cc=davem@davemloft.net \
    --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).