aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_ct.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_ct.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index ad7f33a31567..6f187f3b3048 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -257,6 +257,10 @@ lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb)
257{ 257{
258 struct lpfc_dmabuf *buf_ptr; 258 struct lpfc_dmabuf *buf_ptr;
259 259
260 if (ctiocb->context_un.ndlp) {
261 lpfc_nlp_put(ctiocb->context_un.ndlp);
262 ctiocb->context_un.ndlp = NULL;
263 }
260 if (ctiocb->context1) { 264 if (ctiocb->context1) {
261 buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1; 265 buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1;
262 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); 266 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys);
@@ -314,6 +318,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,
314 /* Save for completion so we can release these resources */ 318 /* Save for completion so we can release these resources */
315 geniocb->context1 = (uint8_t *) inp; 319 geniocb->context1 = (uint8_t *) inp;
316 geniocb->context2 = (uint8_t *) outp; 320 geniocb->context2 = (uint8_t *) outp;
321 geniocb->context_un.ndlp = ndlp;
317 322
318 /* Fill in payload, bp points to frame payload */ 323 /* Fill in payload, bp points to frame payload */
319 icmd->ulpCommand = CMD_GEN_REQUEST64_CR; 324 icmd->ulpCommand = CMD_GEN_REQUEST64_CR;
@@ -548,8 +553,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
548 struct lpfc_dmabuf *bmp; 553 struct lpfc_dmabuf *bmp;
549 struct lpfc_dmabuf *outp; 554 struct lpfc_dmabuf *outp;
550 struct lpfc_sli_ct_request *CTrsp; 555 struct lpfc_sli_ct_request *CTrsp;
556 struct lpfc_nodelist *ndlp;
551 int rc; 557 int rc;
552 558
559 /* First save ndlp, before we overwrite it */
560 ndlp = cmdiocb->context_un.ndlp;
561
553 /* we pass cmdiocb to state machine which needs rspiocb as well */ 562 /* we pass cmdiocb to state machine which needs rspiocb as well */
554 cmdiocb->context_un.rsp_iocb = rspiocb; 563 cmdiocb->context_un.rsp_iocb = rspiocb;
555 564
@@ -674,6 +683,7 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
674 lpfc_disc_start(vport); 683 lpfc_disc_start(vport);
675 } 684 }
676out: 685out:
686 cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */
677 lpfc_ct_free_iocb(phba, cmdiocb); 687 lpfc_ct_free_iocb(phba, cmdiocb);
678 return; 688 return;
679} 689}
@@ -776,10 +786,14 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
776 struct lpfc_dmabuf *outp; 786 struct lpfc_dmabuf *outp;
777 IOCB_t *irsp; 787 IOCB_t *irsp;
778 struct lpfc_sli_ct_request *CTrsp; 788 struct lpfc_sli_ct_request *CTrsp;
789 struct lpfc_nodelist *ndlp;
779 int cmdcode, rc; 790 int cmdcode, rc;
780 uint8_t retry; 791 uint8_t retry;
781 uint32_t latt; 792 uint32_t latt;
782 793
794 /* First save ndlp, before we overwrite it */
795 ndlp = cmdiocb->context_un.ndlp;
796
783 /* we pass cmdiocb to state machine which needs rspiocb as well */ 797 /* we pass cmdiocb to state machine which needs rspiocb as well */
784 cmdiocb->context_un.rsp_iocb = rspiocb; 798 cmdiocb->context_un.rsp_iocb = rspiocb;
785 799
@@ -828,6 +842,7 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
828 } 842 }
829 843
830out: 844out:
845 cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */
831 lpfc_ct_free_iocb(phba, cmdiocb); 846 lpfc_ct_free_iocb(phba, cmdiocb);
832 return; 847 return;
833} 848}
@@ -1066,6 +1081,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1066 cmpl = lpfc_cmpl_ct_cmd_rff_id; 1081 cmpl = lpfc_cmpl_ct_cmd_rff_id;
1067 break; 1082 break;
1068 } 1083 }
1084 lpfc_nlp_get(ndlp);
1069 1085
1070 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { 1086 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) {
1071 /* On success, The cmpl function will free the buffers */ 1087 /* On success, The cmpl function will free the buffers */
@@ -1076,6 +1092,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1076 } 1092 }
1077 1093
1078 rc=6; 1094 rc=6;
1095 lpfc_nlp_put(ndlp);
1079 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); 1096 lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
1080ns_cmd_free_bmp: 1097ns_cmd_free_bmp:
1081 kfree(bmp); 1098 kfree(bmp);
@@ -1501,10 +1518,12 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1501 bpl->tus.w = le32_to_cpu(bpl->tus.w); 1518 bpl->tus.w = le32_to_cpu(bpl->tus.w);
1502 1519
1503 cmpl = lpfc_cmpl_ct_cmd_fdmi; 1520 cmpl = lpfc_cmpl_ct_cmd_fdmi;
1521 lpfc_nlp_get(ndlp);
1504 1522
1505 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0)) 1523 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0))
1506 return 0; 1524 return 0;
1507 1525
1526 lpfc_nlp_put(ndlp);
1508 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); 1527 lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
1509fdmi_cmd_free_bmp: 1528fdmi_cmd_free_bmp:
1510 kfree(bmp); 1529 kfree(bmp);