]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
scsi: qla2xxx: Split FCE|EFT trace control
authorQuinn Tran <qutran@marvell.com>
Tue, 27 Feb 2024 16:41:19 +0000 (22:11 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:33 +0000 (16:19 +0200)
commit 76a192e1a566e15365704b9f8fb3b70825f85064 upstream.

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: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20240227164127.36465-4-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/qla2xxx/qla_init.c

index 8574cd235da366fd12abbd60795bb181acb1ecd1..733a51c46c7bfcc7582ab5b73eb38ffa9b45e4db 100644 (file)
@@ -2671,6 +2671,40 @@ exit:
        return rval;
 }
 
+static void qla_enable_fce_trace(scsi_qla_host_t *vha)
+{
+       int rval;
+       struct qla_hw_data *ha = vha->hw;
+
+       if (ha->fce) {
+               ha->flags.fce_enabled = 1;
+               memset(ha->fce, 0, fce_calc_size(ha->fce_bufs));
+               rval = qla2x00_enable_fce_trace(vha,
+                   ha->fce_dma, ha->fce_bufs, ha->fce_mb, &ha->fce_bufs);
+
+               if (rval) {
+                       ql_log(ql_log_warn, vha, 0x8033,
+                           "Unable to reinitialize FCE (%d).\n", rval);
+                       ha->flags.fce_enabled = 0;
+               }
+       }
+}
+
+static void qla_enable_eft_trace(scsi_qla_host_t *vha)
+{
+       int rval;
+       struct qla_hw_data *ha = vha->hw;
+
+       if (ha->eft) {
+               memset(ha->eft, 0, EFT_SIZE);
+               rval = qla2x00_enable_eft_trace(vha, ha->eft_dma, EFT_NUM_BUFFERS);
+
+               if (rval) {
+                       ql_log(ql_log_warn, vha, 0x8034,
+                           "Unable to reinitialize EFT (%d).\n", rval);
+               }
+       }
+}
 /*
 * qla2x00_initialize_adapter
 *      Initialize board.
@@ -3674,9 +3708,8 @@ qla24xx_chip_diag(scsi_qla_host_t *vha)
 }
 
 static void
-qla2x00_init_fce_trace(scsi_qla_host_t *vha)
+qla2x00_alloc_fce_trace(scsi_qla_host_t *vha)
 {
-       int rval;
        dma_addr_t tc_dma;
        void *tc;
        struct qla_hw_data *ha = vha->hw;
@@ -3705,27 +3738,17 @@ qla2x00_init_fce_trace(scsi_qla_host_t *vha)
                return;
        }
 
-       rval = qla2x00_enable_fce_trace(vha, tc_dma, FCE_NUM_BUFFERS,
-                                       ha->fce_mb, &ha->fce_bufs);
-       if (rval) {
-               ql_log(ql_log_warn, vha, 0x00bf,
-                      "Unable to initialize FCE (%d).\n", rval);
-               dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, tc_dma);
-               return;
-       }
-
        ql_dbg(ql_dbg_init, vha, 0x00c0,
               "Allocated (%d KB) for FCE...\n", FCE_SIZE / 1024);
 
-       ha->flags.fce_enabled = 1;
        ha->fce_dma = tc_dma;
        ha->fce = tc;
+       ha->fce_bufs = FCE_NUM_BUFFERS;
 }
 
 static void
-qla2x00_init_eft_trace(scsi_qla_host_t *vha)
+qla2x00_alloc_eft_trace(scsi_qla_host_t *vha)
 {
-       int rval;
        dma_addr_t tc_dma;
        void *tc;
        struct qla_hw_data *ha = vha->hw;
@@ -3750,14 +3773,6 @@ qla2x00_init_eft_trace(scsi_qla_host_t *vha)
                return;
        }
 
-       rval = qla2x00_enable_eft_trace(vha, tc_dma, EFT_NUM_BUFFERS);
-       if (rval) {
-               ql_log(ql_log_warn, vha, 0x00c2,
-                      "Unable to initialize EFT (%d).\n", rval);
-               dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, tc_dma);
-               return;
-       }
-
        ql_dbg(ql_dbg_init, vha, 0x00c3,
               "Allocated (%d KB) EFT ...\n", EFT_SIZE / 1024);
 
@@ -3765,13 +3780,6 @@ qla2x00_init_eft_trace(scsi_qla_host_t *vha)
        ha->eft = tc;
 }
 
-static void
-qla2x00_alloc_offload_mem(scsi_qla_host_t *vha)
-{
-       qla2x00_init_fce_trace(vha);
-       qla2x00_init_eft_trace(vha);
-}
-
 void
 qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
 {
@@ -3826,10 +3834,10 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
                if (ha->tgt.atio_ring)
                        mq_size += ha->tgt.atio_q_length * sizeof(request_t);
 
-               qla2x00_init_fce_trace(vha);
+               qla2x00_alloc_fce_trace(vha);
                if (ha->fce)
                        fce_size = sizeof(struct qla2xxx_fce_chain) + FCE_SIZE;
-               qla2x00_init_eft_trace(vha);
+               qla2x00_alloc_eft_trace(vha);
                if (ha->eft)
                        eft_size = EFT_SIZE;
        }
@@ -4259,7 +4267,6 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
        struct qla_hw_data *ha = vha->hw;
        struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
        unsigned long flags;
-       uint16_t fw_major_version;
        int done_once = 0;
 
        if (IS_P3P_TYPE(ha)) {
@@ -4326,7 +4333,6 @@ execute_fw_with_lr:
                                        goto failed;
 
 enable_82xx_npiv:
-                               fw_major_version = ha->fw_major_version;
                                if (IS_P3P_TYPE(ha))
                                        qla82xx_check_md_needed(vha);
                                else
@@ -4355,12 +4361,11 @@ enable_82xx_npiv:
                                if (rval != QLA_SUCCESS)
                                        goto failed;
 
-                               if (!fw_major_version && !(IS_P3P_TYPE(ha)))
-                                       qla2x00_alloc_offload_mem(vha);
-
                                if (ql2xallocfwdump && !(IS_P3P_TYPE(ha)))
                                        qla2x00_alloc_fw_dump(vha);
 
+                               qla_enable_fce_trace(vha);
+                               qla_enable_eft_trace(vha);
                        } else {
                                goto failed;
                        }
@@ -7572,7 +7577,6 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
 int
 qla2x00_abort_isp(scsi_qla_host_t *vha)
 {
-       int rval;
        uint8_t        status = 0;
        struct qla_hw_data *ha = vha->hw;
        struct scsi_qla_host *vp, *tvp;
@@ -7663,31 +7667,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
 
                        if (IS_QLA81XX(ha) || IS_QLA8031(ha))
                                qla2x00_get_fw_version(vha);
-                       if (ha->fce) {
-                               ha->flags.fce_enabled = 1;
-                               memset(ha->fce, 0,
-                                   fce_calc_size(ha->fce_bufs));
-                               rval = qla2x00_enable_fce_trace(vha,
-                                   ha->fce_dma, ha->fce_bufs, ha->fce_mb,
-                                   &ha->fce_bufs);
-                               if (rval) {
-                                       ql_log(ql_log_warn, vha, 0x8033,
-                                           "Unable to reinitialize FCE "
-                                           "(%d).\n", rval);
-                                       ha->flags.fce_enabled = 0;
-                               }
-                       }
 
-                       if (ha->eft) {
-                               memset(ha->eft, 0, EFT_SIZE);
-                               rval = qla2x00_enable_eft_trace(vha,
-                                   ha->eft_dma, EFT_NUM_BUFFERS);
-                               if (rval) {
-                                       ql_log(ql_log_warn, vha, 0x8034,
-                                           "Unable to reinitialize EFT "
-                                           "(%d).\n", rval);
-                               }
-                       }
                } else {        /* failed the ISP abort */
                        vha->flags.online = 1;
                        if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {