From f29276eb5f994072eef5f104ee01ed7be5a3b1c3 Mon Sep 17 00:00:00 2001 From: Jacek Kalwas Date: Tue, 25 Feb 2020 18:33:38 +0100 Subject: [PATCH] nvme: put cpl status into union 3rd party library can be integrated with spdk code. To simplify that integration nvme status filed within that patch is exposed as union with u16. Having that is easier to assign spdk status when rhs is u16 and easier to read when lhs is u16. However, both sides need to be aligned with nvme spec. To align with SPDK style it shall be rather status.bits / status.raw but it requires a lot of changes in nvme/nvmf library. Note: According to spec phase tag is not within status but Linux driver does similar, when rsp needs to be set it just shift left 1. Signed-off-by: Jacek Kalwas Change-Id: I90940cbd2851b7d56dd928d801e60cd9dde05b7f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/996 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- include/spdk/nvme_spec.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/spdk/nvme_spec.h b/include/spdk/nvme_spec.h index 07b2673be..2c20ec9b4 100644 --- a/include/spdk/nvme_spec.h +++ b/include/spdk/nvme_spec.h @@ -1103,7 +1103,10 @@ struct spdk_nvme_cpl { /* dword 3 */ uint16_t cid; /* command identifier */ - struct spdk_nvme_status status; + union { + uint16_t status_raw; + struct spdk_nvme_status status; + }; }; SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_cpl) == 16, "Incorrect size");