* [PATCH rdma-next 0/3] bnxt_re driver update
@ 2025-07-04 4:38 Kalesh AP
2025-07-04 4:38 ` [PATCH rdma-next 1/3] RDMA/bnxt_re: Fix size of uverbs_copy_to() in BNXT_RE_METHOD_GET_TOGGLE_MEM Kalesh AP
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Kalesh AP @ 2025-07-04 4:38 UTC (permalink / raw)
To: leon, jgg; +Cc: linux-rdma, andrew.gospodarek, selvin.xavier, Kalesh AP
This patchset adds support for 2G page size in the bnxt_re driver.
There are couple of cosmetic changes as well.
Kalesh AP (2):
RDMA/bnxt_re: Fix size of uverbs_copy_to() in
BNXT_RE_METHOD_GET_TOGGLE_MEM
RDMA/bnxt_re: Use macro instead of hard coded value
Selvin Xavier (1):
RDMA/bnxt_re: Support 2G message size
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +-
drivers/infiniband/hw/bnxt_re/qplib_fp.c | 28 ++++++++++++------------
drivers/infiniband/hw/bnxt_re/qplib_fp.h | 3 +++
drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 +-
drivers/infiniband/hw/bnxt_re/qplib_sp.h | 1 +
5 files changed, 20 insertions(+), 16 deletions(-)
--
2.43.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH rdma-next 1/3] RDMA/bnxt_re: Fix size of uverbs_copy_to() in BNXT_RE_METHOD_GET_TOGGLE_MEM
2025-07-04 4:38 [PATCH rdma-next 0/3] bnxt_re driver update Kalesh AP
@ 2025-07-04 4:38 ` Kalesh AP
2025-07-04 4:38 ` [PATCH rdma-next 2/3] RDMA/bnxt_re: Support 2G message size Kalesh AP
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Kalesh AP @ 2025-07-04 4:38 UTC (permalink / raw)
To: leon, jgg
Cc: linux-rdma, andrew.gospodarek, selvin.xavier, Kalesh AP,
Saravanan Vajravel, Shravya KN
Since both "length" and "offset" are of type u32, there is
no functional issue here.
Reviewed-by: Saravanan Vajravel <saravanan.vajravel@broadcom.com>
Signed-off-by: Shravya KN <shravya.k-n@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
---
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 063801384b2b..3a627acb82ce 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -4738,7 +4738,7 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_GET_TOGGLE_MEM)(struct uverbs_attr_bund
return err;
err = uverbs_copy_to(attrs, BNXT_RE_TOGGLE_MEM_MMAP_OFFSET,
- &offset, sizeof(length));
+ &offset, sizeof(offset));
if (err)
return err;
--
2.43.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH rdma-next 2/3] RDMA/bnxt_re: Support 2G message size
2025-07-04 4:38 [PATCH rdma-next 0/3] bnxt_re driver update Kalesh AP
2025-07-04 4:38 ` [PATCH rdma-next 1/3] RDMA/bnxt_re: Fix size of uverbs_copy_to() in BNXT_RE_METHOD_GET_TOGGLE_MEM Kalesh AP
@ 2025-07-04 4:38 ` Kalesh AP
2025-07-06 7:37 ` Leon Romanovsky
2025-07-04 4:38 ` [PATCH rdma-next 3/3] RDMA/bnxt_re: Use macro instead of hard coded value Kalesh AP
2025-07-06 7:38 ` [PATCH rdma-next 0/3] bnxt_re driver update Leon Romanovsky
3 siblings, 1 reply; 7+ messages in thread
From: Kalesh AP @ 2025-07-04 4:38 UTC (permalink / raw)
To: leon, jgg
Cc: linux-rdma, andrew.gospodarek, selvin.xavier, Shravya KN,
Saravanan Vajravel, Kalesh AP
From: Selvin Xavier <selvin.xavier@broadcom.com>
bnxt_qplib_put_sges is calculating the length in
a signed int. So handling the 2G message size
is not working since it is considered as negative.
Use a unsigned number to calculate the total message
length. As per the spec, IB message size shall be
between zero and 2^31 bytes (inclusive). So adding
a check for 2G message size.
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Shravya KN <shravya.k-n@broadcom.com>
Reviewed-by: Saravanan Vajravel <saravanan.vajravel@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
---
drivers/infiniband/hw/bnxt_re/qplib_fp.c | 28 ++++++++++++------------
drivers/infiniband/hw/bnxt_re/qplib_fp.h | 3 +++
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index be34c605d516..dfe3177123e5 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -1750,9 +1750,9 @@ static void bnxt_qplib_fill_psn_search(struct bnxt_qplib_qp *qp,
}
}
-static int bnxt_qplib_put_inline(struct bnxt_qplib_qp *qp,
- struct bnxt_qplib_swqe *wqe,
- u16 *idx)
+static unsigned int bnxt_qplib_put_inline(struct bnxt_qplib_qp *qp,
+ struct bnxt_qplib_swqe *wqe,
+ u32 *idx)
{
struct bnxt_qplib_hwq *hwq;
int len, t_len, offt;
@@ -1769,7 +1769,7 @@ static int bnxt_qplib_put_inline(struct bnxt_qplib_qp *qp,
il_src = (void *)wqe->sg_list[indx].addr;
t_len += len;
if (t_len > qp->max_inline_data)
- return -ENOMEM;
+ return BNXT_RE_INVAL_MSG_SIZE;
while (len) {
if (pull_dst) {
pull_dst = false;
@@ -1795,9 +1795,9 @@ static int bnxt_qplib_put_inline(struct bnxt_qplib_qp *qp,
return t_len;
}
-static u32 bnxt_qplib_put_sges(struct bnxt_qplib_hwq *hwq,
- struct bnxt_qplib_sge *ssge,
- u16 nsge, u16 *idx)
+static unsigned int bnxt_qplib_put_sges(struct bnxt_qplib_hwq *hwq,
+ struct bnxt_qplib_sge *ssge,
+ u32 nsge, u32 *idx)
{
struct sq_sge *dsge;
int indx, len = 0;
@@ -1878,14 +1878,12 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
struct bnxt_qplib_hwq *hwq;
struct bnxt_qplib_swq *swq;
bool sch_handler = false;
+ u32 wqe_idx, slots, idx;
u16 wqe_sz, qdf = 0;
bool msn_update;
void *base_hdr;
void *ext_hdr;
__le32 temp32;
- u32 wqe_idx;
- u32 slots;
- u16 idx;
hwq = &sq->hwq;
if (qp->state != CMDQ_MODIFY_QP_NEW_STATE_RTS &&
@@ -1937,8 +1935,10 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
else
data_len = bnxt_qplib_put_sges(hwq, wqe->sg_list, wqe->num_sge,
&idx);
- if (data_len < 0)
- goto queue_err;
+ if (data_len > BNXT_RE_MAX_MSG_SIZE) {
+ rc = -EINVAL;
+ goto done;
+ }
/* Make sure we update MSN table only for wired wqes */
msn_update = true;
/* Specifics */
@@ -2139,8 +2139,8 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp,
struct bnxt_qplib_hwq *hwq;
struct bnxt_qplib_swq *swq;
bool sch_handler = false;
- u16 wqe_sz, idx;
- u32 wqe_idx;
+ u32 wqe_idx, idx;
+ u16 wqe_sz;
int rc = 0;
hwq = &rq->hwq;
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.h b/drivers/infiniband/hw/bnxt_re/qplib_fp.h
index 0d9487c889ff..ab125f1d949e 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.h
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.h
@@ -346,6 +346,9 @@ struct bnxt_qplib_qp {
u8 tos_dscp;
};
+#define BNXT_RE_MAX_MSG_SIZE 0x80000000
+#define BNXT_RE_INVAL_MSG_SIZE 0xFFFFFFFF
+
#define BNXT_QPLIB_MAX_CQE_ENTRY_SIZE sizeof(struct cq_base)
#define CQE_CNT_PER_PG (PAGE_SIZE / BNXT_QPLIB_MAX_CQE_ENTRY_SIZE)
--
2.43.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH rdma-next 3/3] RDMA/bnxt_re: Use macro instead of hard coded value
2025-07-04 4:38 [PATCH rdma-next 0/3] bnxt_re driver update Kalesh AP
2025-07-04 4:38 ` [PATCH rdma-next 1/3] RDMA/bnxt_re: Fix size of uverbs_copy_to() in BNXT_RE_METHOD_GET_TOGGLE_MEM Kalesh AP
2025-07-04 4:38 ` [PATCH rdma-next 2/3] RDMA/bnxt_re: Support 2G message size Kalesh AP
@ 2025-07-04 4:38 ` Kalesh AP
2025-07-06 7:38 ` [PATCH rdma-next 0/3] bnxt_re driver update Leon Romanovsky
3 siblings, 0 replies; 7+ messages in thread
From: Kalesh AP @ 2025-07-04 4:38 UTC (permalink / raw)
To: leon, jgg
Cc: linux-rdma, andrew.gospodarek, selvin.xavier, Kalesh AP,
Shravya KN, Hongguang Gao
1. Defined a macro for the hard coded value.
2. "access" field in the request structure is of type "u8".
Updated the mask accordingly.
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Shravya KN <shravya.k-n@broadcom.com>
Reviewed-by: Hongguang Gao <hongguang.gao@broadcom.com>
---
drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 +-
drivers/infiniband/hw/bnxt_re/qplib_sp.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
index 9efd32a3dc55..68981399598d 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
@@ -674,7 +674,7 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
req.log2_pbl_pg_size = cpu_to_le16(((ilog2(PAGE_SIZE) <<
CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_SFT) &
CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_MASK));
- req.access = (mr->access_flags & 0xFFFF);
+ req.access = (mr->access_flags & BNXT_QPLIB_MR_ACCESS_MASK);
req.va = cpu_to_le64(mr->va);
req.key = cpu_to_le32(mr->lkey);
if (_is_alloc_mr_unified(res->dattr->dev_cap_flags))
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
index e626b05038a1..09faf4a1e849 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
@@ -111,6 +111,7 @@ struct bnxt_qplib_mrw {
struct bnxt_qplib_pd *pd;
int type;
u32 access_flags;
+#define BNXT_QPLIB_MR_ACCESS_MASK 0xFF
#define BNXT_QPLIB_FR_PMR 0x80000000
u32 lkey;
u32 rkey;
--
2.43.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH rdma-next 2/3] RDMA/bnxt_re: Support 2G message size
2025-07-04 4:38 ` [PATCH rdma-next 2/3] RDMA/bnxt_re: Support 2G message size Kalesh AP
@ 2025-07-06 7:37 ` Leon Romanovsky
2025-07-07 2:34 ` Kalesh Anakkur Purayil
0 siblings, 1 reply; 7+ messages in thread
From: Leon Romanovsky @ 2025-07-06 7:37 UTC (permalink / raw)
To: Kalesh AP
Cc: jgg, linux-rdma, andrew.gospodarek, selvin.xavier, Shravya KN,
Saravanan Vajravel
On Fri, Jul 04, 2025 at 10:08:56AM +0530, Kalesh AP wrote:
> From: Selvin Xavier <selvin.xavier@broadcom.com>
>
> bnxt_qplib_put_sges is calculating the length in
> a signed int. So handling the 2G message size
> is not working since it is considered as negative.
>
> Use a unsigned number to calculate the total message
> length. As per the spec, IB message size shall be
> between zero and 2^31 bytes (inclusive). So adding
> a check for 2G message size.
You can easily use opto 80 chars per-line in commit messages, there is
no need to limit yourself to 50 chars.
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH rdma-next 0/3] bnxt_re driver update
2025-07-04 4:38 [PATCH rdma-next 0/3] bnxt_re driver update Kalesh AP
` (2 preceding siblings ...)
2025-07-04 4:38 ` [PATCH rdma-next 3/3] RDMA/bnxt_re: Use macro instead of hard coded value Kalesh AP
@ 2025-07-06 7:38 ` Leon Romanovsky
3 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2025-07-06 7:38 UTC (permalink / raw)
To: jgg, Kalesh AP; +Cc: linux-rdma, andrew.gospodarek, selvin.xavier
On Fri, 04 Jul 2025 10:08:54 +0530, Kalesh AP wrote:
> This patchset adds support for 2G page size in the bnxt_re driver.
> There are couple of cosmetic changes as well.
>
> Kalesh AP (2):
> RDMA/bnxt_re: Fix size of uverbs_copy_to() in
> BNXT_RE_METHOD_GET_TOGGLE_MEM
> RDMA/bnxt_re: Use macro instead of hard coded value
>
> [...]
Applied, thanks!
[1/3] RDMA/bnxt_re: Fix size of uverbs_copy_to() in BNXT_RE_METHOD_GET_TOGGLE_MEM
https://git.kernel.org/rdma/rdma/c/8ba2e1eb6b3ec2
[2/3] RDMA/bnxt_re: Support 2G message size
https://git.kernel.org/rdma/rdma/c/c6acd006f110a0
[3/3] RDMA/bnxt_re: Use macro instead of hard coded value
https://git.kernel.org/rdma/rdma/c/bdc5726cdd454f
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH rdma-next 2/3] RDMA/bnxt_re: Support 2G message size
2025-07-06 7:37 ` Leon Romanovsky
@ 2025-07-07 2:34 ` Kalesh Anakkur Purayil
0 siblings, 0 replies; 7+ messages in thread
From: Kalesh Anakkur Purayil @ 2025-07-07 2:34 UTC (permalink / raw)
To: Leon Romanovsky
Cc: jgg, linux-rdma, andrew.gospodarek, selvin.xavier, Shravya KN,
Saravanan Vajravel
[-- Attachment #1.1: Type: text/plain, Size: 829 bytes --]
On Sun, Jul 6, 2025 at 1:07 PM Leon Romanovsky <leon@kernel.org> wrote:
> On Fri, Jul 04, 2025 at 10:08:56AM +0530, Kalesh AP wrote:
> > From: Selvin Xavier <selvin.xavier@broadcom.com>
> >
> > bnxt_qplib_put_sges is calculating the length in
> > a signed int. So handling the 2G message size
> > is not working since it is considered as negative.
> >
> > Use a unsigned number to calculate the total message
> > length. As per the spec, IB message size shall be
> > between zero and 2^31 bytes (inclusive). So adding
> > a check for 2G message size.
>
> You can easily use opto 80 chars per-line in commit messages, there is
> no need to limit yourself to 50 chars.
> Sure, thank you Leon. I usually format upto 80 characters per line, not
> sure how I missed it.
> Thanks
>
--
Regards,
Kalesh AP
[-- Attachment #1.2: Type: text/html, Size: 1437 bytes --]
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4226 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-07 2:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-04 4:38 [PATCH rdma-next 0/3] bnxt_re driver update Kalesh AP
2025-07-04 4:38 ` [PATCH rdma-next 1/3] RDMA/bnxt_re: Fix size of uverbs_copy_to() in BNXT_RE_METHOD_GET_TOGGLE_MEM Kalesh AP
2025-07-04 4:38 ` [PATCH rdma-next 2/3] RDMA/bnxt_re: Support 2G message size Kalesh AP
2025-07-06 7:37 ` Leon Romanovsky
2025-07-07 2:34 ` Kalesh Anakkur Purayil
2025-07-04 4:38 ` [PATCH rdma-next 3/3] RDMA/bnxt_re: Use macro instead of hard coded value Kalesh AP
2025-07-06 7:38 ` [PATCH rdma-next 0/3] bnxt_re driver update Leon Romanovsky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.