SCSI fixes for 5.4-rc1
Subsystems (7)
James Bottomley
maintainerTwelve patches mostly small but obvious fixes or cosmetic but small updates, all in drivers.
The patch is available here:
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes
The short changelog is:
Austin Kim (1):
scsi: qedf: Remove always false 'tmp_prio < 0' statement
Himanshu Madhani (1):
scsi: qla2xxx: Silence fwdump template message
Laurence Oberman (1):
scsi: bnx2fc: Handle scope bits when array returns BUSY or TSF
Long Li (1):
scsi: storvsc: setup 1:1 mapping between hardware queue and CPU queue
Quinn Tran (6):
scsi: qla2xxx: Fix Nport ID display value
scsi: qla2xxx: Fix N2N link up fail
scsi: qla2xxx: Fix N2N link reset
scsi: qla2xxx: Optimize NPIV tear down process
scsi: qla2xxx: Fix stale mem access on driver unload
scsi: qla2xxx: Fix unbound sleep in fcport delete path.
Stanley Chu (1):
scsi: ufs: skip shutdown if hba is not powered
Xiang Chen (1):
scsi: megaraid: disable device when probe failed after enabled device
YueHaibing (1):
scsi: hisi_sas: Make three functions static
And the diffstat:
drivers/scsi/bnx2fc/bnx2fc_io.c | 29 +++++++-- drivers/scsi/hisi_sas/hisi_sas_main.c | 6 +- drivers/scsi/megaraid.c | 4 +- drivers/scsi/qedf/qedf_main.c | 2 +- drivers/scsi/qla2xxx/qla_attr.c | 2 + drivers/scsi/qla2xxx/qla_def.h | 4 +- drivers/scsi/qla2xxx/qla_gs.c | 3 +- drivers/scsi/qla2xxx/qla_init.c | 109 ++++++++++++++++++++++++---------- drivers/scsi/qla2xxx/qla_iocb.c | 7 ++- drivers/scsi/qla2xxx/qla_mbx.c | 25 +++++++- drivers/scsi/qla2xxx/qla_mid.c | 32 ++++++---- drivers/scsi/qla2xxx/qla_os.c | 18 ++++-- drivers/scsi/qla2xxx/qla_target.c | 26 ++++---- drivers/scsi/storvsc_drv.c | 3 +- drivers/scsi/ufs/ufshcd.c | 3 + 15 files changed, 193 insertions(+), 80 deletions(-)
With full diff below.
James
---
drivers/scsi/bnx2fc/bnx2fc_io.c +24 -5
@@ -1923,6 +1923,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,struct fcoe_fcp_rsp_payload *fcp_rsp;struct bnx2fc_rport *tgt = io_req->tgt;struct scsi_cmnd *sc_cmd; +u16 scope =0 , qualifier =0 ;/* scsi_cmd_cmpl is called with tgt lock held */
@@ -1990,12 +1991,30 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,if (io_req->cdb_status ==SAM_STAT_TASK_SET_FULL || io_req->cdb_status ==SAM_STAT_BUSY ) { -/* Set the jiffies + retry_delay_timer * 100ms -for the rport/tgt */ - tgt->retry_delay_timestamp = jiffies + - fcp_rsp->retry_delay_timer *HZ /10 ; +/* Newer array firmware with BUSY or +* TASK_SET_FULL may return a status that needs +* the scope bits masked. +* Or a huge delay timestamp up to 27 minutes +* can result. +*/ +if (fcp_rsp->retry_delay_timer) { +/* Upper 2 bits */ + scope = fcp_rsp->retry_delay_timer + &0xC000 ; +/* Lower 14 bits */ + qualifier = fcp_rsp->retry_delay_timer + &0x3FFF ; + } +if (scope >0 && qualifier >0 && + qualifier <=0x3FEF ) { +/* Set the jiffies + +* retry_delay_timer * 100ms +* for the rport/tgt +*/ + tgt->retry_delay_timestamp = jiffies + + (qualifier *HZ /10 ); + } } - }if (io_req->fcp_resid)scsi_set_resid (sc_cmd, io_req->fcp_resid);
drivers/scsi/hisi_sas/hisi_sas_main.c +3 -3
@@ -3683,7 +3683,7 @@ void hisi_sas_debugfs_work_handler(struct work_struct *work) }EXPORT_SYMBOL_GPL (hisi_sas_debugfs_work_handler); -void hisi_sas_debugfs_release (struct hisi_hba *hisi_hba) +static void hisi_sas_debugfs_release (struct hisi_hba *hisi_hba) {struct device *dev = hisi_hba->dev;int i;
@@ -3705,7 +3705,7 @@ void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba)devm_kfree (dev, hisi_hba->debugfs_port_reg[i]); } -int hisi_sas_debugfs_alloc (struct hisi_hba *hisi_hba) +static int hisi_sas_debugfs_alloc (struct hisi_hba *hisi_hba) {const struct hisi_sas_hw *hw = hisi_hba->hw;struct device *dev = hisi_hba->dev;
@@ -3796,7 +3796,7 @@ int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)return -ENOMEM ; } -void hisi_sas_debugfs_bist_init (struct hisi_hba *hisi_hba) +static void hisi_sas_debugfs_bist_init (struct hisi_hba *hisi_hba) { hisi_hba->debugfs_bist_dentry =debugfs_create_dir ("bist" , hisi_hba->debugfs_dir);
drivers/scsi/megaraid.c +2 -2
@@ -4183,11 +4183,11 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)*/ if (pdev->subsystem_vendor ==PCI_VENDOR_ID_COMPAQ && pdev->subsystem_device ==0xC000 ) -return -ENODEV ; + goto out_disable_device;/* Now check the magic signature byte */ pci_read_config_word (pdev,PCI_CONF_AMISIG , &magic);if (magic !=HBA_SIGNATURE_471 && magic !=HBA_SIGNATURE ) -return -ENODEV ; + goto out_disable_device;/* Ok it is probably a megaraid */ }
drivers/scsi/qedf/qedf_main.c +1 -1
@@ -596,7 +596,7 @@ static void qedf_dcbx_handler(void *dev, struct qed_dcbx_get *get, u32 mib_type) tmp_prio = get->operational.app_prio.fcoe;if (qedf_default_prio >-1 ) qedf->prio = qedf_default_prio; -else if (tmp_prio <0 || tmp_prio >7 ) { +else if (tmp_prio >7 ) {QEDF_INFO (&(qedf->dbg_ctx),QEDF_LOG_DISC ,"FIP/FCoE prio %d out of range, setting to %d.\n" , tmp_prio,QEDF_DEFAULT_PRIO );
drivers/scsi/qla2xxx/qla_attr.c +2 -0
@@ -2920,6 +2920,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)struct qla_hw_data *ha = vha->hw;uint16_t id = vha->vp_idx; +set_bit (VPORT_DELETE , &vha->dpc_flags); +while (test_bit (LOOP_RESYNC_ACTIVE , &vha->dpc_flags) ||test_bit (FCPORT_UPDATE_NEEDED , &vha->dpc_flags))msleep (1000 );
drivers/scsi/qla2xxx/qla_def.h +3 -1
@@ -2396,6 +2396,7 @@ typedef struct fc_port { unsigned int query:1; unsigned int id_changed:1; unsigned int scan_needed:1; + unsigned int n2n_flag:1;struct completion nvme_del_done;uint32_t nvme_prli_service_param;
@@ -2446,7 +2447,6 @@ typedef struct fc_port {uint8_t fc4_type;uint8_t fc4f_nvme;uint8_t scan_state; -uint8_t n2n_flag;unsigned long last_queue_full;unsigned long last_ramp_up;
@@ -3036,6 +3036,7 @@ enum scan_flags_t {enum fc4type_t {FS_FC4TYPE_FCP =BIT_0 ,FS_FC4TYPE_NVME =BIT_1 , +FS_FCP_IS_N2N =BIT_7 , };struct fab_scan_rp {
@@ -4394,6 +4395,7 @@ typedef struct scsi_qla_host {#define IOCB_WORK_ACTIVE 31#define SET_ZIO_THRESHOLD_NEEDED 32#define ISP_ABORT_TO_ROM 33 +#define VPORT_DELETE 34unsigned long pci_flags;#define PFLG_DISCONNECTED 0/* PCI device removed */
drivers/scsi/qla2xxx/qla_gs.c +2 -1
@@ -3102,7 +3102,8 @@ int qla24xx_post_gpnid_work(struct scsi_qla_host *vha, port_id_t *id) {struct qla_work_evt *e; -if (test_bit (UNLOADING , &vha->dpc_flags)) +if (test_bit (UNLOADING , &vha->dpc_flags) || + (vha->vp_idx &&test_bit (VPORT_DELETE , &vha->dpc_flags)))return 0 ; e =qla2x00_alloc_work (vha,QLA_EVT_GPNID );
drivers/scsi/qla2xxx/qla_init.c +78 -31
170 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_iocb.c +4 -3
@@ -2656,9 +2656,10 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) els_iocb->port_id[0 ] = sp->fcport->d_id.b.al_pa; els_iocb->port_id[1 ] = sp->fcport->d_id.b.area; els_iocb->port_id[2 ] = sp->fcport->d_id.b.domain; - els_iocb->s_id[0 ] = vha->d_id.b.al_pa; - els_iocb->s_id[1 ] = vha->d_id.b.area; - els_iocb->s_id[2 ] = vha->d_id.b.domain; +/* For SID the byte order is different than DID */ + els_iocb->s_id[1 ] = vha->d_id.b.al_pa; + els_iocb->s_id[2 ] = vha->d_id.b.area; + els_iocb->s_id[0 ] = vha->d_id.b.domain;if (elsio->u.els_logo.els_cmd ==ELS_DCMD_PLOGI ) { els_iocb->control_flags =0 ;
drivers/scsi/qla2xxx/qla_mbx.c +22 -3
@@ -2249,7 +2249,7 @@ qla2x00_lip_reset(scsi_qla_host_t *vha)mbx_cmd_t mc;mbx_cmd_t *mcp = &mc; -ql_dbg (ql_dbg_mbx + ql_dbg_verbose, vha,0x105a , +ql_dbg (ql_dbg_disc, vha,0x105a ,"Entered %s.\n" , __func__);if (IS_CNA_CAPABLE (vha->hw)) {
@@ -3883,14 +3883,24 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,case TOPO_N2N : ha->current_topology =ISP_CFG_N ;spin_lock_irqsave (&vha->hw->tgt.sess_lock, flags); +list_for_each_entry (fcport, &vha->vp_fcports, list) { + fcport->scan_state =QLA_FCPORT_SCAN ; + fcport->n2n_flag =0 ; + } + fcport =qla2x00_find_fcport_by_wwpn (vha, rptid_entry->u.f1.port_name,1 );spin_unlock_irqrestore (&vha->hw->tgt.sess_lock, flags);if (fcport) { fcport->plogi_nack_done_deadline = jiffies +HZ ; - fcport->dm_login_expire = jiffies +3 *HZ ; + fcport->dm_login_expire = jiffies +2 *HZ ; fcport->scan_state =QLA_FCPORT_FOUND ; + fcport->n2n_flag =1 ; + fcport->keep_nport_handle =1 ; +if (vha->flags.nvme_enabled) + fcport->fc4f_nvme =1 ; +switch (fcport->disc_state) {case DSC_DELETED : set_bit(RELOGIN_NEEDED,
@@ -3924,7 +3934,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, rptid_entry->u.f1.port_name, rptid_entry->u.f1.node_name,NULL , - FC4_TYPE_UNKNOWN); + FS_FCP_IS_N2N); }/* if our portname is higher then initiate N2N login */
@@ -4023,6 +4033,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,list_for_each_entry (fcport, &vha->vp_fcports, list) { fcport->scan_state =QLA_FCPORT_SCAN ; + fcport->n2n_flag =0 ; } fcport = qla2x00_find_fcport_by_wwpn(vha,
@@ -4032,6 +4043,14 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, fcport->login_retry = vha->hw->login_retry_count; fcport->plogi_nack_done_deadline = jiffies +HZ ; fcport->scan_state =QLA_FCPORT_FOUND ; + fcport->keep_nport_handle =1 ; + fcport->n2n_flag =1 ; + fcport->d_id.b.domain = + rptid_entry->u.f2.remote_nport_id[2 ]; + fcport->d_id.b.area = + rptid_entry->u.f2.remote_nport_id[1 ]; + fcport->d_id.b.al_pa = + rptid_entry->u.f2.remote_nport_id[0 ]; } } }
drivers/scsi/qla2xxx/qla_mid.c +22 -10
@@ -66,6 +66,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)uint16_t vp_id;struct qla_hw_data *ha = vha->hw;unsigned long flags =0 ; +u8 i;mutex_lock (&ha->vport_lock);/*
@@ -75,8 +76,9 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)* ensures no active vp_list traversal while the vport is removed * from the queue) */ -wait_event_timeout (vha->vref_waitq, !atomic_read (&vha->vref_count), -10 *HZ ); +for (i =0 ; i <10 &&atomic_read (&vha->vref_count); i++) +wait_event_timeout (vha->vref_waitq, +atomic_read (&vha->vref_count),HZ );spin_lock_irqsave (&ha->vport_slock, flags);if (atomic_read (&vha->vref_count)) {
@@ -262,6 +264,9 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb)spin_lock_irqsave (&ha->vport_slock, flags);list_for_each_entry (vha, &ha->vp_list, list) {if (vha->vp_idx) { +if (test_bit (VPORT_DELETE , &vha->dpc_flags)) +continue ; +atomic_inc (&vha->vref_count);spin_unlock_irqrestore (&ha->vport_slock, flags);
@@ -300,6 +305,20 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb)int qla2x00_vp_abort_isp (scsi_qla_host_t *vha) { +fc_port_t *fcport; + +/* +* To exclusively reset vport, we need to log it out first. +* Note: This control_vp can fail if ISP reset is already +* issued, this is expected, as the vp would be already +* logged out due to ISP reset. +*/ +if (!test_bit (ABORT_ISP_ACTIVE , &vha->dpc_flags)) { +qla24xx_control_vp (vha,VCE_COMMAND_DISABLE_VPS_LOGO_ALL ); +list_for_each_entry (fcport, &vha->vp_fcports, list) + fcport->logout_on_delete =0 ; + } +/* * Physical port will do most of the abort and recovery work. We can * just treat it as a loop down
@@ -312,16 +331,9 @@ qla2x00_vp_abort_isp(scsi_qla_host_t *vha)atomic_set (&vha->loop_down_timer,LOOP_DOWN_TIME ); } -/* -* To exclusively reset vport, we need to log it out first. Note: this -* control_vp can fail if ISP reset is already issued, this is -* expected, as the vp would be already logged out due to ISP reset. -*/ -if (!test_bit (ABORT_ISP_ACTIVE , &vha->dpc_flags)) -qla24xx_control_vp (vha,VCE_COMMAND_DISABLE_VPS_LOGO_ALL ); -ql_dbg (ql_dbg_taskm, vha,0x801d ,"Scheduling enable of Vport %d.\n" , vha->vp_idx); +return qla24xx_enable_vp (vha); }
drivers/scsi/qla2xxx/qla_os.c +13 -5
@@ -1115,9 +1115,15 @@ static inline int test_fcport_count(scsi_qla_host_t *vha)void qla2x00_wait_for_sess_deletion (scsi_qla_host_t *vha) { +u8 i; +qla2x00_mark_all_devices_lost (vha,0 ); -wait_event_timeout (vha->fcport_waitQ,test_fcport_count (vha),10 *HZ ); +for (i =0 ; i <10 ; i++) +wait_event_timeout (vha->fcport_waitQ,test_fcport_count (vha), +HZ ); + +flush_workqueue (vha->hw->wq); }/*
@@ -5027,6 +5033,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)memcpy (fcport->port_name, e->u.new_sess.port_name,WWN_SIZE ); + +if (e->u.new_sess.fc4_type &FS_FCP_IS_N2N ) + fcport->n2n_flag =1 ; + }else { ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %8phC mem alloc fail.\n",
@@ -5125,11 +5135,9 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)if (dfcp)qlt_schedule_sess_for_deletion (tfcp); - -if (N2N_TOPO (vha->hw)) - fcport->flags &= ~FCF_FABRIC_DEVICE ; -if (N2N_TOPO (vha->hw)) { + fcport->flags &= ~FCF_FABRIC_DEVICE ; + fcport->keep_nport_handle =1 ;if (vha->flags.nvme_enabled) { fcport->fc4f_nvme =1 ; fcport->n2n_flag =1 ;
drivers/scsi/qla2xxx/qla_target.c +13 -13
@@ -953,7 +953,7 @@ void qlt_free_session_done(struct work_struct *work)struct qla_hw_data *ha = vha->hw;unsigned long flags;bool logout_started = false; -scsi_qla_host_t *base_vha; +scsi_qla_host_t *base_vha =pci_get_drvdata (ha->pdev);struct qlt_plogi_ack_t *own = sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN ];
@@ -1020,6 +1020,7 @@ void qlt_free_session_done(struct work_struct *work)if (logout_started) {bool traced = false; +u16 cnt =0 ;while (!READ_ONCE (sess->logout_completed)) {if (!traced) {
@@ -1029,6 +1030,9 @@ void qlt_free_session_done(struct work_struct *work) traced = true; }msleep (100 ); + cnt++; +if (cnt >200 ) +break ; } ql_dbg(ql_dbg_disc, vha, 0xf087,
@@ -1101,6 +1105,7 @@ void qlt_free_session_done(struct work_struct *work) }spin_unlock_irqrestore (&ha->tgt.sess_lock, flags); + sess->free_pending =0 ; ql_dbg(ql_dbg_tgt_mgt, vha, 0xf001, "Unregistration of sess %p %8phC finished fcp_cnt %d\n",
@@ -1109,17 +1114,9 @@ void qlt_free_session_done(struct work_struct *work)if (tgt && (tgt->sess_count ==0 ))wake_up_all (&tgt->waitQ); -if (vha->fcport_count ==0 ) -wake_up_all (&vha->fcport_waitQ); - - base_vha =pci_get_drvdata (ha->pdev); - - sess->free_pending =0 ; - -if (test_bit (PFLG_DRIVER_REMOVING , &base_vha->pci_flags)) -return ; - -if ((!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION (vha)) { +if (!test_bit (PFLG_DRIVER_REMOVING , &base_vha->pci_flags) && + !(vha->vp_idx &&test_bit (VPORT_DELETE , &vha->dpc_flags)) && + (!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION (vha)) {switch (vha->host->active_mode) {case MODE_INITIATOR :case MODE_DUAL :
@@ -1132,6 +1129,9 @@ void qlt_free_session_done(struct work_struct *work)break ; } } + +if (vha->fcport_count ==0 ) +wake_up_all (&vha->fcport_waitQ); }/* ha->tgt.sess_lock supposed to be held on entry */
@@ -1161,7 +1161,7 @@ void qlt_unreg_sess(struct fc_port *sess) sess->last_login_gen = sess->login_gen;INIT_WORK (&sess->free_work, qlt_free_session_done); -schedule_work (&sess->free_work); +queue_work (sess->vha->hw->wq, &sess->free_work); }EXPORT_SYMBOL (qlt_unreg_sess);
drivers/scsi/storvsc_drv.c +1 -2
@@ -1837,8 +1837,7 @@ static int storvsc_probe(struct hv_device *device,/* * Set the number of HW queues we are supporting. */ -if (stor_device->num_sc !=0 ) - host->nr_hw_queues = stor_device->num_sc +1 ; + host->nr_hw_queues =num_present_cpus ();/* * Set the error handler work queue.
drivers/scsi/ufs/ufshcd.c +3 -0
@@ -8140,6 +8140,9 @@ int ufshcd_shutdown(struct ufs_hba *hba) {int ret =0 ; +if (!hba->is_powered) + goto out; +if (ufshcd_is_ufs_dev_poweroff (hba) &&ufshcd_is_link_off (hba)) goto out;
The pull request you sent on Fri, 04 Oct 2019 21:44:15 -0700:
The pull request you sent on Fri, 04 Oct 2019 21:44:15 -0700:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.gitscsi-fixes
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/126195c972a2adba8cae12a65cdee155440a4525
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker