summaryrefslogtreecommitdiffstats
path: root/include/linux/nvme.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-06-27 14:03:06 -0400
committerJens Axboe <axboe@kernel.dk>2017-06-27 14:05:56 -0400
commitf5d118406247acfc4fc481e441e01ea4d6318fdc (patch)
tree876a519c0799d1ce9d51d904f63ec2e2e27a36ce /include/linux/nvme.h
parente6959b9350c6135b260d7b561153d9ad6c5d49ff (diff)
nvme: add support for streams and directives
This adds support for Directives in NVMe, particular for the Streams directive. Support for Directives is a new feature in NVMe 1.3. It allows a user to pass in information about where to store the data, so that it the device can do so most effiently. If an application is managing and writing data with different life times, mixing differently retentioned data onto the same locations on flash can cause write amplification to grow. This, in turn, will reduce performance and life time of the device. Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/nvme.h')
-rw-r--r--include/linux/nvme.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 291587a0743f..f516a975bb21 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -253,6 +253,7 @@ enum {
253 NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3, 253 NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3,
254 NVME_CTRL_VWC_PRESENT = 1 << 0, 254 NVME_CTRL_VWC_PRESENT = 1 << 0,
255 NVME_CTRL_OACS_SEC_SUPP = 1 << 0, 255 NVME_CTRL_OACS_SEC_SUPP = 1 << 0,
256 NVME_CTRL_OACS_DIRECTIVES = 1 << 5,
256 NVME_CTRL_OACS_DBBUF_SUPP = 1 << 7, 257 NVME_CTRL_OACS_DBBUF_SUPP = 1 << 7,
257}; 258};
258 259
@@ -304,6 +305,19 @@ enum {
304}; 305};
305 306
306enum { 307enum {
308 NVME_DIR_IDENTIFY = 0x00,
309 NVME_DIR_STREAMS = 0x01,
310 NVME_DIR_SND_ID_OP_ENABLE = 0x01,
311 NVME_DIR_SND_ST_OP_REL_ID = 0x01,
312 NVME_DIR_SND_ST_OP_REL_RSC = 0x02,
313 NVME_DIR_RCV_ID_OP_PARAM = 0x01,
314 NVME_DIR_RCV_ST_OP_PARAM = 0x01,
315 NVME_DIR_RCV_ST_OP_STATUS = 0x02,
316 NVME_DIR_RCV_ST_OP_RESOURCE = 0x03,
317 NVME_DIR_ENDIR = 0x01,
318};
319
320enum {
307 NVME_NS_FEAT_THIN = 1 << 0, 321 NVME_NS_FEAT_THIN = 1 << 0,
308 NVME_NS_FLBAS_LBA_MASK = 0xf, 322 NVME_NS_FLBAS_LBA_MASK = 0xf,
309 NVME_NS_FLBAS_META_EXT = 0x10, 323 NVME_NS_FLBAS_META_EXT = 0x10,
@@ -560,6 +574,7 @@ enum {
560 NVME_RW_PRINFO_PRCHK_APP = 1 << 11, 574 NVME_RW_PRINFO_PRCHK_APP = 1 << 11,
561 NVME_RW_PRINFO_PRCHK_GUARD = 1 << 12, 575 NVME_RW_PRINFO_PRCHK_GUARD = 1 << 12,
562 NVME_RW_PRINFO_PRACT = 1 << 13, 576 NVME_RW_PRINFO_PRACT = 1 << 13,
577 NVME_RW_DTYPE_STREAMS = 1 << 4,
563}; 578};
564 579
565struct nvme_dsm_cmd { 580struct nvme_dsm_cmd {
@@ -634,6 +649,8 @@ enum nvme_admin_opcode {
634 nvme_admin_download_fw = 0x11, 649 nvme_admin_download_fw = 0x11,
635 nvme_admin_ns_attach = 0x15, 650 nvme_admin_ns_attach = 0x15,
636 nvme_admin_keep_alive = 0x18, 651 nvme_admin_keep_alive = 0x18,
652 nvme_admin_directive_send = 0x19,
653 nvme_admin_directive_recv = 0x1a,
637 nvme_admin_dbbuf = 0x7C, 654 nvme_admin_dbbuf = 0x7C,
638 nvme_admin_format_nvm = 0x80, 655 nvme_admin_format_nvm = 0x80,
639 nvme_admin_security_send = 0x81, 656 nvme_admin_security_send = 0x81,
@@ -797,6 +814,24 @@ struct nvme_get_log_page_command {
797 __u32 rsvd14[2]; 814 __u32 rsvd14[2];
798}; 815};
799 816
817struct nvme_directive_cmd {
818 __u8 opcode;
819 __u8 flags;
820 __u16 command_id;
821 __le32 nsid;
822 __u64 rsvd2[2];
823 union nvme_data_ptr dptr;
824 __le32 numd;
825 __u8 doper;
826 __u8 dtype;
827 __le16 dspec;
828 __u8 endir;
829 __u8 tdtype;
830 __u16 rsvd15;
831
832 __u32 rsvd16[3];
833};
834
800/* 835/*
801 * Fabrics subcommands. 836 * Fabrics subcommands.
802 */ 837 */
@@ -927,6 +962,18 @@ struct nvme_dbbuf {
927 __u32 rsvd12[6]; 962 __u32 rsvd12[6];
928}; 963};
929 964
965struct streams_directive_params {
966 __u16 msl;
967 __u16 nssa;
968 __u16 nsso;
969 __u8 rsvd[10];
970 __u32 sws;
971 __u16 sgs;
972 __u16 nsa;
973 __u16 nso;
974 __u8 rsvd2[6];
975};
976
930struct nvme_command { 977struct nvme_command {
931 union { 978 union {
932 struct nvme_common_command common; 979 struct nvme_common_command common;
@@ -947,6 +994,7 @@ struct nvme_command {
947 struct nvmf_property_set_command prop_set; 994 struct nvmf_property_set_command prop_set;
948 struct nvmf_property_get_command prop_get; 995 struct nvmf_property_get_command prop_get;
949 struct nvme_dbbuf dbbuf; 996 struct nvme_dbbuf dbbuf;
997 struct nvme_directive_cmd directive;
950 }; 998 };
951}; 999};
952 1000