From: Varun Prakash <varun@chelsio.com>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: hch@lst.de, kbusch@kernel.org, linux-nvme@lists.infradead.org
Subject: Re: [PATCH v2 2/2] nvme-tcp: send H2CData PDUs based on MAXH2CDATA
Date: Tue, 23 Nov 2021 14:03:49 +0530 [thread overview]
Message-ID: <20211123083346.GA1704@chelsio.com> (raw)
In-Reply-To: <f6e46674-5856-1f0d-045c-6ced393bda70@grimberg.me>
On Mon, Nov 22, 2021 at 12:35:11PM +0200, Sagi Grimberg wrote:
> >@@ -933,6 +934,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
> > {
> > struct nvme_tcp_queue *queue = req->queue;
> > int req_data_len = req->data_len;
> >+ u32 h2cdata_left = req->h2cdata_left;
>
> No need for the local variable, the reference only happens when the
> pdu data transfer is completed.
As this function also executes for inline data it is possible that completion
gets processed and request gets allocated for new cmd before
if (req->h2cdata_left) check, nvme_tcp_setup_cmd_pdu() will set
req->h2cdata_left to 0 so it will work but it does not look correct
to me. IMO we should use local variable here.
>
> > while (true) {
> > struct page *page = nvme_tcp_req_cur_page(req);
> >@@ -977,7 +979,13 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
> > req->state = NVME_TCP_SEND_DDGST;
> > req->offset = 0;
> > } else {
> >- nvme_tcp_done_send_req(queue);
> >+ if (h2cdata_left) {
> >+ nvme_tcp_setup_h2c_data_pdu(req);
> >+ req->state = NVME_TCP_SEND_H2C_PDU;
> >+ req->offset = 0;
>
> >@@ -1028,16 +1036,21 @@ static int nvme_tcp_try_send_data_pdu(struct nvme_tcp_request *req)
> > {
> > struct nvme_tcp_queue *queue = req->queue;
> > struct nvme_tcp_data_pdu *pdu = req->pdu;
> >+ struct page *page = virt_to_page(pdu);
> >+ size_t offset = offset_in_page(pdu) + req->offset;
> > u8 hdgst = nvme_tcp_hdgst_len(queue);
> > int len = sizeof(*pdu) - req->offset + hdgst;
> >+ int flags = MSG_DONTWAIT | MSG_MORE | MSG_SENDPAGE_NOTLAST;
> > int ret;
>
> Not sure the local variables are needed, but OK, I'm fine with that.
I will remove these local variables in next patch.
> >@@ -1057,6 +1070,7 @@ static int nvme_tcp_try_send_ddgst(struct nvme_tcp_request *req)
> > {
> > struct nvme_tcp_queue *queue = req->queue;
> > size_t offset = req->offset;
> >+ u32 h2cdata_left = req->h2cdata_left;
>
> No need for local variable.
Same explanation as above for local variable.
next prev parent reply other threads:[~2021-11-23 8:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 10:25 [PATCH v2 2/2] nvme-tcp: send H2CData PDUs based on MAXH2CDATA Varun Prakash
2021-11-22 10:35 ` Sagi Grimberg
2021-11-23 8:33 ` Varun Prakash [this message]
2021-11-23 9:09 ` Sagi Grimberg
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=20211123083346.GA1704@chelsio.com \
--to=varun@chelsio.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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 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.