From: james_p_freyensee@linux.intel.com (J Freyensee)
Subject: [PATCH v3 6/7] nvme-fabrics: Add target support for FC transport
Date: Wed, 26 Oct 2016 12:09:13 -0700 [thread overview]
Message-ID: <1477508953.3009.97.camel@linux.intel.com> (raw)
In-Reply-To: <580d0ffe.SFprDuHa1JbmKoHU%james.smart@broadcom.com>
> +static void
> +nvmet_fc_xmt_fcp_op_done(struct nvmefc_tgt_fcp_req *fcpreq)
> +{
> + struct nvmet_fc_fcp_iod *fod = fcpreq->nvmet_fc_private;
> + struct nvmet_fc_tgtport *tgtport = fod->tgtport;
> + struct nvme_fc_ersp_iu *ersp = &fod->rspiubuf;
> + struct nvme_completion *cqe = &ersp->cqe;
> +
> + switch (fcpreq->op) {
> +
> + case NVMET_FCOP_WRITEDATA:
> + if (fcpreq->fcp_error) {
> + nvmet_req_complete(&fod->req, fcpreq-
> >fcp_error);
> + return;
> + }
> + if (fcpreq->transferred_length != fcpreq-
> >transfer_length) {
> + nvmet_req_complete(&fod->req,
> + NVME_SC_FC_TRANSPORT_ERROR);
> + return;
> + }
> +
> + fod->offset += fcpreq->transferred_length;
> + if (fod->offset != fod->total_length) {
> + /* transfer the next chunk */
> + nvmet_fc_transfer_fcp_data(tgtport, fod,
> + NVMET_FCOP_WRITEDATA
> );
> + return;
> + }
> +
> + /* data transfer complete, resume with nvmet layer
> */
> +
> + fod->req.execute(&fod->req);
> +
> + break;
> +
> + case NVMET_FCOP_READDATA:
> + if (fcpreq->fcp_error) {
> + /* overwrite the nvmet status */
> + cqe->status = cpu_to_le16(fcpreq-
> >fcp_error);
> + } else if (fcpreq->transferred_length !=
> + fcpreq->transfer_length) {
> + /* overwrite the nvmet status */
> + cqe->status =
> cpu_to_le16(NVME_SC_FC_TRANSPORT_ERROR);
> + } else {
> + fod->offset += fcpreq->transferred_length;
> + if (fod->offset != fod->total_length) {
> + /* transfer the next chunk */
> + nvmet_fc_transfer_fcp_data(tgtport,
> fod,
> + NVMET_FCOP_R
> EADDATA);
> + return;
> + }
> + }
> +
> + /* data transfer complete, send response */
> +
> + /* data no longer needed */
> + nvmet_fc_free_tgt_pgs(fod);
> +
> + if (unlikely(atomic_read(&fod->aborted)))
> + nvmet_fc_abort_op(tgtport, fod->fcpreq);
> + else
> + nvmet_fc_xmt_fcp_rsp(tgtport, fod);
> +
> + break;
> +
> + case NVMET_FCOP_READDATA_RSP:
> + if (fcpreq->fcp_error) {
> + /* overwrite the nvmet status */
> + cqe->status = cpu_to_le16(fcpreq-
> >fcp_error);
> + } else if (fcpreq->transferred_length !=
> + fcpreq->transfer_length) {
> + /* overwrite the nvmet status */
> + cqe->status =
> cpu_to_le16(NVME_SC_FC_TRANSPORT_ERROR);
> + } else
> + fod->offset += fcpreq->transferred_length;
> +
> + /* data transfer complete, response complete as well
> */
> +
> + /* data no longer needed */
> + nvmet_fc_free_tgt_pgs(fod);
> +
> + dma_sync_single_for_cpu(tgtport->dev, fod->rspdma,
> + sizeof(fod->rspiubuf),
> DMA_TO_DEVICE);
> + nvmet_fc_free_fcp_iod(tgtport, fod);
> + nvmet_fc_tgt_q_put(fod->queue);
> + break;
> +
> + case NVMET_FCOP_RSP:
> + case NVMET_FCOP_ABORT:
> + dma_sync_single_for_cpu(tgtport->dev, fod->rspdma,
> + sizeof(fod->rspiubuf),
> DMA_TO_DEVICE);
> + nvmet_fc_free_fcp_iod(tgtport, fod);
> + nvmet_fc_tgt_q_put(fod->queue);
> + break;
> +
> + default:
> + atomic_set(&fod->aborted, 1);
> + nvmet_fc_abort_op(tgtport, fod->fcpreq);
My brain zeroed in on the *abort() functionality, which I don't quite
understand. ?Apologies for the basic question here but is this correct
that nvmet_fc_abort_op() is *NOT* called for the NVMET_FCOP_ABORT case
but nvmet_fc_abort_op() *IS* called for the default case?
Other than that it looks ok,
Reviewed-by: Jay Freyensee <james_p_freyensee at linux.intel.com>
next prev parent reply other threads:[~2016-10-26 19:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-23 19:31 [PATCH v3 6/7] nvme-fabrics: Add target support for FC transport James Smart
2016-10-26 19:09 ` J Freyensee [this message]
[not found] ` <1638bc85-4b94-a74d-e0ef-c955c6f7bf83@broadcom.com>
2016-10-27 23:57 ` J Freyensee
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=1477508953.3009.97.camel@linux.intel.com \
--to=james_p_freyensee@linux.intel.com \
/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: link
Be 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.