@@ -564,14 +564,14 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
564564 struct bsg_job_data * dd_data ;
565565 struct bsg_job * job ;
566566 struct fc_bsg_reply * bsg_reply ;
567- IOCB_t * rsp ;
568567 struct lpfc_nodelist * ndlp ;
569568 struct lpfc_dmabuf * pcmd = NULL , * prsp = NULL ;
570569 struct fc_bsg_ctels_reply * els_reply ;
571570 uint8_t * rjt_data ;
572571 unsigned long flags ;
573572 unsigned int rsp_size ;
574573 int rc = 0 ;
574+ u32 ulp_status , ulp_word4 , total_data_placed ;
575575
576576 dd_data = cmdiocbq -> context1 ;
577577 ndlp = dd_data -> context_un .iocb .ndlp ;
@@ -592,7 +592,9 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
592592 cmdiocbq -> cmd_flag &= ~LPFC_IO_CMD_OUTSTANDING ;
593593 spin_unlock_irqrestore (& phba -> hbalock , flags );
594594
595- rsp = & rspiocbq -> iocb ;
595+ ulp_status = get_job_ulpstatus (phba , rspiocbq );
596+ ulp_word4 = get_job_word4 (phba , rspiocbq );
597+ total_data_placed = get_job_data_placed (phba , rspiocbq );
596598 pcmd = (struct lpfc_dmabuf * )cmdiocbq -> context2 ;
597599 prsp = (struct lpfc_dmabuf * )pcmd -> list .next ;
598600
@@ -601,24 +603,28 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
601603 */
602604
603605 if (job ) {
604- if (rsp -> ulpStatus == IOSTAT_SUCCESS ) {
605- rsp_size = rsp -> un . elsreq64 . bdl . bdeSize ;
606+ if (ulp_status == IOSTAT_SUCCESS ) {
607+ rsp_size = total_data_placed ;
606608 bsg_reply -> reply_payload_rcv_len =
607609 sg_copy_from_buffer (job -> reply_payload .sg_list ,
608610 job -> reply_payload .sg_cnt ,
609611 prsp -> virt ,
610612 rsp_size );
611- } else if (rsp -> ulpStatus == IOSTAT_LS_RJT ) {
613+ } else if (ulp_status == IOSTAT_LS_RJT ) {
612614 bsg_reply -> reply_payload_rcv_len =
613615 sizeof (struct fc_bsg_ctels_reply );
614616 /* LS_RJT data returned in word 4 */
615- rjt_data = (uint8_t * )& rsp -> un . ulpWord [ 4 ] ;
617+ rjt_data = (uint8_t * )& ulp_word4 ;
616618 els_reply = & bsg_reply -> reply_data .ctels_reply ;
617619 els_reply -> status = FC_CTELS_STATUS_REJECT ;
618620 els_reply -> rjt_data .action = rjt_data [3 ];
619621 els_reply -> rjt_data .reason_code = rjt_data [2 ];
620622 els_reply -> rjt_data .reason_explanation = rjt_data [1 ];
621623 els_reply -> rjt_data .vendor_unique = rjt_data [0 ];
624+ } else if (ulp_status == IOSTAT_LOCAL_REJECT &&
625+ (ulp_word4 & IOERR_PARAM_MASK ) ==
626+ IOERR_SEQUENCE_TIMEOUT ) {
627+ rc = - ETIMEDOUT ;
622628 } else {
623629 rc = - EIO ;
624630 }
@@ -695,7 +701,6 @@ lpfc_bsg_rport_els(struct bsg_job *job)
695701 * we won't be dma into memory that is no longer allocated to for the
696702 * request.
697703 */
698-
699704 cmdiocbq = lpfc_prep_els_iocb (vport , 1 , cmdsize , 0 , ndlp ,
700705 ndlp -> nlp_DID , elscmd );
701706 if (!cmdiocbq ) {
@@ -707,12 +712,13 @@ lpfc_bsg_rport_els(struct bsg_job *job)
707712 sg_copy_to_buffer (job -> request_payload .sg_list ,
708713 job -> request_payload .sg_cnt ,
709714 ((struct lpfc_dmabuf * )cmdiocbq -> context2 )-> virt ,
710- cmdsize );
715+ job -> request_payload . payload_len );
711716
712717 rpi = ndlp -> nlp_rpi ;
713718
714719 if (phba -> sli_rev == LPFC_SLI_REV4 )
715- cmdiocbq -> iocb .ulpContext = phba -> sli4_hba .rpi_ids [rpi ];
720+ bf_set (wqe_ctxt_tag , & cmdiocbq -> wqe .generic .wqe_com ,
721+ phba -> sli4_hba .rpi_ids [rpi ]);
716722 else
717723 cmdiocbq -> iocb .ulpContext = rpi ;
718724 cmdiocbq -> cmd_flag |= LPFC_IO_LIBDFC ;
@@ -1372,11 +1378,11 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,
13721378 struct bsg_job_data * dd_data ;
13731379 struct bsg_job * job ;
13741380 struct fc_bsg_reply * bsg_reply ;
1375- IOCB_t * rsp ;
13761381 struct lpfc_dmabuf * bmp , * cmp ;
13771382 struct lpfc_nodelist * ndlp ;
13781383 unsigned long flags ;
13791384 int rc = 0 ;
1385+ u32 ulp_status , ulp_word4 ;
13801386
13811387 dd_data = cmdiocbq -> context1 ;
13821388
@@ -1397,15 +1403,17 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,
13971403 ndlp = dd_data -> context_un .iocb .ndlp ;
13981404 cmp = cmdiocbq -> context2 ;
13991405 bmp = cmdiocbq -> context3 ;
1400- rsp = & rspiocbq -> iocb ;
1406+
1407+ ulp_status = get_job_ulpstatus (phba , rspiocbq );
1408+ ulp_word4 = get_job_word4 (phba , rspiocbq );
14011409
14021410 /* Copy the completed job data or set the error status */
14031411
14041412 if (job ) {
14051413 bsg_reply = job -> reply ;
1406- if (rsp -> ulpStatus ) {
1407- if (rsp -> ulpStatus == IOSTAT_LOCAL_REJECT ) {
1408- switch (rsp -> un . ulpWord [ 4 ] & IOERR_PARAM_MASK ) {
1414+ if (ulp_status ) {
1415+ if (ulp_status == IOSTAT_LOCAL_REJECT ) {
1416+ switch (ulp_word4 & IOERR_PARAM_MASK ) {
14091417 case IOERR_SEQUENCE_TIMEOUT :
14101418 rc = - ETIMEDOUT ;
14111419 break ;
0 commit comments