nvmet: debugfs support
Subsystems (5)
v5 cover nvmet: debugfs support
I've picked up Hannes series, because it allows to reset a controler which is very helpful to implement failover tests in blktests.
Original cover letter:
taking up the original patchset for nvmet debugfs
I've improved upon that submission by modifying
the layout:
/dev/kernel/debug/nvmet
<subsysnqn>
ctrl<cntlid>
port
state
hostnqn
kato
host_traddr
The 'state' attribute is the value of the
CSTS register; one can trigger a controller reset
by writing 'fatal' into it (to set CSTS.CFS).
Changes to v4:
add RV by Chaitanya
addresse comments from CChaitanya
Changes to v3:
- drop patch to add queue entries
Reviews from Sagi
Changes to v2:
- Move the 'host_traddr' attribute to the
controller directory
- Rename callback to 'host_traddr'
Hannes Reinecke (7):
nvmet: add debugfs support
nvmet: add 'host_traddr' callback for debugfs
nvmet-tcp: implement host_traddr()
nvmet-rdma: implement host_traddr()
nvmet-fc: implement host_traddr()
nvme-fcloop: implement 'host_traddr'
lpfc_nvmet: implement 'host_traddr'
drivers/nvme/target/Kconfig | 9 ++ drivers/nvme/target/Makefile | 1 + drivers/nvme/target/core.c | 30 ++++- drivers/nvme/target/debugfs.c | 202 +++++++++++++++++++++++++++++++++ drivers/nvme/target/debugfs.h | 42 +++++++ drivers/nvme/target/fc.c | 33 ++++++ drivers/nvme/target/fcloop.c | 11 ++ drivers/nvme/target/nvmet.h | 12 +- drivers/nvme/target/rdma.c | 12 ++ drivers/nvme/target/tcp.c | 14 +++ drivers/scsi/lpfc/lpfc_nvmet.c | 11 ++ include/linux/nvme-fc-driver.h | 4 + 12 files changed, 378 insertions(+), 3 deletions(-) create mode 100644 drivers/nvme/target/debugfs.c create mode 100644 drivers/nvme/target/debugfs.h
Signature · 1 line
2.45.1
PATCH v5 1/7 nvmet: add debugfs support
From: Hannes Reinecke <[email protected]>
Add a debugfs hierarchy to display the configured subsystems and the controllers attached to the subsystems.
--- drivers/nvme/target/Kconfig | 9 ++ drivers/nvme/target/Makefile | 1 + drivers/nvme/target/core.c | 22 +++- drivers/nvme/target/debugfs.c | 183 ++++++++++++++++++++++++++++++++++ drivers/nvme/target/debugfs.h | 42 ++++++++ drivers/nvme/target/nvmet.h | 8 +- 6 files changed, 262 insertions(+), 3 deletions(-) create mode 100644 drivers/nvme/target/debugfs.c create mode 100644 drivers/nvme/target/debugfs.h
drivers/nvme/target/Kconfig +9 -0
@@ -18,6 +18,15 @@ config NVME_TARGET To configure the NVMe target you probably want to use the nvmetcli tool from http://git.infradead.org/users/hch/nvmetcli.git. +config NVME_TARGET_DEBUGFS + bool "NVMe Target debugfs support" + depends on NVME_TARGET + help + This enables debugfs support to display the connected controllers + to each subsystem + + If unsure, say N. + config NVME_TARGET_PASSTHRU bool "NVMe Target Passthrough support" depends on NVME_TARGET
drivers/nvme/target/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_NVME_TARGET_TCP) += nvmet-tcp.o nvmet-y += core.o configfs.o admin-cmd.o fabrics-cmd.o \ discovery.o io-cmd-file.o io-cmd-bdev.o +nvmet-$(CONFIG_NVME_TARGET_DEBUGFS) += debugfs.o nvmet-$(CONFIG_NVME_TARGET_PASSTHRU) += passthru.o nvmet-$(CONFIG_BLK_DEV_ZONED) += zns.o nvmet-$(CONFIG_NVME_TARGET_AUTH) += fabrics-cmd-auth.o auth.o
drivers/nvme/target/core.c +21 -1
@@ -16,6 +16,7 @@#include "trace.h" #include "nvmet.h" +#include "debugfs.h" struct kmem_cache *nvmet_bvec_cache;struct workqueue_struct *buffered_io_wq;
@@ -1466,6 +1467,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,mutex_lock (&subsys->lock);list_add_tail (&ctrl->subsys_entry, &subsys->ctrls);nvmet_setup_p2p_ns_map (ctrl, req); +nvmet_debugfs_ctrl_setup (ctrl);mutex_unlock (&subsys->lock); *ctrlp = ctrl;
@@ -1500,6 +1502,8 @@ static void nvmet_ctrl_free(struct kref *ref)nvmet_destroy_auth (ctrl); +nvmet_debugfs_ctrl_free (ctrl); +ida_free (&cntlid_ida, ctrl->cntlid);nvmet_async_events_free (ctrl);
@@ -1613,8 +1617,14 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,INIT_LIST_HEAD (&subsys->ctrls);INIT_LIST_HEAD (&subsys->hosts); + ret =nvmet_debugfs_subsys_setup (subsys); +if (ret) + goto free_subsysnqn; +return subsys; +free_subsysnqn: +kfree (subsys->subsysnqn); free_fr:kfree (subsys->firmware_rev); free_mn:
@@ -1631,6 +1641,8 @@ static void nvmet_subsys_free(struct kref *ref)WARN_ON_ONCE (!xa_empty (&subsys->namespaces)); +nvmet_debugfs_subsys_free (subsys); +xa_destroy (&subsys->namespaces);nvmet_passthru_subsys_free (subsys);
@@ -1684,11 +1696,18 @@ static int __init nvmet_init(void)if (error) goto out_free_nvmet_work_queue; - error =nvmet_init_configfs (); + error =nvmet_init_debugfs ();if (error) goto out_exit_discovery; + + error =nvmet_init_configfs (); +if (error) + goto out_exit_debugfs; +return 0 ; +out_exit_debugfs: +nvmet_exit_debugfs (); out_exit_discovery:nvmet_exit_discovery (); out_free_nvmet_work_queue:
@@ -1705,6 +1724,7 @@ static int __init nvmet_init(void) static void __exit nvmet_exit(void) {nvmet_exit_configfs (); +nvmet_exit_debugfs ();nvmet_exit_discovery ();ida_destroy (&cntlid_ida);destroy_workqueue (nvmet_wq);
drivers/nvme/target/debugfs.c new file +183 -0
183 lines not on this page · raw message
drivers/nvme/target/debugfs.h new file +42 -0
42 lines not on this page · raw message
drivers/nvme/target/nvmet.h +6 -2
@@ -230,7 +230,9 @@ struct nvmet_ctrl {struct device *p2p_client;struct radix_tree_root p2p_ns_map; - +#ifdef CONFIG_NVME_TARGET_DEBUGFS +struct dentry *debugfs_dir; +#endif spinlock_t error_lock;u64 err_counter;struct nvme_error_slot slots[NVMET_ERROR_LOG_SLOTS ];
@@ -262,7 +264,9 @@ struct nvmet_subsys {struct list_head hosts;bool allow_any_host; - +#ifdef CONFIG_NVME_TARGET_DEBUGFS +struct dentry *debugfs_dir; +#endif u16 max_qid;u64 ver;
Signature · 1 line
2.45.1
PATCH v5 2/7 nvmet: add 'host_traddr' callback for debugfs
In reply to Daniel WagnerFrom: Hannes Reinecke <[email protected]>
We want to display the transport address of the connected host in debugfs, but this is a property of the transport. So add a callback 'host_traddr' to allow the transport drivers to fill in the data.
--- drivers/nvme/target/core.c | 8 ++++++++ drivers/nvme/target/debugfs.c | 19 +++++++++++++++++++ drivers/nvme/target/nvmet.h | 4 ++++ 3 files changed, 31 insertions(+)
drivers/nvme/target/core.c +8 -0
@@ -1530,6 +1530,14 @@ void nvmet_ctrl_fatal_error(struct nvmet_ctrl *ctrl) }EXPORT_SYMBOL_GPL (nvmet_ctrl_fatal_error); +ssize_t nvmet_ctrl_host_traddr (struct nvmet_ctrl *ctrl, +char *traddr,size_t traddr_len) +{ +if (!ctrl->ops->host_traddr) +return -EOPNOTSUPP ; +return ctrl->ops->host_traddr (ctrl, traddr, traddr_len); +} +static struct nvmet_subsys *nvmet_find_get_subsys (struct nvmet_port *port,const char *subsysnqn) {
drivers/nvme/target/debugfs.c +19 -0
@@ -115,6 +115,23 @@ static ssize_t nvmet_ctrl_state_write(struct file *file, const char __user *buf, }NVMET_DEBUGFS_RW_ATTR (nvmet_ctrl_state); +static int nvmet_ctrl_host_traddr_show (struct seq_file *m,void *p) +{ +struct nvmet_ctrl *ctrl = m->private; +ssize_t size; +char buf[NVMF_TRADDR_SIZE +1 ]; + + size =nvmet_ctrl_host_traddr (ctrl, buf,NVMF_TRADDR_SIZE ); +if (size <0 ) { + buf[0 ] ='\0' ; + size =0 ; + } + buf[size] ='\0' ; +seq_printf (m,"%s\n" , buf); +return 0 ; +} +NVMET_DEBUGFS_ATTR (nvmet_ctrl_host_traddr); +int nvmet_debugfs_ctrl_setup (struct nvmet_ctrl *ctrl) {char name[32 ];
@@ -138,6 +155,8 @@ int nvmet_debugfs_ctrl_setup(struct nvmet_ctrl *ctrl) &nvmet_ctrl_kato_fops);debugfs_create_file ("state" ,S_IRUSR |S_IWUSR , ctrl->debugfs_dir, ctrl, &nvmet_ctrl_state_fops); +debugfs_create_file ("host_traddr" ,S_IRUSR , ctrl->debugfs_dir, ctrl, + &nvmet_ctrl_host_traddr_fops);return 0 ; }
drivers/nvme/target/nvmet.h +4 -0
@@ -354,6 +354,8 @@ struct nvmet_fabrics_ops {void (*delete_ctrl)(struct nvmet_ctrl *ctrl);void (*disc_traddr)(struct nvmet_req *req,struct nvmet_port *port,char *traddr); +ssize_t (*host_traddr)(struct nvmet_ctrl *ctrl, +char *traddr,size_t traddr_len);u16 (*install_queue)(struct nvmet_sq *nvme_sq);void (*discovery_chg)(struct nvmet_port *port);u8 (*get_mdts)(const struct nvmet_ctrl *ctrl);
@@ -502,6 +504,8 @@ struct nvmet_ctrl *nvmet_ctrl_find_get(const char *subsysnqn, struct nvmet_req *req);void nvmet_ctrl_put (struct nvmet_ctrl *ctrl);u16 nvmet_check_ctrl_status (struct nvmet_req *req); +ssize_t nvmet_ctrl_host_traddr (struct nvmet_ctrl *ctrl, +char *traddr,size_t traddr_len);struct nvmet_subsys *nvmet_subsys_alloc (const char *subsysnqn,enum nvme_subsys_type type);
Signature · 1 line
2.45.1
PATCH v5 3/7 nvmet-tcp: implement host_traddr()
In reply to Daniel WagnerFrom: Hannes Reinecke <[email protected]>
Implement callback to display the host transport address.
--- drivers/nvme/target/tcp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/nvme/target/tcp.c +14 -0
@@ -2170,6 +2170,19 @@ static void nvmet_tcp_disc_port_addr(struct nvmet_req *req, } } +static ssize_t nvmet_tcp_host_port_addr (struct nvmet_ctrl *ctrl, +char *traddr,size_t traddr_len) +{ +struct nvmet_sq *sq = ctrl->sqs[0 ]; +struct nvmet_tcp_queue *queue = + container_of(sq, struct nvmet_tcp_queue, nvme_sq); + +if (queue->sockaddr_peer.ss_family ==AF_UNSPEC ) +return -EINVAL ; +return snprintf (traddr, traddr_len,"%pISc" , + (struct sockaddr *)&queue->sockaddr_peer); +} +static const struct nvmet_fabrics_ops nvmet_tcp_ops = { .owner =THIS_MODULE , .type =NVMF_TRTYPE_TCP ,
@@ -2180,6 +2193,7 @@ static const struct nvmet_fabrics_ops nvmet_tcp_ops = { .delete_ctrl = nvmet_tcp_delete_ctrl, .install_queue = nvmet_tcp_install_queue, .disc_traddr = nvmet_tcp_disc_port_addr, + .host_traddr = nvmet_tcp_host_port_addr, };static int __init nvmet_tcp_init (void )
Signature · 1 line
2.45.1
PATCH v5 4/7 nvmet-rdma: implement host_traddr()
In reply to Daniel WagnerFrom: Hannes Reinecke <[email protected]>
Implement callback to display the host transport address.
--- drivers/nvme/target/rdma.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/nvme/target/rdma.c +12 -0
@@ -2008,6 +2008,17 @@ static void nvmet_rdma_disc_port_addr(struct nvmet_req *req, } } +static ssize_t nvmet_rdma_host_port_addr (struct nvmet_ctrl *ctrl, +char *traddr,size_t traddr_len) +{ +struct nvmet_sq *nvme_sq = ctrl->sqs[0 ]; +struct nvmet_rdma_queue *queue = + container_of(nvme_sq, struct nvmet_rdma_queue, nvme_sq); + +return snprintf (traddr, traddr_len,"%pISc" , + (struct sockaddr *)&queue->cm_id->route.addr.dst_addr); +} +static u8 nvmet_rdma_get_mdts (const struct nvmet_ctrl *ctrl) {if (ctrl->pi_support)
@@ -2032,6 +2043,7 @@ static const struct nvmet_fabrics_ops nvmet_rdma_ops = { .queue_response = nvmet_rdma_queue_response, .delete_ctrl = nvmet_rdma_delete_ctrl, .disc_traddr = nvmet_rdma_disc_port_addr, + .host_traddr = nvmet_rdma_host_port_addr, .get_mdts = nvmet_rdma_get_mdts, .get_max_queue_size = nvmet_rdma_get_max_queue_size, };
Signature · 1 line
2.45.1
PATCH v5 5/7 nvmet-fc: implement host_traddr()
In reply to Daniel WagnerFrom: Hannes Reinecke <[email protected]>
Implement callback to display the host transport address by adding a callback 'host_traddr' for nvmet_fc_target_template.
--- drivers/nvme/target/fc.c | 33 +++++++++++++++++++++++++++++++++ include/linux/nvme-fc-driver.h | 4 ++++ 2 files changed, 37 insertions(+)
drivers/nvme/target/fc.c +33 -0
@@ -2931,6 +2931,38 @@ nvmet_fc_discovery_chg(struct nvmet_port *port) tgtport->ops->discovery_event (&tgtport->fc_target_port); } +static ssize_t +nvmet_fc_host_traddr (struct nvmet_ctrl *ctrl, +char *traddr,size_t traddr_size) +{ +struct nvmet_sq *sq = ctrl->sqs[0 ]; +struct nvmet_fc_tgt_queue *queue = + container_of(sq, struct nvmet_fc_tgt_queue, nvme_sq); +struct nvmet_fc_tgtport *tgtport = queue->assoc ? queue->assoc->tgtport :NULL ; +struct nvmet_fc_hostport *hostport = queue->assoc ? queue->assoc->hostport :NULL ; +u64 wwnn, wwpn; +ssize_t ret =0 ; + +if (!tgtport || !nvmet_fc_tgtport_get (tgtport)) +return -ENODEV ; +if (!hostport || !nvmet_fc_hostport_get (hostport)) { + ret = -ENODEV ; + goto out_put; + } + +if (tgtport->ops->host_traddr) { + ret = tgtport->ops->host_traddr (hostport->hosthandle, &wwnn, &wwpn); +if (ret) + goto out_put_host; + ret =snprintf (traddr, traddr_size,"nn-0x%llx:pn-0x%llx" , wwnn, wwpn); + } +out_put_host: +nvmet_fc_hostport_put (hostport); +out_put: +nvmet_fc_tgtport_put (tgtport); +return ret; +} +static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { .owner =THIS_MODULE , .type =NVMF_TRTYPE_FC ,
@@ -2940,6 +2972,7 @@ static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { .queue_response = nvmet_fc_fcp_nvme_cmd_done, .delete_ctrl = nvmet_fc_delete_ctrl, .discovery_chg = nvmet_fc_discovery_chg, + .host_traddr = nvmet_fc_host_traddr, };static int __init nvmet_fc_init_module (void )
include/linux/nvme-fc-driver.h +4 -0
@@ -920,6 +920,9 @@ struct nvmet_fc_target_port {* further references to hosthandle. * Entrypoint is Mandatory if the lldd calls nvmet_fc_invalidate_host(). * +* @host_traddr: called by the transport to retrieve the node name and +* port name of the host port address. +* * @max_hw_queues: indicates the maximum number of hw queues the LLDD * supports for cpu affinitization. * Value is Mandatory. Must be at least 1.
@@ -975,6 +978,7 @@ struct nvmet_fc_target_template {void (*ls_abort)(struct nvmet_fc_target_port *targetport,void *hosthandle,struct nvmefc_ls_req *lsreq);void (*host_release)(void *hosthandle); +int (*host_traddr)(void *hosthandle,u64 *wwnn,u64 *wwpn);u32 max_hw_queues;u16 max_sgl_segments;
Signature · 1 line
2.45.1
Re: [PATCH v5 5/7] nvmet-fc: implement host_traddr()
Quoted 80 lines · Daniel Wagner
From: Hannes Reinecke <[email protected]>
Implement callback to display the host transport address by adding a callback '
host_traddr' fornvmet_fc_target_template.Signed-off-by Hannes Reinecke <[email protected]>Reviewed-by Sagi Grimberg <[email protected]>Reviewed-by Chaitanya Kulkarni <[email protected]>Signed-off-by Daniel Wagner <[email protected]>--- drivers/nvme/target/fc.c | 33 +++++++++++++++++++++++++++++++++ include/linux/nvme-fc-driver.h | 4 ++++ 2 files changed, 37 insertions(+)drivers/nvme/target/fc.c +33
-0@@ -2931,6 +2931,38 @@ nvmet_fc_discovery_chg(struct nvmet_port *port) tgtport->ops->discovery_event (&tgtport->fc_target_port); } +static ssize_t +nvmet_fc_host_traddr (struct nvmet_ctrl *ctrl, +char *traddr,size_t traddr_size) +{ +struct nvmet_sq *sq = ctrl->sqs[0 ]; +struct nvmet_fc_tgt_queue *queue = + container_of(sq, struct nvmet_fc_tgt_queue, nvme_sq); +struct nvmet_fc_tgtport *tgtport = queue->assoc ? queue->assoc->tgtport :NULL ; +struct nvmet_fc_hostport *hostport = queue->assoc ? queue->assoc->hostport :NULL ; +u64 wwnn, wwpn; +ssize_t ret =0 ; + +if (!tgtport || !nvmet_fc_tgtport_get (tgtport)) +return -ENODEV ; +if (!hostport || !nvmet_fc_hostport_get (hostport)) { + ret = -ENODEV ; + goto out_put; + } + +if (tgtport->ops->host_traddr) { + ret = tgtport->ops->host_traddr (hostport->hosthandle, &wwnn, &wwpn); +if (ret) + goto out_put_host; + ret =snprintf (traddr, traddr_size,"nn-0x%llx:pn-0x%llx" , wwnn, wwpn); + } +out_put_host: +nvmet_fc_hostport_put (hostport); +out_put: +nvmet_fc_tgtport_put (tgtport); +return ret; +} +static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { .owner =THIS_MODULE , .type =NVMF_TRTYPE_FC ,@@ -2940,6 +2972,7 @@ static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { .queue_response = nvmet_fc_fcp_nvme_cmd_done, .delete_ctrl = nvmet_fc_delete_ctrl, .discovery_chg = nvmet_fc_discovery_chg, + .host_traddr = nvmet_fc_host_traddr, };static int __init nvmet_fc_init_module (void )include/linux/nvme-fc-driver.h +3
-0@@ -920,6 +920,9 @@ struct nvmet_fc_target_port {* further references to hosthandle. * Entrypoint is Mandatory if the lldd calls nvmet_fc_invalidate_host(). * +* @host_traddr: called by the transport to retrieve the node name and +* port name of the host port address. +* * @max_hw_queues: indicates the maximum number of hw queues the LLDD * supports for cpu affinitization. * Value is Mandatory. Must be at least 1.
include/linux/nvme-fc-driver.h struct nvmet_fc_target_template { · line 984
Quoted 7 lines
include/linux/nvme-fc-driver.h +1
-0@@ -975,6 +978,7 @@ struct nvmet_fc_target_template {void (*ls_abort)(struct nvmet_fc_target_port *targetport,void *hosthandle,struct nvmefc_ls_req *lsreq);void (*host_release)(void *hosthandle); +int (*host_traddr)(void *hosthandle,u64 *wwnn,u64 *wwpn);u32 max_hw_queues;u16 max_sgl_segments;
-- james
PATCH v5 6/7 nvme-fcloop: implement 'host_traddr'
In reply to Daniel WagnerFrom: Hannes Reinecke <[email protected]>
Implement the 'host_traddr' callback to display the host transport address for nvmet debugfs.
--- drivers/nvme/target/fcloop.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/nvme/target/fcloop.c +11 -0
@@ -492,6 +492,16 @@ fcloop_t2h_host_release(void *hosthandle)/* host handle ignored for now */ } +static int +fcloop_t2h_host_traddr (void *hosthandle,u64 *wwnn,u64 *wwpn) +{ +struct fcloop_rport *rport = hosthandle; + + *wwnn = rport->lport->localport->node_name; + *wwpn = rport->lport->localport->port_name; +return 0 ; +} +/* * Simulate reception of RSCN and converting it to a initiator transport * call to rescan a remote port.
@@ -1074,6 +1084,7 @@ static struct nvmet_fc_target_template tgttemplate = { .ls_req = fcloop_t2h_ls_req, .ls_abort = fcloop_t2h_ls_abort, .host_release = fcloop_t2h_host_release, + .host_traddr = fcloop_t2h_host_traddr, .max_hw_queues = FCLOOP_HW_QUEUES, .max_sgl_segments = FCLOOP_SGL_SEGS, .max_dif_sgl_segments = FCLOOP_SGL_SEGS,
Signature · 1 line
2.45.1
Re: [PATCH v5 6/7] nvme-fcloop: implement 'host_traddr'
Quoted 35 lines · Daniel Wagner
From: Hannes Reinecke <[email protected]>
Implement the '
host_traddr' callback to display the host transport address for nvmet debugfs.Signed-off-by Hannes Reinecke <[email protected]>Reviewed-by Sagi Grimberg <[email protected]>Reviewed-by Chaitanya Kulkarni <[email protected]>Signed-off-by Daniel Wagner <[email protected]>--- drivers/nvme/target/fcloop.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/nvme/target/fcloop.c +10
-0@@ -492,6 +492,16 @@ fcloop_t2h_host_release(void *hosthandle)/* host handle ignored for now */ } +static int +fcloop_t2h_host_traddr (void *hosthandle,u64 *wwnn,u64 *wwpn) +{ +struct fcloop_rport *rport = hosthandle; + + *wwnn = rport->lport->localport->node_name; + *wwpn = rport->lport->localport->port_name; +return 0 ; +} +/* * Simulate reception of RSCN and converting it to a initiator transport * call to rescan a remote port.
drivers/nvme/target/fcloop.c static struct nvmet_fc_target_template tgttemplate = { · line 1090
Quoted 7 lines
drivers/nvme/target/fcloop.c +1
-0@@ -1074,6 +1084,7 @@ static struct nvmet_fc_target_template tgttemplate = { .ls_req = fcloop_t2h_ls_req, .ls_abort = fcloop_t2h_ls_abort, .host_release = fcloop_t2h_host_release, + .host_traddr = fcloop_t2h_host_traddr, .max_hw_queues = FCLOOP_HW_QUEUES, .max_sgl_segments = FCLOOP_SGL_SEGS, .max_dif_sgl_segments = FCLOOP_SGL_SEGS,
Daniel,
I found it odd that you had to modify fcloop, but now see what the issue is. We should have had the WWN of the initiator passed to the fc tgt transport at the same time hosthandle was first passed. There's several ways to do this, such as the one you coded or modifying the ls_rcv call. Downside to these are they change the template or calling routines and breaks the driver/os binary api in an os that picks them up.
I'd like to look at doing this a little differently. Change hosthandle, instead of pointing to a void, points to a host structure, with the host structure containing WWPN, WWNN, and N_Port_ID. We can set a target_features bit to know if the structure is a void or a host struct. This keeps the driver/os api in place. I'll put something together.
Thoughts ?
-- james
James Smart
Reviewed-byRe: [PATCH v5 6/7] nvme-fcloop: implement 'host_traddr'
Quoted 46 lines · James Smart
Quoted 41 lines · Daniel Wagner
From: Hannes Reinecke <[email protected]>
Implement the '
host_traddr' callback to display the host transport address for nvmet debugfs.Signed-off-by Hannes Reinecke <[email protected]>Reviewed-by Sagi Grimberg <[email protected]>Reviewed-by Chaitanya Kulkarni <[email protected]>Signed-off-by Daniel Wagner <[email protected]>---
drivers/nvme/target/fcloop.c| 11 +++++++++++1 file changed, 11 insertions(+)drivers/nvme/target/fcloop.c +11
-0@@ -492,6 +492,16 @@ fcloop_t2h_host_release(void *hosthandle) /* host handle ignored for now */ } +static int +fcloop_t2h_host_traddr (void *hosthandle,u64 *wwnn,u64 *wwpn) +{ + struct fcloop_rport *rport = hosthandle; + + *wwnn = rport->lport->localport->node_name; + *wwpn = rport->lport->localport->port_name; + return 0; +} + /** Simulate reception of RSCN and converting it to a initiator transport * call to rescan a remote port. @@ -1074,6 +1084,7 @@ static struct nvmet_fc_target_template tgttemplate = { .ls_req = fcloop_t2h_ls_req, .ls_abort = fcloop_t2h_ls_abort, .host_release = fcloop_t2h_host_release, + .host_traddr = fcloop_t2h_host_traddr, .max_hw_queues = FCLOOP_HW_QUEUES, .max_sgl_segments = FCLOOP_SGL_SEGS,Quoted 1 line
.max_dif_sgl_segments =
FCLOOP_SGL_SEGS,Daniel,
Quoted 8 lines
I found it odd that you had to modify fcloop, but now see what the issue is. We should have had the WWN of the initiator passed to the fc tgt transport at the same time hosthandle was first passed. There's several ways to do this, such as the one you coded or modifying the
ls_rcvcall. Downside to these are they change the template or calling routines and breaks the driver/os binary api in an os that picks them up.I'd like to look at doing this a little differently. Change hosthandle, instead of pointing to a void, points to a host structure, with the host structure containing WWPN, WWNN, and
N_Port_ID. We can set atarget_featuresbit to know if the structure is a void or a host struct. This keeps the driver/os api in place. I'll put something together.Thoughts ?
-- james
It's a little involved in the hba driver to do what I was suggesting. So I think the easiest is what was proposed.
-- james
PATCH v5 7/7 lpfc_nvmet: implement 'host_traddr'
In reply to Daniel WagnerFrom: Hannes Reinecke <[email protected]>
Implement the 'host_traddr' callback to display the host transport address for nvmet debugfs.
--- drivers/scsi/lpfc/lpfc_nvmet.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/scsi/lpfc/lpfc_nvmet.c +11 -0
@@ -1363,6 +1363,16 @@ lpfc_nvmet_ls_abort(struct nvmet_fc_target_port *targetport,atomic_inc (&lpfc_nvmet->xmt_ls_abort); } +static int +lpfc_nvmet_host_traddr (void *hosthandle,u64 *wwnn,u64 *wwpn) +{ +struct lpfc_nodelist *ndlp = hosthandle; + + *wwnn =wwn_to_u64 (ndlp->nlp_nodename.u.wwn); + *wwpn =wwn_to_u64 (ndlp->nlp_portname.u.wwn); +return 0 ; +} +static void lpfc_nvmet_host_release (void *hosthandle) {
@@ -1413,6 +1423,7 @@ static struct nvmet_fc_target_template lpfc_tgttemplate = { .ls_req = lpfc_nvmet_ls_req, .ls_abort = lpfc_nvmet_ls_abort, .host_release = lpfc_nvmet_host_release, + .host_traddr = lpfc_nvmet_host_traddr, .max_hw_queues = 1, .max_sgl_segments = LPFC_NVMET_DEFAULT_SEGS,
Signature · 1 line
2.45.1
Re: [PATCH v5 7/7] lpfc_nvmet: implement 'host_traddr'
Quoted 2 lines · Daniel Wagner
I've picked up Hannes series, because it allows to reset a controler which is very helpful to implement failover tests in blktests.
I see that the nvme-6.11 branch has been created. What about queueing this series up?
Thanks,
Daniel
Keith Busch
maintainerQuoted 6 lines · Daniel Wagner
Quoted 2 lines · Daniel Wagner
I've picked up Hannes series, because it allows to reset a controler which is very helpful to implement failover tests in blktests.
I see that the nvme-6.11 branch has been created. What about queueing this series up?
I'm going to have to rebase that tree after the block 6.11 tree is created. I published the nvme one because I didn't want to spend time figuring out how to compile the apple driver, so posted it for the build bots. :)
But sure, I'll start getting these queued up.