From patchwork Fri Aug 26 10:25:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 600699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B872BECAAD5 for ; Fri, 26 Aug 2022 10:26:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343680AbiHZK00 (ORCPT ); Fri, 26 Aug 2022 06:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245175AbiHZK0W (ORCPT ); Fri, 26 Aug 2022 06:26:22 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A651BCCE38 for ; Fri, 26 Aug 2022 03:26:21 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27Q6TUeM001371 for ; Fri, 26 Aug 2022 03:26:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=RmF61vHP3111WNpuYDtji5b78W9LtHyzT1foJ4J3+iI=; b=BuvXOqPw/reSu4G8JM9Ahu0F8CNaecN7aYw26DOjrvV2qTVkroJS6HqfhmmRDET6LwT9 8/gTFGIXto4EQTmMO7sPv0whaT8lX8woylVVpwuDJ1IRyI2NIGPggwDH5V5UYOF6nXdO Q9GaVRUIsCXMSAUHBZ0FYYWBb5xgKJRikhnyKQzB9Qk3rRhz1TX0AmaP28olxMejQHNW ytHFxQQZ2vVPNvGzu5BsaaDiUH4y3T0zbeps0uZGmlrb0xNW95BsiOqzkCk3l3hiNhbf 9N3tfvNd5rmOGscR9tfeKKwmRlK1x/AskUGyA6hyagp4K+cnaNgqrQaYE1Bjg0Tm9eAp Iw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3j5a67na2n-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 26 Aug 2022 03:26:20 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 26 Aug 2022 03:26:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 26 Aug 2022 03:26:19 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 298A33F7137; Fri, 26 Aug 2022 03:26:17 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH v2 1/7] Revert "scsi: qla2xxx: Fix response queue handler reading stale packets" Date: Fri, 26 Aug 2022 03:25:53 -0700 Message-ID: <20220826102559.17474-2-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220826102559.17474-1-njavali@marvell.com> References: <20220826102559.17474-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: bTw8nNGetLnQ8RH3vWH4WTOaG2fiLr7_ X-Proofpoint-GUID: bTw8nNGetLnQ8RH3vWH4WTOaG2fiLr7_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_04,2022-08-25_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Reverting this patch so that a fixed up patch, without adding new module parameters, could be submitted. Link: https://lore.kernel.org/stable/166039743723771@kroah.com/ This reverts commit b1f707146923335849fb70237eec27d4d1ae7d62. Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gbl.h | 2 -- drivers/scsi/qla2xxx/qla_isr.c | 25 ++----------------------- drivers/scsi/qla2xxx/qla_os.c | 10 ---------- 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 5dd2932382ee..bb69fa8b956a 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -193,8 +193,6 @@ extern int ql2xsecenable; extern int ql2xenforce_iocb_limit; extern int ql2xabts_wait_nvme; extern u32 ql2xnvme_queues; -extern int ql2xrspq_follow_inptr; -extern int ql2xrspq_follow_inptr_legacy; extern int qla2x00_loop_reset(scsi_qla_host_t *); extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 76e79f350a22..ede76357ccb6 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3763,8 +3763,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, struct qla_hw_data *ha = vha->hw; struct purex_entry_24xx *purex_entry; struct purex_item *pure_item; - u16 rsp_in = 0, cur_ring_index; - int follow_inptr, is_shadow_hba; + u16 cur_ring_index; if (!ha->flags.fw_started) return; @@ -3774,25 +3773,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, qla_cpu_update(rsp->qpair, smp_processor_id()); } -#define __update_rsp_in(_update, _is_shadow_hba, _rsp, _rsp_in) \ - do { \ - if (_update) { \ - _rsp_in = _is_shadow_hba ? *(_rsp)->in_ptr : \ - rd_reg_dword_relaxed((_rsp)->rsp_q_in); \ - } \ - } while (0) - - is_shadow_hba = IS_SHADOW_REG_CAPABLE(ha); - follow_inptr = is_shadow_hba ? ql2xrspq_follow_inptr : - ql2xrspq_follow_inptr_legacy; - - __update_rsp_in(follow_inptr, is_shadow_hba, rsp, rsp_in); - - while ((likely(follow_inptr && - rsp->ring_index != rsp_in && - rsp->ring_ptr->signature != RESPONSE_PROCESSED)) || - (!follow_inptr && - rsp->ring_ptr->signature != RESPONSE_PROCESSED)) { + while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) { pkt = (struct sts_entry_24xx *)rsp->ring_ptr; cur_ring_index = rsp->ring_index; @@ -3906,8 +3887,6 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, } pure_item = qla27xx_copy_fpin_pkt(vha, (void **)&pkt, &rsp); - __update_rsp_in(follow_inptr, is_shadow_hba, - rsp, rsp_in); if (!pure_item) break; qla24xx_queue_purex_item(vha, pure_item, diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 0bd0fd1042df..1c7fb6484db2 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -338,16 +338,6 @@ module_param(ql2xdelay_before_pci_error_handling, uint, 0644); MODULE_PARM_DESC(ql2xdelay_before_pci_error_handling, "Number of seconds delayed before qla begin PCI error self-handling (default: 5).\n"); -int ql2xrspq_follow_inptr = 1; -module_param(ql2xrspq_follow_inptr, int, 0644); -MODULE_PARM_DESC(ql2xrspq_follow_inptr, - "Follow RSP IN pointer for RSP updates for HBAs 27xx and newer (default: 1)."); - -int ql2xrspq_follow_inptr_legacy = 1; -module_param(ql2xrspq_follow_inptr_legacy, int, 0644); -MODULE_PARM_DESC(ql2xrspq_follow_inptr_legacy, - "Follow RSP IN pointer for RSP updates for HBAs older than 27XX. (default: 1)."); - static void qla2x00_clear_drv_active(struct qla_hw_data *); static void qla2x00_free_device(scsi_qla_host_t *); static int qla2xxx_map_queues(struct Scsi_Host *shost); From patchwork Fri Aug 26 10:25:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 600539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1178ECAAA3 for ; Fri, 26 Aug 2022 10:26:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343681AbiHZK01 (ORCPT ); Fri, 26 Aug 2022 06:26:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245240AbiHZK0X (ORCPT ); Fri, 26 Aug 2022 06:26:23 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15812CD504 for ; Fri, 26 Aug 2022 03:26:22 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27Q6TUeN001371 for ; Fri, 26 Aug 2022 03:26:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=H1FpKouDBqTWqMRnM1hp51U8muX0Vib+l5VfxR264cA=; b=M8Frdsgj0LNrF1B4Gq1x+quv/Bim6QqEMvvjMKPp9n3Gr7zWLGWLJ+Qi1UA9cTX0YP6D R7NGH7CZIAczVska4/dsAhB9yXNuMAw8E3G48ZRpMg3yIJp1R+dlCfLa/yZu077WRjZw wxBEuCBbw/hHXbizWphBarC3K8P8CV25SupE3tg4ai4dMiHjKrLeahM8lupPy677ZWqB D5e0RVyOPbRVKtDLeAsSkoxWqY7v8yOPbMwzNwAuvsYoOGui30wpC/Q+FwyfxhLXj7Om dVmh3PDI1ipjR9bVOhnTXVvDKmMvlV+6Ho8SuPvhKmPg5INTVOkwJjOxCfB3GLgO8LF2 ww== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3j5a67na2n-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 26 Aug 2022 03:26:21 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 26 Aug 2022 03:26:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 26 Aug 2022 03:26:19 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 600463F713B; Fri, 26 Aug 2022 03:26:17 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH v2 2/7] qla2xxx: Fix response queue handler reading stale packets Date: Fri, 26 Aug 2022 03:25:54 -0700 Message-ID: <20220826102559.17474-3-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220826102559.17474-1-njavali@marvell.com> References: <20220826102559.17474-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: iiUpE2D0ewFWfCKw3a76RTFd4inKviy4 X-Proofpoint-GUID: iiUpE2D0ewFWfCKw3a76RTFd4inKviy4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_04,2022-08-25_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi On some platforms, the current logic of relying on finding new packet solely based on signature pattern can lead to driver reading stale packets. Though this is a bug in those platforms, reduce such exposures by limiting reading packets until the IN pointer. Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index ede76357ccb6..e19fde304e5c 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3763,7 +3763,8 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, struct qla_hw_data *ha = vha->hw; struct purex_entry_24xx *purex_entry; struct purex_item *pure_item; - u16 cur_ring_index; + u16 rsp_in = 0, cur_ring_index; + int is_shadow_hba; if (!ha->flags.fw_started) return; @@ -3773,7 +3774,18 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, qla_cpu_update(rsp->qpair, smp_processor_id()); } - while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) { +#define __update_rsp_in(_is_shadow_hba, _rsp, _rsp_in) \ + do { \ + _rsp_in = _is_shadow_hba ? *(_rsp)->in_ptr : \ + rd_reg_dword_relaxed((_rsp)->rsp_q_in); \ + } while (0) + + is_shadow_hba = IS_SHADOW_REG_CAPABLE(ha); + + __update_rsp_in(is_shadow_hba, rsp, rsp_in); + + while (rsp->ring_index != rsp_in && + rsp->ring_ptr->signature != RESPONSE_PROCESSED) { pkt = (struct sts_entry_24xx *)rsp->ring_ptr; cur_ring_index = rsp->ring_index; @@ -3887,6 +3899,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, } pure_item = qla27xx_copy_fpin_pkt(vha, (void **)&pkt, &rsp); + __update_rsp_in(is_shadow_hba, rsp, rsp_in); if (!pure_item) break; qla24xx_queue_purex_item(vha, pure_item, From patchwork Fri Aug 26 10:25:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 600700 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87B46ECAAA3 for ; Fri, 26 Aug 2022 10:26:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343670AbiHZK0Y (ORCPT ); Fri, 26 Aug 2022 06:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245238AbiHZK0X (ORCPT ); Fri, 26 Aug 2022 06:26:23 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06225CCE3F for ; Fri, 26 Aug 2022 03:26:21 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27Q319Bj027726 for ; Fri, 26 Aug 2022 03:26:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=zpVyerr0aa3TJnleEu21/cyVKgr0MINvHjUeMO8p+zs=; b=hC5+KrcWx7spcMALMzc5JnCks0U78M0XDbHQjBvAF1b0qYcvMBSs3DTLhS+X7c/Scb0h eivTBcdDiU18jMAUlzJPftrxiydjOzdNDmVC7NGazMLfTLhtZGZK+b26eKoJnvD9ilqE abeqvaNlms4uZmSjfbBdGjF9Qmksm6iXlD0TqBe16b1ELLH/Xlg4muEB8WVDjtr+T8xC 7KGaWgHjHNqBCbU61Fue2pjlVsVIZSpbieongBX+uYoijzZ0soAqBrepsCKmAvxHYMn0 8f0WeLzRJ1QEMQBl/+agkP5UqjQMao8yKZMJIMz9RalogBkWkJkiiKhc8reMnlMf45/d wg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3j5a67na2p-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 26 Aug 2022 03:26:21 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 26 Aug 2022 03:26:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 26 Aug 2022 03:26:19 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 966423F70F2; Fri, 26 Aug 2022 03:26:17 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH v2 3/7] qla2xxx: Add debugfs create/delete helpers Date: Fri, 26 Aug 2022 03:25:55 -0700 Message-ID: <20220826102559.17474-4-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220826102559.17474-1-njavali@marvell.com> References: <20220826102559.17474-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: md6wmRXFU74yP_02nCTPxPnBca2e9t9U X-Proofpoint-GUID: md6wmRXFU74yP_02nCTPxPnBca2e9t9U X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_04,2022-08-25_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Define a few helpful macros for creating debugfs files. Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 5 ++ drivers/scsi/qla2xxx/qla_dfs.c | 93 ++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 3ec6a200942e..22274b405d01 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -35,6 +35,11 @@ #include +#define QLA_DFS_DEFINE_DENTRY(_debugfs_file_name) \ + struct dentry *dfs_##_debugfs_file_name +#define QLA_DFS_ROOT_DEFINE_DENTRY(_debugfs_file_name) \ + struct dentry *qla_dfs_##_debugfs_file_name + /* Big endian Fibre Channel S_ID (source ID) or D_ID (destination ID). */ typedef struct { uint8_t domain; diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 85bd0e468d43..777808af5634 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -489,6 +489,99 @@ qla_dfs_naqp_show(struct seq_file *s, void *unused) return 0; } +/* + * Helper macros for setting up debugfs entries. + * _name: The name of the debugfs entry + * _ctx_struct: The context that was passed when creating the debugfs file + * + * QLA_DFS_SETUP_RD could be used when there is only a show function. + * - show function take the name qla_dfs__show + * + * QLA_DFS_SETUP_RW could be used when there are both show and write functions. + * - show function take the name qla_dfs__show + * - write function take the name qla_dfs__write + * + * To have a new debugfs entry, do: + * 1. Create a "struct dentry *" in the appropriate structure in the format + * dfs_ + * 2. Setup debugfs entries using QLA_DFS_SETUP_RD / QLA_DFS_SETUP_RW + * 3. Create debugfs file in qla2x00_dfs_setup() using QLA_DFS_CREATE_FILE + * or QLA_DFS_ROOT_CREATE_FILE + * 4. Remove debugfs file in qla2x00_dfs_remove() using QLA_DFS_REMOVE_FILE + * or QLA_DFS_ROOT_REMOVE_FILE + * + * Example for creating "TEST" sysfs file: + * 1. struct qla_hw_data { ... struct dentry *dfs_TEST; } + * 2. QLA_DFS_SETUP_RD(TEST, scsi_qla_host_t); + * 3. In qla2x00_dfs_setup(): + * QLA_DFS_CREATE_FILE(ha, TEST, 0600, ha->dfs_dir, vha); + * 4. In qla2x00_dfs_remove(): + * QLA_DFS_REMOVE_FILE(ha, TEST); + */ +#define QLA_DFS_SETUP_RD(_name, _ctx_struct) \ +static int \ +qla_dfs_##_name##_open(struct inode *inode, struct file *file) \ +{ \ + _ctx_struct *__ctx = inode->i_private; \ + \ + return single_open(file, qla_dfs_##_name##_show, __ctx); \ +} \ + \ +static const struct file_operations qla_dfs_##_name##_ops = { \ + .open = qla_dfs_##_name##_open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ +}; + +#define QLA_DFS_SETUP_RW(_name, _ctx_struct) \ +static int \ +qla_dfs_##_name##_open(struct inode *inode, struct file *file) \ +{ \ + _ctx_struct *__ctx = inode->i_private; \ + \ + return single_open(file, qla_dfs_##_name##_show, __ctx); \ +} \ + \ +static const struct file_operations qla_dfs_##_name##_ops = { \ + .open = qla_dfs_##_name##_open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ + .write = qla_dfs_##_name##_write, \ +}; + +#define QLA_DFS_ROOT_CREATE_FILE(_name, _perm, _ctx) \ + do { \ + if (!qla_dfs_##_name) \ + qla_dfs_##_name = debugfs_create_file(#_name, \ + _perm, qla2x00_dfs_root, _ctx, \ + &qla_dfs_##_name##_ops); \ + } while (0) + +#define QLA_DFS_ROOT_REMOVE_FILE(_name) \ + do { \ + if (qla_dfs_##_name) { \ + debugfs_remove(qla_dfs_##_name); \ + qla_dfs_##_name = NULL; \ + } \ + } while (0) + +#define QLA_DFS_CREATE_FILE(_struct, _name, _perm, _parent, _ctx) \ + do { \ + (_struct)->dfs_##_name = debugfs_create_file(#_name, \ + _perm, _parent, _ctx, \ + &qla_dfs_##_name##_ops) \ + } while (0) + +#define QLA_DFS_REMOVE_FILE(_struct, _name) \ + do { \ + if ((_struct)->dfs_##_name) { \ + debugfs_remove((_struct)->dfs_##_name); \ + (_struct)->dfs_##_name = NULL; \ + } \ + } while (0) + static int qla_dfs_naqp_open(struct inode *inode, struct file *file) { From patchwork Fri Aug 26 10:25:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 600537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 909F1ECAAA3 for ; Fri, 26 Aug 2022 10:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343691AbiHZK0d (ORCPT ); Fri, 26 Aug 2022 06:26:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343649AbiHZK0Y (ORCPT ); Fri, 26 Aug 2022 06:26:24 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD605CD514 for ; Fri, 26 Aug 2022 03:26:22 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27Q6TUeO001371 for ; Fri, 26 Aug 2022 03:26:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=AdICEKiiFE0sMCWwwLHyDZvRkEHOdNz7JqQCRLGGsOE=; b=DrqGtjaq1AjgZGoZzwztVtiTi/jiWlm77w43f+HmskdxarTJ2jl7GwY9pJ7LlvfgCsP2 D1LTB6HYERPJrnCENpWTxsGMKJlVsIdRuh3LoelLy02kvbXtrBX1rwP5SQR55GQQWctG JRonuBBCHHQJ7PYYSKcEicStKTbJLIjatUJ3RIhKv9Whe5eD5vnZ9Mg9VDeEO7657Ymp DrVBGSE0EaRp6LPqKv9LEcsyaFWrN4Waqyulkeh8kUCgIdE7VgcZsg42002PC+4qX+tu N1rfYD+u/kSzQVCF7i5rQCza0/W2ONRFIdLeP2PpVh5O2vdFewLXstTpu80T8/4+zUyQ 6A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3j5a67na2n-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 26 Aug 2022 03:26:21 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 26 Aug 2022 03:26:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 26 Aug 2022 03:26:19 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id CC5543F70F6; Fri, 26 Aug 2022 03:26:17 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH v2 4/7] qla2xxx: Add NVMe parameters support in Auxiliary Image Status Date: Fri, 26 Aug 2022 03:25:56 -0700 Message-ID: <20220826102559.17474-5-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220826102559.17474-1-njavali@marvell.com> References: <20220826102559.17474-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 1m3oZpKVzTPBpbbNFbH8qseg3CNmID7F X-Proofpoint-GUID: 1m3oZpKVzTPBpbbNFbH8qseg3CNmID7F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_04,2022-08-25_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Anil Gurumurthy Add new API to obtain the NVMe Parameters region status from the Auxiliary Image Status bitmap. Signed-off-by: Anil Gurumurthy Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_bsg.c | 8 ++++++-- drivers/scsi/qla2xxx/qla_bsg.h | 3 ++- drivers/scsi/qla2xxx/qla_def.h | 2 ++ drivers/scsi/qla2xxx/qla_fw.h | 3 +++ drivers/scsi/qla2xxx/qla_init.c | 8 ++++++-- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index 5db9bf69dcff..cd75b179410d 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -2519,19 +2519,23 @@ qla2x00_get_flash_image_status(struct bsg_job *bsg_job) qla27xx_get_active_image(vha, &active_regions); regions.global_image = active_regions.global; + if (IS_QLA27XX(ha)) + regions.nvme_params = QLA27XX_PRIMARY_IMAGE; + if (IS_QLA28XX(ha)) { qla28xx_get_aux_images(vha, &active_regions); regions.board_config = active_regions.aux.board_config; regions.vpd_nvram = active_regions.aux.vpd_nvram; regions.npiv_config_0_1 = active_regions.aux.npiv_config_0_1; regions.npiv_config_2_3 = active_regions.aux.npiv_config_2_3; + regions.nvme_params = active_regions.aux.nvme_params; } ql_dbg(ql_dbg_user, vha, 0x70e1, - "%s(%lu): FW=%u BCFG=%u VPDNVR=%u NPIV01=%u NPIV02=%u\n", + "%s(%lu): FW=%u BCFG=%u VPDNVR=%u NPIV01=%u NPIV02=%u NVME_PARAMS=%u\n", __func__, vha->host_no, regions.global_image, regions.board_config, regions.vpd_nvram, - regions.npiv_config_0_1, regions.npiv_config_2_3); + regions.npiv_config_0_1, regions.npiv_config_2_3, regions.nvme_params); sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, ®ions, sizeof(regions)); diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h index bb64b9c5a74b..d38dab0a07e8 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.h +++ b/drivers/scsi/qla2xxx/qla_bsg.h @@ -314,7 +314,8 @@ struct qla_active_regions { uint8_t vpd_nvram; uint8_t npiv_config_0_1; uint8_t npiv_config_2_3; - uint8_t reserved[32]; + uint8_t nvme_params; + uint8_t reserved[31]; } __packed; #include "qla_edif_bsg.h" diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 22274b405d01..802eec6407d9 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4773,6 +4773,7 @@ struct active_regions { uint8_t vpd_nvram; uint8_t npiv_config_0_1; uint8_t npiv_config_2_3; + uint8_t nvme_params; } aux; }; @@ -5057,6 +5058,7 @@ struct qla27xx_image_status { #define QLA28XX_AUX_IMG_VPD_NVRAM BIT_1 #define QLA28XX_AUX_IMG_NPIV_CONFIG_0_1 BIT_2 #define QLA28XX_AUX_IMG_NPIV_CONFIG_2_3 BIT_3 +#define QLA28XX_AUX_IMG_NVME_PARAMS BIT_4 #define SET_VP_IDX 1 #define SET_AL_PA 2 diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 361015b5763e..f307beed9d29 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h @@ -1675,6 +1675,7 @@ struct qla_flt_location { #define FLT_REG_VPD_SEC_27XX_1 0x52 #define FLT_REG_VPD_SEC_27XX_2 0xD8 #define FLT_REG_VPD_SEC_27XX_3 0xDA +#define FLT_REG_NVME_PARAMS_27XX 0x21 /* 28xx */ #define FLT_REG_AUX_IMG_PRI_28XX 0x125 @@ -1691,6 +1692,8 @@ struct qla_flt_location { #define FLT_REG_MPI_SEC_28XX 0xF0 #define FLT_REG_PEP_PRI_28XX 0xD1 #define FLT_REG_PEP_SEC_28XX 0xF1 +#define FLT_REG_NVME_PARAMS_PRI_28XX 0x14E +#define FLT_REG_NVME_PARAMS_SEC_28XX 0x179 struct qla_flt_region { __le16 code; diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index e7fe0e52c11d..e12db95de688 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -7933,6 +7933,9 @@ qla28xx_component_status( active_regions->aux.npiv_config_2_3 = qla28xx_component_bitmask(aux, QLA28XX_AUX_IMG_NPIV_CONFIG_2_3); + + active_regions->aux.nvme_params = + qla28xx_component_bitmask(aux, QLA28XX_AUX_IMG_NVME_PARAMS); } static int @@ -8041,11 +8044,12 @@ qla28xx_get_aux_images( } ql_dbg(ql_dbg_init, vha, 0x018f, - "aux images active: BCFG=%u VPD/NVR=%u NPIV0/1=%u NPIV2/3=%u\n", + "aux images active: BCFG=%u VPD/NVR=%u NPIV0/1=%u NPIV2/3=%u, NVME=%u\n", active_regions->aux.board_config, active_regions->aux.vpd_nvram, active_regions->aux.npiv_config_0_1, - active_regions->aux.npiv_config_2_3); + active_regions->aux.npiv_config_2_3, + active_regions->aux.nvme_params); } void From patchwork Fri Aug 26 10:25:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 600697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4EEDECAAD4 for ; Fri, 26 Aug 2022 10:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343571AbiHZK0c (ORCPT ); Fri, 26 Aug 2022 06:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343629AbiHZK0Y (ORCPT ); Fri, 26 Aug 2022 06:26:24 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 405E8CD525 for ; Fri, 26 Aug 2022 03:26:23 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27Q6TUeP001371 for ; Fri, 26 Aug 2022 03:26:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=a0qjndoE0Op/GvBY6VIHk6QW5pN8Sr2ViIwQ4vWKiaA=; b=W70J8CIQnkz0NEfxv0XmYDDZu6rE6yXaowvEBqm7vEicCBniFSUPdoM5LKDi/E2EHPn+ J9Ce/2uavIc8n2Wl2uBBYC8C8xO5zxc6Xwx/CKy19+jLMnWuti2denUMsoBqpAV6bH8i VfrSdxpkIKGzadQvNbjHguohp+287A1NBirpV52xWPp+OtU4WknpdSdFRsiDw9qSFGtY 9UIh4+g5j/2fITga9KaRih0RZ7Wyc4UwA/2rzz0hgDRCdE1AxeOeAAXHE12ktvIxRfEI FuJr3r2WMq2LAr9OyunBOdWW7nHVF1WlMXMKNIzrbXqrLWzf7TKqHsxLMBrVIBWSijDf fQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3j5a67na2n-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 26 Aug 2022 03:26:22 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 26 Aug 2022 03:26:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 26 Aug 2022 03:26:19 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 0F1493F70BA; Fri, 26 Aug 2022 03:26:18 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH v2 5/7] qla2xxx: Enhance driver tracing with separate tunable and more Date: Fri, 26 Aug 2022 03:25:57 -0700 Message-ID: <20220826102559.17474-6-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220826102559.17474-1-njavali@marvell.com> References: <20220826102559.17474-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: _akUQi_sBhXPnmoLs_B0msPOcaXoiONa X-Proofpoint-GUID: _akUQi_sBhXPnmoLs_B0msPOcaXoiONa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_04,2022-08-25_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Older tracing of driver messages was to: - log only debug messages to kernel main trace buffer AND - log only if extended logging bits corresponding to this message is off This has been modified and extended as follows: - Tracing is now controlled via ql2xextended_error_logging_ktrace module parameter. Bit usages same as ql2xextended_error_logging. - Tracing uses "qla2xxx" trace instance, unless instance creation have issues. - Tracing is enabled (compile time tunable). - All driver messages, include debug and log messages are now traced in kernel trace buffer. Trace messages can be viewed by looking at the qla2xxx instance at: /sys/kernel/tracing/instances/qla2xxx/trace Trace tunable that takes the same bit mask as ql2xextended_error_logging is: ql2xextended_error_logging_ktrace (default=1) Suggested-by: Daniel Wagner Suggested-by: Steven Rostedt Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Tested-by: Himanshu Madhani Reviewed-by: Daniel Wagner --- drivers/scsi/qla2xxx/qla_dbg.c | 50 ++++++++++++++++++++++++---------- drivers/scsi/qla2xxx/qla_dbg.h | 43 +++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_os.c | 35 ++++++++++++++++++++++++ 4 files changed, 115 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 7cf1f78cbaee..d7e8454304ce 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -2455,7 +2455,7 @@ qla83xx_fw_dump(scsi_qla_host_t *vha) /****************************************************************************/ /* Write the debug message prefix into @pbuf. */ -static void ql_dbg_prefix(char *pbuf, int pbuf_size, +static void ql_dbg_prefix(char *pbuf, int pbuf_size, struct pci_dev *pdev, const scsi_qla_host_t *vha, uint msg_id) { if (vha) { @@ -2464,6 +2464,9 @@ static void ql_dbg_prefix(char *pbuf, int pbuf_size, /* []-:: */ snprintf(pbuf, pbuf_size, "%s [%s]-%04x:%lu: ", QL_MSGHDR, dev_name(&(pdev->dev)), msg_id, vha->host_no); + } else if (pdev) { + snprintf(pbuf, pbuf_size, "%s [%s]-%04x: : ", QL_MSGHDR, + dev_name(&pdev->dev), msg_id); } else { /* []-: : */ snprintf(pbuf, pbuf_size, "%s [%s]-%04x: : ", QL_MSGHDR, @@ -2491,20 +2494,20 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...) struct va_format vaf; char pbuf[64]; - if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled()) + ql_ktrace(1, level, pbuf, NULL, vha, id, fmt); + + if (!ql_mask_match(level)) return; + if (!pbuf[0]) /* set by ql_ktrace */ + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, vha, id); + va_start(va, fmt); vaf.fmt = fmt; vaf.va = &va; - ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), vha, id); - - if (!ql_mask_match(level)) - trace_ql_dbg_log(pbuf, &vaf); - else - pr_warn("%s%pV", pbuf, &vaf); + pr_warn("%s%pV", pbuf, &vaf); va_end(va); @@ -2533,6 +2536,9 @@ ql_dbg_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...) if (pdev == NULL) return; + + ql_ktrace(1, level, pbuf, pdev, NULL, id, fmt); + if (!ql_mask_match(level)) return; @@ -2541,7 +2547,9 @@ ql_dbg_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...) vaf.fmt = fmt; vaf.va = &va; - ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, id + ql_dbg_offset); + if (!pbuf[0]) /* set by ql_ktrace */ + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), pdev, NULL, + id + ql_dbg_offset); pr_warn("%s%pV", pbuf, &vaf); va_end(va); @@ -2570,7 +2578,10 @@ ql_log(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...) if (level > ql_errlev) return; - ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), vha, id); + ql_ktrace(0, level, pbuf, NULL, vha, id, fmt); + + if (!pbuf[0]) /* set by ql_ktrace */ + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, vha, id); va_start(va, fmt); @@ -2621,7 +2632,10 @@ ql_log_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...) if (level > ql_errlev) return; - ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, id); + ql_ktrace(0, level, pbuf, pdev, NULL, id, fmt); + + if (!pbuf[0]) /* set by ql_ktrace */ + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), pdev, NULL, id); va_start(va, fmt); @@ -2716,7 +2730,11 @@ ql_log_qp(uint32_t level, struct qla_qpair *qpair, int32_t id, if (level > ql_errlev) return; - ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), qpair ? qpair->vha : NULL, id); + ql_ktrace(0, level, pbuf, NULL, qpair ? qpair->vha : NULL, id, fmt); + + if (!pbuf[0]) /* set by ql_ktrace */ + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, + qpair ? qpair->vha : NULL, id); va_start(va, fmt); @@ -2762,6 +2780,8 @@ ql_dbg_qp(uint32_t level, struct qla_qpair *qpair, int32_t id, struct va_format vaf; char pbuf[128]; + ql_ktrace(1, level, pbuf, NULL, qpair ? qpair->vha : NULL, id, fmt); + if (!ql_mask_match(level)) return; @@ -2770,8 +2790,10 @@ ql_dbg_qp(uint32_t level, struct qla_qpair *qpair, int32_t id, vaf.fmt = fmt; vaf.va = &va; - ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), qpair ? qpair->vha : NULL, - id + ql_dbg_offset); + if (!pbuf[0]) /* set by ql_ktrace */ + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, + qpair ? qpair->vha : NULL, id + ql_dbg_offset); + pr_warn("%s%pV", pbuf, &vaf); va_end(va); diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index feeb1666227f..70482b55d240 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h @@ -385,3 +385,46 @@ ql_mask_match(uint level) return level && ((level & ql2xextended_error_logging) == level); } + +static inline int +ql_mask_match_ext(uint level, int *log_tunable) +{ + if (*log_tunable == 1) + *log_tunable = QL_DBG_DEFAULT1_MASK; + + return (level & *log_tunable) == level; +} + +/* Assumes local variable pbuf and pbuf_ready present. */ +#define ql_ktrace(dbg_msg, level, pbuf, pdev, vha, id, fmt) do { \ + struct va_format _vaf; \ + va_list _va; \ + u32 dbg_off = dbg_msg ? ql_dbg_offset : 0; \ + \ + pbuf[0] = 0; \ + if (!trace_ql_dbg_log_enabled()) \ + break; \ + \ + if (dbg_msg && !ql_mask_match_ext(level, \ + &ql2xextended_error_logging_ktrace)) \ + break; \ + \ + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), pdev, vha, id + dbg_off); \ + \ + va_start(_va, fmt); \ + _vaf.fmt = fmt; \ + _vaf.va = &_va; \ + \ + trace_ql_dbg_log(pbuf, &_vaf); \ + \ + va_end(_va); \ +} while (0) + +#define QLA_ENABLE_KERNEL_TRACING + +#ifdef QLA_ENABLE_KERNEL_TRACING +#define QLA_TRACE_ENABLE(_tr) \ + trace_array_set_clr_event(_tr, "qla", NULL, true) +#else /* QLA_ENABLE_KERNEL_TRACING */ +#define QLA_TRACE_ENABLE(_tr) +#endif /* QLA_ENABLE_KERNEL_TRACING */ diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index bb69fa8b956a..2fc280e61306 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -163,6 +163,7 @@ extern int ql2xrdpenable; extern int ql2xsmartsan; extern int ql2xallocfwdump; extern int ql2xextended_error_logging; +extern int ql2xextended_error_logging_ktrace; extern int ql2xiidmaenable; extern int ql2xmqsupport; extern int ql2xfwloadbin; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 1c7fb6484db2..4a55c1e81327 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include @@ -35,6 +37,8 @@ static int apidev_major; */ struct kmem_cache *srb_cachep; +struct trace_array *qla_trc_array; + int ql2xfulldump_on_mpifail; module_param(ql2xfulldump_on_mpifail, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(ql2xfulldump_on_mpifail, @@ -117,6 +121,11 @@ MODULE_PARM_DESC(ql2xextended_error_logging, "ql2xextended_error_logging=1).\n" "\t\tDo LOGICAL OR of the value to enable more than one level"); +int ql2xextended_error_logging_ktrace = 1; +module_param(ql2xextended_error_logging_ktrace, int, S_IRUGO|S_IWUSR); +MODULE_PARM_DESC(ql2xextended_error_logging_ktrace, + "Same BIT definiton as ql2xextended_error_logging, but used to control logging to kernel trace buffer (default=1).\n"); + int ql2xshiftctondsd = 6; module_param(ql2xshiftctondsd, int, S_IRUGO); MODULE_PARM_DESC(ql2xshiftctondsd, @@ -2839,6 +2848,27 @@ static void qla2x00_iocb_work_fn(struct work_struct *work) spin_unlock_irqrestore(&vha->work_lock, flags); } +static void +qla_trace_init(void) +{ + qla_trc_array = trace_array_get_by_name("qla2xxx"); + if (!qla_trc_array) { + ql_log(ql_log_fatal, NULL, 0x0001, + "Unable to create qla2xxx trace instance, instance logging will be disabled.\n"); + return; + } + + QLA_TRACE_ENABLE(qla_trc_array); +} + +static void +qla_trace_uninit(void) +{ + if (!qla_trc_array) + return; + trace_array_put(qla_trc_array); +} + /* * PCI driver interface */ @@ -8181,6 +8211,8 @@ qla2x00_module_init(void) BUILD_BUG_ON(sizeof(sw_info_t) != 32); BUILD_BUG_ON(sizeof(target_id_t) != 2); + qla_trace_init(); + /* Allocate cache for SRBs. */ srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0, SLAB_HWCACHE_ALIGN, NULL); @@ -8259,6 +8291,8 @@ qla2x00_module_init(void) destroy_cache: kmem_cache_destroy(srb_cachep); + + qla_trace_uninit(); return ret; } @@ -8277,6 +8311,7 @@ qla2x00_module_exit(void) fc_release_transport(qla2xxx_transport_template); qlt_exit(); kmem_cache_destroy(srb_cachep); + qla_trace_uninit(); } module_init(qla2x00_module_init); From patchwork Fri Aug 26 10:25:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 600538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 505FAECAAA3 for ; Fri, 26 Aug 2022 10:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343491AbiHZK0a (ORCPT ); Fri, 26 Aug 2022 06:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343528AbiHZK0X (ORCPT ); Fri, 26 Aug 2022 06:26:23 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D07C6CD515 for ; Fri, 26 Aug 2022 03:26:22 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27Q319Bl027726 for ; Fri, 26 Aug 2022 03:26:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=QUHyKXF7EflNhPJR/10/RkmQrQgN21WtVrULIzTGMuU=; b=MT0pMR6gdDYNctL0ammNSLgbu1jfc1vpznyY77VoOKUXOYPRcDKMoL28C/41Uf+sxDdW Z2ZbJtluPgpv+oQgGv0M2H7A72fhqRqqXPgnxZXOMrR913kyikWZqyHPS4kBOjZObjWJ lC4Atw8O3nRn6GA4GKDJsKhri1rah4f5RyEwT/siTFMpXwkb7/5U/eMmjtIHy9f1UD5g pLTQqAmCkfV+CpMoPaOqpbzI9sz5OJw0DE5ao78WJbN3XhymNm9vFQDU4o0s2Juls4aL 6LDnn3tClSv7pH4OjUE2sQ50D5rCujH5rfom6ra9Zkni75haLW3VpYPwUKvIDaXM5tiw +w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3j5a67na2p-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 26 Aug 2022 03:26:21 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 26 Aug 2022 03:26:20 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 26 Aug 2022 03:26:20 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 460A03F70F7; Fri, 26 Aug 2022 03:26:18 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH v2 6/7] qla2xxx: define static symbols Date: Fri, 26 Aug 2022 03:25:58 -0700 Message-ID: <20220826102559.17474-7-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220826102559.17474-1-njavali@marvell.com> References: <20220826102559.17474-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: qW0zN790VnPUAqKZOqFVvRZVSSgTsnOv X-Proofpoint-GUID: qW0zN790VnPUAqKZOqFVvRZVSSgTsnOv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_04,2022-08-25_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org drivers/scsi/qla2xxx/qla_os.c:40:20: warning: symbol 'qla_trc_array' was not declared. Should it be static? drivers/scsi/qla2xxx/qla_os.c:345:5: warning: symbol 'ql2xdelay_before_pci_error_handling' was not declared. Should it be static? Define qla_trc_array and ql2xdelay_before_pci_error_handling as static to fix sparse warnings. Cc: stable@vger.kernel.org Reported-by: kernel test robot Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 4a55c1e81327..46c281b55c63 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -37,7 +37,7 @@ static int apidev_major; */ struct kmem_cache *srb_cachep; -struct trace_array *qla_trc_array; +static struct trace_array *qla_trc_array; int ql2xfulldump_on_mpifail; module_param(ql2xfulldump_on_mpifail, int, S_IRUGO | S_IWUSR); @@ -342,7 +342,7 @@ MODULE_PARM_DESC(ql2xabts_wait_nvme, "To wait for ABTS response on I/O timeouts for NVMe. (default: 1)"); -u32 ql2xdelay_before_pci_error_handling = 5; +static u32 ql2xdelay_before_pci_error_handling = 5; module_param(ql2xdelay_before_pci_error_handling, uint, 0644); MODULE_PARM_DESC(ql2xdelay_before_pci_error_handling, "Number of seconds delayed before qla begin PCI error self-handling (default: 5).\n"); From patchwork Fri Aug 26 10:25:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 600698 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABE76ECAAD4 for ; Fri, 26 Aug 2022 10:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245240AbiHZK03 (ORCPT ); Fri, 26 Aug 2022 06:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343491AbiHZK0X (ORCPT ); Fri, 26 Aug 2022 06:26:23 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DC46CD510 for ; Fri, 26 Aug 2022 03:26:22 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27Q319Bk027726 for ; Fri, 26 Aug 2022 03:26:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=F3zFNWBWmkqsbJscpPYHVD2HK2OZ8v1zkdL/JnQLzEo=; b=YaO7EmuNH6gN/CMuhyUAu1s59NVe+gbO0gdudsoQZi9FQObopXG625IEJb7CQFRsDxpM Oz5S52SpJ6uRFUxNmAzCq1FO99qA928hM3+ymjn5IMfLQsSGdl+wLpE9ljBGvOl9sXHB 4MQh7MvsccGxUtpxsuEfdVN4JCKDXvYPH7hEDxYI/swj4ZDSk2fGd0cErAmGiMNoy4bb rRaJTyT6WVleT/Yzx7wm4E6NVcIAF7OnWFlX9PU9LGbCFkV+/otqL0mLZuV1ge+VgI80 +FQ9tJLZuMQeoNDnEPhxjAZnYCpaqgLN99lTax6FZvUt2mTCwdFoWm6D3k6HGYXr6UL3 hw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3j5a67na2p-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 26 Aug 2022 03:26:21 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 26 Aug 2022 03:26:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 26 Aug 2022 03:26:19 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 7CE453F70F9; Fri, 26 Aug 2022 03:26:18 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH v2 7/7] qla2xxx: Update version to 10.02.07.900-k Date: Fri, 26 Aug 2022 03:25:59 -0700 Message-ID: <20220826102559.17474-8-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220826102559.17474-1-njavali@marvell.com> References: <20220826102559.17474-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 6tHkdvHI6X271ie0ITQFThqjNE98l_Yp X-Proofpoint-GUID: 6tHkdvHI6X271ie0ITQFThqjNE98l_Yp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-26_04,2022-08-25_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index f3257d46b6d2..03f3e2cd62b5 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h @@ -6,9 +6,9 @@ /* * Driver version */ -#define QLA2XXX_VERSION "10.02.07.800-k" +#define QLA2XXX_VERSION "10.02.07.900-k" #define QLA_DRIVER_MAJOR_VER 10 #define QLA_DRIVER_MINOR_VER 2 #define QLA_DRIVER_PATCH_VER 7 -#define QLA_DRIVER_BETA_VER 800 +#define QLA_DRIVER_BETA_VER 900