Skip to content

Commit 76a192e

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
scsi: qla2xxx: Split FCE|EFT trace control
Current code combines the allocation of FCE|EFT trace buffers and enables the features all in 1 step. Split this step into separate steps in preparation for follow-on patch to allow user to have a choice to enable / disable FCE trace feature. Cc: [email protected] Reported-by: kernel test robot <[email protected]> Signed-off-by: Quinn Tran <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 881eb86 commit 76a192e

File tree

1 file changed

+41
-61
lines changed

1 file changed

+41
-61
lines changed

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 41 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,6 +2669,40 @@ qla83xx_nic_core_fw_load(scsi_qla_host_t *vha)
26692669
return rval;
26702670
}
26712671

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+
}
26722706
/*
26732707
* qla2x00_initialize_adapter
26742708
* Initialize board.
@@ -3672,9 +3706,8 @@ qla24xx_chip_diag(scsi_qla_host_t *vha)
36723706
}
36733707

36743708
static void
3675-
qla2x00_init_fce_trace(scsi_qla_host_t *vha)
3709+
qla2x00_alloc_fce_trace(scsi_qla_host_t *vha)
36763710
{
3677-
int rval;
36783711
dma_addr_t tc_dma;
36793712
void *tc;
36803713
struct qla_hw_data *ha = vha->hw;
@@ -3703,27 +3736,17 @@ qla2x00_init_fce_trace(scsi_qla_host_t *vha)
37033736
return;
37043737
}
37053738

3706-
rval = qla2x00_enable_fce_trace(vha, tc_dma, FCE_NUM_BUFFERS,
3707-
ha->fce_mb, &ha->fce_bufs);
3708-
if (rval) {
3709-
ql_log(ql_log_warn, vha, 0x00bf,
3710-
"Unable to initialize FCE (%d).\n", rval);
3711-
dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, tc_dma);
3712-
return;
3713-
}
3714-
37153739
ql_dbg(ql_dbg_init, vha, 0x00c0,
37163740
"Allocated (%d KB) for FCE...\n", FCE_SIZE / 1024);
37173741

3718-
ha->flags.fce_enabled = 1;
37193742
ha->fce_dma = tc_dma;
37203743
ha->fce = tc;
3744+
ha->fce_bufs = FCE_NUM_BUFFERS;
37213745
}
37223746

37233747
static void
3724-
qla2x00_init_eft_trace(scsi_qla_host_t *vha)
3748+
qla2x00_alloc_eft_trace(scsi_qla_host_t *vha)
37253749
{
3726-
int rval;
37273750
dma_addr_t tc_dma;
37283751
void *tc;
37293752
struct qla_hw_data *ha = vha->hw;
@@ -3748,28 +3771,13 @@ qla2x00_init_eft_trace(scsi_qla_host_t *vha)
37483771
return;
37493772
}
37503773

3751-
rval = qla2x00_enable_eft_trace(vha, tc_dma, EFT_NUM_BUFFERS);
3752-
if (rval) {
3753-
ql_log(ql_log_warn, vha, 0x00c2,
3754-
"Unable to initialize EFT (%d).\n", rval);
3755-
dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, tc_dma);
3756-
return;
3757-
}
3758-
37593774
ql_dbg(ql_dbg_init, vha, 0x00c3,
37603775
"Allocated (%d KB) EFT ...\n", EFT_SIZE / 1024);
37613776

37623777
ha->eft_dma = tc_dma;
37633778
ha->eft = tc;
37643779
}
37653780

3766-
static void
3767-
qla2x00_alloc_offload_mem(scsi_qla_host_t *vha)
3768-
{
3769-
qla2x00_init_fce_trace(vha);
3770-
qla2x00_init_eft_trace(vha);
3771-
}
3772-
37733781
void
37743782
qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
37753783
{
@@ -3824,10 +3832,10 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
38243832
if (ha->tgt.atio_ring)
38253833
mq_size += ha->tgt.atio_q_length * sizeof(request_t);
38263834

3827-
qla2x00_init_fce_trace(vha);
3835+
qla2x00_alloc_fce_trace(vha);
38283836
if (ha->fce)
38293837
fce_size = sizeof(struct qla2xxx_fce_chain) + FCE_SIZE;
3830-
qla2x00_init_eft_trace(vha);
3838+
qla2x00_alloc_eft_trace(vha);
38313839
if (ha->eft)
38323840
eft_size = EFT_SIZE;
38333841
}
@@ -4257,7 +4265,6 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
42574265
struct qla_hw_data *ha = vha->hw;
42584266
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
42594267
unsigned long flags;
4260-
uint16_t fw_major_version;
42614268
int done_once = 0;
42624269

42634270
if (IS_P3P_TYPE(ha)) {
@@ -4324,7 +4331,6 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
43244331
goto failed;
43254332

43264333
enable_82xx_npiv:
4327-
fw_major_version = ha->fw_major_version;
43284334
if (IS_P3P_TYPE(ha))
43294335
qla82xx_check_md_needed(vha);
43304336
else
@@ -4353,12 +4359,11 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
43534359
if (rval != QLA_SUCCESS)
43544360
goto failed;
43554361

4356-
if (!fw_major_version && !(IS_P3P_TYPE(ha)))
4357-
qla2x00_alloc_offload_mem(vha);
4358-
43594362
if (ql2xallocfwdump && !(IS_P3P_TYPE(ha)))
43604363
qla2x00_alloc_fw_dump(vha);
43614364

4365+
qla_enable_fce_trace(vha);
4366+
qla_enable_eft_trace(vha);
43624367
} else {
43634368
goto failed;
43644369
}
@@ -7491,7 +7496,6 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
74917496
int
74927497
qla2x00_abort_isp(scsi_qla_host_t *vha)
74937498
{
7494-
int rval;
74957499
uint8_t status = 0;
74967500
struct qla_hw_data *ha = vha->hw;
74977501
struct scsi_qla_host *vp, *tvp;
@@ -7585,31 +7589,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
75857589

75867590
if (IS_QLA81XX(ha) || IS_QLA8031(ha))
75877591
qla2x00_get_fw_version(vha);
7588-
if (ha->fce) {
7589-
ha->flags.fce_enabled = 1;
7590-
memset(ha->fce, 0,
7591-
fce_calc_size(ha->fce_bufs));
7592-
rval = qla2x00_enable_fce_trace(vha,
7593-
ha->fce_dma, ha->fce_bufs, ha->fce_mb,
7594-
&ha->fce_bufs);
7595-
if (rval) {
7596-
ql_log(ql_log_warn, vha, 0x8033,
7597-
"Unable to reinitialize FCE "
7598-
"(%d).\n", rval);
7599-
ha->flags.fce_enabled = 0;
7600-
}
7601-
}
76027592

7603-
if (ha->eft) {
7604-
memset(ha->eft, 0, EFT_SIZE);
7605-
rval = qla2x00_enable_eft_trace(vha,
7606-
ha->eft_dma, EFT_NUM_BUFFERS);
7607-
if (rval) {
7608-
ql_log(ql_log_warn, vha, 0x8034,
7609-
"Unable to reinitialize EFT "
7610-
"(%d).\n", rval);
7611-
}
7612-
}
76137593
} else { /* failed the ISP abort */
76147594
vha->flags.online = 1;
76157595
if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {

0 commit comments

Comments
 (0)