RDMA/bnxt_re: Get the toggle bits from SRQ events
authorHongguang Gao <hongguang.gao@broadcom.com>
Thu, 29 Aug 2024 15:34:03 +0000 (08:34 -0700)
committerLeon Romanovsky <leon@kernel.org>
Mon, 2 Sep 2024 07:10:36 +0000 (10:10 +0300)
SRQ arming requires the toggle bits received from hardware.
Get the toggle bits from SRQ notification for the
gen p7 adapters. This value will be zero for the older adapters.

Signed-off-by: Hongguang Gao <hongguang.gao@broadcom.com>
Signed-off-by: Chandramohan Akula <chandramohan.akula@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/1724945645-14989-2-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/bnxt_re/ib_verbs.h
drivers/infiniband/hw/bnxt_re/qplib_fp.c
drivers/infiniband/hw/bnxt_re/qplib_fp.h

index bbbec4b1d201b0c80d5d1d0e66cd6dd68e949aeb..060bf62ecebab235123a3af7c7c6da47b572a2cd 100644 (file)
@@ -77,6 +77,7 @@ struct bnxt_re_srq {
        struct bnxt_qplib_srq   qplib_srq;
        struct ib_umem          *umem;
        spinlock_t              lock;           /* protect srq */
+       void                    *uctx_srq_page;
 };
 
 struct bnxt_re_qp {
index 2810ffe3394b66102523fe7e129739f32d9133ff..42e98e5f94cb1a0755bc6fe96f7fe75c66b8e69d 100644 (file)
 #include "qplib_rcfw.h"
 #include "qplib_sp.h"
 #include "qplib_fp.h"
+#include <rdma/ib_addr.h>
+#include "bnxt_ulp.h"
+#include "bnxt_re.h"
+#include "ib_verbs.h"
 
 static void __clean_cq(struct bnxt_qplib_cq *cq, u64 qp);
 
@@ -347,6 +351,7 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t)
                case NQ_BASE_TYPE_SRQ_EVENT:
                {
                        struct bnxt_qplib_srq *srq;
+                       struct bnxt_re_srq *srq_p;
                        struct nq_srq_event *nqsrqe =
                                                (struct nq_srq_event *)nqe;
 
@@ -354,6 +359,12 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t)
                        q_handle |= (u64)le32_to_cpu(nqsrqe->srq_handle_high)
                                     << 32;
                        srq = (struct bnxt_qplib_srq *)q_handle;
+                       srq->toggle = (le16_to_cpu(nqe->info10_type) & NQ_CN_TOGGLE_MASK)
+                                     >> NQ_CN_TOGGLE_SFT;
+                       srq->dbinfo.toggle = srq->toggle;
+                       srq_p = container_of(srq, struct bnxt_re_srq, qplib_srq);
+                       if (srq_p->uctx_srq_page)
+                               *((u32 *)srq_p->uctx_srq_page) = srq->toggle;
                        bnxt_qplib_armen_db(&srq->dbinfo,
                                            DBC_DBC_TYPE_SRQ_ARMENA);
                        if (nq->srqn_handler(nq,
index 2e7a4fd651b87afb822c45cf38220725ac84c48c..b62df8701950ff622309fb5840ab16189cebf1b9 100644 (file)
@@ -105,6 +105,7 @@ struct bnxt_qplib_srq {
        struct bnxt_qplib_sg_info       sg_info;
        u16                             eventq_hw_ring_id;
        spinlock_t                      lock; /* protect SRQE link list */
+       u8                              toggle;
 };
 
 struct bnxt_qplib_sge {