Commit eaae5267de0b199720e8df6124685268b6258015

Authored by John Soni Jose
Committed by James Bottomley
1 parent 22abeef0fa

[SCSI] be2iscsi: Fix support for handling CQ_CREATE V2 version.

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>

Showing 3 changed files with 52 additions and 13 deletions Side-by-side Diff

drivers/scsi/be2iscsi/be_cmds.c
... ... @@ -649,18 +649,34 @@
649 649 OPCODE_COMMON_CQ_CREATE, sizeof(*req));
650 650  
651 651 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
  652 + if (chip_skh_r(ctrl->pdev)) {
  653 + req->hdr.version = MBX_CMD_VER2;
  654 + req->page_size = 1;
  655 + AMAP_SET_BITS(struct amap_cq_context_v2, coalescwm,
  656 + ctxt, coalesce_wm);
  657 + AMAP_SET_BITS(struct amap_cq_context_v2, nodelay,
  658 + ctxt, no_delay);
  659 + AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt,
  660 + __ilog2_u32(cq->len / 256));
  661 + AMAP_SET_BITS(struct amap_cq_context_v2, valid, ctxt, 1);
  662 + AMAP_SET_BITS(struct amap_cq_context_v2, eventable, ctxt, 1);
  663 + AMAP_SET_BITS(struct amap_cq_context_v2, eqid, ctxt, eq->id);
  664 + AMAP_SET_BITS(struct amap_cq_context_v2, armed, ctxt, 1);
  665 + } else {
  666 + AMAP_SET_BITS(struct amap_cq_context, coalescwm,
  667 + ctxt, coalesce_wm);
  668 + AMAP_SET_BITS(struct amap_cq_context, nodelay, ctxt, no_delay);
  669 + AMAP_SET_BITS(struct amap_cq_context, count, ctxt,
  670 + __ilog2_u32(cq->len / 256));
  671 + AMAP_SET_BITS(struct amap_cq_context, valid, ctxt, 1);
  672 + AMAP_SET_BITS(struct amap_cq_context, solevent, ctxt, sol_evts);
  673 + AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1);
  674 + AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id);
  675 + AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1);
  676 + AMAP_SET_BITS(struct amap_cq_context, func, ctxt,
  677 + PCI_FUNC(ctrl->pdev->devfn));
  678 + }
652 679  
653   - AMAP_SET_BITS(struct amap_cq_context, coalescwm, ctxt, coalesce_wm);
654   - AMAP_SET_BITS(struct amap_cq_context, nodelay, ctxt, no_delay);
655   - AMAP_SET_BITS(struct amap_cq_context, count, ctxt,
656   - __ilog2_u32(cq->len / 256));
657   - AMAP_SET_BITS(struct amap_cq_context, valid, ctxt, 1);
658   - AMAP_SET_BITS(struct amap_cq_context, solevent, ctxt, sol_evts);
659   - AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1);
660   - AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id);
661   - AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1);
662   - AMAP_SET_BITS(struct amap_cq_context, func, ctxt,
663   - PCI_FUNC(ctrl->pdev->devfn));
664 680 be_dws_cpu_to_le(ctxt, sizeof(req->context));
665 681  
666 682 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
drivers/scsi/be2iscsi/be_cmds.h
... ... @@ -58,6 +58,9 @@
58 58 #define CQE_STATUS_EXTD_MASK 0xFFFF
59 59 #define CQE_STATUS_EXTD_SHIFT 16 /* bits 0 - 15 */
60 60  
  61 +/* MBOX Command VER */
  62 +#define MBX_CMD_VER2 0x02
  63 +
61 64 struct be_mcc_compl {
62 65 u32 status; /* dword 0 */
63 66 u32 tag0; /* dword 1 */
... ... @@ -183,7 +186,8 @@
183 186 u8 domain; /* dword 0 */
184 187 u32 timeout; /* dword 1 */
185 188 u32 request_length; /* dword 2 */
186   - u32 rsvd0; /* dword 3 */
  189 + u8 version; /* dword 3 */
  190 + u8 rsvd0[3]; /* dword 3 */
187 191 };
188 192  
189 193 struct be_cmd_resp_hdr {
190 194  
... ... @@ -483,10 +487,28 @@
483 487 u8 rsvd5[32]; /* dword 3 */
484 488 } __packed;
485 489  
  490 +struct amap_cq_context_v2 {
  491 + u8 rsvd0[12]; /* dword 0 */
  492 + u8 coalescwm[2]; /* dword 0 */
  493 + u8 nodelay; /* dword 0 */
  494 + u8 rsvd1[12]; /* dword 0 */
  495 + u8 count[2]; /* dword 0 */
  496 + u8 valid; /* dword 0 */
  497 + u8 rsvd2; /* dword 0 */
  498 + u8 eventable; /* dword 0 */
  499 + u8 eqid[16]; /* dword 1 */
  500 + u8 rsvd3[15]; /* dword 1 */
  501 + u8 armed; /* dword 1 */
  502 + u8 cqecount[16];/* dword 2 */
  503 + u8 rsvd4[16]; /* dword 2 */
  504 + u8 rsvd5[32]; /* dword 3 */
  505 +};
  506 +
486 507 struct be_cmd_req_cq_create {
487 508 struct be_cmd_req_hdr hdr;
488 509 u16 num_pages;
489   - u16 rsvd0;
  510 + u8 page_size;
  511 + u8 rsvd0;
490 512 u8 context[sizeof(struct amap_cq_context) / 8];
491 513 struct phys_addr pages[4];
492 514 } __packed;
drivers/scsi/be2iscsi/be_main.h
... ... @@ -265,6 +265,7 @@
265 265 unsigned short cid;
266 266 } __packed;
267 267  
  268 +#define chip_skh_r(pdev) (pdev->device == OC_SKH_ID1)
268 269 struct beiscsi_hba {
269 270 struct hba_parameters params;
270 271 struct hwi_controller *phwi_ctrlr;