Commit bd407444 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

nvmf/tcp: fix data digest error reporting



When a data digest error is detected, only the status.sc field of the
CQE was filled, leaving sct and cid unassigned.  The former isn't a big
deal, because the CQE is always zeroed when a new request arrives and,
incidentally, sct=GENERIC is defined as 0.  However, not filling cid
means that the target would always report data digest errors for cid=0,
regardless of the actual id of the command.

Change-Id: Ia6d7be365cc9416472cd4c4cc479bb695552fdb4
Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20446


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 2a07b467
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -2018,8 +2018,6 @@ data_crc32_calc_done(void *cb_arg, int status)
{
	struct nvme_tcp_pdu *pdu = cb_arg;
	struct spdk_nvmf_tcp_qpair *tqpair = pdu->qpair;
	struct spdk_nvmf_tcp_req *tcp_req;
	struct spdk_nvme_cpl *rsp;

	/* async crc32 calculation is failed and use direct calculation to check */
	if (spdk_unlikely(status)) {
@@ -2030,10 +2028,9 @@ data_crc32_calc_done(void *cb_arg, int status)
	pdu->data_digest_crc32 ^= SPDK_CRC32C_XOR;
	if (!MATCH_DIGEST_WORD(pdu->data_digest, pdu->data_digest_crc32)) {
		SPDK_ERRLOG("Data digest error on tqpair=(%p) with pdu=%p\n", tqpair, pdu);
		tcp_req = pdu->req;
		assert(tcp_req != NULL);
		rsp = &tcp_req->req.rsp->nvme_cpl;
		rsp->status.sc = SPDK_NVME_SC_COMMAND_TRANSIENT_TRANSPORT_ERROR;
		assert(pdu->req != NULL);
		nvmf_tcp_req_set_cpl(pdu->req, SPDK_NVME_SCT_GENERIC,
				     SPDK_NVME_SC_COMMAND_TRANSIENT_TRANSPORT_ERROR);
	}
	_nvmf_tcp_pdu_payload_handle(tqpair, pdu);
}
+7 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ rpc_cmd << CONFIG
	accel_assign_opc -o crc32c -m error
	framework_start_init
	bdev_null_create null0 100 4096
	nvmf_create_transport $NVMF_TRANSPORT_OPTS
	nvmf_create_transport $NVMF_TRANSPORT_OPTS --in-capsule-data-size 4096
	nvmf_create_subsystem "$nqn" -a
	nvmf_subsystem_add_ns "$nqn" null0
	nvmf_subsystem_add_listener -t tcp -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" "$nqn"
@@ -77,5 +77,11 @@ trap cleanup SIGINT SIGTERM EXIT
run_bperf randread 4096 128
run_bperf randread $((128 * 1024)) 16

# Test the writes - the target should detect digest errors, complete the commands with a transient
# transport error and the host should retry them until successful.  Test both small writes fitting
# within a CapsuleCmd as well as large ones requiring H2CData PDUs.
run_bperf randwrite 4096 128
run_bperf randwrite $((128 * 1024)) 16

trap - SIGINT SIGTERM EXIT
nvmftestfini