Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
[pandora-kernel.git] / drivers / scsi / bnx2i / bnx2i_hwi.c
index 99c71e6..8d9dbb3 100644 (file)
@@ -385,7 +385,6 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
        struct bnx2i_cmd *bnx2i_cmd;
        struct bnx2i_tmf_request *tmfabort_wqe;
        u32 dword;
-       u32 scsi_lun[2];
 
        bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data;
        tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@@ -393,38 +392,41 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
                                                bnx2i_conn->ep->qp.sq_prod_qe;
 
        tmfabort_wqe->op_code = tmfabort_hdr->opcode;
-       tmfabort_wqe->op_attr = 0;
-       tmfabort_wqe->op_attr =
-               ISCSI_TMF_REQUEST_ALWAYS_ONE | ISCSI_TM_FUNC_ABORT_TASK;
+       tmfabort_wqe->op_attr = tmfabort_hdr->flags;
 
        tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH << 14));
        tmfabort_wqe->reserved2 = 0;
        tmfabort_wqe->cmd_sn = be32_to_cpu(tmfabort_hdr->cmdsn);
 
-       ctask = iscsi_itt_to_task(conn, tmfabort_hdr->rtt);
-       if (!ctask || !ctask->sc)
-               /*
-                * the iscsi layer must have completed the cmd while this
-                * was starting up.
-                *
-                * Note: In the case of a SCSI cmd timeout, the task's sc
-                *       is still active; hence ctask->sc != 0
-                *       In this case, the task must be aborted
-                */
-               return 0;
-
-       ref_sc = ctask->sc;
-
-       /* Retrieve LUN directly from the ref_sc */
-       int_to_scsilun(ref_sc->device->lun, (struct scsi_lun *) scsi_lun);
-       tmfabort_wqe->lun[0] = be32_to_cpu(scsi_lun[0]);
-       tmfabort_wqe->lun[1] = be32_to_cpu(scsi_lun[1]);
-
-       if (ref_sc->sc_data_direction == DMA_TO_DEVICE)
-               dword = (ISCSI_TASK_TYPE_WRITE << ISCSI_CMD_REQUEST_TYPE_SHIFT);
-       else
-               dword = (ISCSI_TASK_TYPE_READ << ISCSI_CMD_REQUEST_TYPE_SHIFT);
-       tmfabort_wqe->ref_itt = (dword | (tmfabort_hdr->rtt & ISCSI_ITT_MASK));
+       switch (tmfabort_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) {
+       case ISCSI_TM_FUNC_ABORT_TASK:
+       case ISCSI_TM_FUNC_TASK_REASSIGN:
+               ctask = iscsi_itt_to_task(conn, tmfabort_hdr->rtt);
+               if (!ctask || !ctask->sc)
+                       /*
+                        * the iscsi layer must have completed the cmd while
+                        * was starting up.
+                        *
+                        * Note: In the case of a SCSI cmd timeout, the task's
+                        *       sc is still active; hence ctask->sc != 0
+                        *       In this case, the task must be aborted
+                        */
+                       return 0;
+
+               ref_sc = ctask->sc;
+               if (ref_sc->sc_data_direction == DMA_TO_DEVICE)
+                       dword = (ISCSI_TASK_TYPE_WRITE <<
+                                ISCSI_CMD_REQUEST_TYPE_SHIFT);
+               else
+                       dword = (ISCSI_TASK_TYPE_READ <<
+                                ISCSI_CMD_REQUEST_TYPE_SHIFT);
+               tmfabort_wqe->ref_itt = (dword |
+                                       (tmfabort_hdr->rtt & ISCSI_ITT_MASK));
+               break;
+       default:
+               tmfabort_wqe->ref_itt = RESERVED_ITT;
+       }
+       memcpy(tmfabort_wqe->lun, tmfabort_hdr->lun, sizeof(struct scsi_lun));
        tmfabort_wqe->ref_cmd_sn = be32_to_cpu(tmfabort_hdr->refcmdsn);
 
        tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma;
@@ -464,7 +466,6 @@ int bnx2i_send_iscsi_scsicmd(struct bnx2i_conn *bnx2i_conn,
  * @conn:              iscsi connection
  * @cmd:               driver command structure which is requesting
  *                     a WQE to sent to chip for further processing
- * @ttt:               TTT to be used when building pdu header
  * @datap:             payload buffer pointer
  * @data_len:          payload data length
  * @unsol:             indicated whether nopout pdu is unsolicited pdu or
@@ -473,7 +474,7 @@ int bnx2i_send_iscsi_scsicmd(struct bnx2i_conn *bnx2i_conn,
  * prepare and post a nopout request WQE to CNIC firmware
  */
 int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
-                           struct iscsi_task *task, u32 ttt,
+                           struct iscsi_task *task,
                            char *datap, int data_len, int unsol)
 {
        struct bnx2i_endpoint *ep = bnx2i_conn->ep;
@@ -498,7 +499,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
        nopout_wqe->itt = ((u16)task->itt |
                           (ISCSI_TASK_TYPE_MPATH <<
                            ISCSI_TMF_REQUEST_TYPE_SHIFT));
-       nopout_wqe->ttt = ttt;
+       nopout_wqe->ttt = nopout_hdr->ttt;
        nopout_wqe->flags = 0;
        if (!unsol)
                nopout_wqe->flags = ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION;