Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes and updates from James Bottomley:
"Fully half this pull is updates to lpfc and qla2xxx which got
committed just as the merge window opened. A sizeable fraction of the
driver updates are simple bug fixes (and lock reworks for bug fixes in
the case of lpfc), so rather than splitting the few actual
enhancements out, we're just adding the drivers to the -rc1 pull.

The enhancements for lpfc are log message removals, copyright updates
and three patches redefining types. For qla2xxx it's just removing a
debug message on module removal and the manufacturer detail update.

The two major fixes are the sg teardown race and a core error leg
problem with the procfs directory not being removed if we destroy a
created host that never got to the running state. The rest are minor
fixes and constifications"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (41 commits)
scsi: bnx2fc: Remove spin_lock_bh while releasing resources after upload
scsi: core: Fix unremoved procfs host directory regression
scsi: mpi3mr: Avoid memcpy field-spanning write WARNING
scsi: sd: Fix TCG OPAL unlock on system resume
scsi: sg: Avoid sg device teardown race
scsi: lpfc: Copyright updates for 14.4.0.1 patches
scsi: lpfc: Update lpfc version to 14.4.0.1
scsi: lpfc: Define types in a union for generic void *context3 ptr
scsi: lpfc: Define lpfc_dmabuf type for ctx_buf ptr
scsi: lpfc: Define lpfc_nodelist type for ctx_ndlp ptr
scsi: lpfc: Use a dedicated lock for ras_fwlog state
scsi: lpfc: Release hbalock before calling lpfc_worker_wake_up()
scsi: lpfc: Replace hbalock with ndlp lock in lpfc_nvme_unregister_port()
scsi: lpfc: Update lpfc_ramp_down_queue_handler() logic
scsi: lpfc: Remove IRQF_ONESHOT flag from threaded IRQ handling
scsi: lpfc: Move NPIV's transport unregistration to after resource clean up
scsi: lpfc: Remove unnecessary log message in queuecommand path
scsi: qla2xxx: Update version to 10.02.09.200-k
scsi: qla2xxx: Delay I/O Abort on PCI error
scsi: qla2xxx: Change debug message during driver unload
...

