aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2011-03-11 16:05:35 -0500
committerJames Bottomley <James.Bottomley@suse.de>2011-03-23 12:36:03 -0400
commit5a6f133eea2d0b4f8f75367b803fef0f03acf268 (patch)
tree76c6b5cac1ba7b590289cb04f4a5e26fb631fc71 /drivers/scsi/lpfc
parentd1e12de804f9d8ad114786ca7c2ce593cba79891 (diff)
[SCSI] lpfc 8.3.22: Add new mailbox command and new BSG fix
- Add new Queue Create Mailbox version support - Make lpfc_bsg_wake_mbox_wait routine check the mailboxes job reference before using it. Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c18
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h101
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c228
3 files changed, 229 insertions, 118 deletions
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 0dd43bb91618..5a4a2f36ae6d 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -2479,16 +2479,18 @@ lpfc_bsg_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
2479 2479
2480 from = (uint8_t *)dd_data->context_un.mbox.mb; 2480 from = (uint8_t *)dd_data->context_un.mbox.mb;
2481 job = dd_data->context_un.mbox.set_job; 2481 job = dd_data->context_un.mbox.set_job;
2482 size = job->reply_payload.payload_len; 2482 if (job) {
2483 job->reply->reply_payload_rcv_len = 2483 size = job->reply_payload.payload_len;
2484 sg_copy_from_buffer(job->reply_payload.sg_list, 2484 job->reply->reply_payload_rcv_len =
2485 job->reply_payload.sg_cnt, 2485 sg_copy_from_buffer(job->reply_payload.sg_list,
2486 from, size); 2486 job->reply_payload.sg_cnt,
2487 job->reply->result = 0; 2487 from, size);
2488 job->reply->result = 0;
2488 2489
2490 job->dd_data = NULL;
2491 job->job_done(job);
2492 }
2489 dd_data->context_un.mbox.set_job = NULL; 2493 dd_data->context_un.mbox.set_job = NULL;
2490 job->dd_data = NULL;
2491 job->job_done(job);
2492 /* need to hold the lock until we call job done to hold off 2494 /* need to hold the lock until we call job done to hold off
2493 * the timeout handler returning to the midlayer while 2495 * the timeout handler returning to the midlayer while
2494 * we are stillprocessing the job 2496 * we are stillprocessing the job
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index c7178d60c7bf..b42b6994fd94 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -711,21 +711,27 @@ struct lpfc_sli4_cfg_mhdr {
711union lpfc_sli4_cfg_shdr { 711union lpfc_sli4_cfg_shdr {
712 struct { 712 struct {
713 uint32_t word6; 713 uint32_t word6;
714#define lpfc_mbox_hdr_opcode_SHIFT 0 714#define lpfc_mbox_hdr_opcode_SHIFT 0
715#define lpfc_mbox_hdr_opcode_MASK 0x000000FF 715#define lpfc_mbox_hdr_opcode_MASK 0x000000FF
716#define lpfc_mbox_hdr_opcode_WORD word6 716#define lpfc_mbox_hdr_opcode_WORD word6
717#define lpfc_mbox_hdr_subsystem_SHIFT 8 717#define lpfc_mbox_hdr_subsystem_SHIFT 8
718#define lpfc_mbox_hdr_subsystem_MASK 0x000000FF 718#define lpfc_mbox_hdr_subsystem_MASK 0x000000FF
719#define lpfc_mbox_hdr_subsystem_WORD word6 719#define lpfc_mbox_hdr_subsystem_WORD word6
720#define lpfc_mbox_hdr_port_number_SHIFT 16 720#define lpfc_mbox_hdr_port_number_SHIFT 16
721#define lpfc_mbox_hdr_port_number_MASK 0x000000FF 721#define lpfc_mbox_hdr_port_number_MASK 0x000000FF
722#define lpfc_mbox_hdr_port_number_WORD word6 722#define lpfc_mbox_hdr_port_number_WORD word6
723#define lpfc_mbox_hdr_domain_SHIFT 24 723#define lpfc_mbox_hdr_domain_SHIFT 24
724#define lpfc_mbox_hdr_domain_MASK 0x000000FF 724#define lpfc_mbox_hdr_domain_MASK 0x000000FF
725#define lpfc_mbox_hdr_domain_WORD word6 725#define lpfc_mbox_hdr_domain_WORD word6
726 uint32_t timeout; 726 uint32_t timeout;
727 uint32_t request_length; 727 uint32_t request_length;
728 uint32_t reserved9; 728 uint32_t word9;
729#define lpfc_mbox_hdr_version_SHIFT 0
730#define lpfc_mbox_hdr_version_MASK 0x000000FF
731#define lpfc_mbox_hdr_version_WORD word9
732#define LPFC_Q_CREATE_VERSION_2 2
733#define LPFC_Q_CREATE_VERSION_1 1
734#define LPFC_Q_CREATE_VERSION_0 0
729 } request; 735 } request;
730 struct { 736 struct {
731 uint32_t word6; 737 uint32_t word6;
@@ -917,9 +923,12 @@ struct cq_context {
917#define LPFC_CQ_CNT_512 0x1 923#define LPFC_CQ_CNT_512 0x1
918#define LPFC_CQ_CNT_1024 0x2 924#define LPFC_CQ_CNT_1024 0x2
919 uint32_t word1; 925 uint32_t word1;
920#define lpfc_cq_eq_id_SHIFT 22 926#define lpfc_cq_eq_id_SHIFT 22 /* Version 0 Only */
921#define lpfc_cq_eq_id_MASK 0x000000FF 927#define lpfc_cq_eq_id_MASK 0x000000FF
922#define lpfc_cq_eq_id_WORD word1 928#define lpfc_cq_eq_id_WORD word1
929#define lpfc_cq_eq_id_2_SHIFT 0 /* Version 2 Only */
930#define lpfc_cq_eq_id_2_MASK 0x0000FFFF
931#define lpfc_cq_eq_id_2_WORD word1
923 uint32_t reserved0; 932 uint32_t reserved0;
924 uint32_t reserved1; 933 uint32_t reserved1;
925}; 934};
@@ -929,6 +938,9 @@ struct lpfc_mbx_cq_create {
929 union { 938 union {
930 struct { 939 struct {
931 uint32_t word0; 940 uint32_t word0;
941#define lpfc_mbx_cq_create_page_size_SHIFT 16 /* Version 2 Only */
942#define lpfc_mbx_cq_create_page_size_MASK 0x000000FF
943#define lpfc_mbx_cq_create_page_size_WORD word0
932#define lpfc_mbx_cq_create_num_pages_SHIFT 0 944#define lpfc_mbx_cq_create_num_pages_SHIFT 0
933#define lpfc_mbx_cq_create_num_pages_MASK 0x0000FFFF 945#define lpfc_mbx_cq_create_num_pages_MASK 0x0000FFFF
934#define lpfc_mbx_cq_create_num_pages_WORD word0 946#define lpfc_mbx_cq_create_num_pages_WORD word0
@@ -969,7 +981,7 @@ struct wq_context {
969struct lpfc_mbx_wq_create { 981struct lpfc_mbx_wq_create {
970 struct mbox_header header; 982 struct mbox_header header;
971 union { 983 union {
972 struct { 984 struct { /* Version 0 Request */
973 uint32_t word0; 985 uint32_t word0;
974#define lpfc_mbx_wq_create_num_pages_SHIFT 0 986#define lpfc_mbx_wq_create_num_pages_SHIFT 0
975#define lpfc_mbx_wq_create_num_pages_MASK 0x0000FFFF 987#define lpfc_mbx_wq_create_num_pages_MASK 0x0000FFFF
@@ -979,6 +991,23 @@ struct lpfc_mbx_wq_create {
979#define lpfc_mbx_wq_create_cq_id_WORD word0 991#define lpfc_mbx_wq_create_cq_id_WORD word0
980 struct dma_address page[LPFC_MAX_WQ_PAGE]; 992 struct dma_address page[LPFC_MAX_WQ_PAGE];
981 } request; 993 } request;
994 struct { /* Version 1 Request */
995 uint32_t word0; /* Word 0 is the same as in v0 */
996 uint32_t word1;
997#define lpfc_mbx_wq_create_page_size_SHIFT 0
998#define lpfc_mbx_wq_create_page_size_MASK 0x000000FF
999#define lpfc_mbx_wq_create_page_size_WORD word1
1000#define lpfc_mbx_wq_create_wqe_size_SHIFT 8
1001#define lpfc_mbx_wq_create_wqe_size_MASK 0x0000000F
1002#define lpfc_mbx_wq_create_wqe_size_WORD word1
1003#define LPFC_WQ_WQE_SIZE_64 0x5
1004#define LPFC_WQ_WQE_SIZE_128 0x6
1005#define lpfc_mbx_wq_create_wqe_count_SHIFT 16
1006#define lpfc_mbx_wq_create_wqe_count_MASK 0x0000FFFF
1007#define lpfc_mbx_wq_create_wqe_count_WORD word1
1008 uint32_t word2;
1009 struct dma_address page[LPFC_MAX_WQ_PAGE-1];
1010 } request_1;
982 struct { 1011 struct {
983 uint32_t word0; 1012 uint32_t word0;
984#define lpfc_mbx_wq_create_q_id_SHIFT 0 1013#define lpfc_mbx_wq_create_q_id_SHIFT 0
@@ -1007,13 +1036,22 @@ struct lpfc_mbx_wq_destroy {
1007#define LPFC_DATA_BUF_SIZE 2048 1036#define LPFC_DATA_BUF_SIZE 2048
1008struct rq_context { 1037struct rq_context {
1009 uint32_t word0; 1038 uint32_t word0;
1010#define lpfc_rq_context_rq_size_SHIFT 16 1039#define lpfc_rq_context_rqe_count_SHIFT 16 /* Version 0 Only */
1011#define lpfc_rq_context_rq_size_MASK 0x0000000F 1040#define lpfc_rq_context_rqe_count_MASK 0x0000000F
1012#define lpfc_rq_context_rq_size_WORD word0 1041#define lpfc_rq_context_rqe_count_WORD word0
1013#define LPFC_RQ_RING_SIZE_512 9 /* 512 entries */ 1042#define LPFC_RQ_RING_SIZE_512 9 /* 512 entries */
1014#define LPFC_RQ_RING_SIZE_1024 10 /* 1024 entries */ 1043#define LPFC_RQ_RING_SIZE_1024 10 /* 1024 entries */
1015#define LPFC_RQ_RING_SIZE_2048 11 /* 2048 entries */ 1044#define LPFC_RQ_RING_SIZE_2048 11 /* 2048 entries */
1016#define LPFC_RQ_RING_SIZE_4096 12 /* 4096 entries */ 1045#define LPFC_RQ_RING_SIZE_4096 12 /* 4096 entries */
1046#define lpfc_rq_context_rqe_count_1_SHIFT 16 /* Version 1 Only */
1047#define lpfc_rq_context_rqe_count_1_MASK 0x0000FFFF
1048#define lpfc_rq_context_rqe_count_1_WORD word0
1049#define lpfc_rq_context_rqe_size_SHIFT 8 /* Version 1 Only */
1050#define lpfc_rq_context_rqe_size_MASK 0x0000000F
1051#define lpfc_rq_context_rqe_size_WORD word0
1052#define lpfc_rq_context_page_size_SHIFT 0 /* Version 1 Only */
1053#define lpfc_rq_context_page_size_MASK 0x000000FF
1054#define lpfc_rq_context_page_size_WORD word0
1017 uint32_t reserved1; 1055 uint32_t reserved1;
1018 uint32_t word2; 1056 uint32_t word2;
1019#define lpfc_rq_context_cq_id_SHIFT 16 1057#define lpfc_rq_context_cq_id_SHIFT 16
@@ -1022,7 +1060,7 @@ struct rq_context {
1022#define lpfc_rq_context_buf_size_SHIFT 0 1060#define lpfc_rq_context_buf_size_SHIFT 0
1023#define lpfc_rq_context_buf_size_MASK 0x0000FFFF 1061#define lpfc_rq_context_buf_size_MASK 0x0000FFFF
1024#define lpfc_rq_context_buf_size_WORD word2 1062#define lpfc_rq_context_buf_size_WORD word2
1025 uint32_t reserved3; 1063 uint32_t buffer_size; /* Version 1 Only */
1026}; 1064};
1027 1065
1028struct lpfc_mbx_rq_create { 1066struct lpfc_mbx_rq_create {
@@ -1062,16 +1100,16 @@ struct lpfc_mbx_rq_destroy {
1062 1100
1063struct mq_context { 1101struct mq_context {
1064 uint32_t word0; 1102 uint32_t word0;
1065#define lpfc_mq_context_cq_id_SHIFT 22 1103#define lpfc_mq_context_cq_id_SHIFT 22 /* Version 0 Only */
1066#define lpfc_mq_context_cq_id_MASK 0x000003FF 1104#define lpfc_mq_context_cq_id_MASK 0x000003FF
1067#define lpfc_mq_context_cq_id_WORD word0 1105#define lpfc_mq_context_cq_id_WORD word0
1068#define lpfc_mq_context_count_SHIFT 16 1106#define lpfc_mq_context_ring_size_SHIFT 16
1069#define lpfc_mq_context_count_MASK 0x0000000F 1107#define lpfc_mq_context_ring_size_MASK 0x0000000F
1070#define lpfc_mq_context_count_WORD word0 1108#define lpfc_mq_context_ring_size_WORD word0
1071#define LPFC_MQ_CNT_16 0x5 1109#define LPFC_MQ_RING_SIZE_16 0x5
1072#define LPFC_MQ_CNT_32 0x6 1110#define LPFC_MQ_RING_SIZE_32 0x6
1073#define LPFC_MQ_CNT_64 0x7 1111#define LPFC_MQ_RING_SIZE_64 0x7
1074#define LPFC_MQ_CNT_128 0x8 1112#define LPFC_MQ_RING_SIZE_128 0x8
1075 uint32_t word1; 1113 uint32_t word1;
1076#define lpfc_mq_context_valid_SHIFT 31 1114#define lpfc_mq_context_valid_SHIFT 31
1077#define lpfc_mq_context_valid_MASK 0x00000001 1115#define lpfc_mq_context_valid_MASK 0x00000001
@@ -1105,9 +1143,12 @@ struct lpfc_mbx_mq_create_ext {
1105 union { 1143 union {
1106 struct { 1144 struct {
1107 uint32_t word0; 1145 uint32_t word0;
1108#define lpfc_mbx_mq_create_ext_num_pages_SHIFT 0 1146#define lpfc_mbx_mq_create_ext_num_pages_SHIFT 0
1109#define lpfc_mbx_mq_create_ext_num_pages_MASK 0x0000FFFF 1147#define lpfc_mbx_mq_create_ext_num_pages_MASK 0x0000FFFF
1110#define lpfc_mbx_mq_create_ext_num_pages_WORD word0 1148#define lpfc_mbx_mq_create_ext_num_pages_WORD word0
1149#define lpfc_mbx_mq_create_ext_cq_id_SHIFT 16 /* Version 1 Only */
1150#define lpfc_mbx_mq_create_ext_cq_id_MASK 0x0000FFFF
1151#define lpfc_mbx_mq_create_ext_cq_id_WORD word0
1111 uint32_t async_evt_bmap; 1152 uint32_t async_evt_bmap;
1112#define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK 1153#define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK
1113#define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001 1154#define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 2ee0374a9908..84234a4c54ce 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -10403,7 +10403,6 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
10403 if (!phba->sli4_hba.pc_sli4_params.supported) 10403 if (!phba->sli4_hba.pc_sli4_params.supported)
10404 hw_page_size = SLI4_PAGE_SIZE; 10404 hw_page_size = SLI4_PAGE_SIZE;
10405 10405
10406
10407 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 10406 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
10408 if (!mbox) 10407 if (!mbox)
10409 return -ENOMEM; 10408 return -ENOMEM;
@@ -10413,11 +10412,22 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
10413 LPFC_MBOX_OPCODE_CQ_CREATE, 10412 LPFC_MBOX_OPCODE_CQ_CREATE,
10414 length, LPFC_SLI4_MBX_EMBED); 10413 length, LPFC_SLI4_MBX_EMBED);
10415 cq_create = &mbox->u.mqe.un.cq_create; 10414 cq_create = &mbox->u.mqe.un.cq_create;
10415 shdr = (union lpfc_sli4_cfg_shdr *) &cq_create->header.cfg_shdr;
10416 bf_set(lpfc_mbx_cq_create_num_pages, &cq_create->u.request, 10416 bf_set(lpfc_mbx_cq_create_num_pages, &cq_create->u.request,
10417 cq->page_count); 10417 cq->page_count);
10418 bf_set(lpfc_cq_context_event, &cq_create->u.request.context, 1); 10418 bf_set(lpfc_cq_context_event, &cq_create->u.request.context, 1);
10419 bf_set(lpfc_cq_context_valid, &cq_create->u.request.context, 1); 10419 bf_set(lpfc_cq_context_valid, &cq_create->u.request.context, 1);
10420 bf_set(lpfc_cq_eq_id, &cq_create->u.request.context, eq->queue_id); 10420 bf_set(lpfc_mbox_hdr_version, &shdr->request,
10421 phba->sli4_hba.pc_sli4_params.cqv);
10422 if (phba->sli4_hba.pc_sli4_params.cqv == LPFC_Q_CREATE_VERSION_2) {
10423 bf_set(lpfc_mbx_cq_create_page_size, &cq_create->u.request,
10424 (PAGE_SIZE/SLI4_PAGE_SIZE));
10425 bf_set(lpfc_cq_eq_id_2, &cq_create->u.request.context,
10426 eq->queue_id);
10427 } else {
10428 bf_set(lpfc_cq_eq_id, &cq_create->u.request.context,
10429 eq->queue_id);
10430 }
10421 switch (cq->entry_count) { 10431 switch (cq->entry_count) {
10422 default: 10432 default:
10423 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 10433 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
@@ -10449,7 +10459,6 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
10449 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); 10459 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
10450 10460
10451 /* The IOCTL status is embedded in the mailbox subheader. */ 10461 /* The IOCTL status is embedded in the mailbox subheader. */
10452 shdr = (union lpfc_sli4_cfg_shdr *) &cq_create->header.cfg_shdr;
10453 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); 10462 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
10454 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); 10463 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
10455 if (shdr_status || shdr_add_status || rc) { 10464 if (shdr_status || shdr_add_status || rc) {
@@ -10515,20 +10524,20 @@ lpfc_mq_create_fb_init(struct lpfc_hba *phba, struct lpfc_queue *mq,
10515 bf_set(lpfc_mq_context_valid, &mq_create->u.request.context, 1); 10524 bf_set(lpfc_mq_context_valid, &mq_create->u.request.context, 1);
10516 switch (mq->entry_count) { 10525 switch (mq->entry_count) {
10517 case 16: 10526 case 16:
10518 bf_set(lpfc_mq_context_count, &mq_create->u.request.context, 10527 bf_set(lpfc_mq_context_ring_size, &mq_create->u.request.context,
10519 LPFC_MQ_CNT_16); 10528 LPFC_MQ_RING_SIZE_16);
10520 break; 10529 break;
10521 case 32: 10530 case 32:
10522 bf_set(lpfc_mq_context_count, &mq_create->u.request.context, 10531 bf_set(lpfc_mq_context_ring_size, &mq_create->u.request.context,
10523 LPFC_MQ_CNT_32); 10532 LPFC_MQ_RING_SIZE_32);
10524 break; 10533 break;
10525 case 64: 10534 case 64:
10526 bf_set(lpfc_mq_context_count, &mq_create->u.request.context, 10535 bf_set(lpfc_mq_context_ring_size, &mq_create->u.request.context,
10527 LPFC_MQ_CNT_64); 10536 LPFC_MQ_RING_SIZE_64);
10528 break; 10537 break;
10529 case 128: 10538 case 128:
10530 bf_set(lpfc_mq_context_count, &mq_create->u.request.context, 10539 bf_set(lpfc_mq_context_ring_size, &mq_create->u.request.context,
10531 LPFC_MQ_CNT_128); 10540 LPFC_MQ_RING_SIZE_128);
10532 break; 10541 break;
10533 } 10542 }
10534 list_for_each_entry(dmabuf, &mq->page_list, list) { 10543 list_for_each_entry(dmabuf, &mq->page_list, list) {
@@ -10586,6 +10595,7 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
10586 length, LPFC_SLI4_MBX_EMBED); 10595 length, LPFC_SLI4_MBX_EMBED);
10587 10596
10588 mq_create_ext = &mbox->u.mqe.un.mq_create_ext; 10597 mq_create_ext = &mbox->u.mqe.un.mq_create_ext;
10598 shdr = (union lpfc_sli4_cfg_shdr *) &mq_create_ext->header.cfg_shdr;
10589 bf_set(lpfc_mbx_mq_create_ext_num_pages, 10599 bf_set(lpfc_mbx_mq_create_ext_num_pages,
10590 &mq_create_ext->u.request, mq->page_count); 10600 &mq_create_ext->u.request, mq->page_count);
10591 bf_set(lpfc_mbx_mq_create_ext_async_evt_link, 10601 bf_set(lpfc_mbx_mq_create_ext_async_evt_link,
@@ -10598,9 +10608,15 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
10598 &mq_create_ext->u.request, 1); 10608 &mq_create_ext->u.request, 1);
10599 bf_set(lpfc_mbx_mq_create_ext_async_evt_sli, 10609 bf_set(lpfc_mbx_mq_create_ext_async_evt_sli,
10600 &mq_create_ext->u.request, 1); 10610 &mq_create_ext->u.request, 1);
10601 bf_set(lpfc_mq_context_cq_id,
10602 &mq_create_ext->u.request.context, cq->queue_id);
10603 bf_set(lpfc_mq_context_valid, &mq_create_ext->u.request.context, 1); 10611 bf_set(lpfc_mq_context_valid, &mq_create_ext->u.request.context, 1);
10612 bf_set(lpfc_mbox_hdr_version, &shdr->request,
10613 phba->sli4_hba.pc_sli4_params.mqv);
10614 if (phba->sli4_hba.pc_sli4_params.mqv == LPFC_Q_CREATE_VERSION_1)
10615 bf_set(lpfc_mbx_mq_create_ext_cq_id, &mq_create_ext->u.request,
10616 cq->queue_id);
10617 else
10618 bf_set(lpfc_mq_context_cq_id, &mq_create_ext->u.request.context,
10619 cq->queue_id);
10604 switch (mq->entry_count) { 10620 switch (mq->entry_count) {
10605 default: 10621 default:
10606 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 10622 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
@@ -10610,20 +10626,24 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
10610 return -EINVAL; 10626 return -EINVAL;
10611 /* otherwise default to smallest count (drop through) */ 10627 /* otherwise default to smallest count (drop through) */
10612 case 16: 10628 case 16:
10613 bf_set(lpfc_mq_context_count, &mq_create_ext->u.request.context, 10629 bf_set(lpfc_mq_context_ring_size,
10614 LPFC_MQ_CNT_16); 10630 &mq_create_ext->u.request.context,
10631 LPFC_MQ_RING_SIZE_16);
10615 break; 10632 break;
10616 case 32: 10633 case 32:
10617 bf_set(lpfc_mq_context_count, &mq_create_ext->u.request.context, 10634 bf_set(lpfc_mq_context_ring_size,
10618 LPFC_MQ_CNT_32); 10635 &mq_create_ext->u.request.context,
10636 LPFC_MQ_RING_SIZE_32);
10619 break; 10637 break;
10620 case 64: 10638 case 64:
10621 bf_set(lpfc_mq_context_count, &mq_create_ext->u.request.context, 10639 bf_set(lpfc_mq_context_ring_size,
10622 LPFC_MQ_CNT_64); 10640 &mq_create_ext->u.request.context,
10641 LPFC_MQ_RING_SIZE_64);
10623 break; 10642 break;
10624 case 128: 10643 case 128:
10625 bf_set(lpfc_mq_context_count, &mq_create_ext->u.request.context, 10644 bf_set(lpfc_mq_context_ring_size,
10626 LPFC_MQ_CNT_128); 10645 &mq_create_ext->u.request.context,
10646 LPFC_MQ_RING_SIZE_128);
10627 break; 10647 break;
10628 } 10648 }
10629 list_for_each_entry(dmabuf, &mq->page_list, list) { 10649 list_for_each_entry(dmabuf, &mq->page_list, list) {
@@ -10634,7 +10654,6 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
10634 putPaddrHigh(dmabuf->phys); 10654 putPaddrHigh(dmabuf->phys);
10635 } 10655 }
10636 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); 10656 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
10637 shdr = (union lpfc_sli4_cfg_shdr *) &mq_create_ext->header.cfg_shdr;
10638 mq->queue_id = bf_get(lpfc_mbx_mq_create_q_id, 10657 mq->queue_id = bf_get(lpfc_mbx_mq_create_q_id,
10639 &mq_create_ext->u.response); 10658 &mq_create_ext->u.response);
10640 if (rc != MBX_SUCCESS) { 10659 if (rc != MBX_SUCCESS) {
@@ -10711,6 +10730,7 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
10711 uint32_t shdr_status, shdr_add_status; 10730 uint32_t shdr_status, shdr_add_status;
10712 union lpfc_sli4_cfg_shdr *shdr; 10731 union lpfc_sli4_cfg_shdr *shdr;
10713 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; 10732 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz;
10733 struct dma_address *page;
10714 10734
10715 if (!phba->sli4_hba.pc_sli4_params.supported) 10735 if (!phba->sli4_hba.pc_sli4_params.supported)
10716 hw_page_size = SLI4_PAGE_SIZE; 10736 hw_page_size = SLI4_PAGE_SIZE;
@@ -10724,20 +10744,42 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
10724 LPFC_MBOX_OPCODE_FCOE_WQ_CREATE, 10744 LPFC_MBOX_OPCODE_FCOE_WQ_CREATE,
10725 length, LPFC_SLI4_MBX_EMBED); 10745 length, LPFC_SLI4_MBX_EMBED);
10726 wq_create = &mbox->u.mqe.un.wq_create; 10746 wq_create = &mbox->u.mqe.un.wq_create;
10747 shdr = (union lpfc_sli4_cfg_shdr *) &wq_create->header.cfg_shdr;
10727 bf_set(lpfc_mbx_wq_create_num_pages, &wq_create->u.request, 10748 bf_set(lpfc_mbx_wq_create_num_pages, &wq_create->u.request,
10728 wq->page_count); 10749 wq->page_count);
10729 bf_set(lpfc_mbx_wq_create_cq_id, &wq_create->u.request, 10750 bf_set(lpfc_mbx_wq_create_cq_id, &wq_create->u.request,
10730 cq->queue_id); 10751 cq->queue_id);
10752 bf_set(lpfc_mbox_hdr_version, &shdr->request,
10753 phba->sli4_hba.pc_sli4_params.wqv);
10754 if (phba->sli4_hba.pc_sli4_params.wqv == LPFC_Q_CREATE_VERSION_1) {
10755 bf_set(lpfc_mbx_wq_create_wqe_count, &wq_create->u.request_1,
10756 wq->entry_count);
10757 switch (wq->entry_size) {
10758 default:
10759 case 64:
10760 bf_set(lpfc_mbx_wq_create_wqe_size,
10761 &wq_create->u.request_1,
10762 LPFC_WQ_WQE_SIZE_64);
10763 break;
10764 case 128:
10765 bf_set(lpfc_mbx_wq_create_wqe_size,
10766 &wq_create->u.request_1,
10767 LPFC_WQ_WQE_SIZE_128);
10768 break;
10769 }
10770 bf_set(lpfc_mbx_wq_create_page_size, &wq_create->u.request_1,
10771 (PAGE_SIZE/SLI4_PAGE_SIZE));
10772 page = wq_create->u.request_1.page;
10773 } else {
10774 page = wq_create->u.request.page;
10775 }
10731 list_for_each_entry(dmabuf, &wq->page_list, list) { 10776 list_for_each_entry(dmabuf, &wq->page_list, list) {
10732 memset(dmabuf->virt, 0, hw_page_size); 10777 memset(dmabuf->virt, 0, hw_page_size);
10733 wq_create->u.request.page[dmabuf->buffer_tag].addr_lo = 10778 page[dmabuf->buffer_tag].addr_lo = putPaddrLow(dmabuf->phys);
10734 putPaddrLow(dmabuf->phys); 10779 page[dmabuf->buffer_tag].addr_hi = putPaddrHigh(dmabuf->phys);
10735 wq_create->u.request.page[dmabuf->buffer_tag].addr_hi =
10736 putPaddrHigh(dmabuf->phys);
10737 } 10780 }
10738 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); 10781 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
10739 /* The IOCTL status is embedded in the mailbox subheader. */ 10782 /* The IOCTL status is embedded in the mailbox subheader. */
10740 shdr = (union lpfc_sli4_cfg_shdr *) &wq_create->header.cfg_shdr;
10741 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); 10783 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
10742 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); 10784 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
10743 if (shdr_status || shdr_add_status || rc) { 10785 if (shdr_status || shdr_add_status || rc) {
@@ -10815,37 +10857,51 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
10815 LPFC_MBOX_OPCODE_FCOE_RQ_CREATE, 10857 LPFC_MBOX_OPCODE_FCOE_RQ_CREATE,
10816 length, LPFC_SLI4_MBX_EMBED); 10858 length, LPFC_SLI4_MBX_EMBED);
10817 rq_create = &mbox->u.mqe.un.rq_create; 10859 rq_create = &mbox->u.mqe.un.rq_create;
10818 switch (hrq->entry_count) { 10860 shdr = (union lpfc_sli4_cfg_shdr *) &rq_create->header.cfg_shdr;
10819 default: 10861 bf_set(lpfc_mbox_hdr_version, &shdr->request,
10820 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 10862 phba->sli4_hba.pc_sli4_params.rqv);
10821 "2535 Unsupported RQ count. (%d)\n", 10863 if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) {
10822 hrq->entry_count); 10864 bf_set(lpfc_rq_context_rqe_count_1,
10823 if (hrq->entry_count < 512) 10865 &rq_create->u.request.context,
10824 return -EINVAL; 10866 hrq->entry_count);
10825 /* otherwise default to smallest count (drop through) */ 10867 rq_create->u.request.context.buffer_size = LPFC_HDR_BUF_SIZE;
10826 case 512: 10868 } else {
10827 bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, 10869 switch (hrq->entry_count) {
10828 LPFC_RQ_RING_SIZE_512); 10870 default:
10829 break; 10871 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
10830 case 1024: 10872 "2535 Unsupported RQ count. (%d)\n",
10831 bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, 10873 hrq->entry_count);
10832 LPFC_RQ_RING_SIZE_1024); 10874 if (hrq->entry_count < 512)
10833 break; 10875 return -EINVAL;
10834 case 2048: 10876 /* otherwise default to smallest count (drop through) */
10835 bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, 10877 case 512:
10836 LPFC_RQ_RING_SIZE_2048); 10878 bf_set(lpfc_rq_context_rqe_count,
10837 break; 10879 &rq_create->u.request.context,
10838 case 4096: 10880 LPFC_RQ_RING_SIZE_512);
10839 bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, 10881 break;
10840 LPFC_RQ_RING_SIZE_4096); 10882 case 1024:
10841 break; 10883 bf_set(lpfc_rq_context_rqe_count,
10884 &rq_create->u.request.context,
10885 LPFC_RQ_RING_SIZE_1024);
10886 break;
10887 case 2048:
10888 bf_set(lpfc_rq_context_rqe_count,
10889 &rq_create->u.request.context,
10890 LPFC_RQ_RING_SIZE_2048);
10891 break;
10892 case 4096:
10893 bf_set(lpfc_rq_context_rqe_count,
10894 &rq_create->u.request.context,
10895 LPFC_RQ_RING_SIZE_4096);
10896 break;
10897 }
10898 bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context,
10899 LPFC_HDR_BUF_SIZE);
10842 } 10900 }
10843 bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context, 10901 bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context,
10844 cq->queue_id); 10902 cq->queue_id);
10845 bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request, 10903 bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request,
10846 hrq->page_count); 10904 hrq->page_count);
10847 bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context,
10848 LPFC_HDR_BUF_SIZE);
10849 list_for_each_entry(dmabuf, &hrq->page_list, list) { 10905 list_for_each_entry(dmabuf, &hrq->page_list, list) {
10850 memset(dmabuf->virt, 0, hw_page_size); 10906 memset(dmabuf->virt, 0, hw_page_size);
10851 rq_create->u.request.page[dmabuf->buffer_tag].addr_lo = 10907 rq_create->u.request.page[dmabuf->buffer_tag].addr_lo =
@@ -10855,7 +10911,6 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
10855 } 10911 }
10856 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); 10912 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
10857 /* The IOCTL status is embedded in the mailbox subheader. */ 10913 /* The IOCTL status is embedded in the mailbox subheader. */
10858 shdr = (union lpfc_sli4_cfg_shdr *) &rq_create->header.cfg_shdr;
10859 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); 10914 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
10860 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); 10915 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
10861 if (shdr_status || shdr_add_status || rc) { 10916 if (shdr_status || shdr_add_status || rc) {
@@ -10881,37 +10936,50 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
10881 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, 10936 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE,
10882 LPFC_MBOX_OPCODE_FCOE_RQ_CREATE, 10937 LPFC_MBOX_OPCODE_FCOE_RQ_CREATE,
10883 length, LPFC_SLI4_MBX_EMBED); 10938 length, LPFC_SLI4_MBX_EMBED);
10884 switch (drq->entry_count) { 10939 bf_set(lpfc_mbox_hdr_version, &shdr->request,
10885 default: 10940 phba->sli4_hba.pc_sli4_params.rqv);
10886 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 10941 if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) {
10887 "2536 Unsupported RQ count. (%d)\n", 10942 bf_set(lpfc_rq_context_rqe_count_1,
10888 drq->entry_count); 10943 &rq_create->u.request.context,
10889 if (drq->entry_count < 512) 10944 hrq->entry_count);
10890 return -EINVAL; 10945 rq_create->u.request.context.buffer_size = LPFC_DATA_BUF_SIZE;
10891 /* otherwise default to smallest count (drop through) */ 10946 } else {
10892 case 512: 10947 switch (drq->entry_count) {
10893 bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, 10948 default:
10894 LPFC_RQ_RING_SIZE_512); 10949 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
10895 break; 10950 "2536 Unsupported RQ count. (%d)\n",
10896 case 1024: 10951 drq->entry_count);
10897 bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, 10952 if (drq->entry_count < 512)
10898 LPFC_RQ_RING_SIZE_1024); 10953 return -EINVAL;
10899 break; 10954 /* otherwise default to smallest count (drop through) */
10900 case 2048: 10955 case 512:
10901 bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, 10956 bf_set(lpfc_rq_context_rqe_count,
10902 LPFC_RQ_RING_SIZE_2048); 10957 &rq_create->u.request.context,
10903 break; 10958 LPFC_RQ_RING_SIZE_512);
10904 case 4096: 10959 break;
10905 bf_set(lpfc_rq_context_rq_size, &rq_create->u.request.context, 10960 case 1024:
10906 LPFC_RQ_RING_SIZE_4096); 10961 bf_set(lpfc_rq_context_rqe_count,
10907 break; 10962 &rq_create->u.request.context,
10963 LPFC_RQ_RING_SIZE_1024);
10964 break;
10965 case 2048:
10966 bf_set(lpfc_rq_context_rqe_count,
10967 &rq_create->u.request.context,
10968 LPFC_RQ_RING_SIZE_2048);
10969 break;
10970 case 4096:
10971 bf_set(lpfc_rq_context_rqe_count,
10972 &rq_create->u.request.context,
10973 LPFC_RQ_RING_SIZE_4096);
10974 break;
10975 }
10976 bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context,
10977 LPFC_DATA_BUF_SIZE);
10908 } 10978 }
10909 bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context, 10979 bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context,
10910 cq->queue_id); 10980 cq->queue_id);
10911 bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request, 10981 bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request,
10912 drq->page_count); 10982 drq->page_count);
10913 bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context,
10914 LPFC_DATA_BUF_SIZE);
10915 list_for_each_entry(dmabuf, &drq->page_list, list) { 10983 list_for_each_entry(dmabuf, &drq->page_list, list) {
10916 rq_create->u.request.page[dmabuf->buffer_tag].addr_lo = 10984 rq_create->u.request.page[dmabuf->buffer_tag].addr_lo =
10917 putPaddrLow(dmabuf->phys); 10985 putPaddrLow(dmabuf->phys);