Skip to content

Commit 48c0b76

Browse files
Merge patch series "qla2xxx misc. bug fixes"
Nilesh Javali <[email protected]> says: Please apply the qla2xxx driver miscellaneous bug fixes to the scsi tree at your earliest convenience. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 16cc2ba + b8260ca commit 48c0b76

File tree

9 files changed

+138
-95
lines changed

9 files changed

+138
-95
lines changed

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,7 +2741,13 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
27412741
return;
27422742

27432743
if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) {
2744-
qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16);
2744+
/* Will wait for wind down of adapter */
2745+
ql_dbg(ql_dbg_aer, fcport->vha, 0x900c,
2746+
"%s pci offline detected (id %06x)\n", __func__,
2747+
fcport->d_id.b24);
2748+
qla_pci_set_eeh_busy(fcport->vha);
2749+
qla2x00_eh_wait_for_pending_commands(fcport->vha, fcport->d_id.b24,
2750+
0, WAIT_TARGET);
27452751
return;
27462752
}
27472753
}
@@ -2763,7 +2769,11 @@ qla2x00_terminate_rport_io(struct fc_rport *rport)
27632769
vha = fcport->vha;
27642770

27652771
if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) {
2766-
qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16);
2772+
/* Will wait for wind down of adapter */
2773+
ql_dbg(ql_dbg_aer, fcport->vha, 0x900b,
2774+
"%s pci offline detected (id %06x)\n", __func__,
2775+
fcport->d_id.b24);
2776+
qla_pci_set_eeh_busy(vha);
27672777
qla2x00_eh_wait_for_pending_commands(fcport->vha, fcport->d_id.b24,
27682778
0, WAIT_TARGET);
27692779
return;

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ typedef union {
8282
#include "qla_nvme.h"
8383
#define QLA2XXX_DRIVER_NAME "qla2xxx"
8484
#define QLA2XXX_APIDEV "ql2xapidev"
85-
#define QLA2XXX_MANUFACTURER "Marvell Semiconductor, Inc."
85+
#define QLA2XXX_MANUFACTURER "Marvell"
8686

8787
/*
8888
* We have MAILBOX_REGISTER_COUNT sized arrays in a few places,

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *);
4444
extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *);
4545

4646
extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t);
47-
extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool);
47+
extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *);
4848
extern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha,
4949
struct els_plogi *els_plogi);
5050

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,8 +1193,12 @@ int qla24xx_async_gnl(struct scsi_qla_host *vha, fc_port_t *fcport)
11931193
return rval;
11941194

11951195
done_free_sp:
1196-
/* ref: INIT */
1197-
kref_put(&sp->cmd_kref, qla2x00_sp_release);
1196+
/*
1197+
* use qla24xx_async_gnl_sp_done to purge all pending gnl request.
1198+
* kref_put is call behind the scene.
1199+
*/
1200+
sp->u.iocb_cmd.u.mbx.in_mb[0] = MBS_COMMAND_ERROR;
1201+
qla24xx_async_gnl_sp_done(sp, QLA_COMMAND_ERROR);
11981202
fcport->flags &= ~(FCF_ASYNC_SENT);
11991203
done:
12001204
fcport->flags &= ~(FCF_ASYNC_ACTIVE);
@@ -2665,6 +2669,40 @@ qla83xx_nic_core_fw_load(scsi_qla_host_t *vha)
26652669
return rval;
26662670
}
26672671

