Message ID | 20241216121953.765331-1-pizhenwei@bytedance.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | RDMA/rxe: Fix mismatched max_msg_sz | expand |
在 2024/12/16 13:19, zhenwei pi 写道: > 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. > This is a buf fix. Perhaps Fixes tag is needed? > Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> > --- > drivers/infiniband/sw/rxe/rxe_param.h | 2 +- > drivers/infiniband/sw/rxe/rxe_verbs.c | 5 ++--- > 2 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h > index d2f57ead78ad..003f681e5dc0 100644 > --- a/drivers/infiniband/sw/rxe/rxe_param.h > +++ b/drivers/infiniband/sw/rxe/rxe_param.h > @@ -129,7 +129,7 @@ enum rxe_device_param { > enum rxe_port_param { > RXE_PORT_GID_TBL_LEN = 1024, > RXE_PORT_PORT_CAP_FLAGS = IB_PORT_CM_SUP, > - RXE_PORT_MAX_MSG_SZ = 0x800000, > + RXE_PORT_MAX_MSG_SZ = (1UL << 31), In the above, perhaps the parentheses is not necessary. Except that, I am fine with this. Thanks a lot. Review-by: Zhu Yanjun <yanjun.zhu@linux.dev> Zhu Yanjun > RXE_PORT_BAD_PKEY_CNTR = 0, > RXE_PORT_QKEY_VIOL_CNTR = 0, > RXE_PORT_LID = 0, > diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c > index 5c18f7e342f2..ffd5b07ad3e6 100644 > --- a/drivers/infiniband/sw/rxe/rxe_verbs.c > +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c > @@ -688,7 +688,7 @@ static int validate_send_wr(struct rxe_qp *qp, const struct ib_send_wr *ibwr, > for (i = 0; i < ibwr->num_sge; i++) > length += ibwr->sg_list[i].length; > > - if (length > (1UL << 31)) { > + if (length > RXE_PORT_MAX_MSG_SZ) { > rxe_err_qp(qp, "message length too long\n"); > break; > } > @@ -972,8 +972,7 @@ static int post_one_recv(struct rxe_rq *rq, const struct ib_recv_wr *ibwr) > for (i = 0; i < num_sge; i++) > length += ibwr->sg_list[i].length; > > - /* IBA max message size is 2^31 */ > - if (length >= (1UL<<31)) { > + if (length > RXE_PORT_MAX_MSG_SZ) { > err = -EINVAL; > rxe_dbg("message length too long\n"); > goto err_out;
On 12/17/24 00:47, Zhu Yanjun wrote: > 在 2024/12/16 13:19, zhenwei pi 写道: >> 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. >> > > This is a buf fix. Perhaps Fixes tag is needed? > Hi, Please amend this on applying patch: Fixes: f605f26ea196 ("RDMA/rxe: Protect QP state with qp->state_lock") Fixes: 5bf944f24129 ("RDMA/rxe: Add error messages") If v2 is needed, please let me know. >> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> >> --- >> drivers/infiniband/sw/rxe/rxe_param.h | 2 +- >> drivers/infiniband/sw/rxe/rxe_verbs.c | 5 ++--- >> 2 files changed, 3 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/ >> infiniband/sw/rxe/rxe_param.h >> index d2f57ead78ad..003f681e5dc0 100644 >> --- a/drivers/infiniband/sw/rxe/rxe_param.h >> +++ b/drivers/infiniband/sw/rxe/rxe_param.h >> @@ -129,7 +129,7 @@ enum rxe_device_param { >> enum rxe_port_param { >> RXE_PORT_GID_TBL_LEN = 1024, >> RXE_PORT_PORT_CAP_FLAGS = IB_PORT_CM_SUP, >> - RXE_PORT_MAX_MSG_SZ = 0x800000, >> + RXE_PORT_MAX_MSG_SZ = (1UL << 31), > > In the above, perhaps the parentheses is not necessary. > Except that, I am fine with this. > > Thanks a lot. > Review-by: Zhu Yanjun <yanjun.zhu@linux.dev> > > Zhu Yanjun > >> RXE_PORT_BAD_PKEY_CNTR = 0, >> RXE_PORT_QKEY_VIOL_CNTR = 0, >> RXE_PORT_LID = 0, >> diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/ >> infiniband/sw/rxe/rxe_verbs.c >> index 5c18f7e342f2..ffd5b07ad3e6 100644 >> --- a/drivers/infiniband/sw/rxe/rxe_verbs.c >> +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c >> @@ -688,7 +688,7 @@ static int validate_send_wr(struct rxe_qp *qp, >> const struct ib_send_wr *ibwr, >> for (i = 0; i < ibwr->num_sge; i++) >> length += ibwr->sg_list[i].length; >> - if (length > (1UL << 31)) { >> + if (length > RXE_PORT_MAX_MSG_SZ) { >> rxe_err_qp(qp, "message length too long\n"); >> break; >> } >> @@ -972,8 +972,7 @@ static int post_one_recv(struct rxe_rq *rq, const >> struct ib_recv_wr *ibwr) >> for (i = 0; i < num_sge; i++) >> length += ibwr->sg_list[i].length; >> - /* IBA max message size is 2^31 */ >> - if (length >= (1UL<<31)) { >> + if (length > RXE_PORT_MAX_MSG_SZ) { >> err = -EINVAL; >> rxe_dbg("message length too long\n"); >> goto err_out; >
On Tue, Dec 17, 2024 at 11:37:45AM +0800, zhenwei pi wrote: > > > On 12/17/24 00:47, Zhu Yanjun wrote: > > 在 2024/12/16 13:19, zhenwei pi 写道: > > > 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. > > > > > > > This is a buf fix. Perhaps Fixes tag is needed? > > > > Hi, > > Please amend this on applying patch: > Fixes: f605f26ea196 ("RDMA/rxe: Protect QP state with qp->state_lock") > Fixes: 5bf944f24129 ("RDMA/rxe: Add error messages") > > If v2 is needed, please let me know. There is no need, I added them manually. Thanks
On Mon, 16 Dec 2024 20:19:53 +0800, zhenwei pi wrote: > 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. > > Applied, thanks! [1/1] RDMA/rxe: Fix mismatched max_msg_sz https://git.kernel.org/rdma/rdma/c/db03b70969aab4 Best regards,
diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h index d2f57ead78ad..003f681e5dc0 100644 --- a/drivers/infiniband/sw/rxe/rxe_param.h +++ b/drivers/infiniband/sw/rxe/rxe_param.h @@ -129,7 +129,7 @@ enum rxe_device_param { enum rxe_port_param { RXE_PORT_GID_TBL_LEN = 1024, RXE_PORT_PORT_CAP_FLAGS = IB_PORT_CM_SUP, - RXE_PORT_MAX_MSG_SZ = 0x800000, + RXE_PORT_MAX_MSG_SZ = (1UL << 31), RXE_PORT_BAD_PKEY_CNTR = 0, RXE_PORT_QKEY_VIOL_CNTR = 0, RXE_PORT_LID = 0, diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 5c18f7e342f2..ffd5b07ad3e6 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -688,7 +688,7 @@ static int validate_send_wr(struct rxe_qp *qp, const struct ib_send_wr *ibwr, for (i = 0; i < ibwr->num_sge; i++) length += ibwr->sg_list[i].length; - if (length > (1UL << 31)) { + if (length > RXE_PORT_MAX_MSG_SZ) { rxe_err_qp(qp, "message length too long\n"); break; } @@ -972,8 +972,7 @@ static int post_one_recv(struct rxe_rq *rq, const struct ib_recv_wr *ibwr) for (i = 0; i < num_sge; i++) length += ibwr->sg_list[i].length; - /* IBA max message size is 2^31 */ - if (length >= (1UL<<31)) { + if (length > RXE_PORT_MAX_MSG_SZ) { err = -EINVAL; rxe_dbg("message length too long\n"); goto err_out;
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> --- drivers/infiniband/sw/rxe/rxe_param.h | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-)