scsi: lpfc: Convert abort handling to SLI-3 and SLI-4 handlers
[linux-2.6-microblaze.git] / drivers / scsi / lpfc / lpfc_nvmet.c
index 99d781e..8819213 100644 (file)
@@ -3327,6 +3327,46 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba,
        return 1;
 }
 
+/**
+ * lpfc_nvmet_prep_abort_wqe - set up 'abort' work queue entry.
+ * @pwqeq: Pointer to command iocb.
+ * @xritag: Tag that  uniqely identifies the local exchange resource.
+ * @opt: Option bits -
+ *             bit 0 = inhibit sending abts on the link
+ *
+ * This function is called with hbalock held.
+ **/
+void
+lpfc_nvmet_prep_abort_wqe(struct lpfc_iocbq *pwqeq, u16 xritag, u8 opt)
+{
+       union lpfc_wqe128 *wqe = &pwqeq->wqe;
+
+       /* WQEs are reused.  Clear stale data and set key fields to
+        * zero like ia, iaab, iaar, xri_tag, and ctxt_tag.
+        */
+       memset(wqe, 0, sizeof(*wqe));
+
+       if (opt & INHIBIT_ABORT)
+               bf_set(abort_cmd_ia, &wqe->abort_cmd, 1);
+       /* Abort specified xri tag, with the mask deliberately zeroed */
+       bf_set(abort_cmd_criteria, &wqe->abort_cmd, T_XRI_TAG);
+
+       bf_set(wqe_cmnd, &wqe->abort_cmd.wqe_com, CMD_ABORT_XRI_CX);
+
+       /* Abort the I/O associated with this outstanding exchange ID. */
+       wqe->abort_cmd.wqe_com.abort_tag = xritag;
+
+       /* iotag for the wqe completion. */
+       bf_set(wqe_reqtag, &wqe->abort_cmd.wqe_com, pwqeq->iotag);
+
+       bf_set(wqe_qosd, &wqe->abort_cmd.wqe_com, 1);
+       bf_set(wqe_lenloc, &wqe->abort_cmd.wqe_com, LPFC_WQE_LENLOC_NONE);
+
+       bf_set(wqe_cmd_type, &wqe->abort_cmd.wqe_com, OTHER_COMMAND);
+       bf_set(wqe_wqec, &wqe->abort_cmd.wqe_com, 1);
+       bf_set(wqe_cqid, &wqe->abort_cmd.wqe_com, LPFC_WQE_CQ_ID_DEFAULT);
+}
+
 static int
 lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba,
                               struct lpfc_async_xchg_ctx *ctxp,
@@ -3422,7 +3462,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba,
        /* Ready - mark outstanding as aborted by driver. */
        abts_wqeq->iocb_flag |= LPFC_DRIVER_ABORTED;
 
-       lpfc_nvme_prep_abort_wqe(abts_wqeq, ctxp->wqeq->sli4_xritag, opt);
+       lpfc_nvmet_prep_abort_wqe(abts_wqeq, ctxp->wqeq->sli4_xritag, opt);
 
        /* ABTS WQE must go to the same WQ as the WQE to be aborted */
        abts_wqeq->hba_wqidx = ctxp->wqeq->hba_wqidx;