qla2xxx: Bug fixes for the driver
Subsystems (2)
v2 cover qla2xxx: Bug fixes for the driver
Hi Martin,
This series has fixes for N2N handling and unload path for driver when NPIV is configured. Also included are patches for capturing firmware dump when firmware posts MPI heartbeat stop event. We have also enhanced handling of FCP/FC-NVMe when target advertises both capabilites under same WWNN.
Please apply this series for 5.4/scsi-queue at your earliest convenience.
Note: Series submitted earlier today (9/12/2019) by Roman Bolshakov
(https://marc.info/?l=linux-scsi&m=156824878713514&w=2)
is still being reviewed and I do not see any conflict with this series. Please hold off on merging that series until review is complete.
changes from v1 -> v2
o Rebased series on updated 5.4/queue branch
Thanks,
Himanshu
Himanshu Madhani (3):
qla2xxx: Silence fwdump template message
qla2xxx: Improve logging for scan thread
qla2xxx: Update driver version to 10.01.00.20-k
Michael Hernandez (1):
qla2xxx: Dual FCP-NVMe target port support
Quinn Tran (10):
qla2xxx: Fix unbound sleep in fcport delete path.
qla2xxx: Fix stale mem access on driver unload
qla2xxx: Optimize NPIV tear down process
qla2xxx: Fix N2N link reset
qla2xxx: Fix N2N link up fail
qla2xxx: Fix Nport ID display value
qla2xxx: Add error handling for PLOGI ELS passthrough
qla2xxx: Set remove flag for all VP
qla2xxx: Check for MB timeout while capturing ISP27/28xx FW dump
qla2xxx: Capture FW dump on MPI heartbeat stop event
drivers/scsi/qla2xxx/qla_attr.c | 6 +- drivers/scsi/qla2xxx/qla_def.h | 30 ++++++- drivers/scsi/qla2xxx/qla_fw.h | 2 + drivers/scsi/qla2xxx/qla_gs.c | 67 ++++++++------- drivers/scsi/qla2xxx/qla_init.c | 167 +++++++++++++++++++++++++------------ drivers/scsi/qla2xxx/qla_inline.h | 12 +++ drivers/scsi/qla2xxx/qla_iocb.c | 102 ++++++++++++++++++++-- drivers/scsi/qla2xxx/qla_isr.c | 31 +++++-- drivers/scsi/qla2xxx/qla_mbx.c | 34 ++++++-- drivers/scsi/qla2xxx/qla_mid.c | 32 ++++--- drivers/scsi/qla2xxx/qla_os.c | 63 ++++++++++---- drivers/scsi/qla2xxx/qla_target.c | 26 +++--- drivers/scsi/qla2xxx/qla_tmpl.c | 29 ++++++- drivers/scsi/qla2xxx/qla_version.h | 2 +- 14 files changed, 453 insertions(+), 150 deletions(-)
Signature · 1 line
2.12.0
PATCH v2 1/14 qla2xxx: Silence fwdump template message
Print fwdt template is present or not, only
when ql2xextended_error_logging is enabled.
--- drivers/scsi/qla2xxx/qla_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +1 -1
@@ -3190,7 +3190,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)for (j =0 ; j <2 ; j++, fwdt++) {if (!fwdt->template) { -ql_log (ql_log_warn, vha,0x00ba , +ql_dbg (ql_dbg_init, vha,0x00ba ,"-> fwdt%u no template\n" , j);continue ; }
Signature · 1 line
2.12.0
PATCH v2 2/14 qla2xxx: Fix unbound sleep in fcport delete path.
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
There are instances, though rare, where a LOGO request cannot be sent out and the thread in free session done can wait indefinitely. Fix this by putting an upper bound to sleep.
--- drivers/scsi/qla2xxx/qla_target.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/qla2xxx/qla_target.c +4 -0
@@ -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,
Signature · 1 line
2.12.0
Re: [PATCH v2 02/14] qla2xxx: Fix unbound sleep in fcport delete path.
Quoted 27 lines · Himanshu Madhani
From: Quinn Tran <[email protected]>
There are instances, though rare, where a LOGO request cannot be sent out and the thread in free session done can wait indefinitely. Fix this by putting an upper bound to sleep.
Signed-off-by Quinn Tran <[email protected]>Signed-off-by Himanshu Madhani <[email protected]>--- drivers/scsi/qla2xxx/qla_target.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/scsi/qla2xxx/qla_target.c +1
-0@@ -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) {
drivers/scsi/qla2xxx/qla_target.c void qlt_free_session_done(struct work_struct *work) · line 1038
Quoted 9 lines
drivers/scsi/qla2xxx/qla_target.c +3
-0@@ -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,
Hi Himanshu,
Is qla2x00_async_iocb_timeout() called if no response is received for a LOGO request? If so, has it been considered to modify that function instead of qlt_free_session_done()?
Thanks,
Bart.
PATCH v2 3/14 qla2xxx: Fix stale mem access on driver unload
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
On driver unload, 'remove_one' thread was allow to advance, while session cleanup still lag behind. This patch ensure session deletion will finish before remove_one can advance.
--- drivers/scsi/qla2xxx/qla_os.c | 1 + drivers/scsi/qla2xxx/qla_target.c | 21 ++++++++------------- 2 files changed, 9 insertions(+), 13 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +1 -0
@@ -1118,6 +1118,7 @@ qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha)qla2x00_mark_all_devices_lost (vha,0 );wait_event_timeout (vha->fcport_waitQ,test_fcport_count (vha),10 *HZ ); +flush_workqueue (vha->hw->wq); }/*
drivers/scsi/qla2xxx/qla_target.c +8 -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 ];
@@ -1105,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",
@@ -1113,17 +1114,8 @@ 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) && + (!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION (vha)) {switch (vha->host->active_mode) {case MODE_INITIATOR :case MODE_DUAL :
@@ -1136,6 +1128,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 */
@@ -1165,7 +1160,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);
Signature · 1 line
2.12.0
PATCH v2 4/14 qla2xxx: Optimize NPIV tear down process
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
In the case of NPIV port is being torn down, this patch will set a flag to indicate VPORT_DELETE. This would prevent relogin to be triggered.
--- drivers/scsi/qla2xxx/qla_attr.c | 2 ++ drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_gs.c | 3 ++- drivers/scsi/qla2xxx/qla_mid.c | 32 ++++++++++++++++++++++---------- drivers/scsi/qla2xxx/qla_os.c | 7 ++++++- drivers/scsi/qla2xxx/qla_target.c | 1 + 6 files changed, 34 insertions(+), 12 deletions(-)
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 +1 -0
@@ -4394,6 +4394,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_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 +6 -1
@@ -1115,9 +1115,14 @@ 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); }
drivers/scsi/qla2xxx/qla_target.c +1 -0
@@ -1115,6 +1115,7 @@ void qlt_free_session_done(struct work_struct *work)wake_up_all (&tgt->waitQ);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 :
Signature · 1 line
2.12.0
Re: [PATCH v2 04/14] qla2xxx: Optimize NPIV tear down process
Quoted 35 lines · Himanshu Madhani
From: Quinn Tran <[email protected]>
In the case of NPIV port is being torn down, this patch will set a flag to indicate
VPORT_DELETE. This would prevent relogin to be triggered.Signed-off-by Quinn Tran <[email protected]>Signed-off-by Himanshu Madhani <[email protected]>--- drivers/scsi/qla2xxx/qla_attr.c | 2 ++ drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_gs.c | 3 ++- drivers/scsi/qla2xxx/qla_mid.c | 32 ++++++++++++++++++++++------- --- drivers/scsi/qla2xxx/qla_os.c | 7 ++++++- drivers/scsi/qla2xxx/qla_target.c | 1 + 6 files changed, 34 insertions(+), 12 deletions(-)drivers/scsi/qla2xxx/qla_mid.c +1
-0@@ -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
drivers/scsi/qla2xxx/qla_mid.c +0
-1* from the queue) */ - wait_event_timeout(vha->vref_waitq, !atomic_read(&vha-Quoted 1 line
vref_count),
drivers/scsi/qla2xxx/qla_mid.c qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) · line 81
Quoted 4 lines
drivers/scsi/qla2xxx/qla_mid.c +3
-1- 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 );
Are you missing a negation in this last line?
Also, what's the point of adding this loop?
Quoted 18 lines
drivers/scsi/qla2xxx/qla_os.c +6
-1@@ -1115,9 +1115,14 @@ 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 ); +
Quoted 2 lines
flush_workqueue(vha->hw->wq);
}
Perhaps here, the loop should be exited if test_fcport_count(vha) gets TRUE? And again, why is the loop necessary?
Regards
Martin
Re: [EXT] Re: [PATCH v2 04/14] qla2xxx: Optimize NPIV tear down process
On 9/26/19, 3:52 AM, "Martin Wilck" <[email protected]> wrote:
External Email
----------------------------------------------------------------------
On Thu, 2019-09-12 at 11:09 -0700, Himanshu Madhani wrote:
> From: Quinn Tran <[email protected]>
>
> In the case of NPIV port is being torn down, this patch will
> set a flag to indicate VPORT_DELETE. This would prevent relogin
> to be triggered.
>
> Signed-off-by: Quinn Tran <[email protected]>
> Signed-off-by: Himanshu Madhani <[email protected]>
> ---
> drivers/scsi/qla2xxx/qla_attr.c | 2 ++
> drivers/scsi/qla2xxx/qla_def.h | 1 +
> drivers/scsi/qla2xxx/qla_gs.c | 3 ++-
> drivers/scsi/qla2xxx/qla_mid.c | 32 ++++++++++++++++++++++-------
> ---
> drivers/scsi/qla2xxx/qla_os.c | 7 ++++++-
> drivers/scsi/qla2xxx/qla_target.c | 1 +
> 6 files changed, 34 insertions(+), 12 deletions(-)
>
> --- a/drivers/scsi/qla2xxx/qla_mid.c
> +++ b/drivers/scsi/qla2xxx/qla_mid.c
> @@ -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);
Are you missing a negation in this last line?
Also, what's the point of adding this loop? QT: good catch. The idea is to not sleep the full 10Hz, if the vref_count already reaches zero or reaches zero under 10Hz. Otherwise, loop/wait for 10Hz. We're trying to get NPIV tear down to go faster.
Quoted 18 lines
drivers/scsi/qla2xxx/qla_os.c +6
-1@@ -1115,9 +1115,14 @@ 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 ); +
Quoted 2 lines
flush_workqueue(vha->hw->wq);
}
Perhaps here, the loop should be exited if test_fcport_count(vha) gets TRUE? And again, why is the loop necessary?
QT: Yes. Same answer as above with the looping.
Regards
Martin
Re: [EXT] Re: [PATCH v2 04/14] qla2xxx: Optimize NPIV tear down process
Quoted 8 lines · Quinn Tran
Are you missing a negation in this last line?
Also, what's the point of adding this loop?QT: good catch. The idea is to not sleep the full 10Hz, if the
vref_countalready reaches zero or reaches zero under
10Hz. Otherwise, loop/wait for 10Hz. We're trying to get NPIV tear
down to go faster.
AFAIU, wait_event_timeout() returns before the timeout has elapsed, if the tested condition becomes true _and_ the wait queue is woken up. Thus the loop shouldn't be necessary. Are you missing a wake_up() call to vref_waitq somewhere?
Perhaps you should replace all calls to
atomic_dec(&X->vref_count);
with something like
if (atomic_dec_and_test(&X->vref_count))
wake_up(&X->vref_waitq);??
Martin
PATCH v2 5/14 qla2xxx: Fix N2N link reset
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
Fix stalled link recovery for N2N with FC-NVMe connection
--- drivers/scsi/qla2xxx/qla_def.h | 3 +- drivers/scsi/qla2xxx/qla_init.c | 107 +++++++++++++++++++++++++++++----------- drivers/scsi/qla2xxx/qla_mbx.c | 23 +++++++-- drivers/scsi/qla2xxx/qla_os.c | 4 ++ 4 files changed, 103 insertions(+), 34 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -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 {
drivers/scsi/qla2xxx/qla_init.c +77 -30
162 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_mbx.c +20 -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,23 @@ 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 ; +if (vha->flags.nvme_enabled) + fcport->fc4f_nvme =1 ; +switch (fcport->disc_state) {case DSC_DELETED : set_bit(RELOGIN_NEEDED,
@@ -3924,7 +3933,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 +4032,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 +4042,13 @@ 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->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_os.c +4 -0
@@ -5033,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",
Signature · 1 line
2.12.0
PATCH v2 6/14 qla2xxx: Fix N2N link up fail
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
During link up/bounce, qla driver would do command flush as part of cleanup. In this case, the flush can intefere with FW state. This patch allows FW to be in control of link up.
--- drivers/scsi/qla2xxx/qla_mbx.c | 2 ++ drivers/scsi/qla2xxx/qla_os.c | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_mbx.c +2 -0
@@ -3897,6 +3897,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, 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 ;
@@ -4042,6 +4043,7 @@ 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 ];
drivers/scsi/qla2xxx/qla_os.c +2 -4
@@ -5135,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 ;
Signature · 1 line
2.12.0
PATCH v2 7/14 qla2xxx: Fix Nport ID display value
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
For N2N, the NPort ID is assigned by driver in the PLOGI ELS. According to FW Spec the byte order for SID is not the same as DID.
--- drivers/scsi/qla2xxx/qla_iocb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
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 ;
Signature · 1 line
2.12.0
Re: [PATCH v2 07/14] qla2xxx: Fix Nport ID display value
Quoted 33 lines · Himanshu Madhani
From: Quinn Tran <[email protected]>
For N2N, the NPort ID is assigned by driver in the PLOGI ELS. According to FW Spec the byte order for SID is not the same as DID.
Signed-off-by Quinn Tran <[email protected]>Signed-off-by Himanshu Madhani <[email protected]>--- drivers/scsi/qla2xxx/qla_iocb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)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 ;Signature · 1 line
2.12.0
Yes, this is correct from FW/peer N_Port standpoint.
Thanks,
Roman
PATCH v2 8/14 qla2xxx: Dual FCP-NVMe target port support
In reply to Himanshu MadhaniFrom: Michael Hernandez <[email protected]>
Some storage arrays advertise FCP LUNs and NVMe namespaces behind the same WWN. The driver now offer's a user option by way of NVRAM parameter to allow users to choose, on a per port basis, the kind of FC-4 type they would like to prioritize for login.
--- drivers/scsi/qla2xxx/qla_def.h | 26 ++++++++++++++-- drivers/scsi/qla2xxx/qla_fw.h | 2 ++ drivers/scsi/qla2xxx/qla_gs.c | 42 ++++++++++++++----------- drivers/scsi/qla2xxx/qla_init.c | 64 ++++++++++++++++++++++----------------- drivers/scsi/qla2xxx/qla_inline.h | 12 ++++++++ drivers/scsi/qla2xxx/qla_mbx.c | 11 ++++--- drivers/scsi/qla2xxx/qla_os.c | 17 +++++------ 7 files changed, 114 insertions(+), 60 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +24 -2
@@ -2277,7 +2277,7 @@ typedef struct {uint8_t fabric_port_name[WWN_SIZE ];uint16_t fp_speed;uint8_t fc4_type; -uint8_t fc4f_nvme;/* nvme fc4 feature bits */ +uint8_t fc4_features; } sw_info_t;/* FCP-4 types */
@@ -2445,7 +2445,7 @@ typedef struct fc_port {u32 supported_classes;uint8_t fc4_type; -uint8_t fc4f_nvme; +uint8_t fc4_features;uint8_t scan_state;unsigned long last_queue_full;
@@ -2476,6 +2476,9 @@ typedef struct fc_port {u16 n2n_chip_reset; } fc_port_t; +#define FC4_PRIORITY_NVME 0 +#define FC4_PRIORITY_FCP 1 +#define QLA_FCPORT_SCAN 1#define QLA_FCPORT_FOUND 2
@@ -4291,6 +4294,8 @@ struct qla_hw_data {atomic_t nvme_active_aen_cnt;uint16_t nvme_last_rptd_aen;/* Last recorded aen count */ +uint8_t fc4_type_priority; +atomic_t zio_threshold;uint16_t last_zio_threshold;
@@ -4816,6 +4821,23 @@ struct sff_8247_a0 { ha->current_topology == ISP_CFG_N || \ !ha->current_topology) +#define NVME_TYPE (fcport) \ + (fcport->fc4_type & FS_FC4TYPE_NVME) \ + +#define FCP_TYPE (fcport) \ + (fcport->fc4_type & FS_FC4TYPE_FCP) \ + +#define NVME_ONLY_TARGET (fcport) \ + (NVME_TYPE(fcport) && !FCP_TYPE(fcport)) \ + +#define NVME_FCP_TARGET (fcport) \ + (FCP_TYPE(fcport) && NVME_TYPE(fcport)) \ + +#define NVME_TARGET (ha, fcport) \ + ((NVME_FCP_TARGET(fcport) && \ + (ha->fc4_type_priority == FC4_PRIORITY_NVME)) || \ + NVME_ONLY_TARGET(fcport)) \ +#include "qla_target.h" #include "qla_gbl.h" #include "qla_dbg.h"
drivers/scsi/qla2xxx/qla_fw.h +2 -0
@@ -2101,4 +2101,6 @@ struct qla_fcp_prio_cfg {#define FA_FLASH_LAYOUT_ADDR_83 (0x3F1000/4)#define FA_FLASH_LAYOUT_ADDR_28 (0x11000/4) +#define NVRAM_DUAL_FCP_NVME_FLAG_OFFSET 0x196 +#endif
drivers/scsi/qla2xxx/qla_gs.c +25 -17
83 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_init.c +37 -27
155 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_inline.h +12 -0
@@ -307,3 +307,15 @@ qla_83xx_start_iocbs(struct qla_qpair *qpair)WRT_REG_DWORD (req->req_q_in, req->ring_index); } + +static inline int +qla2xxx_get_fc4_priority (struct scsi_qla_host *vha) +{ +uint32_t data; + + data = + ((uint8_t *)vha->hw->nvram)[NVRAM_DUAL_FCP_NVME_FLAG_OFFSET ]; + + +return ((data >>6 ) &BIT_0 ); +}
drivers/scsi/qla2xxx/qla_mbx.c +6 -5
@@ -1931,7 +1931,7 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt) pd24 = (struct port_database_24xx *) pd;/* Check for logged in state. */ -if (fcport->fc4f_nvme) { +if (NVME_TARGET (ha, fcport)) { current_login_state = pd24->current_login_state >>4 ; last_login_state = pd24->last_login_state >>4 ; }else {
@@ -3898,8 +3898,9 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, fcport->scan_state =QLA_FCPORT_FOUND ; fcport->n2n_flag =1 ; fcport->keep_nport_handle =1 ; + fcport->fc4_type =FS_FC4TYPE_FCP ;if (vha->flags.nvme_enabled) - fcport->fc4f_nvme =1 ; + fcport->fc4_type |=FS_FC4TYPE_NVME ;switch (fcport->disc_state) {case DSC_DELETED :
@@ -6361,7 +6362,7 @@ int __qla24xx_parse_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport,uint64_t zero =0 ;u8 current_login_state, last_login_state; -if (fcport->fc4f_nvme) { +if (NVME_TARGET (vha->hw, fcport)) { current_login_state = pd->current_login_state >>4 ; last_login_state = pd->last_login_state >>4 ; }else {
@@ -6396,8 +6397,8 @@ int __qla24xx_parse_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, fcport->d_id.b.al_pa = pd->port_id[2 ]; fcport->d_id.b.rsvd_1 =0 ; -if (fcport->fc4f_nvme) { - fcport->port_type =0 ; +if (NVME_TARGET (vha->hw, fcport)) { + fcport->port_type =FCT_NVME ;if ((pd->prli_svc_param_word_3[0 ] &BIT_5 ) ==0 ) fcport->port_type |=FCT_NVME_INITIATOR ;if ((pd->prli_svc_param_word_3[0 ] &BIT_4 ) ==0 )
drivers/scsi/qla2xxx/qla_os.c +8 -9
@@ -5023,19 +5023,17 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) fcport->d_id = e->u.new_sess.id; fcport->flags |=FCF_FABRIC_DEVICE ; fcport->fw_login_state =DSC_LS_PLOGI_PEND ; -if (e->u.new_sess.fc4_type ==FS_FC4TYPE_FCP ) - fcport->fc4_type =FC4_TYPE_FCP_SCSI ; - -if (e->u.new_sess.fc4_type ==FS_FC4TYPE_NVME ) { - fcport->fc4_type =FC4_TYPE_OTHER ; - fcport->fc4f_nvme =FC4_TYPE_NVME ; - }memcpy (fcport->port_name, e->u.new_sess.port_name,WWN_SIZE ); -if (e->u.new_sess.fc4_type &FS_FCP_IS_N2N ) + fcport->fc4_type = e->u.new_sess.fc4_type; +if (e->u.new_sess.fc4_type &FS_FCP_IS_N2N ) { + fcport->fc4_type =FS_FC4TYPE_FCP ; fcport->n2n_flag =1 ; +if (vha->flags.nvme_enabled) + fcport->fc4_type |=FS_FC4TYPE_NVME ; + } }else { ql_dbg(ql_dbg_disc, vha, 0xffff,
@@ -5139,7 +5137,8 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) fcport->flags &= ~FCF_FABRIC_DEVICE ; fcport->keep_nport_handle =1 ;if (vha->flags.nvme_enabled) { - fcport->fc4f_nvme =1 ; + fcport->fc4_type = + (FS_FC4TYPE_NVME |FS_FC4TYPE_FCP ); fcport->n2n_flag =1 ; } fcport->fw_login_state =0 ;
Signature · 1 line
2.12.0
Martin K. Petersen
AppliedRe: [PATCH v2 08/14] qla2xxx: Dual FCP-NVMe target port support
Himanshu,
Quoted 4 lines
Some storage arrays advertise FCP LUNs and NVMe namespaces behind the same WWN. The driver now offer's a user option by way of NVRAM parameter to allow users to choose, on a per port basis, the kind of FC-4 type they would like to prioritize for login.
Applied patches 8-14 to 5.5/scsi-queue. Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
PATCH v2 9/14 qla2xxx: Add error handling for PLOGI ELS passthrough
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
Add error handling logic to ELS Passthrough relating to NVME devices. Current code does not parse error code to take proper recovery action, instead it re-login with the same login parameters that encountered the error. Ex: nport handle collision.
--- drivers/scsi/qla2xxx/qla_iocb.c | 95 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +92 -3
@@ -2740,6 +2740,10 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)struct scsi_qla_host *vha = sp->vha;struct event_arg ea;struct qla_work_evt *e; +struct fc_port *conflict_fcport; +port_id_t cid;/* conflict Nport id */ +u32 *fw_status = sp->u.iocb_cmd.u.els_plogi.fw_status; +u16 lid; ql_dbg(ql_dbg_disc, vha, 0x3072, "%s ELS done rc %d hdl=%x, portid=%06x %8phC\n",
@@ -2751,14 +2755,99 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)if (sp->flags &SRB_WAKEUP_ON_COMP )complete (&lio->u.els_plogi.comp);else { -if (res) { -set_bit (RELOGIN_NEEDED , &vha->dpc_flags); - }else { +switch (fw_status[0 ]) { +case CS_DATA_UNDERRUN : +case CS_COMPLETE :memset (&ea,0 ,sizeof (ea)); ea.fcport = fcport; ea.data[0 ] =MBS_COMMAND_COMPLETE ; ea.sp = sp;qla24xx_handle_plogi_done_event (vha, &ea); +break ; +case CS_IOCB_ERROR : +switch (fw_status[1 ]) { +case LSC_SCODE_PORTID_USED : + lid = fw_status[2 ] &0xffff ; +qlt_find_sess_invalidate_other (vha, +wwn_to_u64 (fcport->port_name), + fcport->d_id, lid, &conflict_fcport); +if (conflict_fcport) { +/* +* Another fcport shares the same +* loop_id & nport id; conflict +* fcport needs to finish cleanup +* before this fcport can proceed +* to login. +*/ + conflict_fcport->conflict = fcport; + fcport->login_pause =1 ; +ql_dbg (ql_dbg_disc, vha,0x20ed , +"%s %d %8phC pid %06x inuse with lid %#x post gidpn\n" , + __func__, __LINE__, + fcport->port_name, + fcport->d_id.b24, lid); + }else { +ql_dbg (ql_dbg_disc, vha,0x20ed , +"%s %d %8phC pid %06x inuse with lid %#x sched del\n" , + __func__, __LINE__, + fcport->port_name, + fcport->d_id.b24, lid); +qla2x00_clear_loop_id (fcport); +set_bit (lid, vha->hw->loop_id_map); + fcport->loop_id = lid; + fcport->keep_nport_handle =0 ; +qlt_schedule_sess_for_deletion (fcport); + } +break ; + +case LSC_SCODE_NPORT_USED : + cid.b.domain = (fw_status[2 ] >>16 ) &0xff ; + cid.b.area = (fw_status[2 ] >>8 ) &0xff ; + cid.b.al_pa = fw_status[2 ] &0xff ; + cid.b.rsvd_1 =0 ; + +ql_dbg (ql_dbg_disc, vha,0x20ec , +"%s %d %8phC lid %#x in use with pid %06x post gnl\n" , + __func__, __LINE__, fcport->port_name, + fcport->loop_id, cid.b24); +set_bit (fcport->loop_id, + vha->hw->loop_id_map); + fcport->loop_id =FC_NO_LOOP_ID ; +qla24xx_post_gnl_work (vha, fcport); +break ; + +case LSC_SCODE_NOXCB : + vha->hw->exch_starvation++; +if (vha->hw->exch_starvation >5 ) { +ql_log (ql_log_warn, vha,0xd046 , +"Exchange starvation. Resetting RISC\n" ); + vha->hw->exch_starvation =0 ; +set_bit (ISP_ABORT_NEEDED , + &vha->dpc_flags); +qla2xxx_wake_dpc (vha); + } +/* fall through */ +default : +ql_dbg (ql_dbg_disc, vha,0x20eb , +"%s %8phC cmd error fw_status 0x%x 0x%x 0x%x\n" , + __func__, sp->fcport->port_name, + fw_status[0 ], fw_status[1 ], fw_status[2 ]); + + fcport->flags &= ~FCF_ASYNC_SENT ; +set_bit (RELOGIN_NEEDED , &vha->dpc_flags); +break ; + } +break ; + +default : +ql_dbg (ql_dbg_disc, vha,0x20eb , +"%s %8phC cmd error 2 fw_status 0x%x 0x%x 0x%x\n" , + __func__, sp->fcport->port_name, + fw_status[0 ], fw_status[1 ], fw_status[2 ]); + + sp->fcport->flags &= ~FCF_ASYNC_SENT ; +set_bit (RELOGIN_NEEDED , &vha->dpc_flags); +break ; } e =qla2x00_alloc_work (vha,QLA_EVT_UNMAP );
Signature · 1 line
2.12.0
PATCH v2 10/14 qla2xxx: Set remove flag for all VP
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
During driver unload, the remove flag will be set for all scsi_qla_host/NPIV. This allows each NPIV to see the flag instead of reaching for base_vha to search for it.
--- drivers/scsi/qla2xxx/qla_os.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +25 -5
@@ -3480,6 +3480,29 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)return ret; } +static void __qla_set_remove_flag (scsi_qla_host_t *base_vha) +{ +scsi_qla_host_t *vp; +unsigned long flags; +struct qla_hw_data *ha; + +if (!base_vha) +return ; + + ha = base_vha->hw; + +spin_lock_irqsave (&ha->vport_slock, flags); +list_for_each_entry (vp, &ha->vp_list, list) +set_bit (PFLG_DRIVER_REMOVING , &vp->pci_flags); + +/* +* Indicate device removal to prevent future board_disable +* and wait until any pending board_disable has completed. +*/ +set_bit (PFLG_DRIVER_REMOVING , &base_vha->pci_flags); +spin_unlock_irqrestore (&ha->vport_slock, flags); +} +static void qla2x00_shutdown (struct pci_dev *pdev) {
@@ -3496,7 +3519,7 @@ qla2x00_shutdown(struct pci_dev *pdev)* Prevent future board_disable and wait * until any pending board_disable has completed. */ -set_bit (PFLG_DRIVER_REMOVING , &vha->pci_flags); +__qla_set_remove_flag (vha);cancel_work_sync (&ha->board_disable);if (!atomic_read (&pdev->enable_cnt))
@@ -3652,10 +3675,7 @@ qla2x00_remove_one(struct pci_dev *pdev) ha = base_vha->hw;ql_log (ql_log_info, base_vha,0xb079 ,"Removing driver\n" ); - -/* Indicate device removal to prevent future board_disable and wait -* until any pending board_disable has completed. */ -set_bit (PFLG_DRIVER_REMOVING , &base_vha->pci_flags); +__qla_set_remove_flag (base_vha);cancel_work_sync (&ha->board_disable);/*
Signature · 1 line
2.12.0
PATCH v2 11/14 qla2xxx: Check for MB timeout while capturing ISP27/28xx FW dump
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
Add mailbox timeout checkout for ISP 27xx/28xx during FW dump procedure. Without the timeout check, hardware lock can be held for long period. This patch would shorten the dump procedure, if a timeout condition is encountered.
--- drivers/scsi/qla2xxx/qla_tmpl.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_tmpl.c +23 -2
@@ -10,6 +10,7 @@#define ISPREG (vha) (&(vha)->hw->iobase->isp24)#define IOBAR (reg) offsetof(typeof(*(reg)), iobase_addr)#define IOBASE (vha) IOBAR(ISPREG(vha)) +#define INVALID_ENTRY ((struct qla27xx_fwdt_entry *)0xffffffffffffffffUL)static inline void qla27xx_insert16 (uint16_t value,void *buf,ulong *len)
@@ -261,6 +262,7 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha,ulong start =le32_to_cpu (ent->t262.start_addr);ulong end =le32_to_cpu (ent->t262.end_addr);ulong dwords; +int rc;ql_dbg (ql_dbg_misc, vha,0xd206 ,"%s: rdram(%x) [%lx]\n" , __func__, ent->t262.ram_area, *len);
@@ -308,7 +310,13 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha, dwords = end - start +1 ;if (buf) { buf += *len; -qla24xx_dump_ram (vha->hw, start, buf, dwords, &buf); + rc =qla24xx_dump_ram (vha->hw, start, buf, dwords, &buf); +if (rc !=QLA_SUCCESS ) { +ql_dbg (ql_dbg_async, vha,0xffff , +"%s: dump ram MB failed. Area %xh start %lxh end %lxh\n" , + __func__, area, start, end); +return INVALID_ENTRY ; + } } *len += dwords *sizeof (uint32_t ); done:
@@ -838,6 +846,13 @@ qla27xx_walk_template(struct scsi_qla_host *vha, ent =qla27xx_find_entry (type)(vha, ent, buf, len);if (!ent)break ; + +if (ent ==INVALID_ENTRY ) { + *len =0 ; +ql_dbg (ql_dbg_async, vha,0xffff , +"Unable to capture FW dump" ); + goto bailout; + } }if (tmp->count)
@@ -847,6 +862,9 @@ qla27xx_walk_template(struct scsi_qla_host *vha,if (ent)ql_dbg (ql_dbg_misc, vha,0xd019 ,"%s: missing end entry\n" , __func__); + +bailout: +cpu_to_le32s (&tmp->count);/* endianize residual count */ } static void
@@ -1010,7 +1028,9 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) } len =qla27xx_execute_fwdt_template (vha, fwdt->template, buf); -if (len != fwdt->dump_size) { +if (len ==0 ) { + goto bailout; + }else if (len != fwdt->dump_size) {ql_log (ql_log_warn, vha,0xd013 ,"-> fwdt%u fwdump residual=%+ld\n" , j, fwdt->dump_size - len);
@@ -1025,6 +1045,7 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked)qla2x00_post_uevent_work (vha,QLA_UEVENT_CODE_FW_DUMP ); } +bailout:#ifndef __CHECKER__if (!hardware_locked)spin_unlock_irqrestore (&vha->hw->hardware_lock, flags);
Signature · 1 line
2.12.0
Re: [PATCH v2 11/14] qla2xxx: Check for MB timeout while capturing ISP27/28xx FW dump
Quoted 100 lines · Himanshu Madhani
From: Quinn Tran <[email protected]>
Add mailbox timeout checkout for ISP 27xx/28xx during FW dump procedure. Without the timeout check, hardware lock can be held for long period. This patch would shorten the dump procedure, if a timeout condition is encountered.
Signed-off-by Quinn Tran <[email protected]>Signed-off-by Himanshu Madhani <[email protected]>--- drivers/scsi/qla2xxx/qla_tmpl.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)drivers/scsi/qla2xxx/qla_tmpl.c +1
-0@@ -10,6 +10,7 @@#define ISPREG (vha) (&(vha)->hw->iobase->isp24)#define IOBAR (reg) offsetof(typeof(*(reg)), iobase_addr)#define IOBASE (vha) IOBAR(ISPREG(vha)) +#define INVALID_ENTRY ((struct qla27xx_fwdt_entry *)0xffffffffffffffffUL) static inline void
qla27xx_insert16(uint16_t value, void *buf, ulong *len)drivers/scsi/qla2xxx/qla_tmpl.c +1
-0@@ -261,6 +262,7 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha, ulong start = le32_to_cpu(ent->t262.start_addr);ulong end =le32_to_cpu (ent->t262.end_addr);ulong dwords; +int rc; ql_dbg(ql_dbg_misc, vha, 0xd206,"%s: rdram(%x) [%lx]\n",
__func__,ent->t262.ram_area,
*len);drivers/scsi/qla2xxx/qla_tmpl.c +7
-1@@ -308,7 +310,13 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha, dwords = end - start +1 ;if (buf) { buf += *len; -qla24xx_dump_ram (vha->hw, start, buf, dwords, &buf); + rc =qla24xx_dump_ram (vha->hw, start, buf, dwords, &buf); +if (rc !=QLA_SUCCESS ) { +ql_dbg (ql_dbg_async, vha,0xffff , + "%s: dump ram MB failed. Area %xh start %lxh end %lxh\n", + __func__, area, start, end); +return INVALID_ENTRY ; + }drivers/scsi/qla2xxx/qla_tmpl.c +10
-0} *len += dwords *sizeof (uint32_t ); done:@@ -838,6 +846,13 @@ qla27xx_walk_template(struct scsi_qla_host *vha, ent =qla27xx_find_entry (type)(vha, ent, buf, len);if (!ent)break ; + +if (ent ==INVALID_ENTRY ) { + *len =0 ; +ql_dbg (ql_dbg_async, vha,0xffff , +"Unable to capture FW dump" ); + goto bailout; + } }if (tmp->count)@@ -847,6 +862,9 @@ qla27xx_walk_template(struct scsi_qla_host *vha,if (ent)ql_dbg (ql_dbg_misc, vha,0xd019 ,"%s: missing end entry\n" , __func__); + +bailout: +cpu_to_le32s (&tmp->count);/* endianize residual count */ }static void
drivers/scsi/qla2xxx/qla_tmpl.c +3
-1@@ -1010,7 +1028,9 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) } len =qla27xx_execute_fwdt_template (vha, fwdt->template, buf); -if (len != fwdt->dump_size) { +if (len ==0 ) { + goto bailout; + }else if (len != fwdt->dump_size) { ql_log(ql_log_warn, vha, 0xd013, "-> fwdt%u fwdump residual=%+ld\n",drivers/scsi/qla2xxx/qla_tmpl.c +1
-0j, fwdt->dump_size - len);@@ -1025,6 +1045,7 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked)qla2x00_post_uevent_work (vha ,QLA_UEVENT_CODE_FW_DUMP ); } +bailout:#ifndef __CHECKER__if (!hardware_locked)
Quoted 1 line
spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
Being aware of this issue I reviewed it for sanity and code. I cant speak to functions that interract with the firmware though. Looks good otherwise
PATCH v2 12/14 qla2xxx: Capture FW dump on MPI heartbeat stop event
In reply to Himanshu MadhaniFrom: Quinn Tran <[email protected]>
For MPI heartbeat stop Async Event, this patch would capture MPI FW dump and chip reset. FW will tell which function to capture FW dump for.
--- drivers/scsi/qla2xxx/qla_attr.c | 4 +++- drivers/scsi/qla2xxx/qla_isr.c | 31 ++++++++++++++++++++++++++----- drivers/scsi/qla2xxx/qla_tmpl.c | 4 +++- 3 files changed, 32 insertions(+), 7 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +3 -1
@@ -102,8 +102,10 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,qla8044_idc_lock (ha);qla82xx_set_reset_owner (vha);qla8044_idc_unlock (ha); - }else + }else { + ha->fw_dump_mpi =1 ;qla2x00_system_error (vha); + }break ;case 4 :if (IS_P3P_TYPE (ha)) {
drivers/scsi/qla2xxx/qla_isr.c +26 -5
@@ -1227,11 +1227,32 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)break ;case MBA_IDC_AEN : - mb[4 ] =RD_REG_WORD (®24->mailbox4); - mb[5 ] =RD_REG_WORD (®24->mailbox5); - mb[6 ] =RD_REG_WORD (®24->mailbox6); - mb[7 ] =RD_REG_WORD (®24->mailbox7); -qla83xx_handle_8200_aen (vha, mb); +if (IS_QLA27XX (ha) ||IS_QLA28XX (ha)) { + ha->flags.fw_init_done =0 ; +ql_log (ql_log_warn, vha,0xffff , +"MPI Heartbeat stop. Chip reset needed. MB0[%xh] MB1[%xh] MB2[%xh] MB3[%xh]\n" , + mb[0 ], mb[1 ], mb[2 ], mb[3 ]); + +if ((mb[1 ] &BIT_8 ) || + (mb[2 ] &BIT_8 )) { +ql_log (ql_log_warn, vha,0xd013 , +"MPI Heartbeat stop. FW dump needed\n" ); + ha->fw_dump_mpi =1 ; + ha->isp_ops->fw_dump (vha,1 ); + } +set_bit (ISP_ABORT_NEEDED , &vha->dpc_flags); +qla2xxx_wake_dpc (vha); + }else if (IS_QLA83XX (ha)) { + mb[4 ] =RD_REG_WORD (®24->mailbox4); + mb[5 ] =RD_REG_WORD (®24->mailbox5); + mb[6 ] =RD_REG_WORD (®24->mailbox6); + mb[7 ] =RD_REG_WORD (®24->mailbox7); +qla83xx_handle_8200_aen (vha, mb); + }else { +ql_dbg (ql_dbg_async, vha,0x5052 , +"skip Heartbeat processing mb0-3=[0x%04x] [0x%04x] [0x%04x] [0x%04x]\n" , + mb[0 ], mb[1 ], mb[2 ], mb[3 ]); + }break ;case MBA_DPORT_DIAGNOSTICS :
drivers/scsi/qla2xxx/qla_tmpl.c +3 -1
@@ -1017,8 +1017,9 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked)uint j;ulong len;void *buf = vha->hw->fw_dump; +uint count = vha->hw->fw_dump_mpi ?2 :1 ; -for (j =0 ; j <2 ; j++, fwdt++, buf += len) { +for (j =0 ; j < count; j++, fwdt++, buf += len) {ql_log (ql_log_warn, vha,0xd011 ,"-> fwdt%u running...\n" , j);if (!fwdt->template) {
@@ -1046,6 +1047,7 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) } bailout: + vha->hw->fw_dump_mpi =0 ;#ifndef __CHECKER__if (!hardware_locked)spin_unlock_irqrestore (&vha->hw->hardware_lock, flags);
Signature · 1 line
2.12.0
Re: [PATCH v2 12/14] qla2xxx: Capture FW dump on MPI heartbeat stop event
Quoted 104 lines · Himanshu Madhani
From: Quinn Tran <[email protected]>
For MPI heartbeat stop Async Event, this patch would capture MPI FW dump and chip reset. FW will tell which function to capture FW dump for.
Signed-off-by Quinn Tran <[email protected]>Signed-off-by Himanshu Madhani <[email protected]>--- drivers/scsi/qla2xxx/qla_attr.c | 4 +++- drivers/scsi/qla2xxx/qla_isr.c | 31 ++++++++++++++++++++++++++----- drivers/scsi/qla2xxx/qla_tmpl.c | 4 +++- 3 files changed, 32 insertions(+), 7 deletions(-)drivers/scsi/qla2xxx/qla_attr.c +3
-1@@ -102,8 +102,10 @@ qla2x00_sysfs_write_fw_dump(struct file *filp,struct kobject *kobj,qla8044_idc_lock (ha );qla82xx_set_reset_owner (vha);qla8044_idc_unlock (ha); - }else + }else { + ha->fw_dump_mpi =1 ;qla2x00_system_error (vha); + }break ;case 4 :drivers/scsi/qla2xxx/qla_attr.c +0
-0if (IS_P3P_TYPE (ha)) {drivers/scsi/qla2xxx/qla_isr.c +24
-5@@ -1227,11 +1227,32 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) break;case MBA_IDC_AEN : - mb[4 ] =RD_REG_WORD (®24->mailbox4); - mb[5 ] =RD_REG_WORD (®24->mailbox5); - mb[6 ] =RD_REG_WORD (®24->mailbox6); - mb[7 ] =RD_REG_WORD (®24->mailbox7); -qla83xx_handle_8200_aen (vha, mb); +if (IS_QLA27XX (ha) ||IS_QLA28XX (ha)) { + ha->flags.fw_init_done =0 ; +ql_log (ql_log_warn, vha,0xffff , + "MPI Heartbeat stop. Chip reset needed. MB0[%xh] MB1[%xh] MB2[%xh] MB3[%xh]\n", + mb[0 ], mb[1 ], mb[2 ], mb[3 ]); + +if ((mb[1 ] &BIT_8 ) || + (mb[2 ] &BIT_8 )) { +ql_log (ql_log_warn, vha,0xd013 , +"MPI Heartbeat stop. FW dump needed\n"); + ha->fw_dump_mpi =1 ; + ha->isp_ops->fw_dump (vha,1 ); + } +set_bit (ISP_ABORT_NEEDED , &vha->dpc_flags); +qla2xxx_wake_dpc (vha); + }else if (IS_QLA83XX (ha)) { + mb[4 ] =RD_REG_WORD (®24->mailbox4); + mb[5 ] =RD_REG_WORD (®24->mailbox5); + mb[6 ] =RD_REG_WORD (®24->mailbox6); + mb[7 ] =RD_REG_WORD (®24->mailbox7); +qla83xx_handle_8200_aen (vha, mb); + }else { + ql_dbg(ql_dbg_async, vha, 0x5052, + "skip Heartbeat processing mb0-3=[0x%04x][0x%04x] [0x%04x] [0x%04x]\n",
drivers/scsi/qla2xxx/qla_isr.c +2
-0+ mb[0], mb[1], mb[2], mb[3]); + }break ;case MBA_DPORT_DIAGNOSTICS :drivers/scsi/qla2xxx/qla_tmpl.c +2
-1@@ -1017,8 +1017,9 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) uint j;ulong len;void *buf = vha->hw->fw_dump; +uint count = vha->hw->fw_dump_mpi ?2 :1 ; -for (j =0 ; j <2 ; j++, fwdt++, buf += len) { +for (j =0 ; j < count; j++, fwdt++, buf += len) {ql_log (ql_log_warn, vha,0xd011 ,"-> fwdt%u running...\n" , j);drivers/scsi/qla2xxx/qla_tmpl.c +1
-0if (!fwdt->template) {@@ -1046,6 +1047,7 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) } bailout: + vha->hw->fw_dump_mpi =0 ;#ifndef __CHECKER__if (!hardware_locked)
Quoted 1 line
spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
Being aware of this issue I reviewed it for sanity and code. I cant speak to functions that interract with the firmware though. Looks good otherwise
PATCH v2 13/14 qla2xxx: Improve logging for scan thread
In reply to Himanshu Madhanimove messages to verbose logging for scan thread
--- drivers/scsi/qla2xxx/qla_gs.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +12 -10
@@ -3571,7 +3571,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)u8 recheck =0 ;u16 dup =0 , dup_cnt =0 ; -ql_dbg (ql_dbg_disc, vha,0xffff , +ql_dbg (ql_dbg_disc + ql_dbg_verbose, vha,0xffff ,"%s enter\n" , __func__);if (sp->gen1 != vha->hw->base_qpair->chip_reset) {
@@ -3588,8 +3588,9 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)set_bit (LOCAL_LOOP_UPDATE , &vha->dpc_flags);set_bit (LOOP_RESYNC_NEEDED , &vha->dpc_flags); }else { -ql_dbg (ql_dbg_disc, vha,0xffff , -"Fabric scan failed on all retries.\n" ); +ql_dbg (ql_dbg_disc + ql_dbg_verbose, vha,0xffff , +"%s: Fabric scan failed for %d retries.\n" , + __func__, vha->scan.scan_retry); } goto out; }
@@ -4055,7 +4056,7 @@ static int qla24xx_async_gnnft(scsi_qla_host_t *vha, struct srb *sp,void qla24xx_async_gpnft_done (scsi_qla_host_t *vha,srb_t *sp) { -ql_dbg (ql_dbg_disc, vha,0xffff , +ql_dbg (ql_dbg_disc + ql_dbg_verbose, vha,0xffff ,"%s enter\n" , __func__);qla24xx_async_gnnft (vha, sp, sp->gen2); }
@@ -4069,7 +4070,7 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)u32 rspsz;unsigned long flags; -ql_dbg (ql_dbg_disc, vha,0xffff , +ql_dbg (ql_dbg_disc + ql_dbg_verbose, vha,0xffff ,"%s enter\n" , __func__);if (!vha->flags.online)
@@ -4078,14 +4079,15 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)spin_lock_irqsave (&vha->work_lock, flags);if (vha->scan.scan_flags &SF_SCANNING ) {spin_unlock_irqrestore (&vha->work_lock, flags); -ql_dbg (ql_dbg_disc, vha,0xffff ,"scan active\n" ); +ql_dbg (ql_dbg_disc + ql_dbg_verbose, vha,0xffff , +"%s: scan active\n" , __func__);return rval; } vha->scan.scan_flags |=SF_SCANNING ;spin_unlock_irqrestore (&vha->work_lock, flags);if (fc4_type ==FC4_TYPE_FCP_SCSI ) { -ql_dbg (ql_dbg_disc, vha,0xffff , +ql_dbg (ql_dbg_disc + ql_dbg_verbose, vha,0xffff ,"%s: Performing FCP Scan\n" , __func__);if (sp)
@@ -4140,7 +4142,7 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp) } sp->u.iocb_cmd.u.ctarg.rsp_size = rspsz; -ql_dbg (ql_dbg_disc, vha,0xffff , +ql_dbg (ql_dbg_disc + ql_dbg_verbose, vha,0xffff ,"%s scan list size %d\n" , __func__, vha->scan.size);memset (vha->scan.l,0 , vha->scan.size);
@@ -4205,8 +4207,8 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)spin_lock_irqsave (&vha->work_lock, flags); vha->scan.scan_flags &= ~SF_SCANNING ;if (vha->scan.scan_flags ==0 ) { -ql_dbg (ql_dbg_disc, vha,0xffff , -"%s: schedule\n" , __func__); +ql_dbg (ql_dbg_disc + ql_dbg_verbose, vha,0xffff , +"%s: Scan scheduled.\n" , __func__); vha->scan.scan_flags |=SF_QUEUED ;schedule_delayed_work (&vha->scan.scan_work,5 ); }
Signature · 1 line
2.12.0
PATCH v2 14/14 qla2xxx: Update driver version to 10.01.00.20-k
In reply to Himanshu Madhani--- drivers/scsi/qla2xxx/qla_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_version.h +1 -1
@@ -7,7 +7,7 @@/* * Driver version */ -#define QLA2XXX_VERSION "10.01.00.19-k" +#define QLA2XXX_VERSION "10.01.00.20-k"#define QLA_DRIVER_MAJOR_VER 10#define QLA_DRIVER_MINOR_VER 1
Signature · 1 line
2.12.0
Himanshu,
Quoted 8 lines
This series has fixes for N2N handling and unload path for driver when NPIV is configured. Also included are patches for capturing firmware dump when firmware posts MPI heartbeat stop event. We have also enhanced handling of FCP/FC-NVMe when target advertises both capabilites under same WWNN.
Please apply this series for 5.4/scsi-queue at your earliest convenience.
This came in too late for 5.4. I applied patches #1-7 to fixes. Patch #8 and beyond are more like features and will have to wait for 5.5.
Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering