Re: [PATCH v1 0/1] nvme-tcp: fix wrong status on deferred digest error

Xixin Liu <[email protected]>
Newsgroups org.infradead.lists.linux-nvme,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Hannes,

Thanks for the review. This is not a wire to host conversion. req->status
already mixes wire and host values. Digest error stores a host SC. u16
makes the host SC explicit. __le16 is endian packaging for wire layout.
The SUCCESS rsp branch overwrites with cqe->status, which is wire. A host
SC must be shifted left before nvme_try_complete_req.

Without DATA_SUCCESS, digest error is deferred to the rsp path:

	req->status = cpu_to_le16(NVME_SC_DATA_XFER_ERROR);   /* host SC */

	if (req->status == cpu_to_le16(NVME_SC_SUCCESS))
		req->status = cqe->status;   /* wire */
	if (!nvme_try_complete_req(rq, req->status, cqe->result))

Both branches pass req->status into nvme_try_complete_req, which expects
wire:

	nvme_req(req)->status = le16_to_cpu(status) >> 1;

SUCCESS is fine. Non-SUCCESS still holds host SC 04h Data Transfer Error,
so 0x4 becomes INVALID_FIELD, 0x2.

v1 changed req->status to u16. v2 keeps __le16 as you suggested. Please
take a look at both and say which you prefer for merge. I will send v2
shortly.

Thanks,
Xixin Liu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.