From: James Smart <james.smart@broadcom.com> To: J Freyensee <james_p_freyensee@linux.intel.com>, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org Subject: Re: [PATCH 5/5] nvme-fabrics: Add FC LLDD loopback driver to test FC host and target transport Date: Mon, 22 Aug 2016 10:14:25 -0700 [thread overview] Message-ID: <15eab2d7-b42f-27f1-f934-369db6911c47@broadcom.com> (raw) In-Reply-To: <1470183344.3928.54.camel@linux.intel.com> On 8/2/2016 5:15 PM, J Freyensee wrote: > >> +int >> +fcloop_fcp_op(struct nvmet_fc_target_port *tgtport, >> + struct nvmefc_tgt_fcp_req *tgt_fcpreq) >> +{ >> + ... >> + >> + return 0; > if this function returns an 'int', why would it always return 0 and not > the fcp_err values (if there is an error)? I'll look at it. The reason it's carried in the tgt_fcpreq is that a real LLDD would likely return from the fcp_op, and report an error later on. I'll see if things should be reorg'd. > >> +struct nvme_fc_port_template fctemplate = { >> + .create_queue = fcloop_create_queue, >> + .delete_queue = fcloop_delete_queue, >> + .ls_req = fcloop_ls_req, >> + .fcp_io = fcloop_fcp_req, >> + .ls_abort = fcloop_ls_abort, >> + .fcp_abort = fcloop_fcp_abort, >> + >> + .max_hw_queues = 1, >> + .max_sgl_segments = 256, >> + .max_dif_sgl_segments = 256, >> + .dma_boundary = 0xFFFFFFFF, > Between here and "struct nvmet_fc_target_template tgttemplate" they are > assigning the same magic values to the same variable names, so why not > have these values as #defines for a tad easier maintainability? sure. > >> +static ssize_t >> +fcloop_create_local_port(struct device *dev, struct device_attribute >> *attr, >> + const char *buf, size_t count) >> +{ >> + struct nvme_fc_port_info pinfo; >> + struct fcloop_ctrl_options *opts; >> + struct nvme_fc_local_port *localport; >> + struct fcloop_lport *lport; >> + int ret; >> + >> + opts = kzalloc(sizeof(*opts), GFP_KERNEL); >> + if (!opts) >> + return -ENOMEM; >> + >> + ret = fcloop_parse_options(opts, buf); >> + if (ret) >> + goto out_free_opts; >> + >> + /* everything there ? */ >> + if ((opts->mask & LPORT_OPTS) != LPORT_OPTS) { >> + ret = -EINVAL; >> + goto out_free_opts; >> + } >> + >> + pinfo.fabric_name = opts->fabric; >> + pinfo.node_name = opts->wwnn; >> + pinfo.port_name = opts->wwpn; >> + pinfo.port_role = opts->roles; >> + pinfo.port_id = opts->fcaddr; >> + >> + ret = nvme_fc_register_localport(&pinfo, &fctemplate, NULL, >> &localport); >> + if (!ret) { >> + /* success */ >> + lport = localport->private; >> + lport->localport = localport; >> + INIT_LIST_HEAD(&lport->list); >> + INIT_LIST_HEAD(&lport->rport_list); >> + list_add_tail(&lport->list, &fcloop_lports); >> + >> + /* mark all of the input buffer consumed */ >> + ret = count; >> + } >> + >> +out_free_opts: >> + kfree(opts); >> + return ret; >> +} >> + >> +static int __delete_local_port(struct fcloop_lport *lport) >> +{ >> + int ret; >> + >> + if (!list_empty(&lport->rport_list)) >> + return -EBUSY; >> + >> + list_del(&lport->list); >> + > Is a mutex or locking mechanism not needed here for this list? Yeah - could probably use. As it was mainly a test tool with a controlled sequence, I think I ignored it. -- james
WARNING: multiple messages have this Message-ID (diff)
From: james.smart@broadcom.com (James Smart) Subject: [PATCH 5/5] nvme-fabrics: Add FC LLDD loopback driver to test FC host and target transport Date: Mon, 22 Aug 2016 10:14:25 -0700 [thread overview] Message-ID: <15eab2d7-b42f-27f1-f934-369db6911c47@broadcom.com> (raw) In-Reply-To: <1470183344.3928.54.camel@linux.intel.com> On 8/2/2016 5:15 PM, J Freyensee wrote: > >> +int >> +fcloop_fcp_op(struct nvmet_fc_target_port *tgtport, >> + struct nvmefc_tgt_fcp_req *tgt_fcpreq) >> +{ >> + ... >> + >> + return 0; > if this function returns an 'int', why would it always return 0 and not > the fcp_err values (if there is an error)? I'll look at it. The reason it's carried in the tgt_fcpreq is that a real LLDD would likely return from the fcp_op, and report an error later on. I'll see if things should be reorg'd. > >> +struct nvme_fc_port_template fctemplate = { >> + .create_queue = fcloop_create_queue, >> + .delete_queue = fcloop_delete_queue, >> + .ls_req = fcloop_ls_req, >> + .fcp_io = fcloop_fcp_req, >> + .ls_abort = fcloop_ls_abort, >> + .fcp_abort = fcloop_fcp_abort, >> + >> + .max_hw_queues = 1, >> + .max_sgl_segments = 256, >> + .max_dif_sgl_segments = 256, >> + .dma_boundary = 0xFFFFFFFF, > Between here and "struct nvmet_fc_target_template tgttemplate" they are > assigning the same magic values to the same variable names, so why not > have these values as #defines for a tad easier maintainability? sure. > >> +static ssize_t >> +fcloop_create_local_port(struct device *dev, struct device_attribute >> *attr, >> + const char *buf, size_t count) >> +{ >> + struct nvme_fc_port_info pinfo; >> + struct fcloop_ctrl_options *opts; >> + struct nvme_fc_local_port *localport; >> + struct fcloop_lport *lport; >> + int ret; >> + >> + opts = kzalloc(sizeof(*opts), GFP_KERNEL); >> + if (!opts) >> + return -ENOMEM; >> + >> + ret = fcloop_parse_options(opts, buf); >> + if (ret) >> + goto out_free_opts; >> + >> + /* everything there ? */ >> + if ((opts->mask & LPORT_OPTS) != LPORT_OPTS) { >> + ret = -EINVAL; >> + goto out_free_opts; >> + } >> + >> + pinfo.fabric_name = opts->fabric; >> + pinfo.node_name = opts->wwnn; >> + pinfo.port_name = opts->wwpn; >> + pinfo.port_role = opts->roles; >> + pinfo.port_id = opts->fcaddr; >> + >> + ret = nvme_fc_register_localport(&pinfo, &fctemplate, NULL, >> &localport); >> + if (!ret) { >> + /* success */ >> + lport = localport->private; >> + lport->localport = localport; >> + INIT_LIST_HEAD(&lport->list); >> + INIT_LIST_HEAD(&lport->rport_list); >> + list_add_tail(&lport->list, &fcloop_lports); >> + >> + /* mark all of the input buffer consumed */ >> + ret = count; >> + } >> + >> +out_free_opts: >> + kfree(opts); >> + return ret; >> +} >> + >> +static int __delete_local_port(struct fcloop_lport *lport) >> +{ >> + int ret; >> + >> + if (!list_empty(&lport->rport_list)) >> + return -EBUSY; >> + >> + list_del(&lport->list); >> + > Is a mutex or locking mechanism not needed here for this list? Yeah - could probably use. As it was mainly a test tool with a controlled sequence, I think I ignored it. -- james
next prev parent reply other threads:[~2016-08-22 17:14 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-07-23 0:23 [PATCH 5/5] nvme-fabrics: Add FC LLDD loopback driver to test FC host and target transport James Smart 2016-07-23 0:23 ` James Smart 2016-08-03 0:15 ` J Freyensee 2016-08-03 0:15 ` J Freyensee 2016-08-22 17:14 ` James Smart [this message] 2016-08-22 17:14 ` James Smart 2016-08-11 21:23 ` Christoph Hellwig 2016-08-11 21:23 ` Christoph Hellwig 2016-08-22 17:29 ` James Smart 2016-08-22 17:29 ` James Smart
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=15eab2d7-b42f-27f1-f934-369db6911c47@broadcom.com \ --to=james.smart@broadcom.com \ --cc=james_p_freyensee@linux.intel.com \ --cc=linux-nvme@lists.infradead.org \ --cc=linux-scsi@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.