From: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
To: jgg@nvidia.com, leon@kernel.org, intel-wired-lan@lists.osuosl.org
Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
Shiraz Saleem <shiraz.saleem@intel.com>,
Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Subject: [rdma v3 18/24] RDMA/irdma: Support 64-byte CQEs and GEN3 CQE opcode decoding
Date: Fri, 7 Feb 2025 13:49:25 -0600 [thread overview]
Message-ID: <20250207194931.1569-19-tatyana.e.nikolova@intel.com> (raw)
In-Reply-To: <20250207194931.1569-1-tatyana.e.nikolova@intel.com>
From: Shiraz Saleem <shiraz.saleem@intel.com>
Introduce support for 64-byte CQEs in GEN3 devices. Additionally,
implement GEN3-specific CQE opcode decoding.
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
---
v3:
* Fix detection of CQ empty when avoid_mem_cflct is on.
* In resize CQ, do not double the CQ size if avoid_mem_cflct is on.
* Make CQ size an even number, which is a GEN3 HW requirement.
drivers/infiniband/hw/irdma/main.h | 2 +-
drivers/infiniband/hw/irdma/utils.c | 5 ++++-
drivers/infiniband/hw/irdma/verbs.c | 30 ++++++++++++++++++++++++-----
drivers/infiniband/hw/irdma/verbs.h | 13 +++++++++++++
4 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/hw/irdma/main.h b/drivers/infiniband/hw/irdma/main.h
index f0196aafe59b..0c7f5f730f1f 100644
--- a/drivers/infiniband/hw/irdma/main.h
+++ b/drivers/infiniband/hw/irdma/main.h
@@ -69,7 +69,7 @@ extern struct idc_rdma_core_auxiliary_drv icrdma_core_auxiliary_drv;
#define IRDMA_MACIP_ADD 1
#define IRDMA_MACIP_DELETE 2
-#define IW_CCQ_SIZE (IRDMA_CQP_SW_SQSIZE_2048 + 1)
+#define IW_CCQ_SIZE (IRDMA_CQP_SW_SQSIZE_2048 + 2)
#define IW_CEQ_SIZE 2048
#define IW_AEQ_SIZE 2048
diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c
index 87c88be47ee3..60ef85e842d1 100644
--- a/drivers/infiniband/hw/irdma/utils.c
+++ b/drivers/infiniband/hw/irdma/utils.c
@@ -2381,7 +2381,10 @@ bool irdma_cq_empty(struct irdma_cq *iwcq)
u8 polarity;
ukcq = &iwcq->sc_cq.cq_uk;
- cqe = IRDMA_GET_CURRENT_CQ_ELEM(ukcq);
+ if (ukcq->avoid_mem_cflct)
+ cqe = IRDMA_GET_CURRENT_EXTENDED_CQ_ELEM(ukcq);
+ else
+ cqe = IRDMA_GET_CURRENT_CQ_ELEM(ukcq);
get_64bit_val(cqe, 24, &qword3);
polarity = (u8)FIELD_GET(IRDMA_CQ_VALID, qword3);
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index b5fe5f2fa68b..82a7cec25b52 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -1971,8 +1971,13 @@ static int irdma_resize_cq(struct ib_cq *ibcq, int entries,
if (!iwcq->user_mode) {
entries++;
- if (rf->sc_dev.hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2)
+
+ if (!iwcq->sc_cq.cq_uk.avoid_mem_cflct &&
+ dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2)
entries *= 2;
+
+ if (entries & 1)
+ entries += 1; /* cq size must be an even number */
}
info.cq_size = max(entries, 4);
@@ -2115,6 +2120,7 @@ static int irdma_create_cq(struct ib_cq *ibcq,
unsigned long flags;
int err_code;
int entries = attr->cqe;
+ bool cqe_64byte_ena;
err_code = cq_validate_flags(attr->flags, dev->hw_attrs.uk_attrs.hw_rev);
if (err_code)
@@ -2138,6 +2144,9 @@ static int irdma_create_cq(struct ib_cq *ibcq,
info.dev = dev;
ukinfo->cq_size = max(entries, 4);
ukinfo->cq_id = cq_num;
+ cqe_64byte_ena = dev->hw_attrs.uk_attrs.feature_flags & IRDMA_FEATURE_64_BYTE_CQE ?
+ true : false;
+ ukinfo->avoid_mem_cflct = cqe_64byte_ena;
iwcq->ibcq.cqe = info.cq_uk_init_info.cq_size;
if (attr->comp_vector < rf->ceqs_count)
info.ceq_id = attr->comp_vector;
@@ -2213,11 +2222,18 @@ static int irdma_create_cq(struct ib_cq *ibcq,
}
entries++;
- if (dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2)
+ if (!cqe_64byte_ena && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2)
entries *= 2;
+
+ if (entries & 1)
+ entries += 1; /* cq size must be an even number */
+
ukinfo->cq_size = entries;
- rsize = info.cq_uk_init_info.cq_size * sizeof(struct irdma_cqe);
+ if (cqe_64byte_ena)
+ rsize = info.cq_uk_init_info.cq_size * sizeof(struct irdma_extended_cqe);
+ else
+ rsize = info.cq_uk_init_info.cq_size * sizeof(struct irdma_cqe);
iwcq->kmem.size = ALIGN(round_up(rsize, 256), 256);
iwcq->kmem.va = dma_alloc_coherent(dev->hw->device,
iwcq->kmem.size,
@@ -3775,8 +3791,12 @@ static void irdma_process_cqe(struct ib_wc *entry,
if (cq_poll_info->q_type == IRDMA_CQE_QTYPE_SQ) {
set_ib_wc_op_sq(cq_poll_info, entry);
} else {
- set_ib_wc_op_rq(cq_poll_info, entry,
- qp->qp_uk.qp_caps & IRDMA_SEND_WITH_IMM);
+ if (qp->dev->hw_attrs.uk_attrs.hw_rev <= IRDMA_GEN_2)
+ set_ib_wc_op_rq(cq_poll_info, entry,
+ qp->qp_uk.qp_caps & IRDMA_SEND_WITH_IMM ?
+ true : false);
+ else
+ set_ib_wc_op_rq_gen_3(cq_poll_info, entry);
if (qp->qp_uk.qp_type != IRDMA_QP_TYPE_ROCE_UD &&
cq_poll_info->stag_invalid_set) {
entry->ex.invalidate_rkey = cq_poll_info->inv_stag;
diff --git a/drivers/infiniband/hw/irdma/verbs.h b/drivers/infiniband/hw/irdma/verbs.h
index cfa140b36395..fcb163c45252 100644
--- a/drivers/infiniband/hw/irdma/verbs.h
+++ b/drivers/infiniband/hw/irdma/verbs.h
@@ -267,6 +267,19 @@ static inline void set_ib_wc_op_sq(struct irdma_cq_poll_info *cq_poll_info,
}
}
+static inline void set_ib_wc_op_rq_gen_3(struct irdma_cq_poll_info *info,
+ struct ib_wc *entry)
+{
+ switch (info->op_type) {
+ case IRDMA_OP_TYPE_RDMA_WRITE:
+ case IRDMA_OP_TYPE_RDMA_WRITE_SOL:
+ entry->opcode = IB_WC_RECV_RDMA_WITH_IMM;
+ break;
+ default:
+ entry->opcode = IB_WC_RECV;
+ }
+}
+
static inline void set_ib_wc_op_rq(struct irdma_cq_poll_info *cq_poll_info,
struct ib_wc *entry, bool send_imm_support)
{
--
2.37.3
next prev parent reply other threads:[~2025-02-07 19:50 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 19:49 [iwl-next,rdma v3 00/24] Add RDMA support for Intel IPU E2000 (GEN3) Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 01/24] iidc/ice/irdma: Update IDC to support multiple consumers Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 02/24] idpf: use reserved RDMA vectors from control plane Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 03/24] idpf: implement core RDMA auxiliary dev create, init, and destroy Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 04/24] idpf: implement RDMA vport " Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 05/24] idpf: implement remaining IDC RDMA core callbacks and handlers Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 06/24] idpf: implement IDC vport aux driver MTU change handler Tatyana Nikolova
2025-02-07 19:49 ` [iwl-next v3 07/24] idpf: implement get LAN mmio memory regions Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 08/24] RDMA/irdma: Refactor GEN2 auxiliary driver Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 09/24] RDMA/irdma: Add GEN3 core driver support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 10/24] RDMA/irdma: Discover and set up GEN3 hardware register layout Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 11/24] RDMA/irdma: Add GEN3 CQP support with deferred completions Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 12/24] RDMA/irdma: Add GEN3 support for AEQ and CEQ Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 13/24] RDMA/irdma: Add GEN3 HW statistics support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 14/24] RDMA/irdma: Introduce GEN3 vPort driver support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 15/24] RDMA/irdma: Add GEN3 virtual QP1 support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 16/24] RDMA/irdma: Extend QP context programming for GEN3 Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 17/24] RDMA/irdma: Add support for V2 HMC resource management scheme Tatyana Nikolova
2025-02-07 19:49 ` Tatyana Nikolova [this message]
2025-02-07 19:49 ` [rdma v3 19/24] RDMA/irdma: Add SRQ support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 20/24] RDMA/irdma: Restrict Memory Window and CQE Timestamping to GEN3 Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 21/24] RDMA/irdma: Add Atomic Operations support Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 22/24] RDMA/irdma: Extend CQE Error and Flush Handling for GEN3 Devices Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 23/24] RDMA/irdma: Add Push Page Support for GEN3 Tatyana Nikolova
2025-02-07 19:49 ` [rdma v3 24/24] RDMA/irdma: Update Kconfig Tatyana Nikolova
2025-02-10 10:41 ` [iwl-next,rdma v3 00/24] Add RDMA support for Intel IPU E2000 (GEN3) Przemek Kitszel
2025-02-10 11:09 ` Leon Romanovsky
2025-02-13 16:12 ` Przemek Kitszel
2025-02-16 11:18 ` Leon Romanovsky
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=20250207194931.1569-19-tatyana.e.nikolova@intel.com \
--to=tatyana.e.nikolova@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shiraz.saleem@intel.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