Re: [PATCH] nvme/tcp: use in-capsule data for fabrics commands

Sagi Grimberg
2022-07-07T06:30:13Z

>> The maximum amount of in-capsule data for Fabrics and Admin Commands
>> is 8,192 bytes ... NVMe/TCP controllers must support in-capsule data
>> for Fabrics and Admin Command Capsules
>
> Currently, command data is only sent in-capsule on the admin queue
> or I/O queues that indicate support for it.
> Send fabrics command data in-capsule for I/O queues too to avoid
> needing a separate H2CData PDU.

The only fabrics command that is sent on an I/O queue is connect.
But I guess that if ioccsz=0 that would cause connect to use h2cdata...

>
> Signed-off-by: Caleb Sander <csander@purestorage.com>
> ---
> drivers/nvme/host/tcp.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index bb67538d2..f1869ab3c 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -207,12 +207,15 @@ static inline u8 nvme_tcp_hdgst_len(struct nvme_tcp_queue *queue)
> static inline u8 nvme_tcp_ddgst_len(struct nvme_tcp_queue *queue)
> {
> return queue->data_digest ? NVME_TCP_DIGEST_LENGTH : 0;
> }
>
> -static inline size_t nvme_tcp_inline_data_size(struct nvme_tcp_queue *queue)
> +static inline size_t nvme_tcp_inline_data_size(struct nvme_tcp_queue *queue,
> + struct nvme_tcp_request *req)
> {
> + if (nvme_is_fabrics(req->req.cmd))
> + return NVME_TCP_ADMIN_CCSZ;
> return queue->cmnd_capsule_len - sizeof(struct nvme_command);
> }
>
> static inline bool nvme_tcp_async_req(struct nvme_tcp_request *req)
> {
> @@ -227,11 +230,11 @@ static inline bool nvme_tcp_has_inline_data(struct nvme_tcp_request *req)
> return false; /* async events don't have a request */
>
> rq = blk_mq_rq_from_pdu(req);
>
> return rq_data_dir(rq) == WRITE && req->data_len &&
> - req->data_len <= nvme_tcp_inline_data_size(req->queue);
> + req->data_len <= nvme_tcp_inline_data_size(req->queue, req);

We can just pass req and reference the queue from the request itself.