Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvmet: Export nvmet_update_cc() and nvmet_cc_xxx() helpers

Make the function nvmet_update_cc() available to target drivers by
exporting it. To also facilitate the manipulation of the cc register
bits, move the inline helper functions nvmet_cc_en(), nvmet_cc_css(),
nvmet_cc_mps(), nvmet_cc_ams(), nvmet_cc_shn(), nvmet_cc_iosqes(), and
nvmet_cc_iocqes() from core.c to nvmet.h so that these functions can be
reused in target controller drivers.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>

authored by

Damien Le Moal and committed by
Keith Busch
15e9d264 5d4f4ea8

+36 -35
+1 -35
drivers/nvme/target/core.c
··· 1166 1166 } 1167 1167 EXPORT_SYMBOL_GPL(nvmet_req_free_sgls); 1168 1168 1169 - static inline bool nvmet_cc_en(u32 cc) 1170 - { 1171 - return (cc >> NVME_CC_EN_SHIFT) & 0x1; 1172 - } 1173 - 1174 - static inline u8 nvmet_cc_css(u32 cc) 1175 - { 1176 - return (cc >> NVME_CC_CSS_SHIFT) & 0x7; 1177 - } 1178 - 1179 - static inline u8 nvmet_cc_mps(u32 cc) 1180 - { 1181 - return (cc >> NVME_CC_MPS_SHIFT) & 0xf; 1182 - } 1183 - 1184 - static inline u8 nvmet_cc_ams(u32 cc) 1185 - { 1186 - return (cc >> NVME_CC_AMS_SHIFT) & 0x7; 1187 - } 1188 - 1189 - static inline u8 nvmet_cc_shn(u32 cc) 1190 - { 1191 - return (cc >> NVME_CC_SHN_SHIFT) & 0x3; 1192 - } 1193 - 1194 - static inline u8 nvmet_cc_iosqes(u32 cc) 1195 - { 1196 - return (cc >> NVME_CC_IOSQES_SHIFT) & 0xf; 1197 - } 1198 - 1199 - static inline u8 nvmet_cc_iocqes(u32 cc) 1200 - { 1201 - return (cc >> NVME_CC_IOCQES_SHIFT) & 0xf; 1202 - } 1203 - 1204 1169 static inline bool nvmet_css_supported(u8 cc_css) 1205 1170 { 1206 1171 switch (cc_css << NVME_CC_CSS_SHIFT) { ··· 1242 1277 ctrl->csts &= ~NVME_CSTS_SHST_CMPLT; 1243 1278 mutex_unlock(&ctrl->lock); 1244 1279 } 1280 + EXPORT_SYMBOL_GPL(nvmet_update_cc); 1245 1281 1246 1282 static void nvmet_init_cap(struct nvmet_ctrl *ctrl) 1247 1283 {
+35
drivers/nvme/target/nvmet.h
··· 732 732 u16 errno_to_nvme_status(struct nvmet_req *req, int errno); 733 733 u16 nvmet_report_invalid_opcode(struct nvmet_req *req); 734 734 735 + static inline bool nvmet_cc_en(u32 cc) 736 + { 737 + return (cc >> NVME_CC_EN_SHIFT) & 0x1; 738 + } 739 + 740 + static inline u8 nvmet_cc_css(u32 cc) 741 + { 742 + return (cc >> NVME_CC_CSS_SHIFT) & 0x7; 743 + } 744 + 745 + static inline u8 nvmet_cc_mps(u32 cc) 746 + { 747 + return (cc >> NVME_CC_MPS_SHIFT) & 0xf; 748 + } 749 + 750 + static inline u8 nvmet_cc_ams(u32 cc) 751 + { 752 + return (cc >> NVME_CC_AMS_SHIFT) & 0x7; 753 + } 754 + 755 + static inline u8 nvmet_cc_shn(u32 cc) 756 + { 757 + return (cc >> NVME_CC_SHN_SHIFT) & 0x3; 758 + } 759 + 760 + static inline u8 nvmet_cc_iosqes(u32 cc) 761 + { 762 + return (cc >> NVME_CC_IOSQES_SHIFT) & 0xf; 763 + } 764 + 765 + static inline u8 nvmet_cc_iocqes(u32 cc) 766 + { 767 + return (cc >> NVME_CC_IOCQES_SHIFT) & 0xf; 768 + } 769 + 735 770 /* Convert a 32-bit number to a 16-bit 0's based number */ 736 771 static inline __le16 to0based(u32 a) 737 772 {