2672+
static void qla_enable_fce_trace(scsi_qla_host_t *vha)
2673+
{
2674+
int rval;
2675+
struct qla_hw_data *ha = vha->hw;
2676+
2677+
if (ha->fce) {
2678+
ha->flags.fce_enabled = 1;
2679+
memset(ha->fce, 0, fce_calc_size(ha->fce_bufs));
2680+
rval = qla2x00_enable_fce_trace(vha,
2681+
ha->fce_dma, ha->fce_bufs, ha->fce_mb, &ha->fce_bufs);
2682+
2683+
if (rval) {
2684+
ql_log(ql_log_warn, vha, 0x8033,
2685+
"Unable to reinitialize FCE (%d).\n", rval);
2686+
ha->flags.fce_enabled = 0;
2687+
}
2688+
}
2689+
}
2690+
2691+
static void qla_enable_eft_trace(scsi_qla_host_t *vha)
2692+
{
2693+
int rval;
2694+
struct qla_hw_data *ha = vha->hw;
2695+
2696+
if (ha->eft) {
2697+
memset(ha->eft, 0, EFT_SIZE);
2698+
rval = qla2x00_enable_eft_trace(vha, ha->eft_dma, EFT_NUM_BUFFERS);
2699+
2700+
if (rval) {
2701+
ql_log(ql_log_warn, vha, 0x8034,
2702+
"Unable to reinitialize EFT (%d).\n", rval);
2703+
}
2704+
}
2705+
}
26682706
/*
26692707
* qla2x00_initialize_adapter
26702708
* Initialize board.
@@ -3668,9 +3706,8 @@ qla24xx_chip_diag(scsi_qla_host_t *vha)
36683706
}
36693707

36703708
static void
3671-
qla2x00_init_fce_trace(scsi_qla_host_t *vha)
3709+
qla2x00_alloc_fce_trace(scsi_qla_host_t *vha)
36723710
{
3673-
int rval;
36743711
dma_addr_t tc_dma;
36753712
void *tc;
36763713
struct qla_hw_data *ha = vha->hw;
@@ -3699,27 +3736,17 @@ qla2x00_init_fce_trace(scsi_qla_host_t *vha)
36993736
return;
37003737
}
37013738

3702-
rval = qla2x00_enable_fce_trace(vha, tc_dma, FCE_NUM_BUFFERS,
3703-
ha->fce_mb, &ha->fce_bufs);
3704-
if (rval) {
3705-
ql_log(ql_log_warn, vha, 0x00bf,
3706-
"Unable to initialize FCE (%d).\n", rval);
3707-
dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, tc_dma);
3708-
return;
3709-
}
3710-
37113739
ql_dbg(ql_dbg_init, vha, 0x00c0,
37123740
"Allocated (%d KB) for FCE...\n", FCE_SIZE / 1024);
37133741

3714-
ha->flags.fce_enabled = 1;
37153742
ha->fce_dma = tc_dma;
37163743
ha->fce = tc;
3744+
ha->fce_bufs = FCE_NUM_BUFFERS;
37173745
}
37183746

37193747
static void
3720-
qla2x00_init_eft_trace(scsi_qla_host_t *vha)
3748+
qla2x00_alloc_eft_trace(scsi_qla_host_t *vha)
37213749
{
3722-
int rval;
37233750
dma_addr_t tc_dma;
37243751
void *tc;
37253752
struct qla_hw_data *ha = vha->hw;
@@ -3744,28 +3771,13 @@ qla2x00_init_eft_trace(scsi_qla_host_t *vha)
37443771
return;
37453772
}
37463773

3747-
rval = qla2x00_enable_eft_trace(vha, tc_dma, EFT_NUM_BUFFERS);
3748-
if (rval) {
3749-
ql_log(ql_log_warn, vha, 0x00c2,
3750-
"Unable to initialize EFT (%d).\n", rval);
3751-
dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, tc_dma);
3752-
return;
3753-
}
3754-
37553774
ql_dbg(ql_dbg_init, vha, 0x00c3,
37563775
"Allocated (%d KB) EFT ...\n", EFT_SIZE / 1024);
37573776

37583777
ha->eft_dma = tc_dma;
37593778
ha->eft = tc;
37603779
}
37613780

3762-
static void
3763-
qla2x00_alloc_offload_mem(scsi_qla_host_t *vha)
3764-
{
3765-
qla2x00_init_fce_trace(vha);
3766-
qla2x00_init_eft_trace(vha);
3767-
}
3768-
37693781
void
37703782
qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
37713783
{
@@ -3820,10 +3832,10 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
38203832
if (ha->tgt.atio_ring)
38213833
mq_size += ha->tgt.atio_q_length * sizeof(request_t);
38223834

3823-
qla2x00_init_fce_trace(vha);
3835+
qla2x00_alloc_fce_trace(vha);
38243836
if (ha->fce)
38253837
fce_size = sizeof(struct qla2xxx_fce_chain) + FCE_SIZE;
3826-
qla2x00_init_eft_trace(vha);
3838+
qla2x00_alloc_eft_trace(vha);
38273839
if (ha->eft)
38283840
eft_size = EFT_SIZE;
38293841
}
@@ -4253,7 +4265,6 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
42534265
struct qla_hw_data *ha = vha->hw;
42544266
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
42554267
unsigned long flags;
4256-
uint16_t fw_major_version;
42574268
int done_once = 0;
42584269

42594270
if (IS_P3P_TYPE(ha)) {
@@ -4320,7 +4331,6 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
43204331
goto failed;
43214332

43224333
enable_82xx_npiv:
4323-
fw_major_version = ha->fw_major_version;
43244334
if (IS_P3P_TYPE(ha))
43254335
qla82xx_check_md_needed(vha);
43264336
else
@@ -4349,12 +4359,11 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
43494359
if (rval != QLA_SUCCESS)
43504360
goto failed;
43514361

4352-
if (!fw_major_version && !(IS_P3P_TYPE(ha)))
4353-
qla2x00_alloc_offload_mem(vha);
4354-
43554362
if (ql2xallocfwdump && !(IS_P3P_TYPE(ha)))
43564363
qla2x00_alloc_fw_dump(vha);
43574364

4365+
qla_enable_fce_trace(vha);
4366+
qla_enable_eft_trace(vha);
43584367
} else {
43594368
goto failed;
43604369
}
@@ -7487,12 +7496,12 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
74877496
int
74887497
qla2x00_abort_isp(scsi_qla_host_t *vha)
74897498
{
7490-
int rval;
74917499
uint8_t status = 0;
74927500
struct qla_hw_data *ha = vha->hw;
74937501
struct scsi_qla_host *vp, *tvp;
74947502
struct req_que *req = ha->req_q_map[0];
74957503
unsigned long flags;
7504+
fc_port_t *fcport;
74967505

74977506
if (vha->flags.online) {
74987507
qla2x00_abort_isp_cleanup(vha);
@@ -7561,6 +7570,15 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
75617570
"ISP Abort - ISP reg disconnect post nvmram config, exiting.\n");
75627571
return status;
75637572
}
7573+
7574+
/* User may have updated [fcp|nvme] prefer in flash */
7575+
list_for_each_entry(fcport, &vha->vp_fcports, list) {
7576+
if (NVME_PRIORITY(ha, fcport))
7577+
fcport->do_prli_nvme = 1;
7578+
else
7579+
fcport->do_prli_nvme = 0;
7580+
}
7581+
75647582
if (!qla2x00_restart_isp(vha)) {
75657583
clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags);
75667584

