[PATCH 2/6] nvmet-tcp: only wait for in-capsule data for inline SGLs

Christoph Hellwig hch at lst.de
Thu Nov 12 13:12:46 PST 2026


On Tue, Nov 10, 2026 at 11:03:10PM +0800, shao.mingyin at zte.com.cn wrote:
> +/*
> + * Check whether the SGL of @cmd carries in-capsule data that the host
> + * will send right after the command PDU.  Only the offset form of the
> + * data block descriptor is in-capsule; a regular transport SGL is
> + * fetched through an R2T instead.
> + */
> +static inline bool nvmet_tcp_sgl_is_inline(struct nvmet_tcp_cmd *cmd)
> +{
> +	struct nvme_sgl_desc *sgl = &cmd->req.cmd->common.dptr.sgl;
> +	u32 len = le32_to_cpu(sgl->length);
> +
> +	return sgl->type == ((NVME_SGL_FMT_DATA_DESC << 4) |
> +			     NVME_SGL_FMT_OFFSET) &&
> +		nvme_is_write(cmd->req.cmd) && len &&
> +		len <= cmd->req.port->inline_data_size;

Nit: this would become much more readable if split into multiple
conditions instead of this giant compound expression.

Otherwise looks good.




More information about the Linux-nvme mailing list