Skip to content

Commit 4db24ee

Browse files
Martin Belangerdwsuse
authored andcommitted
types: Add Discovery Information Managment types
Add Discovery Information Management related types for TP8010. Signed-off-by: Martin Belanger <[email protected]> [dwagner: renaming, adding documation and reformating] Signed-off-by: Daniel Wagner <[email protected]>
1 parent db1cf34 commit 4db24ee

2 files changed

Lines changed: 249 additions & 28 deletions

File tree

src/nvme/types.h

Lines changed: 243 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4494,6 +4494,38 @@ enum nvmf_disc_eflags {
44944494
NVMF_DISC_EFLAGS_BOTH = 3,
44954495
};
44964496

4497+
/**
4498+
* union nvmf_tsas - Transport Specific Address Subtype
4499+
* @common: Common transport specific attributes
4500+
* @rdma: RDMA transport specific attribute settings
4501+
* @qptype: RDMA QP Service Type (RDMA_QPTYPE): Specifies the type of RDMA
4502+
* Queue Pair. See &enum nvmf_rdma_qptype.
4503+
* @prtype: RDMA Provider Type (RDMA_PRTYPE): Specifies the type of RDMA
4504+
* provider. See &enum nvmf_rdma_prtype.
4505+
* @cms: RDMA Connection Management Service (RDMA_CMS): Specifies the type
4506+
* of RDMA IP Connection Management Service. See &enum nvmf_rdma_cms.
4507+
* @pkey: RDMA_PKEY: Specifies the Partition Key when AF_IB (InfiniBand)
4508+
* address family type is used.
4509+
* @tcp: TCP transport specific attribute settings
4510+
* @sectype: Security Type (SECTYPE): Specifies the type of security used by the
4511+
* NVMe/TCP port. If SECTYPE is a value of 0h (No Security), then the
4512+
* host shall set up a normal TCP connection. See &enum nvmf_tcp_sectype.
4513+
*/
4514+
union nvmf_tsas {
4515+
char common[NVMF_TSAS_SIZE];
4516+
struct rdma {
4517+
__u8 qptype;
4518+
__u8 prtype;
4519+
__u8 cms;
4520+
__u8 rsvd3[5];
4521+
__u16 pkey;
4522+
__u8 rsvd10[246];
4523+
} rdma;
4524+
struct tcp {
4525+
__u8 sectype;
4526+
} tcp;
4527+
};
4528+
44974529
/**
44984530
* struct nvmf_disc_log_entry - Discovery Log Page entry
44994531
* @trtype: Transport Type (TRTYPE): Specifies the NVMe Transport type.
@@ -4539,20 +4571,6 @@ enum nvmf_disc_eflags {
45394571
* that may be used for a Connect command as an ASCII string. The
45404572
* Address Family field describes the reference for parsing this field.
45414573
* @tsas: Transport specific attribute settings
4542-
* @common: Common transport specific attributes
4543-
* @rdma: RDMA transport specific attribute settings
4544-
* @qptype: RDMA QP Service Type (RDMA_QPTYPE): Specifies the type of RDMA
4545-
* Queue Pair. See &enum nvmf_rdma_qptype.
4546-
* @prtype: RDMA Provider Type (RDMA_PRTYPE): Specifies the type of RDMA
4547-
* provider. See &enum nvmf_rdma_prtype.
4548-
* @cms: RDMA Connection Management Service (RDMA_CMS): Specifies the type
4549-
* of RDMA IP Connection Management Service. See &enum nvmf_rdma_cms.
4550-
* @pkey: RDMA_PKEY: Specifies the Partition Key when AF_IB (InfiniBand)
4551-
* address family type is used.
4552-
* @tcp: TCP transport specific attribute settings
4553-
* @sectype: Security Type (SECTYPE): Specifies the type of security used by the
4554-
* NVMe/TCP port. If SECTYPE is a value of 0h (No Security), then the
4555-
* host shall set up a normal TCP connection. See &enum nvmf_tcp_sectype.
45564574
*/
45574575
struct nvmf_disc_log_entry {
45584576
__u8 trtype;
@@ -4568,20 +4586,7 @@ struct nvmf_disc_log_entry {
45684586
__u8 rsvd64[192];
45694587
char subnqn[NVME_NQN_LENGTH];
45704588
char traddr[NVMF_TRADDR_SIZE];
4571-
union tsas {
4572-
char common[NVMF_TSAS_SIZE];
4573-
struct rdma {
4574-
__u8 qptype;
4575-
__u8 prtype;
4576-
__u8 cms;
4577-
__u8 rsvd3[5];
4578-
__u16 pkey;
4579-
__u8 rsvd10[246];
4580-
} rdma;
4581-
struct tcp {
4582-
__u8 sectype;
4583-
} tcp;
4584-
} tsas;
4589+
union nvmf_tsas tsas;
45854590
};
45864591

45874592
/**
@@ -4712,6 +4717,172 @@ struct nvmf_discovery_log {
47124717
struct nvmf_disc_log_entry entries[];
47134718
};
47144719

4720+
/*
4721+
* Discovery Information Management (DIM) command. This is sent by a
4722+
* host to a Discovery Controller (DC) to perform explicit registration.
4723+
*/
4724+
#define NVMF_ENAME_LEN 256
4725+
#define NVMF_EVER_LEN 64
4726+
4727+
/**
4728+
* enum nvmf_dim_tas - Discovery Information Management Task
4729+
* @NVMF_DIM_TAS_REGISTER: Register
4730+
* @NVMF_DIM_TAS_DEREGISTER: Deregister
4731+
* @NVMF_DIM_TAS_UPDATE: Update
4732+
*/
4733+
enum nvmf_dim_tas {
4734+
NVMF_DIM_TAS_REGISTER = 0x00,
4735+
NVMF_DIM_TAS_DEREGISTER = 0x01,
4736+
NVMF_DIM_TAS_UPDATE = 0x02,
4737+
};
4738+
4739+
/**
4740+
* enum nvmf_dim_entfmt - Discovery Information Management Entry Format
4741+
* @NVMF_DIM_ENTFMT_BASIC: Basic discovery information entry
4742+
* @NVMF_DIM_ENTFMT_EXTENDED: Extended discovery information entry
4743+
*/
4744+
enum nvmf_dim_entfmt
4745+
{
4746+
NVMF_DIM_ENTFMT_BASIC = 0x01,
4747+
NVMF_DIM_ENTFMT_EXTENDED = 0x02,
4748+
};
4749+
4750+
/**
4751+
* enum nvmf_dim_etype -Discovery Information Management Entity Type
4752+
* @NVMF_DIM_ETYPE_HOST: Host
4753+
* @NVMF_DIM_ETYPE_DDC: Direct Discovery controller
4754+
* @NVMF_DIM_ETYPE_CDC: Centralized Discovery controller
4755+
*/
4756+
enum nvmf_dim_etype
4757+
{
4758+
NVMF_DIM_ETYPE_HOST = 0x01,
4759+
NVMF_DIM_ETYPE_DDC = 0x02,
4760+
NVMF_DIM_ETYPE_CDC = 0x03,
4761+
};
4762+
4763+
/**
4764+
* enum nvmf_exattype - Extended Attribute Type
4765+
* @NVMF_EXATTYPE_HOSTID: Host Identifier
4766+
* @NVMF_EXATTYPE_SYMNAME: Symblic Name
4767+
*/
4768+
enum nvmf_exattype
4769+
{
4770+
NVMF_EXATTYPE_HOSTID = 0x01,
4771+
NVMF_EXATTYPE_SYMNAME = 0x02,
4772+
};
4773+
4774+
/**
4775+
* struct nvmf_ext_attr - Extended Attribute (EXAT)
4776+
* @exattype: Extended Attribute Type (EXATTYPE) - see @enum nvmf_exattype
4777+
* @exatlen: Extended Attribute Length (EXATLEN)
4778+
* @exatval: Extended Attribute Value (EXATVAL) - size allocated for array
4779+
* must be a multiple of 4 bytes
4780+
*/
4781+
struct nvmf_ext_attr
4782+
{
4783+
__le16 exattype;
4784+
__le16 exatlen;
4785+
__u8 exatval[];
4786+
};
4787+
4788+
/**
4789+
* struct nvmf_ext_die - Extended Discovery Information Entry (DIE)
4790+
* @trtype: Transport Type (&enum nvmf_trtype)
4791+
* @adrfam: Address Family (&enum nvmf_addr_family)
4792+
* @subtype: Subsystem Type (&enum nvme_subsys_type)
4793+
* @treq: Transport Requirements (&enum nvmf_treq)
4794+
* @portid: Port ID
4795+
* @cntlid: Controller ID
4796+
* @asqsz: Admin Max SQ Size
4797+
* @rsvd10: Reserved
4798+
* @trsvcid: Transport Service Identifier
4799+
* @resv64: Reserved
4800+
* @nqn: NVM Qualified Name
4801+
* @traddr: Transport Address
4802+
* @tsas: Transport Specific Address Subtype (&union nvmf_tsas)
4803+
* @tel: Total Entry Length
4804+
* @numexat: Number of Extended Attributes
4805+
* @resv1030: Reserved
4806+
* @exat: Extented Attributes 0 (&struct nvmf_ext_attr)
4807+
*/
4808+
struct nvmf_ext_die
4809+
{
4810+
__u8 trtype;
4811+
__u8 adrfam;
4812+
__u8 subtype;
4813+
__u8 treq;
4814+
__le16 portid;
4815+
__le16 cntlid;
4816+
__le16 asqsz;
4817+
__u8 rsvd10[22];
4818+
char trsvcid[NVMF_TRSVCID_SIZE];
4819+
__u8 resv64[192];
4820+
char nqn[NVME_NQN_LENGTH];
4821+
char traddr[NVMF_TRADDR_SIZE];
4822+
union nvmf_tsas tsas;
4823+
__le32 tel;
4824+
__le16 numexat;
4825+
__u8 resv1030[2];
4826+
struct nvmf_ext_attr exat[];
4827+
};
4828+
4829+
/**
4830+
* union nvmf_die - Discovery Information Entry (DIE)
4831+
* @basic: Basic format (&struct nvmf_disc_log_entry)
4832+
* @extended: Extended format (&struct nvmf_ext_die)
4833+
*
4834+
* Depending on the ENTFMT specified in the DIM, DIEs can be entered
4835+
* with the Basic or Extended formats. For Basic format, each entry
4836+
* has a fixed length. Therefore, the "basic" field defined below can
4837+
* be accessed as a C array. For the Extended format, however, each
4838+
* entry is of variable length (TEL). Therefore, the "extended" field
4839+
* defined below cannot be accessed as a C array. Instead, the
4840+
* "extended" field is akin to a linked-list, where one can "walk"
4841+
* through the list. To move to the next entry, one simply adds the
4842+
* current entry's length (TEL) to the "walk" pointer. The number of
4843+
* entries in the list is specified by NUMENT. Although extended
4844+
* entries are of a variable lengths (TEL), TEL is always a mutiple of
4845+
* 4 bytes.
4846+
*/
4847+
union nvmf_die
4848+
{
4849+
struct nvmf_disc_log_entry basic[0];
4850+
struct nvmf_ext_die extended;
4851+
};
4852+
4853+
/**
4854+
* struct nvmf_dim_data - Discovery Information Management (DIM) - Data
4855+
* @tdl: Total Data Length
4856+
* @rsvd4: Reserved
4857+
* @nument: Number of entries
4858+
* @entfmt: Entry Format (&enum nvmf_dim_entfmt)
4859+
* @etype: Entity Type (&enum nvmf_dim_etype)
4860+
* @portlcl: Port Local
4861+
* @rsvd21: Reserved
4862+
* @ektype: Entry Key Type
4863+
* @eid: Entity Identifier (e.g. Host NQN)
4864+
* @ename: Entity Name (e.g. hostname)
4865+
* @ever: Entity Version (e.g. OS Name/Version)
4866+
* @rsvd600: Reserved
4867+
* @die: Discovery Information Entry (see @nument above)
4868+
*/
4869+
struct nvmf_dim_data
4870+
{
4871+
__le32 tdl;
4872+
__u8 rsvd4[4];
4873+
__le64 nument;
4874+
__le16 entfmt;
4875+
__le16 etype;
4876+
__u8 portlcl;
4877+
__u8 rsvd21;
4878+
__le16 ektype;
4879+
char eid[NVME_NQN_LENGTH];
4880+
char ename[NVMF_ENAME_LEN];
4881+
char ever[NVMF_EVER_LEN];
4882+
__u8 rsvd600[424];
4883+
union nvmf_die die[];
4884+
};
4885+
47154886
/**
47164887
* struct nvmf_connect_data - Data payload for the 'connect' command
47174888
* @hostid: Host ID of the connecting host
@@ -5411,6 +5582,32 @@ struct nvme_mi_vpd_hdr {
54115582
* @NVME_SC_IOCS_COMBINATION_REJECTED: I/O Command Set Combination Rejected
54125583
* @NVME_SC_INVALID_IOCS: Invalid I/O Command Set
54135584
* @NVME_SC_ID_UNAVAILABLE: Identifier Unavailable
5585+
* @NVME_SC_INVALID_DISCOVERY_INFO: The discovery information provided in
5586+
* one or more extended discovery
5587+
* information entries is not applicable
5588+
* for the type of entity selected in
5589+
* the Entity Type (ETYPE) field of the
5590+
* Discovery Information Management
5591+
* command data portion’s header.
5592+
* @NVME_SC_ZONING_DATA_STRUCT_LOCKED:The requested Zoning data structure
5593+
* is locked on the CDC.
5594+
* @NVME_SC_ZONING_DATA_STRUCT_NOTFND:The requested Zoning data structure
5595+
* does not exist on the CDC.
5596+
* @NVME_SC_INSUFFICIENT_DISC_RES: The number of discover information
5597+
* entries provided in the data portion
5598+
* of the Discovery Information
5599+
* Management command for a registration
5600+
* task (i.e., TAS field cleared to 0h)
5601+
* exceeds the available capacity for
5602+
* new discovery information entries on
5603+
* the CDC or DDC. This may be a
5604+
* transient condition.
5605+
* @NVME_SC_REQSTD_FUNCTION_DISABLED: Fabric Zoning is not enabled on the
5606+
* CDC
5607+
* @NVME_SC_ZONEGRP_ORIGINATOR_INVL: The NQN contained in the ZoneGroup
5608+
* Originator field does not match the
5609+
* Host NQN used by the DDC to connect
5610+
* to the CDC.
54145611
* @NVME_SC_BAD_ATTRIBUTES: Conflicting Dataset Management Attributes
54155612
* @NVME_SC_INVALID_PI: Invalid Protection Information
54165613
* @NVME_SC_READ_ONLY: Attempted Write to Read Only Range
@@ -5639,6 +5836,16 @@ enum nvme_status_field {
56395836
NVME_SC_INVALID_IOCS = 0x2c,
56405837
NVME_SC_ID_UNAVAILABLE = 0x2d,
56415838

5839+
/*
5840+
* Discovery Information Management
5841+
*/
5842+
NVME_SC_INVALID_DISCOVERY_INFO = 0x2f,
5843+
NVME_SC_ZONING_DATA_STRUCT_LOCKED = 0x30,
5844+
NVME_SC_ZONING_DATA_STRUCT_NOTFND = 0x31,
5845+
NVME_SC_INSUFFICIENT_DISC_RES = 0x32,
5846+
NVME_SC_REQSTD_FUNCTION_DISABLED = 0x33,
5847+
NVME_SC_ZONEGRP_ORIGINATOR_INVLD = 0x34,
5848+
56425849
/*
56435850
* I/O Command Set Specific - NVM commands:
56445851
*/
@@ -5752,7 +5959,11 @@ static inline __u16 nvme_status_code(__u16 status_field)
57525959
* @nvme_admin_nvme_mi_send:
57535960
* @nvme_admin_nvme_mi_recv:
57545961
* @nvme_admin_capacity_mgmt:
5962+
* @nvme_admin_discovery_info_mgmt: Discovery Information Management (DIM)
5963+
* @nvme_admin_fabric_zoning_recv: Fabric Zoning Receive
57555964
* @nvme_admin_lockdown:
5965+
* @nvme_admin_fabric_zoning_lookup: Fabric Zoning Lookup
5966+
* @nvme_admin_fabric_zoning_send: Fabric Zoning Send
57565967
* @nvme_admin_dbbuf:
57575968
* @nvme_admin_fabrics:
57585969
* @nvme_admin_format_nvm:
@@ -5785,7 +5996,11 @@ enum nvme_admin_opcode {
57855996
nvme_admin_nvme_mi_send = 0x1d,
57865997
nvme_admin_nvme_mi_recv = 0x1e,
57875998
nvme_admin_capacity_mgmt = 0x20,
5999+
nvme_admin_discovery_info_mgmt = 0x21,
6000+
nvme_admin_fabric_zoning_recv = 0x22,
57886001
nvme_admin_lockdown = 0x24,
6002+
nvme_admin_fabric_zoning_lookup = 0x25,
6003+
nvme_admin_fabric_zoning_send = 0x29,
57896004
nvme_admin_dbbuf = 0x7c,
57906005
nvme_admin_fabrics = 0x7f,
57916006
nvme_admin_format_nvm = 0x80,

src/nvme/util.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ static const char * const cmd_spec_status[] = {
241241
[NVME_SC_IOCS_COMBINATION_REJECTED] = "The I/O command set combination is rejected",
242242
[NVME_SC_INVALID_IOCS] = "The I/O command set is invalid",
243243
[NVME_SC_ID_UNAVAILABLE] = "Identifier Unavailable: The number of Endurance Groups or NVM Sets supported has been exceeded",
244+
[NVME_SC_INVALID_DISCOVERY_INFO] = "Discovery Info Entry not applicable to selected entity",
245+
[NVME_SC_ZONING_DATA_STRUCT_LOCKED] = "The requested Zoning data structure is locked on the CDC",
246+
[NVME_SC_ZONING_DATA_STRUCT_NOTFND] = "The requested Zoning data structure does not exist on the CDC",
247+
[NVME_SC_INSUFFICIENT_DISC_RES] = "Discovery Info entries exceed Discovery Controller's capacity",
248+
[NVME_SC_REQSTD_FUNCTION_DISABLED] = "Fabric Zoning is not enabled on the CDC",
249+
[NVME_SC_ZONEGRP_ORIGINATOR_INVLD] = "The NQN contained in the ZoneGroup Originator field does not match the Host NQN used by the DDC to connect to the CDC",
244250
};
245251

246252
static const char * const nvm_status[] = {

0 commit comments

Comments
 (0)