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-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI updates from James Bottomley:
"Updates to the usual drivers (ufs, lpfc, hisi_sas, st).

Amazingly enough, no core changes with the biggest set of driver
changes being ufs (which conflicted with it's own fixes a bit, hence
the merges) and the rest being minor fixes and updates"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (97 commits)
scsi: st: New session only when Unit Attention for new tape
scsi: st: Add MTIOCGET and MTLOAD to ioctls allowed after device reset
scsi: st: Don't modify unknown block number in MTIOCGET
scsi: ufs: core: Restore SM8650 support
scsi: sun3: Mark driver struct with __refdata to prevent section mismatch
scsi: sg: Enable runtime power management
scsi: qedi: Fix a possible memory leak in qedi_alloc_and_init_sb()
scsi: qedf: Fix a possible memory leak in qedf_alloc_and_init_sb()
scsi: fusion: Remove unused variable 'rc'
scsi: bfa: Fix use-after-free in bfad_im_module_exit()
scsi: esas2r: Remove unused esas2r_build_cli_req()
scsi: target: Fix incorrect function name in pscsi_create_type_disk()
scsi: ufs: Replace deprecated PCI functions
scsi: Switch back to struct platform_driver::remove()
scsi: pm8001: Increase request sg length to support 4MiB requests
scsi: pm8001: Initialize devices in pm8001_alloc_dev()
scsi: pm8001: Use module param to set pcs event log severity
scsi: ufs: ufs-mediatek: Configure individual LU queue flags
scsi: MAINTAINERS: Update UFS Exynos entry
scsi: lpfc: Copyright updates for 14.4.0.6 patches
...

+1411 -1856
+2
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
··· 26 26 - qcom,msm8994-ufshc 27 27 - qcom,msm8996-ufshc 28 28 - qcom,msm8998-ufshc 29 + - qcom,qcs8300-ufshc 29 30 - qcom,sa8775p-ufshc 30 31 - qcom,sc7180-ufshc 31 32 - qcom,sc7280-ufshc ··· 147 146 contains: 148 147 enum: 149 148 - qcom,msm8998-ufshc 149 + - qcom,qcs8300-ufshc 150 150 - qcom,sa8775p-ufshc 151 151 - qcom,sc7280-ufshc 152 152 - qcom,sc8180x-ufshc
+2
MAINTAINERS
··· 23993 23993 23994 23994 UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER EXYNOS HOOKS 23995 23995 M: Alim Akhtar <alim.akhtar@samsung.com> 23996 + R: Peter Griffin <peter.griffin@linaro.org> 23996 23997 L: linux-scsi@vger.kernel.org 23998 + L: linux-samsung-soc@vger.kernel.org 23997 23999 S: Maintained 23998 24000 F: drivers/ufs/host/ufs-exynos* 23999 24001
-3
drivers/message/fusion/mptlan.h
··· 51 51 #define LINUX_MPTLAN_H_INCLUDED 52 52 /*****************************************************************************/ 53 53 54 - #if !defined(__GENKSYMS__) 55 54 #include <linux/module.h> 56 - #endif 57 - 58 55 #include <linux/netdevice.h> 59 56 #include <linux/errno.h> 60 57 // #include <linux/etherdevice.h>
+1 -3
drivers/message/fusion/mptsas.c
··· 4231 4231 static void 4232 4232 mptsas_reprobe_lun(struct scsi_device *sdev, void *data) 4233 4233 { 4234 - int rc; 4235 - 4236 4234 sdev->no_uld_attach = data ? 1 : 0; 4237 - rc = scsi_device_reprobe(sdev); 4235 + WARN_ON(scsi_device_reprobe(sdev)); 4238 4236 } 4239 4237 4240 4238 static void
+3 -3
drivers/scsi/a3000.c
··· 302 302 * triggering a section mismatch warning. 303 303 */ 304 304 static struct platform_driver amiga_a3000_scsi_driver __refdata = { 305 - .remove_new = __exit_p(amiga_a3000_scsi_remove), 306 - .driver = { 307 - .name = "amiga-a3000-scsi", 305 + .remove = __exit_p(amiga_a3000_scsi_remove), 306 + .driver = { 307 + .name = "amiga-a3000-scsi", 308 308 }, 309 309 }; 310 310
+3 -3
drivers/scsi/a4000t.c
··· 115 115 * triggering a section mismatch warning. 116 116 */ 117 117 static struct platform_driver amiga_a4000t_scsi_driver __refdata = { 118 - .remove_new = __exit_p(amiga_a4000t_scsi_remove), 119 - .driver = { 120 - .name = "amiga-a4000t-scsi", 118 + .remove = __exit_p(amiga_a4000t_scsi_remove), 119 + .driver = { 120 + .name = "amiga-a4000t-scsi", 121 121 }, 122 122 }; 123 123
-1
drivers/scsi/aacraid/aacraid.h
··· 2736 2736 int isAif, int isFastResponse, 2737 2737 struct hw_fib *aif_fib); 2738 2738 int aac_reset_adapter(struct aac_dev *dev, int forced, u8 reset_type); 2739 - int aac_check_health(struct aac_dev * dev); 2740 2739 int aac_command_thread(void *data); 2741 2740 int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx); 2742 2741 int aac_fib_adapter_complete(struct fib * fibptr, unsigned short size);
-121
drivers/scsi/aacraid/commsup.c
··· 1698 1698 return retval; 1699 1699 } 1700 1700 1701 - int aac_check_health(struct aac_dev * aac) 1702 - { 1703 - int BlinkLED; 1704 - unsigned long time_now, flagv = 0; 1705 - struct list_head * entry; 1706 - 1707 - /* Extending the scope of fib_lock slightly to protect aac->in_reset */ 1708 - if (spin_trylock_irqsave(&aac->fib_lock, flagv) == 0) 1709 - return 0; 1710 - 1711 - if (aac->in_reset || !(BlinkLED = aac_adapter_check_health(aac))) { 1712 - spin_unlock_irqrestore(&aac->fib_lock, flagv); 1713 - return 0; /* OK */ 1714 - } 1715 - 1716 - aac->in_reset = 1; 1717 - 1718 - /* Fake up an AIF: 1719 - * aac_aifcmd.command = AifCmdEventNotify = 1 1720 - * aac_aifcmd.seqnum = 0xFFFFFFFF 1721 - * aac_aifcmd.data[0] = AifEnExpEvent = 23 1722 - * aac_aifcmd.data[1] = AifExeFirmwarePanic = 3 1723 - * aac.aifcmd.data[2] = AifHighPriority = 3 1724 - * aac.aifcmd.data[3] = BlinkLED 1725 - */ 1726 - 1727 - time_now = jiffies/HZ; 1728 - entry = aac->fib_list.next; 1729 - 1730 - /* 1731 - * For each Context that is on the 1732 - * fibctxList, make a copy of the 1733 - * fib, and then set the event to wake up the 1734 - * thread that is waiting for it. 1735 - */ 1736 - while (entry != &aac->fib_list) { 1737 - /* 1738 - * Extract the fibctx 1739 - */ 1740 - struct aac_fib_context *fibctx = list_entry(entry, struct aac_fib_context, next); 1741 - struct hw_fib * hw_fib; 1742 - struct fib * fib; 1743 - /* 1744 - * Check if the queue is getting 1745 - * backlogged 1746 - */ 1747 - if (fibctx->count > 20) { 1748 - /* 1749 - * It's *not* jiffies folks, 1750 - * but jiffies / HZ, so do not 1751 - * panic ... 1752 - */ 1753 - u32 time_last = fibctx->jiffies; 1754 - /* 1755 - * Has it been > 2 minutes 1756 - * since the last read off 1757 - * the queue? 1758 - */ 1759 - if ((time_now - time_last) > aif_timeout) { 1760 - entry = entry->next; 1761 - aac_close_fib_context(aac, fibctx); 1762 - continue; 1763 - } 1764 - } 1765 - /* 1766 - * Warning: no sleep allowed while 1767 - * holding spinlock 1768 - */ 1769 - hw_fib = kzalloc(sizeof(struct hw_fib), GFP_ATOMIC); 1770 - fib = kzalloc(sizeof(struct fib), GFP_ATOMIC); 1771 - if (fib && hw_fib) { 1772 - struct aac_aifcmd * aif; 1773 - 1774 - fib->hw_fib_va = hw_fib; 1775 - fib->dev = aac; 1776 - aac_fib_init(fib); 1777 - fib->type = FSAFS_NTC_FIB_CONTEXT; 1778 - fib->size = sizeof (struct fib); 1779 - fib->data = hw_fib->data; 1780 - aif = (struct aac_aifcmd *)hw_fib->data; 1781 - aif->command = cpu_to_le32(AifCmdEventNotify); 1782 - aif->seqnum = cpu_to_le32(0xFFFFFFFF); 1783 - ((__le32 *)aif->data)[0] = cpu_to_le32(AifEnExpEvent); 1784 - ((__le32 *)aif->data)[1] = cpu_to_le32(AifExeFirmwarePanic); 1785 - ((__le32 *)aif->data)[2] = cpu_to_le32(AifHighPriority); 1786 - ((__le32 *)aif->data)[3] = cpu_to_le32(BlinkLED); 1787 - 1788 - /* 1789 - * Put the FIB onto the 1790 - * fibctx's fibs 1791 - */ 1792 - list_add_tail(&fib->fiblink, &fibctx->fib_list); 1793 - fibctx->count++; 1794 - /* 1795 - * Set the event to wake up the 1796 - * thread that will waiting. 1797 - */ 1798 - complete(&fibctx->completion); 1799 - } else { 1800 - printk(KERN_WARNING "aifd: didn't allocate NewFib.\n"); 1801 - kfree(fib); 1802 - kfree(hw_fib); 1803 - } 1804 - entry = entry->next; 1805 - } 1806 - 1807 - spin_unlock_irqrestore(&aac->fib_lock, flagv); 1808 - 1809 - if (BlinkLED < 0) { 1810 - printk(KERN_ERR "%s: Host adapter is dead (or got a PCI error) %d\n", 1811 - aac->name, BlinkLED); 1812 - goto out; 1813 - } 1814 - 1815 - printk(KERN_ERR "%s: Host adapter BLINK LED 0x%x\n", aac->name, BlinkLED); 1816 - 1817 - out: 1818 - aac->in_reset = 0; 1819 - return BlinkLED; 1820 - } 1821 - 1822 1701 static inline int is_safw_raid_volume(struct aac_dev *aac, int bus, int target) 1823 1702 { 1824 1703 return bus == CONTAINER_CHANNEL && target < aac->maximum_num_containers;
-15
drivers/scsi/aic7xxx/aic7770.c
··· 99 99 ahc_aic7770_EISA_setup 100 100 } 101 101 }; 102 - const int ahc_num_aic7770_devs = ARRAY_SIZE(aic7770_ident_table); 103 - 104 - struct aic7770_identity * 105 - aic7770_find_device(uint32_t id) 106 - { 107 - struct aic7770_identity *entry; 108 - int i; 109 - 110 - for (i = 0; i < ahc_num_aic7770_devs; i++) { 111 - entry = &aic7770_ident_table[i]; 112 - if (entry->full_id == (id & entry->id_mask)) 113 - return (entry); 114 - } 115 - return (NULL); 116 - } 117 102 118 103 int 119 104 aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io)
-2
drivers/scsi/aic7xxx/aic7xxx.h
··· 1119 1119 ahc_device_setup_t *setup; 1120 1120 }; 1121 1121 extern struct aic7770_identity aic7770_ident_table[]; 1122 - extern const int ahc_num_aic7770_devs; 1123 1122 1124 1123 #define AHC_EISA_SLOT_OFFSET 0xc00 1125 1124 #define AHC_EISA_IOSIZE 0x100 ··· 1134 1135 void __maybe_unused ahc_pci_resume(struct ahc_softc *ahc); 1135 1136 1136 1137 /*************************** EISA/VL Front End ********************************/ 1137 - struct aic7770_identity *aic7770_find_device(uint32_t); 1138 1138 int aic7770_config(struct ahc_softc *ahc, 1139 1139 struct aic7770_identity *, 1140 1140 u_int port);
+1 -1
drivers/scsi/atari_scsi.c
··· 885 885 * triggering a section mismatch warning. 886 886 */ 887 887 static struct platform_driver atari_scsi_driver __refdata = { 888 - .remove_new = __exit_p(atari_scsi_remove), 888 + .remove = __exit_p(atari_scsi_remove), 889 889 .driver = { 890 890 .name = DRV_MODULE_NAME, 891 891 },
-10
drivers/scsi/bfa/bfa.h
··· 138 138 } while (0) 139 139 140 140 141 - /* 142 - * PCI devices supported by the current BFA 143 - */ 144 - struct bfa_pciid_s { 145 - u16 device_id; 146 - u16 vendor_id; 147 - }; 148 - 149 141 extern char bfa_version[]; 150 142 151 143 struct bfa_iocfc_regs_s { ··· 400 408 (((&(_bfa)->modules.dconf_mod)->min_cfg) \ 401 409 ? BFA_LUNMASK_MINCFG : ((bfa_get_lun_mask(_bfa))->status)) 402 410 403 - void bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids); 404 411 void bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg); 405 - void bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg); 406 412 void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, 407 413 struct bfa_meminfo_s *meminfo, 408 414 struct bfa_s *bfa);
-35
drivers/scsi/bfa/bfa_core.c
··· 1934 1934 } 1935 1935 1936 1936 /* 1937 - * Return the list of PCI vendor/device id lists supported by this 1938 - * BFA instance. 1939 - */ 1940 - void 1941 - bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids) 1942 - { 1943 - static struct bfa_pciid_s __pciids[] = { 1944 - {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_FC_8G2P}, 1945 - {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_FC_8G1P}, 1946 - {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT}, 1947 - {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT_FC}, 1948 - }; 1949 - 1950 - *npciids = ARRAY_SIZE(__pciids); 1951 - *pciids = __pciids; 1952 - } 1953 - 1954 - /* 1955 1937 * Use this function query the default struct bfa_iocfc_cfg_s value (compiled 1956 1938 * into BFA layer). The OS driver can then turn back and overwrite entries that 1957 1939 * have been configured by the user. ··· 1968 1986 cfg->drvcfg.ioc_recover = BFA_FALSE; 1969 1987 cfg->drvcfg.delay_comp = BFA_FALSE; 1970 1988 1971 - } 1972 - 1973 - void 1974 - bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg) 1975 - { 1976 - bfa_cfg_get_default(cfg); 1977 - cfg->fwcfg.num_ioim_reqs = BFA_IOIM_MIN; 1978 - cfg->fwcfg.num_tskim_reqs = BFA_TSKIM_MIN; 1979 - cfg->fwcfg.num_fcxp_reqs = BFA_FCXP_MIN; 1980 - cfg->fwcfg.num_uf_bufs = BFA_UF_MIN; 1981 - cfg->fwcfg.num_rports = BFA_RPORT_MIN; 1982 - cfg->fwcfg.num_fwtio_reqs = 0; 1983 - 1984 - cfg->drvcfg.num_sgpgs = BFA_SGPG_MIN; 1985 - cfg->drvcfg.num_reqq_elems = BFA_REQQ_NELEMS_MIN; 1986 - cfg->drvcfg.num_rspq_elems = BFA_RSPQ_NELEMS_MIN; 1987 - cfg->drvcfg.min_cfg = BFA_TRUE; 1988 1989 }
-22
drivers/scsi/bfa/bfa_defs_fcs.h
··· 125 125 }; 126 126 127 127 /* 128 - * FCS lport info. 129 - */ 130 - struct bfa_lport_info_s { 131 - u8 port_type; /* bfa_lport_type_t : physical or 132 - * virtual */ 133 - u8 port_state; /* one of bfa_lport_state values */ 134 - u8 offline_reason; /* one of bfa_lport_offline_reason_t 135 - * values */ 136 - wwn_t port_wwn; 137 - wwn_t node_wwn; 138 - 139 - /* 140 - * following 4 feilds are valid for Physical Ports only 141 - */ 142 - u32 max_vports_supp; /* Max supported vports */ 143 - u32 num_vports_inuse; /* Num of in use vports */ 144 - u32 max_rports_supp; /* Max supported rports */ 145 - u32 num_rports_inuse; /* Num of doscovered rports */ 146 - 147 - }; 148 - 149 - /* 150 128 * FCS port statistics 151 129 */ 152 130 struct bfa_lport_stats_s {
-9
drivers/scsi/bfa/bfa_fcpim.c
··· 3413 3413 } 3414 3414 3415 3415 /* 3416 - * Notification on completions from related ioim. 3417 - */ 3418 - void 3419 - bfa_tskim_iodone(struct bfa_tskim_s *tskim) 3420 - { 3421 - bfa_wc_down(&tskim->wc); 3422 - } 3423 - 3424 - /* 3425 3416 * Handle IOC h/w failure notification from itnim. 3426 3417 */ 3427 3418 void
-1
drivers/scsi/bfa/bfa_fcpim.h
··· 339 339 340 340 void bfa_tskim_attach(struct bfa_fcpim_s *fcpim); 341 341 void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 342 - void bfa_tskim_iodone(struct bfa_tskim_s *tskim); 343 342 void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); 344 343 void bfa_tskim_cleanup(struct bfa_tskim_s *tskim); 345 344 void bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw);
-12
drivers/scsi/bfa/bfa_fcs.h
··· 373 373 struct bfa_fcs_lport_s *bfa_fcs_get_base_port(struct bfa_fcs_s *fcs); 374 374 void bfa_fcs_lport_get_rport_quals(struct bfa_fcs_lport_s *port, 375 375 struct bfa_rport_qualifier_s rport[], int *nrports); 376 - wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, 377 - int index, int nrports, bfa_boolean_t bwwn); 378 376 379 377 struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, 380 378 u16 vf_id, wwn_t lpwwn); 381 379 382 380 void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname); 383 - void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, 384 - struct bfa_lport_info_s *port_info); 385 381 void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port, 386 382 struct bfa_lport_attr_s *port_attr); 387 383 void bfa_fcs_lport_get_stats(struct bfa_fcs_lport_s *fcs_port, ··· 412 416 struct bfa_fcs_lport_s *port, u32 pid); 413 417 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pwwn( 414 418 struct bfa_fcs_lport_s *port, wwn_t pwwn); 415 - struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_nwwn( 416 - struct bfa_fcs_lport_s *port, wwn_t nwwn); 417 419 struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_qualifier( 418 420 struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 pid); 419 421 void bfa_fcs_lport_add_rport(struct bfa_fcs_lport_s *port, ··· 480 486 struct bfa_fcs_s *fcs, u16 vf_id, 481 487 struct bfa_lport_cfg_s *port_cfg, 482 488 struct bfad_vport_s *vport_drv); 483 - bfa_boolean_t bfa_fcs_is_pbc_vport(struct bfa_fcs_vport_s *vport); 484 489 bfa_status_t bfa_fcs_vport_delete(struct bfa_fcs_vport_s *vport); 485 490 bfa_status_t bfa_fcs_vport_start(struct bfa_fcs_vport_s *vport); 486 491 bfa_status_t bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport); ··· 487 494 struct bfa_vport_attr_s *vport_attr); 488 495 struct bfa_fcs_vport_s *bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs, 489 496 u16 vf_id, wwn_t vpwwn); 490 - void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport); 491 497 void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport); 492 498 void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport); 493 499 void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport); ··· 615 623 struct bfa_rport_attr_s *attr); 616 624 struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port, 617 625 wwn_t rpwwn); 618 - struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn( 619 - struct bfa_fcs_lport_s *port, wwn_t rnwwn); 620 626 void bfa_fcs_rport_set_del_timeout(u8 rport_tmo); 621 627 void bfa_fcs_rport_set_max_logins(u32 max_logins); 622 628 void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, ··· 623 633 624 634 struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port, 625 635 u32 pid); 626 - void bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs, 627 - struct fc_logi_s *plogi_rsp); 628 636 void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, 629 637 struct fchs_s *rx_fchs, 630 638 struct fc_logi_s *plogi);
-142
drivers/scsi/bfa/bfa_fcs_lport.c
··· 938 938 } 939 939 940 940 /* 941 - * NWWN based Lookup for a R-Port in the Port R-Port Queue 942 - */ 943 - struct bfa_fcs_rport_s * 944 - bfa_fcs_lport_get_rport_by_nwwn(struct bfa_fcs_lport_s *port, wwn_t nwwn) 945 - { 946 - struct bfa_fcs_rport_s *rport; 947 - struct list_head *qe; 948 - 949 - list_for_each(qe, &port->rport_q) { 950 - rport = (struct bfa_fcs_rport_s *) qe; 951 - if (wwn_is_equal(rport->nwwn, nwwn)) 952 - return rport; 953 - } 954 - 955 - bfa_trc(port->fcs, nwwn); 956 - return NULL; 957 - } 958 - 959 - /* 960 941 * PWWN & PID based Lookup for a R-Port in the Port R-Port Queue 961 942 */ 962 943 struct bfa_fcs_rport_s * ··· 5626 5645 return &fcs->fabric.bport; 5627 5646 } 5628 5647 5629 - wwn_t 5630 - bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, int index, 5631 - int nrports, bfa_boolean_t bwwn) 5632 - { 5633 - struct list_head *qh, *qe; 5634 - struct bfa_fcs_rport_s *rport = NULL; 5635 - int i; 5636 - struct bfa_fcs_s *fcs; 5637 - 5638 - if (port == NULL || nrports == 0) 5639 - return (wwn_t) 0; 5640 - 5641 - fcs = port->fcs; 5642 - bfa_trc(fcs, (u32) nrports); 5643 - 5644 - i = 0; 5645 - qh = &port->rport_q; 5646 - qe = bfa_q_first(qh); 5647 - 5648 - while ((qe != qh) && (i < nrports)) { 5649 - rport = (struct bfa_fcs_rport_s *) qe; 5650 - if (bfa_ntoh3b(rport->pid) > 0xFFF000) { 5651 - qe = bfa_q_next(qe); 5652 - bfa_trc(fcs, (u32) rport->pwwn); 5653 - bfa_trc(fcs, rport->pid); 5654 - bfa_trc(fcs, i); 5655 - continue; 5656 - } 5657 - 5658 - if (bwwn) { 5659 - if (!memcmp(&wwn, &rport->pwwn, 8)) 5660 - break; 5661 - } else { 5662 - if (i == index) 5663 - break; 5664 - } 5665 - 5666 - i++; 5667 - qe = bfa_q_next(qe); 5668 - } 5669 - 5670 - bfa_trc(fcs, i); 5671 - if (rport) 5672 - return rport->pwwn; 5673 - else 5674 - return (wwn_t) 0; 5675 - } 5676 - 5677 5648 void 5678 5649 bfa_fcs_lport_get_rport_quals(struct bfa_fcs_lport_s *port, 5679 5650 struct bfa_rport_qualifier_s rports[], int *nrports) ··· 5754 5821 return &vport->lport; 5755 5822 5756 5823 return NULL; 5757 - } 5758 - 5759 - /* 5760 - * API corresponding to NPIV_VPORT_GETINFO. 5761 - */ 5762 - void 5763 - bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, 5764 - struct bfa_lport_info_s *port_info) 5765 - { 5766 - 5767 - bfa_trc(port->fcs, port->fabric->fabric_name); 5768 - 5769 - if (port->vport == NULL) { 5770 - /* 5771 - * This is a Physical port 5772 - */ 5773 - port_info->port_type = BFA_LPORT_TYPE_PHYSICAL; 5774 - 5775 - /* 5776 - * @todo : need to fix the state & reason 5777 - */ 5778 - port_info->port_state = 0; 5779 - port_info->offline_reason = 0; 5780 - 5781 - port_info->port_wwn = bfa_fcs_lport_get_pwwn(port); 5782 - port_info->node_wwn = bfa_fcs_lport_get_nwwn(port); 5783 - 5784 - port_info->max_vports_supp = 5785 - bfa_lps_get_max_vport(port->fcs->bfa); 5786 - port_info->num_vports_inuse = 5787 - port->fabric->num_vports; 5788 - port_info->max_rports_supp = BFA_FCS_MAX_RPORTS_SUPP; 5789 - port_info->num_rports_inuse = port->num_rports; 5790 - } else { 5791 - /* 5792 - * This is a virtual port 5793 - */ 5794 - port_info->port_type = BFA_LPORT_TYPE_VIRTUAL; 5795 - 5796 - /* 5797 - * @todo : need to fix the state & reason 5798 - */ 5799 - port_info->port_state = 0; 5800 - port_info->offline_reason = 0; 5801 - 5802 - port_info->port_wwn = bfa_fcs_lport_get_pwwn(port); 5803 - port_info->node_wwn = bfa_fcs_lport_get_nwwn(port); 5804 - } 5805 5824 } 5806 5825 5807 5826 void ··· 6453 6568 } 6454 6569 6455 6570 /* 6456 - * Cleanup notification from fabric SM on link timer expiry. 6457 - */ 6458 - void 6459 - bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport) 6460 - { 6461 - vport->vport_stats.fab_cleanup++; 6462 - } 6463 - 6464 - /* 6465 6571 * Stop notification from fabric SM. To be invoked from within FCS. 6466 6572 */ 6467 6573 void ··· 6572 6696 vport->lport.port_cfg.preboot_vp = BFA_TRUE; 6573 6697 6574 6698 return rc; 6575 - } 6576 - 6577 - /* 6578 - * Use this function to findout if this is a pbc vport or not. 6579 - * 6580 - * @param[in] vport - pointer to bfa_fcs_vport_t. 6581 - * 6582 - * @returns None 6583 - */ 6584 - bfa_boolean_t 6585 - bfa_fcs_is_pbc_vport(struct bfa_fcs_vport_s *vport) 6586 - { 6587 - 6588 - if (vport && (vport->lport.port_cfg.preboot_vp == BFA_TRUE)) 6589 - return BFA_TRUE; 6590 - else 6591 - return BFA_FALSE; 6592 - 6593 6699 } 6594 6700 6595 6701 /*
-36
drivers/scsi/bfa/bfa_fcs_rport.c
··· 2646 2646 bfa_sm_send_event(rport, RPSM_EVENT_ADDRESS_DISC); 2647 2647 return rport; 2648 2648 } 2649 - /* 2650 - * Called by bport in private loop topology to indicate that a 2651 - * rport has been discovered and plogi has been completed. 2652 - * 2653 - * @param[in] port - base port or vport 2654 - * @param[in] rpid - remote port ID 2655 - */ 2656 - void 2657 - bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *fchs, 2658 - struct fc_logi_s *plogi) 2659 - { 2660 - struct bfa_fcs_rport_s *rport; 2661 - 2662 - rport = bfa_fcs_rport_alloc(port, WWN_NULL, fchs->s_id); 2663 - if (!rport) 2664 - return; 2665 - 2666 - bfa_fcs_rport_update(rport, plogi); 2667 - 2668 - bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_COMP); 2669 - } 2670 2649 2671 2650 /* 2672 2651 * Called by bport/vport to handle PLOGI received from a new remote port. ··· 3059 3080 struct bfa_fcs_rport_s *rport; 3060 3081 3061 3082 rport = bfa_fcs_lport_get_rport_by_pwwn(port, rpwwn); 3062 - if (rport == NULL) { 3063 - /* 3064 - * TBD Error handling 3065 - */ 3066 - } 3067 - 3068 - return rport; 3069 - } 3070 - 3071 - struct bfa_fcs_rport_s * 3072 - bfa_fcs_rport_lookup_by_nwwn(struct bfa_fcs_lport_s *port, wwn_t rnwwn) 3073 - { 3074 - struct bfa_fcs_rport_s *rport; 3075 - 3076 - rport = bfa_fcs_lport_get_rport_by_nwwn(port, rnwwn); 3077 3083 if (rport == NULL) { 3078 3084 /* 3079 3085 * TBD Error handling
-21
drivers/scsi/bfa/bfa_ioc.c
··· 2254 2254 return status; 2255 2255 } 2256 2256 2257 - /* 2258 - * Enable/disable IOC failure auto recovery. 2259 - */ 2260 - void 2261 - bfa_ioc_auto_recover(bfa_boolean_t auto_recover) 2262 - { 2263 - bfa_auto_recover = auto_recover; 2264 - } 2265 - 2266 - 2267 - 2268 2257 bfa_boolean_t 2269 2258 bfa_ioc_is_operational(struct bfa_ioc_s *ioc) 2270 2259 { 2271 2260 return bfa_fsm_cmp_state(ioc, bfa_ioc_sm_op); 2272 - } 2273 - 2274 - bfa_boolean_t 2275 - bfa_ioc_is_initialized(struct bfa_ioc_s *ioc) 2276 - { 2277 - u32 r32 = bfa_ioc_get_cur_ioc_fwstate(ioc); 2278 - 2279 - return ((r32 != BFI_IOC_UNINIT) && 2280 - (r32 != BFI_IOC_INITING) && 2281 - (r32 != BFI_IOC_MEMTEST)); 2282 2261 } 2283 2262 2284 2263 bfa_boolean_t
-2
drivers/scsi/bfa/bfa_ioc.h
··· 919 919 920 920 void bfa_ioc_attach(struct bfa_ioc_s *ioc, void *bfa, 921 921 struct bfa_ioc_cbfn_s *cbfn, struct bfa_timer_mod_s *timer_mod); 922 - void bfa_ioc_auto_recover(bfa_boolean_t auto_recover); 923 922 void bfa_ioc_detach(struct bfa_ioc_s *ioc); 924 923 void bfa_ioc_suspend(struct bfa_ioc_s *ioc); 925 924 void bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev, ··· 933 934 void bfa_ioc_isr(struct bfa_ioc_s *ioc, struct bfi_mbmsg_s *msg); 934 935 void bfa_ioc_error_isr(struct bfa_ioc_s *ioc); 935 936 bfa_boolean_t bfa_ioc_is_operational(struct bfa_ioc_s *ioc); 936 - bfa_boolean_t bfa_ioc_is_initialized(struct bfa_ioc_s *ioc); 937 937 bfa_boolean_t bfa_ioc_is_disabled(struct bfa_ioc_s *ioc); 938 938 bfa_boolean_t bfa_ioc_is_acq_addr(struct bfa_ioc_s *ioc); 939 939 bfa_boolean_t bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc);
-1
drivers/scsi/bfa/bfa_modules.h
··· 113 113 struct bfa_s *); 114 114 void bfa_sgpg_attach(struct bfa_s *, void *bfad, struct bfa_iocfc_cfg_s *, 115 115 struct bfa_pcidev_s *); 116 - void bfa_uf_iocdisable(struct bfa_s *); 117 116 void bfa_uf_meminfo(struct bfa_iocfc_cfg_s *, struct bfa_meminfo_s *, 118 117 struct bfa_s *); 119 118 void bfa_uf_attach(struct bfa_s *, void *, struct bfa_iocfc_cfg_s *,
-72
drivers/scsi/bfa/bfa_svc.c
··· 913 913 return reqbuf; 914 914 } 915 915 916 - u32 917 - bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp) 918 - { 919 - struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; 920 - 921 - return mod->req_pld_sz; 922 - } 923 - 924 916 /* 925 917 * Get the internal response buffer pointer 926 918 * ··· 1013 1021 } 1014 1022 1015 1023 bfa_fcxp_queue(fcxp, send_req); 1016 - } 1017 - 1018 - /* 1019 - * Abort a BFA FCXP 1020 - * 1021 - * @param[in] fcxp BFA fcxp pointer 1022 - * 1023 - * @return void 1024 - */ 1025 - bfa_status_t 1026 - bfa_fcxp_abort(struct bfa_fcxp_s *fcxp) 1027 - { 1028 - bfa_trc(fcxp->fcxp_mod->bfa, fcxp->fcxp_tag); 1029 - WARN_ON(1); 1030 - return BFA_STATUS_OK; 1031 1024 } 1032 1025 1033 1026 void ··· 3834 3857 return BFA_STATUS_OK; 3835 3858 } 3836 3859 3837 - bfa_boolean_t 3838 - bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa) 3839 - { 3840 - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 3841 - 3842 - *alpa = fcport->cfg.hardalpa; 3843 - return fcport->cfg.cfg_hardalpa; 3844 - } 3845 - 3846 3860 u8 3847 3861 bfa_fcport_get_myalpa(struct bfa_s *bfa) 3848 3862 { ··· 3891 3923 /* 3892 3924 * Get port attributes. 3893 3925 */ 3894 - 3895 - wwn_t 3896 - bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node) 3897 - { 3898 - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 3899 - if (node) 3900 - return fcport->nwwn; 3901 - else 3902 - return fcport->pwwn; 3903 - } 3904 - 3905 3926 void 3906 3927 bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr) 3907 3928 { ··· 4060 4103 4061 4104 return fcport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE; 4062 4105 4063 - } 4064 - 4065 - /* 4066 - * Enable/Disable FAA feature in port config 4067 - */ 4068 - void 4069 - bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state) 4070 - { 4071 - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 4072 - 4073 - bfa_trc(bfa, state); 4074 - fcport->cfg.faa_state = state; 4075 4106 } 4076 4107 4077 4108 /* ··· 5471 5526 __bfa_cb_uf_recv(uf, BFA_TRUE); 5472 5527 else 5473 5528 bfa_cb_queue(bfa, &uf->hcb_qe, __bfa_cb_uf_recv, uf); 5474 - } 5475 - 5476 - void 5477 - bfa_uf_iocdisable(struct bfa_s *bfa) 5478 - { 5479 - struct bfa_uf_mod_s *ufm = BFA_UF_MOD(bfa); 5480 - struct bfa_uf_s *uf; 5481 - struct list_head *qe, *qen; 5482 - 5483 - /* Enqueue unused uf resources to free_q */ 5484 - list_splice_tail_init(&ufm->uf_unused_q, &ufm->uf_free_q); 5485 - 5486 - list_for_each_safe(qe, qen, &ufm->uf_posted_q) { 5487 - uf = (struct bfa_uf_s *) qe; 5488 - list_del(&uf->qe); 5489 - bfa_uf_put(ufm, uf); 5490 - } 5491 5529 } 5492 5530 5493 5531 void
-5
drivers/scsi/bfa/bfa_svc.h
··· 587 587 enum bfa_port_topology bfa_fcport_get_topology(struct bfa_s *bfa); 588 588 enum bfa_port_topology bfa_fcport_get_cfg_topology(struct bfa_s *bfa); 589 589 bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa); 590 - bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa); 591 590 u8 bfa_fcport_get_myalpa(struct bfa_s *bfa); 592 591 bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa); 593 592 bfa_status_t bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize); 594 593 u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa); 595 594 u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa); 596 595 void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr); 597 - wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node); 598 596 void bfa_fcport_event_register(struct bfa_s *bfa, 599 597 void (*event_cbfn) (void *cbarg, 600 598 enum bfa_port_linkstate event), void *event_cbarg); ··· 617 619 void bfa_fcport_dportenable(struct bfa_s *bfa); 618 620 void bfa_fcport_dportdisable(struct bfa_s *bfa); 619 621 bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa); 620 - void bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state); 621 622 bfa_status_t bfa_fcport_cfg_bbcr(struct bfa_s *bfa, 622 623 bfa_boolean_t on_off, u8 bb_scn); 623 624 bfa_status_t bfa_fcport_get_bbcr_attr(struct bfa_s *bfa, ··· 684 687 bfa_cb_fcxp_send_t cbfn, 685 688 void *cbarg, 686 689 u32 rsp_maxlen, u8 rsp_timeout); 687 - bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp); 688 - u32 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp); 689 690 u32 bfa_fcxp_get_maxrsp(struct bfa_s *bfa); 690 691 void bfa_fcxp_res_recfg(struct bfa_s *bfa, u16 num_fcxp_fw); 691 692
+1 -22
drivers/scsi/bfa/bfad.c
··· 843 843 } 844 844 845 845 void 846 - bfad_drv_uninit(struct bfad_s *bfad) 847 - { 848 - unsigned long flags; 849 - 850 - spin_lock_irqsave(&bfad->bfad_lock, flags); 851 - init_completion(&bfad->comp); 852 - bfa_iocfc_stop(&bfad->bfa); 853 - spin_unlock_irqrestore(&bfad->bfad_lock, flags); 854 - wait_for_completion(&bfad->comp); 855 - 856 - del_timer_sync(&bfad->hal_tmo); 857 - bfa_isr_disable(&bfad->bfa); 858 - bfa_detach(&bfad->bfa); 859 - bfad_remove_intr(bfad); 860 - bfad_hal_mem_release(bfad); 861 - 862 - bfad->bfad_flags &= ~BFAD_DRV_INIT_DONE; 863 - } 864 - 865 - void 866 846 bfad_drv_start(struct bfad_s *bfad) 867 847 { 868 848 unsigned long flags; ··· 1673 1693 1674 1694 error = bfad_im_module_init(); 1675 1695 if (error) { 1676 - error = -ENOMEM; 1677 1696 printk(KERN_WARNING "bfad_im_module_init failure\n"); 1678 - goto ext; 1697 + return -ENOMEM; 1679 1698 } 1680 1699 1681 1700 if (strcmp(FCPI_NAME, " fcpim") == 0)
-1
drivers/scsi/bfa/bfad_drv.h
··· 312 312 void bfad_init_timer(struct bfad_s *bfad); 313 313 int bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad); 314 314 void bfad_pci_uninit(struct pci_dev *pdev, struct bfad_s *bfad); 315 - void bfad_drv_uninit(struct bfad_s *bfad); 316 315 int bfad_worker(void *ptr); 317 316 void bfad_debugfs_init(struct bfad_port_s *port); 318 317 void bfad_debugfs_exit(struct bfad_port_s *port);
+1 -1
drivers/scsi/bfa/bfi.h
··· 1148 1148 u16 numbuffer; /* from switch */ 1149 1149 u8 subtest_status[DPORT_TEST_MAX]; /* 4 bytes */ 1150 1150 u32 latency; /* from switch */ 1151 - u32 distance; /* from swtich unit in meters */ 1151 + u32 distance; /* from switch unit in meters */ 1152 1152 /* Buffers required to saturate the link */ 1153 1153 u16 frm_sz; /* from switch for buf_reqd */ 1154 1154 u8 rsvd[2];
+1 -1
drivers/scsi/bvme6000_scsi.c
··· 106 106 .name = "bvme6000-scsi", 107 107 }, 108 108 .probe = bvme6000_probe, 109 - .remove_new = bvme6000_device_remove, 109 + .remove = bvme6000_device_remove, 110 110 }; 111 111 112 112 static int __init bvme6000_scsi_init(void)
-4
drivers/scsi/esas2r/esas2r.h
··· 1045 1045 u32 length, 1046 1046 void *data); 1047 1047 void esas2r_build_ae_req(struct esas2r_adapter *a, struct esas2r_request *rq); 1048 - void esas2r_build_cli_req(struct esas2r_adapter *a, 1049 - struct esas2r_request *rq, 1050 - u32 length, 1051 - u32 cmd_rsp_len); 1052 1048 void esas2r_build_ioctl_req(struct esas2r_adapter *a, 1053 1049 struct esas2r_request *rq, 1054 1050 u32 length,
-17
drivers/scsi/esas2r/esas2r_vda.c
··· 444 444 } 445 445 } 446 446 447 - /* Build a VDA CLI request. */ 448 - void esas2r_build_cli_req(struct esas2r_adapter *a, 449 - struct esas2r_request *rq, 450 - u32 length, 451 - u32 cmd_rsp_len) 452 - { 453 - struct atto_vda_cli_req *vrq = &rq->vrq->cli; 454 - 455 - clear_vda_request(rq); 456 - 457 - rq->vrq->scsi.function = VDA_FUNC_CLI; 458 - 459 - vrq->length = cpu_to_le32(length); 460 - vrq->cmd_rsp_len = cpu_to_le32(cmd_rsp_len); 461 - vrq->sg_list_offset = (u8)offsetof(struct atto_vda_cli_req, sge); 462 - } 463 - 464 447 /* Build a VDA IOCTL request. */ 465 448 void esas2r_build_ioctl_req(struct esas2r_adapter *a, 466 449 struct esas2r_request *rq,
+1
drivers/scsi/hisi_sas/hisi_sas.h
··· 307 307 308 308 struct hisi_sas_hw { 309 309 int (*hw_init)(struct hisi_hba *hisi_hba); 310 + int (*fw_info_check)(struct hisi_hba *hisi_hba); 310 311 int (*interrupt_preinit)(struct hisi_hba *hisi_hba); 311 312 void (*setup_itct)(struct hisi_hba *hisi_hba, 312 313 struct hisi_sas_device *device);
+27 -4
drivers/scsi/hisi_sas/hisi_sas_main.c
··· 1321 1321 } 1322 1322 1323 1323 if (rc == TMF_RESP_FUNC_COMPLETE) { 1324 + usleep_range(900, 1000); 1324 1325 ata_for_each_link(link, ap, EDGE) { 1325 1326 int pmp = sata_srst_pmp(link); 1326 1327 ··· 1385 1384 1386 1385 static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state) 1387 1386 { 1387 + u32 new_state = hisi_hba->hw->get_phys_state(hisi_hba); 1388 1388 struct asd_sas_port *_sas_port = NULL; 1389 1389 int phy_no; 1390 1390 ··· 1399 1397 continue; 1400 1398 1401 1399 /* Report PHY state change to libsas */ 1402 - if (state & BIT(phy_no)) { 1400 + if (new_state & BIT(phy_no)) { 1403 1401 if (do_port_check && sas_port && sas_port->port_dev) { 1404 1402 struct domain_device *dev = sas_port->port_dev; 1405 1403 ··· 1412 1410 } 1413 1411 } else { 1414 1412 hisi_sas_phy_down(hisi_hba, phy_no, 0, GFP_KERNEL); 1413 + 1414 + /* 1415 + * The new_state is not ready but old_state is ready, 1416 + * the two possible causes: 1417 + * 1. The connected device is removed 1418 + * 2. Device exists but phyup timed out 1419 + */ 1420 + if (state & BIT(phy_no)) 1421 + hisi_sas_notify_phy_event(phy, 1422 + HISI_PHYE_LINK_RESET); 1415 1423 } 1416 1424 } 1417 1425 } ··· 1557 1545 /* Init and wait for PHYs to come up and all libsas event finished. */ 1558 1546 for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) { 1559 1547 struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; 1548 + struct asd_sas_phy *sas_phy = &phy->sas_phy; 1560 1549 1561 - if (!(hisi_hba->phy_state & BIT(phy_no))) 1550 + if (!sas_phy->phy->enabled) 1562 1551 continue; 1552 + 1553 + if (!(hisi_hba->phy_state & BIT(phy_no))) { 1554 + hisi_sas_phy_enable(hisi_hba, phy_no, 1); 1555 + continue; 1556 + } 1563 1557 1564 1558 async_schedule_domain(hisi_sas_async_init_wait_phyup, 1565 1559 phy, &async); ··· 2468 2450 if (hisi_sas_get_fw_info(hisi_hba) < 0) 2469 2451 goto err_out; 2470 2452 2453 + if (hisi_hba->hw->fw_info_check) { 2454 + if (hisi_hba->hw->fw_info_check(hisi_hba)) 2455 + goto err_out; 2456 + } 2457 + 2471 2458 error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); 2472 2459 if (error) { 2473 2460 dev_err(dev, "No usable DMA addressing method\n"); ··· 2653 2630 2654 2631 static __exit void hisi_sas_exit(void) 2655 2632 { 2656 - sas_release_transport(hisi_sas_stt); 2657 - 2658 2633 if (hisi_sas_debugfs_enable) 2659 2634 debugfs_remove(hisi_sas_debugfs_dir); 2635 + 2636 + sas_release_transport(hisi_sas_stt); 2660 2637 } 2661 2638 2662 2639 module_init(hisi_sas_init);
+19 -1
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
··· 1734 1734 1735 1735 ATTRIBUTE_GROUPS(host_v1_hw); 1736 1736 1737 + static int check_fw_info_v1_hw(struct hisi_hba *hisi_hba) 1738 + { 1739 + struct device *dev = hisi_hba->dev; 1740 + 1741 + if (hisi_hba->n_phy < 0 || hisi_hba->n_phy > 9) { 1742 + dev_err(dev, "invalid phy number from FW\n"); 1743 + return -EINVAL; 1744 + } 1745 + 1746 + if (hisi_hba->queue_count < 0 || hisi_hba->queue_count > 32) { 1747 + dev_err(dev, "invalid queue count from FW\n"); 1748 + return -EINVAL; 1749 + } 1750 + 1751 + return 0; 1752 + } 1753 + 1737 1754 static const struct scsi_host_template sht_v1_hw = { 1738 1755 LIBSAS_SHT_BASE_NO_SLAVE_INIT 1739 1756 .device_configure = hisi_sas_device_configure, ··· 1764 1747 1765 1748 static const struct hisi_sas_hw hisi_sas_v1_hw = { 1766 1749 .hw_init = hisi_sas_v1_init, 1750 + .fw_info_check = check_fw_info_v1_hw, 1767 1751 .setup_itct = setup_itct_v1_hw, 1768 1752 .sl_notify_ssp = sl_notify_ssp_v1_hw, 1769 1753 .clear_itct = clear_itct_v1_hw, ··· 1802 1784 1803 1785 static struct platform_driver hisi_sas_v1_driver = { 1804 1786 .probe = hisi_sas_v1_probe, 1805 - .remove_new = hisi_sas_remove, 1787 + .remove = hisi_sas_remove, 1806 1788 .driver = { 1807 1789 .name = DRV_NAME, 1808 1790 .of_match_table = sas_v1_of_match,
+19 -1
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
··· 3566 3566 } 3567 3567 } 3568 3568 3569 + static int check_fw_info_v2_hw(struct hisi_hba *hisi_hba) 3570 + { 3571 + struct device *dev = hisi_hba->dev; 3572 + 3573 + if (hisi_hba->n_phy < 0 || hisi_hba->n_phy > 9) { 3574 + dev_err(dev, "invalid phy number from FW\n"); 3575 + return -EINVAL; 3576 + } 3577 + 3578 + if (hisi_hba->queue_count < 0 || hisi_hba->queue_count > 16) { 3579 + dev_err(dev, "invalid queue count from FW\n"); 3580 + return -EINVAL; 3581 + } 3582 + 3583 + return 0; 3584 + } 3585 + 3569 3586 static const struct scsi_host_template sht_v2_hw = { 3570 3587 LIBSAS_SHT_BASE_NO_SLAVE_INIT 3571 3588 .device_configure = hisi_sas_device_configure, ··· 3599 3582 3600 3583 static const struct hisi_sas_hw hisi_sas_v2_hw = { 3601 3584 .hw_init = hisi_sas_v2_init, 3585 + .fw_info_check = check_fw_info_v2_hw, 3602 3586 .interrupt_preinit = hisi_sas_v2_interrupt_preinit, 3603 3587 .setup_itct = setup_itct_v2_hw, 3604 3588 .slot_index_alloc = slot_index_alloc_quirk_v2_hw, ··· 3649 3631 3650 3632 static struct platform_driver hisi_sas_v2_driver = { 3651 3633 .probe = hisi_sas_v2_probe, 3652 - .remove_new = hisi_sas_remove, 3634 + .remove = hisi_sas_remove, 3653 3635 .driver = { 3654 3636 .name = DRV_NAME, 3655 3637 .of_match_table = sas_v2_of_match,
+142 -49
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
··· 43 43 #define CQ_INT_CONVERGE_EN 0xb0 44 44 #define CFG_AGING_TIME 0xbc 45 45 #define HGC_DFX_CFG2 0xc0 46 + #define CFG_ICT_TIMER_STEP_TRSH 0xc8 46 47 #define CFG_ABT_SET_QUERY_IPTT 0xd4 47 48 #define CFG_SET_ABORTED_IPTT_OFF 0 48 49 #define CFG_SET_ABORTED_IPTT_MSK (0xfff << CFG_SET_ABORTED_IPTT_OFF) ··· 639 638 hisi_sas_write32(hisi_hba, TRANS_LOCK_ICT_TIME, 0x4A817C80); 640 639 hisi_sas_write32(hisi_hba, HGC_SAS_TXFAIL_RETRY_CTRL, 0x108); 641 640 hisi_sas_write32(hisi_hba, CFG_AGING_TIME, 0x1); 642 - hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1); 643 - hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0x1); 644 - hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0x1); 641 + hisi_sas_write32(hisi_hba, CFG_ICT_TIMER_STEP_TRSH, 0xf4240); 642 + hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x3); 643 + /* configure the interrupt coalescing timeout period 10us */ 644 + hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0xa); 645 + /* configure the count of CQ entries 10 */ 646 + hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0xa); 645 647 hisi_sas_write32(hisi_hba, CQ_INT_CONVERGE_EN, 646 648 hisi_sas_intr_conv); 647 649 hisi_sas_write32(hisi_hba, OQ_INT_SRC, 0xffff); ··· 686 682 hisi_sas_phy_write32(hisi_hba, i, PHY_CTRL_RDY_MSK, 0x0); 687 683 hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_DWS_RESET_MSK, 0x0); 688 684 hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_OOB_RESTART_MSK, 0x1); 689 - hisi_sas_phy_write32(hisi_hba, i, STP_LINK_TIMER, 0x7f7a120); 685 + hisi_sas_phy_write32(hisi_hba, i, STP_LINK_TIMER, 0x7ffffff); 690 686 hisi_sas_phy_write32(hisi_hba, i, CON_CFG_DRIVER, 0x2a0a01); 691 687 hisi_sas_phy_write32(hisi_hba, i, SAS_EC_INT_COAL_TIME, 692 688 0x30f4240); ··· 2497 2493 /* update rd_point */ 2498 2494 cq->rd_point = rd_point; 2499 2495 hisi_sas_write32(hisi_hba, COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); 2496 + cond_resched(); 2500 2497 2501 2498 return completed; 2502 2499 } ··· 2801 2796 { 2802 2797 /* config those registers between enable and disable PHYs */ 2803 2798 hisi_sas_stop_phys(hisi_hba); 2799 + hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x3); 2804 2800 2805 2801 if (hisi_hba->intr_coal_ticks == 0 || 2806 2802 hisi_hba->intr_coal_count == 0) { 2807 - hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1); 2808 - hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0x1); 2809 - hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0x1); 2803 + /* configure the interrupt coalescing timeout period 10us */ 2804 + hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0xa); 2805 + /* configure the count of CQ entries 10 */ 2806 + hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0xa); 2810 2807 } else { 2811 - hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x3); 2812 2808 hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 2813 2809 hisi_hba->intr_coal_ticks); 2814 2810 hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, ··· 3377 3371 .debugfs_snapshot_regs = debugfs_snapshot_regs_v3_hw, 3378 3372 }; 3379 3373 3374 + static int check_fw_info_v3_hw(struct hisi_hba *hisi_hba) 3375 + { 3376 + struct device *dev = hisi_hba->dev; 3377 + 3378 + if (hisi_hba->n_phy < 0 || hisi_hba->n_phy > 8) { 3379 + dev_err(dev, "invalid phy number from FW\n"); 3380 + return -EINVAL; 3381 + } 3382 + 3383 + if (hisi_hba->queue_count < 0 || hisi_hba->queue_count > 16) { 3384 + dev_err(dev, "invalid queue count from FW\n"); 3385 + return -EINVAL; 3386 + } 3387 + 3388 + return 0; 3389 + } 3390 + 3380 3391 static struct Scsi_Host * 3381 3392 hisi_sas_shost_alloc_pci(struct pci_dev *pdev) 3382 3393 { ··· 3422 3399 hisi_hba->prot_mask = prot_mask; 3423 3400 3424 3401 if (hisi_sas_get_fw_info(hisi_hba) < 0) 3402 + goto err_out; 3403 + 3404 + if (check_fw_info_v3_hw(hisi_hba) < 0) 3425 3405 goto err_out; 3426 3406 3427 3407 if (experimental_iopoll_q_cnt < 0 || ··· 3576 3550 return NULL; 3577 3551 } 3578 3552 3553 + static bool debugfs_dump_is_generated_v3_hw(void *p) 3554 + { 3555 + return p ? true : false; 3556 + } 3557 + 3579 3558 static void debugfs_print_reg_v3_hw(u32 *regs_val, struct seq_file *s, 3580 3559 const struct hisi_sas_debugfs_reg *reg) 3581 3560 { ··· 3606 3575 { 3607 3576 struct hisi_sas_debugfs_regs *global = s->private; 3608 3577 3578 + if (!debugfs_dump_is_generated_v3_hw(global->data)) 3579 + return -EPERM; 3580 + 3609 3581 debugfs_print_reg_v3_hw(global->data, s, 3610 3582 &debugfs_global_reg); 3611 3583 ··· 3619 3585 static int debugfs_axi_v3_hw_show(struct seq_file *s, void *p) 3620 3586 { 3621 3587 struct hisi_sas_debugfs_regs *axi = s->private; 3588 + 3589 + if (!debugfs_dump_is_generated_v3_hw(axi->data)) 3590 + return -EPERM; 3622 3591 3623 3592 debugfs_print_reg_v3_hw(axi->data, s, 3624 3593 &debugfs_axi_reg); ··· 3634 3597 { 3635 3598 struct hisi_sas_debugfs_regs *ras = s->private; 3636 3599 3600 + if (!debugfs_dump_is_generated_v3_hw(ras->data)) 3601 + return -EPERM; 3602 + 3637 3603 debugfs_print_reg_v3_hw(ras->data, s, 3638 3604 &debugfs_ras_reg); 3639 3605 ··· 3648 3608 { 3649 3609 struct hisi_sas_debugfs_port *port = s->private; 3650 3610 const struct hisi_sas_debugfs_reg *reg_port = &debugfs_port_reg; 3611 + 3612 + if (!debugfs_dump_is_generated_v3_hw(port->data)) 3613 + return -EPERM; 3651 3614 3652 3615 debugfs_print_reg_v3_hw(port->data, s, reg_port); 3653 3616 ··· 3707 3664 struct hisi_sas_debugfs_cq *debugfs_cq = s->private; 3708 3665 int slot; 3709 3666 3667 + if (!debugfs_dump_is_generated_v3_hw(debugfs_cq->complete_hdr)) 3668 + return -EPERM; 3669 + 3710 3670 for (slot = 0; slot < HISI_SAS_QUEUE_SLOTS; slot++) 3711 3671 debugfs_cq_show_slot_v3_hw(s, slot, debugfs_cq); 3712 3672 ··· 3731 3685 3732 3686 static int debugfs_dq_v3_hw_show(struct seq_file *s, void *p) 3733 3687 { 3688 + struct hisi_sas_debugfs_dq *debugfs_dq = s->private; 3734 3689 int slot; 3690 + 3691 + if (!debugfs_dump_is_generated_v3_hw(debugfs_dq->hdr)) 3692 + return -EPERM; 3735 3693 3736 3694 for (slot = 0; slot < HISI_SAS_QUEUE_SLOTS; slot++) 3737 3695 debugfs_dq_show_slot_v3_hw(s, slot, s->private); ··· 3749 3699 struct hisi_sas_debugfs_iost *debugfs_iost = s->private; 3750 3700 struct hisi_sas_iost *iost = debugfs_iost->iost; 3751 3701 int i, max_command_entries = HISI_SAS_MAX_COMMANDS; 3702 + 3703 + if (!debugfs_dump_is_generated_v3_hw(iost)) 3704 + return -EPERM; 3752 3705 3753 3706 for (i = 0; i < max_command_entries; i++, iost++) { 3754 3707 __le64 *data = &iost->qw0; ··· 3771 3718 u32 cache_size = HISI_SAS_IOST_ITCT_CACHE_DW_SZ * 4; 3772 3719 int i, tab_idx; 3773 3720 __le64 *iost; 3721 + 3722 + if (!debugfs_dump_is_generated_v3_hw(iost_cache)) 3723 + return -EPERM; 3774 3724 3775 3725 for (i = 0; i < HISI_SAS_IOST_ITCT_CACHE_NUM; i++, iost_cache++) { 3776 3726 /* ··· 3798 3742 struct hisi_sas_debugfs_itct *debugfs_itct = s->private; 3799 3743 struct hisi_sas_itct *itct = debugfs_itct->itct; 3800 3744 3745 + if (!debugfs_dump_is_generated_v3_hw(itct)) 3746 + return -EPERM; 3747 + 3801 3748 for (i = 0; i < HISI_SAS_MAX_ITCT_ENTRIES; i++, itct++) { 3802 3749 __le64 *data = &itct->qw0; 3803 3750 ··· 3820 3761 int i, tab_idx; 3821 3762 __le64 *itct; 3822 3763 3764 + if (!debugfs_dump_is_generated_v3_hw(itct_cache)) 3765 + return -EPERM; 3766 + 3823 3767 for (i = 0; i < HISI_SAS_IOST_ITCT_CACHE_NUM; i++, itct_cache++) { 3824 3768 /* 3825 3769 * Data struct of ITCT cache: ··· 3840 3778 } 3841 3779 DEFINE_SHOW_ATTRIBUTE(debugfs_itct_cache_v3_hw); 3842 3780 3843 - static void debugfs_create_files_v3_hw(struct hisi_hba *hisi_hba) 3781 + static void debugfs_create_files_v3_hw(struct hisi_hba *hisi_hba, int index) 3844 3782 { 3845 3783 u64 *debugfs_timestamp; 3846 - int dump_index = hisi_hba->debugfs_dump_index; 3847 3784 struct dentry *dump_dentry; 3848 3785 struct dentry *dentry; 3849 3786 char name[256]; ··· 3850 3789 int c; 3851 3790 int d; 3852 3791 3853 - snprintf(name, 256, "%d", dump_index); 3792 + snprintf(name, 256, "%d", index); 3854 3793 3855 3794 dump_dentry = debugfs_create_dir(name, hisi_hba->debugfs_dump_dentry); 3856 3795 3857 - debugfs_timestamp = &hisi_hba->debugfs_timestamp[dump_index]; 3796 + debugfs_timestamp = &hisi_hba->debugfs_timestamp[index]; 3858 3797 3859 3798 debugfs_create_u64("timestamp", 0400, dump_dentry, 3860 3799 debugfs_timestamp); 3861 3800 3862 3801 debugfs_create_file("global", 0400, dump_dentry, 3863 - &hisi_hba->debugfs_regs[dump_index][DEBUGFS_GLOBAL], 3802 + &hisi_hba->debugfs_regs[index][DEBUGFS_GLOBAL], 3864 3803 &debugfs_global_v3_hw_fops); 3865 3804 3866 3805 /* Create port dir and files */ ··· 3869 3808 snprintf(name, 256, "%d", p); 3870 3809 3871 3810 debugfs_create_file(name, 0400, dentry, 3872 - &hisi_hba->debugfs_port_reg[dump_index][p], 3811 + &hisi_hba->debugfs_port_reg[index][p], 3873 3812 &debugfs_port_v3_hw_fops); 3874 3813 } 3875 3814 ··· 3879 3818 snprintf(name, 256, "%d", c); 3880 3819 3881 3820 debugfs_create_file(name, 0400, dentry, 3882 - &hisi_hba->debugfs_cq[dump_index][c], 3821 + &hisi_hba->debugfs_cq[index][c], 3883 3822 &debugfs_cq_v3_hw_fops); 3884 3823 } 3885 3824 ··· 3889 3828 snprintf(name, 256, "%d", d); 3890 3829 3891 3830 debugfs_create_file(name, 0400, dentry, 3892 - &hisi_hba->debugfs_dq[dump_index][d], 3831 + &hisi_hba->debugfs_dq[index][d], 3893 3832 &debugfs_dq_v3_hw_fops); 3894 3833 } 3895 3834 3896 3835 debugfs_create_file("iost", 0400, dump_dentry, 3897 - &hisi_hba->debugfs_iost[dump_index], 3836 + &hisi_hba->debugfs_iost[index], 3898 3837 &debugfs_iost_v3_hw_fops); 3899 3838 3900 3839 debugfs_create_file("iost_cache", 0400, dump_dentry, 3901 - &hisi_hba->debugfs_iost_cache[dump_index], 3840 + &hisi_hba->debugfs_iost_cache[index], 3902 3841 &debugfs_iost_cache_v3_hw_fops); 3903 3842 3904 3843 debugfs_create_file("itct", 0400, dump_dentry, 3905 - &hisi_hba->debugfs_itct[dump_index], 3844 + &hisi_hba->debugfs_itct[index], 3906 3845 &debugfs_itct_v3_hw_fops); 3907 3846 3908 3847 debugfs_create_file("itct_cache", 0400, dump_dentry, 3909 - &hisi_hba->debugfs_itct_cache[dump_index], 3848 + &hisi_hba->debugfs_itct_cache[index], 3910 3849 &debugfs_itct_cache_v3_hw_fops); 3911 3850 3912 3851 debugfs_create_file("axi", 0400, dump_dentry, 3913 - &hisi_hba->debugfs_regs[dump_index][DEBUGFS_AXI], 3852 + &hisi_hba->debugfs_regs[index][DEBUGFS_AXI], 3914 3853 &debugfs_axi_v3_hw_fops); 3915 3854 3916 3855 debugfs_create_file("ras", 0400, dump_dentry, 3917 - &hisi_hba->debugfs_regs[dump_index][DEBUGFS_RAS], 3856 + &hisi_hba->debugfs_regs[index][DEBUGFS_RAS], 3918 3857 &debugfs_ras_v3_hw_fops); 3919 3858 } 3920 3859 ··· 4577 4516 int i; 4578 4517 4579 4518 devm_kfree(dev, hisi_hba->debugfs_iost_cache[dump_index].cache); 4519 + hisi_hba->debugfs_iost_cache[dump_index].cache = NULL; 4580 4520 devm_kfree(dev, hisi_hba->debugfs_itct_cache[dump_index].cache); 4521 + hisi_hba->debugfs_itct_cache[dump_index].cache = NULL; 4581 4522 devm_kfree(dev, hisi_hba->debugfs_iost[dump_index].iost); 4523 + hisi_hba->debugfs_iost[dump_index].iost = NULL; 4582 4524 devm_kfree(dev, hisi_hba->debugfs_itct[dump_index].itct); 4525 + hisi_hba->debugfs_itct[dump_index].itct = NULL; 4583 4526 4584 - for (i = 0; i < hisi_hba->queue_count; i++) 4527 + for (i = 0; i < hisi_hba->queue_count; i++) { 4585 4528 devm_kfree(dev, hisi_hba->debugfs_dq[dump_index][i].hdr); 4529 + hisi_hba->debugfs_dq[dump_index][i].hdr = NULL; 4530 + } 4586 4531 4587 - for (i = 0; i < hisi_hba->queue_count; i++) 4532 + for (i = 0; i < hisi_hba->queue_count; i++) { 4588 4533 devm_kfree(dev, 4589 4534 hisi_hba->debugfs_cq[dump_index][i].complete_hdr); 4535 + hisi_hba->debugfs_cq[dump_index][i].complete_hdr = NULL; 4536 + } 4590 4537 4591 - for (i = 0; i < DEBUGFS_REGS_NUM; i++) 4538 + for (i = 0; i < DEBUGFS_REGS_NUM; i++) { 4592 4539 devm_kfree(dev, hisi_hba->debugfs_regs[dump_index][i].data); 4540 + hisi_hba->debugfs_regs[dump_index][i].data = NULL; 4541 + } 4593 4542 4594 - for (i = 0; i < hisi_hba->n_phy; i++) 4543 + for (i = 0; i < hisi_hba->n_phy; i++) { 4595 4544 devm_kfree(dev, hisi_hba->debugfs_port_reg[dump_index][i].data); 4545 + hisi_hba->debugfs_port_reg[dump_index][i].data = NULL; 4546 + } 4596 4547 } 4597 4548 4598 4549 static const struct hisi_sas_debugfs_reg *debugfs_reg_array_v3_hw[DEBUGFS_REGS_NUM] = { ··· 4731 4658 debugfs_snapshot_itct_reg_v3_hw(hisi_hba); 4732 4659 debugfs_snapshot_iost_reg_v3_hw(hisi_hba); 4733 4660 4734 - debugfs_create_files_v3_hw(hisi_hba); 4735 - 4736 4661 debugfs_snapshot_restore_v3_hw(hisi_hba); 4737 4662 hisi_hba->debugfs_dump_index++; 4738 4663 ··· 4814 4743 hisi_hba->debugfs_bist_linkrate = SAS_LINK_RATE_1_5_GBPS; 4815 4744 } 4816 4745 4746 + static int debugfs_dump_index_v3_hw_show(struct seq_file *s, void *p) 4747 + { 4748 + int *debugfs_dump_index = s->private; 4749 + 4750 + if (*debugfs_dump_index > 0) 4751 + seq_printf(s, "%d\n", *debugfs_dump_index - 1); 4752 + else 4753 + seq_puts(s, "dump not triggered\n"); 4754 + 4755 + return 0; 4756 + } 4757 + DEFINE_SHOW_ATTRIBUTE(debugfs_dump_index_v3_hw); 4758 + 4759 + static void debugfs_dump_init_v3_hw(struct hisi_hba *hisi_hba) 4760 + { 4761 + int i; 4762 + 4763 + hisi_hba->debugfs_dump_dentry = 4764 + debugfs_create_dir("dump", hisi_hba->debugfs_dir); 4765 + 4766 + debugfs_create_file("latest_dump", 0400, hisi_hba->debugfs_dump_dentry, 4767 + &hisi_hba->debugfs_dump_index, 4768 + &debugfs_dump_index_v3_hw_fops); 4769 + 4770 + for (i = 0; i < hisi_sas_debugfs_dump_count; i++) 4771 + debugfs_create_files_v3_hw(hisi_hba, i); 4772 + } 4773 + 4817 4774 static void debugfs_exit_v3_hw(struct hisi_hba *hisi_hba) 4818 4775 { 4819 4776 debugfs_remove_recursive(hisi_hba->debugfs_dir); ··· 4854 4755 4855 4756 hisi_hba->debugfs_dir = debugfs_create_dir(dev_name(dev), 4856 4757 hisi_sas_debugfs_dir); 4758 + /* create bist structures */ 4759 + debugfs_bist_init_v3_hw(hisi_hba); 4760 + 4761 + debugfs_dump_init_v3_hw(hisi_hba); 4762 + 4763 + debugfs_phy_down_cnt_init_v3_hw(hisi_hba); 4764 + debugfs_fifo_init_v3_hw(hisi_hba); 4857 4765 debugfs_create_file("trigger_dump", 0200, 4858 4766 hisi_hba->debugfs_dir, 4859 4767 hisi_hba, 4860 4768 &debugfs_trigger_dump_v3_hw_fops); 4861 - 4862 - /* create bist structures */ 4863 - debugfs_bist_init_v3_hw(hisi_hba); 4864 - 4865 - hisi_hba->debugfs_dump_dentry = 4866 - debugfs_create_dir("dump", hisi_hba->debugfs_dir); 4867 - 4868 - debugfs_phy_down_cnt_init_v3_hw(hisi_hba); 4869 - debugfs_fifo_init_v3_hw(hisi_hba); 4870 4769 } 4871 4770 4872 4771 static int ··· 4957 4860 SHOST_DIX_GUARD_CRC); 4958 4861 } 4959 4862 4960 - if (hisi_sas_debugfs_enable) 4961 - debugfs_init_v3_hw(hisi_hba); 4962 - 4963 4863 rc = interrupt_preinit_v3_hw(hisi_hba); 4964 4864 if (rc) 4965 - goto err_out_undo_debugfs; 4865 + goto err_out_free_host; 4966 4866 4967 4867 rc = scsi_add_host(shost, dev); 4968 4868 if (rc) 4969 - goto err_out_undo_debugfs; 4869 + goto err_out_free_host; 4970 4870 4971 4871 rc = sas_register_ha(sha); 4972 4872 if (rc) ··· 4974 4880 goto err_out_unregister_ha; 4975 4881 4976 4882 scsi_scan_host(shost); 4883 + if (hisi_sas_debugfs_enable) 4884 + debugfs_init_v3_hw(hisi_hba); 4977 4885 4978 4886 pm_runtime_set_autosuspend_delay(dev, 5000); 4979 4887 pm_runtime_use_autosuspend(dev); ··· 4996 4900 sas_unregister_ha(sha); 4997 4901 err_out_remove_host: 4998 4902 scsi_remove_host(shost); 4999 - err_out_undo_debugfs: 5000 - if (hisi_sas_debugfs_enable) 5001 - debugfs_exit_v3_hw(hisi_hba); 5002 4903 err_out_free_host: 5003 4904 hisi_sas_free(hisi_hba); 5004 4905 scsi_host_put(shost); ··· 5027 4934 struct Scsi_Host *shost = sha->shost; 5028 4935 5029 4936 pm_runtime_get_noresume(dev); 4937 + if (hisi_sas_debugfs_enable) 4938 + debugfs_exit_v3_hw(hisi_hba); 5030 4939 5031 4940 sas_unregister_ha(sha); 5032 4941 flush_workqueue(hisi_hba->wq); ··· 5036 4941 5037 4942 hisi_sas_v3_destroy_irqs(pdev, hisi_hba); 5038 4943 hisi_sas_free(hisi_hba); 5039 - if (hisi_sas_debugfs_enable) 5040 - debugfs_exit_v3_hw(hisi_hba); 5041 - 5042 4944 scsi_host_put(shost); 5043 4945 } 5044 4946 ··· 5126 5034 interrupt_disable_v3_hw(hisi_hba); 5127 5035 5128 5036 #ifdef CONFIG_PM 5129 - if (atomic_read(&device->power.usage_count)) { 5037 + if ((device->power.runtime_status == RPM_SUSPENDING) && 5038 + atomic_read(&device->power.usage_count)) { 5130 5039 dev_err(dev, "PM suspend: host status cannot be suspended\n"); 5131 5040 rc = -EBUSY; 5132 5041 goto err_out;
+1 -1
drivers/scsi/jazz_esp.c
··· 196 196 197 197 static struct platform_driver esp_jazz_driver = { 198 198 .probe = esp_jazz_probe, 199 - .remove_new = esp_jazz_remove, 199 + .remove = esp_jazz_remove, 200 200 .driver = { 201 201 .name = "jazz_esp", 202 202 },
+5 -1
drivers/scsi/lpfc/lpfc_bsg.c
··· 398 398 /* in case no data is transferred */ 399 399 bsg_reply->reply_payload_rcv_len = 0; 400 400 401 - if (ndlp->nlp_flag & NLP_ELS_SND_MASK) 401 + if (test_bit(NLP_PLOGI_SND, &ndlp->nlp_flag) || 402 + test_bit(NLP_PRLI_SND, &ndlp->nlp_flag) || 403 + test_bit(NLP_ADISC_SND, &ndlp->nlp_flag) || 404 + test_bit(NLP_LOGO_SND, &ndlp->nlp_flag) || 405 + test_bit(NLP_RNID_SND, &ndlp->nlp_flag)) 402 406 return -ENODEV; 403 407 404 408 /* allocate our bsg tracking structure */
+3 -2
drivers/scsi/lpfc/lpfc_crtn.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. * ··· 571 571 int lpfc_issue_unreg_vfi(struct lpfc_vport *); 572 572 int lpfc_selective_reset(struct lpfc_hba *); 573 573 int lpfc_sli4_read_config(struct lpfc_hba *); 574 - void lpfc_sli4_node_prep(struct lpfc_hba *); 574 + void lpfc_sli4_node_rpi_restore(struct lpfc_hba *phba); 575 575 int lpfc_sli4_els_sgl_update(struct lpfc_hba *phba); 576 576 int lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba); 577 577 int lpfc_io_buf_flush(struct lpfc_hba *phba, struct list_head *sglist); ··· 660 660 void lpfc_nvmet_cmd_template(void); 661 661 void lpfc_nvme_cancel_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, 662 662 uint32_t stat, uint32_t param); 663 + void lpfc_nvmels_flush_cmd(struct lpfc_hba *phba); 663 664 extern int lpfc_enable_nvmet_cnt; 664 665 extern unsigned long long lpfc_enable_nvmet[]; 665 666 extern int lpfc_no_hba_reset_cnt;
+21 -18
drivers/scsi/lpfc/lpfc_ct.c
··· 735 735 736 736 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 737 737 "0238 Process x%06x NameServer Rsp " 738 - "Data: x%x x%x x%x x%lx x%x\n", Did, 738 + "Data: x%lx x%x x%x x%lx x%x\n", Did, 739 739 ndlp->nlp_flag, ndlp->nlp_fc4_type, 740 740 ndlp->nlp_state, vport->fc_flag, 741 741 vport->fc_rscn_id_cnt); ··· 744 744 * state of ndlp hit devloss, change state to 745 745 * allow rediscovery. 746 746 */ 747 - if (ndlp->nlp_flag & NLP_NPR_2B_DISC && 747 + if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag) && 748 748 ndlp->nlp_state == NLP_STE_UNUSED_NODE) { 749 749 lpfc_nlp_set_state(vport, ndlp, 750 750 NLP_STE_NPR_NODE); ··· 832 832 if (ndlp->nlp_type != NLP_NVME_INITIATOR || 833 833 ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) 834 834 continue; 835 - spin_lock_irq(&ndlp->lock); 836 835 if (ndlp->nlp_DID == Did) 837 - ndlp->nlp_flag &= ~NLP_NVMET_RECOV; 836 + clear_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag); 838 837 else 839 - ndlp->nlp_flag |= NLP_NVMET_RECOV; 840 - spin_unlock_irq(&ndlp->lock); 838 + set_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag); 841 839 } 842 840 } 843 841 } ··· 892 894 */ 893 895 if (vport->phba->nvmet_support) { 894 896 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { 895 - if (!(ndlp->nlp_flag & NLP_NVMET_RECOV)) 897 + if (!test_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag)) 896 898 continue; 897 899 lpfc_disc_state_machine(vport, ndlp, NULL, 898 900 NLP_EVT_DEVICE_RECOVERY); 899 - spin_lock_irq(&ndlp->lock); 900 - ndlp->nlp_flag &= ~NLP_NVMET_RECOV; 901 - spin_unlock_irq(&ndlp->lock); 901 + clear_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag); 902 902 } 903 903 } 904 904 ··· 1436 1440 if (ndlp) { 1437 1441 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 1438 1442 "0242 Process x%x GFF " 1439 - "NameServer Rsp Data: x%x x%lx x%x\n", 1443 + "NameServer Rsp Data: x%lx x%lx x%x\n", 1440 1444 did, ndlp->nlp_flag, vport->fc_flag, 1441 1445 vport->fc_rscn_id_cnt); 1442 1446 } else { ··· 2222 2226 ulp_status, ulp_word4, latt); 2223 2227 2224 2228 if (latt || ulp_status) { 2229 + lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY, 2230 + "0229 FDMI cmd %04x failed, latt = %d " 2231 + "ulp_status: (x%x/x%x), sli_flag x%x\n", 2232 + be16_to_cpu(fdmi_cmd), latt, ulp_status, 2233 + ulp_word4, phba->sli.sli_flag); 2225 2234 2226 2235 /* Look for a retryable error */ 2227 2236 if (ulp_status == IOSTAT_LOCAL_REJECT) { ··· 2235 2234 case IOERR_SLI_DOWN: 2236 2235 /* Driver aborted this IO. No retry as error 2237 2236 * is likely Offline->Online or some adapter 2238 - * error. Recovery will try again. 2237 + * error. Recovery will try again, but if port 2238 + * is not active there's no point to continue 2239 + * issuing follow up FDMI commands. 2239 2240 */ 2241 + if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { 2242 + free_ndlp = cmdiocb->ndlp; 2243 + lpfc_ct_free_iocb(phba, cmdiocb); 2244 + lpfc_nlp_put(free_ndlp); 2245 + return; 2246 + } 2240 2247 break; 2241 2248 case IOERR_ABORT_IN_PROGRESS: 2242 2249 case IOERR_SEQUENCE_TIMEOUT: ··· 2265 2256 break; 2266 2257 } 2267 2258 } 2268 - 2269 - lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 2270 - "0229 FDMI cmd %04x latt = %d " 2271 - "ulp_status: x%x, rid x%x\n", 2272 - be16_to_cpu(fdmi_cmd), latt, ulp_status, 2273 - ulp_word4); 2274 2259 } 2275 2260 2276 2261 free_ndlp = cmdiocb->ndlp;
+2 -2
drivers/scsi/lpfc/lpfc_debugfs.c
··· 870 870 wwn_to_u64(ndlp->nlp_nodename.u.wwn)); 871 871 len += scnprintf(buf+len, size-len, "RPI:x%04x ", 872 872 ndlp->nlp_rpi); 873 - len += scnprintf(buf+len, size-len, "flag:x%08x ", 874 - ndlp->nlp_flag); 873 + len += scnprintf(buf+len, size-len, "flag:x%08lx ", 874 + ndlp->nlp_flag); 875 875 if (!ndlp->nlp_type) 876 876 len += scnprintf(buf+len, size-len, "UNKNOWN_TYPE "); 877 877 if (ndlp->nlp_type & NLP_FC_NODE)
+31 -31
drivers/scsi/lpfc/lpfc_disc.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-2022 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-2013 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 102 102 103 103 spinlock_t lock; /* Node management lock */ 104 104 105 - uint32_t nlp_flag; /* entry flags */ 105 + unsigned long nlp_flag; /* entry flags */ 106 106 uint32_t nlp_DID; /* FC D_ID of entry */ 107 107 uint32_t nlp_last_elscmd; /* Last ELS cmd sent */ 108 108 uint16_t nlp_type; ··· 182 182 #define lpfc_ndlp_check_qdepth(phba, ndlp) \ 183 183 (ndlp->cmd_qdepth < phba->sli4_hba.max_cfg_param.max_xri) 184 184 185 - /* Defines for nlp_flag (uint32) */ 186 - #define NLP_IGNR_REG_CMPL 0x00000001 /* Rcvd rscn before we cmpl reg login */ 187 - #define NLP_REG_LOGIN_SEND 0x00000002 /* sent reglogin to adapter */ 188 - #define NLP_RELEASE_RPI 0x00000004 /* Release RPI to free pool */ 189 - #define NLP_SUPPRESS_RSP 0x00000010 /* Remote NPort supports suppress rsp */ 190 - #define NLP_PLOGI_SND 0x00000020 /* sent PLOGI request for this entry */ 191 - #define NLP_PRLI_SND 0x00000040 /* sent PRLI request for this entry */ 192 - #define NLP_ADISC_SND 0x00000080 /* sent ADISC request for this entry */ 193 - #define NLP_LOGO_SND 0x00000100 /* sent LOGO request for this entry */ 194 - #define NLP_RNID_SND 0x00000400 /* sent RNID request for this entry */ 195 - #define NLP_ELS_SND_MASK 0x000007e0 /* sent ELS request for this entry */ 196 - #define NLP_NVMET_RECOV 0x00001000 /* NVMET auditing node for recovery. */ 197 - #define NLP_UNREG_INP 0x00008000 /* UNREG_RPI cmd is in progress */ 198 - #define NLP_DROPPED 0x00010000 /* Init ref count has been dropped */ 199 - #define NLP_DELAY_TMO 0x00020000 /* delay timeout is running for node */ 200 - #define NLP_NPR_2B_DISC 0x00040000 /* node is included in num_disc_nodes */ 201 - #define NLP_RCV_PLOGI 0x00080000 /* Rcv'ed PLOGI from remote system */ 202 - #define NLP_LOGO_ACC 0x00100000 /* Process LOGO after ACC completes */ 203 - #define NLP_TGT_NO_SCSIID 0x00200000 /* good PRLI but no binding for scsid */ 204 - #define NLP_ISSUE_LOGO 0x00400000 /* waiting to issue a LOGO */ 205 - #define NLP_IN_DEV_LOSS 0x00800000 /* devloss in progress */ 206 - #define NLP_ACC_REGLOGIN 0x01000000 /* Issue Reg Login after successful 185 + /* nlp_flag mask bits */ 186 + enum lpfc_nlp_flag { 187 + NLP_IGNR_REG_CMPL = 0, /* Rcvd rscn before we cmpl reg login */ 188 + NLP_REG_LOGIN_SEND = 1, /* sent reglogin to adapter */ 189 + NLP_SUPPRESS_RSP = 4, /* Remote NPort supports suppress rsp */ 190 + NLP_PLOGI_SND = 5, /* sent PLOGI request for this entry */ 191 + NLP_PRLI_SND = 6, /* sent PRLI request for this entry */ 192 + NLP_ADISC_SND = 7, /* sent ADISC request for this entry */ 193 + NLP_LOGO_SND = 8, /* sent LOGO request for this entry */ 194 + NLP_RNID_SND = 10, /* sent RNID request for this entry */ 195 + NLP_NVMET_RECOV = 12, /* NVMET auditing node for recovery. */ 196 + NLP_UNREG_INP = 15, /* UNREG_RPI cmd is in progress */ 197 + NLP_DROPPED = 16, /* Init ref count has been dropped */ 198 + NLP_DELAY_TMO = 17, /* delay timeout is running for node */ 199 + NLP_NPR_2B_DISC = 18, /* node is included in num_disc_nodes */ 200 + NLP_RCV_PLOGI = 19, /* Rcv'ed PLOGI from remote system */ 201 + NLP_LOGO_ACC = 20, /* Process LOGO after ACC completes */ 202 + NLP_TGT_NO_SCSIID = 21, /* good PRLI but no binding for scsid */ 203 + NLP_ISSUE_LOGO = 22, /* waiting to issue a LOGO */ 204 + NLP_IN_DEV_LOSS = 23, /* devloss in progress */ 205 + NLP_ACC_REGLOGIN = 24, /* Issue Reg Login after successful 207 206 ACC */ 208 - #define NLP_NPR_ADISC 0x02000000 /* Issue ADISC when dq'ed from 207 + NLP_NPR_ADISC = 25, /* Issue ADISC when dq'ed from 209 208 NPR list */ 210 - #define NLP_RM_DFLT_RPI 0x04000000 /* need to remove leftover dflt RPI */ 211 - #define NLP_NODEV_REMOVE 0x08000000 /* Defer removal till discovery ends */ 212 - #define NLP_TARGET_REMOVE 0x10000000 /* Target remove in process */ 213 - #define NLP_SC_REQ 0x20000000 /* Target requires authentication */ 214 - #define NLP_FIRSTBURST 0x40000000 /* Target supports FirstBurst */ 215 - #define NLP_RPI_REGISTERED 0x80000000 /* nlp_rpi is valid */ 209 + NLP_RM_DFLT_RPI = 26, /* need to remove leftover dflt RPI */ 210 + NLP_NODEV_REMOVE = 27, /* Defer removal till discovery ends */ 211 + NLP_TARGET_REMOVE = 28, /* Target remove in process */ 212 + NLP_SC_REQ = 29, /* Target requires authentication */ 213 + NLP_FIRSTBURST = 30, /* Target supports FirstBurst */ 214 + NLP_RPI_REGISTERED = 31 /* nlp_rpi is valid */ 215 + }; 216 216 217 217 /* There are 4 different double linked lists nodelist entries can reside on. 218 218 * The Port Login (PLOGI) list and Address Discovery (ADISC) list are used
+190 -273
drivers/scsi/lpfc/lpfc_els.c
··· 725 725 list_for_each_entry_safe(np, next_np, 726 726 &vport->fc_nodes, nlp_listp) { 727 727 if ((np->nlp_state != NLP_STE_NPR_NODE) || 728 - !(np->nlp_flag & NLP_NPR_ADISC)) 728 + !test_bit(NLP_NPR_ADISC, &np->nlp_flag)) 729 729 continue; 730 - spin_lock_irq(&np->lock); 731 - np->nlp_flag &= ~NLP_NPR_ADISC; 732 - spin_unlock_irq(&np->lock); 730 + clear_bit(NLP_NPR_ADISC, &np->nlp_flag); 733 731 lpfc_unreg_rpi(vport, np); 734 732 } 735 733 lpfc_cleanup_pending_mbox(vport); ··· 862 864 sizeof(struct lpfc_name)); 863 865 /* Set state will put ndlp onto node list if not already done */ 864 866 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 865 - spin_lock_irq(&ndlp->lock); 866 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 867 - spin_unlock_irq(&ndlp->lock); 867 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 868 868 869 869 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 870 870 if (!mbox) ··· 1014 1018 * registered with the SCSI transport, remove the initial 1015 1019 * reference to trigger node release. 1016 1020 */ 1017 - if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS) && 1021 + if (!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag) && 1018 1022 !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) 1019 1023 lpfc_nlp_put(ndlp); 1020 1024 ··· 1232 1236 1233 1237 lpfc_printf_log(phba, KERN_INFO, LOG_ELS, 1234 1238 "6445 ELS completes after LINK_DOWN: " 1235 - " Status %x/%x cmd x%x flg x%x\n", 1239 + " Status %x/%x cmd x%x flg x%x iotag x%x\n", 1236 1240 ulp_status, ulp_word4, cmd, 1237 - cmdiocb->cmd_flag); 1241 + cmdiocb->cmd_flag, cmdiocb->iotag); 1238 1242 1239 1243 if (cmdiocb->cmd_flag & LPFC_IO_FABRIC) { 1240 1244 cmdiocb->cmd_flag &= ~LPFC_IO_FABRIC; ··· 1544 1548 * Otherwise, decrement node reference to trigger release. 1545 1549 */ 1546 1550 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) && 1547 - !(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) 1551 + !test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag)) 1548 1552 lpfc_nlp_put(ndlp); 1549 1553 return 0; 1550 1554 } ··· 1593 1597 * Otherwise, decrement node reference to trigger release. 1594 1598 */ 1595 1599 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) && 1596 - !(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) 1600 + !test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag)) 1597 1601 lpfc_nlp_put(ndlp); 1598 1602 return 0; 1599 1603 } ··· 1671 1675 struct lpfc_nodelist *new_ndlp; 1672 1676 struct serv_parm *sp; 1673 1677 uint8_t name[sizeof(struct lpfc_name)]; 1674 - uint32_t keepDID = 0, keep_nlp_flag = 0; 1678 + uint32_t keepDID = 0; 1675 1679 int rc; 1676 - uint32_t keep_new_nlp_flag = 0; 1680 + unsigned long keep_nlp_flag = 0, keep_new_nlp_flag = 0; 1677 1681 uint16_t keep_nlp_state; 1678 1682 u32 keep_nlp_fc4_type = 0; 1679 1683 struct lpfc_nvme_rport *keep_nrport = NULL; ··· 1700 1704 } 1701 1705 1702 1706 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_NODE, 1703 - "3178 PLOGI confirm: ndlp x%x x%x x%x: " 1704 - "new_ndlp x%x x%x x%x\n", 1707 + "3178 PLOGI confirm: ndlp x%x x%lx x%x: " 1708 + "new_ndlp x%x x%lx x%x\n", 1705 1709 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_fc4_type, 1706 1710 (new_ndlp ? new_ndlp->nlp_DID : 0), 1707 1711 (new_ndlp ? new_ndlp->nlp_flag : 0), ··· 1765 1769 new_ndlp->nlp_flag = ndlp->nlp_flag; 1766 1770 1767 1771 /* if new_ndlp had NLP_UNREG_INP set, keep it */ 1768 - if (keep_new_nlp_flag & NLP_UNREG_INP) 1769 - new_ndlp->nlp_flag |= NLP_UNREG_INP; 1772 + if (test_bit(NLP_UNREG_INP, &keep_new_nlp_flag)) 1773 + set_bit(NLP_UNREG_INP, &new_ndlp->nlp_flag); 1770 1774 else 1771 - new_ndlp->nlp_flag &= ~NLP_UNREG_INP; 1775 + clear_bit(NLP_UNREG_INP, &new_ndlp->nlp_flag); 1772 1776 1773 1777 /* if new_ndlp had NLP_RPI_REGISTERED set, keep it */ 1774 - if (keep_new_nlp_flag & NLP_RPI_REGISTERED) 1775 - new_ndlp->nlp_flag |= NLP_RPI_REGISTERED; 1778 + if (test_bit(NLP_RPI_REGISTERED, &keep_new_nlp_flag)) 1779 + set_bit(NLP_RPI_REGISTERED, &new_ndlp->nlp_flag); 1776 1780 else 1777 - new_ndlp->nlp_flag &= ~NLP_RPI_REGISTERED; 1781 + clear_bit(NLP_RPI_REGISTERED, &new_ndlp->nlp_flag); 1778 1782 1779 1783 /* 1780 1784 * Retain the DROPPED flag. This will take care of the init 1781 1785 * refcount when affecting the state change 1782 1786 */ 1783 - if (keep_new_nlp_flag & NLP_DROPPED) 1784 - new_ndlp->nlp_flag |= NLP_DROPPED; 1787 + if (test_bit(NLP_DROPPED, &keep_new_nlp_flag)) 1788 + set_bit(NLP_DROPPED, &new_ndlp->nlp_flag); 1785 1789 else 1786 - new_ndlp->nlp_flag &= ~NLP_DROPPED; 1790 + clear_bit(NLP_DROPPED, &new_ndlp->nlp_flag); 1787 1791 1788 1792 ndlp->nlp_flag = keep_new_nlp_flag; 1789 1793 1790 1794 /* if ndlp had NLP_UNREG_INP set, keep it */ 1791 - if (keep_nlp_flag & NLP_UNREG_INP) 1792 - ndlp->nlp_flag |= NLP_UNREG_INP; 1795 + if (test_bit(NLP_UNREG_INP, &keep_nlp_flag)) 1796 + set_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 1793 1797 else 1794 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 1798 + clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 1795 1799 1796 1800 /* if ndlp had NLP_RPI_REGISTERED set, keep it */ 1797 - if (keep_nlp_flag & NLP_RPI_REGISTERED) 1798 - ndlp->nlp_flag |= NLP_RPI_REGISTERED; 1801 + if (test_bit(NLP_RPI_REGISTERED, &keep_nlp_flag)) 1802 + set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 1799 1803 else 1800 - ndlp->nlp_flag &= ~NLP_RPI_REGISTERED; 1804 + clear_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 1801 1805 1802 1806 /* 1803 1807 * Retain the DROPPED flag. This will take care of the init 1804 1808 * refcount when affecting the state change 1805 1809 */ 1806 - if (keep_nlp_flag & NLP_DROPPED) 1807 - ndlp->nlp_flag |= NLP_DROPPED; 1810 + if (test_bit(NLP_DROPPED, &keep_nlp_flag)) 1811 + set_bit(NLP_DROPPED, &ndlp->nlp_flag); 1808 1812 else 1809 - ndlp->nlp_flag &= ~NLP_DROPPED; 1813 + clear_bit(NLP_DROPPED, &ndlp->nlp_flag); 1810 1814 1811 1815 spin_unlock_irq(&new_ndlp->lock); 1812 1816 spin_unlock_irq(&ndlp->lock); ··· 1884 1888 phba->active_rrq_pool); 1885 1889 1886 1890 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_NODE, 1887 - "3173 PLOGI confirm exit: new_ndlp x%x x%x x%x\n", 1891 + "3173 PLOGI confirm exit: new_ndlp x%x x%lx x%x\n", 1888 1892 new_ndlp->nlp_DID, new_ndlp->nlp_flag, 1889 1893 new_ndlp->nlp_fc4_type); 1890 1894 ··· 2005 2009 IOCB_t *irsp; 2006 2010 struct lpfc_nodelist *ndlp, *free_ndlp; 2007 2011 struct lpfc_dmabuf *prsp; 2008 - int disc; 2012 + bool disc; 2009 2013 struct serv_parm *sp = NULL; 2010 2014 u32 ulp_status, ulp_word4, did, iotag; 2011 2015 bool release_node = false; ··· 2040 2044 /* Since ndlp can be freed in the disc state machine, note if this node 2041 2045 * is being used during discovery. 2042 2046 */ 2043 - spin_lock_irq(&ndlp->lock); 2044 - disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); 2045 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 2046 - spin_unlock_irq(&ndlp->lock); 2047 + disc = test_and_clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2047 2048 2048 2049 /* PLOGI completes to NPort <nlp_DID> */ 2049 2050 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, ··· 2053 2060 2054 2061 /* Check to see if link went down during discovery */ 2055 2062 if (lpfc_els_chk_latt(vport)) { 2056 - spin_lock_irq(&ndlp->lock); 2057 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 2058 - spin_unlock_irq(&ndlp->lock); 2063 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2059 2064 goto out; 2060 2065 } 2061 2066 ··· 2061 2070 /* Check for retry */ 2062 2071 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) { 2063 2072 /* ELS command is being retried */ 2064 - if (disc) { 2065 - spin_lock_irq(&ndlp->lock); 2066 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 2067 - spin_unlock_irq(&ndlp->lock); 2068 - } 2073 + if (disc) 2074 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2069 2075 goto out; 2070 2076 } 2071 2077 /* Warn PLOGI status Don't print the vport to vport rjts */ ··· 2085 2097 * with the reglogin process. 2086 2098 */ 2087 2099 spin_lock_irq(&ndlp->lock); 2088 - if ((ndlp->nlp_flag & (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI)) && 2100 + if ((test_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag) || 2101 + test_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag)) && 2089 2102 ndlp->nlp_state == NLP_STE_REG_LOGIN_ISSUE) { 2090 2103 spin_unlock_irq(&ndlp->lock); 2091 2104 goto out; ··· 2097 2108 * start the device remove process. 2098 2109 */ 2099 2110 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) { 2100 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 2101 - if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) 2111 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2112 + if (!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag)) 2102 2113 release_node = true; 2103 2114 } 2104 2115 spin_unlock_irq(&ndlp->lock); ··· 2201 2212 * outstanding UNREG_RPI mbox command completes, unless we 2202 2213 * are going offline. This logic does not apply for Fabric DIDs 2203 2214 */ 2204 - if ((ndlp->nlp_flag & (NLP_IGNR_REG_CMPL | NLP_UNREG_INP)) && 2215 + if ((test_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag) || 2216 + test_bit(NLP_UNREG_INP, &ndlp->nlp_flag)) && 2205 2217 ((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) && 2206 2218 !test_bit(FC_OFFLINE_MODE, &vport->fc_flag)) { 2207 2219 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 2208 2220 "4110 Issue PLOGI x%x deferred " 2209 - "on NPort x%x rpi x%x flg x%x Data:" 2221 + "on NPort x%x rpi x%x flg x%lx Data:" 2210 2222 " x%px\n", 2211 2223 ndlp->nlp_defer_did, ndlp->nlp_DID, 2212 2224 ndlp->nlp_rpi, ndlp->nlp_flag, ndlp); ··· 2325 2335 ulp_status = get_job_ulpstatus(phba, rspiocb); 2326 2336 ulp_word4 = get_job_word4(phba, rspiocb); 2327 2337 2328 - spin_lock_irq(&ndlp->lock); 2329 - ndlp->nlp_flag &= ~NLP_PRLI_SND; 2338 + clear_bit(NLP_PRLI_SND, &ndlp->nlp_flag); 2330 2339 2331 2340 /* Driver supports multiple FC4 types. Counters matter. */ 2341 + spin_lock_irq(&ndlp->lock); 2332 2342 vport->fc_prli_sent--; 2333 2343 ndlp->fc4_prli_sent--; 2334 2344 spin_unlock_irq(&ndlp->lock); ··· 2369 2379 /* Warn PRLI status */ 2370 2380 lpfc_printf_vlog(vport, mode, LOG_ELS, 2371 2381 "2754 PRLI DID:%06X Status:x%x/x%x, " 2372 - "data: x%x x%x x%x\n", 2382 + "data: x%x x%x x%lx\n", 2373 2383 ndlp->nlp_DID, ulp_status, 2374 2384 ulp_word4, ndlp->nlp_state, 2375 2385 ndlp->fc4_prli_sent, ndlp->nlp_flag); ··· 2386 2396 if ((ndlp->nlp_state >= NLP_STE_PLOGI_ISSUE && 2387 2397 ndlp->nlp_state <= NLP_STE_REG_LOGIN_ISSUE) || 2388 2398 (ndlp->nlp_state == NLP_STE_NPR_NODE && 2389 - ndlp->nlp_flag & NLP_DELAY_TMO)) { 2390 - lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE, 2399 + test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag))) { 2400 + lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE, 2391 2401 "2784 PRLI cmpl: Allow Node recovery " 2392 - "DID x%06x nstate x%x nflag x%x\n", 2402 + "DID x%06x nstate x%x nflag x%lx\n", 2393 2403 ndlp->nlp_DID, ndlp->nlp_state, 2394 2404 ndlp->nlp_flag); 2395 2405 goto out; ··· 2410 2420 spin_lock_irq(&ndlp->lock); 2411 2421 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) && 2412 2422 !ndlp->fc4_prli_sent) { 2413 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 2414 - if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) 2423 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2424 + if (!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag)) 2415 2425 release_node = true; 2416 2426 } 2417 2427 spin_unlock_irq(&ndlp->lock); ··· 2486 2496 ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); 2487 2497 ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); 2488 2498 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 2489 - ndlp->nlp_flag &= ~(NLP_FIRSTBURST | NLP_NPR_2B_DISC); 2499 + clear_bit(NLP_FIRSTBURST, &ndlp->nlp_flag); 2500 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2490 2501 ndlp->nvme_fb_size = 0; 2491 2502 2492 2503 send_next_prli: ··· 2618 2627 * the ndlp is used to track outstanding PRLIs for different 2619 2628 * FC4 types. 2620 2629 */ 2630 + set_bit(NLP_PRLI_SND, &ndlp->nlp_flag); 2621 2631 spin_lock_irq(&ndlp->lock); 2622 - ndlp->nlp_flag |= NLP_PRLI_SND; 2623 2632 vport->fc_prli_sent++; 2624 2633 ndlp->fc4_prli_sent++; 2625 2634 spin_unlock_irq(&ndlp->lock); ··· 2780 2789 struct lpfc_vport *vport = cmdiocb->vport; 2781 2790 IOCB_t *irsp; 2782 2791 struct lpfc_nodelist *ndlp; 2783 - int disc; 2792 + bool disc; 2784 2793 u32 ulp_status, ulp_word4, tmo, iotag; 2785 2794 bool release_node = false; 2786 2795 ··· 2809 2818 /* Since ndlp can be freed in the disc state machine, note if this node 2810 2819 * is being used during discovery. 2811 2820 */ 2812 - spin_lock_irq(&ndlp->lock); 2813 - disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC); 2814 - ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC); 2815 - spin_unlock_irq(&ndlp->lock); 2821 + disc = test_and_clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2822 + clear_bit(NLP_ADISC_SND, &ndlp->nlp_flag); 2816 2823 /* ADISC completes to NPort <nlp_DID> */ 2817 2824 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 2818 2825 "0104 ADISC completes to NPort x%x " ··· 2821 2832 2822 2833 /* Check to see if link went down during discovery */ 2823 2834 if (lpfc_els_chk_latt(vport)) { 2824 - spin_lock_irq(&ndlp->lock); 2825 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 2826 - spin_unlock_irq(&ndlp->lock); 2835 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2827 2836 goto out; 2828 2837 } 2829 2838 ··· 2830 2843 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) { 2831 2844 /* ELS command is being retried */ 2832 2845 if (disc) { 2833 - spin_lock_irq(&ndlp->lock); 2834 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 2835 - spin_unlock_irq(&ndlp->lock); 2846 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2836 2847 lpfc_set_disctmo(vport); 2837 2848 } 2838 2849 goto out; ··· 2849 2864 */ 2850 2865 spin_lock_irq(&ndlp->lock); 2851 2866 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) { 2852 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 2853 - if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS)) 2867 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2868 + if (!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag)) 2854 2869 release_node = true; 2855 2870 } 2856 2871 spin_unlock_irq(&ndlp->lock); ··· 2923 2938 2924 2939 phba->fc_stat.elsXmitADISC++; 2925 2940 elsiocb->cmd_cmpl = lpfc_cmpl_els_adisc; 2926 - spin_lock_irq(&ndlp->lock); 2927 - ndlp->nlp_flag |= NLP_ADISC_SND; 2928 - spin_unlock_irq(&ndlp->lock); 2941 + set_bit(NLP_ADISC_SND, &ndlp->nlp_flag); 2929 2942 elsiocb->ndlp = lpfc_nlp_get(ndlp); 2930 2943 if (!elsiocb->ndlp) { 2931 2944 lpfc_els_free_iocb(phba, elsiocb); ··· 2944 2961 return 0; 2945 2962 2946 2963 err: 2947 - spin_lock_irq(&ndlp->lock); 2948 - ndlp->nlp_flag &= ~NLP_ADISC_SND; 2949 - spin_unlock_irq(&ndlp->lock); 2964 + clear_bit(NLP_ADISC_SND, &ndlp->nlp_flag); 2950 2965 return 1; 2951 2966 } 2952 2967 ··· 2966 2985 struct lpfc_nodelist *ndlp = cmdiocb->ndlp; 2967 2986 struct lpfc_vport *vport = ndlp->vport; 2968 2987 IOCB_t *irsp; 2969 - unsigned long flags; 2970 2988 uint32_t skip_recovery = 0; 2971 2989 int wake_up_waiter = 0; 2972 2990 u32 ulp_status; ··· 2987 3007 iotag = irsp->ulpIoTag; 2988 3008 } 2989 3009 3010 + clear_bit(NLP_LOGO_SND, &ndlp->nlp_flag); 2990 3011 spin_lock_irq(&ndlp->lock); 2991 - ndlp->nlp_flag &= ~NLP_LOGO_SND; 2992 3012 if (ndlp->save_flags & NLP_WAIT_FOR_LOGO) { 2993 3013 wake_up_waiter = 1; 2994 3014 ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO; ··· 3003 3023 /* LOGO completes to NPort <nlp_DID> */ 3004 3024 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 3005 3025 "0105 LOGO completes to NPort x%x " 3006 - "IoTag x%x refcnt %d nflags x%x xflags x%x " 3026 + "IoTag x%x refcnt %d nflags x%lx xflags x%x " 3007 3027 "Data: x%x x%x x%x x%x\n", 3008 3028 ndlp->nlp_DID, iotag, 3009 3029 kref_read(&ndlp->kref), ndlp->nlp_flag, ··· 3041 3061 /* The driver sets this flag for an NPIV instance that doesn't want to 3042 3062 * log into the remote port. 3043 3063 */ 3044 - if (ndlp->nlp_flag & NLP_TARGET_REMOVE) { 3045 - spin_lock_irq(&ndlp->lock); 3046 - if (phba->sli_rev == LPFC_SLI_REV4) 3047 - ndlp->nlp_flag |= NLP_RELEASE_RPI; 3048 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 3049 - spin_unlock_irq(&ndlp->lock); 3064 + if (test_bit(NLP_TARGET_REMOVE, &ndlp->nlp_flag)) { 3065 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 3050 3066 lpfc_disc_state_machine(vport, ndlp, cmdiocb, 3051 3067 NLP_EVT_DEVICE_RM); 3052 3068 goto out_rsrc_free; ··· 3065 3089 if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET) && 3066 3090 skip_recovery == 0) { 3067 3091 lpfc_cancel_retry_delay_tmo(vport, ndlp); 3068 - spin_lock_irqsave(&ndlp->lock, flags); 3069 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 3070 - spin_unlock_irqrestore(&ndlp->lock, flags); 3092 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 3071 3093 3072 3094 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 3073 3095 "3187 LOGO completes to NPort x%x: Start " ··· 3087 3113 * register with the transport. 3088 3114 */ 3089 3115 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) { 3090 - spin_lock_irq(&ndlp->lock); 3091 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 3092 - spin_unlock_irq(&ndlp->lock); 3116 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 3093 3117 lpfc_disc_state_machine(vport, ndlp, cmdiocb, 3094 3118 NLP_EVT_DEVICE_RM); 3095 3119 } ··· 3128 3156 uint16_t cmdsize; 3129 3157 int rc; 3130 3158 3131 - spin_lock_irq(&ndlp->lock); 3132 - if (ndlp->nlp_flag & NLP_LOGO_SND) { 3133 - spin_unlock_irq(&ndlp->lock); 3159 + if (test_bit(NLP_LOGO_SND, &ndlp->nlp_flag)) 3134 3160 return 0; 3135 - } 3136 - spin_unlock_irq(&ndlp->lock); 3137 3161 3138 3162 cmdsize = (2 * sizeof(uint32_t)) + sizeof(struct lpfc_name); 3139 3163 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, ··· 3148 3180 3149 3181 phba->fc_stat.elsXmitLOGO++; 3150 3182 elsiocb->cmd_cmpl = lpfc_cmpl_els_logo; 3151 - spin_lock_irq(&ndlp->lock); 3152 - ndlp->nlp_flag |= NLP_LOGO_SND; 3153 - ndlp->nlp_flag &= ~NLP_ISSUE_LOGO; 3154 - spin_unlock_irq(&ndlp->lock); 3183 + set_bit(NLP_LOGO_SND, &ndlp->nlp_flag); 3184 + clear_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag); 3155 3185 elsiocb->ndlp = lpfc_nlp_get(ndlp); 3156 3186 if (!elsiocb->ndlp) { 3157 3187 lpfc_els_free_iocb(phba, elsiocb); ··· 3174 3208 return 0; 3175 3209 3176 3210 err: 3177 - spin_lock_irq(&ndlp->lock); 3178 - ndlp->nlp_flag &= ~NLP_LOGO_SND; 3179 - spin_unlock_irq(&ndlp->lock); 3211 + clear_bit(NLP_LOGO_SND, &ndlp->nlp_flag); 3180 3212 return 1; 3181 3213 } 3182 3214 ··· 3250 3286 static int 3251 3287 lpfc_reg_fab_ctrl_node(struct lpfc_vport *vport, struct lpfc_nodelist *fc_ndlp) 3252 3288 { 3253 - int rc = 0; 3289 + int rc; 3254 3290 struct lpfc_hba *phba = vport->phba; 3255 3291 struct lpfc_nodelist *ns_ndlp; 3256 3292 LPFC_MBOXQ_t *mbox; 3257 3293 3258 - if (fc_ndlp->nlp_flag & NLP_RPI_REGISTERED) 3259 - return rc; 3294 + if (test_bit(NLP_RPI_REGISTERED, &fc_ndlp->nlp_flag)) 3295 + return 0; 3260 3296 3261 3297 ns_ndlp = lpfc_findnode_did(vport, NameServer_DID); 3262 3298 if (!ns_ndlp) ··· 3273 3309 if (!mbox) { 3274 3310 lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE, 3275 3311 "0936 %s: no memory for reg_login " 3276 - "Data: x%x x%x x%x x%x\n", __func__, 3312 + "Data: x%x x%x x%lx x%x\n", __func__, 3277 3313 fc_ndlp->nlp_DID, fc_ndlp->nlp_state, 3278 3314 fc_ndlp->nlp_flag, fc_ndlp->nlp_rpi); 3279 3315 return -ENOMEM; ··· 3285 3321 goto out; 3286 3322 } 3287 3323 3288 - fc_ndlp->nlp_flag |= NLP_REG_LOGIN_SEND; 3324 + set_bit(NLP_REG_LOGIN_SEND, &fc_ndlp->nlp_flag); 3289 3325 mbox->mbox_cmpl = lpfc_mbx_cmpl_fc_reg_login; 3290 3326 mbox->ctx_ndlp = lpfc_nlp_get(fc_ndlp); 3291 3327 if (!mbox->ctx_ndlp) { ··· 3309 3345 lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); 3310 3346 lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE, 3311 3347 "0938 %s: failed to format reg_login " 3312 - "Data: x%x x%x x%x x%x\n", __func__, 3348 + "Data: x%x x%x x%lx x%x\n", __func__, 3313 3349 fc_ndlp->nlp_DID, fc_ndlp->nlp_state, 3314 3350 fc_ndlp->nlp_flag, fc_ndlp->nlp_rpi); 3315 3351 return rc; ··· 4348 4384 { 4349 4385 struct lpfc_work_evt *evtp; 4350 4386 4351 - if (!(nlp->nlp_flag & NLP_DELAY_TMO)) 4387 + if (!test_and_clear_bit(NLP_DELAY_TMO, &nlp->nlp_flag)) 4352 4388 return; 4353 - spin_lock_irq(&nlp->lock); 4354 - nlp->nlp_flag &= ~NLP_DELAY_TMO; 4355 - spin_unlock_irq(&nlp->lock); 4356 4389 del_timer_sync(&nlp->nlp_delayfunc); 4357 4390 nlp->nlp_last_elscmd = 0; 4358 4391 if (!list_empty(&nlp->els_retry_evt.evt_listp)) { ··· 4358 4397 evtp = &nlp->els_retry_evt; 4359 4398 lpfc_nlp_put((struct lpfc_nodelist *)evtp->evt_arg1); 4360 4399 } 4361 - if (nlp->nlp_flag & NLP_NPR_2B_DISC) { 4362 - spin_lock_irq(&nlp->lock); 4363 - nlp->nlp_flag &= ~NLP_NPR_2B_DISC; 4364 - spin_unlock_irq(&nlp->lock); 4400 + if (test_and_clear_bit(NLP_NPR_2B_DISC, &nlp->nlp_flag)) { 4365 4401 if (vport->num_disc_nodes) { 4366 4402 if (vport->port_state < LPFC_VPORT_READY) { 4367 4403 /* Check if there are more ADISCs to be sent */ ··· 4438 4480 spin_lock_irq(&ndlp->lock); 4439 4481 cmd = ndlp->nlp_last_elscmd; 4440 4482 ndlp->nlp_last_elscmd = 0; 4441 - 4442 - if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { 4443 - spin_unlock_irq(&ndlp->lock); 4444 - return; 4445 - } 4446 - 4447 - ndlp->nlp_flag &= ~NLP_DELAY_TMO; 4448 4483 spin_unlock_irq(&ndlp->lock); 4484 + 4485 + if (!test_and_clear_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) 4486 + return; 4487 + 4449 4488 /* 4450 4489 * If a discovery event readded nlp_delayfunc after timer 4451 4490 * firing and before processing the timer, cancel the ··· 4965 5010 /* delay is specified in milliseconds */ 4966 5011 mod_timer(&ndlp->nlp_delayfunc, 4967 5012 jiffies + msecs_to_jiffies(delay)); 4968 - spin_lock_irq(&ndlp->lock); 4969 - ndlp->nlp_flag |= NLP_DELAY_TMO; 4970 - spin_unlock_irq(&ndlp->lock); 5013 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 4971 5014 4972 5015 ndlp->nlp_prev_state = ndlp->nlp_state; 4973 5016 if ((cmd == ELS_CMD_PRLI) || ··· 5025 5072 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 5026 5073 "0108 No retry ELS command x%x to remote " 5027 5074 "NPORT x%x Retried:%d Error:x%x/%x " 5028 - "IoTag x%x nflags x%x\n", 5075 + "IoTag x%x nflags x%lx\n", 5029 5076 cmd, did, cmdiocb->retry, ulp_status, 5030 5077 ulp_word4, cmdiocb->iotag, 5031 5078 (ndlp ? ndlp->nlp_flag : 0)); ··· 5192 5239 /* ACC to LOGO completes to NPort <nlp_DID> */ 5193 5240 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 5194 5241 "0109 ACC to LOGO completes to NPort x%x refcnt %d " 5195 - "last els x%x Data: x%x x%x x%x\n", 5242 + "last els x%x Data: x%lx x%x x%x\n", 5196 5243 ndlp->nlp_DID, kref_read(&ndlp->kref), 5197 5244 ndlp->nlp_last_elscmd, ndlp->nlp_flag, ndlp->nlp_state, 5198 5245 ndlp->nlp_rpi); ··· 5207 5254 goto out; 5208 5255 5209 5256 if (ndlp->nlp_state == NLP_STE_NPR_NODE) { 5210 - if (ndlp->nlp_flag & NLP_RPI_REGISTERED) 5257 + if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) 5211 5258 lpfc_unreg_rpi(vport, ndlp); 5212 5259 5213 5260 /* If came from PRLO, then PRLO_ACC is done. 5214 5261 * Start rediscovery now. 5215 5262 */ 5216 5263 if (ndlp->nlp_last_elscmd == ELS_CMD_PRLO) { 5217 - spin_lock_irq(&ndlp->lock); 5218 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 5219 - spin_unlock_irq(&ndlp->lock); 5264 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 5220 5265 ndlp->nlp_prev_state = ndlp->nlp_state; 5221 5266 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); 5222 5267 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); ··· 5251 5300 5252 5301 if (ndlp) { 5253 5302 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, 5254 - "0006 rpi x%x DID:%x flg:%x %d x%px " 5303 + "0006 rpi x%x DID:%x flg:%lx %d x%px " 5255 5304 "mbx_cmd x%x mbx_flag x%x x%px\n", 5256 5305 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, 5257 5306 kref_read(&ndlp->kref), ndlp, mbx_cmd, ··· 5262 5311 * first on an UNREG_LOGIN and then release the final 5263 5312 * references. 5264 5313 */ 5265 - spin_lock_irq(&ndlp->lock); 5266 - ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 5314 + clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 5267 5315 if (mbx_cmd == MBX_UNREG_LOGIN) 5268 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 5269 - spin_unlock_irq(&ndlp->lock); 5316 + clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 5270 5317 lpfc_nlp_put(ndlp); 5271 5318 lpfc_drop_node(ndlp->vport, ndlp); 5272 5319 } ··· 5330 5381 /* ELS response tag <ulpIoTag> completes */ 5331 5382 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 5332 5383 "0110 ELS response tag x%x completes " 5333 - "Data: x%x x%x x%x x%x x%x x%x x%x x%x %p %p\n", 5384 + "Data: x%x x%x x%x x%x x%lx x%x x%x x%x %p %p\n", 5334 5385 iotag, ulp_status, ulp_word4, tmo, 5335 5386 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, 5336 5387 ndlp->nlp_rpi, kref_read(&ndlp->kref), mbox, ndlp); 5337 5388 if (mbox) { 5338 - if (ulp_status == 0 5339 - && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { 5389 + if (ulp_status == 0 && 5390 + test_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag)) { 5340 5391 if (!lpfc_unreg_rpi(vport, ndlp) && 5341 5392 !test_bit(FC_PT2PT, &vport->fc_flag)) { 5342 - if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || 5393 + if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || 5343 5394 ndlp->nlp_state == 5344 5395 NLP_STE_REG_LOGIN_ISSUE) { 5345 5396 lpfc_printf_vlog(vport, KERN_INFO, 5346 5397 LOG_DISCOVERY, 5347 5398 "0314 PLOGI recov " 5348 5399 "DID x%x " 5349 - "Data: x%x x%x x%x\n", 5400 + "Data: x%x x%x x%lx\n", 5350 5401 ndlp->nlp_DID, 5351 5402 ndlp->nlp_state, 5352 5403 ndlp->nlp_rpi, ··· 5363 5414 goto out_free_mbox; 5364 5415 5365 5416 mbox->vport = vport; 5366 - if (ndlp->nlp_flag & NLP_RM_DFLT_RPI) { 5417 + if (test_bit(NLP_RM_DFLT_RPI, &ndlp->nlp_flag)) { 5367 5418 mbox->mbox_flag |= LPFC_MBX_IMED_UNREG; 5368 5419 mbox->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi; 5369 - } 5370 - else { 5420 + } else { 5371 5421 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; 5372 5422 ndlp->nlp_prev_state = ndlp->nlp_state; 5373 5423 lpfc_nlp_set_state(vport, ndlp, 5374 5424 NLP_STE_REG_LOGIN_ISSUE); 5375 5425 } 5376 5426 5377 - ndlp->nlp_flag |= NLP_REG_LOGIN_SEND; 5427 + set_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 5378 5428 if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) 5379 5429 != MBX_NOT_FINISHED) 5380 5430 goto out; ··· 5382 5434 * set for this failed mailbox command. 5383 5435 */ 5384 5436 lpfc_nlp_put(ndlp); 5385 - ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 5437 + clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 5386 5438 5387 5439 /* ELS rsp: Cannot issue reg_login for <NPortid> */ 5388 5440 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 5389 5441 "0138 ELS rsp: Cannot issue reg_login for x%x " 5390 - "Data: x%x x%x x%x\n", 5442 + "Data: x%lx x%x x%x\n", 5391 5443 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, 5392 5444 ndlp->nlp_rpi); 5393 5445 } ··· 5396 5448 } 5397 5449 out: 5398 5450 if (ndlp && shost) { 5399 - spin_lock_irq(&ndlp->lock); 5400 5451 if (mbox) 5401 - ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN; 5402 - ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI; 5403 - spin_unlock_irq(&ndlp->lock); 5452 + clear_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag); 5453 + clear_bit(NLP_RM_DFLT_RPI, &ndlp->nlp_flag); 5404 5454 } 5405 5455 5406 5456 /* An SLI4 NPIV instance wants to drop the node at this point under 5407 - * these conditions and release the RPI. 5457 + * these conditions because it doesn't need the login. 5408 5458 */ 5409 5459 if (phba->sli_rev == LPFC_SLI_REV4 && 5410 5460 vport && vport->port_type == LPFC_NPIV_PORT && 5411 5461 !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) { 5412 - if (ndlp->nlp_flag & NLP_RELEASE_RPI) { 5413 - if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE && 5414 - ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) { 5415 - lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); 5416 - spin_lock_irq(&ndlp->lock); 5417 - ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR; 5418 - ndlp->nlp_flag &= ~NLP_RELEASE_RPI; 5419 - spin_unlock_irq(&ndlp->lock); 5420 - } 5421 - lpfc_drop_node(vport, ndlp); 5422 - } else if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE && 5423 - ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE && 5424 - ndlp->nlp_state != NLP_STE_PRLI_ISSUE) { 5462 + if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE && 5463 + ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE && 5464 + ndlp->nlp_state != NLP_STE_PRLI_ISSUE) { 5425 5465 /* Drop ndlp if there is no planned or outstanding 5426 5466 * issued PRLI. 5427 5467 * ··· 5476 5540 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, 5477 5541 ndlp, ndlp->nlp_DID, ELS_CMD_ACC); 5478 5542 if (!elsiocb) { 5479 - spin_lock_irq(&ndlp->lock); 5480 - ndlp->nlp_flag &= ~NLP_LOGO_ACC; 5481 - spin_unlock_irq(&ndlp->lock); 5543 + clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 5482 5544 return 1; 5483 5545 } 5484 5546 ··· 5504 5570 pcmd += sizeof(uint32_t); 5505 5571 5506 5572 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 5507 - "Issue ACC: did:x%x flg:x%x", 5573 + "Issue ACC: did:x%x flg:x%lx", 5508 5574 ndlp->nlp_DID, ndlp->nlp_flag, 0); 5509 5575 break; 5510 5576 case ELS_CMD_FLOGI: ··· 5583 5649 } 5584 5650 5585 5651 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 5586 - "Issue ACC FLOGI/PLOGI: did:x%x flg:x%x", 5652 + "Issue ACC FLOGI/PLOGI: did:x%x flg:x%lx", 5587 5653 ndlp->nlp_DID, ndlp->nlp_flag, 0); 5588 5654 break; 5589 5655 case ELS_CMD_PRLO: ··· 5621 5687 els_pkt_ptr->un.prlo.acceptRspCode = PRLO_REQ_EXECUTED; 5622 5688 5623 5689 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 5624 - "Issue ACC PRLO: did:x%x flg:x%x", 5690 + "Issue ACC PRLO: did:x%x flg:x%lx", 5625 5691 ndlp->nlp_DID, ndlp->nlp_flag, 0); 5626 5692 break; 5627 5693 case ELS_CMD_RDF: ··· 5666 5732 default: 5667 5733 return 1; 5668 5734 } 5669 - if (ndlp->nlp_flag & NLP_LOGO_ACC) { 5670 - spin_lock_irq(&ndlp->lock); 5671 - if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED || 5672 - ndlp->nlp_flag & NLP_REG_LOGIN_SEND)) 5673 - ndlp->nlp_flag &= ~NLP_LOGO_ACC; 5674 - spin_unlock_irq(&ndlp->lock); 5735 + if (test_bit(NLP_LOGO_ACC, &ndlp->nlp_flag)) { 5736 + if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag) && 5737 + !test_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag)) 5738 + clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 5675 5739 elsiocb->cmd_cmpl = lpfc_cmpl_els_logo_acc; 5676 5740 } else { 5677 5741 elsiocb->cmd_cmpl = lpfc_cmpl_els_rsp; ··· 5692 5760 /* Xmit ELS ACC response tag <ulpIoTag> */ 5693 5761 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 5694 5762 "0128 Xmit ELS ACC response Status: x%x, IoTag: x%x, " 5695 - "XRI: x%x, DID: x%x, nlp_flag: x%x nlp_state: x%x " 5763 + "XRI: x%x, DID: x%x, nlp_flag: x%lx nlp_state: x%x " 5696 5764 "RPI: x%x, fc_flag x%lx refcnt %d\n", 5697 5765 rc, elsiocb->iotag, elsiocb->sli4_xritag, 5698 5766 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, ··· 5767 5835 /* Xmit ELS RJT <err> response tag <ulpIoTag> */ 5768 5836 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 5769 5837 "0129 Xmit ELS RJT x%x response tag x%x " 5770 - "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " 5838 + "xri x%x, did x%x, nlp_flag x%lx, nlp_state x%x, " 5771 5839 "rpi x%x\n", 5772 5840 rejectError, elsiocb->iotag, 5773 5841 get_job_ulpcontext(phba, elsiocb), ndlp->nlp_DID, 5774 5842 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); 5775 5843 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 5776 - "Issue LS_RJT: did:x%x flg:x%x err:x%x", 5844 + "Issue LS_RJT: did:x%x flg:x%lx err:x%x", 5777 5845 ndlp->nlp_DID, ndlp->nlp_flag, rejectError); 5778 5846 5779 5847 phba->fc_stat.elsXmitLSRJT++; ··· 5782 5850 if (!elsiocb->ndlp) { 5783 5851 lpfc_els_free_iocb(phba, elsiocb); 5784 5852 return 1; 5785 - } 5786 - 5787 - /* The NPIV instance is rejecting this unsolicited ELS. Make sure the 5788 - * node's assigned RPI gets released provided this node is not already 5789 - * registered with the transport. 5790 - */ 5791 - if (phba->sli_rev == LPFC_SLI_REV4 && 5792 - vport->port_type == LPFC_NPIV_PORT && 5793 - !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) { 5794 - spin_lock_irq(&ndlp->lock); 5795 - ndlp->nlp_flag |= NLP_RELEASE_RPI; 5796 - spin_unlock_irq(&ndlp->lock); 5797 5853 } 5798 5854 5799 5855 rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); ··· 5864 5944 lpfc_format_edc_lft_desc(phba, tlv); 5865 5945 5866 5946 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 5867 - "Issue EDC ACC: did:x%x flg:x%x refcnt %d", 5947 + "Issue EDC ACC: did:x%x flg:x%lx refcnt %d", 5868 5948 ndlp->nlp_DID, ndlp->nlp_flag, 5869 5949 kref_read(&ndlp->kref)); 5870 5950 elsiocb->cmd_cmpl = lpfc_cmpl_els_rsp; ··· 5886 5966 /* Xmit ELS ACC response tag <ulpIoTag> */ 5887 5967 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 5888 5968 "0152 Xmit EDC ACC response Status: x%x, IoTag: x%x, " 5889 - "XRI: x%x, DID: x%x, nlp_flag: x%x nlp_state: x%x " 5969 + "XRI: x%x, DID: x%x, nlp_flag: x%lx nlp_state: x%x " 5890 5970 "RPI: x%x, fc_flag x%lx\n", 5891 5971 rc, elsiocb->iotag, elsiocb->sli4_xritag, 5892 5972 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, ··· 5955 6035 /* Xmit ADISC ACC response tag <ulpIoTag> */ 5956 6036 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 5957 6037 "0130 Xmit ADISC ACC response iotag x%x xri: " 5958 - "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n", 6038 + "x%x, did x%x, nlp_flag x%lx, nlp_state x%x rpi x%x\n", 5959 6039 elsiocb->iotag, ulp_context, 5960 6040 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, 5961 6041 ndlp->nlp_rpi); ··· 5971 6051 ap->DID = be32_to_cpu(vport->fc_myDID); 5972 6052 5973 6053 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 5974 - "Issue ACC ADISC: did:x%x flg:x%x refcnt %d", 6054 + "Issue ACC ADISC: did:x%x flg:x%lx refcnt %d", 5975 6055 ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); 5976 6056 5977 6057 phba->fc_stat.elsXmitACC++; ··· 6077 6157 /* Xmit PRLI ACC response tag <ulpIoTag> */ 6078 6158 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 6079 6159 "0131 Xmit PRLI ACC response tag x%x xri x%x, " 6080 - "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", 6160 + "did x%x, nlp_flag x%lx, nlp_state x%x, rpi x%x\n", 6081 6161 elsiocb->iotag, ulp_context, 6082 6162 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, 6083 6163 ndlp->nlp_rpi); ··· 6148 6228 6149 6229 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, 6150 6230 "6015 NVME issue PRLI ACC word1 x%08x " 6151 - "word4 x%08x word5 x%08x flag x%x, " 6231 + "word4 x%08x word5 x%08x flag x%lx, " 6152 6232 "fcp_info x%x nlp_type x%x\n", 6153 6233 npr_nvme->word1, npr_nvme->word4, 6154 6234 npr_nvme->word5, ndlp->nlp_flag, ··· 6163 6243 ndlp->nlp_DID); 6164 6244 6165 6245 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 6166 - "Issue ACC PRLI: did:x%x flg:x%x", 6246 + "Issue ACC PRLI: did:x%x flg:x%lx", 6167 6247 ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); 6168 6248 6169 6249 phba->fc_stat.elsXmitACC++; ··· 6277 6357 } 6278 6358 6279 6359 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 6280 - "Issue ACC RNID: did:x%x flg:x%x refcnt %d", 6360 + "Issue ACC RNID: did:x%x flg:x%lx refcnt %d", 6281 6361 ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); 6282 6362 6283 6363 phba->fc_stat.elsXmitACC++; ··· 6334 6414 get_job_ulpcontext(phba, iocb)); 6335 6415 6336 6416 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 6337 - "Clear RRQ: did:x%x flg:x%x exchg:x%.08x", 6417 + "Clear RRQ: did:x%x flg:x%lx exchg:x%.08x", 6338 6418 ndlp->nlp_DID, ndlp->nlp_flag, rrq->rrq_exchg); 6339 6419 if (vport->fc_myDID == be32_to_cpu(bf_get(rrq_did, rrq))) 6340 6420 xri = bf_get(rrq_oxid, rrq); ··· 6411 6491 memcpy(pcmd, data, cmdsize - sizeof(uint32_t)); 6412 6492 6413 6493 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 6414 - "Issue ACC ECHO: did:x%x flg:x%x refcnt %d", 6494 + "Issue ACC ECHO: did:x%x flg:x%lx refcnt %d", 6415 6495 ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); 6416 6496 6417 6497 phba->fc_stat.elsXmitACC++; ··· 6461 6541 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 6462 6542 6463 6543 if (ndlp->nlp_state != NLP_STE_NPR_NODE || 6464 - !(ndlp->nlp_flag & NLP_NPR_ADISC)) 6544 + !test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) 6465 6545 continue; 6466 6546 6467 - spin_lock_irq(&ndlp->lock); 6468 - ndlp->nlp_flag &= ~NLP_NPR_ADISC; 6469 - spin_unlock_irq(&ndlp->lock); 6547 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 6470 6548 6471 - if (!(ndlp->nlp_flag & NLP_NPR_2B_DISC)) { 6549 + if (!test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 6472 6550 /* This node was marked for ADISC but was not picked 6473 6551 * for discovery. This is possible if the node was 6474 6552 * missing in gidft response. ··· 6524 6606 /* go thru NPR nodes and issue any remaining ELS PLOGIs */ 6525 6607 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 6526 6608 if (ndlp->nlp_state == NLP_STE_NPR_NODE && 6527 - (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && 6528 - (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 && 6529 - (ndlp->nlp_flag & NLP_NPR_ADISC) == 0) { 6609 + test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag) && 6610 + !test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag) && 6611 + !test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) { 6530 6612 ndlp->nlp_prev_state = ndlp->nlp_state; 6531 6613 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); 6532 6614 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); ··· 7022 7104 7023 7105 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 7024 7106 "2171 Xmit RDP response tag x%x xri x%x, " 7025 - "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x", 7107 + "did x%x, nlp_flag x%lx, nlp_state x%x, rpi x%x", 7026 7108 elsiocb->iotag, ulp_context, 7027 7109 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, 7028 7110 ndlp->nlp_rpi); ··· 7996 8078 */ 7997 8079 if (vport->port_state <= LPFC_NS_QRY) { 7998 8080 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 7999 - "RCV RSCN ignore: did:x%x/ste:x%x flg:x%x", 8081 + "RCV RSCN ignore: did:x%x/ste:x%x flg:x%lx", 8000 8082 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag); 8001 8083 8002 8084 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); ··· 8026 8108 vport->fc_flag, payload_len, 8027 8109 *lp, vport->fc_rscn_id_cnt); 8028 8110 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 8029 - "RCV RSCN vport: did:x%x/ste:x%x flg:x%x", 8111 + "RCV RSCN vport: did:x%x/ste:x%x flg:x%lx", 8030 8112 ndlp->nlp_DID, vport->port_state, 8031 8113 ndlp->nlp_flag); 8032 8114 ··· 8063 8145 if (test_bit(FC_RSCN_MODE, &vport->fc_flag) || 8064 8146 test_bit(FC_NDISC_ACTIVE, &vport->fc_flag)) { 8065 8147 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 8066 - "RCV RSCN defer: did:x%x/ste:x%x flg:x%x", 8148 + "RCV RSCN defer: did:x%x/ste:x%x flg:x%lx", 8067 8149 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag); 8068 8150 8069 8151 set_bit(FC_RSCN_DEFERRED, &vport->fc_flag); ··· 8119 8201 return 0; 8120 8202 } 8121 8203 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 8122 - "RCV RSCN: did:x%x/ste:x%x flg:x%x", 8204 + "RCV RSCN: did:x%x/ste:x%x flg:x%lx", 8123 8205 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag); 8124 8206 8125 8207 set_bit(FC_RSCN_MODE, &vport->fc_flag); ··· 8625 8707 /* Xmit ELS RLS ACC response tag <ulpIoTag> */ 8626 8708 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS, 8627 8709 "2874 Xmit ELS RLS ACC response tag x%x xri x%x, " 8628 - "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", 8710 + "did x%x, nlp_flag x%lx, nlp_state x%x, rpi x%x\n", 8629 8711 elsiocb->iotag, ulp_context, 8630 8712 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, 8631 8713 ndlp->nlp_rpi); ··· 8787 8869 /* Xmit ELS RLS ACC response tag <ulpIoTag> */ 8788 8870 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS, 8789 8871 "2875 Xmit ELS RTV ACC response tag x%x xri x%x, " 8790 - "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x, " 8872 + "did x%x, nlp_flag x%lx, nlp_state x%x, rpi x%x, " 8791 8873 "Data: x%x x%x x%x\n", 8792 8874 elsiocb->iotag, ulp_context, 8793 8875 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, ··· 8984 9066 /* Xmit ELS RPL ACC response tag <ulpIoTag> */ 8985 9067 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 8986 9068 "0120 Xmit ELS RPL ACC response tag x%x " 8987 - "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, " 9069 + "xri x%x, did x%x, nlp_flag x%lx, nlp_state x%x, " 8988 9070 "rpi x%x\n", 8989 9071 elsiocb->iotag, ulp_context, 8990 9072 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, ··· 9560 9642 mbx_tmo_err = test_bit(MBX_TMO_ERR, &phba->bit_flags); 9561 9643 /* First we need to issue aborts to outstanding cmds on txcmpl */ 9562 9644 list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { 9563 - if (piocb->cmd_flag & LPFC_IO_LIBDFC && !mbx_tmo_err) 9564 - continue; 9645 + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 9646 + "2243 iotag = 0x%x cmd_flag = 0x%x " 9647 + "ulp_command = 0x%x this_vport %x " 9648 + "sli_flag = 0x%x\n", 9649 + piocb->iotag, piocb->cmd_flag, 9650 + get_job_cmnd(phba, piocb), 9651 + (piocb->vport == vport), 9652 + phba->sli.sli_flag); 9565 9653 9566 9654 if (piocb->vport != vport) 9567 9655 continue; 9568 9656 9569 - if (piocb->cmd_flag & LPFC_DRIVER_ABORTED && !mbx_tmo_err) 9570 - continue; 9657 + if ((phba->sli.sli_flag & LPFC_SLI_ACTIVE) && !mbx_tmo_err) { 9658 + if (piocb->cmd_flag & LPFC_IO_LIBDFC) 9659 + continue; 9660 + if (piocb->cmd_flag & LPFC_DRIVER_ABORTED) 9661 + continue; 9662 + } 9571 9663 9572 9664 /* On the ELS ring we can have ELS_REQUESTs, ELS_RSPs, 9573 9665 * or GEN_REQUESTs waiting for a CQE response. ··· 10339 10411 * Do not process any unsolicited ELS commands 10340 10412 * if the ndlp is in DEV_LOSS 10341 10413 */ 10342 - spin_lock_irq(&ndlp->lock); 10343 - if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) { 10344 - spin_unlock_irq(&ndlp->lock); 10414 + if (test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag)) { 10345 10415 if (newnode) 10346 10416 lpfc_nlp_put(ndlp); 10347 10417 goto dropit; 10348 10418 } 10349 - spin_unlock_irq(&ndlp->lock); 10350 10419 10351 10420 elsiocb->ndlp = lpfc_nlp_get(ndlp); 10352 10421 if (!elsiocb->ndlp) ··· 10372 10447 switch (cmd) { 10373 10448 case ELS_CMD_PLOGI: 10374 10449 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10375 - "RCV PLOGI: did:x%x/ste:x%x flg:x%x", 10450 + "RCV PLOGI: did:x%x/ste:x%x flg:x%lx", 10376 10451 did, vport->port_state, ndlp->nlp_flag); 10377 10452 10378 10453 phba->fc_stat.elsRcvPLOGI++; ··· 10411 10486 } 10412 10487 } 10413 10488 10414 - spin_lock_irq(&ndlp->lock); 10415 - ndlp->nlp_flag &= ~NLP_TARGET_REMOVE; 10416 - spin_unlock_irq(&ndlp->lock); 10489 + clear_bit(NLP_TARGET_REMOVE, &ndlp->nlp_flag); 10417 10490 10418 10491 lpfc_disc_state_machine(vport, ndlp, elsiocb, 10419 10492 NLP_EVT_RCV_PLOGI); ··· 10419 10496 break; 10420 10497 case ELS_CMD_FLOGI: 10421 10498 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10422 - "RCV FLOGI: did:x%x/ste:x%x flg:x%x", 10499 + "RCV FLOGI: did:x%x/ste:x%x flg:x%lx", 10423 10500 did, vport->port_state, ndlp->nlp_flag); 10424 10501 10425 10502 phba->fc_stat.elsRcvFLOGI++; ··· 10446 10523 break; 10447 10524 case ELS_CMD_LOGO: 10448 10525 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10449 - "RCV LOGO: did:x%x/ste:x%x flg:x%x", 10526 + "RCV LOGO: did:x%x/ste:x%x flg:x%lx", 10450 10527 did, vport->port_state, ndlp->nlp_flag); 10451 10528 10452 10529 phba->fc_stat.elsRcvLOGO++; ··· 10463 10540 break; 10464 10541 case ELS_CMD_PRLO: 10465 10542 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10466 - "RCV PRLO: did:x%x/ste:x%x flg:x%x", 10543 + "RCV PRLO: did:x%x/ste:x%x flg:x%lx", 10467 10544 did, vport->port_state, ndlp->nlp_flag); 10468 10545 10469 10546 phba->fc_stat.elsRcvPRLO++; ··· 10492 10569 break; 10493 10570 case ELS_CMD_ADISC: 10494 10571 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10495 - "RCV ADISC: did:x%x/ste:x%x flg:x%x", 10572 + "RCV ADISC: did:x%x/ste:x%x flg:x%lx", 10496 10573 did, vport->port_state, ndlp->nlp_flag); 10497 10574 10498 10575 lpfc_send_els_event(vport, ndlp, payload); ··· 10507 10584 break; 10508 10585 case ELS_CMD_PDISC: 10509 10586 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10510 - "RCV PDISC: did:x%x/ste:x%x flg:x%x", 10587 + "RCV PDISC: did:x%x/ste:x%x flg:x%lx", 10511 10588 did, vport->port_state, ndlp->nlp_flag); 10512 10589 10513 10590 phba->fc_stat.elsRcvPDISC++; ··· 10521 10598 break; 10522 10599 case ELS_CMD_FARPR: 10523 10600 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10524 - "RCV FARPR: did:x%x/ste:x%x flg:x%x", 10601 + "RCV FARPR: did:x%x/ste:x%x flg:x%lx", 10525 10602 did, vport->port_state, ndlp->nlp_flag); 10526 10603 10527 10604 phba->fc_stat.elsRcvFARPR++; ··· 10529 10606 break; 10530 10607 case ELS_CMD_FARP: 10531 10608 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10532 - "RCV FARP: did:x%x/ste:x%x flg:x%x", 10609 + "RCV FARP: did:x%x/ste:x%x flg:x%lx", 10533 10610 did, vport->port_state, ndlp->nlp_flag); 10534 10611 10535 10612 phba->fc_stat.elsRcvFARP++; ··· 10537 10614 break; 10538 10615 case ELS_CMD_FAN: 10539 10616 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10540 - "RCV FAN: did:x%x/ste:x%x flg:x%x", 10617 + "RCV FAN: did:x%x/ste:x%x flg:x%lx", 10541 10618 did, vport->port_state, ndlp->nlp_flag); 10542 10619 10543 10620 phba->fc_stat.elsRcvFAN++; ··· 10546 10623 case ELS_CMD_PRLI: 10547 10624 case ELS_CMD_NVMEPRLI: 10548 10625 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10549 - "RCV PRLI: did:x%x/ste:x%x flg:x%x", 10626 + "RCV PRLI: did:x%x/ste:x%x flg:x%lx", 10550 10627 did, vport->port_state, ndlp->nlp_flag); 10551 10628 10552 10629 phba->fc_stat.elsRcvPRLI++; ··· 10560 10637 break; 10561 10638 case ELS_CMD_LIRR: 10562 10639 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10563 - "RCV LIRR: did:x%x/ste:x%x flg:x%x", 10640 + "RCV LIRR: did:x%x/ste:x%x flg:x%lx", 10564 10641 did, vport->port_state, ndlp->nlp_flag); 10565 10642 10566 10643 phba->fc_stat.elsRcvLIRR++; ··· 10571 10648 break; 10572 10649 case ELS_CMD_RLS: 10573 10650 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10574 - "RCV RLS: did:x%x/ste:x%x flg:x%x", 10651 + "RCV RLS: did:x%x/ste:x%x flg:x%lx", 10575 10652 did, vport->port_state, ndlp->nlp_flag); 10576 10653 10577 10654 phba->fc_stat.elsRcvRLS++; ··· 10582 10659 break; 10583 10660 case ELS_CMD_RPL: 10584 10661 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10585 - "RCV RPL: did:x%x/ste:x%x flg:x%x", 10662 + "RCV RPL: did:x%x/ste:x%x flg:x%lx", 10586 10663 did, vport->port_state, ndlp->nlp_flag); 10587 10664 10588 10665 phba->fc_stat.elsRcvRPL++; ··· 10593 10670 break; 10594 10671 case ELS_CMD_RNID: 10595 10672 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10596 - "RCV RNID: did:x%x/ste:x%x flg:x%x", 10673 + "RCV RNID: did:x%x/ste:x%x flg:x%lx", 10597 10674 did, vport->port_state, ndlp->nlp_flag); 10598 10675 10599 10676 phba->fc_stat.elsRcvRNID++; ··· 10604 10681 break; 10605 10682 case ELS_CMD_RTV: 10606 10683 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10607 - "RCV RTV: did:x%x/ste:x%x flg:x%x", 10684 + "RCV RTV: did:x%x/ste:x%x flg:x%lx", 10608 10685 did, vport->port_state, ndlp->nlp_flag); 10609 10686 phba->fc_stat.elsRcvRTV++; 10610 10687 lpfc_els_rcv_rtv(vport, elsiocb, ndlp); ··· 10614 10691 break; 10615 10692 case ELS_CMD_RRQ: 10616 10693 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10617 - "RCV RRQ: did:x%x/ste:x%x flg:x%x", 10694 + "RCV RRQ: did:x%x/ste:x%x flg:x%lx", 10618 10695 did, vport->port_state, ndlp->nlp_flag); 10619 10696 10620 10697 phba->fc_stat.elsRcvRRQ++; ··· 10625 10702 break; 10626 10703 case ELS_CMD_ECHO: 10627 10704 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10628 - "RCV ECHO: did:x%x/ste:x%x flg:x%x", 10705 + "RCV ECHO: did:x%x/ste:x%x flg:x%lx", 10629 10706 did, vport->port_state, ndlp->nlp_flag); 10630 10707 10631 10708 phba->fc_stat.elsRcvECHO++; ··· 10641 10718 break; 10642 10719 case ELS_CMD_FPIN: 10643 10720 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 10644 - "RCV FPIN: did:x%x/ste:x%x flg:x%x", 10721 + "RCV FPIN: did:x%x/ste:x%x " 10722 + "flg:x%lx", 10645 10723 did, vport->port_state, ndlp->nlp_flag); 10646 10724 10647 10725 lpfc_els_rcv_fpin(vport, (struct fc_els_fpin *)payload, ··· 11150 11226 return; 11151 11227 11152 11228 mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000)); 11153 - spin_lock_irq(&ndlp->lock); 11154 - ndlp->nlp_flag |= NLP_DELAY_TMO; 11155 - spin_unlock_irq(&ndlp->lock); 11229 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 11156 11230 ndlp->nlp_last_elscmd = ELS_CMD_FLOGI; 11157 11231 phba->pport->port_state = LPFC_FLOGI; 11158 11232 return; ··· 11281 11359 list_for_each_entry_safe(np, next_np, 11282 11360 &vport->fc_nodes, nlp_listp) { 11283 11361 if ((np->nlp_state != NLP_STE_NPR_NODE) || 11284 - !(np->nlp_flag & NLP_NPR_ADISC)) 11362 + !test_bit(NLP_NPR_ADISC, &np->nlp_flag)) 11285 11363 continue; 11286 - spin_lock_irq(&ndlp->lock); 11287 - np->nlp_flag &= ~NLP_NPR_ADISC; 11288 - spin_unlock_irq(&ndlp->lock); 11364 + clear_bit(NLP_NPR_ADISC, &np->nlp_flag); 11289 11365 lpfc_unreg_rpi(vport, np); 11290 11366 } 11291 11367 lpfc_cleanup_pending_mbox(vport); ··· 11486 11566 /* NPIV LOGO completes to NPort <nlp_DID> */ 11487 11567 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 11488 11568 "2928 NPIV LOGO completes to NPort x%x " 11489 - "Data: x%x x%x x%x x%x x%x x%x x%x\n", 11569 + "Data: x%x x%x x%x x%x x%x x%lx x%x\n", 11490 11570 ndlp->nlp_DID, ulp_status, ulp_word4, 11491 11571 tmo, vport->num_disc_nodes, 11492 11572 kref_read(&ndlp->kref), ndlp->nlp_flag, ··· 11502 11582 /* Wake up lpfc_vport_delete if waiting...*/ 11503 11583 if (ndlp->logo_waitq) 11504 11584 wake_up(ndlp->logo_waitq); 11585 + clear_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag); 11586 + clear_bit(NLP_LOGO_SND, &ndlp->nlp_flag); 11505 11587 spin_lock_irq(&ndlp->lock); 11506 - ndlp->nlp_flag &= ~(NLP_ISSUE_LOGO | NLP_LOGO_SND); 11507 11588 ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO; 11508 11589 spin_unlock_irq(&ndlp->lock); 11509 11590 } ··· 11554 11633 memcpy(pcmd, &vport->fc_portname, sizeof(struct lpfc_name)); 11555 11634 11556 11635 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, 11557 - "Issue LOGO npiv did:x%x flg:x%x", 11636 + "Issue LOGO npiv did:x%x flg:x%lx", 11558 11637 ndlp->nlp_DID, ndlp->nlp_flag, 0); 11559 11638 11560 11639 elsiocb->cmd_cmpl = lpfc_cmpl_els_npiv_logo; 11561 - spin_lock_irq(&ndlp->lock); 11562 - ndlp->nlp_flag |= NLP_LOGO_SND; 11563 - spin_unlock_irq(&ndlp->lock); 11640 + set_bit(NLP_LOGO_SND, &ndlp->nlp_flag); 11564 11641 elsiocb->ndlp = lpfc_nlp_get(ndlp); 11565 11642 if (!elsiocb->ndlp) { 11566 11643 lpfc_els_free_iocb(phba, elsiocb); ··· 11574 11655 return 0; 11575 11656 11576 11657 err: 11577 - spin_lock_irq(&ndlp->lock); 11578 - ndlp->nlp_flag &= ~NLP_LOGO_SND; 11579 - spin_unlock_irq(&ndlp->lock); 11658 + clear_bit(NLP_LOGO_SND, &ndlp->nlp_flag); 11580 11659 return 1; 11581 11660 } 11582 11661 ··· 12055 12138 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, 12056 12139 "3094 Start rport recovery on shost id 0x%x " 12057 12140 "fc_id 0x%06x vpi 0x%x rpi 0x%x state 0x%x " 12058 - "flags 0x%x\n", 12141 + "flag 0x%lx\n", 12059 12142 shost->host_no, ndlp->nlp_DID, 12060 12143 vport->vpi, ndlp->nlp_rpi, ndlp->nlp_state, 12061 12144 ndlp->nlp_flag); ··· 12065 12148 */ 12066 12149 spin_lock_irqsave(&ndlp->lock, flags); 12067 12150 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 12068 - ndlp->nlp_flag |= NLP_ISSUE_LOGO; 12069 12151 spin_unlock_irqrestore(&ndlp->lock, flags); 12152 + set_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag); 12070 12153 lpfc_unreg_rpi(vport, ndlp); 12071 12154 } 12072 12155
+131 -180
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 100 100 return -EINVAL; 101 101 } 102 102 103 + if (rport->flags & FC_RPORT_DEVLOSS_CALLBK_DONE) { 104 + pr_info("**** %s: devloss_callbk_done rport x%px SID x%x\n", 105 + __func__, rport, rport->scsi_target_id); 106 + return -EINVAL; 107 + } 108 + 103 109 rdata = rport->dd_data; 104 110 if (!rdata) { 105 111 pr_err("**** %s: NULL dd_data on rport x%px SID x%x\n", ··· 143 137 ndlp = rdata->pnode; 144 138 vport = ndlp->vport; 145 139 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, 146 - "rport terminate: sid:x%x did:x%x flg:x%x", 140 + "rport terminate: sid:x%x did:x%x flg:x%lx", 147 141 ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); 148 142 149 143 if (ndlp->nlp_sid != NLP_NO_SID) ··· 161 155 struct lpfc_hba *phba; 162 156 struct lpfc_work_evt *evtp; 163 157 unsigned long iflags; 158 + bool nvme_reg = false; 164 159 165 160 ndlp = ((struct lpfc_rport_data *)rport->dd_data)->pnode; 166 161 if (!ndlp) ··· 171 164 phba = vport->phba; 172 165 173 166 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, 174 - "rport devlosscb: sid:x%x did:x%x flg:x%x", 167 + "rport devlosscb: sid:x%x did:x%x flg:x%lx", 175 168 ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); 176 169 177 170 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, 178 - "3181 dev_loss_callbk x%06x, rport x%px flg x%x " 171 + "3181 dev_loss_callbk x%06x, rport x%px flg x%lx " 179 172 "load_flag x%lx refcnt %u state %d xpt x%x\n", 180 173 ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag, 181 174 vport->load_flag, kref_read(&ndlp->kref), ··· 184 177 /* Don't schedule a worker thread event if the vport is going down. */ 185 178 if (test_bit(FC_UNLOADING, &vport->load_flag) || 186 179 !test_bit(HBA_SETUP, &phba->hba_flag)) { 180 + 187 181 spin_lock_irqsave(&ndlp->lock, iflags); 188 182 ndlp->rport = NULL; 189 183 184 + if (ndlp->fc4_xpt_flags & NVME_XPT_REGD) 185 + nvme_reg = true; 186 + 190 187 /* The scsi_transport is done with the rport so lpfc cannot 191 - * call to unregister. Remove the scsi transport reference 192 - * and clean up the SCSI transport node details. 188 + * call to unregister. 193 189 */ 194 - if (ndlp->fc4_xpt_flags & (NLP_XPT_REGD | SCSI_XPT_REGD)) { 190 + if (ndlp->fc4_xpt_flags & SCSI_XPT_REGD) { 195 191 ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD; 196 192 197 - /* NVME transport-registered rports need the 198 - * NLP_XPT_REGD flag to complete an unregister. 193 + /* If NLP_XPT_REGD was cleared in lpfc_nlp_unreg_node, 194 + * unregister calls were made to the scsi and nvme 195 + * transports and refcnt was already decremented. Clear 196 + * the NLP_XPT_REGD flag only if the NVME Rport is 197 + * confirmed unregistered. 199 198 */ 200 - if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) 199 + if (!nvme_reg && ndlp->fc4_xpt_flags & NLP_XPT_REGD) { 201 200 ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD; 201 + spin_unlock_irqrestore(&ndlp->lock, iflags); 202 + lpfc_nlp_put(ndlp); /* may free ndlp */ 203 + } else { 204 + spin_unlock_irqrestore(&ndlp->lock, iflags); 205 + } 206 + } else { 202 207 spin_unlock_irqrestore(&ndlp->lock, iflags); 203 - lpfc_nlp_put(ndlp); 204 - spin_lock_irqsave(&ndlp->lock, iflags); 205 208 } 206 209 207 210 /* Only 1 thread can drop the initial node reference. If 208 211 * another thread has set NLP_DROPPED, this thread is done. 209 212 */ 210 - if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD) && 211 - !(ndlp->nlp_flag & NLP_DROPPED)) { 212 - ndlp->nlp_flag |= NLP_DROPPED; 213 - spin_unlock_irqrestore(&ndlp->lock, iflags); 214 - lpfc_nlp_put(ndlp); 213 + if (nvme_reg || test_bit(NLP_DROPPED, &ndlp->nlp_flag)) 215 214 return; 216 - } 217 215 218 - spin_unlock_irqrestore(&ndlp->lock, iflags); 216 + set_bit(NLP_DROPPED, &ndlp->nlp_flag); 217 + lpfc_nlp_put(ndlp); 219 218 return; 220 219 } 221 220 ··· 248 235 return; 249 236 } 250 237 251 - spin_lock_irqsave(&ndlp->lock, iflags); 252 - ndlp->nlp_flag |= NLP_IN_DEV_LOSS; 238 + set_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag); 253 239 240 + spin_lock_irqsave(&ndlp->lock, iflags); 254 241 /* If there is a PLOGI in progress, and we are in a 255 242 * NLP_NPR_2B_DISC state, don't turn off the flag. 256 243 */ 257 244 if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE) 258 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 245 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 259 246 260 247 /* 261 248 * The backend does not expect any more calls associated with this ··· 284 271 } else { 285 272 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, 286 273 "3188 worker thread is stopped %s x%06x, " 287 - " rport x%px flg x%x load_flag x%lx refcnt " 274 + " rport x%px flg x%lx load_flag x%lx refcnt " 288 275 "%d\n", __func__, ndlp->nlp_DID, 289 276 ndlp->rport, ndlp->nlp_flag, 290 277 vport->load_flag, kref_read(&ndlp->kref)); 291 278 if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) { 292 - spin_lock_irqsave(&ndlp->lock, iflags); 293 279 /* Node is in dev loss. No further transaction. */ 294 - ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; 295 - spin_unlock_irqrestore(&ndlp->lock, iflags); 280 + clear_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag); 296 281 lpfc_disc_state_machine(vport, ndlp, NULL, 297 282 NLP_EVT_DEVICE_RM); 298 283 } ··· 423 412 lpfc_nlp_get(ndlp); 424 413 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY | LOG_NODE, 425 414 "8438 Devloss timeout reversed on DID x%x " 426 - "refcnt %d ndlp %p flag x%x " 415 + "refcnt %d ndlp %p flag x%lx " 427 416 "port_state = x%x\n", 428 417 ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp, 429 418 ndlp->nlp_flag, vport->port_state); ··· 466 455 ndlp->nlp_DID, ndlp->nlp_type, ndlp->nlp_sid); 467 456 468 457 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, 469 - "3182 %s x%06x, nflag x%x xflags x%x refcnt %d\n", 458 + "3182 %s x%06x, nflag x%lx xflags x%x refcnt %d\n", 470 459 __func__, ndlp->nlp_DID, ndlp->nlp_flag, 471 460 ndlp->fc4_xpt_flags, kref_read(&ndlp->kref)); 472 461 ··· 480 469 *(name+4), *(name+5), *(name+6), *(name+7), 481 470 ndlp->nlp_DID); 482 471 483 - spin_lock_irqsave(&ndlp->lock, iflags); 484 - ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; 485 - spin_unlock_irqrestore(&ndlp->lock, iflags); 472 + clear_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag); 486 473 return fcf_inuse; 487 474 } 488 475 ··· 508 499 } 509 500 break; 510 501 case Fabric_Cntl_DID: 511 - if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) 502 + if (test_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag)) 512 503 recovering = true; 513 504 break; 514 505 case FDMI_DID: ··· 536 527 * the following lpfc_nlp_put is necessary after fabric node is 537 528 * recovered. 538 529 */ 539 - spin_lock_irqsave(&ndlp->lock, iflags); 540 - ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; 541 - spin_unlock_irqrestore(&ndlp->lock, iflags); 530 + clear_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag); 542 531 if (recovering) { 543 532 lpfc_printf_vlog(vport, KERN_INFO, 544 533 LOG_DISCOVERY | LOG_NODE, 545 534 "8436 Devloss timeout marked on " 546 535 "DID x%x refcnt %d ndlp %p " 547 - "flag x%x port_state = x%x\n", 536 + "flag x%lx port_state = x%x\n", 548 537 ndlp->nlp_DID, kref_read(&ndlp->kref), 549 538 ndlp, ndlp->nlp_flag, 550 539 vport->port_state); ··· 559 552 LOG_DISCOVERY | LOG_NODE, 560 553 "8437 Devloss timeout ignored on " 561 554 "DID x%x refcnt %d ndlp %p " 562 - "flag x%x port_state = x%x\n", 555 + "flag x%lx port_state = x%x\n", 563 556 ndlp->nlp_DID, kref_read(&ndlp->kref), 564 557 ndlp, ndlp->nlp_flag, 565 558 vport->port_state); ··· 579 572 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 580 573 "0203 Devloss timeout on " 581 574 "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x " 582 - "NPort x%06x Data: x%x x%x x%x refcnt %d\n", 575 + "NPort x%06x Data: x%lx x%x x%x refcnt %d\n", 583 576 *name, *(name+1), *(name+2), *(name+3), 584 577 *(name+4), *(name+5), *(name+6), *(name+7), 585 578 ndlp->nlp_DID, ndlp->nlp_flag, ··· 589 582 lpfc_printf_vlog(vport, KERN_INFO, LOG_TRACE_EVENT, 590 583 "0204 Devloss timeout on " 591 584 "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x " 592 - "NPort x%06x Data: x%x x%x x%x\n", 585 + "NPort x%06x Data: x%lx x%x x%x\n", 593 586 *name, *(name+1), *(name+2), *(name+3), 594 587 *(name+4), *(name+5), *(name+6), *(name+7), 595 588 ndlp->nlp_DID, ndlp->nlp_flag, 596 589 ndlp->nlp_state, ndlp->nlp_rpi); 597 590 } 598 - spin_lock_irqsave(&ndlp->lock, iflags); 599 - ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; 600 - spin_unlock_irqrestore(&ndlp->lock, iflags); 591 + clear_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag); 601 592 602 593 /* If we are devloss, but we are in the process of rediscovering the 603 594 * ndlp, don't issue a NLP_EVT_DEVICE_RM event. ··· 1360 1355 if (ndlp->nlp_DID != Fabric_DID) 1361 1356 lpfc_unreg_rpi(vport, ndlp); 1362 1357 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 1363 - } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { 1358 + } else if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) { 1364 1359 /* Fail outstanding IO now since device is 1365 1360 * marked for PLOGI. 1366 1361 */ ··· 3869 3864 pmb->ctx_ndlp = NULL; 3870 3865 3871 3866 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI | LOG_NODE | LOG_DISCOVERY, 3872 - "0002 rpi:%x DID:%x flg:%x %d x%px\n", 3867 + "0002 rpi:%x DID:%x flg:%lx %d x%px\n", 3873 3868 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, 3874 3869 kref_read(&ndlp->kref), 3875 3870 ndlp); 3876 - if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) 3877 - ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 3871 + clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 3878 3872 3879 - if (ndlp->nlp_flag & NLP_IGNR_REG_CMPL || 3873 + if (test_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag) || 3880 3874 ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) { 3881 3875 /* We rcvd a rscn after issuing this 3882 3876 * mbox reg login, we may have cycled ··· 3885 3881 * there is another reg login in 3886 3882 * process. 3887 3883 */ 3888 - spin_lock_irq(&ndlp->lock); 3889 - ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL; 3890 - spin_unlock_irq(&ndlp->lock); 3884 + clear_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag); 3891 3885 3892 3886 /* 3893 3887 * We cannot leave the RPI registered because 3894 3888 * if we go thru discovery again for this ndlp 3895 3889 * a subsequent REG_RPI will fail. 3896 3890 */ 3897 - ndlp->nlp_flag |= NLP_RPI_REGISTERED; 3891 + set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 3898 3892 lpfc_unreg_rpi(vport, ndlp); 3899 3893 } 3900 3894 ··· 4205 4203 4206 4204 if (phba->sli_rev < LPFC_SLI_REV4) 4207 4205 ndlp->nlp_rpi = mb->un.varWords[0]; 4208 - ndlp->nlp_flag |= NLP_RPI_REGISTERED; 4206 + set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 4209 4207 ndlp->nlp_type |= NLP_FABRIC; 4210 4208 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); 4211 4209 ··· 4336 4334 * reference. 4337 4335 */ 4338 4336 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) { 4339 - spin_lock_irq(&ndlp->lock); 4340 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 4341 - spin_unlock_irq(&ndlp->lock); 4337 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 4342 4338 lpfc_nlp_put(ndlp); 4343 4339 } 4344 4340 ··· 4357 4357 4358 4358 if (phba->sli_rev < LPFC_SLI_REV4) 4359 4359 ndlp->nlp_rpi = mb->un.varWords[0]; 4360 - ndlp->nlp_flag |= NLP_RPI_REGISTERED; 4360 + set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 4361 4361 ndlp->nlp_type |= NLP_FABRIC; 4362 4362 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); 4363 4363 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY, 4364 - "0003 rpi:%x DID:%x flg:%x %d x%px\n", 4364 + "0003 rpi:%x DID:%x flg:%lx %d x%px\n", 4365 4365 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, 4366 4366 kref_read(&ndlp->kref), 4367 4367 ndlp); ··· 4453 4453 __func__, ndlp->nlp_DID, ndlp->nlp_rpi, 4454 4454 ndlp->nlp_state); 4455 4455 4456 - ndlp->nlp_flag |= NLP_RPI_REGISTERED; 4457 - ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 4456 + set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 4457 + clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 4458 4458 ndlp->nlp_type |= NLP_FABRIC; 4459 4459 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); 4460 4460 ··· 4488 4488 4489 4489 4490 4490 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, 4491 - "rport add: did:x%x flg:x%x type x%x", 4491 + "rport add: did:x%x flg:x%lx type x%x", 4492 4492 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); 4493 4493 4494 4494 /* Don't add the remote port if unloading. */ ··· 4556 4556 return; 4557 4557 4558 4558 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, 4559 - "rport delete: did:x%x flg:x%x type x%x", 4559 + "rport delete: did:x%x flg:x%lx type x%x", 4560 4560 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); 4561 4561 4562 4562 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, ··· 4672 4672 lpfc_printf_vlog(vport, KERN_INFO, 4673 4673 LOG_ELS | LOG_NODE | LOG_DISCOVERY, 4674 4674 "0999 %s Not regd: ndlp x%px rport x%px DID " 4675 - "x%x FLG x%x XPT x%x\n", 4675 + "x%x FLG x%lx XPT x%x\n", 4676 4676 __func__, ndlp, ndlp->rport, ndlp->nlp_DID, 4677 4677 ndlp->nlp_flag, ndlp->fc4_xpt_flags); 4678 4678 return; ··· 4688 4688 } else if (!ndlp->rport) { 4689 4689 lpfc_printf_vlog(vport, KERN_INFO, 4690 4690 LOG_ELS | LOG_NODE | LOG_DISCOVERY, 4691 - "1999 %s NDLP in devloss x%px DID x%x FLG x%x" 4691 + "1999 %s NDLP in devloss x%px DID x%x FLG x%lx" 4692 4692 " XPT x%x refcnt %u\n", 4693 4693 __func__, ndlp, ndlp->nlp_DID, ndlp->nlp_flag, 4694 4694 ndlp->fc4_xpt_flags, ··· 4733 4733 ndlp->nlp_type |= NLP_FC_NODE; 4734 4734 fallthrough; 4735 4735 case NLP_STE_MAPPED_NODE: 4736 - ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; 4736 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 4737 4737 lpfc_nlp_reg_node(vport, ndlp); 4738 4738 break; 4739 4739 ··· 4744 4744 * backend, attempt it now 4745 4745 */ 4746 4746 case NLP_STE_NPR_NODE: 4747 - ndlp->nlp_flag &= ~NLP_RCV_PLOGI; 4747 + clear_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag); 4748 4748 fallthrough; 4749 4749 default: 4750 4750 lpfc_nlp_unreg_node(vport, ndlp); ··· 4765 4765 } 4766 4766 4767 4767 if (new_state == NLP_STE_UNMAPPED_NODE) { 4768 - ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; 4768 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 4769 4769 ndlp->nlp_type |= NLP_FC_NODE; 4770 4770 } 4771 4771 if (new_state == NLP_STE_MAPPED_NODE) 4772 - ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; 4772 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 4773 4773 if (new_state == NLP_STE_NPR_NODE) 4774 - ndlp->nlp_flag &= ~NLP_RCV_PLOGI; 4774 + clear_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag); 4775 4775 4776 4776 /* Reg/Unreg for FCP and NVME Transport interface */ 4777 4777 if ((old_state == NLP_STE_MAPPED_NODE || ··· 4779 4779 /* For nodes marked for ADISC, Handle unreg in ADISC cmpl 4780 4780 * if linkup. In linkdown do unreg_node 4781 4781 */ 4782 - if (!(ndlp->nlp_flag & NLP_NPR_ADISC) || 4782 + if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag) || 4783 4783 !lpfc_is_link_up(vport->phba)) 4784 4784 lpfc_nlp_unreg_node(vport, ndlp); 4785 4785 } ··· 4799 4799 (!ndlp->rport || 4800 4800 ndlp->rport->scsi_target_id == -1 || 4801 4801 ndlp->rport->scsi_target_id >= LPFC_MAX_TARGET)) { 4802 - spin_lock_irq(&ndlp->lock); 4803 - ndlp->nlp_flag |= NLP_TGT_NO_SCSIID; 4804 - spin_unlock_irq(&ndlp->lock); 4802 + set_bit(NLP_TGT_NO_SCSIID, &ndlp->nlp_flag); 4805 4803 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); 4806 4804 } 4807 4805 } ··· 4831 4833 int state) 4832 4834 { 4833 4835 int old_state = ndlp->nlp_state; 4834 - int node_dropped = ndlp->nlp_flag & NLP_DROPPED; 4836 + bool node_dropped = test_bit(NLP_DROPPED, &ndlp->nlp_flag); 4835 4837 char name1[16], name2[16]; 4836 4838 unsigned long iflags; 4837 4839 ··· 4847 4849 4848 4850 if (node_dropped && old_state == NLP_STE_UNUSED_NODE && 4849 4851 state != NLP_STE_UNUSED_NODE) { 4850 - ndlp->nlp_flag &= ~NLP_DROPPED; 4852 + clear_bit(NLP_DROPPED, &ndlp->nlp_flag); 4851 4853 lpfc_nlp_get(ndlp); 4852 4854 } 4853 4855 ··· 4855 4857 state != NLP_STE_NPR_NODE) 4856 4858 lpfc_cancel_retry_delay_tmo(vport, ndlp); 4857 4859 if (old_state == NLP_STE_UNMAPPED_NODE) { 4858 - ndlp->nlp_flag &= ~NLP_TGT_NO_SCSIID; 4860 + clear_bit(NLP_TGT_NO_SCSIID, &ndlp->nlp_flag); 4859 4861 ndlp->nlp_type &= ~NLP_FC_NODE; 4860 4862 } 4861 4863 ··· 4952 4954 * reference from lpfc_nlp_init. If set, don't drop it again and 4953 4955 * introduce an imbalance. 4954 4956 */ 4955 - spin_lock_irq(&ndlp->lock); 4956 - if (!(ndlp->nlp_flag & NLP_DROPPED)) { 4957 - ndlp->nlp_flag |= NLP_DROPPED; 4958 - spin_unlock_irq(&ndlp->lock); 4957 + if (!test_and_set_bit(NLP_DROPPED, &ndlp->nlp_flag)) 4959 4958 lpfc_nlp_put(ndlp); 4960 - return; 4961 - } 4962 - spin_unlock_irq(&ndlp->lock); 4963 4959 } 4964 4960 4965 4961 /* ··· 5068 5076 } else if (pring->ringno == LPFC_FCP_RING) { 5069 5077 /* Skip match check if waiting to relogin to FCP target */ 5070 5078 if ((ndlp->nlp_type & NLP_FCP_TARGET) && 5071 - (ndlp->nlp_flag & NLP_DELAY_TMO)) { 5079 + test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) 5072 5080 return 0; 5073 - } 5081 + 5074 5082 if (ulp_context == ndlp->nlp_rpi) 5075 5083 return 1; 5076 5084 } ··· 5140 5148 * Everything that matches on txcmplq will be returned 5141 5149 * by firmware with a no rpi error. 5142 5150 */ 5143 - if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { 5151 + if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) { 5144 5152 if (phba->sli_rev != LPFC_SLI_REV4) 5145 5153 lpfc_sli3_dequeue_nport_iocbs(phba, ndlp, &completions); 5146 5154 else ··· 5174 5182 lpfc_issue_els_logo(vport, ndlp, 0); 5175 5183 5176 5184 /* Check to see if there are any deferred events to process */ 5177 - if ((ndlp->nlp_flag & NLP_UNREG_INP) && 5178 - (ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING)) { 5185 + if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag) && 5186 + ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING) { 5179 5187 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 5180 5188 "1434 UNREG cmpl deferred logo x%x " 5181 5189 "on NPort x%x Data: x%x x%px\n", 5182 5190 ndlp->nlp_rpi, ndlp->nlp_DID, 5183 5191 ndlp->nlp_defer_did, ndlp); 5184 5192 5185 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 5193 + clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 5186 5194 ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING; 5187 5195 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); 5188 5196 } else { 5189 - /* NLP_RELEASE_RPI is only set for SLI4 ports. */ 5190 - if (ndlp->nlp_flag & NLP_RELEASE_RPI) { 5191 - lpfc_sli4_free_rpi(vport->phba, ndlp->nlp_rpi); 5192 - spin_lock_irq(&ndlp->lock); 5193 - ndlp->nlp_flag &= ~NLP_RELEASE_RPI; 5194 - ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR; 5195 - spin_unlock_irq(&ndlp->lock); 5196 - } 5197 - spin_lock_irq(&ndlp->lock); 5198 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 5199 - spin_unlock_irq(&ndlp->lock); 5197 + clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 5200 5198 } 5201 5199 5202 5200 /* The node has an outstanding reference for the unreg. Now ··· 5206 5224 lpfc_set_unreg_login_mbx_cmpl(struct lpfc_hba *phba, struct lpfc_vport *vport, 5207 5225 struct lpfc_nodelist *ndlp, LPFC_MBOXQ_t *mbox) 5208 5226 { 5209 - unsigned long iflags; 5210 - 5211 5227 /* Driver always gets a reference on the mailbox job 5212 5228 * in support of async jobs. 5213 5229 */ ··· 5213 5233 if (!mbox->ctx_ndlp) 5214 5234 return; 5215 5235 5216 - if (ndlp->nlp_flag & NLP_ISSUE_LOGO) { 5236 + if (test_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag)) { 5217 5237 mbox->mbox_cmpl = lpfc_nlp_logo_unreg; 5218 - 5219 5238 } else if (phba->sli_rev == LPFC_SLI_REV4 && 5220 5239 !test_bit(FC_UNLOADING, &vport->load_flag) && 5221 5240 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= ··· 5222 5243 (kref_read(&ndlp->kref) > 0)) { 5223 5244 mbox->mbox_cmpl = lpfc_sli4_unreg_rpi_cmpl_clr; 5224 5245 } else { 5225 - if (test_bit(FC_UNLOADING, &vport->load_flag)) { 5226 - if (phba->sli_rev == LPFC_SLI_REV4) { 5227 - spin_lock_irqsave(&ndlp->lock, iflags); 5228 - ndlp->nlp_flag |= NLP_RELEASE_RPI; 5229 - spin_unlock_irqrestore(&ndlp->lock, iflags); 5230 - } 5231 - } 5232 5246 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 5233 5247 } 5234 5248 } ··· 5243 5271 int rc, acc_plogi = 1; 5244 5272 uint16_t rpi; 5245 5273 5246 - if (ndlp->nlp_flag & NLP_RPI_REGISTERED || 5247 - ndlp->nlp_flag & NLP_REG_LOGIN_SEND) { 5248 - if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) 5274 + if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag) || 5275 + test_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag)) { 5276 + if (test_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag)) 5249 5277 lpfc_printf_vlog(vport, KERN_INFO, 5250 5278 LOG_NODE | LOG_DISCOVERY, 5251 5279 "3366 RPI x%x needs to be " 5252 - "unregistered nlp_flag x%x " 5280 + "unregistered nlp_flag x%lx " 5253 5281 "did x%x\n", 5254 5282 ndlp->nlp_rpi, ndlp->nlp_flag, 5255 5283 ndlp->nlp_DID); ··· 5257 5285 /* If there is already an UNREG in progress for this ndlp, 5258 5286 * no need to queue up another one. 5259 5287 */ 5260 - if (ndlp->nlp_flag & NLP_UNREG_INP) { 5288 + if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag)) { 5261 5289 lpfc_printf_vlog(vport, KERN_INFO, 5262 5290 LOG_NODE | LOG_DISCOVERY, 5263 5291 "1436 unreg_rpi SKIP UNREG x%x on " 5264 - "NPort x%x deferred x%x flg x%x " 5292 + "NPort x%x deferred x%x flg x%lx " 5265 5293 "Data: x%px\n", 5266 5294 ndlp->nlp_rpi, ndlp->nlp_DID, 5267 5295 ndlp->nlp_defer_did, ··· 5284 5312 return 1; 5285 5313 } 5286 5314 5315 + /* Accept PLOGIs after unreg_rpi_cmpl. */ 5287 5316 if (mbox->mbox_cmpl == lpfc_sli4_unreg_rpi_cmpl_clr) 5288 - /* 5289 - * accept PLOGIs after unreg_rpi_cmpl 5290 - */ 5291 5317 acc_plogi = 0; 5292 - if (((ndlp->nlp_DID & Fabric_DID_MASK) != 5293 - Fabric_DID_MASK) && 5294 - (!test_bit(FC_OFFLINE_MODE, &vport->fc_flag))) 5295 - ndlp->nlp_flag |= NLP_UNREG_INP; 5318 + 5319 + if (!test_bit(FC_OFFLINE_MODE, &vport->fc_flag)) 5320 + set_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 5296 5321 5297 5322 lpfc_printf_vlog(vport, KERN_INFO, 5298 5323 LOG_NODE | LOG_DISCOVERY, 5299 5324 "1433 unreg_rpi UNREG x%x on " 5300 - "NPort x%x deferred flg x%x " 5325 + "NPort x%x deferred flg x%lx " 5301 5326 "Data:x%px\n", 5302 5327 ndlp->nlp_rpi, ndlp->nlp_DID, 5303 5328 ndlp->nlp_flag, ndlp); 5304 5329 5305 5330 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); 5306 5331 if (rc == MBX_NOT_FINISHED) { 5307 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 5332 + clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 5308 5333 mempool_free(mbox, phba->mbox_mem_pool); 5309 5334 acc_plogi = 1; 5310 5335 lpfc_nlp_put(ndlp); ··· 5311 5342 LOG_NODE | LOG_DISCOVERY, 5312 5343 "1444 Failed to allocate mempool " 5313 5344 "unreg_rpi UNREG x%x, " 5314 - "DID x%x, flag x%x, " 5345 + "DID x%x, flag x%lx, " 5315 5346 "ndlp x%px\n", 5316 5347 ndlp->nlp_rpi, ndlp->nlp_DID, 5317 5348 ndlp->nlp_flag, ndlp); ··· 5321 5352 * not unloading. 5322 5353 */ 5323 5354 if (!test_bit(FC_UNLOADING, &vport->load_flag)) { 5324 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 5355 + clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 5325 5356 lpfc_issue_els_logo(vport, ndlp, 0); 5326 5357 ndlp->nlp_prev_state = ndlp->nlp_state; 5327 5358 lpfc_nlp_set_state(vport, ndlp, ··· 5334 5365 out: 5335 5366 if (phba->sli_rev != LPFC_SLI_REV4) 5336 5367 ndlp->nlp_rpi = 0; 5337 - ndlp->nlp_flag &= ~NLP_RPI_REGISTERED; 5338 - ndlp->nlp_flag &= ~NLP_NPR_ADISC; 5368 + clear_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 5369 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 5339 5370 if (acc_plogi) 5340 - ndlp->nlp_flag &= ~NLP_LOGO_ACC; 5371 + clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 5341 5372 return 1; 5342 5373 } 5343 - ndlp->nlp_flag &= ~NLP_LOGO_ACC; 5374 + clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 5344 5375 return 0; 5345 5376 } 5346 5377 ··· 5368 5399 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { 5369 5400 spin_lock_irqsave(&vports[i]->fc_nodes_list_lock, iflags); 5370 5401 list_for_each_entry(ndlp, &vports[i]->fc_nodes, nlp_listp) { 5371 - if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { 5402 + if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) { 5372 5403 /* The mempool_alloc might sleep */ 5373 5404 spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock, 5374 5405 iflags); ··· 5456 5487 /* Cleanup node for NPort <nlp_DID> */ 5457 5488 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, 5458 5489 "0900 Cleanup node for NPort x%x " 5459 - "Data: x%x x%x x%x\n", 5490 + "Data: x%lx x%x x%x\n", 5460 5491 ndlp->nlp_DID, ndlp->nlp_flag, 5461 5492 ndlp->nlp_state, ndlp->nlp_rpi); 5462 5493 lpfc_dequeue_node(vport, ndlp); ··· 5501 5532 5502 5533 lpfc_els_abort(phba, ndlp); 5503 5534 5504 - spin_lock_irq(&ndlp->lock); 5505 - ndlp->nlp_flag &= ~NLP_DELAY_TMO; 5506 - spin_unlock_irq(&ndlp->lock); 5535 + clear_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 5507 5536 5508 5537 ndlp->nlp_last_elscmd = 0; 5509 5538 del_timer_sync(&ndlp->nlp_delayfunc); ··· 5510 5543 list_del_init(&ndlp->dev_loss_evt.evt_listp); 5511 5544 list_del_init(&ndlp->recovery_evt.evt_listp); 5512 5545 lpfc_cleanup_vports_rrqs(vport, ndlp); 5513 - 5514 - if (phba->sli_rev == LPFC_SLI_REV4) 5515 - ndlp->nlp_flag |= NLP_RELEASE_RPI; 5516 - 5517 5546 return 0; 5518 5547 } 5519 5548 ··· 5583 5620 ); 5584 5621 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, 5585 5622 "0929 FIND node DID " 5586 - "Data: x%px x%x x%x x%x x%x x%px\n", 5623 + "Data: x%px x%x x%lx x%x x%x x%px\n", 5587 5624 ndlp, ndlp->nlp_DID, 5588 5625 ndlp->nlp_flag, data1, ndlp->nlp_rpi, 5589 5626 ndlp->active_rrqs_xri_bitmap); ··· 5630 5667 iflags); 5631 5668 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, 5632 5669 "2025 FIND node DID MAPPED " 5633 - "Data: x%px x%x x%x x%x x%px\n", 5670 + "Data: x%px x%x x%lx x%x x%px\n", 5634 5671 ndlp, ndlp->nlp_DID, 5635 5672 ndlp->nlp_flag, data1, 5636 5673 ndlp->active_rrqs_xri_bitmap); ··· 5664 5701 5665 5702 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 5666 5703 "6453 Setup New Node 2B_DISC x%x " 5667 - "Data:x%x x%x x%lx\n", 5704 + "Data:x%lx x%x x%lx\n", 5668 5705 ndlp->nlp_DID, ndlp->nlp_flag, 5669 5706 ndlp->nlp_state, vport->fc_flag); 5670 5707 5671 - spin_lock_irq(&ndlp->lock); 5672 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 5673 - spin_unlock_irq(&ndlp->lock); 5708 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 5674 5709 return ndlp; 5675 5710 } 5676 5711 ··· 5687 5726 5688 5727 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 5689 5728 "6455 Setup RSCN Node 2B_DISC x%x " 5690 - "Data:x%x x%x x%lx\n", 5729 + "Data:x%lx x%x x%lx\n", 5691 5730 ndlp->nlp_DID, ndlp->nlp_flag, 5692 5731 ndlp->nlp_state, vport->fc_flag); 5693 5732 ··· 5705 5744 NLP_EVT_DEVICE_RECOVERY); 5706 5745 } 5707 5746 5708 - spin_lock_irq(&ndlp->lock); 5709 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 5710 - spin_unlock_irq(&ndlp->lock); 5747 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 5711 5748 } else { 5712 5749 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 5713 5750 "6456 Skip Setup RSCN Node x%x " 5714 - "Data:x%x x%x x%lx\n", 5751 + "Data:x%lx x%x x%lx\n", 5715 5752 ndlp->nlp_DID, ndlp->nlp_flag, 5716 5753 ndlp->nlp_state, vport->fc_flag); 5717 5754 ndlp = NULL; ··· 5717 5758 } else { 5718 5759 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 5719 5760 "6457 Setup Active Node 2B_DISC x%x " 5720 - "Data:x%x x%x x%lx\n", 5761 + "Data:x%lx x%x x%lx\n", 5721 5762 ndlp->nlp_DID, ndlp->nlp_flag, 5722 5763 ndlp->nlp_state, vport->fc_flag); 5723 5764 ··· 5728 5769 if (ndlp->nlp_state == NLP_STE_ADISC_ISSUE || 5729 5770 ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || 5730 5771 (!vport->phba->nvmet_support && 5731 - ndlp->nlp_flag & NLP_RCV_PLOGI)) 5772 + test_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag))) 5732 5773 return NULL; 5733 5774 5734 5775 if (vport->phba->nvmet_support) ··· 5738 5779 * allows for rediscovery 5739 5780 */ 5740 5781 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 5741 - 5742 - spin_lock_irq(&ndlp->lock); 5743 - ndlp->nlp_flag |= NLP_NPR_2B_DISC; 5744 - spin_unlock_irq(&ndlp->lock); 5782 + set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 5745 5783 } 5746 5784 return ndlp; 5747 5785 } ··· 6109 6153 /* Clean up the ndlp on Fabric connections */ 6110 6154 lpfc_drop_node(vport, ndlp); 6111 6155 6112 - } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { 6156 + } else if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) { 6113 6157 /* Fail outstanding IO now since device 6114 6158 * is marked for PLOGI. 6115 6159 */ ··· 6322 6366 6323 6367 if (phba->sli_rev < LPFC_SLI_REV4) 6324 6368 ndlp->nlp_rpi = mb->un.varWords[0]; 6325 - ndlp->nlp_flag |= NLP_RPI_REGISTERED; 6369 + set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 6326 6370 ndlp->nlp_type |= NLP_FABRIC; 6327 6371 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); 6328 6372 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY, 6329 - "0004 rpi:%x DID:%x flg:%x %d x%px\n", 6373 + "0004 rpi:%x DID:%x flg:%lx %d x%px\n", 6330 6374 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, 6331 6375 kref_read(&ndlp->kref), 6332 6376 ndlp); ··· 6376 6420 if (filter(ndlp, param)) { 6377 6421 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, 6378 6422 "3185 FIND node filter %ps DID " 6379 - "ndlp x%px did x%x flg x%x st x%x " 6423 + "ndlp x%px did x%x flg x%lx st x%x " 6380 6424 "xri x%x type x%x rpi x%x\n", 6381 6425 filter, ndlp, ndlp->nlp_DID, 6382 6426 ndlp->nlp_flag, ndlp->nlp_state, ··· 6511 6555 INIT_LIST_HEAD(&ndlp->nlp_listp); 6512 6556 if (vport->phba->sli_rev == LPFC_SLI_REV4) { 6513 6557 ndlp->nlp_rpi = rpi; 6514 - lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY, 6515 - "0007 Init New ndlp x%px, rpi:x%x DID:%x " 6516 - "flg:x%x refcnt:%d\n", 6558 + lpfc_printf_vlog(vport, KERN_INFO, 6559 + LOG_ELS | LOG_NODE | LOG_DISCOVERY, 6560 + "0007 Init New ndlp x%px, rpi:x%x DID:x%x " 6561 + "flg:x%lx refcnt:%d\n", 6517 6562 ndlp, ndlp->nlp_rpi, ndlp->nlp_DID, 6518 6563 ndlp->nlp_flag, kref_read(&ndlp->kref)); 6519 6564 ··· 6546 6589 struct lpfc_vport *vport = ndlp->vport; 6547 6590 6548 6591 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, 6549 - "node release: did:x%x flg:x%x type:x%x", 6592 + "node release: did:x%x flg:x%lx type:x%x", 6550 6593 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); 6551 6594 6552 6595 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, ··· 6558 6601 lpfc_cancel_retry_delay_tmo(vport, ndlp); 6559 6602 lpfc_cleanup_node(vport, ndlp); 6560 6603 6561 - /* Not all ELS transactions have registered the RPI with the port. 6562 - * In these cases the rpi usage is temporary and the node is 6563 - * released when the WQE is completed. Catch this case to free the 6564 - * RPI to the pool. Because this node is in the release path, a lock 6565 - * is unnecessary. All references are gone and the node has been 6566 - * dequeued. 6604 + /* All nodes are initialized with an RPI that needs to be released 6605 + * now. All references are gone and the node has been dequeued. 6567 6606 */ 6568 - if (ndlp->nlp_flag & NLP_RELEASE_RPI) { 6569 - if (ndlp->nlp_rpi != LPFC_RPI_ALLOC_ERROR && 6570 - !(ndlp->nlp_flag & (NLP_RPI_REGISTERED | NLP_UNREG_INP))) { 6571 - lpfc_sli4_free_rpi(vport->phba, ndlp->nlp_rpi); 6572 - ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR; 6573 - } 6607 + if (vport->phba->sli_rev == LPFC_SLI_REV4) { 6608 + lpfc_sli4_free_rpi(vport->phba, ndlp->nlp_rpi); 6609 + ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR; 6574 6610 } 6575 6611 6576 6612 /* The node is not freed back to memory, it is released to a pool so ··· 6592 6642 6593 6643 if (ndlp) { 6594 6644 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, 6595 - "node get: did:x%x flg:x%x refcnt:x%x", 6645 + "node get: did:x%x flg:x%lx refcnt:x%x", 6596 6646 ndlp->nlp_DID, ndlp->nlp_flag, 6597 6647 kref_read(&ndlp->kref)); 6598 6648 ··· 6624 6674 { 6625 6675 if (ndlp) { 6626 6676 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, 6627 - "node put: did:x%x flg:x%x refcnt:x%x", 6677 + "node put: did:x%x flg:x%lx refcnt:x%x", 6628 6678 ndlp->nlp_DID, ndlp->nlp_flag, 6629 6679 kref_read(&ndlp->kref)); 6630 6680 } else { ··· 6677 6727 spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock, 6678 6728 iflags); 6679 6729 goto out; 6680 - } else if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { 6730 + } else if (test_bit(NLP_RPI_REGISTERED, 6731 + &ndlp->nlp_flag)) { 6681 6732 ret = 1; 6682 6733 lpfc_printf_log(phba, KERN_INFO, 6683 6734 LOG_NODE | LOG_DISCOVERY, 6684 - "2624 RPI %x DID %x flag %x " 6735 + "2624 RPI %x DID %x flag %lx " 6685 6736 "still logged in\n", 6686 6737 ndlp->nlp_rpi, ndlp->nlp_DID, 6687 6738 ndlp->nlp_flag);
+23 -38
drivers/scsi/lpfc/lpfc_init.c
··· 1943 1943 1944 1944 lpfc_offline_prep(phba, mbx_action); 1945 1945 lpfc_sli_flush_io_rings(phba); 1946 + lpfc_nvmels_flush_cmd(phba); 1946 1947 lpfc_offline(phba); 1947 1948 /* release interrupt for possible resource change */ 1948 1949 lpfc_sli4_disable_intr(phba); ··· 3093 3092 lpfc_printf_vlog(ndlp->vport, KERN_ERR, 3094 3093 LOG_DISCOVERY, 3095 3094 "0282 did:x%x ndlp:x%px " 3096 - "refcnt:%d xflags x%x nflag x%x\n", 3095 + "refcnt:%d xflags x%x " 3096 + "nflag x%lx\n", 3097 3097 ndlp->nlp_DID, (void *)ndlp, 3098 3098 kref_read(&ndlp->kref), 3099 3099 ndlp->fc4_xpt_flags, ··· 3381 3379 } 3382 3380 3383 3381 /** 3384 - * lpfc_sli4_node_prep - Assign RPIs for active nodes. 3382 + * lpfc_sli4_node_rpi_restore - Recover assigned RPIs for active nodes. 3385 3383 * @phba: pointer to lpfc hba data structure. 3386 3384 * 3387 3385 * Allocate RPIs for all active remote nodes. This is needed whenever ··· 3389 3387 * is to fixup the temporary rpi assignments. 3390 3388 **/ 3391 3389 void 3392 - lpfc_sli4_node_prep(struct lpfc_hba *phba) 3390 + lpfc_sli4_node_rpi_restore(struct lpfc_hba *phba) 3393 3391 { 3394 3392 struct lpfc_nodelist *ndlp, *next_ndlp; 3395 3393 struct lpfc_vport **vports; ··· 3399 3397 return; 3400 3398 3401 3399 vports = lpfc_create_vport_work_array(phba); 3402 - if (vports == NULL) 3400 + if (!vports) 3403 3401 return; 3404 3402 3405 - for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { 3403 + for (i = 0; i <= phba->max_vports && vports[i]; i++) { 3406 3404 if (test_bit(FC_UNLOADING, &vports[i]->load_flag)) 3407 3405 continue; 3408 3406 ··· 3411 3409 nlp_listp) { 3412 3410 rpi = lpfc_sli4_alloc_rpi(phba); 3413 3411 if (rpi == LPFC_RPI_ALLOC_ERROR) { 3414 - /* TODO print log? */ 3412 + lpfc_printf_vlog(ndlp->vport, KERN_INFO, 3413 + LOG_NODE | LOG_DISCOVERY, 3414 + "0099 RPI alloc error for " 3415 + "ndlp x%px DID:x%06x " 3416 + "flg:x%lx\n", 3417 + ndlp, ndlp->nlp_DID, 3418 + ndlp->nlp_flag); 3415 3419 continue; 3416 3420 } 3417 3421 ndlp->nlp_rpi = rpi; 3418 3422 lpfc_printf_vlog(ndlp->vport, KERN_INFO, 3419 3423 LOG_NODE | LOG_DISCOVERY, 3420 3424 "0009 Assign RPI x%x to ndlp x%px " 3421 - "DID:x%06x flg:x%x\n", 3425 + "DID:x%06x flg:x%lx\n", 3422 3426 ndlp->nlp_rpi, ndlp, ndlp->nlp_DID, 3423 3427 ndlp->nlp_flag); 3424 3428 } ··· 3828 3820 &vports[i]->fc_nodes, 3829 3821 nlp_listp) { 3830 3822 3831 - spin_lock_irq(&ndlp->lock); 3832 - ndlp->nlp_flag &= ~NLP_NPR_ADISC; 3833 - spin_unlock_irq(&ndlp->lock); 3834 - 3823 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 3835 3824 if (offline || hba_pci_err) { 3836 - spin_lock_irq(&ndlp->lock); 3837 - ndlp->nlp_flag &= ~(NLP_UNREG_INP | 3838 - NLP_RPI_REGISTERED); 3839 - spin_unlock_irq(&ndlp->lock); 3840 - if (phba->sli_rev == LPFC_SLI_REV4) 3841 - lpfc_sli_rpi_release(vports[i], 3842 - ndlp); 3843 - } else { 3844 - lpfc_unreg_rpi(vports[i], ndlp); 3845 - } 3846 - /* 3847 - * Whenever an SLI4 port goes offline, free the 3848 - * RPI. Get a new RPI when the adapter port 3849 - * comes back online. 3850 - */ 3851 - if (phba->sli_rev == LPFC_SLI_REV4) { 3852 - lpfc_printf_vlog(vports[i], KERN_INFO, 3853 - LOG_NODE | LOG_DISCOVERY, 3854 - "0011 Free RPI x%x on " 3855 - "ndlp: x%px did x%x\n", 3856 - ndlp->nlp_rpi, ndlp, 3857 - ndlp->nlp_DID); 3858 - lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi); 3859 - ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR; 3825 + clear_bit(NLP_UNREG_INP, 3826 + &ndlp->nlp_flag); 3827 + clear_bit(NLP_RPI_REGISTERED, 3828 + &ndlp->nlp_flag); 3860 3829 } 3861 3830 3862 3831 if (ndlp->nlp_type & NLP_FABRIC) { ··· 6910 6925 */ 6911 6926 mod_timer(&ndlp->nlp_delayfunc, 6912 6927 jiffies + msecs_to_jiffies(1000)); 6913 - spin_lock_irq(&ndlp->lock); 6914 - ndlp->nlp_flag |= NLP_DELAY_TMO; 6915 - spin_unlock_irq(&ndlp->lock); 6928 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 6916 6929 ndlp->nlp_last_elscmd = ELS_CMD_FDISC; 6917 6930 vport->port_state = LPFC_FDISC; 6918 6931 } else { ··· 13500 13517 13501 13518 /* Disable FW logging to host memory */ 13502 13519 lpfc_ras_stop_fwlog(phba); 13520 + 13521 + lpfc_sli4_queue_unset(phba); 13503 13522 13504 13523 /* Reset SLI4 HBA FCoE function */ 13505 13524 lpfc_pci_function_reset(phba);
+134 -195
drivers/scsi/lpfc/lpfc_nportdisc.c
··· 65 65 struct lpfc_name *nn, struct lpfc_name *pn) 66 66 { 67 67 /* First, we MUST have a RPI registered */ 68 - if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED)) 68 + if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) 69 69 return 0; 70 70 71 71 /* Compare the ADISC rsp WWNN / WWPN matches our internal node ··· 239 239 /* Abort outstanding I/O on NPort <nlp_DID> */ 240 240 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY, 241 241 "2819 Abort outstanding I/O on NPort x%x " 242 - "Data: x%x x%x x%x\n", 242 + "Data: x%lx x%x x%x\n", 243 243 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, 244 244 ndlp->nlp_rpi); 245 245 /* Clean up all fabric IOs first.*/ ··· 340 340 341 341 /* Now process the REG_RPI cmpl */ 342 342 lpfc_mbx_cmpl_reg_login(phba, login_mbox); 343 - ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN; 343 + clear_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag); 344 344 kfree(save_iocb); 345 345 } 346 346 ··· 404 404 405 405 /* PLOGI chkparm OK */ 406 406 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 407 - "0114 PLOGI chkparm OK Data: x%x x%x x%x " 407 + "0114 PLOGI chkparm OK Data: x%x x%x x%lx " 408 408 "x%x x%x x%lx\n", 409 409 ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, 410 410 ndlp->nlp_rpi, vport->port_state, ··· 429 429 /* if already logged in, do implicit logout */ 430 430 switch (ndlp->nlp_state) { 431 431 case NLP_STE_NPR_NODE: 432 - if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) 432 + if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) 433 433 break; 434 434 fallthrough; 435 435 case NLP_STE_REG_LOGIN_ISSUE: ··· 449 449 ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); 450 450 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 451 451 ndlp->nlp_nvme_info &= ~NLP_NVME_NSLER; 452 - ndlp->nlp_flag &= ~NLP_FIRSTBURST; 452 + clear_bit(NLP_FIRSTBURST, &ndlp->nlp_flag); 453 453 454 454 lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, 455 455 ndlp, NULL); ··· 480 480 ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); 481 481 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 482 482 ndlp->nlp_nvme_info &= ~NLP_NVME_NSLER; 483 - ndlp->nlp_flag &= ~NLP_FIRSTBURST; 483 + clear_bit(NLP_FIRSTBURST, &ndlp->nlp_flag); 484 484 485 485 login_mbox = NULL; 486 486 link_mbox = NULL; ··· 552 552 lpfc_can_disctmo(vport); 553 553 } 554 554 555 - ndlp->nlp_flag &= ~NLP_SUPPRESS_RSP; 555 + clear_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag); 556 556 if ((phba->sli.sli_flag & LPFC_SLI_SUPPRESS_RSP) && 557 557 sp->cmn.valid_vendor_ver_level) { 558 558 vid = be32_to_cpu(sp->un.vv.vid); 559 559 flag = be32_to_cpu(sp->un.vv.flags); 560 560 if ((vid == LPFC_VV_EMLX_ID) && (flag & LPFC_VV_SUPPRESS_RSP)) 561 - ndlp->nlp_flag |= NLP_SUPPRESS_RSP; 561 + set_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag); 562 562 } 563 563 564 564 login_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); ··· 627 627 * this ELS request. The only way to do this is 628 628 * to register, then unregister the RPI. 629 629 */ 630 - spin_lock_irq(&ndlp->lock); 631 - ndlp->nlp_flag |= (NLP_RM_DFLT_RPI | NLP_ACC_REGLOGIN | 632 - NLP_RCV_PLOGI); 633 - spin_unlock_irq(&ndlp->lock); 630 + set_bit(NLP_RM_DFLT_RPI, &ndlp->nlp_flag); 631 + set_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag); 632 + set_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag); 634 633 } 635 634 636 635 stat.un.b.lsRjtRsnCode = LSRJT_INVALID_CMD; ··· 664 665 665 666 login_mbox->ctx_u.save_iocb = save_iocb; /* For PLOGI ACC */ 666 667 667 - spin_lock_irq(&ndlp->lock); 668 - ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); 669 - spin_unlock_irq(&ndlp->lock); 668 + set_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag); 669 + set_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag); 670 670 671 671 /* Start the ball rolling by issuing REG_LOGIN here */ 672 672 rc = lpfc_sli_issue_mbox(phba, login_mbox, MBX_NOWAIT); ··· 795 797 */ 796 798 if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET)) { 797 799 if ((ndlp->nlp_state != NLP_STE_MAPPED_NODE) && 798 - !(ndlp->nlp_flag & NLP_NPR_ADISC)) 800 + !test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) 799 801 lpfc_nlp_set_state(vport, ndlp, 800 802 NLP_STE_MAPPED_NODE); 801 803 } ··· 812 814 /* 1 sec timeout */ 813 815 mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000)); 814 816 815 - spin_lock_irq(&ndlp->lock); 816 - ndlp->nlp_flag |= NLP_DELAY_TMO; 817 - spin_unlock_irq(&ndlp->lock); 817 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 818 818 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 819 819 ndlp->nlp_prev_state = ndlp->nlp_state; 820 820 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); ··· 831 835 /* Only call LOGO ACC for first LOGO, this avoids sending unnecessary 832 836 * PLOGIs during LOGO storms from a device. 833 837 */ 834 - spin_lock_irq(&ndlp->lock); 835 - ndlp->nlp_flag |= NLP_LOGO_ACC; 836 - spin_unlock_irq(&ndlp->lock); 838 + set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 837 839 if (els_cmd == ELS_CMD_PRLO) 838 840 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); 839 841 else ··· 884 890 */ 885 891 mod_timer(&ndlp->nlp_delayfunc, 886 892 jiffies + msecs_to_jiffies(1000)); 887 - spin_lock_irq(&ndlp->lock); 888 - ndlp->nlp_flag |= NLP_DELAY_TMO; 889 - spin_unlock_irq(&ndlp->lock); 893 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 890 894 ndlp->nlp_last_elscmd = ELS_CMD_FDISC; 891 895 vport->port_state = LPFC_FDISC; 892 896 } else { ··· 907 915 ndlp->nlp_state <= NLP_STE_PRLI_ISSUE)) { 908 916 mod_timer(&ndlp->nlp_delayfunc, 909 917 jiffies + msecs_to_jiffies(1000 * 1)); 910 - spin_lock_irq(&ndlp->lock); 911 - ndlp->nlp_flag |= NLP_DELAY_TMO; 912 - spin_unlock_irq(&ndlp->lock); 918 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 913 919 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 914 920 lpfc_printf_vlog(vport, KERN_INFO, 915 921 LOG_NODE | LOG_ELS | LOG_DISCOVERY, 916 922 "3204 Start nlpdelay on DID x%06x " 917 - "nflag x%x lastels x%x ref cnt %u", 923 + "nflag x%lx lastels x%x ref cnt %u", 918 924 ndlp->nlp_DID, ndlp->nlp_flag, 919 925 ndlp->nlp_last_elscmd, 920 926 kref_read(&ndlp->kref)); ··· 925 935 ndlp->nlp_prev_state = ndlp->nlp_state; 926 936 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 927 937 928 - spin_lock_irq(&ndlp->lock); 929 - ndlp->nlp_flag &= ~NLP_NPR_ADISC; 930 - spin_unlock_irq(&ndlp->lock); 938 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 931 939 /* The driver has to wait until the ACC completes before it continues 932 940 * processing the LOGO. The action will resume in 933 941 * lpfc_cmpl_els_logo_acc routine. Since part of processing includes an ··· 966 978 out: 967 979 lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY, 968 980 "6115 Rcv PRLI (%x) check failed: ndlp rpi %d " 969 - "state x%x flags x%x port_type: x%x " 981 + "state x%x flags x%lx port_type: x%x " 970 982 "npr->initfcn: x%x npr->tgtfcn: x%x\n", 971 983 cmd, ndlp->nlp_rpi, ndlp->nlp_state, 972 984 ndlp->nlp_flag, vport->port_type, ··· 1008 1020 if (npr->prliType == PRLI_NVME_TYPE) 1009 1021 ndlp->nlp_type |= NLP_NVME_TARGET; 1010 1022 if (npr->writeXferRdyDis) 1011 - ndlp->nlp_flag |= NLP_FIRSTBURST; 1023 + set_bit(NLP_FIRSTBURST, &ndlp->nlp_flag); 1012 1024 } 1013 1025 if (npr->Retry && ndlp->nlp_type & 1014 1026 (NLP_FCP_INITIATOR | NLP_FCP_TARGET)) ··· 1045 1057 roles |= FC_RPORT_ROLE_FCP_TARGET; 1046 1058 1047 1059 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, 1048 - "rport rolechg: role:x%x did:x%x flg:x%x", 1060 + "rport rolechg: role:x%x did:x%x flg:x%lx", 1049 1061 roles, ndlp->nlp_DID, ndlp->nlp_flag); 1050 1062 1051 1063 if (vport->cfg_enable_fc4_type != LPFC_ENABLE_NVME) ··· 1056 1068 static uint32_t 1057 1069 lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 1058 1070 { 1059 - if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED)) { 1060 - spin_lock_irq(&ndlp->lock); 1061 - ndlp->nlp_flag &= ~NLP_NPR_ADISC; 1062 - spin_unlock_irq(&ndlp->lock); 1071 + if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) { 1072 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 1063 1073 return 0; 1064 1074 } 1065 1075 ··· 1067 1081 (test_bit(FC_RSCN_MODE, &vport->fc_flag) || 1068 1082 ((ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) && 1069 1083 (ndlp->nlp_type & NLP_FCP_TARGET)))) { 1070 - spin_lock_irq(&ndlp->lock); 1071 - ndlp->nlp_flag |= NLP_NPR_ADISC; 1072 - spin_unlock_irq(&ndlp->lock); 1084 + set_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 1073 1085 return 1; 1074 1086 } 1075 1087 } 1076 1088 1077 - spin_lock_irq(&ndlp->lock); 1078 - ndlp->nlp_flag &= ~NLP_NPR_ADISC; 1079 - spin_unlock_irq(&ndlp->lock); 1089 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 1080 1090 lpfc_unreg_rpi(vport, ndlp); 1081 1091 return 0; 1082 1092 } ··· 1097 1115 /* If there is already an UNREG in progress for this ndlp, 1098 1116 * no need to queue up another one. 1099 1117 */ 1100 - if (ndlp->nlp_flag & NLP_UNREG_INP) { 1118 + if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag)) { 1101 1119 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 1102 1120 "1435 release_rpi SKIP UNREG x%x on " 1103 - "NPort x%x deferred x%x flg x%x " 1121 + "NPort x%x deferred x%x flg x%lx " 1104 1122 "Data: x%px\n", 1105 1123 ndlp->nlp_rpi, ndlp->nlp_DID, 1106 1124 ndlp->nlp_defer_did, ··· 1125 1143 1126 1144 if (((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) && 1127 1145 (!test_bit(FC_OFFLINE_MODE, &vport->fc_flag))) 1128 - ndlp->nlp_flag |= NLP_UNREG_INP; 1146 + set_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 1129 1147 1130 1148 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 1131 1149 "1437 release_rpi UNREG x%x " 1132 - "on NPort x%x flg x%x\n", 1150 + "on NPort x%x flg x%lx\n", 1133 1151 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag); 1134 1152 1135 1153 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); ··· 1157 1175 } 1158 1176 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 1159 1177 "0271 Illegal State Transition: node x%x " 1160 - "event x%x, state x%x Data: x%x x%x\n", 1178 + "event x%x, state x%x Data: x%x x%lx\n", 1161 1179 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, 1162 1180 ndlp->nlp_flag); 1163 1181 return ndlp->nlp_state; ··· 1172 1190 * working on the same NPortID, do nothing for this thread 1173 1191 * to stop it. 1174 1192 */ 1175 - if (!(ndlp->nlp_flag & NLP_RCV_PLOGI)) { 1193 + if (!test_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag)) 1176 1194 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 1177 1195 "0272 Illegal State Transition: node x%x " 1178 - "event x%x, state x%x Data: x%x x%x\n", 1196 + "event x%x, state x%x Data: x%x x%lx\n", 1179 1197 ndlp->nlp_DID, evt, ndlp->nlp_state, 1180 1198 ndlp->nlp_rpi, ndlp->nlp_flag); 1181 - } 1182 1199 return ndlp->nlp_state; 1183 1200 } 1184 1201 ··· 1211 1230 { 1212 1231 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; 1213 1232 1214 - spin_lock_irq(&ndlp->lock); 1215 - ndlp->nlp_flag |= NLP_LOGO_ACC; 1216 - spin_unlock_irq(&ndlp->lock); 1233 + set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 1217 1234 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); 1218 1235 1219 1236 return ndlp->nlp_state; ··· 1269 1290 NULL); 1270 1291 } else { 1271 1292 if (lpfc_rcv_plogi(vport, ndlp, cmdiocb) && 1272 - (ndlp->nlp_flag & NLP_NPR_2B_DISC) && 1273 - (vport->num_disc_nodes)) { 1274 - spin_lock_irq(&ndlp->lock); 1275 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1276 - spin_unlock_irq(&ndlp->lock); 1293 + test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag) && 1294 + vport->num_disc_nodes) { 1295 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 1277 1296 /* Check if there are more PLOGIs to be sent */ 1278 1297 lpfc_more_plogi(vport); 1279 1298 if (vport->num_disc_nodes == 0) { ··· 1333 1356 1334 1357 /* Put ndlp in npr state set plogi timer for 1 sec */ 1335 1358 mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000 * 1)); 1336 - spin_lock_irq(&ndlp->lock); 1337 - ndlp->nlp_flag |= NLP_DELAY_TMO; 1338 - spin_unlock_irq(&ndlp->lock); 1359 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 1339 1360 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 1340 1361 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; 1341 1362 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); ··· 1364 1389 1365 1390 ulp_status = get_job_ulpstatus(phba, rspiocb); 1366 1391 1367 - if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { 1392 + if (test_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag)) { 1368 1393 /* Recovery from PLOGI collision logic */ 1369 1394 return ndlp->nlp_state; 1370 1395 } ··· 1393 1418 goto out; 1394 1419 /* PLOGI chkparm OK */ 1395 1420 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 1396 - "0121 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", 1421 + "0121 PLOGI chkparm OK Data: x%x x%x x%lx x%x\n", 1397 1422 ndlp->nlp_DID, ndlp->nlp_state, 1398 1423 ndlp->nlp_flag, ndlp->nlp_rpi); 1399 1424 if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid)) ··· 1421 1446 ed_tov = (phba->fc_edtov + 999999) / 1000000; 1422 1447 } 1423 1448 1424 - ndlp->nlp_flag &= ~NLP_SUPPRESS_RSP; 1449 + clear_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag); 1425 1450 if ((phba->sli.sli_flag & LPFC_SLI_SUPPRESS_RSP) && 1426 1451 sp->cmn.valid_vendor_ver_level) { 1427 1452 vid = be32_to_cpu(sp->un.vv.vid); 1428 1453 flag = be32_to_cpu(sp->un.vv.flags); 1429 1454 if ((vid == LPFC_VV_EMLX_ID) && 1430 1455 (flag & LPFC_VV_SUPPRESS_RSP)) 1431 - ndlp->nlp_flag |= NLP_SUPPRESS_RSP; 1456 + set_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag); 1432 1457 } 1433 1458 1434 1459 /* ··· 1451 1476 LOG_TRACE_EVENT, 1452 1477 "0133 PLOGI: no memory " 1453 1478 "for config_link " 1454 - "Data: x%x x%x x%x x%x\n", 1479 + "Data: x%x x%x x%lx x%x\n", 1455 1480 ndlp->nlp_DID, ndlp->nlp_state, 1456 1481 ndlp->nlp_flag, ndlp->nlp_rpi); 1457 1482 goto out; ··· 1475 1500 if (!mbox) { 1476 1501 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 1477 1502 "0018 PLOGI: no memory for reg_login " 1478 - "Data: x%x x%x x%x x%x\n", 1503 + "Data: x%x x%x x%lx x%x\n", 1479 1504 ndlp->nlp_DID, ndlp->nlp_state, 1480 1505 ndlp->nlp_flag, ndlp->nlp_rpi); 1481 1506 goto out; ··· 1495 1520 mbox->mbox_cmpl = lpfc_mbx_cmpl_fdmi_reg_login; 1496 1521 break; 1497 1522 default: 1498 - ndlp->nlp_flag |= NLP_REG_LOGIN_SEND; 1523 + set_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 1499 1524 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; 1500 1525 } 1501 1526 ··· 1510 1535 NLP_STE_REG_LOGIN_ISSUE); 1511 1536 return ndlp->nlp_state; 1512 1537 } 1513 - if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) 1514 - ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 1538 + clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 1515 1539 /* decrement node reference count to the failed mbox 1516 1540 * command 1517 1541 */ ··· 1518 1544 lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); 1519 1545 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 1520 1546 "0134 PLOGI: cannot issue reg_login " 1521 - "Data: x%x x%x x%x x%x\n", 1547 + "Data: x%x x%x x%lx x%x\n", 1522 1548 ndlp->nlp_DID, ndlp->nlp_state, 1523 1549 ndlp->nlp_flag, ndlp->nlp_rpi); 1524 1550 } else { ··· 1526 1552 1527 1553 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 1528 1554 "0135 PLOGI: cannot format reg_login " 1529 - "Data: x%x x%x x%x x%x\n", 1555 + "Data: x%x x%x x%lx x%x\n", 1530 1556 ndlp->nlp_DID, ndlp->nlp_state, 1531 1557 ndlp->nlp_flag, ndlp->nlp_rpi); 1532 1558 } ··· 1579 1605 lpfc_device_rm_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 1580 1606 void *arg, uint32_t evt) 1581 1607 { 1582 - if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { 1583 - spin_lock_irq(&ndlp->lock); 1584 - ndlp->nlp_flag |= NLP_NODEV_REMOVE; 1585 - spin_unlock_irq(&ndlp->lock); 1608 + if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 1609 + set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 1586 1610 return ndlp->nlp_state; 1587 - } else { 1588 - /* software abort outstanding PLOGI */ 1589 - lpfc_els_abort(vport->phba, ndlp); 1590 - 1591 - lpfc_drop_node(vport, ndlp); 1592 - return NLP_STE_FREED_NODE; 1593 1611 } 1612 + /* software abort outstanding PLOGI */ 1613 + lpfc_els_abort(vport->phba, ndlp); 1614 + 1615 + lpfc_drop_node(vport, ndlp); 1616 + return NLP_STE_FREED_NODE; 1594 1617 } 1595 1618 1596 1619 static uint32_t ··· 1607 1636 1608 1637 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; 1609 1638 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 1610 - spin_lock_irq(&ndlp->lock); 1611 - ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1612 - spin_unlock_irq(&ndlp->lock); 1639 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 1640 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 1613 1641 1614 1642 return ndlp->nlp_state; 1615 1643 } ··· 1626 1656 cmdiocb = (struct lpfc_iocbq *) arg; 1627 1657 1628 1658 if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) { 1629 - if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { 1630 - spin_lock_irq(&ndlp->lock); 1631 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1632 - spin_unlock_irq(&ndlp->lock); 1659 + if (test_and_clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 1633 1660 if (vport->num_disc_nodes) 1634 1661 lpfc_more_adisc(vport); 1635 1662 } ··· 1715 1748 /* 1 sec timeout */ 1716 1749 mod_timer(&ndlp->nlp_delayfunc, 1717 1750 jiffies + msecs_to_jiffies(1000)); 1718 - spin_lock_irq(&ndlp->lock); 1719 - ndlp->nlp_flag |= NLP_DELAY_TMO; 1720 - spin_unlock_irq(&ndlp->lock); 1751 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 1721 1752 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 1722 1753 1723 1754 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; ··· 1754 1789 lpfc_device_rm_adisc_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 1755 1790 void *arg, uint32_t evt) 1756 1791 { 1757 - if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { 1758 - spin_lock_irq(&ndlp->lock); 1759 - ndlp->nlp_flag |= NLP_NODEV_REMOVE; 1760 - spin_unlock_irq(&ndlp->lock); 1792 + if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 1793 + set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 1761 1794 return ndlp->nlp_state; 1762 - } else { 1763 - /* software abort outstanding ADISC */ 1764 - lpfc_els_abort(vport->phba, ndlp); 1765 - 1766 - lpfc_drop_node(vport, ndlp); 1767 - return NLP_STE_FREED_NODE; 1768 1795 } 1796 + /* software abort outstanding ADISC */ 1797 + lpfc_els_abort(vport->phba, ndlp); 1798 + 1799 + lpfc_drop_node(vport, ndlp); 1800 + return NLP_STE_FREED_NODE; 1769 1801 } 1770 1802 1771 1803 static uint32_t ··· 1782 1820 1783 1821 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; 1784 1822 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 1785 - spin_lock_irq(&ndlp->lock); 1786 - ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1787 - spin_unlock_irq(&ndlp->lock); 1823 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 1824 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 1788 1825 lpfc_disc_set_adisc(vport, ndlp); 1789 1826 return ndlp->nlp_state; 1790 1827 } ··· 1817 1856 * transition to UNMAPPED provided the RPI has completed 1818 1857 * registration. 1819 1858 */ 1820 - if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { 1859 + if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) { 1821 1860 lpfc_rcv_prli(vport, ndlp, cmdiocb); 1822 1861 lpfc_els_rsp_prli_acc(vport, cmdiocb, ndlp); 1823 1862 } else { ··· 1856 1895 if ((mb = phba->sli.mbox_active)) { 1857 1896 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 1858 1897 (ndlp == mb->ctx_ndlp)) { 1859 - ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 1898 + clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 1860 1899 lpfc_nlp_put(ndlp); 1861 1900 mb->ctx_ndlp = NULL; 1862 1901 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; ··· 1867 1906 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { 1868 1907 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 1869 1908 (ndlp == mb->ctx_ndlp)) { 1870 - ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 1909 + clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag); 1871 1910 lpfc_nlp_put(ndlp); 1872 1911 list_del(&mb->list); 1873 1912 phba->sli.mboxq_cnt--; ··· 1937 1976 /* Put ndlp in npr state set plogi timer for 1 sec */ 1938 1977 mod_timer(&ndlp->nlp_delayfunc, 1939 1978 jiffies + msecs_to_jiffies(1000 * 1)); 1940 - spin_lock_irq(&ndlp->lock); 1941 - ndlp->nlp_flag |= NLP_DELAY_TMO; 1942 - spin_unlock_irq(&ndlp->lock); 1979 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 1943 1980 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 1944 1981 1945 1982 lpfc_issue_els_logo(vport, ndlp, 0); ··· 1948 1989 if (phba->sli_rev < LPFC_SLI_REV4) 1949 1990 ndlp->nlp_rpi = mb->un.varWords[0]; 1950 1991 1951 - ndlp->nlp_flag |= NLP_RPI_REGISTERED; 1992 + set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 1952 1993 1953 1994 /* Only if we are not a fabric nport do we issue PRLI */ 1954 1995 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, ··· 2020 2061 void *arg, 2021 2062 uint32_t evt) 2022 2063 { 2023 - if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { 2024 - spin_lock_irq(&ndlp->lock); 2025 - ndlp->nlp_flag |= NLP_NODEV_REMOVE; 2026 - spin_unlock_irq(&ndlp->lock); 2064 + if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 2065 + set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2027 2066 return ndlp->nlp_state; 2028 - } else { 2029 - lpfc_drop_node(vport, ndlp); 2030 - return NLP_STE_FREED_NODE; 2031 2067 } 2068 + lpfc_drop_node(vport, ndlp); 2069 + return NLP_STE_FREED_NODE; 2032 2070 } 2033 2071 2034 2072 static uint32_t ··· 2040 2084 2041 2085 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; 2042 2086 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 2043 - spin_lock_irq(&ndlp->lock); 2044 2087 2045 2088 /* If we are a target we won't immediately transition into PRLI, 2046 2089 * so if REG_LOGIN already completed we don't need to ignore it. 2047 2090 */ 2048 - if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED) || 2091 + if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag) || 2049 2092 !vport->phba->nvmet_support) 2050 - ndlp->nlp_flag |= NLP_IGNR_REG_CMPL; 2093 + set_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag); 2051 2094 2052 - ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 2053 - spin_unlock_irq(&ndlp->lock); 2095 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2096 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2054 2097 lpfc_disc_set_adisc(vport, ndlp); 2055 2098 return ndlp->nlp_state; 2056 2099 } ··· 2183 2228 if (npr->targetFunc) { 2184 2229 ndlp->nlp_type |= NLP_FCP_TARGET; 2185 2230 if (npr->writeXferRdyDis) 2186 - ndlp->nlp_flag |= NLP_FIRSTBURST; 2231 + set_bit(NLP_FIRSTBURST, 2232 + &ndlp->nlp_flag); 2187 2233 } 2188 2234 if (npr->Retry) 2189 2235 ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE; ··· 2228 2272 /* Both sides support FB. The target's first 2229 2273 * burst size is a 512 byte encoded value. 2230 2274 */ 2231 - ndlp->nlp_flag |= NLP_FIRSTBURST; 2275 + set_bit(NLP_FIRSTBURST, &ndlp->nlp_flag); 2232 2276 ndlp->nvme_fb_size = bf_get_be32(prli_fb_sz, 2233 2277 nvpr); 2234 2278 ··· 2243 2287 2244 2288 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, 2245 2289 "6029 NVME PRLI Cmpl w1 x%08x " 2246 - "w4 x%08x w5 x%08x flag x%x, " 2290 + "w4 x%08x w5 x%08x flag x%lx, " 2247 2291 "fcp_info x%x nlp_type x%x\n", 2248 2292 be32_to_cpu(nvpr->word1), 2249 2293 be32_to_cpu(nvpr->word4), ··· 2255 2299 (vport->port_type == LPFC_NPIV_PORT) && 2256 2300 vport->cfg_restrict_login) { 2257 2301 out: 2258 - spin_lock_irq(&ndlp->lock); 2259 - ndlp->nlp_flag |= NLP_TARGET_REMOVE; 2260 - spin_unlock_irq(&ndlp->lock); 2302 + set_bit(NLP_TARGET_REMOVE, &ndlp->nlp_flag); 2261 2303 lpfc_issue_els_logo(vport, ndlp, 0); 2262 2304 2263 2305 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; ··· 2307 2353 lpfc_device_rm_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 2308 2354 void *arg, uint32_t evt) 2309 2355 { 2310 - if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { 2311 - spin_lock_irq(&ndlp->lock); 2312 - ndlp->nlp_flag |= NLP_NODEV_REMOVE; 2313 - spin_unlock_irq(&ndlp->lock); 2356 + if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 2357 + set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2314 2358 return ndlp->nlp_state; 2315 - } else { 2316 - /* software abort outstanding PLOGI */ 2317 - lpfc_els_abort(vport->phba, ndlp); 2318 - 2319 - lpfc_drop_node(vport, ndlp); 2320 - return NLP_STE_FREED_NODE; 2321 2359 } 2360 + /* software abort outstanding PLOGI */ 2361 + lpfc_els_abort(vport->phba, ndlp); 2362 + 2363 + lpfc_drop_node(vport, ndlp); 2364 + return NLP_STE_FREED_NODE; 2322 2365 } 2323 2366 2324 2367 ··· 2352 2401 2353 2402 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; 2354 2403 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 2355 - spin_lock_irq(&ndlp->lock); 2356 - ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 2357 - spin_unlock_irq(&ndlp->lock); 2404 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2405 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2358 2406 lpfc_disc_set_adisc(vport, ndlp); 2359 2407 return ndlp->nlp_state; 2360 2408 } ··· 2392 2442 { 2393 2443 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *)arg; 2394 2444 2395 - spin_lock_irq(&ndlp->lock); 2396 - ndlp->nlp_flag |= NLP_LOGO_ACC; 2397 - spin_unlock_irq(&ndlp->lock); 2445 + set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 2398 2446 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); 2399 2447 return ndlp->nlp_state; 2400 2448 } ··· 2431 2483 { 2432 2484 ndlp->nlp_prev_state = NLP_STE_LOGO_ISSUE; 2433 2485 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 2434 - spin_lock_irq(&ndlp->lock); 2435 - ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 2436 - spin_unlock_irq(&ndlp->lock); 2486 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2487 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2437 2488 lpfc_disc_set_adisc(vport, ndlp); 2438 2489 return ndlp->nlp_state; 2439 2490 } ··· 2538 2591 { 2539 2592 ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; 2540 2593 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 2594 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2595 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2541 2596 spin_lock_irq(&ndlp->lock); 2542 - ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 2543 2597 ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); 2544 2598 spin_unlock_irq(&ndlp->lock); 2545 2599 lpfc_disc_set_adisc(vport, ndlp); ··· 2601 2653 lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT); 2602 2654 2603 2655 /* Send PRLO_ACC */ 2604 - spin_lock_irq(&ndlp->lock); 2605 - ndlp->nlp_flag |= NLP_LOGO_ACC; 2606 - spin_unlock_irq(&ndlp->lock); 2656 + set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 2607 2657 lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); 2608 2658 2609 2659 /* Save ELS_CMD_PRLO as the last elscmd and then set to NPR. ··· 2611 2665 ndlp->nlp_prev_state = ndlp->nlp_state; 2612 2666 2613 2667 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_ELS | LOG_DISCOVERY, 2614 - "3422 DID x%06x nflag x%x lastels x%x ref cnt %u\n", 2668 + "3422 DID x%06x nflag x%lx lastels x%x ref cnt %u\n", 2615 2669 ndlp->nlp_DID, ndlp->nlp_flag, 2616 2670 ndlp->nlp_last_elscmd, 2617 2671 kref_read(&ndlp->kref)); ··· 2631 2685 2632 2686 ndlp->nlp_prev_state = NLP_STE_MAPPED_NODE; 2633 2687 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 2688 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2689 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2634 2690 spin_lock_irq(&ndlp->lock); 2635 - ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 2636 2691 ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); 2637 2692 spin_unlock_irq(&ndlp->lock); 2638 2693 return ndlp->nlp_state; ··· 2646 2699 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; 2647 2700 2648 2701 /* Ignore PLOGI if we have an outstanding LOGO */ 2649 - if (ndlp->nlp_flag & (NLP_LOGO_SND | NLP_LOGO_ACC)) 2702 + if (test_bit(NLP_LOGO_SND, &ndlp->nlp_flag) || 2703 + test_bit(NLP_LOGO_ACC, &ndlp->nlp_flag)) 2650 2704 return ndlp->nlp_state; 2651 2705 if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) { 2652 2706 lpfc_cancel_retry_delay_tmo(vport, ndlp); 2653 - spin_lock_irq(&ndlp->lock); 2654 - ndlp->nlp_flag &= ~(NLP_NPR_ADISC | NLP_NPR_2B_DISC); 2655 - spin_unlock_irq(&ndlp->lock); 2656 - } else if (!(ndlp->nlp_flag & NLP_NPR_2B_DISC)) { 2707 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 2708 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2709 + } else if (!test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 2657 2710 /* send PLOGI immediately, move to PLOGI issue state */ 2658 - if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { 2711 + if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) { 2659 2712 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 2660 2713 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); 2661 2714 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); ··· 2676 2729 stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; 2677 2730 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL); 2678 2731 2679 - if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { 2732 + if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) { 2680 2733 /* 2681 2734 * ADISC nodes will be handled in regular discovery path after 2682 2735 * receiving response from NS. 2683 2736 * 2684 2737 * For other nodes, Send PLOGI to trigger an implicit LOGO. 2685 2738 */ 2686 - if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { 2739 + if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) { 2687 2740 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 2688 2741 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); 2689 2742 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); ··· 2714 2767 * or discovery in progress for this node. Starting discovery 2715 2768 * here will affect the counting of discovery threads. 2716 2769 */ 2717 - if (!(ndlp->nlp_flag & NLP_DELAY_TMO) && 2718 - !(ndlp->nlp_flag & NLP_NPR_2B_DISC)) { 2770 + if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag) && 2771 + !test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 2719 2772 /* 2720 2773 * ADISC nodes will be handled in regular discovery path after 2721 2774 * receiving response from NS. 2722 2775 * 2723 2776 * For other nodes, Send PLOGI to trigger an implicit LOGO. 2724 2777 */ 2725 - if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { 2778 + if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) { 2726 2779 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 2727 2780 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); 2728 2781 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); ··· 2737 2790 { 2738 2791 struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; 2739 2792 2740 - spin_lock_irq(&ndlp->lock); 2741 - ndlp->nlp_flag |= NLP_LOGO_ACC; 2742 - spin_unlock_irq(&ndlp->lock); 2793 + set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 2743 2794 2744 2795 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); 2745 2796 2746 - if ((ndlp->nlp_flag & NLP_DELAY_TMO) == 0) { 2797 + if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) { 2747 2798 mod_timer(&ndlp->nlp_delayfunc, 2748 2799 jiffies + msecs_to_jiffies(1000 * 1)); 2749 - spin_lock_irq(&ndlp->lock); 2750 - ndlp->nlp_flag |= NLP_DELAY_TMO; 2751 - ndlp->nlp_flag &= ~NLP_NPR_ADISC; 2752 - spin_unlock_irq(&ndlp->lock); 2800 + set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 2801 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 2753 2802 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 2754 2803 } else { 2755 - spin_lock_irq(&ndlp->lock); 2756 - ndlp->nlp_flag &= ~NLP_NPR_ADISC; 2757 - spin_unlock_irq(&ndlp->lock); 2804 + clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 2758 2805 } 2759 2806 return ndlp->nlp_state; 2760 2807 } ··· 2785 2844 2786 2845 ulp_status = get_job_ulpstatus(phba, rspiocb); 2787 2846 2788 - if (ulp_status && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { 2847 + if (ulp_status && test_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag)) { 2789 2848 lpfc_drop_node(vport, ndlp); 2790 2849 return NLP_STE_FREED_NODE; 2791 2850 } ··· 2818 2877 2819 2878 ulp_status = get_job_ulpstatus(phba, rspiocb); 2820 2879 2821 - if (ulp_status && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { 2880 + if (ulp_status && test_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag)) { 2822 2881 lpfc_drop_node(vport, ndlp); 2823 2882 return NLP_STE_FREED_NODE; 2824 2883 } ··· 2837 2896 /* SLI4 ports have preallocated logical rpis. */ 2838 2897 if (vport->phba->sli_rev < LPFC_SLI_REV4) 2839 2898 ndlp->nlp_rpi = mb->un.varWords[0]; 2840 - ndlp->nlp_flag |= NLP_RPI_REGISTERED; 2841 - if (ndlp->nlp_flag & NLP_LOGO_ACC) { 2899 + set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); 2900 + if (test_bit(NLP_LOGO_ACC, &ndlp->nlp_flag)) 2842 2901 lpfc_unreg_rpi(vport, ndlp); 2843 - } 2844 2902 } else { 2845 - if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { 2903 + if (test_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag)) { 2846 2904 lpfc_drop_node(vport, ndlp); 2847 2905 return NLP_STE_FREED_NODE; 2848 2906 } ··· 2853 2913 lpfc_device_rm_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 2854 2914 void *arg, uint32_t evt) 2855 2915 { 2856 - if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { 2857 - spin_lock_irq(&ndlp->lock); 2858 - ndlp->nlp_flag |= NLP_NODEV_REMOVE; 2859 - spin_unlock_irq(&ndlp->lock); 2916 + if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) { 2917 + set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2860 2918 return ndlp->nlp_state; 2861 2919 } 2862 2920 lpfc_drop_node(vport, ndlp); ··· 2870 2932 return ndlp->nlp_state; 2871 2933 2872 2934 lpfc_cancel_retry_delay_tmo(vport, ndlp); 2935 + clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag); 2936 + clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag); 2873 2937 spin_lock_irq(&ndlp->lock); 2874 - ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 2875 2938 ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); 2876 2939 spin_unlock_irq(&ndlp->lock); 2877 2940 return ndlp->nlp_state; ··· 3085 3146 /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ 3086 3147 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 3087 3148 "0211 DSM in event x%x on NPort x%x in " 3088 - "state %d rpi x%x Data: x%x x%x\n", 3149 + "state %d rpi x%x Data: x%lx x%x\n", 3089 3150 evt, ndlp->nlp_DID, cur_state, ndlp->nlp_rpi, 3090 3151 ndlp->nlp_flag, data1); 3091 3152 ··· 3102 3163 ((uint32_t)ndlp->nlp_type)); 3103 3164 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 3104 3165 "0212 DSM out state %d on NPort x%x " 3105 - "rpi x%x Data: x%x x%x\n", 3166 + "rpi x%x Data: x%lx x%x\n", 3106 3167 rc, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_flag, 3107 3168 data1); 3108 3169 3109 3170 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, 3110 - "DSM out: ste:%d did:x%x flg:x%x", 3171 + "DSM out: ste:%d did:x%x flg:x%lx", 3111 3172 rc, ndlp->nlp_DID, ndlp->nlp_flag); 3112 3173 /* Decrement the ndlp reference count held for this function */ 3113 3174 lpfc_nlp_put(ndlp);
+52 -8
drivers/scsi/lpfc/lpfc_nvme.c
··· 1232 1232 1233 1233 /* Word 5 */ 1234 1234 if ((phba->cfg_nvme_enable_fb) && 1235 - (pnode->nlp_flag & NLP_FIRSTBURST)) { 1235 + test_bit(NLP_FIRSTBURST, &pnode->nlp_flag)) { 1236 1236 req_len = lpfc_ncmd->nvmeCmd->payload_length; 1237 1237 if (req_len < pnode->nvme_fb_size) 1238 1238 wqe->fcp_iwrite.initial_xfer_len = ··· 2231 2231 struct lpfc_hba *phba = vport->phba; 2232 2232 struct lpfc_sli4_hdw_queue *qp; 2233 2233 int abts_scsi, abts_nvme; 2234 + u16 nvmels_cnt; 2234 2235 2235 2236 /* Host transport has to clean up and confirm requiring an indefinite 2236 2237 * wait. Print a message if a 10 second wait expires and renew the ··· 2244 2243 pending = 0; 2245 2244 abts_scsi = 0; 2246 2245 abts_nvme = 0; 2246 + nvmels_cnt = 0; 2247 2247 for (i = 0; i < phba->cfg_hdw_queue; i++) { 2248 2248 qp = &phba->sli4_hba.hdwq[i]; 2249 2249 if (!vport->localport || !qp || !qp->io_wq) ··· 2257 2255 abts_scsi += qp->abts_scsi_io_bufs; 2258 2256 abts_nvme += qp->abts_nvme_io_bufs; 2259 2257 } 2258 + if (phba->sli4_hba.nvmels_wq) { 2259 + pring = phba->sli4_hba.nvmels_wq->pring; 2260 + if (pring) 2261 + nvmels_cnt = pring->txcmplq_cnt; 2262 + } 2260 2263 if (!vport->localport || 2261 2264 test_bit(HBA_PCI_ERR, &vport->phba->bit_flags) || 2262 2265 phba->link_state == LPFC_HBA_ERROR || ··· 2270 2263 2271 2264 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 2272 2265 "6176 Lport x%px Localport x%px wait " 2273 - "timed out. Pending %d [%d:%d]. " 2266 + "timed out. Pending %d [%d:%d:%d]. " 2274 2267 "Renewing.\n", 2275 2268 lport, vport->localport, pending, 2276 - abts_scsi, abts_nvme); 2269 + abts_scsi, abts_nvme, nvmels_cnt); 2277 2270 continue; 2278 2271 } 2279 2272 break; ··· 2651 2644 * reference. Check if another thread has set 2652 2645 * NLP_DROPPED. 2653 2646 */ 2654 - spin_lock_irq(&ndlp->lock); 2655 - if (!(ndlp->nlp_flag & NLP_DROPPED)) { 2656 - ndlp->nlp_flag |= NLP_DROPPED; 2657 - spin_unlock_irq(&ndlp->lock); 2647 + if (!test_and_set_bit(NLP_DROPPED, 2648 + &ndlp->nlp_flag)) { 2658 2649 lpfc_nlp_put(ndlp); 2659 2650 return; 2660 2651 } 2661 - spin_unlock_irq(&ndlp->lock); 2662 2652 } 2663 2653 } 2664 2654 } ··· 2843 2839 2844 2840 memcpy(&pwqeIn->wcqe_cmpl, wcqep, sizeof(*wcqep)); 2845 2841 (pwqeIn->cmd_cmpl)(phba, pwqeIn, pwqeIn); 2842 + #endif 2843 + } 2844 + 2845 + /** 2846 + * lpfc_nvmels_flush_cmd - Clean up outstanding nvmels commands for a port 2847 + * @phba: Pointer to HBA context object. 2848 + * 2849 + **/ 2850 + void 2851 + lpfc_nvmels_flush_cmd(struct lpfc_hba *phba) 2852 + { 2853 + #if (IS_ENABLED(CONFIG_NVME_FC)) 2854 + LIST_HEAD(cancel_list); 2855 + struct lpfc_sli_ring *pring = NULL; 2856 + struct lpfc_iocbq *piocb, *tmp_iocb; 2857 + unsigned long iflags; 2858 + 2859 + if (phba->sli4_hba.nvmels_wq) 2860 + pring = phba->sli4_hba.nvmels_wq->pring; 2861 + 2862 + if (unlikely(!pring)) 2863 + return; 2864 + 2865 + spin_lock_irqsave(&phba->hbalock, iflags); 2866 + spin_lock(&pring->ring_lock); 2867 + list_splice_init(&pring->txq, &cancel_list); 2868 + pring->txq_cnt = 0; 2869 + list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { 2870 + if (piocb->cmd_flag & LPFC_IO_NVME_LS) { 2871 + list_move_tail(&piocb->list, &cancel_list); 2872 + pring->txcmplq_cnt--; 2873 + piocb->cmd_flag &= ~LPFC_IO_ON_TXCMPLQ; 2874 + } 2875 + } 2876 + spin_unlock(&pring->ring_lock); 2877 + spin_unlock_irqrestore(&phba->hbalock, iflags); 2878 + 2879 + if (!list_empty(&cancel_list)) 2880 + lpfc_sli_cancel_iocbs(phba, &cancel_list, IOSTAT_LOCAL_REJECT, 2881 + IOERR_SLI_DOWN); 2846 2882 #endif 2847 2883 }
+1 -1
drivers/scsi/lpfc/lpfc_nvmet.c
··· 2854 2854 /* In template ar=1 wqes=0 sup=0 irsp=0 irsplen=0 */ 2855 2855 2856 2856 if (rsp->rsplen == LPFC_NVMET_SUCCESS_LEN) { 2857 - if (ndlp->nlp_flag & NLP_SUPPRESS_RSP) 2857 + if (test_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag)) 2858 2858 bf_set(wqe_sup, 2859 2859 &wqe->fcp_tsend.wqe_com, 1); 2860 2860 } else {
+4 -4
drivers/scsi/lpfc/lpfc_scsi.c
··· 4629 4629 iocb_cmd->ulpCommand = CMD_FCP_IWRITE64_CR; 4630 4630 iocb_cmd->ulpPU = PARM_READ_CHECK; 4631 4631 if (vport->cfg_first_burst_size && 4632 - (pnode->nlp_flag & NLP_FIRSTBURST)) { 4632 + test_bit(NLP_FIRSTBURST, &pnode->nlp_flag)) { 4633 4633 u32 xrdy_len; 4634 4634 4635 4635 fcpdl = scsi_bufflen(scsi_cmnd); ··· 5829 5829 5830 5830 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, 5831 5831 "0702 Issue %s to TGT %d LUN %llu " 5832 - "rpi x%x nlp_flag x%x Data: x%x x%x\n", 5832 + "rpi x%x nlp_flag x%lx Data: x%x x%x\n", 5833 5833 lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id, 5834 5834 pnode->nlp_rpi, pnode->nlp_flag, iocbq->sli4_xritag, 5835 5835 iocbq->cmd_flag); ··· 6094 6094 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 6095 6095 "0722 Target Reset rport failure: rdata x%px\n", rdata); 6096 6096 if (pnode) { 6097 + clear_bit(NLP_NPR_ADISC, &pnode->nlp_flag); 6097 6098 spin_lock_irqsave(&pnode->lock, flags); 6098 - pnode->nlp_flag &= ~NLP_NPR_ADISC; 6099 6099 pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 6100 6100 spin_unlock_irqrestore(&pnode->lock, flags); 6101 6101 } ··· 6124 6124 !pnode->logo_waitq) { 6125 6125 pnode->logo_waitq = &waitq; 6126 6126 pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 6127 - pnode->nlp_flag |= NLP_ISSUE_LOGO; 6127 + set_bit(NLP_ISSUE_LOGO, &pnode->nlp_flag); 6128 6128 pnode->save_flags |= NLP_WAIT_FOR_LOGO; 6129 6129 spin_unlock_irqrestore(&pnode->lock, flags); 6130 6130 lpfc_unreg_rpi(vport, pnode);
+66 -59
drivers/scsi/lpfc/lpfc_sli.c
··· 1932 1932 union lpfc_wqe128 *wqe; 1933 1933 struct lpfc_iocbq *sync_buf; 1934 1934 unsigned long iflags; 1935 - u32 ret_val; 1935 + u32 ret_val, cgn_sig_freq; 1936 1936 u32 atot, wtot, max; 1937 1937 u8 warn_sync_period = 0; 1938 1938 ··· 1987 1987 } else if (wtot) { 1988 1988 if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY || 1989 1989 phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) { 1990 + cgn_sig_freq = phba->cgn_sig_freq ? phba->cgn_sig_freq : 1991 + lpfc_fabric_cgn_frequency; 1990 1992 /* We hit an Signal warning condition */ 1991 - max = LPFC_SEC_TO_MSEC / lpfc_fabric_cgn_frequency * 1993 + max = LPFC_SEC_TO_MSEC / cgn_sig_freq * 1992 1994 lpfc_acqe_cgn_frequency; 1993 1995 bf_set(cmf_sync_wsigmax, &wqe->cmf_sync, max); 1994 1996 bf_set(cmf_sync_wsigcnt, &wqe->cmf_sync, wtot); ··· 2844 2842 return; 2845 2843 } 2846 2844 2847 - static void 2848 - __lpfc_sli_rpi_release(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 2849 - { 2850 - unsigned long iflags; 2851 - 2852 - if (ndlp->nlp_flag & NLP_RELEASE_RPI) { 2853 - lpfc_sli4_free_rpi(vport->phba, ndlp->nlp_rpi); 2854 - spin_lock_irqsave(&ndlp->lock, iflags); 2855 - ndlp->nlp_flag &= ~NLP_RELEASE_RPI; 2856 - ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR; 2857 - spin_unlock_irqrestore(&ndlp->lock, iflags); 2858 - } 2859 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 2860 - } 2861 - 2862 - void 2863 - lpfc_sli_rpi_release(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 2864 - { 2865 - __lpfc_sli_rpi_release(vport, ndlp); 2866 - } 2867 - 2868 2845 /** 2869 2846 * lpfc_sli_def_mbox_cmpl - Default mailbox completion handler 2870 2847 * @phba: Pointer to HBA context object. ··· 2913 2932 vport, 2914 2933 KERN_INFO, LOG_MBOX | LOG_DISCOVERY, 2915 2934 "1438 UNREG cmpl deferred mbox x%x " 2916 - "on NPort x%x Data: x%x x%x x%px x%lx x%x\n", 2935 + "on NPort x%x Data: x%lx x%x x%px x%lx x%x\n", 2917 2936 ndlp->nlp_rpi, ndlp->nlp_DID, 2918 2937 ndlp->nlp_flag, ndlp->nlp_defer_did, 2919 2938 ndlp, vport->load_flag, kref_read(&ndlp->kref)); 2920 2939 2921 - if ((ndlp->nlp_flag & NLP_UNREG_INP) && 2922 - (ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING)) { 2923 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 2940 + if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag) && 2941 + ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING) { 2942 + clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 2924 2943 ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING; 2925 2944 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); 2926 - } else { 2927 - __lpfc_sli_rpi_release(vport, ndlp); 2928 2945 } 2929 2946 2930 2947 /* The unreg_login mailbox is complete and had a ··· 2970 2991 { 2971 2992 struct lpfc_vport *vport = pmb->vport; 2972 2993 struct lpfc_nodelist *ndlp; 2994 + bool unreg_inp; 2973 2995 2974 2996 ndlp = pmb->ctx_ndlp; 2975 2997 if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) { ··· 2983 3003 vport, KERN_INFO, 2984 3004 LOG_MBOX | LOG_SLI | LOG_NODE, 2985 3005 "0010 UNREG_LOGIN vpi:x%x " 2986 - "rpi:%x DID:%x defer x%x flg x%x " 3006 + "rpi:%x DID:%x defer x%x flg x%lx " 2987 3007 "x%px\n", 2988 3008 vport->vpi, ndlp->nlp_rpi, 2989 3009 ndlp->nlp_DID, ndlp->nlp_defer_did, 2990 3010 ndlp->nlp_flag, 2991 3011 ndlp); 2992 - ndlp->nlp_flag &= ~NLP_LOGO_ACC; 3012 + 3013 + /* Cleanup the nlp_flag now that the UNREG RPI 3014 + * has completed. 3015 + */ 3016 + unreg_inp = test_and_clear_bit(NLP_UNREG_INP, 3017 + &ndlp->nlp_flag); 3018 + clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag); 2993 3019 2994 3020 /* Check to see if there are any deferred 2995 3021 * events to process 2996 3022 */ 2997 - if ((ndlp->nlp_flag & NLP_UNREG_INP) && 2998 - (ndlp->nlp_defer_did != 2999 - NLP_EVT_NOTHING_PENDING)) { 3023 + if (unreg_inp && 3024 + ndlp->nlp_defer_did != 3025 + NLP_EVT_NOTHING_PENDING) { 3000 3026 lpfc_printf_vlog( 3001 3027 vport, KERN_INFO, 3002 3028 LOG_MBOX | LOG_SLI | LOG_NODE, ··· 3011 3025 "NPort x%x Data: x%x x%px\n", 3012 3026 ndlp->nlp_rpi, ndlp->nlp_DID, 3013 3027 ndlp->nlp_defer_did, ndlp); 3014 - ndlp->nlp_flag &= ~NLP_UNREG_INP; 3015 3028 ndlp->nlp_defer_did = 3016 3029 NLP_EVT_NOTHING_PENDING; 3017 3030 lpfc_issue_els_plogi( 3018 3031 vport, ndlp->nlp_DID, 0); 3019 - } else { 3020 - __lpfc_sli_rpi_release(vport, ndlp); 3021 3032 } 3033 + 3022 3034 lpfc_nlp_put(ndlp); 3023 3035 } 3024 3036 } ··· 5274 5290 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 5275 5291 "0296 Restart HBA Data: x%x x%x\n", 5276 5292 phba->pport->port_state, psli->sli_flag); 5293 + 5294 + lpfc_sli4_queue_unset(phba); 5277 5295 5278 5296 rc = lpfc_sli4_brdreset(phba); 5279 5297 if (rc) { ··· 8734 8748 lpfc_sli_config_mbox_opcode_get( 8735 8749 phba, mboxq), 8736 8750 rc, dd); 8751 + 8737 8752 /* 8738 8753 * Allocate all resources (xri,rpi,vpi,vfi) now. Subsequent 8739 8754 * calls depends on these resources to complete port setup. ··· 8746 8759 "rc = x%x\n", rc); 8747 8760 goto out_free_mbox; 8748 8761 } 8762 + 8763 + lpfc_sli4_node_rpi_restore(phba); 8749 8764 8750 8765 lpfc_set_host_data(phba, mboxq); 8751 8766 ··· 8936 8947 rc = -ENODEV; 8937 8948 goto out_free_iocblist; 8938 8949 } 8939 - lpfc_sli4_node_prep(phba); 8940 8950 8941 8951 if (!test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { 8942 8952 if ((phba->nvmet_support == 0) || (phba->cfg_nvmet_mrq == 1)) { ··· 14340 14352 * an unsolicited PLOGI from the same NPortId from 14341 14353 * starting another mailbox transaction. 14342 14354 */ 14343 - spin_lock_irqsave(&ndlp->lock, iflags); 14344 - ndlp->nlp_flag |= NLP_UNREG_INP; 14345 - spin_unlock_irqrestore(&ndlp->lock, iflags); 14355 + set_bit(NLP_UNREG_INP, &ndlp->nlp_flag); 14346 14356 lpfc_unreg_login(phba, vport->vpi, 14347 14357 pmbox->un.varWords[0], pmb); 14348 14358 pmb->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi; ··· 17611 17625 if (!eq) 17612 17626 return -ENODEV; 17613 17627 17628 + if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) 17629 + goto list_remove; 17630 + 17614 17631 mbox = mempool_alloc(eq->phba->mbox_mem_pool, GFP_KERNEL); 17615 17632 if (!mbox) 17616 17633 return -ENOMEM; ··· 17640 17651 shdr_status, shdr_add_status, rc); 17641 17652 status = -ENXIO; 17642 17653 } 17654 + mempool_free(mbox, eq->phba->mbox_mem_pool); 17643 17655 17656 + list_remove: 17644 17657 /* Remove eq from any list */ 17645 17658 list_del_init(&eq->list); 17646 - mempool_free(mbox, eq->phba->mbox_mem_pool); 17659 + 17647 17660 return status; 17648 17661 } 17649 17662 ··· 17673 17682 /* sanity check on queue memory */ 17674 17683 if (!cq) 17675 17684 return -ENODEV; 17685 + 17686 + if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) 17687 + goto list_remove; 17688 + 17676 17689 mbox = mempool_alloc(cq->phba->mbox_mem_pool, GFP_KERNEL); 17677 17690 if (!mbox) 17678 17691 return -ENOMEM; ··· 17702 17707 shdr_status, shdr_add_status, rc); 17703 17708 status = -ENXIO; 17704 17709 } 17710 + mempool_free(mbox, cq->phba->mbox_mem_pool); 17711 + 17712 + list_remove: 17705 17713 /* Remove cq from any list */ 17706 17714 list_del_init(&cq->list); 17707 - mempool_free(mbox, cq->phba->mbox_mem_pool); 17708 17715 return status; 17709 17716 } 17710 17717 ··· 17734 17737 /* sanity check on queue memory */ 17735 17738 if (!mq) 17736 17739 return -ENODEV; 17740 + 17741 + if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) 17742 + goto list_remove; 17743 + 17737 17744 mbox = mempool_alloc(mq->phba->mbox_mem_pool, GFP_KERNEL); 17738 17745 if (!mbox) 17739 17746 return -ENOMEM; ··· 17763 17762 shdr_status, shdr_add_status, rc); 17764 17763 status = -ENXIO; 17765 17764 } 17765 + mempool_free(mbox, mq->phba->mbox_mem_pool); 17766 + 17767 + list_remove: 17766 17768 /* Remove mq from any list */ 17767 17769 list_del_init(&mq->list); 17768 - mempool_free(mbox, mq->phba->mbox_mem_pool); 17769 17770 return status; 17770 17771 } 17771 17772 ··· 17795 17792 /* sanity check on queue memory */ 17796 17793 if (!wq) 17797 17794 return -ENODEV; 17795 + 17796 + if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) 17797 + goto list_remove; 17798 + 17798 17799 mbox = mempool_alloc(wq->phba->mbox_mem_pool, GFP_KERNEL); 17799 17800 if (!mbox) 17800 17801 return -ENOMEM; ··· 17823 17816 shdr_status, shdr_add_status, rc); 17824 17817 status = -ENXIO; 17825 17818 } 17819 + mempool_free(mbox, wq->phba->mbox_mem_pool); 17820 + 17821 + list_remove: 17826 17822 /* Remove wq from any list */ 17827 17823 list_del_init(&wq->list); 17828 17824 kfree(wq->pring); 17829 17825 wq->pring = NULL; 17830 - mempool_free(mbox, wq->phba->mbox_mem_pool); 17831 17826 return status; 17832 17827 } 17833 17828 ··· 17859 17850 /* sanity check on queue memory */ 17860 17851 if (!hrq || !drq) 17861 17852 return -ENODEV; 17853 + 17854 + if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) 17855 + goto list_remove; 17856 + 17862 17857 mbox = mempool_alloc(hrq->phba->mbox_mem_pool, GFP_KERNEL); 17863 17858 if (!mbox) 17864 17859 return -ENOMEM; ··· 17903 17890 shdr_status, shdr_add_status, rc); 17904 17891 status = -ENXIO; 17905 17892 } 17893 + mempool_free(mbox, hrq->phba->mbox_mem_pool); 17894 + 17895 + list_remove: 17906 17896 list_del_init(&hrq->list); 17907 17897 list_del_init(&drq->list); 17908 - mempool_free(mbox, hrq->phba->mbox_mem_pool); 17909 17898 return status; 17910 17899 } 17911 17900 ··· 19089 19074 * to free ndlp when transmit completes 19090 19075 */ 19091 19076 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE && 19092 - !(ndlp->nlp_flag & NLP_DROPPED) && 19077 + !test_bit(NLP_DROPPED, &ndlp->nlp_flag) && 19093 19078 !(ndlp->fc4_xpt_flags & (NVME_XPT_REGD | SCSI_XPT_REGD))) { 19094 - ndlp->nlp_flag |= NLP_DROPPED; 19079 + set_bit(NLP_DROPPED, &ndlp->nlp_flag); 19095 19080 lpfc_nlp_put(ndlp); 19096 19081 } 19097 19082 } ··· 21109 21094 /* Unregister the RPI when mailbox complete */ 21110 21095 mb->mbox_flag |= LPFC_MBX_IMED_UNREG; 21111 21096 restart_loop = 1; 21112 - spin_unlock_irq(&phba->hbalock); 21113 - spin_lock(&ndlp->lock); 21114 - ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL; 21115 - spin_unlock(&ndlp->lock); 21116 - spin_lock_irq(&phba->hbalock); 21097 + clear_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag); 21117 21098 break; 21118 21099 } 21119 21100 } ··· 21124 21113 ndlp = mb->ctx_ndlp; 21125 21114 mb->ctx_ndlp = NULL; 21126 21115 if (ndlp) { 21127 - spin_lock(&ndlp->lock); 21128 - ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL; 21129 - spin_unlock(&ndlp->lock); 21116 + clear_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag); 21130 21117 lpfc_nlp_put(ndlp); 21131 21118 } 21132 21119 } ··· 21133 21124 21134 21125 /* Release the ndlp with the cleaned-up active mailbox command */ 21135 21126 if (act_mbx_ndlp) { 21136 - spin_lock(&act_mbx_ndlp->lock); 21137 - act_mbx_ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL; 21138 - spin_unlock(&act_mbx_ndlp->lock); 21127 + clear_bit(NLP_IGNR_REG_CMPL, &act_mbx_ndlp->nlp_flag); 21139 21128 lpfc_nlp_put(act_mbx_ndlp); 21140 21129 } 21141 21130 }
+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.5" 23 + #define LPFC_DRIVER_VERSION "14.4.0.6" 24 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+3 -3
drivers/scsi/lpfc/lpfc_vport.c
··· 496 496 !ndlp->logo_waitq) { 497 497 ndlp->logo_waitq = &waitq; 498 498 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 499 - ndlp->nlp_flag |= NLP_ISSUE_LOGO; 499 + set_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag); 500 500 ndlp->save_flags |= NLP_WAIT_FOR_LOGO; 501 501 } 502 502 spin_unlock_irq(&ndlp->lock); ··· 515 515 } 516 516 517 517 /* Error - clean up node flags. */ 518 + clear_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag); 518 519 spin_lock_irq(&ndlp->lock); 519 - ndlp->nlp_flag &= ~NLP_ISSUE_LOGO; 520 520 ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO; 521 521 spin_unlock_irq(&ndlp->lock); 522 522 ··· 708 708 709 709 lpfc_printf_vlog(vport, KERN_INFO, LOG_VPORT | LOG_ELS, 710 710 "1829 DA_ID issue status %d. " 711 - "SFlag x%x NState x%x, NFlag x%x " 711 + "SFlag x%x NState x%x, NFlag x%lx " 712 712 "Rpi x%x\n", 713 713 rc, ndlp->save_flags, ndlp->nlp_state, 714 714 ndlp->nlp_flag, ndlp->nlp_rpi);
+1 -1
drivers/scsi/mac_esp.c
··· 432 432 433 433 static struct platform_driver esp_mac_driver = { 434 434 .probe = esp_mac_probe, 435 - .remove_new = esp_mac_remove, 435 + .remove = esp_mac_remove, 436 436 .driver = { 437 437 .name = DRV_MODULE_NAME, 438 438 },
+1 -1
drivers/scsi/mac_scsi.c
··· 547 547 * triggering a section mismatch warning. 548 548 */ 549 549 static struct platform_driver mac_scsi_driver __refdata = { 550 - .remove_new = __exit_p(mac_scsi_remove), 550 + .remove = __exit_p(mac_scsi_remove), 551 551 .driver = { 552 552 .name = DRV_MODULE_NAME, 553 553 },
+1 -1
drivers/scsi/mvme16x_scsi.c
··· 127 127 .name = "mvme16x-scsi", 128 128 }, 129 129 .probe = mvme16x_probe, 130 - .remove_new = mvme16x_device_remove, 130 + .remove = mvme16x_device_remove, 131 131 }; 132 132 133 133 static int __init mvme16x_scsi_init(void)
+5 -2
drivers/scsi/pm8001/pm8001_defs.h
··· 92 92 #define PM8001_MAX_MSIX_VEC 64 /* max msi-x int for spcv/ve */ 93 93 #define PM8001_RESERVE_SLOT 8 94 94 95 - #define CONFIG_SCSI_PM8001_MAX_DMA_SG 528 96 - #define PM8001_MAX_DMA_SG CONFIG_SCSI_PM8001_MAX_DMA_SG 95 + #define PM8001_SECTOR_SIZE 512 96 + #define PM8001_PAGE_SIZE_4K 4096 97 + #define PM8001_MAX_IO_SIZE (4 * 1024 * 1024) 98 + #define PM8001_MAX_DMA_SG (PM8001_MAX_IO_SIZE / PM8001_PAGE_SIZE_4K) 99 + #define PM8001_MAX_SECTORS (PM8001_MAX_IO_SIZE / PM8001_SECTOR_SIZE) 97 100 98 101 enum memory_region_num { 99 102 AAP1 = 0x0, /* application acceleration processor */
+5 -3
drivers/scsi/pm8001/pm8001_init.c
··· 68 68 module_param_named(read_wwn, pm8001_read_wwn, bool, 0444); 69 69 MODULE_PARM_DESC(zoned, "Get WWN from the controller. Default: true"); 70 70 71 + uint pcs_event_log_severity = 0x03; 72 + module_param(pcs_event_log_severity, int, 0644); 73 + MODULE_PARM_DESC(pcs_event_log_severity, "PCS event log severity level"); 74 + 71 75 static struct scsi_transport_template *pm8001_stt; 72 76 static int pm8001_init_ccb_tag(struct pm8001_hba_info *); 73 77 ··· 121 117 .scan_start = pm8001_scan_start, 122 118 .can_queue = 1, 123 119 .sg_tablesize = PM8001_MAX_DMA_SG, 120 + .max_sectors = PM8001_MAX_SECTORS, 124 121 .shost_groups = pm8001_host_groups, 125 122 .sdev_groups = pm8001_sdev_groups, 126 123 .track_queue_depth = 1, ··· 452 447 } 453 448 for (i = 0; i < PM8001_MAX_DEVICES; i++) { 454 449 pm8001_ha->devices[i].dev_type = SAS_PHY_UNUSED; 455 - pm8001_ha->devices[i].id = i; 456 - pm8001_ha->devices[i].device_id = PM8001_MAX_DEVICES; 457 - atomic_set(&pm8001_ha->devices[i].running_req, 0); 458 450 } 459 451 pm8001_ha->flags = PM8001F_INIT_TIME; 460 452 return 0;
+12 -5
drivers/scsi/pm8001/pm8001_sas.c
··· 572 572 pm8001_ccb_free(pm8001_ha, ccb); 573 573 } 574 574 575 + static void pm8001_init_dev(struct pm8001_device *pm8001_dev, int id) 576 + { 577 + pm8001_dev->id = id; 578 + pm8001_dev->device_id = PM8001_MAX_DEVICES; 579 + atomic_set(&pm8001_dev->running_req, 0); 580 + } 581 + 575 582 /** 576 583 * pm8001_alloc_dev - find a empty pm8001_device 577 584 * @pm8001_ha: our hba card information ··· 587 580 { 588 581 u32 dev; 589 582 for (dev = 0; dev < PM8001_MAX_DEVICES; dev++) { 590 - if (pm8001_ha->devices[dev].dev_type == SAS_PHY_UNUSED) { 591 - pm8001_ha->devices[dev].id = dev; 592 - return &pm8001_ha->devices[dev]; 583 + struct pm8001_device *pm8001_dev = &pm8001_ha->devices[dev]; 584 + 585 + if (pm8001_dev->dev_type == SAS_PHY_UNUSED) { 586 + pm8001_init_dev(pm8001_dev, dev); 587 + return pm8001_dev; 593 588 } 594 589 } 595 590 if (dev == PM8001_MAX_DEVICES) { ··· 622 613 623 614 void pm8001_free_dev(struct pm8001_device *pm8001_dev) 624 615 { 625 - u32 id = pm8001_dev->id; 626 616 memset(pm8001_dev, 0, sizeof(*pm8001_dev)); 627 - pm8001_dev->id = id; 628 617 pm8001_dev->dev_type = SAS_PHY_UNUSED; 629 618 pm8001_dev->device_id = PM8001_MAX_DEVICES; 630 619 pm8001_dev->sas_device = NULL;
+2
drivers/scsi/pm8001/pm8001_sas.h
··· 96 96 extern const struct pm8001_dispatch pm8001_8001_dispatch; 97 97 extern const struct pm8001_dispatch pm8001_80xx_dispatch; 98 98 99 + extern uint pcs_event_log_severity; 100 + 99 101 struct pm8001_hba_info; 100 102 struct pm8001_ccb_info; 101 103 struct pm8001_device;
+2 -1
drivers/scsi/pm8001/pm80xx_hwi.c
··· 763 763 pm8001_ha->memoryMap.region[IOP].phys_addr_lo; 764 764 pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_size = 765 765 PM8001_EVENT_LOG_SIZE; 766 - pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity = 0x01; 766 + pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity = 767 + pcs_event_log_severity; 767 768 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt = 0x01; 768 769 769 770 /* Enable higher IQs and OQs, 32 to 63, bit 16 */
+1 -5
drivers/scsi/qedf/qedf_main.c
··· 2738 2738 sb_id, QED_SB_TYPE_STORAGE); 2739 2739 2740 2740 if (ret) { 2741 + dma_free_coherent(&qedf->pdev->dev, sizeof(*sb_virt), sb_virt, sb_phys); 2741 2742 QEDF_ERR(&qedf->dbg_ctx, 2742 2743 "Status block initialization failed (0x%x) for id = %d.\n", 2743 2744 ret, sb_id); ··· 4018 4017 { 4019 4018 struct qedf_ctx *qedf = 4020 4019 container_of(work, struct qedf_ctx, stag_work.work); 4021 - 4022 - if (!qedf) { 4023 - QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL"); 4024 - return; 4025 - } 4026 4020 4027 4021 if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) { 4028 4022 QEDF_ERR(&qedf->dbg_ctx,
+1
drivers/scsi/qedi/qedi_main.c
··· 369 369 ret = qedi_ops->common->sb_init(qedi->cdev, sb_info, sb_virt, sb_phys, 370 370 sb_id, QED_SB_TYPE_STORAGE); 371 371 if (ret) { 372 + dma_free_coherent(&qedi->pdev->dev, sizeof(*sb_virt), sb_virt, sb_phys); 372 373 QEDI_ERR(&qedi->dbg_ctx, 373 374 "Status block initialization failed for id = %d.\n", 374 375 sb_id);
+1 -1
drivers/scsi/qlogicpti.c
··· 1463 1463 .of_match_table = qpti_match, 1464 1464 }, 1465 1465 .probe = qpti_sbus_probe, 1466 - .remove_new = qpti_sbus_remove, 1466 + .remove = qpti_sbus_remove, 1467 1467 }; 1468 1468 module_platform_driver(qpti_sbus_driver); 1469 1469
+1 -8
drivers/scsi/sg.c
··· 307 307 if (retval) 308 308 goto sg_put; 309 309 310 - retval = scsi_autopm_get_device(device); 311 - if (retval) 312 - goto sdp_put; 313 - 314 310 /* scsi_block_when_processing_errors() may block so bypass 315 311 * check if O_NONBLOCK. Permits SCSI commands to be issued 316 312 * during error recovery. Tread carefully. */ ··· 314 318 scsi_block_when_processing_errors(device))) { 315 319 retval = -ENXIO; 316 320 /* we are in error recovery for this device */ 317 - goto error_out; 321 + goto sdp_put; 318 322 } 319 323 320 324 mutex_lock(&sdp->open_rel_lock); ··· 367 371 } 368 372 error_mutex_locked: 369 373 mutex_unlock(&sdp->open_rel_lock); 370 - error_out: 371 - scsi_autopm_put_device(device); 372 374 sdp_put: 373 375 kref_put(&sdp->d_ref, sg_device_destroy); 374 376 scsi_device_put(device); ··· 386 392 SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, "sg_release\n")); 387 393 388 394 mutex_lock(&sdp->open_rel_lock); 389 - scsi_autopm_put_device(sdp->device); 390 395 kref_put(&sfp->f_ref, sg_remove_sfp); 391 396 sdp->open_cnt--; 392 397
+1 -1
drivers/scsi/sgiwd93.c
··· 306 306 307 307 static struct platform_driver sgiwd93_driver = { 308 308 .probe = sgiwd93_probe, 309 - .remove_new = sgiwd93_remove, 309 + .remove = sgiwd93_remove, 310 310 .driver = { 311 311 .name = "sgiwd93", 312 312 }
+1 -1
drivers/scsi/sni_53c710.c
··· 119 119 120 120 static struct platform_driver snirm710_driver = { 121 121 .probe = snirm710_probe, 122 - .remove_new = snirm710_driver_remove, 122 + .remove = snirm710_driver_remove, 123 123 .driver = { 124 124 .name = "snirm_53c710", 125 125 },
+26 -10
drivers/scsi/st.c
··· 991 991 scode = cmdstatp->sense_hdr.sense_key; 992 992 993 993 if (scode == UNIT_ATTENTION) { /* New media? */ 994 - new_session = 1; 994 + if (cmdstatp->sense_hdr.asc == 0x28) { /* New media */ 995 + new_session = 1; 996 + DEBC_printk(STp, "New tape session."); 997 + } 995 998 if (attentions < MAX_ATTENTIONS) { 996 999 attentions++; 997 1000 continue; ··· 3509 3506 int i, cmd_nr, cmd_type, bt; 3510 3507 int retval = 0; 3511 3508 unsigned int blk; 3509 + bool cmd_mtiocget; 3512 3510 struct scsi_tape *STp = file->private_data; 3513 3511 struct st_modedef *STm; 3514 3512 struct st_partstat *STps; ··· 3623 3619 */ 3624 3620 if (mtc.mt_op != MTREW && 3625 3621 mtc.mt_op != MTOFFL && 3622 + mtc.mt_op != MTLOAD && 3626 3623 mtc.mt_op != MTRETEN && 3627 3624 mtc.mt_op != MTERASE && 3628 3625 mtc.mt_op != MTSEEK && ··· 3737 3732 goto out; 3738 3733 } 3739 3734 3735 + cmd_mtiocget = cmd_type == _IOC_TYPE(MTIOCGET) && cmd_nr == _IOC_NR(MTIOCGET); 3736 + 3740 3737 if ((i = flush_buffer(STp, 0)) < 0) { 3741 - retval = i; 3742 - goto out; 3743 - } 3744 - if (STp->can_partitions && 3745 - (i = switch_partition(STp)) < 0) { 3746 - retval = i; 3747 - goto out; 3738 + if (cmd_mtiocget && STp->pos_unknown) { 3739 + /* flush fails -> modify status accordingly */ 3740 + reset_state(STp); 3741 + STp->pos_unknown = 1; 3742 + } else { /* return error */ 3743 + retval = i; 3744 + goto out; 3745 + } 3746 + } else { /* flush_buffer succeeds */ 3747 + if (STp->can_partitions) { 3748 + i = switch_partition(STp); 3749 + if (i < 0) { 3750 + retval = i; 3751 + goto out; 3752 + } 3753 + } 3748 3754 } 3749 3755 3750 - if (cmd_type == _IOC_TYPE(MTIOCGET) && cmd_nr == _IOC_NR(MTIOCGET)) { 3756 + if (cmd_mtiocget) { 3751 3757 struct mtget mt_status; 3752 3758 3753 3759 if (_IOC_SIZE(cmd_in) != sizeof(struct mtget)) { ··· 3772 3756 ((STp->density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK); 3773 3757 mt_status.mt_blkno = STps->drv_block; 3774 3758 mt_status.mt_fileno = STps->drv_file; 3775 - if (STp->block_size != 0) { 3759 + if (STp->block_size != 0 && mt_status.mt_blkno >= 0) { 3776 3760 if (STps->rw == ST_WRITING) 3777 3761 mt_status.mt_blkno += 3778 3762 (STp->buffer)->buffer_bytes / STp->block_size;
+8 -2
drivers/scsi/sun3_scsi.c
··· 656 656 iounmap(ioaddr); 657 657 } 658 658 659 - static struct platform_driver sun3_scsi_driver = { 660 - .remove_new = __exit_p(sun3_scsi_remove), 659 + /* 660 + * sun3_scsi_remove() lives in .exit.text. For drivers registered via 661 + * module_platform_driver_probe() this is ok because they cannot get unbound at 662 + * runtime. So mark the driver struct with __refdata to prevent modpost 663 + * triggering a section mismatch warning. 664 + */ 665 + static struct platform_driver sun3_scsi_driver __refdata = { 666 + .remove = __exit_p(sun3_scsi_remove), 661 667 .driver = { 662 668 .name = DRV_MODULE_NAME, 663 669 },
+1 -1
drivers/scsi/sun3x_esp.c
··· 265 265 266 266 static struct platform_driver esp_sun3x_driver = { 267 267 .probe = esp_sun3x_probe, 268 - .remove_new = esp_sun3x_remove, 268 + .remove = esp_sun3x_remove, 269 269 .driver = { 270 270 .name = "sun3x_esp", 271 271 },
+1 -1
drivers/scsi/sun_esp.c
··· 603 603 .of_match_table = esp_match, 604 604 }, 605 605 .probe = esp_sbus_probe, 606 - .remove_new = esp_sbus_remove, 606 + .remove = esp_sbus_remove, 607 607 }; 608 608 module_platform_driver(esp_sbus_driver); 609 609
+1 -1
drivers/target/target_core_pscsi.c
··· 369 369 bdev_file = bdev_file_open_by_path(dev->udev_path, 370 370 BLK_OPEN_WRITE | BLK_OPEN_READ, pdv, NULL); 371 371 if (IS_ERR(bdev_file)) { 372 - pr_err("pSCSI: bdev_open_by_path() failed\n"); 372 + pr_err("pSCSI: bdev_file_open_by_path() failed\n"); 373 373 scsi_device_put(sd); 374 374 return PTR_ERR(bdev_file); 375 375 }
+17 -13
drivers/ufs/core/ufs-mcq.c
··· 417 417 } 418 418 EXPORT_SYMBOL_GPL(ufshcd_mcq_make_queues_operational); 419 419 420 - void ufshcd_mcq_enable_esi(struct ufs_hba *hba) 421 - { 422 - ufshcd_writel(hba, ufshcd_readl(hba, REG_UFS_MEM_CFG) | 0x2, 423 - REG_UFS_MEM_CFG); 424 - } 425 - EXPORT_SYMBOL_GPL(ufshcd_mcq_enable_esi); 426 - 427 420 void ufshcd_mcq_enable(struct ufs_hba *hba) 428 421 { 429 422 ufshcd_rmwl(hba, MCQ_MODE_SELECT, MCQ_MODE_SELECT, REG_UFS_MEM_CFG); ··· 429 436 ufshcd_rmwl(hba, MCQ_MODE_SELECT, 0, REG_UFS_MEM_CFG); 430 437 hba->mcq_enabled = false; 431 438 } 439 + 440 + void ufshcd_mcq_enable_esi(struct ufs_hba *hba) 441 + { 442 + ufshcd_writel(hba, ufshcd_readl(hba, REG_UFS_MEM_CFG) | 0x2, 443 + REG_UFS_MEM_CFG); 444 + } 445 + EXPORT_SYMBOL_GPL(ufshcd_mcq_enable_esi); 432 446 433 447 void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg) 434 448 { ··· 539 539 struct scsi_cmnd *cmd = lrbp->cmd; 540 540 struct ufs_hw_queue *hwq; 541 541 void __iomem *reg, *opr_sqd_base; 542 - u32 nexus, id, val, rtc; 542 + u32 nexus, id, val; 543 543 int err; 544 544 545 545 if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC) ··· 573 573 writel(readl(opr_sqd_base + REG_SQRTC) | SQ_ICU, 574 574 opr_sqd_base + REG_SQRTC); 575 575 576 - /* Poll SQRTSy.CUS = 1. Return result from SQRTSy.RTC */ 576 + /* Wait until SQRTSy.CUS = 1. Report SQRTSy.RTC. */ 577 577 reg = opr_sqd_base + REG_SQRTS; 578 578 err = read_poll_timeout(readl, val, val & SQ_CUS, 20, 579 579 MCQ_POLL_US, false, reg); 580 - rtc = FIELD_GET(SQ_ICU_ERR_CODE_MASK, readl(reg)); 581 - if (err || rtc) 582 - dev_err(hba->dev, "%s: failed. hwq=%d, tag=%d err=%d RTC=%d\n", 583 - __func__, id, task_tag, err, rtc); 580 + if (err) 581 + dev_err(hba->dev, "%s: failed. hwq=%d, tag=%d err=%d\n", 582 + __func__, id, task_tag, err); 583 + else 584 + dev_info(hba->dev, 585 + "%s, hwq %d: cleanup return code (RTC) %ld\n", 586 + __func__, id, 587 + FIELD_GET(SQ_ICU_ERR_CODE_MASK, readl(reg))); 584 588 585 589 if (ufshcd_mcq_sq_start(hba, hwq)) 586 590 err = -ETIMEDOUT;
+302 -269
drivers/ufs/core/ufshcd.c
··· 298 298 static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd); 299 299 static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag); 300 300 static void ufshcd_hba_exit(struct ufs_hba *hba); 301 + static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params); 301 302 static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params); 302 303 static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on); 303 304 static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba); ··· 348 347 349 348 if (ufshcd_is_wb_buf_flush_allowed(hba)) 350 349 ufshcd_wb_toggle_buf_flush(hba, true); 351 - } 352 - 353 - static void ufshcd_scsi_unblock_requests(struct ufs_hba *hba) 354 - { 355 - if (atomic_dec_and_test(&hba->scsi_block_reqs_cnt)) 356 - scsi_unblock_requests(hba->host); 357 - } 358 - 359 - static void ufshcd_scsi_block_requests(struct ufs_hba *hba) 360 - { 361 - if (atomic_inc_return(&hba->scsi_block_reqs_cnt) == 1) 362 - scsi_block_requests(hba->host); 363 350 } 364 351 365 352 static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag, ··· 728 739 * Return: -ETIMEDOUT on error, zero on success. 729 740 */ 730 741 static int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask, 731 - u32 val, unsigned long interval_us, 732 - unsigned long timeout_ms) 742 + u32 val, unsigned long interval_us, 743 + unsigned long timeout_ms) 733 744 { 734 - int err = 0; 735 - unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); 745 + u32 v; 736 746 737 - /* ignore bits that we don't intend to wait on */ 738 - val = val & mask; 747 + val &= mask; /* ignore bits that we don't intend to wait on */ 739 748 740 - while ((ufshcd_readl(hba, reg) & mask) != val) { 741 - usleep_range(interval_us, interval_us + 50); 742 - if (time_after(jiffies, timeout)) { 743 - if ((ufshcd_readl(hba, reg) & mask) != val) 744 - err = -ETIMEDOUT; 745 - break; 746 - } 747 - } 748 - 749 - return err; 749 + return read_poll_timeout(ufshcd_readl, v, (v & mask) == val, 750 + interval_us, timeout_ms * 1000, false, hba, reg); 750 751 } 751 752 752 753 /** ··· 1234 1255 static u32 ufshcd_pending_cmds(struct ufs_hba *hba) 1235 1256 { 1236 1257 const struct scsi_device *sdev; 1258 + unsigned long flags; 1237 1259 u32 pending = 0; 1238 1260 1239 - lockdep_assert_held(hba->host->host_lock); 1261 + spin_lock_irqsave(hba->host->host_lock, flags); 1240 1262 __shost_for_each_device(sdev, hba->host) 1241 1263 pending += sbitmap_weight(&sdev->budget_map); 1264 + spin_unlock_irqrestore(hba->host->host_lock, flags); 1242 1265 1243 1266 return pending; 1244 1267 } ··· 1254 1273 static int ufshcd_wait_for_doorbell_clr(struct ufs_hba *hba, 1255 1274 u64 wait_timeout_us) 1256 1275 { 1257 - unsigned long flags; 1258 1276 int ret = 0; 1259 1277 u32 tm_doorbell; 1260 1278 u32 tr_pending; ··· 1261 1281 ktime_t start; 1262 1282 1263 1283 ufshcd_hold(hba); 1264 - spin_lock_irqsave(hba->host->host_lock, flags); 1265 1284 /* 1266 1285 * Wait for all the outstanding tasks/transfer requests. 1267 1286 * Verify by checking the doorbell registers are clear. ··· 1281 1302 break; 1282 1303 } 1283 1304 1284 - spin_unlock_irqrestore(hba->host->host_lock, flags); 1285 1305 io_schedule_timeout(msecs_to_jiffies(20)); 1286 1306 if (ktime_to_us(ktime_sub(ktime_get(), start)) > 1287 1307 wait_timeout_us) { ··· 1292 1314 */ 1293 1315 do_last_check = true; 1294 1316 } 1295 - spin_lock_irqsave(hba->host->host_lock, flags); 1296 1317 } while (tm_doorbell || tr_pending); 1297 1318 1298 1319 if (timeout) { ··· 1301 1324 ret = -EBUSY; 1302 1325 } 1303 1326 out: 1304 - spin_unlock_irqrestore(hba->host->host_lock, flags); 1305 1327 ufshcd_release(hba); 1306 1328 return ret; 1307 1329 } ··· 2387 2411 int err; 2388 2412 2389 2413 hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); 2390 - if (hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS) 2391 - hba->capabilities &= ~MASK_64_ADDRESSING_SUPPORT; 2392 2414 2393 2415 /* nutrs and nutmrs are 0 based values */ 2394 2416 hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS_SDB) + 1; ··· 2525 2551 * __ufshcd_send_uic_cmd - Send UIC commands and retrieve the result 2526 2552 * @hba: per adapter instance 2527 2553 * @uic_cmd: UIC command 2528 - * @completion: initialize the completion only if this is set to true 2529 2554 * 2530 2555 * Return: 0 only if success. 2531 2556 */ 2532 2557 static int 2533 - __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, 2534 - bool completion) 2558 + __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) 2535 2559 { 2536 2560 lockdep_assert_held(&hba->uic_cmd_mutex); 2537 2561 ··· 2539 2567 return -EIO; 2540 2568 } 2541 2569 2542 - if (completion) 2543 - init_completion(&uic_cmd->done); 2570 + init_completion(&uic_cmd->done); 2544 2571 2545 2572 uic_cmd->cmd_active = 1; 2546 2573 ufshcd_dispatch_uic_cmd(hba, uic_cmd); ··· 2565 2594 mutex_lock(&hba->uic_cmd_mutex); 2566 2595 ufshcd_add_delay_before_dme_cmd(hba); 2567 2596 2568 - ret = __ufshcd_send_uic_cmd(hba, uic_cmd, true); 2597 + ret = __ufshcd_send_uic_cmd(hba, uic_cmd); 2569 2598 if (!ret) 2570 2599 ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd); 2571 2600 ··· 2746 2775 ucd_req_ptr->sc.exp_data_transfer_len = cpu_to_be32(cmd->sdb.length); 2747 2776 2748 2777 cdb_len = min_t(unsigned short, cmd->cmd_len, UFS_CDB_SIZE); 2749 - memset(ucd_req_ptr->sc.cdb, 0, UFS_CDB_SIZE); 2750 2778 memcpy(ucd_req_ptr->sc.cdb, cmd->cmnd, cdb_len); 2751 2779 2752 2780 memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); ··· 2846 2876 if (ioprio_class == IOPRIO_CLASS_RT) 2847 2877 upiu_flags |= UPIU_CMD_FLAGS_CP; 2848 2878 ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags); 2879 + } 2880 + 2881 + static void __ufshcd_setup_cmd(struct ufshcd_lrb *lrbp, struct scsi_cmnd *cmd, u8 lun, int tag) 2882 + { 2883 + memset(lrbp->ucd_req_ptr, 0, sizeof(*lrbp->ucd_req_ptr)); 2884 + 2885 + lrbp->cmd = cmd; 2886 + lrbp->task_tag = tag; 2887 + lrbp->lun = lun; 2888 + ufshcd_prepare_lrbp_crypto(cmd ? scsi_cmd_to_rq(cmd) : NULL, lrbp); 2889 + } 2890 + 2891 + static void ufshcd_setup_scsi_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, 2892 + struct scsi_cmnd *cmd, u8 lun, int tag) 2893 + { 2894 + __ufshcd_setup_cmd(lrbp, cmd, lun, tag); 2895 + lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba); 2896 + lrbp->req_abort_skip = false; 2897 + 2898 + ufshcd_comp_scsi_upiu(hba, lrbp); 2849 2899 } 2850 2900 2851 2901 /** ··· 3000 3010 ufshcd_hold(hba); 3001 3011 3002 3012 lrbp = &hba->lrb[tag]; 3003 - lrbp->cmd = cmd; 3004 - lrbp->task_tag = tag; 3005 - lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); 3006 - lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba); 3007 3013 3008 - ufshcd_prepare_lrbp_crypto(scsi_cmd_to_rq(cmd), lrbp); 3009 - 3010 - lrbp->req_abort_skip = false; 3011 - 3012 - ufshcd_comp_scsi_upiu(hba, lrbp); 3014 + ufshcd_setup_scsi_cmd(hba, lrbp, cmd, ufshcd_scsi_to_upiu_lun(cmd->device->lun), tag); 3013 3015 3014 3016 err = ufshcd_map_sg(hba, lrbp); 3015 3017 if (err) { ··· 3029 3047 static void ufshcd_setup_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, 3030 3048 enum dev_cmd_type cmd_type, u8 lun, int tag) 3031 3049 { 3032 - lrbp->cmd = NULL; 3033 - lrbp->task_tag = tag; 3034 - lrbp->lun = lun; 3050 + __ufshcd_setup_cmd(lrbp, NULL, lun, tag); 3035 3051 lrbp->intr_cmd = true; /* No interrupt aggregation */ 3036 - ufshcd_prepare_lrbp_crypto(NULL, lrbp); 3037 3052 hba->dev_cmd.type = cmd_type; 3038 3053 } 3039 3054 ··· 3062 3083 static int ufshcd_clear_cmd(struct ufs_hba *hba, u32 task_tag) 3063 3084 { 3064 3085 u32 mask; 3065 - unsigned long flags; 3066 3086 int err; 3067 3087 3068 3088 if (hba->mcq_enabled) { ··· 3081 3103 mask = 1U << task_tag; 3082 3104 3083 3105 /* clear outstanding transaction before retry */ 3084 - spin_lock_irqsave(hba->host->host_lock, flags); 3085 3106 ufshcd_utrl_clear(hba, mask); 3086 - spin_unlock_irqrestore(hba->host->host_lock, flags); 3087 3107 3088 3108 /* 3089 3109 * wait for h/w to clear corresponding bit in door-bell. ··· 4264 4288 reenable_intr = true; 4265 4289 } 4266 4290 spin_unlock_irqrestore(hba->host->host_lock, flags); 4267 - ret = __ufshcd_send_uic_cmd(hba, cmd, false); 4291 + ret = __ufshcd_send_uic_cmd(hba, cmd); 4268 4292 if (ret) { 4269 4293 dev_err(hba->dev, 4270 4294 "pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n", ··· 4510 4534 if (!pwr_info->lane_rx || !pwr_info->lane_tx) { 4511 4535 dev_err(hba->dev, "%s: invalid connected lanes value. rx=%d, tx=%d\n", 4512 4536 __func__, 4537 + pwr_info->lane_rx, 4538 + pwr_info->lane_tx); 4539 + return -EINVAL; 4540 + } 4541 + 4542 + if (pwr_info->lane_rx != pwr_info->lane_tx) { 4543 + dev_err(hba->dev, "%s: asymmetric connected lanes. rx=%d, tx=%d\n", 4544 + __func__, 4513 4545 pwr_info->lane_rx, 4514 4546 pwr_info->lane_tx); 4515 4547 return -EINVAL; ··· 4806 4822 */ 4807 4823 static int ufshcd_hba_execute_hce(struct ufs_hba *hba) 4808 4824 { 4809 - int retry_outer = 3; 4810 - int retry_inner; 4825 + int retry; 4811 4826 4812 - start: 4813 - if (ufshcd_is_hba_active(hba)) 4814 - /* change controller state to "reset state" */ 4815 - ufshcd_hba_stop(hba); 4827 + for (retry = 3; retry > 0; retry--) { 4828 + if (ufshcd_is_hba_active(hba)) 4829 + /* change controller state to "reset state" */ 4830 + ufshcd_hba_stop(hba); 4816 4831 4817 - /* UniPro link is disabled at this point */ 4818 - ufshcd_set_link_off(hba); 4832 + /* UniPro link is disabled at this point */ 4833 + ufshcd_set_link_off(hba); 4819 4834 4820 - ufshcd_vops_hce_enable_notify(hba, PRE_CHANGE); 4835 + ufshcd_vops_hce_enable_notify(hba, PRE_CHANGE); 4821 4836 4822 - /* start controller initialization sequence */ 4823 - ufshcd_hba_start(hba); 4837 + /* start controller initialization sequence */ 4838 + ufshcd_hba_start(hba); 4824 4839 4825 - /* 4826 - * To initialize a UFS host controller HCE bit must be set to 1. 4827 - * During initialization the HCE bit value changes from 1->0->1. 4828 - * When the host controller completes initialization sequence 4829 - * it sets the value of HCE bit to 1. The same HCE bit is read back 4830 - * to check if the controller has completed initialization sequence. 4831 - * So without this delay the value HCE = 1, set in the previous 4832 - * instruction might be read back. 4833 - * This delay can be changed based on the controller. 4834 - */ 4835 - ufshcd_delay_us(hba->vps->hba_enable_delay_us, 100); 4840 + /* 4841 + * To initialize a UFS host controller HCE bit must be set to 1. 4842 + * During initialization the HCE bit value changes from 1->0->1. 4843 + * When the host controller completes initialization sequence 4844 + * it sets the value of HCE bit to 1. The same HCE bit is read back 4845 + * to check if the controller has completed initialization sequence. 4846 + * So without this delay the value HCE = 1, set in the previous 4847 + * instruction might be read back. 4848 + * This delay can be changed based on the controller. 4849 + */ 4850 + ufshcd_delay_us(hba->vps->hba_enable_delay_us, 100); 4836 4851 4837 - /* wait for the host controller to complete initialization */ 4838 - retry_inner = 50; 4839 - while (!ufshcd_is_hba_active(hba)) { 4840 - if (retry_inner) { 4841 - retry_inner--; 4842 - } else { 4843 - dev_err(hba->dev, 4844 - "Controller enable failed\n"); 4845 - if (retry_outer) { 4846 - retry_outer--; 4847 - goto start; 4848 - } 4849 - return -EIO; 4850 - } 4851 - usleep_range(1000, 1100); 4852 + /* wait for the host controller to complete initialization */ 4853 + if (!ufshcd_wait_for_register(hba, REG_CONTROLLER_ENABLE, CONTROLLER_ENABLE, 4854 + CONTROLLER_ENABLE, 1000, 50)) 4855 + break; 4856 + 4857 + dev_err(hba->dev, "Enabling the controller failed\n"); 4852 4858 } 4859 + 4860 + if (!retry) 4861 + return -EIO; 4853 4862 4854 4863 /* enable UIC related interrupts */ 4855 4864 ufshcd_enable_intr(hba, UFSHCD_UIC_MASK); ··· 5235 5258 */ 5236 5259 sdev->silence_suspend = 1; 5237 5260 5261 + if (hba->vops && hba->vops->config_scsi_dev) 5262 + hba->vops->config_scsi_dev(sdev); 5263 + 5238 5264 ufshcd_crypto_register(hba, q); 5239 5265 5240 5266 return 0; ··· 5458 5478 static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status) 5459 5479 { 5460 5480 irqreturn_t retval = IRQ_NONE; 5481 + struct uic_command *cmd; 5461 5482 5462 5483 spin_lock(hba->host->host_lock); 5484 + cmd = hba->active_uic_cmd; 5485 + if (WARN_ON_ONCE(!cmd)) 5486 + goto unlock; 5487 + 5463 5488 if (ufshcd_is_auto_hibern8_error(hba, intr_status)) 5464 5489 hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status); 5465 5490 5466 - if ((intr_status & UIC_COMMAND_COMPL) && hba->active_uic_cmd) { 5467 - hba->active_uic_cmd->argument2 |= 5468 - ufshcd_get_uic_cmd_result(hba); 5469 - hba->active_uic_cmd->argument3 = 5470 - ufshcd_get_dme_attr_val(hba); 5491 + if (intr_status & UIC_COMMAND_COMPL) { 5492 + cmd->argument2 |= ufshcd_get_uic_cmd_result(hba); 5493 + cmd->argument3 = ufshcd_get_dme_attr_val(hba); 5471 5494 if (!hba->uic_async_done) 5472 - hba->active_uic_cmd->cmd_active = 0; 5473 - complete(&hba->active_uic_cmd->done); 5495 + cmd->cmd_active = 0; 5496 + complete(&cmd->done); 5474 5497 retval = IRQ_HANDLED; 5475 5498 } 5476 5499 5477 - if ((intr_status & UFSHCD_UIC_PWR_MASK) && hba->uic_async_done) { 5478 - hba->active_uic_cmd->cmd_active = 0; 5500 + if (intr_status & UFSHCD_UIC_PWR_MASK && hba->uic_async_done) { 5501 + cmd->cmd_active = 0; 5479 5502 complete(hba->uic_async_done); 5480 5503 retval = IRQ_HANDLED; 5481 5504 } 5482 5505 5483 5506 if (retval == IRQ_HANDLED) 5484 - ufshcd_add_uic_command_trace(hba, hba->active_uic_cmd, 5485 - UFS_CMD_COMP); 5507 + ufshcd_add_uic_command_trace(hba, cmd, UFS_CMD_COMP); 5508 + 5509 + unlock: 5486 5510 spin_unlock(hba->host->host_lock); 5511 + 5487 5512 return retval; 5488 5513 } 5489 5514 ··· 6181 6196 u32 status = 0; 6182 6197 hba = container_of(work, struct ufs_hba, eeh_work); 6183 6198 6184 - ufshcd_scsi_block_requests(hba); 6185 6199 err = ufshcd_get_ee_status(hba, &status); 6186 6200 if (err) { 6187 6201 dev_err(hba->dev, "%s: failed to get exception status %d\n", 6188 6202 __func__, err); 6189 - goto out; 6203 + return; 6190 6204 } 6191 6205 6192 6206 trace_ufshcd_exception_event(dev_name(hba->dev), status); ··· 6197 6213 ufshcd_temp_exception_event_handler(hba, status); 6198 6214 6199 6215 ufs_debugfs_exception_event(hba, status); 6200 - out: 6201 - ufshcd_scsi_unblock_requests(hba); 6202 6216 } 6203 6217 6204 6218 /* Complete requests that have door-bell cleared */ ··· 6362 6380 ufshcd_suspend_clkscaling(hba); 6363 6381 ufshcd_clk_scaling_allow(hba, false); 6364 6382 } 6365 - ufshcd_scsi_block_requests(hba); 6366 6383 /* Wait for ongoing ufshcd_queuecommand() calls to finish. */ 6367 - blk_mq_wait_quiesce_done(&hba->host->tag_set); 6384 + blk_mq_quiesce_tagset(&hba->host->tag_set); 6368 6385 cancel_work_sync(&hba->eeh_work); 6369 6386 } 6370 6387 6371 6388 static void ufshcd_err_handling_unprepare(struct ufs_hba *hba) 6372 6389 { 6373 - ufshcd_scsi_unblock_requests(hba); 6390 + blk_mq_unquiesce_tagset(&hba->host->tag_set); 6374 6391 ufshcd_release(hba); 6375 6392 if (ufshcd_is_clkscaling_supported(hba)) 6376 6393 ufshcd_clk_scaling_suspend(hba, false); ··· 6983 7002 { 6984 7003 int err = 0; 6985 7004 u32 mask = 1 << tag; 6986 - unsigned long flags; 6987 7005 6988 7006 if (!test_bit(tag, &hba->outstanding_tasks)) 6989 7007 goto out; 6990 7008 6991 - spin_lock_irqsave(hba->host->host_lock, flags); 6992 7009 ufshcd_utmrl_clear(hba, tag); 6993 - spin_unlock_irqrestore(hba->host->host_lock, flags); 6994 7010 6995 7011 /* poll for max. 1 sec to clear door bell register by h/w */ 6996 7012 err = ufshcd_wait_for_register(hba, ··· 7030 7052 memcpy(hba->utmrdl_base_addr + task_tag, treq, sizeof(*treq)); 7031 7053 ufshcd_vops_setup_task_mgmt(hba, task_tag, tm_function); 7032 7054 7033 - /* send command to the controller */ 7034 7055 __set_bit(task_tag, &hba->outstanding_tasks); 7035 - ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); 7036 7056 7037 7057 spin_unlock_irqrestore(host->host_lock, flags); 7058 + 7059 + /* send command to the controller */ 7060 + ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); 7038 7061 7039 7062 ufshcd_add_tm_upiu_trace(hba, task_tag, UFS_TM_SEND); 7040 7063 ··· 7452 7473 int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) 7453 7474 { 7454 7475 struct ufshcd_lrb *lrbp = &hba->lrb[tag]; 7455 - int err = 0; 7476 + int err; 7456 7477 int poll_cnt; 7457 7478 u8 resp = 0xF; 7458 - u32 reg; 7459 7479 7460 7480 for (poll_cnt = 100; poll_cnt; poll_cnt--) { 7461 7481 err = ufshcd_issue_tm_cmd(hba, lrbp->lun, lrbp->task_tag, ··· 7469 7491 * cmd not pending in the device, check if it is 7470 7492 * in transition. 7471 7493 */ 7472 - dev_err(hba->dev, "%s: cmd at tag %d not pending in the device.\n", 7494 + dev_info( 7495 + hba->dev, 7496 + "%s: cmd with tag %d not pending in the device.\n", 7473 7497 __func__, tag); 7474 - if (hba->mcq_enabled) { 7475 - /* MCQ mode */ 7476 - if (ufshcd_cmd_inflight(lrbp->cmd)) { 7477 - /* sleep for max. 200us same delay as in SDB mode */ 7478 - usleep_range(100, 200); 7479 - continue; 7480 - } 7481 - /* command completed already */ 7482 - dev_err(hba->dev, "%s: cmd at tag=%d is cleared.\n", 7483 - __func__, tag); 7484 - goto out; 7498 + if (!ufshcd_cmd_inflight(lrbp->cmd)) { 7499 + dev_info(hba->dev, 7500 + "%s: cmd with tag=%d completed.\n", 7501 + __func__, tag); 7502 + return 0; 7485 7503 } 7486 - 7487 - /* Single Doorbell Mode */ 7488 - reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); 7489 - if (reg & (1 << tag)) { 7490 - /* sleep for max. 200us to stabilize */ 7491 - usleep_range(100, 200); 7492 - continue; 7493 - } 7494 - /* command completed already */ 7495 - dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n", 7496 - __func__, tag); 7497 - goto out; 7504 + usleep_range(100, 200); 7498 7505 } else { 7499 7506 dev_err(hba->dev, 7500 7507 "%s: no response from device. tag = %d, err %d\n", 7501 7508 __func__, tag, err); 7502 - if (!err) 7503 - err = resp; /* service response error */ 7504 - goto out; 7509 + return err ? : resp; 7505 7510 } 7506 7511 } 7507 7512 7508 - if (!poll_cnt) { 7509 - err = -EBUSY; 7510 - goto out; 7511 - } 7513 + if (!poll_cnt) 7514 + return -EBUSY; 7512 7515 7513 7516 err = ufshcd_issue_tm_cmd(hba, lrbp->lun, lrbp->task_tag, 7514 7517 UFS_ABORT_TASK, &resp); ··· 7499 7540 dev_err(hba->dev, "%s: issued. tag = %d, err %d\n", 7500 7541 __func__, tag, err); 7501 7542 } 7502 - goto out; 7543 + return err; 7503 7544 } 7504 7545 7505 7546 err = ufshcd_clear_cmd(hba, tag); ··· 7507 7548 dev_err(hba->dev, "%s: Failed clearing cmd at tag %d, err %d\n", 7508 7549 __func__, tag, err); 7509 7550 7510 - out: 7511 7551 return err; 7512 7552 } 7513 7553 ··· 7630 7672 } 7631 7673 7632 7674 /** 7675 + * ufshcd_process_probe_result - Process the ufshcd_probe_hba() result. 7676 + * @hba: UFS host controller instance. 7677 + * @probe_start: time when the ufshcd_probe_hba() call started. 7678 + * @ret: ufshcd_probe_hba() return value. 7679 + */ 7680 + static void ufshcd_process_probe_result(struct ufs_hba *hba, 7681 + ktime_t probe_start, int ret) 7682 + { 7683 + unsigned long flags; 7684 + 7685 + spin_lock_irqsave(hba->host->host_lock, flags); 7686 + if (ret) 7687 + hba->ufshcd_state = UFSHCD_STATE_ERROR; 7688 + else if (hba->ufshcd_state == UFSHCD_STATE_RESET) 7689 + hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL; 7690 + spin_unlock_irqrestore(hba->host->host_lock, flags); 7691 + 7692 + trace_ufshcd_init(dev_name(hba->dev), ret, 7693 + ktime_to_us(ktime_sub(ktime_get(), probe_start)), 7694 + hba->curr_dev_pwr_mode, hba->uic_link_state); 7695 + } 7696 + 7697 + /** 7633 7698 * ufshcd_host_reset_and_restore - reset and restore host controller 7634 7699 * @hba: per-adapter instance 7635 7700 * ··· 7681 7700 err = ufshcd_hba_enable(hba); 7682 7701 7683 7702 /* Establish the link again and restore the device */ 7684 - if (!err) 7685 - err = ufshcd_probe_hba(hba, false); 7703 + if (!err) { 7704 + ktime_t probe_start = ktime_get(); 7705 + 7706 + err = ufshcd_device_init(hba, /*init_dev_params=*/false); 7707 + if (!err) 7708 + err = ufshcd_probe_hba(hba, false); 7709 + ufshcd_process_probe_result(hba, probe_start, err); 7710 + } 7686 7711 7687 7712 if (err) 7688 7713 dev_err(hba->dev, "%s: Host init failed %d\n", __func__, err); ··· 8714 8727 hba->nutrs); 8715 8728 } 8716 8729 8730 + static int ufshcd_post_device_init(struct ufs_hba *hba) 8731 + { 8732 + int ret; 8733 + 8734 + ufshcd_tune_unipro_params(hba); 8735 + 8736 + /* UFS device is also active now */ 8737 + ufshcd_set_ufs_dev_active(hba); 8738 + ufshcd_force_reset_auto_bkops(hba); 8739 + 8740 + ufshcd_set_timestamp_attr(hba); 8741 + 8742 + if (!hba->max_pwr_info.is_valid) 8743 + return 0; 8744 + 8745 + /* 8746 + * Set the right value to bRefClkFreq before attempting to 8747 + * switch to HS gears. 8748 + */ 8749 + if (hba->dev_ref_clk_freq != REF_CLK_FREQ_INVAL) 8750 + ufshcd_set_dev_ref_clk(hba); 8751 + /* Gear up to HS gear. */ 8752 + ret = ufshcd_config_pwr_mode(hba, &hba->max_pwr_info.info); 8753 + if (ret) { 8754 + dev_err(hba->dev, "%s: Failed setting power mode, err = %d\n", 8755 + __func__, ret); 8756 + return ret; 8757 + } 8758 + 8759 + return 0; 8760 + } 8761 + 8717 8762 static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params) 8718 8763 { 8719 8764 int ret; 8720 - struct Scsi_Host *host = hba->host; 8765 + 8766 + WARN_ON_ONCE(!hba->scsi_host_added); 8721 8767 8722 8768 hba->ufshcd_state = UFSHCD_STATE_RESET; 8723 8769 ··· 8791 8771 ret = ufshcd_device_params_init(hba); 8792 8772 if (ret) 8793 8773 return ret; 8794 - if (is_mcq_supported(hba) && !hba->scsi_host_added) { 8795 - ufshcd_mcq_enable(hba); 8796 - ret = ufshcd_alloc_mcq(hba); 8797 - if (!ret) { 8798 - ufshcd_config_mcq(hba); 8799 - } else { 8800 - /* Continue with SDB mode */ 8801 - ufshcd_mcq_disable(hba); 8802 - use_mcq_mode = false; 8803 - dev_err(hba->dev, "MCQ mode is disabled, err=%d\n", 8804 - ret); 8805 - } 8806 - ret = scsi_add_host(host, hba->dev); 8807 - if (ret) { 8808 - dev_err(hba->dev, "scsi_add_host failed\n"); 8809 - return ret; 8810 - } 8811 - hba->scsi_host_added = true; 8812 - } else if (is_mcq_supported(hba)) { 8813 - /* UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH is set */ 8774 + if (is_mcq_supported(hba) && 8775 + hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH) { 8814 8776 ufshcd_config_mcq(hba); 8815 8777 ufshcd_mcq_enable(hba); 8816 8778 } 8817 8779 } 8818 8780 8819 - ufshcd_tune_unipro_params(hba); 8820 - 8821 - /* UFS device is also active now */ 8822 - ufshcd_set_ufs_dev_active(hba); 8823 - ufshcd_force_reset_auto_bkops(hba); 8824 - 8825 - ufshcd_set_timestamp_attr(hba); 8826 - 8827 - /* Gear up to HS gear if supported */ 8828 - if (hba->max_pwr_info.is_valid) { 8829 - /* 8830 - * Set the right value to bRefClkFreq before attempting to 8831 - * switch to HS gears. 8832 - */ 8833 - if (hba->dev_ref_clk_freq != REF_CLK_FREQ_INVAL) 8834 - ufshcd_set_dev_ref_clk(hba); 8835 - ret = ufshcd_config_pwr_mode(hba, &hba->max_pwr_info.info); 8836 - if (ret) { 8837 - dev_err(hba->dev, "%s: Failed setting power mode, err = %d\n", 8838 - __func__, ret); 8839 - return ret; 8840 - } 8841 - } 8842 - 8843 - return 0; 8781 + return ufshcd_post_device_init(hba); 8844 8782 } 8845 8783 8846 8784 /** ··· 8812 8834 */ 8813 8835 static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params) 8814 8836 { 8815 - ktime_t start = ktime_get(); 8816 - unsigned long flags; 8817 8837 int ret; 8818 - 8819 - ret = ufshcd_device_init(hba, init_dev_params); 8820 - if (ret) 8821 - goto out; 8822 8838 8823 8839 if (!hba->pm_op_in_progress && 8824 8840 (hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH)) { ··· 8826 8854 dev_err(hba->dev, "Host controller enable failed\n"); 8827 8855 ufshcd_print_evt_hist(hba); 8828 8856 ufshcd_print_host_state(hba); 8829 - goto out; 8857 + return ret; 8830 8858 } 8831 8859 8832 8860 /* Reinit the device */ 8833 8861 ret = ufshcd_device_init(hba, init_dev_params); 8834 8862 if (ret) 8835 - goto out; 8863 + return ret; 8836 8864 } 8837 8865 8838 8866 ufshcd_print_pwr_info(hba); ··· 8852 8880 ufshcd_write_ee_control(hba); 8853 8881 ufshcd_configure_auto_hibern8(hba); 8854 8882 8855 - out: 8856 - spin_lock_irqsave(hba->host->host_lock, flags); 8857 - if (ret) 8858 - hba->ufshcd_state = UFSHCD_STATE_ERROR; 8859 - else if (hba->ufshcd_state == UFSHCD_STATE_RESET) 8860 - hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL; 8861 - spin_unlock_irqrestore(hba->host->host_lock, flags); 8862 - 8863 - trace_ufshcd_init(dev_name(hba->dev), ret, 8864 - ktime_to_us(ktime_sub(ktime_get(), start)), 8865 - hba->curr_dev_pwr_mode, hba->uic_link_state); 8866 - return ret; 8883 + return 0; 8867 8884 } 8868 8885 8869 8886 /** ··· 8863 8902 static void ufshcd_async_scan(void *data, async_cookie_t cookie) 8864 8903 { 8865 8904 struct ufs_hba *hba = (struct ufs_hba *)data; 8905 + ktime_t probe_start; 8866 8906 int ret; 8867 8907 8868 8908 down(&hba->host_sem); 8869 8909 /* Initialize hba, detect and initialize UFS device */ 8910 + probe_start = ktime_get(); 8870 8911 ret = ufshcd_probe_hba(hba, true); 8912 + ufshcd_process_probe_result(hba, probe_start, ret); 8871 8913 up(&hba->host_sem); 8872 8914 if (ret) 8873 8915 goto out; ··· 10273 10309 */ 10274 10310 static int ufshcd_set_dma_mask(struct ufs_hba *hba) 10275 10311 { 10312 + if (hba->vops && hba->vops->set_dma_mask) 10313 + return hba->vops->set_dma_mask(hba); 10276 10314 if (hba->capabilities & MASK_64_ADDRESSING_SUPPORT) { 10277 10315 if (!dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(64))) 10278 10316 return 0; ··· 10337 10371 static const struct blk_mq_ops ufshcd_tmf_ops = { 10338 10372 .queue_rq = ufshcd_queue_tmf, 10339 10373 }; 10374 + 10375 + static int ufshcd_add_scsi_host(struct ufs_hba *hba) 10376 + { 10377 + int err; 10378 + 10379 + if (is_mcq_supported(hba)) { 10380 + ufshcd_mcq_enable(hba); 10381 + err = ufshcd_alloc_mcq(hba); 10382 + if (!err) { 10383 + ufshcd_config_mcq(hba); 10384 + } else { 10385 + /* Continue with SDB mode */ 10386 + ufshcd_mcq_disable(hba); 10387 + use_mcq_mode = false; 10388 + dev_err(hba->dev, "MCQ mode is disabled, err=%d\n", 10389 + err); 10390 + } 10391 + } 10392 + if (!is_mcq_supported(hba) && !hba->lsdb_sup) { 10393 + dev_err(hba->dev, 10394 + "%s: failed to initialize (legacy doorbell mode not supported)\n", 10395 + __func__); 10396 + return -EINVAL; 10397 + } 10398 + 10399 + err = scsi_add_host(hba->host, hba->dev); 10400 + if (err) { 10401 + dev_err(hba->dev, "scsi_add_host failed\n"); 10402 + return err; 10403 + } 10404 + hba->scsi_host_added = true; 10405 + 10406 + hba->tmf_tag_set = (struct blk_mq_tag_set) { 10407 + .nr_hw_queues = 1, 10408 + .queue_depth = hba->nutmrs, 10409 + .ops = &ufshcd_tmf_ops, 10410 + .flags = BLK_MQ_F_NO_SCHED, 10411 + }; 10412 + err = blk_mq_alloc_tag_set(&hba->tmf_tag_set); 10413 + if (err < 0) 10414 + goto remove_scsi_host; 10415 + hba->tmf_queue = blk_mq_alloc_queue(&hba->tmf_tag_set, NULL, NULL); 10416 + if (IS_ERR(hba->tmf_queue)) { 10417 + err = PTR_ERR(hba->tmf_queue); 10418 + goto free_tmf_tag_set; 10419 + } 10420 + hba->tmf_rqs = devm_kcalloc(hba->dev, hba->nutmrs, 10421 + sizeof(*hba->tmf_rqs), GFP_KERNEL); 10422 + if (!hba->tmf_rqs) { 10423 + err = -ENOMEM; 10424 + goto free_tmf_queue; 10425 + } 10426 + 10427 + return 0; 10428 + 10429 + free_tmf_queue: 10430 + blk_mq_destroy_queue(hba->tmf_queue); 10431 + blk_put_queue(hba->tmf_queue); 10432 + 10433 + free_tmf_tag_set: 10434 + blk_mq_free_tag_set(&hba->tmf_tag_set); 10435 + 10436 + remove_scsi_host: 10437 + if (hba->scsi_host_added) 10438 + scsi_remove_host(hba->host); 10439 + 10440 + return err; 10441 + } 10340 10442 10341 10443 /** 10342 10444 * ufshcd_init - Driver initialization routine ··· 10537 10503 hba->is_irq_enabled = true; 10538 10504 } 10539 10505 10540 - if (!is_mcq_supported(hba)) { 10541 - if (!hba->lsdb_sup) { 10542 - dev_err(hba->dev, "%s: failed to initialize (legacy doorbell mode not supported)\n", 10543 - __func__); 10544 - err = -EINVAL; 10545 - goto out_disable; 10546 - } 10547 - err = scsi_add_host(host, hba->dev); 10548 - if (err) { 10549 - dev_err(hba->dev, "scsi_add_host failed\n"); 10550 - goto out_disable; 10551 - } 10552 - hba->scsi_host_added = true; 10553 - } 10554 - 10555 - hba->tmf_tag_set = (struct blk_mq_tag_set) { 10556 - .nr_hw_queues = 1, 10557 - .queue_depth = hba->nutmrs, 10558 - .ops = &ufshcd_tmf_ops, 10559 - .flags = BLK_MQ_F_NO_SCHED, 10560 - }; 10561 - err = blk_mq_alloc_tag_set(&hba->tmf_tag_set); 10562 - if (err < 0) 10563 - goto out_remove_scsi_host; 10564 - hba->tmf_queue = blk_mq_alloc_queue(&hba->tmf_tag_set, NULL, NULL); 10565 - if (IS_ERR(hba->tmf_queue)) { 10566 - err = PTR_ERR(hba->tmf_queue); 10567 - goto free_tmf_tag_set; 10568 - } 10569 - hba->tmf_rqs = devm_kcalloc(hba->dev, hba->nutmrs, 10570 - sizeof(*hba->tmf_rqs), GFP_KERNEL); 10571 - if (!hba->tmf_rqs) { 10572 - err = -ENOMEM; 10573 - goto free_tmf_queue; 10574 - } 10575 - 10576 10506 /* Reset the attached device */ 10577 10507 ufshcd_device_reset(hba); 10578 10508 ··· 10548 10550 dev_err(hba->dev, "Host controller enable failed\n"); 10549 10551 ufshcd_print_evt_hist(hba); 10550 10552 ufshcd_print_host_state(hba); 10551 - goto free_tmf_queue; 10553 + goto out_disable; 10552 10554 } 10553 10555 10554 10556 /* ··· 10574 10576 10575 10577 /* Hold auto suspend until async scan completes */ 10576 10578 pm_runtime_get_sync(dev); 10577 - atomic_set(&hba->scsi_block_reqs_cnt, 0); 10579 + 10578 10580 /* 10579 10581 * We are assuming that device wasn't put in sleep/power-down 10580 10582 * state exclusively during the boot stage before kernel. ··· 10583 10585 */ 10584 10586 ufshcd_set_ufs_dev_active(hba); 10585 10587 10588 + /* Initialize hba, detect and initialize UFS device */ 10589 + ktime_t probe_start = ktime_get(); 10590 + 10591 + hba->ufshcd_state = UFSHCD_STATE_RESET; 10592 + 10593 + err = ufshcd_link_startup(hba); 10594 + if (err) 10595 + goto out_disable; 10596 + 10597 + if (hba->quirks & UFSHCD_QUIRK_SKIP_PH_CONFIGURATION) 10598 + goto initialized; 10599 + 10600 + /* Debug counters initialization */ 10601 + ufshcd_clear_dbg_ufs_stats(hba); 10602 + 10603 + /* UniPro link is active now */ 10604 + ufshcd_set_link_active(hba); 10605 + 10606 + /* Verify device initialization by sending NOP OUT UPIU */ 10607 + err = ufshcd_verify_dev_init(hba); 10608 + if (err) 10609 + goto out_disable; 10610 + 10611 + /* Initiate UFS initialization, and waiting until completion */ 10612 + err = ufshcd_complete_dev_init(hba); 10613 + if (err) 10614 + goto out_disable; 10615 + 10616 + err = ufshcd_device_params_init(hba); 10617 + if (err) 10618 + goto out_disable; 10619 + 10620 + err = ufshcd_post_device_init(hba); 10621 + 10622 + initialized: 10623 + ufshcd_process_probe_result(hba, probe_start, err); 10624 + if (err) 10625 + goto out_disable; 10626 + 10627 + err = ufshcd_add_scsi_host(hba); 10628 + if (err) 10629 + goto out_disable; 10630 + 10586 10631 async_schedule(ufshcd_async_scan, hba); 10587 10632 ufs_sysfs_add_nodes(hba->dev); 10588 10633 ··· 10633 10592 ufshcd_pm_qos_init(hba); 10634 10593 return 0; 10635 10594 10636 - free_tmf_queue: 10637 - blk_mq_destroy_queue(hba->tmf_queue); 10638 - blk_put_queue(hba->tmf_queue); 10639 - free_tmf_tag_set: 10640 - blk_mq_free_tag_set(&hba->tmf_tag_set); 10641 - out_remove_scsi_host: 10642 - if (hba->scsi_host_added) 10643 - scsi_remove_host(hba->host); 10644 10595 out_disable: 10645 10596 hba->is_irq_enabled = false; 10646 10597 ufshcd_hba_exit(hba);
+3 -5
drivers/ufs/host/tc-dwc-g210-pci.c
··· 80 80 81 81 pci_set_master(pdev); 82 82 83 - err = pcim_iomap_regions(pdev, 1 << 0, UFSHCD); 84 - if (err < 0) { 83 + mmio_base = pcim_iomap_region(pdev, 0, UFSHCD); 84 + if (IS_ERR(mmio_base)) { 85 85 dev_err(&pdev->dev, "request and iomap failed\n"); 86 - return err; 86 + return PTR_ERR(mmio_base); 87 87 } 88 - 89 - mmio_base = pcim_iomap_table(pdev)[0]; 90 88 91 89 err = ufshcd_alloc_host(&pdev->dev, &hba); 92 90 if (err) {
+73 -63
drivers/ufs/host/ufs-exynos.c
··· 48 48 #define HCI_UNIPRO_APB_CLK_CTRL 0x68 49 49 #define UNIPRO_APB_CLK(v, x) (((v) & ~0xF) | ((x) & 0xF)) 50 50 #define HCI_AXIDMA_RWDATA_BURST_LEN 0x6C 51 + #define WLU_EN BIT(31) 52 + #define WLU_BURST_LEN(x) ((x) << 27 | ((x) & 0xF)) 51 53 #define HCI_GPIO_OUT 0x70 52 54 #define HCI_ERR_EN_PA_LAYER 0x78 53 55 #define HCI_ERR_EN_DL_LAYER 0x7C ··· 76 74 #define CLK_CTRL_EN_MASK (REFCLK_CTRL_EN |\ 77 75 UNIPRO_PCLK_CTRL_EN |\ 78 76 UNIPRO_MCLK_CTRL_EN) 77 + 78 + #define HCI_IOP_ACG_DISABLE 0x100 79 + #define HCI_IOP_ACG_DISABLE_EN BIT(0) 80 + 79 81 /* Device fatal error */ 80 82 #define DFES_ERR_EN BIT(31) 81 83 #define DFES_DEF_L2_ERRS (UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF |\ ··· 204 198 exynos_ufs_ctrl_clkstop(ufs, false); 205 199 } 206 200 207 - static int exynos7_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) 201 + static int exynos_ufs_shareability(struct exynos_ufs *ufs) 208 202 { 209 - return 0; 210 - } 211 - 212 - static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) 213 - { 214 - struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; 215 - 216 203 /* IO Coherency setting */ 217 204 if (ufs->sysreg) { 218 205 return regmap_update_bits(ufs->sysreg, ··· 213 214 UFS_SHARABLE, UFS_SHARABLE); 214 215 } 215 216 216 - attr->tx_dif_p_nsec = 3200000; 217 - 218 217 return 0; 218 + } 219 + 220 + static int gs101_ufs_drv_init(struct exynos_ufs *ufs) 221 + { 222 + struct ufs_hba *hba = ufs->hba; 223 + u32 reg; 224 + 225 + /* Enable WriteBooster */ 226 + hba->caps |= UFSHCD_CAP_WB_EN; 227 + 228 + /* Enable clock gating and hibern8 */ 229 + hba->caps |= UFSHCD_CAP_CLK_GATING | UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; 230 + 231 + /* set ACG to be controlled by UFS_ACG_DISABLE */ 232 + reg = hci_readl(ufs, HCI_IOP_ACG_DISABLE); 233 + hci_writel(ufs, reg & (~HCI_IOP_ACG_DISABLE_EN), HCI_IOP_ACG_DISABLE); 234 + 235 + return exynos_ufs_shareability(ufs); 236 + } 237 + 238 + static int exynosauto_ufs_drv_init(struct exynos_ufs *ufs) 239 + { 240 + return exynos_ufs_shareability(ufs); 219 241 } 220 242 221 243 static int exynosauto_ufs_post_hce_enable(struct exynos_ufs *ufs) ··· 566 546 struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; 567 547 struct ufs_phy_time_cfg *t_cfg = &ufs->t_cfg; 568 548 549 + if (ufs->opts & EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR) 550 + return; 551 + 569 552 t_cfg->tx_linereset_p = 570 553 exynos_ufs_calc_time_cntr(ufs, attr->tx_dif_p_nsec); 571 554 t_cfg->tx_linereset_n = ··· 747 724 { 748 725 u32 reg, val; 749 726 727 + if (ufs->opts & EXYNOS_UFS_OPT_UFSPR_SECURE) 728 + return; 729 + 750 730 exynos_ufs_disable_auto_ctrl_hcc_save(ufs, &val); 751 731 752 732 /* make encryption disabled by default */ ··· 797 771 exynos_ufs_disable_ov_tm(hba); 798 772 } 799 773 774 + #define UFS_HW_VER_MAJOR_MASK GENMASK(15, 8) 775 + 776 + static u32 exynos_ufs_get_hs_gear(struct ufs_hba *hba) 777 + { 778 + u8 major; 779 + 780 + major = FIELD_GET(UFS_HW_VER_MAJOR_MASK, hba->ufs_version); 781 + 782 + if (major >= 3) 783 + return UFS_HS_G4; 784 + 785 + /* Default is HS-G3 */ 786 + return UFS_HS_G3; 787 + } 788 + 800 789 static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba, 801 790 struct ufs_pa_layer_attr *dev_max_params, 802 791 struct ufs_pa_layer_attr *dev_req_params) ··· 828 787 } 829 788 830 789 ufshcd_init_host_params(&host_params); 790 + 791 + /* This driver only support symmetric gear setting e.g. hs_tx_gear == hs_rx_gear */ 792 + host_params.hs_tx_gear = exynos_ufs_get_hs_gear(hba); 793 + host_params.hs_rx_gear = exynos_ufs_get_hs_gear(hba); 831 794 832 795 ret = ufshcd_negotiate_pwr_params(&host_params, dev_max_params, dev_req_params); 833 796 if (ret) { ··· 1474 1429 exynos_ufs_fmp_init(hba, ufs); 1475 1430 1476 1431 if (ufs->drv_data->drv_init) { 1477 - ret = ufs->drv_data->drv_init(dev, ufs); 1432 + ret = ufs->drv_data->drv_init(ufs); 1478 1433 if (ret) { 1479 1434 dev_err(dev, "failed to init drv-data\n"); 1480 1435 goto out; ··· 1485 1440 if (ret) 1486 1441 goto out; 1487 1442 exynos_ufs_specify_phy_time_attr(ufs); 1488 - if (!(ufs->opts & EXYNOS_UFS_OPT_UFSPR_SECURE)) 1489 - exynos_ufs_config_smu(ufs); 1443 + 1444 + exynos_ufs_config_smu(ufs); 1490 1445 1491 1446 hba->host->dma_alignment = DATA_UNIT_SIZE - 1; 1492 1447 return 0; ··· 1529 1484 hci_writel(ufs, 1 << 0, HCI_GPIO_OUT); 1530 1485 } 1531 1486 1532 - static void exynos_ufs_pre_hibern8(struct ufs_hba *hba, u8 enter) 1487 + static void exynos_ufs_pre_hibern8(struct ufs_hba *hba, enum uic_cmd_dme cmd) 1533 1488 { 1534 1489 struct exynos_ufs *ufs = ufshcd_get_variant(hba); 1535 1490 struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; 1536 1491 1537 - if (!enter) { 1492 + if (cmd == UIC_CMD_DME_HIBER_EXIT) { 1538 1493 if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL) 1539 1494 exynos_ufs_disable_auto_ctrl_hcc(ufs); 1540 1495 exynos_ufs_ungate_clks(ufs); ··· 1562 1517 } 1563 1518 } 1564 1519 1565 - static void exynos_ufs_post_hibern8(struct ufs_hba *hba, u8 enter) 1520 + static void exynos_ufs_post_hibern8(struct ufs_hba *hba, enum uic_cmd_dme cmd) 1566 1521 { 1567 1522 struct exynos_ufs *ufs = ufshcd_get_variant(hba); 1568 1523 1569 - if (!enter) { 1570 - u32 cur_mode = 0; 1571 - u32 pwrmode; 1572 - 1573 - if (ufshcd_is_hs_mode(&ufs->dev_req_params)) 1574 - pwrmode = FAST_MODE; 1575 - else 1576 - pwrmode = SLOW_MODE; 1577 - 1578 - ufshcd_dme_get(hba, UIC_ARG_MIB(PA_PWRMODE), &cur_mode); 1579 - if (cur_mode != (pwrmode << 4 | pwrmode)) { 1580 - dev_warn(hba->dev, "%s: power mode change\n", __func__); 1581 - hba->pwr_info.pwr_rx = (cur_mode >> 4) & 0xf; 1582 - hba->pwr_info.pwr_tx = cur_mode & 0xf; 1583 - ufshcd_config_pwr_mode(hba, &hba->max_pwr_info.info); 1584 - } 1585 - 1586 - if (!(ufs->opts & EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB)) 1587 - exynos_ufs_establish_connt(ufs); 1588 - } else { 1524 + if (cmd == UIC_CMD_DME_HIBER_ENTER) { 1589 1525 ufs->entry_hibern8_t = ktime_get(); 1590 1526 exynos_ufs_gate_clks(ufs); 1591 1527 if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL) ··· 1653 1627 } 1654 1628 1655 1629 static void exynos_ufs_hibern8_notify(struct ufs_hba *hba, 1656 - enum uic_cmd_dme enter, 1630 + enum uic_cmd_dme cmd, 1657 1631 enum ufs_notify_change_status notify) 1658 1632 { 1659 1633 switch ((u8)notify) { 1660 1634 case PRE_CHANGE: 1661 - exynos_ufs_pre_hibern8(hba, enter); 1635 + exynos_ufs_pre_hibern8(hba, cmd); 1662 1636 break; 1663 1637 case POST_CHANGE: 1664 - exynos_ufs_post_hibern8(hba, enter); 1638 + exynos_ufs_post_hibern8(hba, cmd); 1665 1639 break; 1666 1640 } 1667 1641 } ··· 1917 1891 { 1918 1892 struct ufs_hba *hba = ufs->hba; 1919 1893 1894 + /* 1895 + * Enable Write Line Unique. This field has to be 0x3 1896 + * to support Write Line Unique transaction on gs101. 1897 + */ 1898 + hci_writel(ufs, WLU_EN | WLU_BURST_LEN(3), HCI_AXIDMA_RWDATA_BURST_LEN); 1899 + 1920 1900 exynos_ufs_enable_dbg_mode(hba); 1921 1901 ufshcd_dme_set(hba, UIC_ARG_MIB(PA_SAVECONFIGTIME), 0x3e8); 1922 1902 exynos_ufs_disable_dbg_mode(hba); ··· 2068 2036 EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX | 2069 2037 EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB | 2070 2038 EXYNOS_UFS_OPT_USE_SW_HIBERN8_TIMER, 2071 - .drv_init = exynos7_ufs_drv_init, 2072 2039 .pre_link = exynos7_ufs_pre_link, 2073 2040 .post_link = exynos7_ufs_post_link, 2074 2041 .pre_pwr_change = exynos7_ufs_pre_pwr_change, ··· 2076 2045 2077 2046 static struct exynos_ufs_uic_attr gs101_uic_attr = { 2078 2047 .tx_trailingclks = 0xff, 2079 - .tx_dif_p_nsec = 3000000, /* unit: ns */ 2080 - .tx_dif_n_nsec = 1000000, /* unit: ns */ 2081 - .tx_high_z_cnt_nsec = 20000, /* unit: ns */ 2082 - .tx_base_unit_nsec = 100000, /* unit: ns */ 2083 - .tx_gran_unit_nsec = 4000, /* unit: ns */ 2084 - .tx_sleep_cnt = 1000, /* unit: ns */ 2085 - .tx_min_activatetime = 0xa, 2086 - .rx_filler_enable = 0x2, 2087 - .rx_dif_p_nsec = 1000000, /* unit: ns */ 2088 - .rx_hibern8_wait_nsec = 4000000, /* unit: ns */ 2089 - .rx_base_unit_nsec = 100000, /* unit: ns */ 2090 - .rx_gran_unit_nsec = 4000, /* unit: ns */ 2091 - .rx_sleep_cnt = 1280, /* unit: ns */ 2092 - .rx_stall_cnt = 320, /* unit: ns */ 2093 - .rx_hs_g1_sync_len_cap = SYNC_LEN_COARSE(0xf), 2094 - .rx_hs_g2_sync_len_cap = SYNC_LEN_COARSE(0xf), 2095 - .rx_hs_g3_sync_len_cap = SYNC_LEN_COARSE(0xf), 2096 - .rx_hs_g1_prep_sync_len_cap = PREP_LEN(0xf), 2097 - .rx_hs_g2_prep_sync_len_cap = PREP_LEN(0xf), 2098 - .rx_hs_g3_prep_sync_len_cap = PREP_LEN(0xf), 2099 2048 .pa_dbg_opt_suite1_val = 0x90913C1C, 2100 2049 .pa_dbg_opt_suite1_off = PA_GS101_DBG_OPTION_SUITE1, 2101 2050 .pa_dbg_opt_suite2_val = 0xE01C115F, ··· 2133 2122 UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR | 2134 2123 UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL | 2135 2124 UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING, 2136 - .opts = EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL | 2137 - EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | 2125 + .opts = EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | 2138 2126 EXYNOS_UFS_OPT_UFSPR_SECURE | 2139 2127 EXYNOS_UFS_OPT_TIMER_TICK_SELECT, 2140 - .drv_init = exynosauto_ufs_drv_init, 2128 + .drv_init = gs101_ufs_drv_init, 2141 2129 .pre_link = gs101_ufs_pre_link, 2142 2130 .post_link = gs101_ufs_post_link, 2143 2131 .pre_pwr_change = gs101_ufs_pre_pwr_change,
+1 -1
drivers/ufs/host/ufs-exynos.h
··· 182 182 unsigned int quirks; 183 183 unsigned int opts; 184 184 /* SoC's specific operations */ 185 - int (*drv_init)(struct device *dev, struct exynos_ufs *ufs); 185 + int (*drv_init)(struct exynos_ufs *ufs); 186 186 int (*pre_link)(struct exynos_ufs *ufs); 187 187 int (*post_link)(struct exynos_ufs *ufs); 188 188 int (*pre_pwr_change)(struct exynos_ufs *ufs,
+10
drivers/ufs/host/ufs-mediatek.c
··· 1780 1780 return ufs_mtk_config_mcq(hba, true); 1781 1781 } 1782 1782 1783 + static void ufs_mtk_config_scsi_dev(struct scsi_device *sdev) 1784 + { 1785 + struct ufs_hba *hba = shost_priv(sdev->host); 1786 + 1787 + dev_dbg(hba->dev, "lu %llu scsi device configured", sdev->lun); 1788 + if (sdev->lun == 2) 1789 + blk_queue_flag_set(QUEUE_FLAG_SAME_FORCE, sdev->request_queue); 1790 + } 1791 + 1783 1792 /* 1784 1793 * struct ufs_hba_mtk_vops - UFS MTK specific variant operations 1785 1794 * ··· 1818 1809 .op_runtime_config = ufs_mtk_op_runtime_config, 1819 1810 .mcq_config_resource = ufs_mtk_mcq_config_resource, 1820 1811 .config_esi = ufs_mtk_config_esi, 1812 + .config_scsi_dev = ufs_mtk_config_scsi_dev, 1821 1813 }; 1822 1814 1823 1815 /**
+22 -4
drivers/ufs/host/ufs-qcom.c
··· 828 828 if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME) 829 829 err = ufs_qcom_quirk_host_pa_saveconfigtime(hba); 830 830 831 - if (hba->dev_info.wmanufacturerid == UFS_VENDOR_WDC) 832 - hba->dev_quirks |= UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE; 833 - 834 831 return err; 832 + } 833 + 834 + /* UFS device-specific quirks */ 835 + static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = { 836 + { .wmanufacturerid = UFS_VENDOR_SKHYNIX, 837 + .model = UFS_ANY_MODEL, 838 + .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM }, 839 + { .wmanufacturerid = UFS_VENDOR_TOSHIBA, 840 + .model = UFS_ANY_MODEL, 841 + .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM }, 842 + { .wmanufacturerid = UFS_VENDOR_WDC, 843 + .model = UFS_ANY_MODEL, 844 + .quirk = UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE }, 845 + {} 846 + }; 847 + 848 + static void ufs_qcom_fixup_dev_quirks(struct ufs_hba *hba) 849 + { 850 + ufshcd_fixup_dev_quirks(hba, ufs_qcom_dev_fixups); 835 851 } 836 852 837 853 static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba) ··· 874 858 if (host->hw_ver.major > 0x3) 875 859 hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; 876 860 877 - if (of_device_is_compatible(hba->dev->of_node, "qcom,sm8550-ufshc")) 861 + if (of_device_is_compatible(hba->dev->of_node, "qcom,sm8550-ufshc") || 862 + of_device_is_compatible(hba->dev->of_node, "qcom,sm8650-ufshc")) 878 863 hba->quirks |= UFSHCD_QUIRK_BROKEN_LSDBS_CAP; 879 864 } 880 865 ··· 1818 1801 .link_startup_notify = ufs_qcom_link_startup_notify, 1819 1802 .pwr_change_notify = ufs_qcom_pwr_change_notify, 1820 1803 .apply_dev_quirks = ufs_qcom_apply_dev_quirks, 1804 + .fixup_dev_quirks = ufs_qcom_fixup_dev_quirks, 1821 1805 .suspend = ufs_qcom_suspend, 1822 1806 .resume = ufs_qcom_resume, 1823 1807 .dbg_register_dump = ufs_qcom_dump_dbg_regs,
+8 -1
drivers/ufs/host/ufs-renesas.c
··· 7 7 8 8 #include <linux/clk.h> 9 9 #include <linux/delay.h> 10 + #include <linux/dma-mapping.h> 10 11 #include <linux/err.h> 11 12 #include <linux/iopoll.h> 12 13 #include <linux/kernel.h> ··· 365 364 return -ENOMEM; 366 365 ufshcd_set_variant(hba, priv); 367 366 368 - hba->quirks |= UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS | UFSHCD_QUIRK_HIBERN_FASTAUTO; 367 + hba->quirks |= UFSHCD_QUIRK_HIBERN_FASTAUTO; 369 368 370 369 return 0; 370 + } 371 + 372 + static int ufs_renesas_set_dma_mask(struct ufs_hba *hba) 373 + { 374 + return dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(32)); 371 375 } 372 376 373 377 static const struct ufs_hba_variant_ops ufs_renesas_vops = { 374 378 .name = "renesas", 375 379 .init = ufs_renesas_init, 380 + .set_dma_mask = ufs_renesas_set_dma_mask, 376 381 .setup_clocks = ufs_renesas_setup_clocks, 377 382 .hce_enable_notify = ufs_renesas_hce_enable_notify, 378 383 .dbg_register_dump = ufs_renesas_dbg_register_dump,
+3 -5
drivers/ufs/host/ufshcd-pci.c
··· 588 588 589 589 pci_set_master(pdev); 590 590 591 - err = pcim_iomap_regions(pdev, 1 << 0, UFSHCD); 592 - if (err < 0) { 591 + mmio_base = pcim_iomap_region(pdev, 0, UFSHCD); 592 + if (IS_ERR(mmio_base)) { 593 593 dev_err(&pdev->dev, "request and iomap failed\n"); 594 - return err; 594 + return PTR_ERR(mmio_base); 595 595 } 596 - 597 - mmio_base = pcim_iomap_table(pdev)[0]; 598 596 599 597 err = ufshcd_alloc_host(&pdev->dev, &hba); 600 598 if (err) {
+9 -12
include/ufs/ufshcd.h
··· 299 299 * @max_num_rtt: maximum RTT supported by the host 300 300 * @init: called when the driver is initialized 301 301 * @exit: called to cleanup everything done in init 302 + * @set_dma_mask: For setting another DMA mask than indicated by the 64AS 303 + * capability bit. 302 304 * @get_ufs_hci_version: called to get UFS HCI version 303 305 * @clk_scale_notify: notifies that clks are scaled up/down 304 306 * @setup_clocks: called before touching any of the controller registers ··· 343 341 int (*init)(struct ufs_hba *); 344 342 void (*exit)(struct ufs_hba *); 345 343 u32 (*get_ufs_hci_version)(struct ufs_hba *); 344 + int (*set_dma_mask)(struct ufs_hba *); 346 345 int (*clk_scale_notify)(struct ufs_hba *, bool, 347 346 enum ufs_notify_change_status); 348 347 int (*setup_clocks)(struct ufs_hba *, bool, ··· 386 383 int (*get_outstanding_cqs)(struct ufs_hba *hba, 387 384 unsigned long *ocqs); 388 385 int (*config_esi)(struct ufs_hba *hba); 386 + void (*config_scsi_dev)(struct scsi_device *sdev); 389 387 }; 390 388 391 389 /* clock gating state */ ··· 626 622 * support physical host configuration. 627 623 */ 628 624 UFSHCD_QUIRK_SKIP_PH_CONFIGURATION = 1 << 16, 629 - 630 - /* 631 - * This quirk needs to be enabled if the host controller has 632 - * 64-bit addressing supported capability but it doesn't work. 633 - */ 634 - UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS = 1 << 17, 635 625 636 626 /* 637 627 * This quirk needs to be enabled if the host controller has ··· 875 877 * @tmf_tag_set: TMF tag set. 876 878 * @tmf_queue: Used to allocate TMF tags. 877 879 * @tmf_rqs: array with pointers to TMF requests while these are in progress. 878 - * @active_uic_cmd: handle of active UIC command 879 - * @uic_cmd_mutex: mutex for UIC command 880 - * @uic_async_done: completion used during UIC processing 880 + * @active_uic_cmd: pointer to active UIC command. 881 + * @uic_cmd_mutex: mutex used for serializing UIC command processing. 882 + * @uic_async_done: completion used to wait for power mode or hibernation state 883 + * changes. 881 884 * @ufshcd_state: UFSHCD state 882 885 * @eh_flags: Error handling flags 883 886 * @intr_mask: Interrupt Mask Bits ··· 926 927 * @wb_mutex: used to serialize devfreq and sysfs write booster toggling 927 928 * @clk_scaling_lock: used to serialize device commands and clock scaling 928 929 * @desc_size: descriptor sizes reported by device 929 - * @scsi_block_reqs_cnt: reference counting for scsi block requests 930 930 * @bsg_dev: struct device associated with the BSG queue 931 931 * @bsg_queue: BSG queue associated with the UFS controller 932 932 * @rpm_dev_flush_recheck_work: used to suspend from RPM (runtime power ··· 1086 1088 1087 1089 struct mutex wb_mutex; 1088 1090 struct rw_semaphore clk_scaling_lock; 1089 - atomic_t scsi_block_reqs_cnt; 1090 1091 1091 1092 struct device bsg_dev; 1092 1093 struct request_queue *bsg_queue; ··· 1317 1320 unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba, 1318 1321 struct ufs_hw_queue *hwq); 1319 1322 void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba); 1320 - void ufshcd_mcq_enable_esi(struct ufs_hba *hba); 1321 1323 void ufshcd_mcq_enable(struct ufs_hba *hba); 1324 + void ufshcd_mcq_enable_esi(struct ufs_hba *hba); 1322 1325 void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg); 1323 1326 1324 1327 int ufshcd_opp_config_clks(struct device *dev, struct opp_table *opp_table,