mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abhijit Gangurde <abhijit.gangurde@amd.com>
To: <jgg@ziepe.ca>, <leon@kernel.org>
Cc: <allen.hubbe@amd.com>, <a.k@amd.com>, <nikhil.agarwal@amd.com>,
	<linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Abhijit Gangurde" <abhijit.gangurde@amd.com>
Subject: [for-next 2/3] RDMA/ionic: set the SQ WQE color bit
Date: Tue, 27 Oct 2026 14:53:52 +0530	[thread overview]
Message-ID: <20261027092353.1961552-2-abhijit.gangurde@amd.com> (raw)
In-Reply-To: <20261027092353.1961552-1-abhijit.gangurde@amd.com>

From: Amit Kumar <a.k@amd.com>

The NIC uses the WQE color bit to tell one pass of the send queue
from the next. Userspace sets IONIC_V1_FLAG_COLOR and toggles it when
prod wraps. Do the same for kernel send queues, and start again at
the initial color when a QP reset returns prod to zero.

Signed-off-by: Amit Kumar <a.k@amd.com>
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
---
 drivers/infiniband/hw/ionic/ionic_controlpath.c | 3 +++
 drivers/infiniband/hw/ionic/ionic_datapath.c    | 4 ++++
 drivers/infiniband/hw/ionic/ionic_fw.h          | 1 +
 drivers/infiniband/hw/ionic/ionic_ibdev.h       | 1 +
 4 files changed, 9 insertions(+)

diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infiniband/hw/ionic/ionic_controlpath.c
index 00f9086f3bab..1738635bacf4 100644
--- a/drivers/infiniband/hw/ionic/ionic_controlpath.c
+++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c
@@ -1949,6 +1949,8 @@ static int ionic_qp_sq_init(struct ionic_ibdev *dev, struct ionic_ctx *ctx,
 		return rc;
 	}
 
+	qp->sq_color = true;
+
 	rc = -EINVAL;
 
 	if (max_wr < 0 || max_wr > 0xffff)
@@ -2662,6 +2664,7 @@ static void ionic_reset_qp(struct ionic_ibdev *dev, struct ionic_qp *qp)
 		qp->sq_msn_cons = 0;
 		qp->sq.prod = 0;
 		qp->sq.cons = 0;
+		qp->sq_color = true;
 		spin_unlock(&qp->sq_lock);
 	}
 
diff --git a/drivers/infiniband/hw/ionic/ionic_datapath.c b/drivers/infiniband/hw/ionic/ionic_datapath.c
index c5726c6bd5cb..422e53e21054 100644
--- a/drivers/infiniband/hw/ionic/ionic_datapath.c
+++ b/drivers/infiniband/hw/ionic/ionic_datapath.c
@@ -820,6 +820,9 @@ static void ionic_prep_base(struct ionic_qp *qp,
 
 	wqe->base.wqe_idx = cpu_to_le64(qp->sq.prod);
 
+	if (qp->sq_color)
+		wqe->base.flags |= cpu_to_be16(IONIC_V1_FLAG_COLOR);
+
 	if (wr->send_flags & IB_SEND_FENCE)
 		wqe->base.flags |= cpu_to_be16(IONIC_V1_FLAG_FENCE);
 
@@ -843,6 +846,7 @@ static void ionic_prep_base(struct ionic_qp *qp,
 	}
 
 	ionic_queue_produce(&qp->sq);
+	qp->sq_color = ionic_color_wrap(qp->sq.prod, qp->sq_color);
 }
 
 static int ionic_prep_common(struct ionic_qp *qp,
diff --git a/drivers/infiniband/hw/ionic/ionic_fw.h b/drivers/infiniband/hw/ionic/ionic_fw.h
index 1db67fcb9a53..b8e996d4b8b9 100644
--- a/drivers/infiniband/hw/ionic/ionic_fw.h
+++ b/drivers/infiniband/hw/ionic/ionic_fw.h
@@ -532,6 +532,7 @@ enum ionic_v1_op {
 	IONIC_V1_FLAG_SOL		= BIT(1),
 	IONIC_V1_FLAG_INL		= BIT(2),
 	IONIC_V1_FLAG_SIG		= BIT(3),
+	IONIC_V1_FLAG_COLOR		= BIT(4),
 
 	/* flags last four bits for sgl spec format */
 	IONIC_V1_FLAG_SPEC32		= (1u << 12),
diff --git a/drivers/infiniband/hw/ionic/ionic_ibdev.h b/drivers/infiniband/hw/ionic/ionic_ibdev.h
index f8d580dd4d95..cf4b85355f26 100644
--- a/drivers/infiniband/hw/ionic/ionic_ibdev.h
+++ b/drivers/infiniband/hw/ionic/ionic_ibdev.h
@@ -306,6 +306,7 @@ struct ionic_qp {
 	u8			sq_cmb;
 	bool			sq_flush;
 	bool			sq_flush_rcvd;
+	bool			sq_color;
 
 	struct ionic_rq		rq;
 
-- 
2.43.0


  reply	other threads:[~2026-10-27  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27  9:23 [for-next 1/3] RDMA/ionic: size the MR PTE reservation to max_sg Abhijit Gangurde
2026-10-27  9:23 ` Abhijit Gangurde [this message]
2026-10-27  9:23 ` [for-next 3/3] RDMA/ionic: key recv completions by producer index Abhijit Gangurde

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=20261027092353.1961552-2-abhijit.gangurde@amd.com \
    --to=abhijit.gangurde@amd.com \
    --cc=a.k@amd.com \
    --cc=allen.hubbe@amd.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=nikhil.agarwal@amd.com \
    /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

all inboxes | Powered by JetHome®