[SCSI] bnx2fc: HSI changes for tape
authorBhanu Prakash Gollapudi <bprakash@broadcom.com>
Wed, 27 Jul 2011 18:32:08 +0000 (11:32 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 28 Jul 2011 07:52:38 +0000 (11:52 +0400)
Program the firmware task structure with init_flags indicating the device is
'sequence level error recovery' capable.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/bnx2fc/bnx2fc_hwi.c

index 764c452..9f38c57 100644 (file)
@@ -1564,7 +1564,12 @@ void bnx2fc_init_cleanup_task(struct bnx2fc_cmd *io_req,
                                FCOE_TCE_TX_WR_RX_RD_CONST_TASK_TYPE_SHIFT;
        task->txwr_rxrd.const_ctx.init_flags |= FCOE_TASK_CLASS_TYPE_3 <<
                                FCOE_TCE_TX_WR_RX_RD_CONST_CLASS_TYPE_SHIFT;
-       task->txwr_rxrd.const_ctx.init_flags |=
+       if (tgt->dev_type == TYPE_TAPE)
+               task->txwr_rxrd.const_ctx.init_flags |=
+                               FCOE_TASK_DEV_TYPE_TAPE <<
+                               FCOE_TCE_TX_WR_RX_RD_CONST_DEV_TYPE_SHIFT;
+       else
+               task->txwr_rxrd.const_ctx.init_flags |=
                                FCOE_TASK_DEV_TYPE_DISK <<
                                FCOE_TCE_TX_WR_RX_RD_CONST_DEV_TYPE_SHIFT;
        task->txwr_rxrd.union_ctx.cleanup.ctx.cleaned_task_id = orig_xid;
@@ -1624,7 +1629,12 @@ void bnx2fc_init_mp_task(struct bnx2fc_cmd *io_req,
        /* init flags */
        task->txwr_rxrd.const_ctx.init_flags = task_type <<
                                FCOE_TCE_TX_WR_RX_RD_CONST_TASK_TYPE_SHIFT;
-       task->txwr_rxrd.const_ctx.init_flags |=
+       if (tgt->dev_type == TYPE_TAPE)
+               task->txwr_rxrd.const_ctx.init_flags |=
+                               FCOE_TASK_DEV_TYPE_TAPE <<
+                               FCOE_TCE_TX_WR_RX_RD_CONST_DEV_TYPE_SHIFT;
+       else
+               task->txwr_rxrd.const_ctx.init_flags |=
                                FCOE_TASK_DEV_TYPE_DISK <<
                                FCOE_TCE_TX_WR_RX_RD_CONST_DEV_TYPE_SHIFT;
        task->txwr_rxrd.const_ctx.init_flags |= FCOE_TASK_CLASS_TYPE_3 <<
@@ -1681,6 +1691,7 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req,
        struct bnx2fc_rport *tgt = io_req->tgt;
        struct fcoe_cached_sge_ctx *cached_sge;
        struct fcoe_ext_mul_sges_ctx *sgl;
+       int dev_type = tgt->dev_type;
        u64 *fcp_cmnd;
        u64 tmp_fcp_cmnd[4];
        u32 context_id;
@@ -1711,7 +1722,12 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req,
        /* Init state to NORMAL */
        task->txwr_rxrd.const_ctx.init_flags = task_type <<
                                FCOE_TCE_TX_WR_RX_RD_CONST_TASK_TYPE_SHIFT;
-       task->txwr_rxrd.const_ctx.init_flags |=
+       if (dev_type == TYPE_TAPE)
+               task->txwr_rxrd.const_ctx.init_flags |=
+                               FCOE_TASK_DEV_TYPE_TAPE <<
+                               FCOE_TCE_TX_WR_RX_RD_CONST_DEV_TYPE_SHIFT;
+       else
+               task->txwr_rxrd.const_ctx.init_flags |=
                                FCOE_TASK_DEV_TYPE_DISK <<
                                FCOE_TCE_TX_WR_RX_RD_CONST_DEV_TYPE_SHIFT;
        task->txwr_rxrd.const_ctx.init_flags |= FCOE_TASK_CLASS_TYPE_3 <<
@@ -1754,7 +1770,8 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req,
        cached_sge = &task->rxwr_only.union_ctx.read_info.sgl_ctx.cached_sge;
        sgl = &task->rxwr_only.union_ctx.read_info.sgl_ctx.sgl;
        bd_count = bd_tbl->bd_valid;
-       if (task_type == FCOE_TASK_TYPE_READ) {
+       if (task_type == FCOE_TASK_TYPE_READ &&
+           dev_type == TYPE_DISK) {
                if (bd_count == 1) {
 
                        struct fcoe_bd_ctx *fcoe_bd_tbl = bd_tbl->bd_tbl;
@@ -1786,6 +1803,11 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req,
                                        (u32)((u64)bd_tbl->bd_tbl_dma >> 32);
                        sgl->mul_sgl.sgl_size = bd_count;
                }
+       } else {
+               sgl->mul_sgl.cur_sge_addr.lo = (u32)bd_tbl->bd_tbl_dma;
+               sgl->mul_sgl.cur_sge_addr.hi =
+                               (u32)((u64)bd_tbl->bd_tbl_dma >> 32);
+               sgl->mul_sgl.sgl_size = bd_count;
        }
 }