tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 88bb507a74ea7d75fa49edd421eaa710a7d80598 commit: da255e2e7cc889e10820bc89752466322426571f scsi: lpfc: Convert SCSI path to use common I/O submission path date: 3 months ago config: i386-randconfig-s031-20210202 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-215-g0fb77bb6-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=da255e2e7cc889e10820bc89752466322426571f git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout da255e2e7cc889e10820bc89752466322426571f # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <l...@intel.com> "sparse warnings: (new ones prefixed by >>)" drivers/scsi/lpfc/lpfc_scsi.c:129:30: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:131:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:131:28: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:131:28: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:397:35: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:398:34: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:401:32: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:404:35: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:405:34: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:408:32: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:693:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_hi @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:693:22: sparse: expected unsigned int [usertype] addr_hi drivers/scsi/lpfc/lpfc_scsi.c:693:22: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:694:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_lo @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:694:22: sparse: expected unsigned int [usertype] addr_lo drivers/scsi/lpfc/lpfc_scsi.c:694:22: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:695:22: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:697:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:697:20: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:697:20: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:698:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] sge_len @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:698:22: sparse: expected unsigned int [usertype] sge_len drivers/scsi/lpfc/lpfc_scsi.c:698:22: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:703:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_hi @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:703:22: sparse: expected unsigned int [usertype] addr_hi drivers/scsi/lpfc/lpfc_scsi.c:703:22: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:704:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_lo @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:704:22: sparse: expected unsigned int [usertype] addr_lo drivers/scsi/lpfc/lpfc_scsi.c:704:22: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:705:22: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:707:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:707:20: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:707:20: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:708:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] sge_len @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:708:22: sparse: expected unsigned int [usertype] sge_len drivers/scsi/lpfc/lpfc_scsi.c:708:22: sparse: got restricted __le32 [usertype] >> drivers/scsi/lpfc/lpfc_scsi.c:823:39: sparse: sparse: incorrect type in >> assignment (different base types) @@ expected unsigned int [usertype] @@ >> got restricted __be32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:823:39: sparse: expected unsigned int [usertype] drivers/scsi/lpfc/lpfc_scsi.c:823:39: sparse: got restricted __be32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:911:46: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:913:41: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:915:41: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:956:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] fcpDl @@ got restricted __be32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:956:25: sparse: expected unsigned int [usertype] fcpDl drivers/scsi/lpfc/lpfc_scsi.c:956:25: sparse: got restricted __be32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1088:69: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] prot_data @@ got restricted __be32 [usertype] ref_tag @@ drivers/scsi/lpfc/lpfc_scsi.c:1088:69: sparse: expected unsigned int [usertype] prot_data drivers/scsi/lpfc/lpfc_scsi.c:1088:69: sparse: got restricted __be32 [usertype] ref_tag drivers/scsi/lpfc/lpfc_scsi.c:1209:69: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] prot_data @@ got restricted __be16 [usertype] app_tag @@ drivers/scsi/lpfc/lpfc_scsi.c:1209:69: sparse: expected unsigned int [usertype] prot_data drivers/scsi/lpfc/lpfc_scsi.c:1209:69: sparse: got restricted __be16 [usertype] app_tag drivers/scsi/lpfc/lpfc_scsi.c:1610:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word0 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1610:21: sparse: expected unsigned int [usertype] word0 drivers/scsi/lpfc/lpfc_scsi.c:1610:21: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1611:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] reftag @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1611:22: sparse: expected unsigned int [usertype] reftag drivers/scsi/lpfc/lpfc_scsi.c:1611:22: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1644:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word0 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1644:21: sparse: expected unsigned int [usertype] word0 drivers/scsi/lpfc/lpfc_scsi.c:1644:21: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1645:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word1 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1645:21: sparse: expected unsigned int [usertype] word1 drivers/scsi/lpfc/lpfc_scsi.c:1645:21: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1646:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1646:21: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:1646:21: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1655:32: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:1656:33: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:1662:30: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:1777:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word0 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1777:29: sparse: expected unsigned int [usertype] word0 drivers/scsi/lpfc/lpfc_scsi.c:1777:29: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1778:30: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] reftag @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1778:30: sparse: expected unsigned int [usertype] reftag drivers/scsi/lpfc/lpfc_scsi.c:1778:30: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1806:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word0 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1806:29: sparse: expected unsigned int [usertype] word0 drivers/scsi/lpfc/lpfc_scsi.c:1806:29: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1807:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word1 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1807:29: sparse: expected unsigned int [usertype] word1 drivers/scsi/lpfc/lpfc_scsi.c:1807:29: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1808:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:1808:29: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:1808:29: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:1825:34: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:1826:33: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:1860:40: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:1861:41: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:1884:38: sparse: sparse: cast to restricted __le32 drivers/scsi/lpfc/lpfc_scsi.c:2000:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ref_tag @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2000:25: sparse: expected unsigned int [usertype] ref_tag drivers/scsi/lpfc/lpfc_scsi.c:2000:25: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2027:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2027:23: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:2027:23: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2028:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word3 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2028:23: sparse: expected unsigned int [usertype] word3 drivers/scsi/lpfc/lpfc_scsi.c:2028:23: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2053:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_lo @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2053:38: sparse: expected unsigned int [usertype] addr_lo drivers/scsi/lpfc/lpfc_scsi.c:2053:38: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2055:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_hi @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2055:38: sparse: expected unsigned int [usertype] addr_hi drivers/scsi/lpfc/lpfc_scsi.c:2055:38: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2067:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_lo @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2067:38: sparse: expected unsigned int [usertype] addr_lo drivers/scsi/lpfc/lpfc_scsi.c:2067:38: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2068:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_hi @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2068:38: sparse: expected unsigned int [usertype] addr_hi drivers/scsi/lpfc/lpfc_scsi.c:2068:38: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2071:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2071:36: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:2071:36: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2072:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] sge_len @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2072:38: sparse: expected unsigned int [usertype] sge_len drivers/scsi/lpfc/lpfc_scsi.c:2072:38: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2082:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2082:36: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:2082:36: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2083:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] sge_len @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2083:38: sparse: expected unsigned int [usertype] sge_len drivers/scsi/lpfc/lpfc_scsi.c:2083:38: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2214:46: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_lo @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2214:46: sparse: expected unsigned int [usertype] addr_lo drivers/scsi/lpfc/lpfc_scsi.c:2214:46: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2216:46: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] addr_hi @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2216:46: sparse: expected unsigned int [usertype] addr_hi drivers/scsi/lpfc/lpfc_scsi.c:2216:46: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2220:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] word2 @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2220:36: sparse: expected unsigned int [usertype] word2 drivers/scsi/lpfc/lpfc_scsi.c:2220:36: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2221:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] sge_len @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2221:38: sparse: expected unsigned int [usertype] sge_len drivers/scsi/lpfc/lpfc_scsi.c:2221:38: sparse: got restricted __le32 [usertype] drivers/scsi/lpfc/lpfc_scsi.c:2233:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ref_tag @@ got restricted __le32 [usertype] @@ drivers/scsi/lpfc/lpfc_scsi.c:2233:33: sparse: expected unsigned int [usertype] ref_tag drivers/scsi/lpfc/lpfc_scsi.c:2233:33: sparse: got restricted __le32 [usertype] vim +823 drivers/scsi/lpfc/lpfc_scsi.c 579 580 /** 581 * lpfc_get_scsi_buf_s3 - Get a scsi buffer from lpfc_scsi_buf_list of the HBA 582 * @phba: The HBA for which this call is being executed. 583 * @ndlp: pointer to a node-list data structure. 584 * @cmnd: Pointer to scsi_cmnd data structure. 585 * 586 * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list 587 * and returns to caller. 588 * 589 * Return codes: 590 * NULL - Error 591 * Pointer to lpfc_scsi_buf - Success 592 **/ 593 static struct lpfc_io_buf * 594 lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, 595 struct scsi_cmnd *cmnd) 596 { 597 struct lpfc_io_buf *lpfc_cmd = NULL; 598 struct list_head *scsi_buf_list_get = &phba->lpfc_scsi_buf_list_get; 599 unsigned long iflag = 0; 600 601 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag); 602 list_remove_head(scsi_buf_list_get, lpfc_cmd, struct lpfc_io_buf, 603 list); 604 if (!lpfc_cmd) { 605 spin_lock(&phba->scsi_buf_list_put_lock); 606 list_splice(&phba->lpfc_scsi_buf_list_put, 607 &phba->lpfc_scsi_buf_list_get); 608 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); 609 list_remove_head(scsi_buf_list_get, lpfc_cmd, 610 struct lpfc_io_buf, list); 611 spin_unlock(&phba->scsi_buf_list_put_lock); 612 } 613 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag); 614 615 if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) { 616 atomic_inc(&ndlp->cmd_pending); 617 lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH; 618 } 619 return lpfc_cmd; 620 } 621 /** 622 * lpfc_get_scsi_buf_s4 - Get a scsi buffer from io_buf_list of the HBA 623 * @phba: The HBA for which this call is being executed. 624 * @ndlp: pointer to a node-list data structure. 625 * @cmnd: Pointer to scsi_cmnd data structure. 626 * 627 * This routine removes a scsi buffer from head of @hdwq io_buf_list 628 * and returns to caller. 629 * 630 * Return codes: 631 * NULL - Error 632 * Pointer to lpfc_scsi_buf - Success 633 **/ 634 static struct lpfc_io_buf * 635 lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, 636 struct scsi_cmnd *cmnd) 637 { 638 struct lpfc_io_buf *lpfc_cmd; 639 struct lpfc_sli4_hdw_queue *qp; 640 struct sli4_sge *sgl; 641 dma_addr_t pdma_phys_fcp_rsp; 642 dma_addr_t pdma_phys_fcp_cmd; 643 uint32_t cpu, idx; 644 int tag; 645 struct fcp_cmd_rsp_buf *tmp = NULL; 646 647 cpu = raw_smp_processor_id(); 648 if (cmnd && phba->cfg_fcp_io_sched == LPFC_FCP_SCHED_BY_HDWQ) { 649 tag = blk_mq_unique_tag(cmnd->request); 650 idx = blk_mq_unique_tag_to_hwq(tag); 651 } else { 652 idx = phba->sli4_hba.cpu_map[cpu].hdwq; 653 } 654 655 lpfc_cmd = lpfc_get_io_buf(phba, ndlp, idx, 656 !phba->cfg_xri_rebalancing); 657 if (!lpfc_cmd) { 658 qp = &phba->sli4_hba.hdwq[idx]; 659 qp->empty_io_bufs++; 660 return NULL; 661 } 662 663 /* Setup key fields in buffer that may have been changed 664 * if other protocols used this buffer. 665 */ 666 lpfc_cmd->cur_iocbq.iocb_flag = LPFC_IO_FCP; 667 lpfc_cmd->prot_seg_cnt = 0; 668 lpfc_cmd->seg_cnt = 0; 669 lpfc_cmd->timeout = 0; 670 lpfc_cmd->flags = 0; 671 lpfc_cmd->start_time = jiffies; 672 lpfc_cmd->waitq = NULL; 673 lpfc_cmd->cpu = cpu; 674 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS 675 lpfc_cmd->prot_data_type = 0; 676 #endif 677 tmp = lpfc_get_cmd_rsp_buf_per_hdwq(phba, lpfc_cmd); 678 if (!tmp) { 679 lpfc_release_io_buf(phba, lpfc_cmd, lpfc_cmd->hdwq); 680 return NULL; 681 } 682 683 lpfc_cmd->fcp_cmnd = tmp->fcp_cmnd; 684 lpfc_cmd->fcp_rsp = tmp->fcp_rsp; 685 686 /* 687 * The first two SGEs are the FCP_CMD and FCP_RSP. 688 * The balance are sg list bdes. Initialize the 689 * first two and leave the rest for queuecommand. 690 */ 691 sgl = (struct sli4_sge *)lpfc_cmd->dma_sgl; 692 pdma_phys_fcp_cmd = tmp->fcp_cmd_rsp_dma_handle; 693 sgl->addr_hi = cpu_to_le32(putPaddrHigh(pdma_phys_fcp_cmd)); 694 sgl->addr_lo = cpu_to_le32(putPaddrLow(pdma_phys_fcp_cmd)); 695 sgl->word2 = le32_to_cpu(sgl->word2); 696 bf_set(lpfc_sli4_sge_last, sgl, 0); 697 sgl->word2 = cpu_to_le32(sgl->word2); 698 sgl->sge_len = cpu_to_le32(sizeof(struct fcp_cmnd)); 699 sgl++; 700 701 /* Setup the physical region for the FCP RSP */ 702 pdma_phys_fcp_rsp = pdma_phys_fcp_cmd + sizeof(struct fcp_cmnd); 703 sgl->addr_hi = cpu_to_le32(putPaddrHigh(pdma_phys_fcp_rsp)); > 704 sgl->addr_lo = cpu_to_le32(putPaddrLow(pdma_phys_fcp_rsp)); 705 sgl->word2 = le32_to_cpu(sgl->word2); 706 bf_set(lpfc_sli4_sge_last, sgl, 1); 707 sgl->word2 = cpu_to_le32(sgl->word2); 708 sgl->sge_len = cpu_to_le32(sizeof(struct fcp_rsp)); 709 710 if (lpfc_ndlp_check_qdepth(phba, ndlp)) { 711 atomic_inc(&ndlp->cmd_pending); 712 lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH; 713 } 714 return lpfc_cmd; 715 } 716 /** 717 * lpfc_get_scsi_buf - Get a scsi buffer from lpfc_scsi_buf_list of the HBA 718 * @phba: The HBA for which this call is being executed. 719 * @ndlp: pointer to a node-list data structure. 720 * @cmnd: Pointer to scsi_cmnd data structure. 721 * 722 * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list 723 * and returns to caller. 724 * 725 * Return codes: 726 * NULL - Error 727 * Pointer to lpfc_scsi_buf - Success 728 **/ 729 static struct lpfc_io_buf* 730 lpfc_get_scsi_buf(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, 731 struct scsi_cmnd *cmnd) 732 { 733 return phba->lpfc_get_scsi_buf(phba, ndlp, cmnd); 734 } 735 736 /** 737 * lpfc_release_scsi_buf - Return a scsi buffer back to hba scsi buf list 738 * @phba: The Hba for which this call is being executed. 739 * @psb: The scsi buffer which is being released. 740 * 741 * This routine releases @psb scsi buffer by adding it to tail of @phba 742 * lpfc_scsi_buf_list list. 743 **/ 744 static void 745 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_io_buf *psb) 746 { 747 unsigned long iflag = 0; 748 749 psb->seg_cnt = 0; 750 psb->prot_seg_cnt = 0; 751 752 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); 753 psb->pCmd = NULL; 754 psb->cur_iocbq.iocb_flag = LPFC_IO_FCP; 755 list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list_put); 756 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); 757 } 758 759 /** 760 * lpfc_release_scsi_buf_s4: Return a scsi buffer back to hba scsi buf list. 761 * @phba: The Hba for which this call is being executed. 762 * @psb: The scsi buffer which is being released. 763 * 764 * This routine releases @psb scsi buffer by adding it to tail of @hdwq 765 * io_buf_list list. For SLI4 XRI's are tied to the scsi buffer 766 * and cannot be reused for at least RA_TOV amount of time if it was 767 * aborted. 768 **/ 769 static void 770 lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *psb) 771 { 772 struct lpfc_sli4_hdw_queue *qp; 773 unsigned long iflag = 0; 774 775 psb->seg_cnt = 0; 776 psb->prot_seg_cnt = 0; 777 778 qp = psb->hdwq; 779 if (psb->flags & LPFC_SBUF_XBUSY) { 780 spin_lock_irqsave(&qp->abts_io_buf_list_lock, iflag); 781 psb->pCmd = NULL; 782 list_add_tail(&psb->list, &qp->lpfc_abts_io_buf_list); 783 qp->abts_scsi_io_bufs++; 784 spin_unlock_irqrestore(&qp->abts_io_buf_list_lock, iflag); 785 } else { 786 lpfc_release_io_buf(phba, (struct lpfc_io_buf *)psb, qp); 787 } 788 } 789 790 /** 791 * lpfc_release_scsi_buf: Return a scsi buffer back to hba scsi buf list. 792 * @phba: The Hba for which this call is being executed. 793 * @psb: The scsi buffer which is being released. 794 * 795 * This routine releases @psb scsi buffer by adding it to tail of @phba 796 * lpfc_scsi_buf_list list. 797 **/ 798 static void 799 lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_io_buf *psb) 800 { 801 if ((psb->flags & LPFC_SBUF_BUMP_QDEPTH) && psb->ndlp) 802 atomic_dec(&psb->ndlp->cmd_pending); 803 804 psb->flags &= ~LPFC_SBUF_BUMP_QDEPTH; 805 phba->lpfc_release_scsi_buf(phba, psb); 806 } 807 808 /** 809 * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB 810 * @data: A pointer to the immediate command data portion of the IOCB. 811 * @fcp_cmnd: The FCP Command that is provided by the SCSI layer. 812 * 813 * The routine copies the entire FCP command from @fcp_cmnd to @data while 814 * byte swapping the data to big endian format for transmission on the wire. 815 **/ 816 static void 817 lpfc_fcpcmd_to_iocb(u8 *data, struct fcp_cmnd *fcp_cmnd) 818 { 819 int i, j; 820 821 for (i = 0, j = 0; i < sizeof(struct fcp_cmnd); 822 i += sizeof(uint32_t), j++) { > 823 ((uint32_t *)data)[j] = cpu_to_be32(((uint32_t > *)fcp_cmnd)[j]); 824 } 825 } 826 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
.config.gz
Description: application/gzip