diff options
| -rw-r--r-- | drivers/scsi/qla2xxx/qla_inline.h | 26 | ||||
| -rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 30 | ||||
| -rw-r--r-- | drivers/scsi/qla2xxx/qla_target.c | 8 |
3 files changed, 31 insertions, 33 deletions
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 66df6cec59da..c61a6a871c8e 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h | |||
| @@ -129,28 +129,16 @@ qla2x00_clear_loop_id(fc_port_t *fcport) { | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | static inline void | 131 | static inline void |
| 132 | qla2x00_clean_dsd_pool(struct qla_hw_data *ha, srb_t *sp, | 132 | qla2x00_clean_dsd_pool(struct qla_hw_data *ha, struct crc_context *ctx) |
| 133 | struct qla_tgt_cmd *tc) | ||
| 134 | { | 133 | { |
| 135 | struct dsd_dma *dsd_ptr, *tdsd_ptr; | 134 | struct dsd_dma *dsd, *tdsd; |
| 136 | struct crc_context *ctx; | ||
| 137 | |||
| 138 | if (sp) | ||
| 139 | ctx = (struct crc_context *)GET_CMD_CTX_SP(sp); | ||
| 140 | else if (tc) | ||
| 141 | ctx = (struct crc_context *)tc->ctx; | ||
| 142 | else { | ||
| 143 | BUG(); | ||
| 144 | return; | ||
| 145 | } | ||
| 146 | 135 | ||
| 147 | /* clean up allocated prev pool */ | 136 | /* clean up allocated prev pool */ |
| 148 | list_for_each_entry_safe(dsd_ptr, tdsd_ptr, | 137 | list_for_each_entry_safe(dsd, tdsd, &ctx->dsd_list, list) { |
| 149 | &ctx->dsd_list, list) { | 138 | dma_pool_free(ha->dl_dma_pool, dsd->dsd_addr, |
| 150 | dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr, | 139 | dsd->dsd_list_dma); |
| 151 | dsd_ptr->dsd_list_dma); | 140 | list_del(&dsd->list); |
| 152 | list_del(&dsd_ptr->list); | 141 | kfree(dsd); |
| 153 | kfree(dsd_ptr); | ||
| 154 | } | 142 | } |
| 155 | INIT_LIST_HEAD(&ctx->dsd_list); | 143 | INIT_LIST_HEAD(&ctx->dsd_list); |
| 156 | } | 144 | } |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index af25d8afd42a..2a2ce7476339 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -630,29 +630,34 @@ qla2x00_sp_free_dma(void *ptr) | |||
| 630 | sp->flags &= ~SRB_CRC_PROT_DMA_VALID; | 630 | sp->flags &= ~SRB_CRC_PROT_DMA_VALID; |
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | if (!ctx) | ||
| 634 | goto end; | ||
| 635 | |||
| 633 | if (sp->flags & SRB_CRC_CTX_DSD_VALID) { | 636 | if (sp->flags & SRB_CRC_CTX_DSD_VALID) { |
| 634 | /* List assured to be having elements */ | 637 | /* List assured to be having elements */ |
| 635 | qla2x00_clean_dsd_pool(ha, sp, NULL); | 638 | qla2x00_clean_dsd_pool(ha, ctx); |
| 636 | sp->flags &= ~SRB_CRC_CTX_DSD_VALID; | 639 | sp->flags &= ~SRB_CRC_CTX_DSD_VALID; |
| 637 | } | 640 | } |
| 638 | 641 | ||
| 639 | if (sp->flags & SRB_CRC_CTX_DMA_VALID) { | 642 | if (sp->flags & SRB_CRC_CTX_DMA_VALID) { |
| 640 | dma_pool_free(ha->dl_dma_pool, ctx, | 643 | struct crc_context *ctx0 = ctx; |
| 641 | ((struct crc_context *)ctx)->crc_ctx_dma); | 644 | |
| 645 | dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); | ||
| 642 | sp->flags &= ~SRB_CRC_CTX_DMA_VALID; | 646 | sp->flags &= ~SRB_CRC_CTX_DMA_VALID; |
| 643 | } | 647 | } |
| 644 | 648 | ||
| 645 | if (sp->flags & SRB_FCP_CMND_DMA_VALID) { | 649 | if (sp->flags & SRB_FCP_CMND_DMA_VALID) { |
| 646 | struct ct6_dsd *ctx1 = (struct ct6_dsd *)ctx; | 650 | struct ct6_dsd *ctx1 = ctx; |
| 647 | 651 | ||
| 648 | dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, | 652 | dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, |
| 649 | ctx1->fcp_cmnd_dma); | 653 | ctx1->fcp_cmnd_dma); |
| 650 | list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); | 654 | list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); |
| 651 | ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; | 655 | ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; |
| 652 | ha->gbl_dsd_avail += ctx1->dsd_use_cnt; | 656 | ha->gbl_dsd_avail += ctx1->dsd_use_cnt; |
| 653 | mempool_free(ctx1, ha->ctx_mempool); | 657 | mempool_free(ctx1, ha->ctx_mempool); |
| 654 | } | 658 | } |
| 655 | 659 | ||
| 660 | end: | ||
| 656 | CMD_SP(cmd) = NULL; | 661 | CMD_SP(cmd) = NULL; |
| 657 | qla2x00_rel_sp(sp); | 662 | qla2x00_rel_sp(sp); |
| 658 | } | 663 | } |
| @@ -699,21 +704,24 @@ qla2xxx_qpair_sp_free_dma(void *ptr) | |||
| 699 | sp->flags &= ~SRB_CRC_PROT_DMA_VALID; | 704 | sp->flags &= ~SRB_CRC_PROT_DMA_VALID; |
| 700 | } | 705 | } |
| 701 | 706 | ||
| 707 | if (!ctx) | ||
| 708 | goto end; | ||
| 709 | |||
| 702 | if (sp->flags & SRB_CRC_CTX_DSD_VALID) { | 710 | if (sp->flags & SRB_CRC_CTX_DSD_VALID) { |
| 703 | /* List assured to be having elements */ | 711 | /* List assured to be having elements */ |
| 704 | qla2x00_clean_dsd_pool(ha, sp, NULL); | 712 | qla2x00_clean_dsd_pool(ha, ctx); |
| 705 | sp->flags &= ~SRB_CRC_CTX_DSD_VALID; | 713 | sp->flags &= ~SRB_CRC_CTX_DSD_VALID; |
| 706 | } | 714 | } |
| 707 | 715 | ||
| 708 | if (sp->flags & SRB_CRC_CTX_DMA_VALID) { | 716 | if (sp->flags & SRB_CRC_CTX_DMA_VALID) { |
| 709 | dma_pool_free(ha->dl_dma_pool, ctx, | 717 | struct crc_context *ctx0 = ctx; |
| 710 | ((struct crc_context *)ctx)->crc_ctx_dma); | 718 | |
| 719 | dma_pool_free(ha->dl_dma_pool, ctx, ctx0->crc_ctx_dma); | ||
| 711 | sp->flags &= ~SRB_CRC_CTX_DMA_VALID; | 720 | sp->flags &= ~SRB_CRC_CTX_DMA_VALID; |
| 712 | } | 721 | } |
| 713 | 722 | ||
| 714 | if (sp->flags & SRB_FCP_CMND_DMA_VALID) { | 723 | if (sp->flags & SRB_FCP_CMND_DMA_VALID) { |
| 715 | struct ct6_dsd *ctx1 = (struct ct6_dsd *)ctx; | 724 | struct ct6_dsd *ctx1 = ctx; |
| 716 | |||
| 717 | dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, | 725 | dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, |
| 718 | ctx1->fcp_cmnd_dma); | 726 | ctx1->fcp_cmnd_dma); |
| 719 | list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); | 727 | list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); |
| @@ -721,7 +729,7 @@ qla2xxx_qpair_sp_free_dma(void *ptr) | |||
| 721 | ha->gbl_dsd_avail += ctx1->dsd_use_cnt; | 729 | ha->gbl_dsd_avail += ctx1->dsd_use_cnt; |
| 722 | mempool_free(ctx1, ha->ctx_mempool); | 730 | mempool_free(ctx1, ha->ctx_mempool); |
| 723 | } | 731 | } |
| 724 | 732 | end: | |
| 725 | CMD_SP(cmd) = NULL; | 733 | CMD_SP(cmd) = NULL; |
| 726 | qla2xxx_rel_qpair_sp(sp->qpair, sp); | 734 | qla2xxx_rel_qpair_sp(sp->qpair, sp); |
| 727 | } | 735 | } |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 0e03ca2ab3e5..e766d8412384 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
| @@ -2245,11 +2245,13 @@ static void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd) | |||
| 2245 | pci_unmap_sg(ha->pdev, cmd->prot_sg, cmd->prot_sg_cnt, | 2245 | pci_unmap_sg(ha->pdev, cmd->prot_sg, cmd->prot_sg_cnt, |
| 2246 | cmd->dma_data_direction); | 2246 | cmd->dma_data_direction); |
| 2247 | 2247 | ||
| 2248 | if (!cmd->ctx) | ||
| 2249 | return; | ||
| 2250 | |||
| 2248 | if (cmd->ctx_dsd_alloced) | 2251 | if (cmd->ctx_dsd_alloced) |
| 2249 | qla2x00_clean_dsd_pool(ha, NULL, cmd); | 2252 | qla2x00_clean_dsd_pool(ha, cmd->ctx); |
| 2250 | 2253 | ||
| 2251 | if (cmd->ctx) | 2254 | dma_pool_free(ha->dl_dma_pool, cmd->ctx, cmd->ctx->crc_ctx_dma); |
| 2252 | dma_pool_free(ha->dl_dma_pool, cmd->ctx, cmd->ctx->crc_ctx_dma); | ||
| 2253 | } | 2255 | } |
| 2254 | 2256 | ||
| 2255 | static int qlt_check_reserve_free_req(struct scsi_qla_host *vha, | 2257 | static int qlt_check_reserve_free_req(struct scsi_qla_host *vha, |
