[SCSI] be2iscsi: Fix support for handling CQ_CREATE V2 version.
authorJohn Soni Jose <sony.john-n@emulex.com>
Fri, 19 Oct 2012 23:13:44 +0000 (04:43 +0530)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 27 Nov 2012 04:59:38 +0000 (08:59 +0400)
For latest adapters, V2 version of cq_create MBX_CMD is to be used. When
driver is loaded depending on the adapter type appropriate cq_create command
will be called.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/be2iscsi/be_cmds.c
drivers/scsi/be2iscsi/be_cmds.h
drivers/scsi/be2iscsi/be_main.h

index 05f70bb190785c254254dee3f01b309151dc57e9..3913e26306dda37a944d1ac845ab74bcd41d67f6 100644 (file)
@@ -649,18 +649,34 @@ int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
                        OPCODE_COMMON_CQ_CREATE, sizeof(*req));
 
        req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
+       if (chip_skh_r(ctrl->pdev)) {
+               req->hdr.version = MBX_CMD_VER2;
+               req->page_size = 1;
+               AMAP_SET_BITS(struct amap_cq_context_v2, coalescwm,
+                             ctxt, coalesce_wm);
+               AMAP_SET_BITS(struct amap_cq_context_v2, nodelay,
+                             ctxt, no_delay);
+               AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt,
+                             __ilog2_u32(cq->len / 256));
+               AMAP_SET_BITS(struct amap_cq_context_v2, valid, ctxt, 1);
+               AMAP_SET_BITS(struct amap_cq_context_v2, eventable, ctxt, 1);
+               AMAP_SET_BITS(struct amap_cq_context_v2, eqid, ctxt, eq->id);
+               AMAP_SET_BITS(struct amap_cq_context_v2, armed, ctxt, 1);
+       } else {
+               AMAP_SET_BITS(struct amap_cq_context, coalescwm,
+                             ctxt, coalesce_wm);
+               AMAP_SET_BITS(struct amap_cq_context, nodelay, ctxt, no_delay);
+               AMAP_SET_BITS(struct amap_cq_context, count, ctxt,
+                             __ilog2_u32(cq->len / 256));
+               AMAP_SET_BITS(struct amap_cq_context, valid, ctxt, 1);
+               AMAP_SET_BITS(struct amap_cq_context, solevent, ctxt, sol_evts);
+               AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1);
+               AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id);
+               AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1);
+               AMAP_SET_BITS(struct amap_cq_context, func, ctxt,
+                             PCI_FUNC(ctrl->pdev->devfn));
+       }
 
-       AMAP_SET_BITS(struct amap_cq_context, coalescwm, ctxt, coalesce_wm);
-       AMAP_SET_BITS(struct amap_cq_context, nodelay, ctxt, no_delay);
-       AMAP_SET_BITS(struct amap_cq_context, count, ctxt,
-                     __ilog2_u32(cq->len / 256));
-       AMAP_SET_BITS(struct amap_cq_context, valid, ctxt, 1);
-       AMAP_SET_BITS(struct amap_cq_context, solevent, ctxt, sol_evts);
-       AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1);
-       AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id);
-       AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1);
-       AMAP_SET_BITS(struct amap_cq_context, func, ctxt,
-                     PCI_FUNC(ctrl->pdev->devfn));
        be_dws_cpu_to_le(ctxt, sizeof(req->context));
 
        be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
index 897086b255e6eeb9c0102e4c19609f3fa5179a42..c560e9dbe7a94b05d7e1da9e21248691e7b06f03 100644 (file)
@@ -58,6 +58,9 @@ struct be_mcc_wrb {
 #define CQE_STATUS_EXTD_MASK 0xFFFF
 #define CQE_STATUS_EXTD_SHIFT 16               /* bits 0 - 15 */
 
+/* MBOX Command VER */
+#define MBX_CMD_VER2   0x02
+
 struct be_mcc_compl {
        u32 status;             /* dword 0 */
        u32 tag0;               /* dword 1 */
@@ -183,7 +186,8 @@ struct be_cmd_req_hdr {
        u8 domain;              /* dword 0 */
        u32 timeout;            /* dword 1 */
        u32 request_length;     /* dword 2 */
-       u32 rsvd0;              /* dword 3 */
+       u8 version;             /* dword 3 */
+       u8 rsvd0[3];            /* dword 3 */
 };
 
 struct be_cmd_resp_hdr {
@@ -483,10 +487,28 @@ struct amap_cq_context {
        u8 rsvd5[32];           /* dword 3 */
 } __packed;
 
+struct amap_cq_context_v2 {
+       u8 rsvd0[12];   /* dword 0 */
+       u8 coalescwm[2];    /* dword 0 */
+       u8 nodelay;     /* dword 0 */
+       u8 rsvd1[12];   /* dword 0 */
+       u8 count[2];    /* dword 0 */
+       u8 valid;       /* dword 0 */
+       u8 rsvd2;       /* dword 0 */
+       u8 eventable;   /* dword 0 */
+       u8 eqid[16];    /* dword 1 */
+       u8 rsvd3[15];   /* dword 1 */
+       u8 armed;       /* dword 1 */
+       u8 cqecount[16];/* dword 2 */
+       u8 rsvd4[16];   /* dword 2 */
+       u8 rsvd5[32];   /* dword 3 */
+};
+
 struct be_cmd_req_cq_create {
        struct be_cmd_req_hdr hdr;
        u16 num_pages;
-       u16 rsvd0;
+       u8 page_size;
+       u8 rsvd0;
        u8 context[sizeof(struct amap_cq_context) / 8];
        struct phys_addr pages[4];
 } __packed;
index 2e534f3b7bfe5927f92d541d5493d3caad118195..2c9cba2533b9941175c8804adc904bbe4b72eb5c 100644 (file)
@@ -265,6 +265,7 @@ struct invalidate_command_table {
        unsigned short cid;
 } __packed;
 
+#define chip_skh_r(pdev)       (pdev->device == OC_SKH_ID1)
 struct beiscsi_hba {
        struct hba_parameters params;
        struct hwi_controller *phwi_ctrlr;