@@ -7581,31 +7599,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
75817599

75827600
if (IS_QLA81XX(ha) || IS_QLA8031(ha))
75837601
qla2x00_get_fw_version(vha);
7584-
if (ha->fce) {
7585-
ha->flags.fce_enabled = 1;
7586-
memset(ha->fce, 0,
7587-
fce_calc_size(ha->fce_bufs));
7588-
rval = qla2x00_enable_fce_trace(vha,
7589-
ha->fce_dma, ha->fce_bufs, ha->fce_mb,
7590-
&ha->fce_bufs);
7591-
if (rval) {
7592-
ql_log(ql_log_warn, vha, 0x8033,
7593-
"Unable to reinitialize FCE "
7594-
"(%d).\n", rval);
7595-
ha->flags.fce_enabled = 0;
7596-
}
7597-
}
75987602

7599-
if (ha->eft) {
7600-
memset(ha->eft, 0, EFT_SIZE);
7601-
rval = qla2x00_enable_eft_trace(vha,
7602-
ha->eft_dma, EFT_NUM_BUFFERS);
7603-
if (rval) {
7604-
ql_log(ql_log_warn, vha, 0x8034,
7605-
"Unable to reinitialize EFT "
7606-
"(%d).\n", rval);
7607-
}
7608-
}
76097603
} else { /* failed the ISP abort */
76107604
vha->flags.online = 1;
76117605
if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
@@ -7655,6 +7649,14 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
76557649
atomic_inc(&vp->vref_count);
76567650
spin_unlock_irqrestore(&ha->vport_slock, flags);
76577651

7652+
/* User may have updated [fcp|nvme] prefer in flash */
7653+
list_for_each_entry(fcport, &vp->vp_fcports, list) {
7654+
if (NVME_PRIORITY(ha, fcport))
7655+
fcport->do_prli_nvme = 1;
7656+
else
7657+
fcport->do_prli_nvme = 0;
7658+
}
7659+
76587660
qla2x00_vp_abort_isp(vp);
76597661

76607662
spin_lock_irqsave(&ha->vport_slock, flags);

0 commit comments

Comments
 (0)