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.

nvme: Add PCI transport type

Define the transport type NVMF_TRTYPE_PCI for PCI endpoint targets.
This transport type is defined using the value 0 which is reserved in
the NVMe base specifications v2.1 (Figure 294). Given that struct
nvmet_port are zeroed out on creation, to avoid having this transsport
type becoming the new default, nvmet_referral_make() and
nvmet_ports_make() are modified to initialize a port discovery address
transport type field (disc_addr.trtype) to NVMF_TRTYPE_MAX.

Any port using this transport type is also skipped and not reported in
the discovery log page (nvmet_execute_disc_get_log_page()).

The helper function nvmet_is_pci_ctrl() is also introduced to check if
a target controller uses the PCI transport.

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
200adac7 35c593e5

+13
+4
drivers/nvme/target/configfs.c
··· 37 37 { NVMF_TRTYPE_RDMA, "rdma" }, 38 38 { NVMF_TRTYPE_FC, "fc" }, 39 39 { NVMF_TRTYPE_TCP, "tcp" }, 40 + { NVMF_TRTYPE_PCI, "pci" }, 40 41 { NVMF_TRTYPE_LOOP, "loop" }, 41 42 }; 42 43 ··· 47 46 { NVMF_ADDR_FAMILY_IP6, "ipv6" }, 48 47 { NVMF_ADDR_FAMILY_IB, "ib" }, 49 48 { NVMF_ADDR_FAMILY_FC, "fc" }, 49 + { NVMF_ADDR_FAMILY_PCI, "pci" }, 50 50 { NVMF_ADDR_FAMILY_LOOP, "loop" }, 51 51 }; 52 52 ··· 1841 1839 return ERR_PTR(-ENOMEM); 1842 1840 1843 1841 INIT_LIST_HEAD(&port->entry); 1842 + port->disc_addr.trtype = NVMF_TRTYPE_MAX; 1844 1843 config_group_init_type_name(&port->group, name, &nvmet_referral_type); 1845 1844 1846 1845 return &port->group; ··· 2067 2064 port->inline_data_size = -1; /* < 0 == let the transport choose */ 2068 2065 port->max_queue_size = -1; /* < 0 == let the transport choose */ 2069 2066 2067 + port->disc_addr.trtype = NVMF_TRTYPE_MAX; 2070 2068 port->disc_addr.portid = cpu_to_le16(portid); 2071 2069 port->disc_addr.adrfam = NVMF_ADDR_FAMILY_MAX; 2072 2070 port->disc_addr.treq = NVMF_TREQ_DISABLE_SQFLOW;
+3
drivers/nvme/target/discovery.c
··· 224 224 } 225 225 226 226 list_for_each_entry(r, &req->port->referrals, entry) { 227 + if (r->disc_addr.trtype == NVMF_TRTYPE_PCI) 228 + continue; 229 + 227 230 nvmet_format_discovery_entry(hdr, r, 228 231 NVME_DISC_SUBSYS_NAME, 229 232 r->disc_addr.traddr,
+5
drivers/nvme/target/nvmet.h
··· 693 693 return subsys->type != NVME_NQN_NVME; 694 694 } 695 695 696 + static inline bool nvmet_is_pci_ctrl(struct nvmet_ctrl *ctrl) 697 + { 698 + return ctrl->port->disc_addr.trtype == NVMF_TRTYPE_PCI; 699 + } 700 + 696 701 #ifdef CONFIG_NVME_TARGET_PASSTHRU 697 702 void nvmet_passthru_subsys_free(struct nvmet_subsys *subsys); 698 703 int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys);
+1
include/linux/nvme.h
··· 64 64 65 65 /* Transport Type codes for Discovery Log Page entry TRTYPE field */ 66 66 enum { 67 + NVMF_TRTYPE_PCI = 0, /* PCI */ 67 68 NVMF_TRTYPE_RDMA = 1, /* RDMA */ 68 69 NVMF_TRTYPE_FC = 2, /* Fibre Channel */ 69 70 NVMF_TRTYPE_TCP = 3, /* TCP/IP */