aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c9
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h167
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c228
3 files changed, 197 insertions, 207 deletions
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index e61b57df241b..884f4d321799 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -177,15 +177,18 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
177 (elscmd == ELS_CMD_LOGO))) 177 (elscmd == ELS_CMD_LOGO)))
178 switch (elscmd) { 178 switch (elscmd) {
179 case ELS_CMD_FLOGI: 179 case ELS_CMD_FLOGI:
180 elsiocb->iocb_flag |= ((ELS_ID_FLOGI << LPFC_FIP_ELS_ID_SHIFT) 180 elsiocb->iocb_flag |=
181 ((LPFC_ELS_ID_FLOGI << LPFC_FIP_ELS_ID_SHIFT)
181 & LPFC_FIP_ELS_ID_MASK); 182 & LPFC_FIP_ELS_ID_MASK);
182 break; 183 break;
183 case ELS_CMD_FDISC: 184 case ELS_CMD_FDISC:
184 elsiocb->iocb_flag |= ((ELS_ID_FDISC << LPFC_FIP_ELS_ID_SHIFT) 185 elsiocb->iocb_flag |=
186 ((LPFC_ELS_ID_FDISC << LPFC_FIP_ELS_ID_SHIFT)
185 & LPFC_FIP_ELS_ID_MASK); 187 & LPFC_FIP_ELS_ID_MASK);
186 break; 188 break;
187 case ELS_CMD_LOGO: 189 case ELS_CMD_LOGO:
188 elsiocb->iocb_flag |= ((ELS_ID_LOGO << LPFC_FIP_ELS_ID_SHIFT) 190 elsiocb->iocb_flag |=
191 ((LPFC_ELS_ID_LOGO << LPFC_FIP_ELS_ID_SHIFT)
189 & LPFC_FIP_ELS_ID_MASK); 192 & LPFC_FIP_ELS_ID_MASK);
190 break; 193 break;
191 } 194 }
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index bbdcf96800f6..6e4bc34e1d0d 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -424,79 +424,6 @@ struct lpfc_rcqe {
424#define FCOE_SOFn3 0x36 424#define FCOE_SOFn3 0x36
425}; 425};
426 426
427struct lpfc_wqe_generic{
428 struct ulp_bde64 bde;
429 uint32_t word3;
430 uint32_t word4;
431 uint32_t word5;
432 uint32_t word6;
433#define lpfc_wqe_gen_context_SHIFT 16
434#define lpfc_wqe_gen_context_MASK 0x0000FFFF
435#define lpfc_wqe_gen_context_WORD word6
436#define lpfc_wqe_gen_xri_SHIFT 0
437#define lpfc_wqe_gen_xri_MASK 0x0000FFFF
438#define lpfc_wqe_gen_xri_WORD word6
439 uint32_t word7;
440#define lpfc_wqe_gen_lnk_SHIFT 23
441#define lpfc_wqe_gen_lnk_MASK 0x00000001
442#define lpfc_wqe_gen_lnk_WORD word7
443#define lpfc_wqe_gen_erp_SHIFT 22
444#define lpfc_wqe_gen_erp_MASK 0x00000001
445#define lpfc_wqe_gen_erp_WORD word7
446#define lpfc_wqe_gen_pu_SHIFT 20
447#define lpfc_wqe_gen_pu_MASK 0x00000003
448#define lpfc_wqe_gen_pu_WORD word7
449#define lpfc_wqe_gen_class_SHIFT 16
450#define lpfc_wqe_gen_class_MASK 0x00000007
451#define lpfc_wqe_gen_class_WORD word7
452#define lpfc_wqe_gen_command_SHIFT 8
453#define lpfc_wqe_gen_command_MASK 0x000000FF
454#define lpfc_wqe_gen_command_WORD word7
455#define lpfc_wqe_gen_status_SHIFT 4
456#define lpfc_wqe_gen_status_MASK 0x0000000F
457#define lpfc_wqe_gen_status_WORD word7
458#define lpfc_wqe_gen_ct_SHIFT 2
459#define lpfc_wqe_gen_ct_MASK 0x00000003
460#define lpfc_wqe_gen_ct_WORD word7
461 uint32_t abort_tag;
462 uint32_t word9;
463#define lpfc_wqe_gen_request_tag_SHIFT 0
464#define lpfc_wqe_gen_request_tag_MASK 0x0000FFFF
465#define lpfc_wqe_gen_request_tag_WORD word9
466 uint32_t word10;
467#define lpfc_wqe_gen_ccp_SHIFT 24
468#define lpfc_wqe_gen_ccp_MASK 0x000000FF
469#define lpfc_wqe_gen_ccp_WORD word10
470#define lpfc_wqe_gen_ccpe_SHIFT 23
471#define lpfc_wqe_gen_ccpe_MASK 0x00000001
472#define lpfc_wqe_gen_ccpe_WORD word10
473#define lpfc_wqe_gen_pv_SHIFT 19
474#define lpfc_wqe_gen_pv_MASK 0x00000001
475#define lpfc_wqe_gen_pv_WORD word10
476#define lpfc_wqe_gen_pri_SHIFT 16
477#define lpfc_wqe_gen_pri_MASK 0x00000007
478#define lpfc_wqe_gen_pri_WORD word10
479 uint32_t word11;
480#define lpfc_wqe_gen_cq_id_SHIFT 16
481#define lpfc_wqe_gen_cq_id_MASK 0x0000FFFF
482#define lpfc_wqe_gen_cq_id_WORD word11
483#define LPFC_WQE_CQ_ID_DEFAULT 0xffff
484#define lpfc_wqe_gen_wqec_SHIFT 7
485#define lpfc_wqe_gen_wqec_MASK 0x00000001
486#define lpfc_wqe_gen_wqec_WORD word11
487#define ELS_ID_FLOGI 3
488#define ELS_ID_FDISC 2
489#define ELS_ID_LOGO 1
490#define ELS_ID_DEFAULT 0
491#define lpfc_wqe_gen_els_id_SHIFT 4
492#define lpfc_wqe_gen_els_id_MASK 0x00000003
493#define lpfc_wqe_gen_els_id_WORD word11
494#define lpfc_wqe_gen_cmd_type_SHIFT 0
495#define lpfc_wqe_gen_cmd_type_MASK 0x0000000F
496#define lpfc_wqe_gen_cmd_type_WORD word11
497 uint32_t payload[4];
498};
499
500struct lpfc_rqe { 427struct lpfc_rqe {
501 uint32_t address_hi; 428 uint32_t address_hi;
502 uint32_t address_lo; 429 uint32_t address_lo;
@@ -2279,9 +2206,36 @@ struct wqe_common {
2279#define wqe_reqtag_MASK 0x0000FFFF 2206#define wqe_reqtag_MASK 0x0000FFFF
2280#define wqe_reqtag_WORD word9 2207#define wqe_reqtag_WORD word9
2281#define wqe_rcvoxid_SHIFT 16 2208#define wqe_rcvoxid_SHIFT 16
2282#define wqe_rcvoxid_MASK 0x0000FFFF 2209#define wqe_rcvoxid_MASK 0x0000FFFF
2283#define wqe_rcvoxid_WORD word9 2210#define wqe_rcvoxid_WORD word9
2284 uint32_t word10; 2211 uint32_t word10;
2212#define wqe_ebde_cnt_SHIFT 0
2213#define wqe_ebde_cnt_MASK 0x00000007
2214#define wqe_ebde_cnt_WORD word10
2215#define wqe_lenloc_SHIFT 7
2216#define wqe_lenloc_MASK 0x00000003
2217#define wqe_lenloc_WORD word10
2218#define LPFC_WQE_LENLOC_NONE 0
2219#define LPFC_WQE_LENLOC_WORD3 1
2220#define LPFC_WQE_LENLOC_WORD12 2
2221#define LPFC_WQE_LENLOC_WORD4 3
2222#define wqe_qosd_SHIFT 9
2223#define wqe_qosd_MASK 0x00000001
2224#define wqe_qosd_WORD word10
2225#define wqe_xbl_SHIFT 11
2226#define wqe_xbl_MASK 0x00000001
2227#define wqe_xbl_WORD word10
2228#define wqe_iod_SHIFT 13
2229#define wqe_iod_MASK 0x00000001
2230#define wqe_iod_WORD word10
2231#define LPFC_WQE_IOD_WRITE 0
2232#define LPFC_WQE_IOD_READ 1
2233#define wqe_dbde_SHIFT 14
2234#define wqe_dbde_MASK 0x00000001
2235#define wqe_dbde_WORD word10
2236#define wqe_wqes_SHIFT 15
2237#define wqe_wqes_MASK 0x00000001
2238#define wqe_wqes_WORD word10
2285#define wqe_pri_SHIFT 16 2239#define wqe_pri_SHIFT 16
2286#define wqe_pri_MASK 0x00000007 2240#define wqe_pri_MASK 0x00000007
2287#define wqe_pri_WORD word10 2241#define wqe_pri_WORD word10
@@ -2295,18 +2249,26 @@ struct wqe_common {
2295#define wqe_ccpe_MASK 0x00000001 2249#define wqe_ccpe_MASK 0x00000001
2296#define wqe_ccpe_WORD word10 2250#define wqe_ccpe_WORD word10
2297#define wqe_ccp_SHIFT 24 2251#define wqe_ccp_SHIFT 24
2298#define wqe_ccp_MASK 0x000000ff 2252#define wqe_ccp_MASK 0x000000ff
2299#define wqe_ccp_WORD word10 2253#define wqe_ccp_WORD word10
2300 uint32_t word11; 2254 uint32_t word11;
2301#define wqe_cmd_type_SHIFT 0 2255#define wqe_cmd_type_SHIFT 0
2302#define wqe_cmd_type_MASK 0x0000000f 2256#define wqe_cmd_type_MASK 0x0000000f
2303#define wqe_cmd_type_WORD word11 2257#define wqe_cmd_type_WORD word11
2304#define wqe_wqec_SHIFT 7 2258#define wqe_els_id_SHIFT 4
2305#define wqe_wqec_MASK 0x00000001 2259#define wqe_els_id_MASK 0x00000003
2306#define wqe_wqec_WORD word11 2260#define wqe_els_id_WORD word11
2307#define wqe_cqid_SHIFT 16 2261#define LPFC_ELS_ID_FLOGI 3
2308#define wqe_cqid_MASK 0x0000ffff 2262#define LPFC_ELS_ID_FDISC 2
2309#define wqe_cqid_WORD word11 2263#define LPFC_ELS_ID_LOGO 1
2264#define LPFC_ELS_ID_DEFAULT 0
2265#define wqe_wqec_SHIFT 7
2266#define wqe_wqec_MASK 0x00000001
2267#define wqe_wqec_WORD word11
2268#define wqe_cqid_SHIFT 16
2269#define wqe_cqid_MASK 0x0000ffff
2270#define wqe_cqid_WORD word11
2271#define LPFC_WQE_CQ_ID_DEFAULT 0xffff
2310}; 2272};
2311 2273
2312struct wqe_did { 2274struct wqe_did {
@@ -2325,6 +2287,15 @@ struct wqe_did {
2325#define wqe_xmit_bls_xo_WORD word5 2287#define wqe_xmit_bls_xo_WORD word5
2326}; 2288};
2327 2289
2290struct lpfc_wqe_generic{
2291 struct ulp_bde64 bde;
2292 uint32_t word3;
2293 uint32_t word4;
2294 uint32_t word5;
2295 struct wqe_common wqe_com;
2296 uint32_t payload[4];
2297};
2298
2328struct els_request64_wqe { 2299struct els_request64_wqe {
2329 struct ulp_bde64 bde; 2300 struct ulp_bde64 bde;
2330 uint32_t payload_len; 2301 uint32_t payload_len;
@@ -2356,9 +2327,9 @@ struct els_request64_wqe {
2356 2327
2357struct xmit_els_rsp64_wqe { 2328struct xmit_els_rsp64_wqe {
2358 struct ulp_bde64 bde; 2329 struct ulp_bde64 bde;
2359 uint32_t rsvd3; 2330 uint32_t response_payload_len;
2360 uint32_t rsvd4; 2331 uint32_t rsvd4;
2361 struct wqe_did wqe_dest; 2332 struct wqe_did wqe_dest;
2362 struct wqe_common wqe_com; /* words 6-11 */ 2333 struct wqe_common wqe_com; /* words 6-11 */
2363 uint32_t rsvd_12_15[4]; 2334 uint32_t rsvd_12_15[4];
2364}; 2335};
@@ -2427,7 +2398,7 @@ struct wqe_rctl_dfctl {
2427 2398
2428struct xmit_seq64_wqe { 2399struct xmit_seq64_wqe {
2429 struct ulp_bde64 bde; 2400 struct ulp_bde64 bde;
2430 uint32_t paylaod_offset; 2401 uint32_t rsvd3;
2431 uint32_t relative_offset; 2402 uint32_t relative_offset;
2432 struct wqe_rctl_dfctl wge_ctl; 2403 struct wqe_rctl_dfctl wge_ctl;
2433 struct wqe_common wqe_com; /* words 6-11 */ 2404 struct wqe_common wqe_com; /* words 6-11 */
@@ -2437,7 +2408,7 @@ struct xmit_seq64_wqe {
2437}; 2408};
2438struct xmit_bcast64_wqe { 2409struct xmit_bcast64_wqe {
2439 struct ulp_bde64 bde; 2410 struct ulp_bde64 bde;
2440 uint32_t paylaod_len; 2411 uint32_t seq_payload_len;
2441 uint32_t rsvd4; 2412 uint32_t rsvd4;
2442 struct wqe_rctl_dfctl wge_ctl; /* word 5 */ 2413 struct wqe_rctl_dfctl wge_ctl; /* word 5 */
2443 struct wqe_common wqe_com; /* words 6-11 */ 2414 struct wqe_common wqe_com; /* words 6-11 */
@@ -2446,8 +2417,8 @@ struct xmit_bcast64_wqe {
2446 2417
2447struct gen_req64_wqe { 2418struct gen_req64_wqe {
2448 struct ulp_bde64 bde; 2419 struct ulp_bde64 bde;
2449 uint32_t command_len; 2420 uint32_t request_payload_len;
2450 uint32_t payload_len; 2421 uint32_t relative_offset;
2451 struct wqe_rctl_dfctl wge_ctl; /* word 5 */ 2422 struct wqe_rctl_dfctl wge_ctl; /* word 5 */
2452 struct wqe_common wqe_com; /* words 6-11 */ 2423 struct wqe_common wqe_com; /* words 6-11 */
2453 uint32_t rsvd_12_15[4]; 2424 uint32_t rsvd_12_15[4];
@@ -2480,7 +2451,7 @@ struct abort_cmd_wqe {
2480 2451
2481struct fcp_iwrite64_wqe { 2452struct fcp_iwrite64_wqe {
2482 struct ulp_bde64 bde; 2453 struct ulp_bde64 bde;
2483 uint32_t payload_len; 2454 uint32_t payload_offset_len;
2484 uint32_t total_xfer_len; 2455 uint32_t total_xfer_len;
2485 uint32_t initial_xfer_len; 2456 uint32_t initial_xfer_len;
2486 struct wqe_common wqe_com; /* words 6-11 */ 2457 struct wqe_common wqe_com; /* words 6-11 */
@@ -2489,7 +2460,7 @@ struct fcp_iwrite64_wqe {
2489 2460
2490struct fcp_iread64_wqe { 2461struct fcp_iread64_wqe {
2491 struct ulp_bde64 bde; 2462 struct ulp_bde64 bde;
2492 uint32_t payload_len; /* word 3 */ 2463 uint32_t payload_offset_len; /* word 3 */
2493 uint32_t total_xfer_len; /* word 4 */ 2464 uint32_t total_xfer_len; /* word 4 */
2494 uint32_t rsrvd5; /* word 5 */ 2465 uint32_t rsrvd5; /* word 5 */
2495 struct wqe_common wqe_com; /* words 6-11 */ 2466 struct wqe_common wqe_com; /* words 6-11 */
@@ -2497,10 +2468,12 @@ struct fcp_iread64_wqe {
2497}; 2468};
2498 2469
2499struct fcp_icmnd64_wqe { 2470struct fcp_icmnd64_wqe {
2500 struct ulp_bde64 bde; /* words 0-2 */ 2471 struct ulp_bde64 bde; /* words 0-2 */
2501 uint32_t rsrvd[3]; /* words 3-5 */ 2472 uint32_t rsrvd3; /* word 3 */
2473 uint32_t rsrvd4; /* word 4 */
2474 uint32_t rsrvd5; /* word 5 */
2502 struct wqe_common wqe_com; /* words 6-11 */ 2475 struct wqe_common wqe_com; /* words 6-11 */
2503 uint32_t rsvd_12_15[4]; /* word 12-15 */ 2476 uint32_t rsvd_12_15[4]; /* word 12-15 */
2504}; 2477};
2505 2478
2506 2479
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index ce4145377efd..554efa6623f4 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -95,7 +95,7 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
95 return -ENOMEM; 95 return -ENOMEM;
96 /* set consumption flag every once in a while */ 96 /* set consumption flag every once in a while */
97 if (!((q->host_index + 1) % LPFC_RELEASE_NOTIFICATION_INTERVAL)) 97 if (!((q->host_index + 1) % LPFC_RELEASE_NOTIFICATION_INTERVAL))
98 bf_set(lpfc_wqe_gen_wqec, &wqe->generic, 1); 98 bf_set(wqe_wqec, &wqe->generic.wqe_com, 1);
99 99
100 lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size); 100 lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
101 101
@@ -5965,7 +5965,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
5965 uint16_t abrt_iotag; 5965 uint16_t abrt_iotag;
5966 struct lpfc_iocbq *abrtiocbq; 5966 struct lpfc_iocbq *abrtiocbq;
5967 struct ulp_bde64 *bpl = NULL; 5967 struct ulp_bde64 *bpl = NULL;
5968 uint32_t els_id = ELS_ID_DEFAULT; 5968 uint32_t els_id = LPFC_ELS_ID_DEFAULT;
5969 int numBdes, i; 5969 int numBdes, i;
5970 struct ulp_bde64 bde; 5970 struct ulp_bde64 bde;
5971 5971
@@ -5982,7 +5982,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
5982 memcpy(wqe, &iocbq->iocb, sizeof(union lpfc_wqe)); 5982 memcpy(wqe, &iocbq->iocb, sizeof(union lpfc_wqe));
5983 abort_tag = (uint32_t) iocbq->iotag; 5983 abort_tag = (uint32_t) iocbq->iotag;
5984 xritag = iocbq->sli4_xritag; 5984 xritag = iocbq->sli4_xritag;
5985 wqe->words[7] = 0; /* The ct field has moved so reset */ 5985 wqe->generic.wqe_com.word7 = 0; /* The ct field has moved so reset */
5986 /* words0-2 bpl convert bde */ 5986 /* words0-2 bpl convert bde */
5987 if (iocbq->iocb.un.genreq64.bdl.bdeFlags == BUFF_TYPE_BLP_64) { 5987 if (iocbq->iocb.un.genreq64.bdl.bdeFlags == BUFF_TYPE_BLP_64) {
5988 numBdes = iocbq->iocb.un.genreq64.bdl.bdeSize / 5988 numBdes = iocbq->iocb.un.genreq64.bdl.bdeSize /
@@ -6033,109 +6033,117 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6033 * contains the FCFI and remote N_Port_ID is 6033 * contains the FCFI and remote N_Port_ID is
6034 * in word 5. 6034 * in word 5.
6035 */ 6035 */
6036
6037 ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l); 6036 ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l);
6038 bf_set(lpfc_wqe_gen_context, &wqe->generic, 6037 bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com,
6039 iocbq->iocb.ulpContext); 6038 iocbq->iocb.ulpContext);
6040 6039 bf_set(wqe_ct, &wqe->els_req.wqe_com, ct);
6041 bf_set(lpfc_wqe_gen_ct, &wqe->generic, ct); 6040 bf_set(wqe_pu, &wqe->els_req.wqe_com, 0);
6042 bf_set(lpfc_wqe_gen_pu, &wqe->generic, 0);
6043 /* CCP CCPE PV PRI in word10 were set in the memcpy */ 6041 /* CCP CCPE PV PRI in word10 were set in the memcpy */
6044
6045 if (command_type == ELS_COMMAND_FIP) { 6042 if (command_type == ELS_COMMAND_FIP) {
6046 els_id = ((iocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK) 6043 els_id = ((iocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK)
6047 >> LPFC_FIP_ELS_ID_SHIFT); 6044 >> LPFC_FIP_ELS_ID_SHIFT);
6048 } 6045 }
6049 bf_set(lpfc_wqe_gen_els_id, &wqe->generic, els_id); 6046 bf_set(wqe_els_id, &wqe->els_req.wqe_com, els_id);
6050 6047 bf_set(wqe_dbde, &wqe->els_req.wqe_com, 1);
6048 bf_set(wqe_iod, &wqe->els_req.wqe_com, LPFC_WQE_IOD_READ);
6049 bf_set(wqe_qosd, &wqe->els_req.wqe_com, 1);
6050 bf_set(wqe_lenloc, &wqe->els_req.wqe_com, LPFC_WQE_LENLOC_NONE);
6051 bf_set(wqe_ebde_cnt, &wqe->els_req.wqe_com, 0);
6051 break; 6052 break;
6052 case CMD_XMIT_SEQUENCE64_CX: 6053 case CMD_XMIT_SEQUENCE64_CX:
6053 bf_set(lpfc_wqe_gen_context, &wqe->generic, 6054 bf_set(wqe_ctxt_tag, &wqe->xmit_sequence.wqe_com,
6054 iocbq->iocb.un.ulpWord[3]); 6055 iocbq->iocb.un.ulpWord[3]);
6055 wqe->generic.word3 = 0; 6056 bf_set(wqe_rcvoxid, &wqe->xmit_sequence.wqe_com,
6056 bf_set(wqe_rcvoxid, &wqe->generic, iocbq->iocb.ulpContext); 6057 iocbq->iocb.ulpContext);
6057 /* The entire sequence is transmitted for this IOCB */ 6058 /* The entire sequence is transmitted for this IOCB */
6058 xmit_len = total_len; 6059 xmit_len = total_len;
6059 cmnd = CMD_XMIT_SEQUENCE64_CR; 6060 cmnd = CMD_XMIT_SEQUENCE64_CR;
6060 case CMD_XMIT_SEQUENCE64_CR: 6061 case CMD_XMIT_SEQUENCE64_CR:
6061 /* word3 iocb=io_tag32 wqe=payload_offset */ 6062 /* word3 iocb=io_tag32 wqe=reserved */
6062 /* payload offset used for multilpe outstanding 6063 wqe->xmit_sequence.rsvd3 = 0;
6063 * sequences on the same exchange
6064 */
6065 wqe->words[3] = 0;
6066 /* word4 relative_offset memcpy */ 6064 /* word4 relative_offset memcpy */
6067 /* word5 r_ctl/df_ctl memcpy */ 6065 /* word5 r_ctl/df_ctl memcpy */
6068 bf_set(lpfc_wqe_gen_pu, &wqe->generic, 0); 6066 bf_set(wqe_pu, &wqe->xmit_sequence.wqe_com, 0);
6067 bf_set(wqe_dbde, &wqe->xmit_sequence.wqe_com, 1);
6068 bf_set(wqe_iod, &wqe->xmit_sequence.wqe_com,
6069 LPFC_WQE_IOD_WRITE);
6070 bf_set(wqe_lenloc, &wqe->xmit_sequence.wqe_com,
6071 LPFC_WQE_LENLOC_WORD12);
6072 bf_set(wqe_ebde_cnt, &wqe->xmit_sequence.wqe_com, 0);
6069 wqe->xmit_sequence.xmit_len = xmit_len; 6073 wqe->xmit_sequence.xmit_len = xmit_len;
6070 command_type = OTHER_COMMAND; 6074 command_type = OTHER_COMMAND;
6071 break; 6075 break;
6072 case CMD_XMIT_BCAST64_CN: 6076 case CMD_XMIT_BCAST64_CN:
6073 /* word3 iocb=iotag32 wqe=payload_len */ 6077 /* word3 iocb=iotag32 wqe=seq_payload_len */
6074 wqe->words[3] = 0; /* no definition for this in wqe */ 6078 wqe->xmit_bcast64.seq_payload_len = xmit_len;
6075 /* word4 iocb=rsvd wqe=rsvd */ 6079 /* word4 iocb=rsvd wqe=rsvd */
6076 /* word5 iocb=rctl/type/df_ctl wqe=rctl/type/df_ctl memcpy */ 6080 /* word5 iocb=rctl/type/df_ctl wqe=rctl/type/df_ctl memcpy */
6077 /* word6 iocb=ctxt_tag/io_tag wqe=ctxt_tag/xri */ 6081 /* word6 iocb=ctxt_tag/io_tag wqe=ctxt_tag/xri */
6078 bf_set(lpfc_wqe_gen_ct, &wqe->generic, 6082 bf_set(wqe_ct, &wqe->xmit_bcast64.wqe_com,
6079 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l)); 6083 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l));
6084 bf_set(wqe_dbde, &wqe->xmit_bcast64.wqe_com, 1);
6085 bf_set(wqe_iod, &wqe->xmit_bcast64.wqe_com, LPFC_WQE_IOD_WRITE);
6086 bf_set(wqe_lenloc, &wqe->xmit_bcast64.wqe_com,
6087 LPFC_WQE_LENLOC_WORD3);
6088 bf_set(wqe_ebde_cnt, &wqe->xmit_bcast64.wqe_com, 0);
6080 break; 6089 break;
6081 case CMD_FCP_IWRITE64_CR: 6090 case CMD_FCP_IWRITE64_CR:
6082 command_type = FCP_COMMAND_DATA_OUT; 6091 command_type = FCP_COMMAND_DATA_OUT;
6083 /* The struct for wqe fcp_iwrite has 3 fields that are somewhat 6092 /* word3 iocb=iotag wqe=payload_offset_len */
6084 * confusing. 6093 /* Add the FCP_CMD and FCP_RSP sizes to get the offset */
6085 * word3 is payload_len: byte offset to the sgl entry for the 6094 wqe->fcp_iwrite.payload_offset_len =
6086 * fcp_command. 6095 xmit_len + sizeof(struct fcp_rsp);
6087 * word4 is total xfer len, same as the IOCB->ulpParameter. 6096 /* word4 iocb=parameter wqe=total_xfer_length memcpy */
6088 * word5 is initial xfer len 0 = wait for xfer-ready 6097 /* word5 iocb=initial_xfer_len wqe=initial_xfer_len memcpy */
6089 */ 6098 bf_set(wqe_erp, &wqe->fcp_iwrite.wqe_com,
6090 6099 iocbq->iocb.ulpFCP2Rcvy);
6091 /* Always wait for xfer-ready before sending data */ 6100 bf_set(wqe_lnk, &wqe->fcp_iwrite.wqe_com, iocbq->iocb.ulpXS);
6092 wqe->fcp_iwrite.initial_xfer_len = 0; 6101 /* Always open the exchange */
6093 /* word 4 (xfer length) should have been set on the memcpy */ 6102 bf_set(wqe_xc, &wqe->fcp_iwrite.wqe_com, 0);
6094 6103 bf_set(wqe_dbde, &wqe->fcp_iwrite.wqe_com, 1);
6095 /* allow write to fall through to read */ 6104 bf_set(wqe_iod, &wqe->fcp_iwrite.wqe_com, LPFC_WQE_IOD_WRITE);
6105 bf_set(wqe_lenloc, &wqe->fcp_iwrite.wqe_com,
6106 LPFC_WQE_LENLOC_WORD4);
6107 bf_set(wqe_ebde_cnt, &wqe->fcp_iwrite.wqe_com, 0);
6108 bf_set(wqe_pu, &wqe->fcp_iwrite.wqe_com, iocbq->iocb.ulpPU);
6109 break;
6096 case CMD_FCP_IREAD64_CR: 6110 case CMD_FCP_IREAD64_CR:
6097 /* FCP_CMD is always the 1st sgl entry */ 6111 /* word3 iocb=iotag wqe=payload_offset_len */
6098 wqe->fcp_iread.payload_len = 6112 /* Add the FCP_CMD and FCP_RSP sizes to get the offset */
6113 wqe->fcp_iread.payload_offset_len =
6099 xmit_len + sizeof(struct fcp_rsp); 6114 xmit_len + sizeof(struct fcp_rsp);
6100 6115 /* word4 iocb=parameter wqe=total_xfer_length memcpy */
6101 /* word 4 (xfer length) should have been set on the memcpy */ 6116 /* word5 iocb=initial_xfer_len wqe=initial_xfer_len memcpy */
6102 6117 bf_set(wqe_erp, &wqe->fcp_iread.wqe_com,
6103 bf_set(lpfc_wqe_gen_erp, &wqe->generic, 6118 iocbq->iocb.ulpFCP2Rcvy);
6104 iocbq->iocb.ulpFCP2Rcvy); 6119 bf_set(wqe_lnk, &wqe->fcp_iread.wqe_com, iocbq->iocb.ulpXS);
6105 bf_set(lpfc_wqe_gen_lnk, &wqe->generic, iocbq->iocb.ulpXS);
6106 /* The XC bit and the XS bit are similar. The driver never
6107 * tracked whether or not the exchange was previouslly open.
6108 * XC = Exchange create, 0 is create. 1 is already open.
6109 * XS = link cmd: 1 do not close the exchange after command.
6110 * XS = 0 close exchange when command completes.
6111 * The only time we would not set the XC bit is when the XS bit
6112 * is set and we are sending our 2nd or greater command on
6113 * this exchange.
6114 */
6115 /* Always open the exchange */ 6120 /* Always open the exchange */
6116 bf_set(wqe_xc, &wqe->fcp_iread.wqe_com, 0); 6121 bf_set(wqe_xc, &wqe->fcp_iread.wqe_com, 0);
6117 6122 bf_set(wqe_dbde, &wqe->fcp_iread.wqe_com, 1);
6118 wqe->words[10] &= 0xffff0000; /* zero out ebde count */ 6123 bf_set(wqe_iod, &wqe->fcp_iread.wqe_com, LPFC_WQE_IOD_READ);
6119 bf_set(lpfc_wqe_gen_pu, &wqe->generic, iocbq->iocb.ulpPU); 6124 bf_set(wqe_lenloc, &wqe->fcp_iread.wqe_com,
6120 break; 6125 LPFC_WQE_LENLOC_WORD4);
6126 bf_set(wqe_ebde_cnt, &wqe->fcp_iread.wqe_com, 0);
6127 bf_set(wqe_pu, &wqe->fcp_iread.wqe_com, iocbq->iocb.ulpPU);
6128 break;
6121 case CMD_FCP_ICMND64_CR: 6129 case CMD_FCP_ICMND64_CR:
6130 /* word3 iocb=IO_TAG wqe=reserved */
6131 wqe->fcp_icmd.rsrvd3 = 0;
6132 bf_set(wqe_pu, &wqe->fcp_icmd.wqe_com, 0);
6122 /* Always open the exchange */ 6133 /* Always open the exchange */
6123 bf_set(wqe_xc, &wqe->fcp_iread.wqe_com, 0); 6134 bf_set(wqe_xc, &wqe->fcp_icmd.wqe_com, 0);
6124 6135 bf_set(wqe_dbde, &wqe->fcp_icmd.wqe_com, 1);
6125 wqe->words[4] = 0; 6136 bf_set(wqe_iod, &wqe->fcp_icmd.wqe_com, LPFC_WQE_IOD_WRITE);
6126 wqe->words[10] &= 0xffff0000; /* zero out ebde count */ 6137 bf_set(wqe_qosd, &wqe->fcp_icmd.wqe_com, 1);
6127 bf_set(lpfc_wqe_gen_pu, &wqe->generic, 0); 6138 bf_set(wqe_lenloc, &wqe->fcp_icmd.wqe_com,
6139 LPFC_WQE_LENLOC_NONE);
6140 bf_set(wqe_ebde_cnt, &wqe->fcp_icmd.wqe_com, 0);
6128 break; 6141 break;
6129 case CMD_GEN_REQUEST64_CR: 6142 case CMD_GEN_REQUEST64_CR:
6130 /* word3 command length is described as byte offset to the 6143 /* word3 iocb=IO_TAG wqe=request_payload_len */
6131 * rsp_data. Would always be 16, sizeof(struct sli4_sge) 6144 wqe->gen_req.request_payload_len = xmit_len;
6132 * sgl[0] = cmnd 6145 /* word4 iocb=parameter wqe=relative_offset memcpy */
6133 * sgl[1] = rsp. 6146 /* word5 [rctl, type, df_ctl, la] copied in memcpy */
6134 *
6135 */
6136 wqe->gen_req.command_len = xmit_len;
6137 /* Word4 parameter copied in the memcpy */
6138 /* Word5 [rctl, type, df_ctl, la] copied in memcpy */
6139 /* word6 context tag copied in memcpy */ 6147 /* word6 context tag copied in memcpy */
6140 if (iocbq->iocb.ulpCt_h || iocbq->iocb.ulpCt_l) { 6148 if (iocbq->iocb.ulpCt_h || iocbq->iocb.ulpCt_l) {
6141 ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l); 6149 ct = ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l);
@@ -6144,31 +6152,39 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6144 ct, iocbq->iocb.ulpCommand); 6152 ct, iocbq->iocb.ulpCommand);
6145 return IOCB_ERROR; 6153 return IOCB_ERROR;
6146 } 6154 }
6147 bf_set(lpfc_wqe_gen_ct, &wqe->generic, 0); 6155 bf_set(wqe_ct, &wqe->gen_req.wqe_com, 0);
6148 bf_set(wqe_tmo, &wqe->gen_req.wqe_com, 6156 bf_set(wqe_tmo, &wqe->gen_req.wqe_com, iocbq->iocb.ulpTimeout);
6149 iocbq->iocb.ulpTimeout); 6157 bf_set(wqe_pu, &wqe->gen_req.wqe_com, iocbq->iocb.ulpPU);
6150 6158 bf_set(wqe_dbde, &wqe->gen_req.wqe_com, 1);
6151 bf_set(lpfc_wqe_gen_pu, &wqe->generic, iocbq->iocb.ulpPU); 6159 bf_set(wqe_iod, &wqe->gen_req.wqe_com, LPFC_WQE_IOD_READ);
6160 bf_set(wqe_qosd, &wqe->gen_req.wqe_com, 1);
6161 bf_set(wqe_lenloc, &wqe->gen_req.wqe_com, LPFC_WQE_LENLOC_NONE);
6162 bf_set(wqe_ebde_cnt, &wqe->gen_req.wqe_com, 0);
6152 command_type = OTHER_COMMAND; 6163 command_type = OTHER_COMMAND;
6153 break; 6164 break;
6154 case CMD_XMIT_ELS_RSP64_CX: 6165 case CMD_XMIT_ELS_RSP64_CX:
6155 /* words0-2 BDE memcpy */ 6166 /* words0-2 BDE memcpy */
6156 /* word3 iocb=iotag32 wqe=rsvd */ 6167 /* word3 iocb=iotag32 wqe=response_payload_len */
6157 wqe->words[3] = 0; 6168 wqe->xmit_els_rsp.response_payload_len = xmit_len;
6158 /* word4 iocb=did wge=rsvd. */ 6169 /* word4 iocb=did wge=rsvd. */
6159 wqe->words[4] = 0; 6170 wqe->xmit_els_rsp.rsvd4 = 0;
6160 /* word5 iocb=rsvd wge=did */ 6171 /* word5 iocb=rsvd wge=did */
6161 bf_set(wqe_els_did, &wqe->xmit_els_rsp.wqe_dest, 6172 bf_set(wqe_els_did, &wqe->xmit_els_rsp.wqe_dest,
6162 iocbq->iocb.un.elsreq64.remoteID); 6173 iocbq->iocb.un.elsreq64.remoteID);
6163 6174 bf_set(wqe_ct, &wqe->xmit_els_rsp.wqe_com,
6164 bf_set(lpfc_wqe_gen_ct, &wqe->generic, 6175 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l));
6165 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l)); 6176 bf_set(wqe_pu, &wqe->xmit_els_rsp.wqe_com, iocbq->iocb.ulpPU);
6166 6177 bf_set(wqe_rcvoxid, &wqe->xmit_els_rsp.wqe_com,
6167 bf_set(lpfc_wqe_gen_pu, &wqe->generic, iocbq->iocb.ulpPU); 6178 iocbq->iocb.ulpContext);
6168 bf_set(wqe_rcvoxid, &wqe->generic, iocbq->iocb.ulpContext);
6169 if (!iocbq->iocb.ulpCt_h && iocbq->iocb.ulpCt_l) 6179 if (!iocbq->iocb.ulpCt_h && iocbq->iocb.ulpCt_l)
6170 bf_set(lpfc_wqe_gen_context, &wqe->generic, 6180 bf_set(wqe_ctxt_tag, &wqe->xmit_els_rsp.wqe_com,
6171 iocbq->vport->vpi + phba->vpi_base); 6181 iocbq->vport->vpi + phba->vpi_base);
6182 bf_set(wqe_dbde, &wqe->xmit_els_rsp.wqe_com, 1);
6183 bf_set(wqe_iod, &wqe->xmit_els_rsp.wqe_com, LPFC_WQE_IOD_WRITE);
6184 bf_set(wqe_qosd, &wqe->xmit_els_rsp.wqe_com, 1);
6185 bf_set(wqe_lenloc, &wqe->xmit_els_rsp.wqe_com,
6186 LPFC_WQE_LENLOC_WORD3);
6187 bf_set(wqe_ebde_cnt, &wqe->xmit_els_rsp.wqe_com, 0);
6172 command_type = OTHER_COMMAND; 6188 command_type = OTHER_COMMAND;
6173 break; 6189 break;
6174 case CMD_CLOSE_XRI_CN: 6190 case CMD_CLOSE_XRI_CN:
@@ -6193,15 +6209,19 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6193 else 6209 else
6194 bf_set(abort_cmd_ia, &wqe->abort_cmd, 0); 6210 bf_set(abort_cmd_ia, &wqe->abort_cmd, 0);
6195 bf_set(abort_cmd_criteria, &wqe->abort_cmd, T_XRI_TAG); 6211 bf_set(abort_cmd_criteria, &wqe->abort_cmd, T_XRI_TAG);
6196 wqe->words[5] = 0; 6212 /* word5 iocb=CONTEXT_TAG|IO_TAG wqe=reserved */
6197 bf_set(lpfc_wqe_gen_ct, &wqe->generic, 6213 wqe->abort_cmd.rsrvd5 = 0;
6214 bf_set(wqe_ct, &wqe->abort_cmd.wqe_com,
6198 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l)); 6215 ((iocbq->iocb.ulpCt_h << 1) | iocbq->iocb.ulpCt_l));
6199 abort_tag = iocbq->iocb.un.acxri.abortIoTag; 6216 abort_tag = iocbq->iocb.un.acxri.abortIoTag;
6200 /* 6217 /*
6201 * The abort handler will send us CMD_ABORT_XRI_CN or 6218 * The abort handler will send us CMD_ABORT_XRI_CN or
6202 * CMD_CLOSE_XRI_CN and the fw only accepts CMD_ABORT_XRI_CX 6219 * CMD_CLOSE_XRI_CN and the fw only accepts CMD_ABORT_XRI_CX
6203 */ 6220 */
6204 bf_set(lpfc_wqe_gen_command, &wqe->generic, CMD_ABORT_XRI_CX); 6221 bf_set(wqe_cmnd, &wqe->abort_cmd.wqe_com, CMD_ABORT_XRI_CX);
6222 bf_set(wqe_qosd, &wqe->abort_cmd.wqe_com, 1);
6223 bf_set(wqe_lenloc, &wqe->abort_cmd.wqe_com,
6224 LPFC_WQE_LENLOC_NONE);
6205 cmnd = CMD_ABORT_XRI_CX; 6225 cmnd = CMD_ABORT_XRI_CX;
6206 command_type = OTHER_COMMAND; 6226 command_type = OTHER_COMMAND;
6207 xritag = 0; 6227 xritag = 0;
@@ -6235,18 +6255,14 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6235 bf_set(wqe_xmit_bls_pt, &wqe->xmit_bls_rsp.wqe_dest, 0x1); 6255 bf_set(wqe_xmit_bls_pt, &wqe->xmit_bls_rsp.wqe_dest, 0x1);
6236 bf_set(wqe_ctxt_tag, &wqe->xmit_bls_rsp.wqe_com, 6256 bf_set(wqe_ctxt_tag, &wqe->xmit_bls_rsp.wqe_com,
6237 iocbq->iocb.ulpContext); 6257 iocbq->iocb.ulpContext);
6258 bf_set(wqe_qosd, &wqe->xmit_bls_rsp.wqe_com, 1);
6259 bf_set(wqe_lenloc, &wqe->xmit_bls_rsp.wqe_com,
6260 LPFC_WQE_LENLOC_NONE);
6238 /* Overwrite the pre-set comnd type with OTHER_COMMAND */ 6261 /* Overwrite the pre-set comnd type with OTHER_COMMAND */
6239 command_type = OTHER_COMMAND; 6262 command_type = OTHER_COMMAND;
6240 break; 6263 break;
6241 case CMD_XRI_ABORTED_CX: 6264 case CMD_XRI_ABORTED_CX:
6242 case CMD_CREATE_XRI_CR: /* Do we expect to use this? */ 6265 case CMD_CREATE_XRI_CR: /* Do we expect to use this? */
6243 /* words0-2 are all 0's no bde */
6244 /* word3 and word4 are rsvrd */
6245 wqe->words[3] = 0;
6246 wqe->words[4] = 0;
6247 /* word5 iocb=rsvd wge=did */
6248 /* There is no remote port id in the IOCB? */
6249 /* Let this fall through and fail */
6250 case CMD_IOCB_FCP_IBIDIR64_CR: /* bidirectional xfer */ 6266 case CMD_IOCB_FCP_IBIDIR64_CR: /* bidirectional xfer */
6251 case CMD_FCP_TSEND64_CX: /* Target mode send xfer-ready */ 6267 case CMD_FCP_TSEND64_CX: /* Target mode send xfer-ready */
6252 case CMD_FCP_TRSP64_CX: /* Target mode rcv */ 6268 case CMD_FCP_TRSP64_CX: /* Target mode rcv */
@@ -6257,16 +6273,14 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
6257 iocbq->iocb.ulpCommand); 6273 iocbq->iocb.ulpCommand);
6258 return IOCB_ERROR; 6274 return IOCB_ERROR;
6259 break; 6275 break;
6260
6261 } 6276 }
6262 bf_set(lpfc_wqe_gen_xri, &wqe->generic, xritag); 6277 bf_set(wqe_xri_tag, &wqe->generic.wqe_com, xritag);
6263 bf_set(lpfc_wqe_gen_request_tag, &wqe->generic, iocbq->iotag); 6278 bf_set(wqe_reqtag, &wqe->generic.wqe_com, iocbq->iotag);
6264 wqe->generic.abort_tag = abort_tag; 6279 wqe->generic.wqe_com.abort_tag = abort_tag;
6265 bf_set(lpfc_wqe_gen_cmd_type, &wqe->generic, command_type); 6280 bf_set(wqe_cmd_type, &wqe->generic.wqe_com, command_type);
6266 bf_set(lpfc_wqe_gen_command, &wqe->generic, cmnd); 6281 bf_set(wqe_cmnd, &wqe->generic.wqe_com, cmnd);
6267 bf_set(lpfc_wqe_gen_class, &wqe->generic, iocbq->iocb.ulpClass); 6282 bf_set(wqe_class, &wqe->generic.wqe_com, iocbq->iocb.ulpClass);
6268 bf_set(lpfc_wqe_gen_cq_id, &wqe->generic, LPFC_WQE_CQ_ID_DEFAULT); 6283 bf_set(wqe_cqid, &wqe->generic.wqe_com, LPFC_WQE_CQ_ID_DEFAULT);
6269
6270 return 0; 6284 return 0;
6271} 6285}
6272 6286