+479 -355
+4 -1
drivers/ata/libata-eh.c
··· 712 712 ehc->saved_ncq_enabled |= 1 << devno; 713 713 714 714 /* If we are resuming, wake up the device */ 715 - if (ap->pflags & ATA_PFLAG_RESUMING) 715 + if (ap->pflags & ATA_PFLAG_RESUMING) { 716 + dev->flags |= ATA_DFLAG_RESUMING; 716 717 ehc->i.dev_action[devno] |= ATA_EH_SET_ACTIVE; 718 + } 717 719 } 718 720 } 719 721 ··· 3171 3169 return 0; 3172 3170 3173 3171 err: 3172 + dev->flags &= ~ATA_DFLAG_RESUMING; 3174 3173 *r_failed_dev = dev; 3175 3174 return rc; 3176 3175 }
+9
drivers/ata/libata-scsi.c
··· 4730 4730 struct ata_link *link; 4731 4731 struct ata_device *dev; 4732 4732 unsigned long flags; 4733 + bool do_resume; 4733 4734 int ret = 0; 4734 4735 4735 4736 mutex_lock(&ap->scsi_scan_mutex); ··· 4752 4751 if (scsi_device_get(sdev)) 4753 4752 continue; 4754 4753 4754 + do_resume = dev->flags & ATA_DFLAG_RESUMING; 4755 + 4755 4756 spin_unlock_irqrestore(ap->lock, flags); 4757 + if (do_resume) { 4758 + ret = scsi_resume_device(sdev); 4759 + if (ret == -EWOULDBLOCK) 4760 + goto unlock; 4761 + dev->flags &= ~ATA_DFLAG_RESUMING; 4762 + } 4756 4763 ret = scsi_rescan_device(sdev); 4757 4764 scsi_device_put(sdev); 4758 4765 spin_lock_irqsave(ap->lock, flags);
-2
drivers/scsi/bnx2fc/bnx2fc_tgt.c
··· 833 833 834 834 BNX2FC_TGT_DBG(tgt, "Freeing up session resources\n"); 835 835 836 - spin_lock_bh(&tgt->cq_lock); 837 836 ctx_base_ptr = tgt->ctx_base; 838 837 tgt->ctx_base = NULL; 839 838 ··· 888 889 tgt->sq, tgt->sq_dma); 889 890 tgt->sq = NULL; 890 891 } 891 - spin_unlock_bh(&tgt->cq_lock); 892 892 893 893 if (ctx_base_ptr) 894 894 iounmap(ctx_base_ptr);
+10 -10
drivers/scsi/ch.c
··· 102 102 103 103 #define MAX_RETRIES 1 104 104 105 - static struct class * ch_sysfs_class; 105 + static const struct class ch_sysfs_class = { 106 + .name = "scsi_changer", 107 + }; 106 108 107 109 typedef struct { 108 110 struct kref ref; ··· 932 930 mutex_init(&ch->lock); 933 931 kref_init(&ch->ref); 934 932 ch->device = sd; 935 - class_dev = device_create(ch_sysfs_class, dev, 933 + class_dev = device_create(&ch_sysfs_class, dev, 936 934 MKDEV(SCSI_CHANGER_MAJOR, ch->minor), ch, 937 935 "s%s", ch->name); 938 936 if (IS_ERR(class_dev)) { ··· 957 955 958 956 return 0; 959 957 destroy_dev: 960 - device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor)); 958 + device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor)); 961 959 put_device: 962 960 scsi_device_put(sd); 963 961 remove_idr: ··· 976 974 dev_set_drvdata(dev, NULL); 977 975 spin_unlock(&ch_index_lock); 978 976 979 - device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR,ch->minor)); 977 + device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor)); 980 978 scsi_device_put(ch->device); 981 979 kref_put(&ch->ref, ch_destroy); 982 980 return 0; ··· 1005 1003 int rc; 1006 1004 1007 1005 printk(KERN_INFO "SCSI Media Changer driver v" VERSION " \n"); 1008 - ch_sysfs_class = class_create("scsi_changer"); 1009 - if (IS_ERR(ch_sysfs_class)) { 1010 - rc = PTR_ERR(ch_sysfs_class); 1006 + rc = class_register(&ch_sysfs_class); 1007 + if (rc) 1011 1008 return rc; 1012 - } 1013 1009 rc = register_chrdev(SCSI_CHANGER_MAJOR,"ch",&changer_fops); 1014 1010 if (rc < 0) { 1015 1011 printk("Unable to get major %d for SCSI-Changer\n", ··· 1022 1022 fail2: 1023 1023 unregister_chrdev(SCSI_CHANGER_MAJOR, "ch"); 1024 1024 fail1: 1025 - class_destroy(ch_sysfs_class); 1025 + class_unregister(&ch_sysfs_class); 1026 1026 return rc; 1027 1027 } 1028 1028 ··· 1030 1030 { 1031 1031 scsi_unregister_driver(&ch_template.gendrv); 1032 1032 unregister_chrdev(SCSI_CHANGER_MAJOR, "ch"); 1033 - class_destroy(ch_sysfs_class); 1033 + class_unregister(&ch_sysfs_class); 1034 1034 idr_destroy(&ch_index_idr); 1035 1035 } 1036 1036
+10 -7
drivers/scsi/cxlflash/main.c
··· 28 28 MODULE_AUTHOR("Matthew R. Ochs <mrochs@linux.vnet.ibm.com>"); 29 29 MODULE_LICENSE("GPL"); 30 30 31 - static struct class *cxlflash_class; 31 + static char *cxlflash_devnode(const struct device *dev, umode_t *mode); 32 + static const struct class cxlflash_class = { 33 + .name = "cxlflash", 34 + .devnode = cxlflash_devnode, 35 + }; 36 + 32 37 static u32 cxlflash_major; 33 38 static DECLARE_BITMAP(cxlflash_minor, CXLFLASH_MAX_ADAPTERS); 34 39 ··· 3607 3602 goto err1; 3608 3603 } 3609 3604 3610 - char_dev = device_create(cxlflash_class, NULL, devno, 3605 + char_dev = device_create(&cxlflash_class, NULL, devno, 3611 3606 NULL, "cxlflash%d", minor); 3612 3607 if (IS_ERR(char_dev)) { 3613 3608 rc = PTR_ERR(char_dev); ··· 3885 3880 3886 3881 cxlflash_major = MAJOR(devno); 3887 3882 3888 - cxlflash_class = class_create("cxlflash"); 3889 - if (IS_ERR(cxlflash_class)) { 3890 - rc = PTR_ERR(cxlflash_class); 3883 + rc = class_register(&cxlflash_class); 3884 + if (rc) { 3891 3885 pr_err("%s: class_create failed rc=%d\n", __func__, rc); 3892 3886 goto err; 3893 3887 } 3894 3888 3895 - cxlflash_class->devnode = cxlflash_devnode; 3896 3889 out: 3897 3890 pr_debug("%s: returning rc=%d\n", __func__, rc); 3898 3891 return rc; ··· 3906 3903 { 3907 3904 dev_t devno = MKDEV(cxlflash_major, 0); 3908 3905 3909 - class_destroy(cxlflash_class); 3906 + class_unregister(&cxlflash_class); 3910 3907 unregister_chrdev_region(devno, CXLFLASH_MAX_ADAPTERS); 3911 3908 } 3912 3909
+4 -3
drivers/scsi/hosts.c
··· 353 353 354 354 if (shost->shost_state == SHOST_CREATED) { 355 355 /* 356 - * Free the shost_dev device name here if scsi_host_alloc() 357 - * and scsi_host_put() have been called but neither 356 + * Free the shost_dev device name and remove the proc host dir 357 + * here if scsi_host_{alloc,put}() have been called but neither 358 358 * scsi_host_add() nor scsi_remove_host() has been called. 359 359 * This avoids that the memory allocated for the shost_dev 360 - * name is leaked. 360 + * name as well as the proc dir structure are leaked. 361 361 */ 362 + scsi_proc_hostdir_rm(shost->hostt); 362 363 kfree(dev_name(&shost->shost_dev)); 363 364 } 364 365
+34 -17
drivers/scsi/libsas/sas_expander.c
··· 1621 1621 1622 1622 /* ---------- Domain revalidation ---------- */ 1623 1623 1624 + static void sas_get_sas_addr_and_dev_type(struct smp_disc_resp *disc_resp, 1625 + u8 *sas_addr, 1626 + enum sas_device_type *type) 1627 + { 1628 + memcpy(sas_addr, disc_resp->disc.attached_sas_addr, SAS_ADDR_SIZE); 1629 + *type = to_dev_type(&disc_resp->disc); 1630 + if (*type == SAS_PHY_UNUSED) 1631 + memset(sas_addr, 0, SAS_ADDR_SIZE); 1632 + } 1633 + 1624 1634 static int sas_get_phy_discover(struct domain_device *dev, 1625 1635 int phy_id, struct smp_disc_resp *disc_resp) 1626 1636 { ··· 1684 1674 return -ENOMEM; 1685 1675 1686 1676 res = sas_get_phy_discover(dev, phy_id, disc_resp); 1687 - if (res == 0) { 1688 - memcpy(sas_addr, disc_resp->disc.attached_sas_addr, 1689 - SAS_ADDR_SIZE); 1690 - *type = to_dev_type(&disc_resp->disc); 1691 - if (*type == 0) 1692 - memset(sas_addr, 0, SAS_ADDR_SIZE); 1693 - } 1677 + if (res == 0) 1678 + sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, type); 1694 1679 kfree(disc_resp); 1695 1680 return res; 1696 1681 } ··· 1945 1940 struct expander_device *ex = &dev->ex_dev; 1946 1941 struct ex_phy *phy = &ex->ex_phy[phy_id]; 1947 1942 enum sas_device_type type = SAS_PHY_UNUSED; 1943 + struct smp_disc_resp *disc_resp; 1948 1944 u8 sas_addr[SAS_ADDR_SIZE]; 1949 1945 char msg[80] = ""; 1950 1946 int res; ··· 1957 1951 SAS_ADDR(dev->sas_addr), phy_id, msg); 1958 1952 1959 1953 memset(sas_addr, 0, SAS_ADDR_SIZE); 1960 - res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); 1954 + disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE); 1955 + if (!disc_resp) 1956 + return -ENOMEM; 1957 + 1958 + res = sas_get_phy_discover(dev, phy_id, disc_resp); 1961 1959 switch (res) { 1962 1960 case SMP_RESP_NO_PHY: 1963 1961 phy->phy_state = PHY_NOT_PRESENT; 1964 1962 sas_unregister_devs_sas_addr(dev, phy_id, last); 1965 - return res; 1963 + goto out_free_resp; 1966 1964 case SMP_RESP_PHY_VACANT: 1967 1965 phy->phy_state = PHY_VACANT; 1968 1966 sas_unregister_devs_sas_addr(dev, phy_id, last); 1969 - return res; 1967 + goto out_free_resp; 1970 1968 case SMP_RESP_FUNC_ACC: 1971 1969 break; 1972 1970 case -ECOMM: 1973 1971 break; 1974 1972 default: 1975 - return res; 1973 + goto out_free_resp; 1976 1974 } 1975 + 1976 + if (res == 0) 1977 + sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, &type); 1977 1978 1978 1979 if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { 1979 1980 phy->phy_state = PHY_EMPTY; 1980 1981 sas_unregister_devs_sas_addr(dev, phy_id, last); 1981 1982 /* 1982 - * Even though the PHY is empty, for convenience we discover 1983 - * the PHY to update the PHY info, like negotiated linkrate. 1983 + * Even though the PHY is empty, for convenience we update 1984 + * the PHY info, like negotiated linkrate. 1984 1985 */ 1985 - sas_ex_phy_discover(dev, phy_id); 1986 - return res; 1986 + if (res == 0) 1987 + sas_set_ex_phy(dev, phy_id, disc_resp); 1988 + goto out_free_resp; 1987 1989 } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && 1988 1990 dev_type_flutter(type, phy->attached_dev_type)) { 1989 1991 struct domain_device *ata_dev = sas_ex_to_ata(dev, phy_id); ··· 2003 1989 action = ", needs recovery"; 2004 1990 pr_debug("ex %016llx phy%02d broadcast flutter%s\n", 2005 1991 SAS_ADDR(dev->sas_addr), phy_id, action); 2006 - return res; 1992 + goto out_free_resp; 2007 1993 } 2008 1994 2009 1995 /* we always have to delete the old device when we went here */ ··· 2012 1998 SAS_ADDR(phy->attached_sas_addr)); 2013 1999 sas_unregister_devs_sas_addr(dev, phy_id, last); 2014 2000 2015 - return sas_discover_new(dev, phy_id); 2001 + res = sas_discover_new(dev, phy_id); 2002 + out_free_resp: 2003 + kfree(disc_resp); 2004 + return res; 2016 2005 } 2017 2006 2018 2007 /**
+1 -1
drivers/scsi/lpfc/lpfc.h
··· 1333 1333 struct timer_list fabric_block_timer; 1334 1334 unsigned long bit_flags; 1335 1335 atomic_t num_rsrc_err; 1336 - atomic_t num_cmd_success; 1337 1336 unsigned long last_rsrc_error_time; 1338 1337 unsigned long last_ramp_down_time; 1339 1338 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS ··· 1437 1438 struct timer_list inactive_vmid_poll; 1438 1439 1439 1440 /* RAS Support */ 1441 + spinlock_t ras_fwlog_lock; /* do not take while holding another lock */ 1440 1442 struct lpfc_ras_fwlog ras_fwlog; 1441 1443 1442 1444 uint32_t iocb_cnt;
+2 -2
drivers/scsi/lpfc/lpfc_attr.c
··· 5865 5865 if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) 5866 5866 return -EINVAL; 5867 5867 5868 - spin_lock_irq(&phba->hbalock); 5868 + spin_lock_irq(&phba->ras_fwlog_lock); 5869 5869 state = phba->ras_fwlog.state; 5870 - spin_unlock_irq(&phba->hbalock); 5870 + spin_unlock_irq(&phba->ras_fwlog_lock); 5871 5871 5872 5872 if (state == REG_INPROGRESS) { 5873 5873 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "6147 RAS Logging "
+20 -20
drivers/scsi/lpfc/lpfc_bsg.c
··· 2513 2513 return -ENOMEM; 2514 2514 } 2515 2515 2516 - dmabuff = (struct lpfc_dmabuf *)mbox->ctx_buf; 2516 + dmabuff = mbox->ctx_buf; 2517 2517 mbox->ctx_buf = NULL; 2518 2518 mbox->ctx_ndlp = NULL; 2519 2519 status = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO); ··· 3169 3169 } 3170 3170 3171 3171 cmdwqe = &cmdiocbq->wqe; 3172 - memset(cmdwqe, 0, sizeof(union lpfc_wqe)); 3172 + memset(cmdwqe, 0, sizeof(*cmdwqe)); 3173 3173 if (phba->sli_rev < LPFC_SLI_REV4) { 3174 3174 rspwqe = &rspiocbq->wqe; 3175 - memset(rspwqe, 0, sizeof(union lpfc_wqe)); 3175 + memset(rspwqe, 0, sizeof(*rspwqe)); 3176 3176 } 3177 3177 3178 3178 INIT_LIST_HEAD(&head); ··· 3376 3376 unsigned long flags; 3377 3377 uint8_t *pmb, *pmb_buf; 3378 3378 3379 - dd_data = pmboxq->ctx_ndlp; 3379 + dd_data = pmboxq->ctx_u.dd_data; 3380 3380 3381 3381 /* 3382 3382 * The outgoing buffer is readily referred from the dma buffer, ··· 3553 3553 struct lpfc_sli_config_mbox *sli_cfg_mbx; 3554 3554 uint8_t *pmbx; 3555 3555 3556 - dd_data = pmboxq->ctx_buf; 3556 + dd_data = pmboxq->ctx_u.dd_data; 3557 3557 3558 3558 /* Determine if job has been aborted */ 3559 3559 spin_lock_irqsave(&phba->ct_ev_lock, flags); ··· 3940 3940 pmboxq->mbox_cmpl = lpfc_bsg_issue_read_mbox_ext_cmpl; 3941 3941 3942 3942 /* context fields to callback function */ 3943 - pmboxq->ctx_buf = dd_data; 3943 + pmboxq->ctx_u.dd_data = dd_data; 3944 3944 dd_data->type = TYPE_MBOX; 3945 3945 dd_data->set_job = job; 3946 3946 dd_data->context_un.mbox.pmboxq = pmboxq; ··· 4112 4112 pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl; 4113 4113 4114 4114 /* context fields to callback function */ 4115 - pmboxq->ctx_buf = dd_data; 4115 + pmboxq->ctx_u.dd_data = dd_data; 4116 4116 dd_data->type = TYPE_MBOX; 4117 4117 dd_data->set_job = job; 4118 4118 dd_data->context_un.mbox.pmboxq = pmboxq; ··· 4460 4460 pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl; 4461 4461 4462 4462 /* context fields to callback function */ 4463 - pmboxq->ctx_buf = dd_data; 4463 + pmboxq->ctx_u.dd_data = dd_data; 4464 4464 dd_data->type = TYPE_MBOX; 4465 4465 dd_data->set_job = job; 4466 4466 dd_data->context_un.mbox.pmboxq = pmboxq; ··· 4747 4747 if (mbox_req->inExtWLen || mbox_req->outExtWLen) { 4748 4748 from = pmbx; 4749 4749 ext = from + sizeof(MAILBOX_t); 4750 - pmboxq->ctx_buf = ext; 4750 + pmboxq->ext_buf = ext; 4751 4751 pmboxq->in_ext_byte_len = 4752 4752 mbox_req->inExtWLen * sizeof(uint32_t); 4753 4753 pmboxq->out_ext_byte_len = ··· 4875 4875 pmboxq->mbox_cmpl = lpfc_bsg_issue_mbox_cmpl; 4876 4876 4877 4877 /* setup context field to pass wait_queue pointer to wake function */ 4878 - pmboxq->ctx_ndlp = dd_data; 4878 + pmboxq->ctx_u.dd_data = dd_data; 4879 4879 dd_data->type = TYPE_MBOX; 4880 4880 dd_data->set_job = job; 4881 4881 dd_data->context_un.mbox.pmboxq = pmboxq; ··· 5070 5070 bsg_reply->reply_data.vendor_reply.vendor_rsp; 5071 5071 5072 5072 /* Current logging state */ 5073 - spin_lock_irq(&phba->hbalock); 5073 + spin_lock_irq(&phba->ras_fwlog_lock); 5074 5074 if (ras_fwlog->state == ACTIVE) 5075 5075 ras_reply->state = LPFC_RASLOG_STATE_RUNNING; 5076 5076 else 5077 5077 ras_reply->state = LPFC_RASLOG_STATE_STOPPED; 5078 - spin_unlock_irq(&phba->hbalock); 5078 + spin_unlock_irq(&phba->ras_fwlog_lock); 5079 5079 5080 5080 ras_reply->log_level = phba->ras_fwlog.fw_loglevel; 5081 5081 ras_reply->log_buff_sz = phba->cfg_ras_fwlog_buffsize; ··· 5132 5132 5133 5133 if (action == LPFC_RASACTION_STOP_LOGGING) { 5134 5134 /* Check if already disabled */ 5135 - spin_lock_irq(&phba->hbalock); 5135 + spin_lock_irq(&phba->ras_fwlog_lock); 5136 5136 if (ras_fwlog->state != ACTIVE) { 5137 - spin_unlock_irq(&phba->hbalock); 5137 + spin_unlock_irq(&phba->ras_fwlog_lock); 5138 5138 rc = -ESRCH; 5139 5139 goto ras_job_error; 5140 5140 } 5141 - spin_unlock_irq(&phba->hbalock); 5141 + spin_unlock_irq(&phba->ras_fwlog_lock); 5142 5142 5143 5143 /* Disable logging */ 5144 5144 lpfc_ras_stop_fwlog(phba); ··· 5149 5149 * FW-logging with new log-level. Return status 5150 5150 * "Logging already Running" to caller. 5151 5151 **/ 5152 - spin_lock_irq(&phba->hbalock); 5152 + spin_lock_irq(&phba->ras_fwlog_lock); 5153 5153 if (ras_fwlog->state != INACTIVE) 5154 5154 action_status = -EINPROGRESS; 5155 - spin_unlock_irq(&phba->hbalock); 5155 + spin_unlock_irq(&phba->ras_fwlog_lock); 5156 5156 5157 5157 /* Enable logging */ 5158 5158 rc = lpfc_sli4_ras_fwlog_init(phba, log_level, ··· 5268 5268 goto ras_job_error; 5269 5269 5270 5270 /* Logging to be stopped before reading */ 5271 - spin_lock_irq(&phba->hbalock); 5271 + spin_lock_irq(&phba->ras_fwlog_lock); 5272 5272 if (ras_fwlog->state == ACTIVE) { 5273 - spin_unlock_irq(&phba->hbalock); 5273 + spin_unlock_irq(&phba->ras_fwlog_lock); 5274 5274 rc = -EINPROGRESS; 5275 5275 goto ras_job_error; 5276 5276 } 5277 - spin_unlock_irq(&phba->hbalock); 5277 + spin_unlock_irq(&phba->ras_fwlog_lock); 5278 5278 5279 5279 if (job->request_len < 5280 5280 sizeof(struct fc_bsg_request) +
+6 -6
drivers/scsi/lpfc/lpfc_debugfs.c
··· 2194 2194 2195 2195 memset(buffer, 0, size); 2196 2196 2197 - spin_lock_irq(&phba->hbalock); 2197 + spin_lock_irq(&phba->ras_fwlog_lock); 2198 2198 if (phba->ras_fwlog.state != ACTIVE) { 2199 - spin_unlock_irq(&phba->hbalock); 2199 + spin_unlock_irq(&phba->ras_fwlog_lock); 2200 2200 return -EINVAL; 2201 2201 } 2202 - spin_unlock_irq(&phba->hbalock); 2202 + spin_unlock_irq(&phba->ras_fwlog_lock); 2203 2203 2204 2204 list_for_each_entry_safe(dmabuf, next, 2205 2205 &phba->ras_fwlog.fwlog_buff_list, list) { ··· 2250 2250 int size; 2251 2251 int rc = -ENOMEM; 2252 2252 2253 - spin_lock_irq(&phba->hbalock); 2253 + spin_lock_irq(&phba->ras_fwlog_lock); 2254 2254 if (phba->ras_fwlog.state != ACTIVE) { 2255 - spin_unlock_irq(&phba->hbalock); 2255 + spin_unlock_irq(&phba->ras_fwlog_lock); 2256 2256 rc = -EINVAL; 2257 2257 goto out; 2258 2258 } 2259 - spin_unlock_irq(&phba->hbalock); 2259 + spin_unlock_irq(&phba->ras_fwlog_lock); 2260 2260 2261 2261 if (check_mul_overflow(LPFC_RAS_MIN_BUFF_POST_SIZE, 2262 2262 phba->cfg_ras_fwlog_buffsize, &size))
+21 -24
drivers/scsi/lpfc/lpfc_els.c
··· 4437 4437 unsigned long flags; 4438 4438 struct lpfc_work_evt *evtp = &ndlp->els_retry_evt; 4439 4439 4440 + /* Hold a node reference for outstanding queued work */ 4441 + if (!lpfc_nlp_get(ndlp)) 4442 + return; 4443 + 4440 4444 spin_lock_irqsave(&phba->hbalock, flags); 4441 4445 if (!list_empty(&evtp->evt_listp)) { 4442 4446 spin_unlock_irqrestore(&phba->hbalock, flags); 4447 + lpfc_nlp_put(ndlp); 4443 4448 return; 4444 4449 } 4445 4450 4446 - /* We need to hold the node by incrementing the reference 4447 - * count until the queued work is done 4448 - */ 4449 - evtp->evt_arg1 = lpfc_nlp_get(ndlp); 4450 - if (evtp->evt_arg1) { 4451 - evtp->evt = LPFC_EVT_ELS_RETRY; 4452 - list_add_tail(&evtp->evt_listp, &phba->work_list); 4453 - lpfc_worker_wake_up(phba); 4454 - } 4451 + evtp->evt_arg1 = ndlp; 4452 + evtp->evt = LPFC_EVT_ELS_RETRY; 4453 + list_add_tail(&evtp->evt_listp, &phba->work_list); 4455 4454 spin_unlock_irqrestore(&phba->hbalock, flags); 4456 - return; 4455 + 4456 + lpfc_worker_wake_up(phba); 4457 4457 } 4458 4458 4459 4459 /** ··· 7238 7238 goto rdp_fail; 7239 7239 mbox->vport = rdp_context->ndlp->vport; 7240 7240 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a0; 7241 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 7241 + mbox->ctx_u.rdp = rdp_context; 7242 7242 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); 7243 7243 if (rc == MBX_NOT_FINISHED) { 7244 7244 lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); ··· 7290 7290 mbox->in_ext_byte_len = DMP_SFF_PAGE_A0_SIZE; 7291 7291 mbox->out_ext_byte_len = DMP_SFF_PAGE_A0_SIZE; 7292 7292 mbox->mbox_offset_word = 5; 7293 - mbox->ctx_buf = virt; 7293 + mbox->ext_buf = virt; 7294 7294 } else { 7295 7295 bf_set(lpfc_mbx_memory_dump_type3_length, 7296 7296 &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A0_SIZE); ··· 7298 7298 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); 7299 7299 } 7300 7300 mbox->vport = phba->pport; 7301 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 7302 7301 7303 7302 rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); 7304 7303 if (rc == MBX_NOT_FINISHED) { ··· 7306 7307 } 7307 7308 7308 7309 if (phba->sli_rev == LPFC_SLI_REV4) 7309 - mp = (struct lpfc_dmabuf *)(mbox->ctx_buf); 7310 + mp = mbox->ctx_buf; 7310 7311 else 7311 7312 mp = mpsave; 7312 7313 ··· 7349 7350 mbox->in_ext_byte_len = DMP_SFF_PAGE_A2_SIZE; 7350 7351 mbox->out_ext_byte_len = DMP_SFF_PAGE_A2_SIZE; 7351 7352 mbox->mbox_offset_word = 5; 7352 - mbox->ctx_buf = virt; 7353 + mbox->ext_buf = virt; 7353 7354 } else { 7354 7355 bf_set(lpfc_mbx_memory_dump_type3_length, 7355 7356 &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A2_SIZE); ··· 7357 7358 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); 7358 7359 } 7359 7360 7360 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 7361 7361 rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); 7362 7362 if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) { 7363 7363 rc = 1; ··· 7498 7500 int rc; 7499 7501 7500 7502 mb = &pmb->u.mb; 7501 - lcb_context = (struct lpfc_lcb_context *)pmb->ctx_ndlp; 7503 + lcb_context = pmb->ctx_u.lcb; 7502 7504 ndlp = lcb_context->ndlp; 7503 - pmb->ctx_ndlp = NULL; 7505 + memset(&pmb->ctx_u, 0, sizeof(pmb->ctx_u)); 7504 7506 pmb->ctx_buf = NULL; 7505 7507 7506 7508 shdr = (union lpfc_sli4_cfg_shdr *) ··· 7640 7642 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, 7641 7643 LPFC_MBOX_OPCODE_SET_BEACON_CONFIG, len, 7642 7644 LPFC_SLI4_MBX_EMBED); 7643 - mbox->ctx_ndlp = (void *)lcb_context; 7645 + mbox->ctx_u.lcb = lcb_context; 7644 7646 mbox->vport = phba->pport; 7645 7647 mbox->mbox_cmpl = lpfc_els_lcb_rsp; 7646 7648 bf_set(lpfc_mbx_set_beacon_port_num, &mbox->u.mqe.un.beacon_config, ··· 8637 8639 mb = &pmb->u.mb; 8638 8640 8639 8641 ndlp = pmb->ctx_ndlp; 8640 - rxid = (uint16_t)((unsigned long)(pmb->ctx_buf) & 0xffff); 8641 - oxid = (uint16_t)(((unsigned long)(pmb->ctx_buf) >> 16) & 0xffff); 8642 - pmb->ctx_buf = NULL; 8642 + rxid = (uint16_t)(pmb->ctx_u.ox_rx_id & 0xffff); 8643 + oxid = (uint16_t)((pmb->ctx_u.ox_rx_id >> 16) & 0xffff); 8644 + memset(&pmb->ctx_u, 0, sizeof(pmb->ctx_u)); 8643 8645 pmb->ctx_ndlp = NULL; 8644 8646 8645 8647 if (mb->mbxStatus) { ··· 8743 8745 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_ATOMIC); 8744 8746 if (mbox) { 8745 8747 lpfc_read_lnk_stat(phba, mbox); 8746 - mbox->ctx_buf = (void *)((unsigned long) 8747 - (ox_id << 16 | ctx)); 8748 + mbox->ctx_u.ox_rx_id = ox_id << 16 | ctx; 8748 8749 mbox->ctx_ndlp = lpfc_nlp_get(ndlp); 8749 8750 if (!mbox->ctx_ndlp) 8750 8751 goto node_err;
+16 -17
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 257 257 if (evtp->evt_arg1) { 258 258 evtp->evt = LPFC_EVT_DEV_LOSS; 259 259 list_add_tail(&evtp->evt_listp, &phba->work_list); 260 + spin_unlock_irqrestore(&phba->hbalock, iflags); 260 261 lpfc_worker_wake_up(phba); 262 + return; 261 263 } 262 264 spin_unlock_irqrestore(&phba->hbalock, iflags); 263 265 } else { ··· 277 275 lpfc_disc_state_machine(vport, ndlp, NULL, 278 276 NLP_EVT_DEVICE_RM); 279 277 } 280 - 281 278 } 282 - 283 - return; 284 279 } 285 280 286 281 /** ··· 3428 3429 lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 3429 3430 { 3430 3431 MAILBOX_t *mb = &pmb->u.mb; 3431 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 3432 + struct lpfc_dmabuf *mp = pmb->ctx_buf; 3432 3433 struct lpfc_vport *vport = pmb->vport; 3433 3434 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 3434 3435 struct serv_parm *sp = &vport->fc_sparam; ··· 3736 3737 struct lpfc_mbx_read_top *la; 3737 3738 struct lpfc_sli_ring *pring; 3738 3739 MAILBOX_t *mb = &pmb->u.mb; 3739 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); 3740 + struct lpfc_dmabuf *mp = pmb->ctx_buf; 3740 3741 uint8_t attn_type; 3741 3742 3742 3743 /* Unblock ELS traffic */ ··· 3850 3851 lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 3851 3852 { 3852 3853 struct lpfc_vport *vport = pmb->vport; 3853 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 3854 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 3854 + struct lpfc_dmabuf *mp = pmb->ctx_buf; 3855 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 3855 3856 3856 3857 /* The driver calls the state machine with the pmb pointer 3857 3858 * but wants to make sure a stale ctx_buf isn't acted on. ··· 4065 4066 * the dump routine is a single-use construct. 4066 4067 */ 4067 4068 if (pmb->ctx_buf) { 4068 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 4069 + mp = pmb->ctx_buf; 4069 4070 lpfc_mbuf_free(phba, mp->virt, mp->phys); 4070 4071 kfree(mp); 4071 4072 pmb->ctx_buf = NULL; ··· 4088 4089 4089 4090 if (phba->sli_rev == LPFC_SLI_REV4) { 4090 4091 byte_count = pmb->u.mqe.un.mb_words[5]; 4091 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 4092 + mp = pmb->ctx_buf; 4092 4093 if (byte_count > sizeof(struct static_vport_info) - 4093 4094 offset) 4094 4095 byte_count = sizeof(struct static_vport_info) ··· 4168 4169 { 4169 4170 struct lpfc_vport *vport = pmb->vport; 4170 4171 MAILBOX_t *mb = &pmb->u.mb; 4171 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 4172 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 4172 4173 4173 4174 pmb->ctx_ndlp = NULL; 4174 4175 ··· 4306 4307 lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 4307 4308 { 4308 4309 MAILBOX_t *mb = &pmb->u.mb; 4309 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 4310 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 4310 4311 struct lpfc_vport *vport = pmb->vport; 4311 4312 int rc; 4312 4313 ··· 4430 4431 { 4431 4432 struct lpfc_vport *vport = pmb->vport; 4432 4433 MAILBOX_t *mb = &pmb->u.mb; 4433 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 4434 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 4434 4435 4435 4436 pmb->ctx_ndlp = NULL; 4436 4437 if (mb->mbxStatus) { ··· 5173 5174 struct lpfc_vport *vport = pmb->vport; 5174 5175 struct lpfc_nodelist *ndlp; 5175 5176 5176 - ndlp = (struct lpfc_nodelist *)(pmb->ctx_ndlp); 5177 + ndlp = pmb->ctx_ndlp; 5177 5178 if (!ndlp) 5178 5179 return; 5179 5180 lpfc_issue_els_logo(vport, ndlp, 0); ··· 5495 5496 if ((mb = phba->sli.mbox_active)) { 5496 5497 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 5497 5498 !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && 5498 - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { 5499 + (ndlp == mb->ctx_ndlp)) { 5499 5500 mb->ctx_ndlp = NULL; 5500 5501 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 5501 5502 } ··· 5506 5507 list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) { 5507 5508 if ((mb->u.mb.mbxCommand != MBX_REG_LOGIN64) || 5508 5509 (mb->mbox_flag & LPFC_MBX_IMED_UNREG) || 5509 - (ndlp != (struct lpfc_nodelist *)mb->ctx_ndlp)) 5510 + (ndlp != mb->ctx_ndlp)) 5510 5511 continue; 5511 5512 5512 5513 mb->ctx_ndlp = NULL; ··· 5516 5517 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { 5517 5518 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 5518 5519 !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && 5519 - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { 5520 + (ndlp == mb->ctx_ndlp)) { 5520 5521 list_del(&mb->list); 5521 5522 lpfc_mbox_rsrc_cleanup(phba, mb, MBOX_THD_LOCKED); 5522 5523 ··· 6356 6357 lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 6357 6358 { 6358 6359 MAILBOX_t *mb = &pmb->u.mb; 6359 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 6360 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 6360 6361 struct lpfc_vport *vport = pmb->vport; 6361 6362 6362 6363 pmb->ctx_ndlp = NULL;
+8 -5
drivers/scsi/lpfc/lpfc_init.c
··· 460 460 return -EIO; 461 461 } 462 462 463 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 463 + mp = pmb->ctx_buf; 464 464 465 465 /* This dmabuf was allocated by lpfc_read_sparam. The dmabuf is no 466 466 * longer needed. Prevent unintended ctx_buf access as the mbox is ··· 2217 2217 /* Cleanup any outstanding ELS commands */ 2218 2218 lpfc_els_flush_all_cmd(phba); 2219 2219 psli->slistat.link_event++; 2220 - lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); 2220 + lpfc_read_topology(phba, pmb, pmb->ctx_buf); 2221 2221 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; 2222 2222 pmb->vport = vport; 2223 2223 /* Block ELS IOCBs until we have processed this mbox command */ ··· 5454 5454 phba->sli.slistat.link_event++; 5455 5455 5456 5456 /* Create lpfc_handle_latt mailbox command from link ACQE */ 5457 - lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); 5457 + lpfc_read_topology(phba, pmb, pmb->ctx_buf); 5458 5458 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; 5459 5459 pmb->vport = phba->pport; 5460 5460 ··· 6347 6347 phba->sli.slistat.link_event++; 6348 6348 6349 6349 /* Create lpfc_handle_latt mailbox command from link ACQE */ 6350 - lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); 6350 + lpfc_read_topology(phba, pmb, pmb->ctx_buf); 6351 6351 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; 6352 6352 pmb->vport = phba->pport; 6353 6353 ··· 7704 7704 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? 7705 7705 "NVME" : " "), 7706 7706 (phba->nvmet_support ? "NVMET" : " ")); 7707 + 7708 + /* ras_fwlog state */ 7709 + spin_lock_init(&phba->ras_fwlog_lock); 7707 7710 7708 7711 /* Initialize the IO buffer list used by driver for SLI3 SCSI */ 7709 7712 spin_lock_init(&phba->scsi_buf_list_get_lock); ··· 13058 13055 rc = request_threaded_irq(eqhdl->irq, 13059 13056 &lpfc_sli4_hba_intr_handler, 13060 13057 &lpfc_sli4_hba_intr_handler_th, 13061 - IRQF_ONESHOT, name, eqhdl); 13058 + 0, name, eqhdl); 13062 13059 if (rc) { 13063 13060 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, 13064 13061 "0486 MSI-X fast-path (%d) "
+10 -20
drivers/scsi/lpfc/lpfc_mbox.c
··· 102 102 { 103 103 struct lpfc_dmabuf *mp; 104 104 105 - mp = (struct lpfc_dmabuf *)mbox->ctx_buf; 105 + mp = mbox->ctx_buf; 106 106 mbox->ctx_buf = NULL; 107 107 108 108 /* Release the generic BPL buffer memory. */ ··· 204 204 uint16_t region_id) 205 205 { 206 206 MAILBOX_t *mb; 207 - void *ctx; 208 207 209 208 mb = &pmb->u.mb; 210 - ctx = pmb->ctx_buf; 211 209 212 210 /* Setup to dump VPD region */ 213 211 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); ··· 217 219 mb->un.varDmp.word_cnt = (DMP_RSP_SIZE / sizeof (uint32_t)); 218 220 mb->un.varDmp.co = 0; 219 221 mb->un.varDmp.resp_offset = 0; 220 - pmb->ctx_buf = ctx; 221 222 mb->mbxOwner = OWN_HOST; 222 223 return; 223 224 } ··· 233 236 lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 234 237 { 235 238 MAILBOX_t *mb; 236 - void *ctx; 237 239 238 240 mb = &pmb->u.mb; 239 - /* Save context so that we can restore after memset */ 240 - ctx = pmb->ctx_buf; 241 241 242 242 /* Setup to dump VPD region */ 243 243 memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); ··· 248 254 mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE; 249 255 mb->un.varDmp.co = 0; 250 256 mb->un.varDmp.resp_offset = 0; 251 - pmb->ctx_buf = ctx; 252 257 return; 253 258 } 254 259 ··· 365 372 /* Save address for later completion and set the owner to host so that 366 373 * the FW knows this mailbox is available for processing. 367 374 */ 368 - pmb->ctx_buf = (uint8_t *)mp; 375 + pmb->ctx_buf = mp; 369 376 mb->mbxOwner = OWN_HOST; 370 377 return (0); 371 378 } ··· 1809 1816 } 1810 1817 /* Reinitialize the context pointers to avoid stale usage. */ 1811 1818 mbox->ctx_buf = NULL; 1812 - mbox->context3 = NULL; 1819 + memset(&mbox->ctx_u, 0, sizeof(mbox->ctx_u)); 1813 1820 kfree(mbox->sge_array); 1814 1821 /* Finally, free the mailbox command itself */ 1815 1822 mempool_free(mbox, phba->mbox_mem_pool); ··· 2359 2366 { 2360 2367 MAILBOX_t *mb; 2361 2368 int rc = FAILURE; 2362 - struct lpfc_rdp_context *rdp_context = 2363 - (struct lpfc_rdp_context *)(mboxq->ctx_ndlp); 2369 + struct lpfc_rdp_context *rdp_context = mboxq->ctx_u.rdp; 2364 2370 2365 2371 mb = &mboxq->u.mb; 2366 2372 if (mb->mbxStatus) ··· 2377 2385 static void 2378 2386 lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) 2379 2387 { 2380 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)mbox->ctx_buf; 2381 - struct lpfc_rdp_context *rdp_context = 2382 - (struct lpfc_rdp_context *)(mbox->ctx_ndlp); 2388 + struct lpfc_dmabuf *mp = mbox->ctx_buf; 2389 + struct lpfc_rdp_context *rdp_context = mbox->ctx_u.rdp; 2383 2390 2384 2391 if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) 2385 2392 goto error_mbox_free; ··· 2392 2401 /* Save the dma buffer for cleanup in the final completion. */ 2393 2402 mbox->ctx_buf = mp; 2394 2403 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat; 2395 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 2404 + mbox->ctx_u.rdp = rdp_context; 2396 2405 if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == MBX_NOT_FINISHED) 2397 2406 goto error_mbox_free; 2398 2407 ··· 2407 2416 lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) 2408 2417 { 2409 2418 int rc; 2410 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(mbox->ctx_buf); 2411 - struct lpfc_rdp_context *rdp_context = 2412 - (struct lpfc_rdp_context *)(mbox->ctx_ndlp); 2419 + struct lpfc_dmabuf *mp = mbox->ctx_buf; 2420 + struct lpfc_rdp_context *rdp_context = mbox->ctx_u.rdp; 2413 2421 2414 2422 if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) 2415 2423 goto error; ··· 2438 2448 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); 2439 2449 2440 2450 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a2; 2441 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 2451 + mbox->ctx_u.rdp = rdp_context; 2442 2452 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); 2443 2453 if (rc == MBX_NOT_FINISHED) 2444 2454 goto error;
+6 -6
drivers/scsi/lpfc/lpfc_nportdisc.c
··· 300 300 int rc; 301 301 302 302 ndlp = login_mbox->ctx_ndlp; 303 - save_iocb = login_mbox->context3; 303 + save_iocb = login_mbox->ctx_u.save_iocb; 304 304 305 305 if (mb->mbxStatus == MBX_SUCCESS) { 306 306 /* Now that REG_RPI completed successfully, ··· 640 640 if (!login_mbox->ctx_ndlp) 641 641 goto out; 642 642 643 - login_mbox->context3 = save_iocb; /* For PLOGI ACC */ 643 + login_mbox->ctx_u.save_iocb = save_iocb; /* For PLOGI ACC */ 644 644 645 645 spin_lock_irq(&ndlp->lock); 646 646 ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); ··· 682 682 struct lpfc_nodelist *ndlp; 683 683 uint32_t cmd; 684 684 685 - elsiocb = (struct lpfc_iocbq *)mboxq->ctx_buf; 686 - ndlp = (struct lpfc_nodelist *)mboxq->ctx_ndlp; 685 + elsiocb = mboxq->ctx_u.save_iocb; 686 + ndlp = mboxq->ctx_ndlp; 687 687 vport = mboxq->vport; 688 688 cmd = elsiocb->drvrTimeout; 689 689 ··· 1875 1875 /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ 1876 1876 if ((mb = phba->sli.mbox_active)) { 1877 1877 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 1878 - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { 1878 + (ndlp == mb->ctx_ndlp)) { 1879 1879 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 1880 1880 lpfc_nlp_put(ndlp); 1881 1881 mb->ctx_ndlp = NULL; ··· 1886 1886 spin_lock_irq(&phba->hbalock); 1887 1887 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { 1888 1888 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 1889 - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { 1889 + (ndlp == mb->ctx_ndlp)) { 1890 1890 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 1891 1891 lpfc_nlp_put(ndlp); 1892 1892 list_del(&mb->list);
+2 -2
drivers/scsi/lpfc/lpfc_nvme.c
··· 2616 2616 /* No concern about the role change on the nvme remoteport. 2617 2617 * The transport will update it. 2618 2618 */ 2619 - spin_lock_irq(&vport->phba->hbalock); 2619 + spin_lock_irq(&ndlp->lock); 2620 2620 ndlp->fc4_xpt_flags |= NVME_XPT_UNREG_WAIT; 2621 - spin_unlock_irq(&vport->phba->hbalock); 2621 + spin_unlock_irq(&ndlp->lock); 2622 2622 2623 2623 /* Don't let the host nvme transport keep sending keep-alives 2624 2624 * on this remoteport. Vport is unloading, no recovery. The
+1 -1
drivers/scsi/lpfc/lpfc_nvmet.c
··· 1586 1586 wqe = &nvmewqe->wqe; 1587 1587 1588 1588 /* Initialize WQE */ 1589 - memset(wqe, 0, sizeof(union lpfc_wqe)); 1589 + memset(wqe, 0, sizeof(*wqe)); 1590 1590 1591 1591 ctx_buf->iocbq->cmd_dmabuf = NULL; 1592 1592 spin_lock(&phba->sli4_hba.sgl_list_lock);
+4 -19
drivers/scsi/lpfc/lpfc_scsi.c
··· 167 167 struct Scsi_Host *shost; 168 168 struct scsi_device *sdev; 169 169 unsigned long new_queue_depth; 170 - unsigned long num_rsrc_err, num_cmd_success; 170 + unsigned long num_rsrc_err; 171 171 int i; 172 172 173 173 num_rsrc_err = atomic_read(&phba->num_rsrc_err); 174 - num_cmd_success = atomic_read(&phba->num_cmd_success); 175 174 176 175 /* 177 176 * The error and success command counters are global per ··· 185 186 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { 186 187 shost = lpfc_shost_from_vport(vports[i]); 187 188 shost_for_each_device(sdev, shost) { 188 - new_queue_depth = 189 - sdev->queue_depth * num_rsrc_err / 190 - (num_rsrc_err + num_cmd_success); 191 - if (!new_queue_depth) 192 - new_queue_depth = sdev->queue_depth - 1; 189 + if (num_rsrc_err >= sdev->queue_depth) 190 + new_queue_depth = 1; 193 191 else 194 192 new_queue_depth = sdev->queue_depth - 195 - new_queue_depth; 193 + num_rsrc_err; 196 194 scsi_change_queue_depth(sdev, new_queue_depth); 197 195 } 198 196 } 199 197 lpfc_destroy_vport_work_array(phba, vports); 200 198 atomic_set(&phba->num_rsrc_err, 0); 201 - atomic_set(&phba->num_cmd_success, 0); 202 199 } 203 200 204 201 /** ··· 5331 5336 } 5332 5337 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); 5333 5338 } else { 5334 - if (vport->phba->cfg_enable_bg) { 5335 - lpfc_printf_vlog(vport, 5336 - KERN_INFO, LOG_SCSI_CMD, 5337 - "9038 BLKGRD: rcvd PROT_NORMAL cmd: " 5338 - "x%x reftag x%x cnt %u pt %x\n", 5339 - cmnd->cmnd[0], 5340 - scsi_prot_ref_tag(cmnd), 5341 - scsi_logical_block_count(cmnd), 5342 - (cmnd->cmnd[1]>>5)); 5343 - } 5344 5339 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); 5345 5340 } 5346 5341
+49 -50
drivers/scsi/lpfc/lpfc_sli.c
··· 1217 1217 empty = list_empty(&phba->active_rrq_list); 1218 1218 list_add_tail(&rrq->list, &phba->active_rrq_list); 1219 1219 phba->hba_flag |= HBA_RRQ_ACTIVE; 1220 + spin_unlock_irqrestore(&phba->hbalock, iflags); 1220 1221 if (empty) 1221 1222 lpfc_worker_wake_up(phba); 1222 - spin_unlock_irqrestore(&phba->hbalock, iflags); 1223 1223 return 0; 1224 1224 out: 1225 1225 spin_unlock_irqrestore(&phba->hbalock, iflags); ··· 2830 2830 */ 2831 2831 pmboxq->mbox_flag |= LPFC_MBX_WAKE; 2832 2832 spin_lock_irqsave(&phba->hbalock, drvr_flag); 2833 - pmbox_done = (struct completion *)pmboxq->context3; 2833 + pmbox_done = pmboxq->ctx_u.mbox_wait; 2834 2834 if (pmbox_done) 2835 2835 complete(pmbox_done); 2836 2836 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); ··· 2885 2885 if (!test_bit(FC_UNLOADING, &phba->pport->load_flag) && 2886 2886 pmb->u.mb.mbxCommand == MBX_REG_LOGIN64 && 2887 2887 !pmb->u.mb.mbxStatus) { 2888 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 2888 + mp = pmb->ctx_buf; 2889 2889 if (mp) { 2890 2890 pmb->ctx_buf = NULL; 2891 2891 lpfc_mbuf_free(phba, mp->virt, mp->phys); ··· 2914 2914 } 2915 2915 2916 2916 if (pmb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 2917 - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 2917 + ndlp = pmb->ctx_ndlp; 2918 2918 lpfc_nlp_put(ndlp); 2919 2919 } 2920 2920 2921 2921 if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) { 2922 - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 2922 + ndlp = pmb->ctx_ndlp; 2923 2923 2924 2924 /* Check to see if there are any deferred events to process */ 2925 2925 if (ndlp) { ··· 2952 2952 2953 2953 /* This nlp_put pairs with lpfc_sli4_resume_rpi */ 2954 2954 if (pmb->u.mb.mbxCommand == MBX_RESUME_RPI) { 2955 - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 2955 + ndlp = pmb->ctx_ndlp; 2956 2956 lpfc_nlp_put(ndlp); 2957 2957 } 2958 2958 ··· 5819 5819 goto out_free_mboxq; 5820 5820 } 5821 5821 5822 - mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; 5822 + mp = mboxq->ctx_buf; 5823 5823 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 5824 5824 5825 5825 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, ··· 6849 6849 { 6850 6850 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; 6851 6851 6852 - spin_lock_irq(&phba->hbalock); 6852 + spin_lock_irq(&phba->ras_fwlog_lock); 6853 6853 ras_fwlog->state = INACTIVE; 6854 - spin_unlock_irq(&phba->hbalock); 6854 + spin_unlock_irq(&phba->ras_fwlog_lock); 6855 6855 6856 6856 /* Disable FW logging to host memory */ 6857 6857 writel(LPFC_CTL_PDEV_CTL_DDL_RAS, ··· 6894 6894 ras_fwlog->lwpd.virt = NULL; 6895 6895 } 6896 6896 6897 - spin_lock_irq(&phba->hbalock); 6897 + spin_lock_irq(&phba->ras_fwlog_lock); 6898 6898 ras_fwlog->state = INACTIVE; 6899 - spin_unlock_irq(&phba->hbalock); 6899 + spin_unlock_irq(&phba->ras_fwlog_lock); 6900 6900 } 6901 6901 6902 6902 /** ··· 6998 6998 goto disable_ras; 6999 6999 } 7000 7000 7001 - spin_lock_irq(&phba->hbalock); 7001 + spin_lock_irq(&phba->ras_fwlog_lock); 7002 7002 ras_fwlog->state = ACTIVE; 7003 - spin_unlock_irq(&phba->hbalock); 7003 + spin_unlock_irq(&phba->ras_fwlog_lock); 7004 7004 mempool_free(pmb, phba->mbox_mem_pool); 7005 7005 7006 7006 return; ··· 7032 7032 uint32_t len = 0, fwlog_buffsize, fwlog_entry_count; 7033 7033 int rc = 0; 7034 7034 7035 - spin_lock_irq(&phba->hbalock); 7035 + spin_lock_irq(&phba->ras_fwlog_lock); 7036 7036 ras_fwlog->state = INACTIVE; 7037 - spin_unlock_irq(&phba->hbalock); 7037 + spin_unlock_irq(&phba->ras_fwlog_lock); 7038 7038 7039 7039 fwlog_buffsize = (LPFC_RAS_MIN_BUFF_POST_SIZE * 7040 7040 phba->cfg_ras_fwlog_buffsize); ··· 7095 7095 mbx_fwlog->u.request.lwpd.addr_lo = putPaddrLow(ras_fwlog->lwpd.phys); 7096 7096 mbx_fwlog->u.request.lwpd.addr_hi = putPaddrHigh(ras_fwlog->lwpd.phys); 7097 7097 7098 - spin_lock_irq(&phba->hbalock); 7098 + spin_lock_irq(&phba->ras_fwlog_lock); 7099 7099 ras_fwlog->state = REG_INPROGRESS; 7100 - spin_unlock_irq(&phba->hbalock); 7100 + spin_unlock_irq(&phba->ras_fwlog_lock); 7101 7101 mbox->vport = phba->pport; 7102 7102 mbox->mbox_cmpl = lpfc_sli4_ras_mbox_cmpl; 7103 7103 ··· 8766 8766 8767 8767 mboxq->vport = vport; 8768 8768 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 8769 - mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; 8769 + mp = mboxq->ctx_buf; 8770 8770 if (rc == MBX_SUCCESS) { 8771 8771 memcpy(&vport->fc_sparam, mp->virt, sizeof(struct serv_parm)); 8772 8772 rc = 0; ··· 9548 9548 } 9549 9549 9550 9550 /* Copy the mailbox extension data */ 9551 - if (pmbox->in_ext_byte_len && pmbox->ctx_buf) { 9552 - lpfc_sli_pcimem_bcopy(pmbox->ctx_buf, 9551 + if (pmbox->in_ext_byte_len && pmbox->ext_buf) { 9552 + lpfc_sli_pcimem_bcopy(pmbox->ext_buf, 9553 9553 (uint8_t *)phba->mbox_ext, 9554 9554 pmbox->in_ext_byte_len); 9555 9555 } ··· 9562 9562 = MAILBOX_HBA_EXT_OFFSET; 9563 9563 9564 9564 /* Copy the mailbox extension data */ 9565 - if (pmbox->in_ext_byte_len && pmbox->ctx_buf) 9565 + if (pmbox->in_ext_byte_len && pmbox->ext_buf) 9566 9566 lpfc_memcpy_to_slim(phba->MBslimaddr + 9567 9567 MAILBOX_HBA_EXT_OFFSET, 9568 - pmbox->ctx_buf, pmbox->in_ext_byte_len); 9568 + pmbox->ext_buf, pmbox->in_ext_byte_len); 9569 9569 9570 9570 if (mbx->mbxCommand == MBX_CONFIG_PORT) 9571 9571 /* copy command data into host mbox for cmpl */ ··· 9688 9688 lpfc_sli_pcimem_bcopy(phba->mbox, mbx, 9689 9689 MAILBOX_CMD_SIZE); 9690 9690 /* Copy the mailbox extension data */ 9691 - if (pmbox->out_ext_byte_len && pmbox->ctx_buf) { 9691 + if (pmbox->out_ext_byte_len && pmbox->ext_buf) { 9692 9692 lpfc_sli_pcimem_bcopy(phba->mbox_ext, 9693 - pmbox->ctx_buf, 9693 + pmbox->ext_buf, 9694 9694 pmbox->out_ext_byte_len); 9695 9695 } 9696 9696 } else { ··· 9698 9698 lpfc_memcpy_from_slim(mbx, phba->MBslimaddr, 9699 9699 MAILBOX_CMD_SIZE); 9700 9700 /* Copy the mailbox extension data */ 9701 - if (pmbox->out_ext_byte_len && pmbox->ctx_buf) { 9701 + if (pmbox->out_ext_byte_len && pmbox->ext_buf) { 9702 9702 lpfc_memcpy_from_slim( 9703 - pmbox->ctx_buf, 9703 + pmbox->ext_buf, 9704 9704 phba->MBslimaddr + 9705 9705 MAILBOX_HBA_EXT_OFFSET, 9706 9706 pmbox->out_ext_byte_len); ··· 11373 11373 unsigned long iflags; 11374 11374 struct lpfc_work_evt *evtp = &ndlp->recovery_evt; 11375 11375 11376 + /* Hold a node reference for outstanding queued work */ 11377 + if (!lpfc_nlp_get(ndlp)) 11378 + return; 11379 + 11376 11380 spin_lock_irqsave(&phba->hbalock, iflags); 11377 11381 if (!list_empty(&evtp->evt_listp)) { 11378 11382 spin_unlock_irqrestore(&phba->hbalock, iflags); 11383 + lpfc_nlp_put(ndlp); 11379 11384 return; 11380 11385 } 11381 11386 11382 - /* Incrementing the reference count until the queued work is done. */ 11383 - evtp->evt_arg1 = lpfc_nlp_get(ndlp); 11384 - if (!evtp->evt_arg1) { 11385 - spin_unlock_irqrestore(&phba->hbalock, iflags); 11386 - return; 11387 - } 11387 + evtp->evt_arg1 = ndlp; 11388 11388 evtp->evt = LPFC_EVT_RECOVER_PORT; 11389 11389 list_add_tail(&evtp->evt_listp, &phba->work_list); 11390 11390 spin_unlock_irqrestore(&phba->hbalock, iflags); ··· 13262 13262 /* setup wake call as IOCB callback */ 13263 13263 pmboxq->mbox_cmpl = lpfc_sli_wake_mbox_wait; 13264 13264 13265 - /* setup context3 field to pass wait_queue pointer to wake function */ 13265 + /* setup ctx_u field to pass wait_queue pointer to wake function */ 13266 13266 init_completion(&mbox_done); 13267 - pmboxq->context3 = &mbox_done; 13267 + pmboxq->ctx_u.mbox_wait = &mbox_done; 13268 13268 /* now issue the command */ 13269 13269 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); 13270 13270 if (retval == MBX_BUSY || retval == MBX_SUCCESS) { ··· 13272 13272 msecs_to_jiffies(timeout * 1000)); 13273 13273 13274 13274 spin_lock_irqsave(&phba->hbalock, flag); 13275 - pmboxq->context3 = NULL; 13275 + pmboxq->ctx_u.mbox_wait = NULL; 13276 13276 /* 13277 13277 * if LPFC_MBX_WAKE flag is set the mailbox is completed 13278 13278 * else do not free the resources. ··· 13813 13813 lpfc_sli_pcimem_bcopy(mbox, pmbox, 13814 13814 MAILBOX_CMD_SIZE); 13815 13815 if (pmb->out_ext_byte_len && 13816 - pmb->ctx_buf) 13816 + pmb->ext_buf) 13817 13817 lpfc_sli_pcimem_bcopy( 13818 13818 phba->mbox_ext, 13819 - pmb->ctx_buf, 13819 + pmb->ext_buf, 13820 13820 pmb->out_ext_byte_len); 13821 13821 } 13822 13822 if (pmb->mbox_flag & LPFC_MBX_IMED_UNREG) { ··· 13830 13830 pmbox->un.varWords[0], 0); 13831 13831 13832 13832 if (!pmbox->mbxStatus) { 13833 - mp = (struct lpfc_dmabuf *) 13834 - (pmb->ctx_buf); 13835 - ndlp = (struct lpfc_nodelist *) 13836 - pmb->ctx_ndlp; 13833 + mp = pmb->ctx_buf; 13834 + ndlp = pmb->ctx_ndlp; 13837 13835 13838 13836 /* Reg_LOGIN of dflt RPI was 13839 13837 * successful. new lets get ··· 14338 14340 mcqe_status, 14339 14341 pmbox->un.varWords[0], 0); 14340 14342 if (mcqe_status == MB_CQE_STATUS_SUCCESS) { 14341 - mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); 14342 - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 14343 + mp = pmb->ctx_buf; 14344 + ndlp = pmb->ctx_ndlp; 14343 14345 14344 14346 /* Reg_LOGIN of dflt RPI was successful. Mark the 14345 14347 * node as having an UNREG_LOGIN in progress to stop ··· 19821 19823 * lpfc_sli4_resume_rpi - Remove the rpi bitmask region 19822 19824 * @ndlp: pointer to lpfc nodelist data structure. 19823 19825 * @cmpl: completion call-back. 19824 - * @arg: data to load as MBox 'caller buffer information' 19826 + * @iocbq: data to load as mbox ctx_u information 19825 19827 * 19826 19828 * This routine is invoked to remove the memory region that 19827 19829 * provided rpi via a bitmask. 19828 19830 **/ 19829 19831 int 19830 19832 lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, 19831 - void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *arg) 19833 + void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), 19834 + struct lpfc_iocbq *iocbq) 19832 19835 { 19833 19836 LPFC_MBOXQ_t *mboxq; 19834 19837 struct lpfc_hba *phba = ndlp->phba; ··· 19858 19859 lpfc_resume_rpi(mboxq, ndlp); 19859 19860 if (cmpl) { 19860 19861 mboxq->mbox_cmpl = cmpl; 19861 - mboxq->ctx_buf = arg; 19862 + mboxq->ctx_u.save_iocb = iocbq; 19862 19863 } else 19863 19864 mboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 19864 19865 mboxq->ctx_ndlp = ndlp; ··· 20675 20676 if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) 20676 20677 goto out; 20677 20678 mqe = &mboxq->u.mqe; 20678 - mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; 20679 + mp = mboxq->ctx_buf; 20679 20680 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 20680 20681 if (rc) 20681 20682 goto out; ··· 21034 21035 (mb->u.mb.mbxCommand == MBX_REG_VPI)) 21035 21036 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 21036 21037 if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 21037 - act_mbx_ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; 21038 + act_mbx_ndlp = mb->ctx_ndlp; 21038 21039 21039 21040 /* This reference is local to this routine. The 21040 21041 * reference is removed at routine exit. ··· 21063 21064 21064 21065 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 21065 21066 if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 21066 - ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; 21067 + ndlp = mb->ctx_ndlp; 21067 21068 /* Unregister the RPI when mailbox complete */ 21068 21069 mb->mbox_flag |= LPFC_MBX_IMED_UNREG; 21069 21070 restart_loop = 1; ··· 21083 21084 while (!list_empty(&mbox_cmd_list)) { 21084 21085 list_remove_head(&mbox_cmd_list, mb, LPFC_MBOXQ_t, list); 21085 21086 if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 21086 - ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; 21087 + ndlp = mb->ctx_ndlp; 21087 21088 mb->ctx_ndlp = NULL; 21088 21089 if (ndlp) { 21089 21090 spin_lock(&ndlp->lock);
+24 -6
drivers/scsi/lpfc/lpfc_sli.h
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2004-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 182 182 struct lpfc_mqe mqe; 183 183 } u; 184 184 struct lpfc_vport *vport; /* virtual port pointer */ 185 - void *ctx_ndlp; /* an lpfc_nodelist pointer */ 186 - void *ctx_buf; /* an lpfc_dmabuf pointer */ 187 - void *context3; /* a generic pointer. Code must 188 - * accommodate the actual datatype. 189 - */ 185 + struct lpfc_nodelist *ctx_ndlp; /* caller ndlp pointer */ 186 + struct lpfc_dmabuf *ctx_buf; /* caller buffer information */ 187 + void *ext_buf; /* extended buffer for extended mbox 188 + * cmds. Not a generic pointer. 189 + * Use for storing virtual address. 190 + */ 191 + 192 + /* Pointers that are seldom used during mbox execution, but require 193 + * a saved context. 194 + */ 195 + union { 196 + unsigned long ox_rx_id; /* Used in els_rsp_rls_acc */ 197 + struct lpfc_rdp_context *rdp; /* Used in get_rdp_info */ 198 + struct lpfc_lcb_context *lcb; /* Used in set_beacon */ 199 + struct completion *mbox_wait; /* Used in issue_mbox_wait */ 200 + struct bsg_job_data *dd_data; /* Used in bsg_issue_mbox_cmpl 201 + * and 202 + * bsg_issue_mbox_ext_handle_job 203 + */ 204 + struct lpfc_iocbq *save_iocb; /* Used in defer_plogi_acc and 205 + * lpfc_mbx_cmpl_resume_rpi 206 + */ 207 + } ctx_u; 190 208 191 209 void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); 192 210 uint8_t mbox_flag;
+4 -3
drivers/scsi/lpfc/lpfc_sli4.h
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2009-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 1118 1118 void lpfc_sli4_remove_rpis(struct lpfc_hba *); 1119 1119 void lpfc_sli4_async_event_proc(struct lpfc_hba *); 1120 1120 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *); 1121 - int lpfc_sli4_resume_rpi(struct lpfc_nodelist *, 1122 - void (*)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *); 1121 + int lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, 1122 + void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), 1123 + struct lpfc_iocbq *iocbq); 1123 1124 void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba); 1124 1125 void lpfc_sli4_nvme_pci_offline_aborted(struct lpfc_hba *phba, 1125 1126 struct lpfc_io_buf *lpfc_ncmd);
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 20 * included with this package. * 21 21 *******************************************************************/ 22 22 23 - #define LPFC_DRIVER_VERSION "14.4.0.0" 23 + #define LPFC_DRIVER_VERSION "14.4.0.1" 24 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+5 -5
drivers/scsi/lpfc/lpfc_vport.c
··· 166 166 } 167 167 } 168 168 169 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 169 + mp = pmb->ctx_buf; 170 170 memcpy(&vport->fc_sparam, mp->virt, sizeof (struct serv_parm)); 171 171 memcpy(&vport->fc_nodename, &vport->fc_sparam.nodeName, 172 172 sizeof (struct lpfc_name)); ··· 674 674 lpfc_free_sysfs_attr(vport); 675 675 lpfc_debugfs_terminate(vport); 676 676 677 - /* Remove FC host to break driver binding. */ 678 - fc_remove_host(shost); 679 - scsi_remove_host(shost); 680 - 681 677 /* Send the DA_ID and Fabric LOGO to cleanup Nameserver entries. */ 682 678 ndlp = lpfc_findnode_did(vport, Fabric_DID); 683 679 if (!ndlp) ··· 716 720 lpfc_discovery_wait(vport); 717 721 718 722 skip_logo: 723 + 724 + /* Remove FC host to break driver binding. */ 725 + fc_remove_host(shost); 726 + scsi_remove_host(shost); 719 727 720 728 lpfc_cleanup(vport); 721 729
+1 -1
drivers/scsi/mpi3mr/mpi3mr_app.c
··· 1644 1644 if ((mpirep_offset != 0xFF) && 1645 1645 drv_bufs[mpirep_offset].bsg_buf_len) { 1646 1646 drv_buf_iter = &drv_bufs[mpirep_offset]; 1647 - drv_buf_iter->kern_buf_len = (sizeof(*bsg_reply_buf) - 1 + 1647 + drv_buf_iter->kern_buf_len = (sizeof(*bsg_reply_buf) + 1648 1648 mrioc->reply_sz); 1649 1649 bsg_reply_buf = kzalloc(drv_buf_iter->kern_buf_len, GFP_KERNEL); 1650 1650
+11 -9
drivers/scsi/pmcraid.c
··· 61 61 * pmcraid_minor - minor number(s) to use 62 62 */ 63 63 static unsigned int pmcraid_major; 64 - static struct class *pmcraid_class; 64 + static const struct class pmcraid_class = { 65 + .name = PMCRAID_DEVFILE, 66 + }; 65 67 static DECLARE_BITMAP(pmcraid_minor, PMCRAID_MAX_ADAPTERS); 66 68 67 69 /* ··· 4725 4723 if (error) 4726 4724 pmcraid_release_minor(minor); 4727 4725 else 4728 - device_create(pmcraid_class, NULL, MKDEV(pmcraid_major, minor), 4726 + device_create(&pmcraid_class, NULL, MKDEV(pmcraid_major, minor), 4729 4727 NULL, "%s%u", PMCRAID_DEVFILE, minor); 4730 4728 return error; 4731 4729 } ··· 4741 4739 static void pmcraid_release_chrdev(struct pmcraid_instance *pinstance) 4742 4740 { 4743 4741 pmcraid_release_minor(MINOR(pinstance->cdev.dev)); 4744 - device_destroy(pmcraid_class, 4742 + device_destroy(&pmcraid_class, 4745 4743 MKDEV(pmcraid_major, MINOR(pinstance->cdev.dev))); 4746 4744 cdev_del(&pinstance->cdev); 4747 4745 } ··· 5392 5390 } 5393 5391 5394 5392 pmcraid_major = MAJOR(dev); 5395 - pmcraid_class = class_create(PMCRAID_DEVFILE); 5396 5393 5397 - if (IS_ERR(pmcraid_class)) { 5398 - error = PTR_ERR(pmcraid_class); 5394 + error = class_register(&pmcraid_class); 5395 + 5396 + if (error) { 5399 5397 pmcraid_err("failed to register with sysfs, error = %x\n", 5400 5398 error); 5401 5399 goto out_unreg_chrdev; ··· 5404 5402 error = pmcraid_netlink_init(); 5405 5403 5406 5404 if (error) { 5407 - class_destroy(pmcraid_class); 5405 + class_unregister(&pmcraid_class); 5408 5406 goto out_unreg_chrdev; 5409 5407 } 5410 5408 ··· 5415 5413 5416 5414 pmcraid_err("failed to register pmcraid driver, error = %x\n", 5417 5415 error); 5418 - class_destroy(pmcraid_class); 5416 + class_unregister(&pmcraid_class); 5419 5417 pmcraid_netlink_release(); 5420 5418 5421 5419 out_unreg_chrdev: ··· 5434 5432 unregister_chrdev_region(MKDEV(pmcraid_major, 0), 5435 5433 PMCRAID_MAX_ADAPTERS); 5436 5434 pci_unregister_driver(&pmcraid_driver); 5437 - class_destroy(pmcraid_class); 5435 + class_unregister(&pmcraid_class); 5438 5436 } 5439 5437 5440 5438 module_init(pmcraid_init);
+12 -2
drivers/scsi/qla2xxx/qla_attr.c
··· 2741 2741 return; 2742 2742 2743 2743 if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { 2744 - qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); 2744 + /* Will wait for wind down of adapter */ 2745 + ql_dbg(ql_dbg_aer, fcport->vha, 0x900c, 2746 + "%s pci offline detected (id %06x)\n", __func__, 2747 + fcport->d_id.b24); 2748 + qla_pci_set_eeh_busy(fcport->vha); 2749 + qla2x00_eh_wait_for_pending_commands(fcport->vha, fcport->d_id.b24, 2750 + 0, WAIT_TARGET); 2745 2751 return; 2746 2752 } 2747 2753 } ··· 2769 2763 vha = fcport->vha; 2770 2764 2771 2765 if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { 2772 - qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); 2766 + /* Will wait for wind down of adapter */ 2767 + ql_dbg(ql_dbg_aer, fcport->vha, 0x900b, 2768 + "%s pci offline detected (id %06x)\n", __func__, 2769 + fcport->d_id.b24); 2770 + qla_pci_set_eeh_busy(vha); 2773 2771 qla2x00_eh_wait_for_pending_commands(fcport->vha, fcport->d_id.b24, 2774 2772 0, WAIT_TARGET); 2775 2773 return;
+1 -1
drivers/scsi/qla2xxx/qla_def.h
··· 82 82 #include "qla_nvme.h" 83 83 #define QLA2XXX_DRIVER_NAME "qla2xxx" 84 84 #define QLA2XXX_APIDEV "ql2xapidev" 85 - #define QLA2XXX_MANUFACTURER "Marvell Semiconductor, Inc." 85 + #define QLA2XXX_MANUFACTURER "Marvell" 86 86 87 87 /* 88 88 * We have MAILBOX_REGISTER_COUNT sized arrays in a few places,
+1 -1
drivers/scsi/qla2xxx/qla_gbl.h
··· 44 44 extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *); 45 45 46 46 extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t); 47 - extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool); 47 + extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *); 48 48 extern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, 49 49 struct els_plogi *els_plogi); 50 50
+65 -63
drivers/scsi/qla2xxx/qla_init.c
··· 1193 1193 return rval; 1194 1194 1195 1195 done_free_sp: 1196 - /* ref: INIT */ 1197 - kref_put(&sp->cmd_kref, qla2x00_sp_release); 1196 + /* 1197 + * use qla24xx_async_gnl_sp_done to purge all pending gnl request. 1198 + * kref_put is call behind the scene. 1199 + */ 1200 + sp->u.iocb_cmd.u.mbx.in_mb[0] = MBS_COMMAND_ERROR; 1201 + qla24xx_async_gnl_sp_done(sp, QLA_COMMAND_ERROR); 1198 1202 fcport->flags &= ~(FCF_ASYNC_SENT); 1199 1203 done: 1200 1204 fcport->flags &= ~(FCF_ASYNC_ACTIVE); ··· 2669 2665 return rval; 2670 2666 } 2671 2667 2668 + static void qla_enable_fce_trace(scsi_qla_host_t *vha) 2669 + { 2670 + int rval; 2671 + struct qla_hw_data *ha = vha->hw; 2672 + 2673 + if (ha->fce) { 2674 + ha->flags.fce_enabled = 1; 2675 + memset(ha->fce, 0, fce_calc_size(ha->fce_bufs)); 2676 + rval = qla2x00_enable_fce_trace(vha, 2677 + ha->fce_dma, ha->fce_bufs, ha->fce_mb, &ha->fce_bufs); 2678 + 2679 + if (rval) { 2680 + ql_log(ql_log_warn, vha, 0x8033, 2681 + "Unable to reinitialize FCE (%d).\n", rval); 2682 + ha->flags.fce_enabled = 0; 2683 + } 2684 + } 2685 + } 2686 + 2687 + static void qla_enable_eft_trace(scsi_qla_host_t *vha) 2688 + { 2689 + int rval; 2690 + struct qla_hw_data *ha = vha->hw; 2691 + 2692 + if (ha->eft) { 2693 + memset(ha->eft, 0, EFT_SIZE); 2694 + rval = qla2x00_enable_eft_trace(vha, ha->eft_dma, EFT_NUM_BUFFERS); 2695 + 2696 + if (rval) { 2697 + ql_log(ql_log_warn, vha, 0x8034, 2698 + "Unable to reinitialize EFT (%d).\n", rval); 2699 + } 2700 + } 2701 + } 2672 2702 /* 2673 2703 * qla2x00_initialize_adapter 2674 2704 * Initialize board. ··· 3706 3668 } 3707 3669 3708 3670 static void 3709 - qla2x00_init_fce_trace(scsi_qla_host_t *vha) 3671 + qla2x00_alloc_fce_trace(scsi_qla_host_t *vha) 3710 3672 { 3711 - int rval; 3712 3673 dma_addr_t tc_dma; 3713 3674 void *tc; 3714 3675 struct qla_hw_data *ha = vha->hw; ··· 3736 3699 return; 3737 3700 } 3738 3701 3739 - rval = qla2x00_enable_fce_trace(vha, tc_dma, FCE_NUM_BUFFERS, 3740 - ha->fce_mb, &ha->fce_bufs); 3741 - if (rval) { 3742 - ql_log(ql_log_warn, vha, 0x00bf, 3743 - "Unable to initialize FCE (%d).\n", rval); 3744 - dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, tc_dma); 3745 - return; 3746 - } 3747 - 3748 3702 ql_dbg(ql_dbg_init, vha, 0x00c0, 3749 3703 "Allocated (%d KB) for FCE...\n", FCE_SIZE / 1024); 3750 3704 3751 - ha->flags.fce_enabled = 1; 3752 3705 ha->fce_dma = tc_dma; 3753 3706 ha->fce = tc; 3707 + ha->fce_bufs = FCE_NUM_BUFFERS; 3754 3708 } 3755 3709 3756 3710 static void 3757 - qla2x00_init_eft_trace(scsi_qla_host_t *vha) 3711 + qla2x00_alloc_eft_trace(scsi_qla_host_t *vha) 3758 3712 { 3759 - int rval; 3760 3713 dma_addr_t tc_dma; 3761 3714 void *tc; 3762 3715 struct qla_hw_data *ha = vha->hw; ··· 3771 3744 return; 3772 3745 } 3773 3746 3774 - rval = qla2x00_enable_eft_trace(vha, tc_dma, EFT_NUM_BUFFERS); 3775 - if (rval) { 3776 - ql_log(ql_log_warn, vha, 0x00c2, 3777 - "Unable to initialize EFT (%d).\n", rval); 3778 - dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, tc_dma); 3779 - return; 3780 - } 3781 - 3782 3747 ql_dbg(ql_dbg_init, vha, 0x00c3, 3783 3748 "Allocated (%d KB) EFT ...\n", EFT_SIZE / 1024); 3784 3749 3785 3750 ha->eft_dma = tc_dma; 3786 3751 ha->eft = tc; 3787 - } 3788 - 3789 - static void 3790 - qla2x00_alloc_offload_mem(scsi_qla_host_t *vha) 3791 - { 3792 - qla2x00_init_fce_trace(vha); 3793 - qla2x00_init_eft_trace(vha); 3794 3752 } 3795 3753 3796 3754 void ··· 3832 3820 if (ha->tgt.atio_ring) 3833 3821 mq_size += ha->tgt.atio_q_length * sizeof(request_t); 3834 3822 3835 - qla2x00_init_fce_trace(vha); 3823 + qla2x00_alloc_fce_trace(vha); 3836 3824 if (ha->fce) 3837 3825 fce_size = sizeof(struct qla2xxx_fce_chain) + FCE_SIZE; 3838 - qla2x00_init_eft_trace(vha); 3826 + qla2x00_alloc_eft_trace(vha); 3839 3827 if (ha->eft) 3840 3828 eft_size = EFT_SIZE; 3841 3829 } ··· 4265 4253 struct qla_hw_data *ha = vha->hw; 4266 4254 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 4267 4255 unsigned long flags; 4268 - uint16_t fw_major_version; 4269 4256 int done_once = 0; 4270 4257 4271 4258 if (IS_P3P_TYPE(ha)) { ··· 4331 4320 goto failed; 4332 4321 4333 4322 enable_82xx_npiv: 4334 - fw_major_version = ha->fw_major_version; 4335 4323 if (IS_P3P_TYPE(ha)) 4336 4324 qla82xx_check_md_needed(vha); 4337 4325 else ··· 4359 4349 if (rval != QLA_SUCCESS) 4360 4350 goto failed; 4361 4351 4362 - if (!fw_major_version && !(IS_P3P_TYPE(ha))) 4363 - qla2x00_alloc_offload_mem(vha); 4364 - 4365 4352 if (ql2xallocfwdump && !(IS_P3P_TYPE(ha))) 4366 4353 qla2x00_alloc_fw_dump(vha); 4367 4354 4355 + qla_enable_fce_trace(vha); 4356 + qla_enable_eft_trace(vha); 4368 4357 } else { 4369 4358 goto failed; 4370 4359 } ··· 7496 7487 int 7497 7488 qla2x00_abort_isp(scsi_qla_host_t *vha) 7498 7489 { 7499 - int rval; 7500 7490 uint8_t status = 0; 7501 7491 struct qla_hw_data *ha = vha->hw; 7502 7492 struct scsi_qla_host *vp, *tvp; 7503 7493 struct req_que *req = ha->req_q_map[0]; 7504 7494 unsigned long flags; 7495 + fc_port_t *fcport; 7505 7496 7506 7497 if (vha->flags.online) { 7507 7498 qla2x00_abort_isp_cleanup(vha); ··· 7570 7561 "ISP Abort - ISP reg disconnect post nvmram config, exiting.\n"); 7571 7562 return status; 7572 7563 } 7564 + 7565 + /* User may have updated [fcp|nvme] prefer in flash */ 7566 + list_for_each_entry(fcport, &vha->vp_fcports, list) { 7567 + if (NVME_PRIORITY(ha, fcport)) 7568 + fcport->do_prli_nvme = 1; 7569 + else 7570 + fcport->do_prli_nvme = 0; 7571 + } 7572 + 7573 7573 if (!qla2x00_restart_isp(vha)) { 7574 7574 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); 7575 7575 ··· 7599 7581 7600 7582 if (IS_QLA81XX(ha) || IS_QLA8031(ha)) 7601 7583 qla2x00_get_fw_version(vha); 7602 - if (ha->fce) { 7603 - ha->flags.fce_enabled = 1; 7604 - memset(ha->fce, 0, 7605 - fce_calc_size(ha->fce_bufs)); 7606 - rval = qla2x00_enable_fce_trace(vha, 7607 - ha->fce_dma, ha->fce_bufs, ha->fce_mb, 7608 - &ha->fce_bufs); 7609 - if (rval) { 7610 - ql_log(ql_log_warn, vha, 0x8033, 7611 - "Unable to reinitialize FCE " 7612 - "(%d).\n", rval); 7613 - ha->flags.fce_enabled = 0; 7614 - } 7615 - } 7616 7584 7617 - if (ha->eft) { 7618 - memset(ha->eft, 0, EFT_SIZE); 7619 - rval = qla2x00_enable_eft_trace(vha, 7620 - ha->eft_dma, EFT_NUM_BUFFERS); 7621 - if (rval) { 7622 - ql_log(ql_log_warn, vha, 0x8034, 7623 - "Unable to reinitialize EFT " 7624 - "(%d).\n", rval); 7625 - } 7626 - } 7627 7585 } else { /* failed the ISP abort */ 7628 7586 vha->flags.online = 1; 7629 7587 if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { ··· 7648 7654 if (vp->vp_idx) { 7649 7655 atomic_inc(&vp->vref_count); 7650 7656 spin_unlock_irqrestore(&ha->vport_slock, flags); 7657 + 7658 + /* User may have updated [fcp|nvme] prefer in flash */ 7659 + list_for_each_entry(fcport, &vp->vp_fcports, list) { 7660 + if (NVME_PRIORITY(ha, fcport)) 7661 + fcport->do_prli_nvme = 1; 7662 + else 7663 + fcport->do_prli_nvme = 0; 7664 + } 7651 7665 7652 7666 qla2x00_vp_abort_isp(vp); 7653 7667
+44 -24
drivers/scsi/qla2xxx/qla_iocb.c
··· 2587 2587 qla2x00_sp_release(struct kref *kref) 2588 2588 { 2589 2589 struct srb *sp = container_of(kref, struct srb, cmd_kref); 2590 + struct scsi_qla_host *vha = sp->vha; 2591 + 2592 + switch (sp->type) { 2593 + case SRB_CT_PTHRU_CMD: 2594 + /* GPSC & GFPNID use fcport->ct_desc.ct_sns for both req & rsp */ 2595 + if (sp->u.iocb_cmd.u.ctarg.req && 2596 + (!sp->fcport || 2597 + sp->u.iocb_cmd.u.ctarg.req != sp->fcport->ct_desc.ct_sns)) { 2598 + dma_free_coherent(&vha->hw->pdev->dev, 2599 + sp->u.iocb_cmd.u.ctarg.req_allocated_size, 2600 + sp->u.iocb_cmd.u.ctarg.req, 2601 + sp->u.iocb_cmd.u.ctarg.req_dma); 2602 + sp->u.iocb_cmd.u.ctarg.req = NULL; 2603 + } 2604 + if (sp->u.iocb_cmd.u.ctarg.rsp && 2605 + (!sp->fcport || 2606 + sp->u.iocb_cmd.u.ctarg.rsp != sp->fcport->ct_desc.ct_sns)) { 2607 + dma_free_coherent(&vha->hw->pdev->dev, 2608 + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, 2609 + sp->u.iocb_cmd.u.ctarg.rsp, 2610 + sp->u.iocb_cmd.u.ctarg.rsp_dma); 2611 + sp->u.iocb_cmd.u.ctarg.rsp = NULL; 2612 + } 2613 + break; 2614 + default: 2615 + break; 2616 + } 2590 2617 2591 2618 sp->free(sp); 2592 2619 } ··· 2637 2610 { 2638 2611 struct srb_iocb *elsio = &sp->u.iocb_cmd; 2639 2612 2640 - kfree(sp->fcport); 2613 + if (sp->fcport) 2614 + qla2x00_free_fcport(sp->fcport); 2641 2615 2642 2616 if (elsio->u.els_logo.els_logo_pyld) 2643 2617 dma_free_coherent(&sp->vha->hw->pdev->dev, DMA_POOL_SIZE, ··· 2720 2692 */ 2721 2693 sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); 2722 2694 if (!sp) { 2723 - kfree(fcport); 2695 + qla2x00_free_fcport(fcport); 2724 2696 ql_log(ql_log_info, vha, 0x70e6, 2725 2697 "SRB allocation failed\n"); 2726 2698 return -ENOMEM; ··· 2751 2723 if (!elsio->u.els_logo.els_logo_pyld) { 2752 2724 /* ref: INIT */ 2753 2725 kref_put(&sp->cmd_kref, qla2x00_sp_release); 2726 + qla2x00_free_fcport(fcport); 2754 2727 return QLA_FUNCTION_FAILED; 2755 2728 } 2756 2729 ··· 2776 2747 if (rval != QLA_SUCCESS) { 2777 2748 /* ref: INIT */ 2778 2749 kref_put(&sp->cmd_kref, qla2x00_sp_release); 2750 + qla2x00_free_fcport(fcport); 2779 2751 return QLA_FUNCTION_FAILED; 2780 2752 } 2781 2753 ··· 3042 3012 3043 3013 int 3044 3014 qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, 3045 - fc_port_t *fcport, bool wait) 3015 + fc_port_t *fcport) 3046 3016 { 3047 3017 srb_t *sp; 3048 3018 struct srb_iocb *elsio = NULL; ··· 3057 3027 if (!sp) { 3058 3028 ql_log(ql_log_info, vha, 0x70e6, 3059 3029 "SRB allocation failed\n"); 3060 - fcport->flags &= ~FCF_ASYNC_ACTIVE; 3061 - return -ENOMEM; 3030 + goto done; 3062 3031 } 3063 3032 3064 3033 fcport->flags |= FCF_ASYNC_SENT; ··· 3065 3036 elsio = &sp->u.iocb_cmd; 3066 3037 ql_dbg(ql_dbg_io, vha, 0x3073, 3067 3038 "%s Enter: PLOGI portid=%06x\n", __func__, fcport->d_id.b24); 3068 - 3069 - if (wait) 3070 - sp->flags = SRB_WAKEUP_ON_COMP; 3071 3039 3072 3040 sp->type = SRB_ELS_DCMD; 3073 3041 sp->name = "ELS_DCMD"; ··· 3081 3055 3082 3056 if (!elsio->u.els_plogi.els_plogi_pyld) { 3083 3057 rval = QLA_FUNCTION_FAILED; 3084 - goto out; 3058 + goto done_free_sp; 3085 3059 } 3086 3060 3087 3061 resp_ptr = elsio->u.els_plogi.els_resp_pyld = ··· 3090 3064 3091 3065 if (!elsio->u.els_plogi.els_resp_pyld) { 3092 3066 rval = QLA_FUNCTION_FAILED; 3093 - goto out; 3067 + goto done_free_sp; 3094 3068 } 3095 3069 3096 3070 ql_dbg(ql_dbg_io, vha, 0x3073, "PLOGI %p %p\n", ptr, resp_ptr); ··· 3106 3080 3107 3081 if (els_opcode == ELS_DCMD_PLOGI && DBELL_ACTIVE(vha)) { 3108 3082 struct fc_els_flogi *p = ptr; 3109 - 3110 3083 p->fl_csp.sp_features |= cpu_to_be16(FC_SP_FT_SEC); 3111 3084 } 3112 3085 ··· 3114 3089 (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, 3115 3090 sizeof(*elsio->u.els_plogi.els_plogi_pyld)); 3116 3091 3117 - init_completion(&elsio->u.els_plogi.comp); 3118 3092 rval = qla2x00_start_sp(sp); 3119 3093 if (rval != QLA_SUCCESS) { 3120 - rval = QLA_FUNCTION_FAILED; 3094 + fcport->flags |= FCF_LOGIN_NEEDED; 3095 + set_bit(RELOGIN_NEEDED, &vha->dpc_flags); 3096 + goto done_free_sp; 3121 3097 } else { 3122 3098 ql_dbg(ql_dbg_disc, vha, 0x3074, 3123 3099 "%s PLOGI sent, hdl=%x, loopid=%x, to port_id %06x from port_id %06x\n", ··· 3126 3100 fcport->d_id.b24, vha->d_id.b24); 3127 3101 } 3128 3102 3129 - if (wait) { 3130 - wait_for_completion(&elsio->u.els_plogi.comp); 3103 + return rval; 3131 3104 3132 - if (elsio->u.els_plogi.comp_status != CS_COMPLETE) 3133 - rval = QLA_FUNCTION_FAILED; 3134 - } else { 3135 - goto done; 3136 - } 3137 - 3138 - out: 3139 - fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); 3105 + done_free_sp: 3140 3106 qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi); 3141 3107 /* ref: INIT */ 3142 3108 kref_put(&sp->cmd_kref, qla2x00_sp_release); 3143 3109 done: 3110 + fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); 3111 + qla2x00_set_fcport_disc_state(fcport, DSC_DELETED); 3144 3112 return rval; 3145 3113 } 3146 3114 ··· 3938 3918 return -EAGAIN; 3939 3919 } 3940 3920 3941 - pkt = __qla2x00_alloc_iocbs(sp->qpair, sp); 3921 + pkt = qla2x00_alloc_iocbs_ready(sp->qpair, sp); 3942 3922 if (!pkt) { 3943 3923 rval = -EAGAIN; 3944 3924 ql_log(ql_log_warn, vha, 0x700c,
+1 -1
drivers/scsi/qla2xxx/qla_mbx.c
··· 194 194 if (ha->flags.purge_mbox || chip_reset != ha->chip_reset || 195 195 ha->flags.eeh_busy) { 196 196 ql_log(ql_log_warn, vha, 0xd035, 197 - "Error detected: purge[%d] eeh[%d] cmd=0x%x, Exiting.\n", 197 + "Purge mbox: purge[%d] eeh[%d] cmd=0x%x, Exiting.\n", 198 198 ha->flags.purge_mbox, ha->flags.eeh_busy, mcp->mb[0]); 199 199 rval = QLA_ABORTED; 200 200 goto premature_exit;
+2 -1
drivers/scsi/qla2xxx/qla_os.c
··· 4602 4602 ha->init_cb_dma = 0; 4603 4603 fail_free_vp_map: 4604 4604 kfree(ha->vp_map); 4605 + ha->vp_map = NULL; 4605 4606 fail: 4606 4607 ql_log(ql_log_fatal, NULL, 0x0030, 4607 4608 "Memory allocation failure.\n"); ··· 5584 5583 break; 5585 5584 case QLA_EVT_ELS_PLOGI: 5586 5585 qla24xx_els_dcmd2_iocb(vha, ELS_DCMD_PLOGI, 5587 - e->u.fcport.fcport, false); 5586 + e->u.fcport.fcport); 5588 5587 break; 5589 5588 case QLA_EVT_SA_REPLACE: 5590 5589 rc = qla24xx_issue_sa_replace_iocb(vha, e);
+10
drivers/scsi/qla2xxx/qla_target.c
··· 1062 1062 "%s: sess %p logout completed\n", __func__, sess); 1063 1063 } 1064 1064 1065 + /* check for any straggling io left behind */ 1066 + if (!(sess->flags & FCF_FCP2_DEVICE) && 1067 + qla2x00_eh_wait_for_pending_commands(sess->vha, sess->d_id.b24, 0, WAIT_TARGET)) { 1068 + ql_log(ql_log_warn, vha, 0x3027, 1069 + "IO not return. Resetting.\n"); 1070 + set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); 1071 + qla2xxx_wake_dpc(vha); 1072 + qla2x00_wait_for_chip_reset(vha); 1073 + } 1074 + 1065 1075 if (sess->logo_ack_needed) { 1066 1076 sess->logo_ack_needed = 0; 1067 1077 qla24xx_async_notify_ack(vha, sess,
+2 -2
drivers/scsi/qla2xxx/qla_version.h
··· 6 6 /* 7 7 * Driver version 8 8 */ 9 - #define QLA2XXX_VERSION "10.02.09.100-k" 9 + #define QLA2XXX_VERSION "10.02.09.200-k" 10 10 11 11 #define QLA_DRIVER_MAJOR_VER 10 12 12 #define QLA_DRIVER_MINOR_VER 2 13 13 #define QLA_DRIVER_PATCH_VER 9 14 - #define QLA_DRIVER_BETA_VER 100 14 + #define QLA_DRIVER_BETA_VER 200
+34
drivers/scsi/scsi_scan.c
··· 1642 1642 } 1643 1643 EXPORT_SYMBOL(scsi_add_device); 1644 1644 1645 + int scsi_resume_device(struct scsi_device *sdev) 1646 + { 1647 + struct device *dev = &sdev->sdev_gendev; 1648 + int ret = 0; 1649 + 1650 + device_lock(dev); 1651 + 1652 + /* 1653 + * Bail out if the device or its queue are not running. Otherwise, 1654 + * the rescan may block waiting for commands to be executed, with us 1655 + * holding the device lock. This can result in a potential deadlock 1656 + * in the power management core code when system resume is on-going. 1657 + */ 1658 + if (sdev->sdev_state != SDEV_RUNNING || 1659 + blk_queue_pm_only(sdev->request_queue)) { 1660 + ret = -EWOULDBLOCK; 1661 + goto unlock; 1662 + } 1663 + 1664 + if (dev->driver && try_module_get(dev->driver->owner)) { 1665 + struct scsi_driver *drv = to_scsi_driver(dev->driver); 1666 + 1667 + if (drv->resume) 1668 + ret = drv->resume(dev); 1669 + module_put(dev->driver->owner); 1670 + } 1671 + 1672 + unlock: 1673 + device_unlock(dev); 1674 + 1675 + return ret; 1676 + } 1677 + EXPORT_SYMBOL(scsi_resume_device); 1678 + 1645 1679 int scsi_rescan_device(struct scsi_device *sdev) 1646 1680 { 1647 1681 struct device *dev = &sdev->sdev_gendev;
+19 -4
drivers/scsi/sd.c
··· 4108 4108 return sd_suspend_common(dev, true); 4109 4109 } 4110 4110 4111 - static int sd_resume(struct device *dev, bool runtime) 4111 + static int sd_resume(struct device *dev) 4112 + { 4113 + struct scsi_disk *sdkp = dev_get_drvdata(dev); 4114 + 4115 + sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 4116 + 4117 + if (opal_unlock_from_suspend(sdkp->opal_dev)) { 4118 + sd_printk(KERN_NOTICE, sdkp, "OPAL unlock failed\n"); 4119 + return -EIO; 4120 + } 4121 + 4122 + return 0; 4123 + } 4124 + 4125 + static int sd_resume_common(struct device *dev, bool runtime) 4112 4126 { 4113 4127 struct scsi_disk *sdkp = dev_get_drvdata(dev); 4114 4128 int ret; ··· 4138 4124 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 4139 4125 ret = sd_start_stop_device(sdkp, 1); 4140 4126 if (!ret) { 4141 - opal_unlock_from_suspend(sdkp->opal_dev); 4127 + sd_resume(dev); 4142 4128 sdkp->suspended = false; 4143 4129 } 4144 4130 ··· 4157 4143 return 0; 4158 4144 } 4159 4145 4160 - return sd_resume(dev, false); 4146 + return sd_resume_common(dev, false); 4161 4147 } 4162 4148 4163 4149 static int sd_resume_runtime(struct device *dev) ··· 4184 4170 "Failed to clear sense data\n"); 4185 4171 } 4186 4172 4187 - return sd_resume(dev, true); 4173 + return sd_resume_common(dev, true); 4188 4174 } 4189 4175 4190 4176 static const struct dev_pm_ops sd_pm_ops = { ··· 4207 4193 .pm = &sd_pm_ops, 4208 4194 }, 4209 4195 .rescan = sd_rescan, 4196 + .resume = sd_resume, 4210 4197 .init_command = sd_init_command, 4211 4198 .uninit_command = sd_uninit_command, 4212 4199 .done = sd_done,
+12 -10
drivers/scsi/sg.c
··· 1424 1424 .llseek = no_llseek, 1425 1425 }; 1426 1426 1427 - static struct class *sg_sysfs_class; 1427 + static const struct class sg_sysfs_class = { 1428 + .name = "scsi_generic" 1429 + }; 1428 1430 1429 1431 static int sg_sysfs_valid = 0; 1430 1432 ··· 1528 1526 if (sg_sysfs_valid) { 1529 1527 struct device *sg_class_member; 1530 1528 1531 - sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, 1529 + sg_class_member = device_create(&sg_sysfs_class, cl_dev->parent, 1532 1530 MKDEV(SCSI_GENERIC_MAJOR, 1533 1531 sdp->index), 1534 1532 sdp, "%s", sdp->name); ··· 1618 1616 read_unlock_irqrestore(&sdp->sfd_lock, iflags); 1619 1617 1620 1618 sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); 1621 - device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); 1619 + device_destroy(&sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); 1622 1620 cdev_del(sdp->cdev); 1623 1621 sdp->cdev = NULL; 1624 1622 ··· 1689 1687 SG_MAX_DEVS, "sg"); 1690 1688 if (rc) 1691 1689 return rc; 1692 - sg_sysfs_class = class_create("scsi_generic"); 1693 - if ( IS_ERR(sg_sysfs_class) ) { 1694 - rc = PTR_ERR(sg_sysfs_class); 1690 + rc = class_register(&sg_sysfs_class); 1691 + if (rc) 1695 1692 goto err_out; 1696 - } 1697 1693 sg_sysfs_valid = 1; 1698 1694 rc = scsi_register_interface(&sg_interface); 1699 1695 if (0 == rc) { ··· 1700 1700 #endif /* CONFIG_SCSI_PROC_FS */ 1701 1701 return 0; 1702 1702 } 1703 - class_destroy(sg_sysfs_class); 1703 + class_unregister(&sg_sysfs_class); 1704 1704 register_sg_sysctls(); 1705 1705 err_out: 1706 1706 unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); ··· 1715 1715 remove_proc_subtree("scsi/sg", NULL); 1716 1716 #endif /* CONFIG_SCSI_PROC_FS */ 1717 1717 scsi_unregister_interface(&sg_interface); 1718 - class_destroy(sg_sysfs_class); 1718 + class_unregister(&sg_sysfs_class); 1719 1719 sg_sysfs_valid = 0; 1720 1720 unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), 1721 1721 SG_MAX_DEVS); ··· 2207 2207 { 2208 2208 struct sg_fd *sfp = container_of(work, struct sg_fd, ew.work); 2209 2209 struct sg_device *sdp = sfp->parentdp; 2210 + struct scsi_device *device = sdp->device; 2210 2211 Sg_request *srp; 2211 2212 unsigned long iflags; 2212 2213 ··· 2233 2232 "sg_remove_sfp: sfp=0x%p\n", sfp)); 2234 2233 kfree(sfp); 2235 2234 2236 - scsi_device_put(sdp->device); 2235 + WARN_ON_ONCE(kref_read(&sdp->d_ref) != 1); 2237 2236 kref_put(&sdp->d_ref, sg_device_destroy); 2237 + scsi_device_put(device); 2238 2238 module_put(THIS_MODULE); 2239 2239 } 2240 2240
+2 -2
drivers/scsi/st.c
··· 87 87 static int try_wdio = 1; 88 88 static int debug_flag; 89 89 90 - static struct class st_sysfs_class; 90 + static const struct class st_sysfs_class; 91 91 static const struct attribute_group *st_dev_groups[]; 92 92 static const struct attribute_group *st_drv_groups[]; 93 93 ··· 4438 4438 return; 4439 4439 } 4440 4440 4441 - static struct class st_sysfs_class = { 4441 + static const struct class st_sysfs_class = { 4442 4442 .name = "scsi_tape", 4443 4443 .dev_groups = st_dev_groups, 4444 4444 };
+1 -2
drivers/target/iscsi/iscsi_target_erl1.c
··· 583 583 struct iscsi_pdu *pdu) 584 584 { 585 585 int i, send_recovery_r2t = 0, recovery = 0; 586 - u32 length = 0, offset = 0, pdu_count = 0, xfer_len = 0; 586 + u32 length = 0, offset = 0, pdu_count = 0; 587 587 struct iscsit_conn *conn = cmd->conn; 588 588 struct iscsi_pdu *first_pdu = NULL; 589 589 ··· 596 596 if (cmd->pdu_list[i].seq_no == pdu->seq_no) { 597 597 if (!first_pdu) 598 598 first_pdu = &cmd->pdu_list[i]; 599 - xfer_len += cmd->pdu_list[i].length; 600 599 pdu_count++; 601 600 } else if (pdu_count) 602 601 break;
+1 -1
drivers/ufs/core/ufs-mcq.c
··· 94 94 95 95 val = ufshcd_readl(hba, REG_UFS_MCQ_CFG); 96 96 val &= ~MCQ_CFG_MAC_MASK; 97 - val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds); 97 + val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds - 1); 98 98 ufshcd_writel(hba, val, REG_UFS_MCQ_CFG); 99 99 } 100 100 EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);
+4 -2
drivers/ufs/host/ufs-qcom.c
··· 1210 1210 1211 1211 list_for_each_entry(clki, head, list) { 1212 1212 if (!IS_ERR_OR_NULL(clki->clk) && 1213 - !strcmp(clki->name, "core_clk_unipro")) { 1214 - if (is_scale_up) 1213 + !strcmp(clki->name, "core_clk_unipro")) { 1214 + if (!clki->max_freq) 1215 + cycles_in_1us = 150; /* default for backwards compatibility */ 1216 + else if (is_scale_up) 1215 1217 cycles_in_1us = ceil(clki->max_freq, (1000 * 1000)); 1216 1218 else 1217 1219 cycles_in_1us = ceil(clk_get_rate(clki->clk), (1000 * 1000));
+1
include/linux/libata.h
··· 107 107 108 108 ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 20), /* Priority cmds sent to dev */ 109 109 ATA_DFLAG_CDL_ENABLED = (1 << 21), /* cmd duration limits is enabled */ 110 + ATA_DFLAG_RESUMING = (1 << 22), /* Device is resuming */ 110 111 ATA_DFLAG_DETACH = (1 << 24), 111 112 ATA_DFLAG_DETACHED = (1 << 25), 112 113 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
+1
include/scsi/scsi_driver.h
··· 12 12 struct scsi_driver { 13 13 struct device_driver gendrv; 14 14 15 + int (*resume)(struct device *); 15 16 void (*rescan)(struct device *); 16 17 blk_status_t (*init_command)(struct scsi_cmnd *); 17 18 void (*uninit_command)(struct scsi_cmnd *);
+1
include/scsi/scsi_host.h
··· 767 767 #define scsi_template_proc_dir(sht) NULL 768 768 #endif 769 769 extern void scsi_scan_host(struct Scsi_Host *); 770 + extern int scsi_resume_device(struct scsi_device *sdev); 770 771 extern int scsi_rescan_device(struct scsi_device *sdev); 771 772 extern void scsi_remove_host(struct Scsi_Host *); 772 773 extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
+1 -1
include/uapi/scsi/scsi_bsg_mpi3mr.h
··· 382 382 __u8 mpi_reply_type; 383 383 __u8 rsvd1; 384 384 __u16 rsvd2; 385 - __u8 reply_buf[1]; 385 + __u8 reply_buf[]; 386 386 }; 387 387 388 388 /**
+1
include/ufs/ufshcd.h
··· 328 328 * @op_runtime_config: called to config Operation and runtime regs Pointers 329 329 * @get_outstanding_cqs: called to get outstanding completion queues 330 330 * @config_esi: called to config Event Specific Interrupt 331 + * @config_scsi_dev: called to configure SCSI device parameters 331 332 */ 332 333 struct ufs_hba_variant_ops { 333 334 const char *name;