···50905090 /* NPort Recovery mode or node is just allocated */50915091 if (!lpfc_nlp_not_used(ndlp)) {50925092 /* A LOGO is completing and the node is in NPR state.50935093- * If this a fabric node that cleared its transport50945094- * registration, release the rpi.50935093+ * Just unregister the RPI because the node is still50945094+ * required.50955095 */50965096- spin_lock_irq(&ndlp->lock);50975097- ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;50985098- if (phba->sli_rev == LPFC_SLI_REV4)50995099- ndlp->nlp_flag |= NLP_RELEASE_RPI;51005100- spin_unlock_irq(&ndlp->lock);51015096 lpfc_unreg_rpi(vport, ndlp);51025097 } else {51035098 /* Indicate the node has already released, should
···142142143143#define MPT_MAX_CALLBACKS 32144144145145+#define MPT_MAX_HBA_NUM_PHYS 32146146+145147#define INTERNAL_CMDS_COUNT 10 /* reserved cmds */146148/* reserved for issuing internally framed scsi io cmds */147149#define INTERNAL_SCSIIO_CMDS_COUNT 3···800798 * @enclosure_handle: handle for this a member of an enclosure801799 * @device_info: bitwise defining capabilities of this sas_host/expander802800 * @responding: used in _scsih_expander_device_mark_responding801801+ * @nr_phys_allocated: Allocated memory for this many count phys803802 * @phy: a list of phys that make up this sas_host/expander804803 * @sas_port_list: list of ports attached to this sas_host/expander805804 * @port: hba port entry containing node's port number info···816813 u16 enclosure_handle;817814 u64 enclosure_logical_id;818815 u8 responding;816816+ u8 nr_phys_allocated;819817 struct hba_port *port;820818 struct _sas_phy *phy;821819 struct list_head sas_port_list;
+57-2
drivers/scsi/mpt3sas/mpt3sas_scsih.c
···3869386938703870 shost_for_each_device(sdev, ioc->shost) {38713871 sas_device_priv_data = sdev->hostdata;38723872- if (!sas_device_priv_data)38723872+ if (!sas_device_priv_data || !sas_device_priv_data->sas_target)38733873 continue;38743874 if (sas_device_priv_data->sas_target->sas_address38753875 != sas_address)···64066406 int i, j, count = 0, lcount = 0;64076407 int ret;64086408 u64 sas_addr;64096409+ u8 num_phys;6409641064106411 drsprintk(ioc, ioc_info(ioc,64116412 "updating ports for sas_host(0x%016llx)\n",64126413 (unsigned long long)ioc->sas_hba.sas_address));64146414+64156415+ mpt3sas_config_get_number_hba_phys(ioc, &num_phys);64166416+ if (!num_phys) {64176417+ ioc_err(ioc, "failure at %s:%d/%s()!\n",64186418+ __FILE__, __LINE__, __func__);64196419+ return;64206420+ }64216421+64226422+ if (num_phys > ioc->sas_hba.nr_phys_allocated) {64236423+ ioc_err(ioc, "failure at %s:%d/%s()!\n",64246424+ __FILE__, __LINE__, __func__);64256425+ return;64266426+ }64276427+ ioc->sas_hba.num_phys = num_phys;6413642864146429 port_table = kcalloc(ioc->sas_hba.num_phys,64156430 sizeof(struct hba_port), GFP_KERNEL);···66266611 ioc->sas_hba.phy[i].hba_vphy = 1;66276612 }6628661366146614+ /*66156615+ * Add new HBA phys to STL if these new phys got added as part66166616+ * of HBA Firmware upgrade/downgrade operation.66176617+ */66186618+ if (!ioc->sas_hba.phy[i].phy) {66196619+ if ((mpt3sas_config_get_phy_pg0(ioc, &mpi_reply,66206620+ &phy_pg0, i))) {66216621+ ioc_err(ioc, "failure at %s:%d/%s()!\n",66226622+ __FILE__, __LINE__, __func__);66236623+ continue;66246624+ }66256625+ ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &66266626+ MPI2_IOCSTATUS_MASK;66276627+ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {66286628+ ioc_err(ioc, "failure at %s:%d/%s()!\n",66296629+ __FILE__, __LINE__, __func__);66306630+ continue;66316631+ }66326632+ ioc->sas_hba.phy[i].phy_id = i;66336633+ mpt3sas_transport_add_host_phy(ioc,66346634+ &ioc->sas_hba.phy[i], phy_pg0,66356635+ ioc->sas_hba.parent_dev);66366636+ continue;66376637+ }66296638 ioc->sas_hba.phy[i].handle = ioc->sas_hba.handle;66306639 attached_handle = le16_to_cpu(sas_iounit_pg0->PhyData[i].66316640 AttachedDevHandle);···66606621 mpt3sas_transport_update_links(ioc, ioc->sas_hba.sas_address,66616622 attached_handle, i, link_rate,66626623 ioc->sas_hba.phy[i].port);66246624+ }66256625+ /*66266626+ * Clear the phy details if this phy got disabled as part of66276627+ * HBA Firmware upgrade/downgrade operation.66286628+ */66296629+ for (i = ioc->sas_hba.num_phys;66306630+ i < ioc->sas_hba.nr_phys_allocated; i++) {66316631+ if (ioc->sas_hba.phy[i].phy &&66326632+ ioc->sas_hba.phy[i].phy->negotiated_linkrate >=66336633+ SAS_LINK_RATE_1_5_GBPS)66346634+ mpt3sas_transport_update_links(ioc,66356635+ ioc->sas_hba.sas_address, 0, i,66366636+ MPI2_SAS_NEG_LINK_RATE_PHY_DISABLED, NULL);66636637 }66646638 out:66656639 kfree(sas_iounit_pg0);···67066654 __FILE__, __LINE__, __func__);67076655 return;67086656 }67096709- ioc->sas_hba.phy = kcalloc(num_phys,66576657+66586658+ ioc->sas_hba.nr_phys_allocated = max_t(u8,66596659+ MPT_MAX_HBA_NUM_PHYS, num_phys);66606660+ ioc->sas_hba.phy = kcalloc(ioc->sas_hba.nr_phys_allocated,67106661 sizeof(struct _sas_phy), GFP_KERNEL);67116662 if (!ioc->sas_hba.phy) {67126663 ioc_err(ioc, "failure at %s:%d/%s()!\n",
+2-4
drivers/scsi/pm8001/pm8001_init.c
···282282 if (rc) {283283 pm8001_dbg(pm8001_ha, FAIL,284284 "pm8001_setup_irq failed [ret: %d]\n", rc);285285- goto err_out_shost;285285+ goto err_out;286286 }287287 /* Request Interrupt */288288 rc = pm8001_request_irq(pm8001_ha);289289 if (rc)290290- goto err_out_shost;290290+ goto err_out;291291292292 count = pm8001_ha->max_q_num;293293 /* Queues are chosen based on the number of cores/msix availability */···423423 pm8001_tag_init(pm8001_ha);424424 return 0;425425426426-err_out_shost:427427- scsi_remove_host(pm8001_ha->shost);428426err_out_nodev:429427 for (i = 0; i < pm8001_ha->max_memcnt; i++) {430428 if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) {
···865865 "APP request entry - portid=%06x.\n", tdid.b24);866866867867 /* Ran out of space */868868- if (pcnt > app_req.num_ports)868868+ if (pcnt >= app_req.num_ports)869869 break;870870871871 if (tdid.b24 != 0 && tdid.b24 != fcport->d_id.b24)
···797797 int i, ret;798798 struct scsi_device *sdev = to_scsi_device(dev);799799 enum scsi_device_state state = 0;800800+ bool rescan_dev = false;800801801802 for (i = 0; i < ARRAY_SIZE(sdev_states); i++) {802803 const int len = strlen(sdev_states[i].name);···816815 }817816818817 mutex_lock(&sdev->state_mutex);819819- ret = scsi_device_set_state(sdev, state);820820- /*821821- * If the device state changes to SDEV_RUNNING, we need to822822- * run the queue to avoid I/O hang, and rescan the device823823- * to revalidate it. Running the queue first is necessary824824- * because another thread may be waiting inside825825- * blk_mq_freeze_queue_wait() and because that call may be826826- * waiting for pending I/O to finish.827827- */828828- if (ret == 0 && state == SDEV_RUNNING) {818818+ if (sdev->sdev_state == SDEV_RUNNING && state == SDEV_RUNNING) {819819+ ret = 0;820820+ } else {821821+ ret = scsi_device_set_state(sdev, state);822822+ if (ret == 0 && state == SDEV_RUNNING)823823+ rescan_dev = true;824824+ }825825+ mutex_unlock(&sdev->state_mutex);826826+827827+ if (rescan_dev) {828828+ /*829829+ * If the device state changes to SDEV_RUNNING, we need to830830+ * run the queue to avoid I/O hang, and rescan the device831831+ * to revalidate it. Running the queue first is necessary832832+ * because another thread may be waiting inside833833+ * blk_mq_freeze_queue_wait() and because that call may be834834+ * waiting for pending I/O to finish.835835+ */829836 blk_mq_run_hw_queues(sdev->request_queue, true);830837 scsi_rescan_device(dev);831838 }832832- mutex_unlock(&sdev->state_mutex);833839834840 return ret == 0 ? count : -EINVAL;835841}