All of lore.kernel.org
 help / color / mirror / Atom feed
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] nvme-tcp: send H2CData PDUs based on MAXH2CDATA
Date: Thu, 18 Nov 2021 13:58:52 +0530	[thread overview]
Message-ID: <20211118082849.GA1697@chelsio.com> (raw)
In-Reply-To: <57fe4578-d8be-8c05-4f52-ece4b3f4cabb@grimberg.me>

On Wed, Nov 17, 2021 at 11:01:52AM +0200, Sagi Grimberg wrote:
> >  		}
> >@@ -1022,14 +1056,26 @@ static int nvme_tcp_try_send_data_pdu(struct nvme_tcp_request *req)
> >  	struct nvme_tcp_data_pdu *pdu = req->pdu;
> >  	u8 hdgst = nvme_tcp_hdgst_len(queue);
> >  	int len = sizeof(*pdu) - req->offset + hdgst;
> >+	int flags = MSG_DONTWAIT | MSG_MORE;
> >  	int ret;
> >  	if (queue->hdr_digest && !req->offset)
> >  		nvme_tcp_hdgst(queue->snd_hash, pdu, sizeof(*pdu));
> >-	ret = kernel_sendpage(queue->sock, virt_to_page(pdu),
> >-			offset_in_page(pdu) + req->offset, len,
> >-			MSG_DONTWAIT | MSG_MORE | MSG_SENDPAGE_NOTLAST);
> >+	if (req->rem_r2t_len) {
> >+		struct msghdr msg = { .msg_flags = flags };
> >+		struct kvec iov = {
> >+			.iov_base = (u8 *)pdu + req->offset,
> >+			.iov_len = len
> >+		};
> >+
> >+		ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len);
> >+	} else {
> >+		ret = kernel_sendpage(queue->sock, virt_to_page(pdu),
> >+				      offset_in_page(pdu) + req->offset, len,
> >+				      flags | MSG_SENDPAGE_NOTLAST);
> >+	}
> 
> Why is this needed? Seems out-of-place to me...

As per my understanding kernel_sendpage() does zero copy TX, return
from kernel_sendpage() does not guarantee that buffer is transmitted
or DMA read by NIC. Is this not correct?

If driver reuses same buffer for next H2CData PDU header it can
corrupt previous H2CData PDU header.

I will send v2 with other suggested changes.


  reply	other threads:[~2021-11-18  8:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 12:23 [PATCH] nvme-tcp: send H2CData PDUs based on MAXH2CDATA Varun Prakash
2021-11-17  9:01 ` Sagi Grimberg
2021-11-18  8:28   ` Varun Prakash [this message]
2021-11-18  9:10     ` 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=20211118082849.GA1697@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.