Commit b6f67477 authored by John Levon's avatar John Levon Committed by Jim Harris
Browse files

nvme: add SPDK_NVME_IDENTIFY_BUFLEN



Add a define for the Identify command buffer instead of using a raw
value.

Signed-off-by: default avatarJohn Levon <john.levon@nutanix.com>
Change-Id: I9073ff84e2fa2ef9268051b898fe1027d8e97baa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16119


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent 4bb902a6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3809,6 +3809,9 @@ SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_ns_streams_status) == 131072, "Incorr
#define SPDK_NVME_IO_FLAGS_VALID_MASK 0xFFFF0003
#define SPDK_NVME_IO_FLAGS_CDW12_MASK 0xFFFF0000

/** Identify command buffer response size */
#define SPDK_NVME_IDENTIFY_BUFLEN 4096

#ifdef __cplusplus
}
#endif
+1 −1
Original line number Diff line number Diff line
@@ -2895,7 +2895,7 @@ nvmf_ctrlr_identify(struct spdk_nvmf_request *req)
	struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
	struct spdk_nvmf_subsystem *subsystem = ctrlr->subsys;

	if (req->data == NULL || req->length < 4096) {
	if (req->data == NULL || req->length < SPDK_NVME_IDENTIFY_BUFLEN) {
		SPDK_DEBUGLOG(nvmf, "identify command with invalid buffer\n");
		rsp->status.sct = SPDK_NVME_SCT_GENERIC;
		rsp->status.sc = SPDK_NVME_SC_INVALID_FIELD;
+2 −1
Original line number Diff line number Diff line
@@ -968,7 +968,8 @@ test_nvme_ctrlr_cmd_identify(void)
	int rc;
	MOCK_SET(nvme_ctrlr_submit_admin_request, 0);

	rc = nvme_ctrlr_cmd_identify(&ctrlr, SPDK_NVME_IDENTIFY_NS, 2, 1, 0, &payload, 4096, NULL, NULL);
	rc = nvme_ctrlr_cmd_identify(&ctrlr, SPDK_NVME_IDENTIFY_NS, 2, 1, 0, &payload,
				     SPDK_NVME_IDENTIFY_BUFLEN, NULL, NULL);
	CU_ASSERT(rc == 0);
	CU_ASSERT(req.cmd.opc == SPDK_NVME_OPC_IDENTIFY);
	CU_ASSERT(req.cmd.cdw10_bits.identify.cns == SPDK_NVME_IDENTIFY_NS);