nvme: add symbolic constants for CC identifiers
authorMax Gurtovoy <maxg@mellanox.com>
Sun, 13 Aug 2017 16:21:06 +0000 (19:21 +0300)
committerSagi Grimberg <sagi@grimberg.me>
Mon, 28 Aug 2017 20:00:38 +0000 (23:00 +0300)
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/core.c
include/linux/nvme.h

index ea7eb00dcb87c0517e3700c76e11b08451edf43d..7c23eaf8e5639c14b5824fad26bdd4d6642e45b1 100644 (file)
@@ -538,37 +538,37 @@ EXPORT_SYMBOL_GPL(nvmet_req_uninit);
 
 static inline bool nvmet_cc_en(u32 cc)
 {
-       return cc & 0x1;
+       return (cc >> NVME_CC_EN_SHIFT) & 0x1;
 }
 
 static inline u8 nvmet_cc_css(u32 cc)
 {
-       return (cc >> 4) & 0x7;
+       return (cc >> NVME_CC_CSS_SHIFT) & 0x7;
 }
 
 static inline u8 nvmet_cc_mps(u32 cc)
 {
-       return (cc >> 7) & 0xf;
+       return (cc >> NVME_CC_MPS_SHIFT) & 0xf;
 }
 
 static inline u8 nvmet_cc_ams(u32 cc)
 {
-       return (cc >> 11) & 0x7;
+       return (cc >> NVME_CC_AMS_SHIFT) & 0x7;
 }
 
 static inline u8 nvmet_cc_shn(u32 cc)
 {
-       return (cc >> 14) & 0x3;
+       return (cc >> NVME_CC_SHN_SHIFT) & 0x3;
 }
 
 static inline u8 nvmet_cc_iosqes(u32 cc)
 {
-       return (cc >> 16) & 0xf;
+       return (cc >> NVME_CC_IOSQES_SHIFT) & 0xf;
 }
 
 static inline u8 nvmet_cc_iocqes(u32 cc)
 {
-       return (cc >> 20) & 0xf;
+       return (cc >> NVME_CC_IOCQES_SHIFT) & 0xf;
 }
 
 static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
index a12b4707327323170c0caab84814136c49374e16..7b4322dc297542d402217d2c3c72f18a937f4c4e 100644 (file)
@@ -135,16 +135,22 @@ enum {
 enum {
        NVME_CC_ENABLE          = 1 << 0,
        NVME_CC_CSS_NVM         = 0 << 4,
+       NVME_CC_EN_SHIFT        = 0,
+       NVME_CC_CSS_SHIFT       = 4,
        NVME_CC_MPS_SHIFT       = 7,
-       NVME_CC_ARB_RR          = 0 << 11,
-       NVME_CC_ARB_WRRU        = 1 << 11,
-       NVME_CC_ARB_VS          = 7 << 11,
-       NVME_CC_SHN_NONE        = 0 << 14,
-       NVME_CC_SHN_NORMAL      = 1 << 14,
-       NVME_CC_SHN_ABRUPT      = 2 << 14,
-       NVME_CC_SHN_MASK        = 3 << 14,
-       NVME_CC_IOSQES          = NVME_NVM_IOSQES << 16,
-       NVME_CC_IOCQES          = NVME_NVM_IOCQES << 20,
+       NVME_CC_AMS_SHIFT       = 11,
+       NVME_CC_SHN_SHIFT       = 14,
+       NVME_CC_IOSQES_SHIFT    = 16,
+       NVME_CC_IOCQES_SHIFT    = 20,
+       NVME_CC_ARB_RR          = 0 << NVME_CC_AMS_SHIFT,
+       NVME_CC_ARB_WRRU        = 1 << NVME_CC_AMS_SHIFT,
+       NVME_CC_ARB_VS          = 7 << NVME_CC_AMS_SHIFT,
+       NVME_CC_SHN_NONE        = 0 << NVME_CC_SHN_SHIFT,
+       NVME_CC_SHN_NORMAL      = 1 << NVME_CC_SHN_SHIFT,
+       NVME_CC_SHN_ABRUPT      = 2 << NVME_CC_SHN_SHIFT,
+       NVME_CC_SHN_MASK        = 3 << NVME_CC_SHN_SHIFT,
+       NVME_CC_IOSQES          = NVME_NVM_IOSQES << NVME_CC_IOSQES_SHIFT,
+       NVME_CC_IOCQES          = NVME_NVM_IOCQES << NVME_CC_IOCQES_SHIFT,
        NVME_CSTS_RDY           = 1 << 0,
        NVME_CSTS_CFS           = 1 << 1,
        NVME_CSTS_NSSRO         = 1 << 4,