netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Nelson <shannon.nelson@amd.com>
To: <netdev@vger.kernel.org>, <davem@davemloft.net>, <kuba@kernel.org>
Cc: <drivers@pensando.io>, Neel Patel <neel.patel@amd.com>,
	Shannon Nelson <shannon.nelson@amd.com>
Subject: [PATCH net 4/6] ionic: clean interrupt before enabling queue to avoid credit race
Date: Wed, 1 Feb 2023 17:30:00 -0800	[thread overview]
Message-ID: <20230202013002.34358-5-shannon.nelson@amd.com> (raw)
In-Reply-To: <20230202013002.34358-1-shannon.nelson@amd.com>

From: Neel Patel <neel.patel@amd.com>

Clear the interrupt credits before enabling the queue rather
than after to be sure that the enabled queue starts at 0 and
that we don't wipe away possible credits after enabling the
queue.

Fixes: 0f3154e6bcb3 ("ionic: Add Tx and Rx handling")
Signed-off-by: Neel Patel <neel.patel@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/pensando/ionic/ionic_lif.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index c08d0762212c..90a3ad4a6ea0 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -269,6 +269,7 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq)
 			.oper = IONIC_Q_ENABLE,
 		},
 	};
+	int ret;
 
 	idev = &lif->ionic->idev;
 	dev = lif->ionic->dev;
@@ -276,16 +277,24 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq)
 	dev_dbg(dev, "q_enable.index %d q_enable.qtype %d\n",
 		ctx.cmd.q_control.index, ctx.cmd.q_control.type);
 
+	if (qcq->flags & IONIC_QCQ_F_INTR)
+		ionic_intr_clean(idev->intr_ctrl, qcq->intr.index);
+
+	ret = ionic_adminq_post_wait(lif, &ctx);
+	if (ret)
+		return ret;
+
+	if (qcq->napi.poll)
+		napi_enable(&qcq->napi);
+
 	if (qcq->flags & IONIC_QCQ_F_INTR) {
 		irq_set_affinity_hint(qcq->intr.vector,
 				      &qcq->intr.affinity_mask);
-		napi_enable(&qcq->napi);
-		ionic_intr_clean(idev->intr_ctrl, qcq->intr.index);
 		ionic_intr_mask(idev->intr_ctrl, qcq->intr.index,
 				IONIC_INTR_MASK_CLEAR);
 	}
 
-	return ionic_adminq_post_wait(lif, &ctx);
+	return 0;
 }
 
 static int ionic_qcq_disable(struct ionic_lif *lif, struct ionic_qcq *qcq, int fw_err)
-- 
2.17.1


  parent reply	other threads:[~2023-02-02  1:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02  1:29 [PATCH net 0/6] ionic: code maintenance Shannon Nelson
2023-02-02  1:29 ` [PATCH net 1/6] ionic: remove unnecessary indirection Shannon Nelson
2023-02-02  8:43   ` Leon Romanovsky
2023-02-02  1:29 ` [PATCH net 2/6] ionic: remove unnecessary void casts Shannon Nelson
2023-02-02  8:43   ` Leon Romanovsky
2023-02-02  1:29 ` [PATCH net 3/6] ionic: add check for NULL t/rxqcqs in reconfig Shannon Nelson
2023-02-02  8:44   ` Leon Romanovsky
2023-02-02 18:05   ` Jakub Kicinski
2023-02-02 20:06     ` Shannon Nelson
2023-02-02 20:46       ` Jakub Kicinski
2023-02-02 20:55         ` Shannon Nelson
2023-02-02  1:30 ` Shannon Nelson [this message]
2023-02-02  8:46   ` [PATCH net 4/6] ionic: clean interrupt before enabling queue to avoid credit race Leon Romanovsky
2023-02-02  1:30 ` [PATCH net 5/6] ionic: clear up notifyq alloc commentary Shannon Nelson
2023-02-02  8:46   ` Leon Romanovsky
2023-02-02  1:30 ` [PATCH net 6/6] ionic: missed doorbell workaround 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=20230202013002.34358-5-shannon.nelson@amd.com \
    --to=shannon.nelson@amd.com \
    --cc=davem@davemloft.net \
    --cc=drivers@pensando.io \
    --cc=kuba@kernel.org \
    --cc=neel.patel@amd.com \
    --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).