Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Yanjun Zhu <yanjun.zhu@oracle.com>
To: Konstantin Taranov <konstantin.taranov@inf.ethz.ch>
Cc: monis@mellanox.com, linux-rdma@vger.kernel.org
Subject: Re: [PATCH] Make rxe driver to calculate correct byte_len on receiving side when work completion is generated with IB_WC_RECV_RDMA_WITH_IMM opcode.
Date: Mon, 8 Jul 2019 09:57:28 +0800	[thread overview]
Message-ID: <2850a772-1a91-07dd-eb01-8e6e4d8aa690@oracle.com> (raw)
In-Reply-To: <20190708034621.101b25dc@ktaranov-laptop>


On 2019/7/8 9:46, Konstantin Taranov wrote:
> On Mon, 8 Jul 2019 07:35:24 +0800
> Zhu Yanjun <yanjun.zhu@oracle.com> wrote:
>
>> 在 2019/7/8 5:23, Konstantin Taranov 写道:
>>> On Wed, 3 Jul 2019 09:24:54 +0800
>>> Yanjun Zhu <yanjun.zhu@oracle.com> wrote:
>>>   
>>>> On 2019/6/27 22:06, Konstantin Taranov wrote:
>>>>> Make softRoce to calculate correct byte_len on receiving side when work completion
>>>>> is generated with IB_WC_RECV_RDMA_WITH_IMM opcode.
>>>>>
>>>>> According to documentation byte_len must indicate the number of written
>>>>> bytes, whereas it was always equal to zero for IB_WC_RECV_RDMA_WITH_IMM opcode.
>>>> With roce NIC, what is the byte_len? Thanks a lot.
>>> byte_len is a field of a work completion (struct ib_uverbs_wc or struct ibv_wc). It is defined in verbs and stores
>>> the number of written bytes to the destination memory. In case of IB_WC_RECV_RDMA_WITH_IMM
>>> completion event, the field byte_len must store the number of written bytes for incoming
>>> RDMA_WRITE_WITH_IMM request.
>> Cool. Thanks for your explanations.
>>
>> The above is the test result of physical RoCE NIC?
>>
> Yes. When I use physical nics, the byte_len indicates the number of received bytes.
> It is also fully complies with what is written in https://www.rdmamojo.com/2013/02/15/ibv_poll_cq/ about the byte_len field.

Nice. I am fine with this patch.

Thanks a lot.

Zhu Yanjun

>   
>
>
>> Thanks.
>>
>> Zhu Yanjun
>>
>>>   
>>>> Zhu Yanjun
>>>>   
>>>>> The patch proposes to remember the length of an RDMA request from the RETH header, and use it
>>>>> as byte_len when the work completion with IB_WC_RECV_RDMA_WITH_IMM opcode is generated.
>>>>>
>>>>> Signed-off-by: Konstantin Taranov <konstantin.taranov@inf.ethz.ch>
>>>>> ---
>>>>>     drivers/infiniband/sw/rxe/rxe_resp.c  | 5 ++++-
>>>>>     drivers/infiniband/sw/rxe/rxe_verbs.h | 1 +
>>>>>     2 files changed, 5 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
>>>>> index aca9f60f9b21..1cbfbd98eb22 100644
>>>>> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
>>>>> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
>>>>> @@ -431,6 +431,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp,
>>>>>     			qp->resp.va = reth_va(pkt);
>>>>>     			qp->resp.rkey = reth_rkey(pkt);
>>>>>     			qp->resp.resid = reth_len(pkt);
>>>>> +			qp->resp.length = reth_len(pkt);
>>>>>     		}
>>>>>     		access = (pkt->mask & RXE_READ_MASK) ? IB_ACCESS_REMOTE_READ
>>>>>     						     : IB_ACCESS_REMOTE_WRITE;
>>>>> @@ -856,7 +857,9 @@ static enum resp_states do_complete(struct rxe_qp *qp,
>>>>>     				pkt->mask & RXE_WRITE_MASK) ?
>>>>>     					IB_WC_RECV_RDMA_WITH_IMM : IB_WC_RECV;
>>>>>     		wc->vendor_err = 0;
>>>>> -		wc->byte_len = wqe->dma.length - wqe->dma.resid;
>>>>> +		wc->byte_len = (pkt->mask & RXE_IMMDT_MASK &&
>>>>> +				pkt->mask & RXE_WRITE_MASK) ?
>>>>> +					qp->resp.length : wqe->dma.length - wqe->dma.resid;
>>>>>     
>>>>>     		/* fields after byte_len are different between kernel and user
>>>>>     		 * space
>>>>> diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
>>>>> index e8be7f44e3be..28bfb3ece104 100644
>>>>> --- a/drivers/infiniband/sw/rxe/rxe_verbs.h
>>>>> +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
>>>>> @@ -213,6 +213,7 @@ struct rxe_resp_info {
>>>>>     	struct rxe_mem		*mr;
>>>>>     	u32			resid;
>>>>>     	u32			rkey;
>>>>> +	u32			length;
>>>>>     	u64			atomic_orig;
>>>>>     
>>>>>     	/* SRQ only */

  reply	other threads:[~2019-07-08  1:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190627140643.6191-1-konstantin.taranov@inf.ethz.ch>
     [not found] ` <d149da15-523a-438a-1550-095b4b1a840b@oracle.com>
2019-07-07 21:23   ` [PATCH] Make rxe driver to calculate correct byte_len on receiving side when work completion is generated with IB_WC_RECV_RDMA_WITH_IMM opcode Konstantin Taranov
2019-07-07 23:35     ` Zhu Yanjun
2019-07-08  1:46       ` Konstantin Taranov
2019-07-08  1:57         ` Yanjun Zhu [this message]
2019-07-08 19:51 ` 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=2850a772-1a91-07dd-eb01-8e6e4d8aa690@oracle.com \
    --to=yanjun.zhu@oracle.com \
    --cc=konstantin.taranov@inf.ethz.ch \
    --cc=linux-rdma@vger.kernel.org \
    --cc=monis@mellanox.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