Skip to content

Commit db03b70

Browse files
pizhenweirleon
authored andcommitted
RDMA/rxe: Fix mismatched max_msg_sz
User mode queries max_msg_sz as 0x800000 by command 'ibv_devinfo -v', however ibv_post_send/ibv_post_recv has a limit of 2^31. Fix this mismatched information. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Fixes: f605f26 ("RDMA/rxe: Protect QP state with qp->state_lock") Fixes: 5bf944f ("RDMA/rxe: Add error messages") Link: https://patch.msgid.link/20241216121953.765331-1-pizhenwei@bytedance.com Review-by: Zhu Yanjun <yanjun.zhu@linux.dev> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 2dab32d commit db03b70

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

drivers/infiniband/sw/rxe/rxe_param.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ enum rxe_device_param {
129129
enum rxe_port_param {
130130
RXE_PORT_GID_TBL_LEN = 1024,
131131
RXE_PORT_PORT_CAP_FLAGS = IB_PORT_CM_SUP,
132-
RXE_PORT_MAX_MSG_SZ = 0x800000,
132+
RXE_PORT_MAX_MSG_SZ = (1UL << 31),
133133
RXE_PORT_BAD_PKEY_CNTR = 0,
134134
RXE_PORT_QKEY_VIOL_CNTR = 0,
135135
RXE_PORT_LID = 0,

drivers/infiniband/sw/rxe/rxe_verbs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ static int validate_send_wr(struct rxe_qp *qp, const struct ib_send_wr *ibwr,
688688
for (i = 0; i < ibwr->num_sge; i++)
689689
length += ibwr->sg_list[i].length;
690690

691-
if (length > (1UL << 31)) {
691+
if (length > RXE_PORT_MAX_MSG_SZ) {
692692
rxe_err_qp(qp, "message length too long\n");
693693
break;
694694
}
@@ -972,8 +972,7 @@ static int post_one_recv(struct rxe_rq *rq, const struct ib_recv_wr *ibwr)
972972
for (i = 0; i < num_sge; i++)
973973
length += ibwr->sg_list[i].length;
974974

975-
/* IBA max message size is 2^31 */
976-
if (length >= (1UL<<31)) {
975+
if (length > RXE_PORT_MAX_MSG_SZ) {
977976
err = -EINVAL;
978977
rxe_dbg("message length too long\n");
979978
goto err_out;

0 commit comments

Comments
 (0)