From: Jason Gunthorpe <jgg@nvidia.com>
To: Zhu Yanjun <yanjun.zhu@linux.dev>
Cc: zhenwei pi <pizhenwei@bytedance.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
zyjzyj2000@gmail.com, leonro@nvidia.com
Subject: Re: [PATCH 1/3] RDMA/rxe: Use sizeof instead of hard code number
Date: Thu, 22 Aug 2024 09:36:49 -0300 [thread overview]
Message-ID: <20240822123649.GP3773488@nvidia.com> (raw)
In-Reply-To: <d933e865-2b6b-41c1-a0f2-46f8fef3cc17@linux.dev>
On Thu, Aug 22, 2024 at 07:59:32PM +0800, Zhu Yanjun wrote:
> 在 2024/8/22 14:52, zhenwei pi 写道:
> > Use 'sizeof(union rdma_network_hdr)' instead of hard code GRH length
> > for GSI and UD.
> >
> > Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> > ---
> > drivers/infiniband/sw/rxe/rxe_resp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
> > index 6596a85723c9..bf8f4bc8c5c8 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_resp.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
> > @@ -351,7 +351,7 @@ static enum resp_states rxe_resp_check_length(struct rxe_qp *qp,
> > for (i = 0; i < qp->resp.wqe->dma.num_sge; i++)
> > recv_buffer_len += qp->resp.wqe->dma.sge[i].length;
> > - if (payload + 40 > recv_buffer_len) {
> > + if (payload + sizeof(union rdma_network_hdr) > recv_buffer_len) {
>
> The definition of union rdma_network_hdr is as below
>
> 797 union rdma_network_hdr {
> 798 struct ib_grh ibgrh;
> 799 struct {
> 800 /* The IB spec states that if it's IPv4, the header
> 801 * is located in the last 20 bytes of the header.
> 802 */
> 803 u8 reserved[20];
> 804 struct iphdr roce4grh;
> 805 };
> 806 };
>
> The length is 40 byte.
This looks like the right struct to me if this is talking about the
special 40 byte blob that is placed in front of UD verbs completions.
Jason
next prev parent reply other threads:[~2024-08-22 12:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 6:52 [PATCH 0/3] RDMA/rxe misc fixes zhenwei pi
2024-08-22 6:52 ` [PATCH 1/3] RDMA/rxe: Use sizeof instead of hard code number zhenwei pi
2024-08-22 11:59 ` Zhu Yanjun
2024-08-22 12:36 ` Jason Gunthorpe [this message]
[not found] ` <CABoGonKvG9AyuVPMG29b3q5bGr7ZAH5RsGg7TOtkcaAZm9F-Dg@mail.gmail.com>
2024-08-23 5:56 ` Zhu Yanjun
2024-08-23 8:23 ` zhenwei pi
2024-08-23 9:17 ` Zhu Yanjun
2024-08-22 6:52 ` [PATCH 2/3] RDMA/rxe: Typo fix zhenwei pi
2024-08-22 12:01 ` Zhu Yanjun
2024-08-22 6:52 ` [PATCH 3/3] RDMA/rxe: Fix __bth_set_resv6a zhenwei pi
2024-08-22 12:37 ` Zhu Yanjun
2024-08-23 14:44 ` [PATCH 0/3] RDMA/rxe misc fixes Jason Gunthorpe
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=20240822123649.GP3773488@nvidia.com \
--to=jgg@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=pizhenwei@bytedance.com \
--cc=yanjun.zhu@linux.dev \
--cc=zyjzyj2000@gmail.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;
as well as URLs for NNTP newsgroup(s).