From patchwork Fri Jul 15 06:02:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 591141 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 17ACBC43334 for ; Fri, 15 Jul 2022 06:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230132AbiGOGCj (ORCPT ); Fri, 15 Jul 2022 02:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229996AbiGOGCg (ORCPT ); Fri, 15 Jul 2022 02:02:36 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30AAC7A539 for ; Thu, 14 Jul 2022 23:02:34 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26F1ifo8013575 for ; Thu, 14 Jul 2022 23:02:34 -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=FwKNVYn+/3M6VKWq+uG8gYxPeBoQiLHuH6iLxqzrpEs=; b=fZfiTpg9+qTeYjXa6ZBThjU5odaFtQwykEqmLbUYWFh1fuEwtXqA/BTsw8SXwxIVKZId E18CsjBh9hmlvbkIZC4ISGnI8zCAOi2yXqJfaV84ej1f4EqDodJKaYCxQ2De4whj3Dip nfcBJQkxVp+6wTbrDdOic4d60Xbwow9uY8kxX1O86/gVcDv6s+MXY9PTTSsPJidNYpJY Kuy9K0phKWwbZgeuh7hN/25IdqQcEjjfhFjZiLWwAVLBRCBINN8Pu92AqEVWCzErG8nt s73yy5Gze69Q2H0xTL9ZnLkf54DIW1Kx3VZ2cwS7CIGdPNCaV3DSEiAhgpujlFGIixws TA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3haxu9gkug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 14 Jul 2022 23:02:33 -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; Thu, 14 Jul 2022 23:02:32 -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; Thu, 14 Jul 2022 23:02:32 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 327C93F706D; Thu, 14 Jul 2022 23:02:32 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH 1/6] qla2xxx: Add debugfs create/delete helpers Date: Thu, 14 Jul 2022 23:02:22 -0700 Message-ID: <20220715060227.23923-2-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220715060227.23923-1-njavali@marvell.com> References: <20220715060227.23923-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: sRdLAjJ6WKkVjIJGUn-7zF6vReHd8qHt X-Proofpoint-GUID: sRdLAjJ6WKkVjIJGUn-7zF6vReHd8qHt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_02,2022-07-14_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 --- drivers/scsi/qla2xxx/qla_def.h | 5 ++ drivers/scsi/qla2xxx/qla_dfs.c | 90 ++++++++++++++++++++++++++++++++++ 2 files changed, 95 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..c3c8b9536ef6 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -489,6 +489,96 @@ 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) \ + (_struct)->dfs_##_name = debugfs_create_file(#_name, _perm, \ + _parent, _ctx, &qla_dfs_##_name##_ops); + +#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 Jul 15 06:02:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 591607 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 47EDCC433EF for ; Fri, 15 Jul 2022 06:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbiGOGCl (ORCPT ); Fri, 15 Jul 2022 02:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbiGOGCg (ORCPT ); Fri, 15 Jul 2022 02:02:36 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 773D87A53A for ; Thu, 14 Jul 2022 23:02:34 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26F1ifo9013575 for ; Thu, 14 Jul 2022 23:02:34 -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=gNyvXHN22kDgkx6zThoo3P/nTojylT7pQd3aXHdsK74=; b=ZdKtvkMpaT7mUMSrVRZk8+T0FR/KDy7XoqmT4qehq961odnChfTtEwJBDeylupnL7Evo AaqCtYPVIzbVzok+4cUGRbpyyhrbv1o/pdHH+xZGQHRvv4/ud/cwfV36joMACmPjIjFx jBtcKFSYZdRETuxR/5MnTBjj8tlFXCbyQ44FjxLhj/3OWDDL1Okblksa5FKyQ7ql0Vni gxL0HGzluUNt07qb/DRL6wr/C3qBxLLao/wdRspyMu6YeLO+RA1zVRBIoKjD+kYRvKCO MDyhfIg0Evh4VB/U3d/k40RVnAeCcKvRgOMEJHfkcUdaQDsV1K6YRp892OKizJkJain5 Rg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3haxu9gkug-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 14 Jul 2022 23:02:34 -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; Thu, 14 Jul 2022 23:02:32 -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; Thu, 14 Jul 2022 23:02:32 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 572A33F706F; Thu, 14 Jul 2022 23:02:32 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH 2/6] qla2xxx: Add a generic tracing framework Date: Thu, 14 Jul 2022 23:02:23 -0700 Message-ID: <20220715060227.23923-3-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220715060227.23923-1-njavali@marvell.com> References: <20220715060227.23923-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: JgjagZAMERN9q_xNQrQ3SA-wlmT-0PLC X-Proofpoint-GUID: JgjagZAMERN9q_xNQrQ3SA-wlmT-0PLC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_02,2022-07-14_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Adding a message based tracing mechanism where a rotating number of messages are captured in a trace structure. Disable/enable/resize operations are allowed via debugfs interfaces. Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reported-by: kernel test robot --- drivers/scsi/qla2xxx/qla_dbg.c | 12 +++ drivers/scsi/qla2xxx/qla_dbg.h | 140 +++++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_def.h | 31 ++++++++ drivers/scsi/qla2xxx/qla_dfs.c | 102 ++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_os.c | 5 ++ 5 files changed, 290 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 7cf1f78cbaee..c4ba8ac51d27 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -2777,3 +2777,15 @@ ql_dbg_qp(uint32_t level, struct qla_qpair *qpair, int32_t id, va_end(va); } + +#ifdef QLA_TRACING +void qla_tracing_init(void) +{ + if (is_kdump_kernel()) + return; +} + +void qla_tracing_exit(void) +{ +} +#endif /* QLA_TRACING */ diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index feeb1666227f..e0d91a1f81c0 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h @@ -5,6 +5,7 @@ */ #include "qla_def.h" +#include /* * Firmware Dump structure definition @@ -321,6 +322,145 @@ struct qla2xxx_fw_dump { extern uint ql_errlev; +#ifdef QLA_TRACING +#include + +extern void qla_tracing_init(void); +extern void qla_tracing_exit(void); + +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; +} + +static inline int +__qla_trace_get(struct qla_trace *trc) +{ + if (test_bit(QLA_TRACE_QUIESCE, &trc->flags)) + return -EIO; + atomic_inc(&trc->ref_count); + return 0; +} + +static inline int +qla_trace_get(struct qla_trace *trc) +{ + unsigned long flags; + int ret; + + spin_lock_irqsave(&trc->trc_lock, flags); + ret = __qla_trace_get(trc); + spin_unlock_irqrestore(&trc->trc_lock, flags); + + return ret; +} + +static inline void +qla_trace_put(struct qla_trace *trc) +{ + wmb(); + atomic_dec(&trc->ref_count); +} + +static inline char * +qla_get_trace_next(struct qla_trace *trc) +{ + uint32_t t_ind; + char *buf; + unsigned long flags; + + spin_lock_irqsave(&trc->trc_lock, flags); + if (!test_bit(QLA_TRACE_ENABLED, &trc->flags) || + __qla_trace_get(trc)) { + spin_unlock_irqrestore(&trc->trc_lock, flags); + return NULL; + } + t_ind = trc->trace_ind = qla_trace_ind_norm(trc, trc->trace_ind + 1); + spin_unlock_irqrestore(&trc->trc_lock, flags); + + if (!t_ind) + set_bit(QLA_TRACE_WRAPPED, &trc->flags); + + buf = qla_trace_record(trc, t_ind); + /* Put an end marker '>' for the next record. */ + qla_trace_record(trc, qla_trace_ind_norm(trc, t_ind + 1))[0] = '>'; + + return buf; +} + +static inline int +qla_trace_quiesce(struct qla_trace *trc) +{ + unsigned long flags; + u32 cnt = 0; + int ret = 0; + + set_bit(QLA_TRACE_QUIESCE, &trc->flags); + + spin_lock_irqsave(&trc->trc_lock, flags); + while (atomic_read(&trc->ref_count)) { + spin_unlock_irqrestore(&trc->trc_lock, flags); + + msleep(1); + + spin_lock_irqsave(&trc->trc_lock, flags); + cnt++; + if (cnt > 10 * 1000) { + pr_info("qla2xxx: Trace could not be quiesced now (count=%d).", + atomic_read(&trc->ref_count)); + /* Leave trace enabled */ + clear_bit(QLA_TRACE_QUIESCE, &trc->flags); + ret = -EIO; + break; + } + } + spin_unlock_irqrestore(&trc->trc_lock, flags); + return ret; +} + +static inline void +qla_trace_init(struct qla_trace *trc, char *name, u32 num_entries) +{ + if (trc->recs) + return; + + memset(trc, 0, sizeof(*trc)); + + trc->name = name; + spin_lock_init(&trc->trc_lock); + if (!num_entries) + return; + trc->num_entries = num_entries; + trc->recs = vzalloc(trc->num_entries * + sizeof(struct qla_trace_rec)); + if (!trc->recs) + return; + + set_bit(QLA_TRACE_ENABLED, &trc->flags); +} + +static inline void +qla_trace_uninit(struct qla_trace *trc) +{ + if (!trc->recs) + return; + + vfree(trc->recs); + trc->recs = NULL; + clear_bit(QLA_TRACE_ENABLED, &trc->flags); +} + +#else /* QLA_TRACING */ +#define qla_trace_init(trc, name, num) +#define qla_trace_uninit(trc) +#define qla_tracing_init() +#define qla_tracing_exit() +#endif /* QLA_TRACING */ + void __attribute__((format (printf, 4, 5))) ql_dbg(uint, scsi_qla_host_t *vha, uint, const char *fmt, ...); void __attribute__((format (printf, 4, 5))) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 22274b405d01..39322105e7be 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -35,6 +35,37 @@ #include +#define QLA_TRACING /* Captures driver messages to buffer */ + +#ifdef QLA_TRACING +#define QLA_TRACE_LINE_SIZE 256 /* Biggest so far is ~215 */ +#define qla_trace_ind_norm(_trc, _ind) ((_ind) >= (_trc)->num_entries ? \ + 0 : (_ind)) +#define qla_trace_record(_trc, __ind) ((_trc)->recs[__ind].buf) +#define qla_trace_record_len (sizeof(struct qla_trace_rec)) +#define qla_trace_start(_trc) qla_trace_record(_trc, 0) +#define qla_trace_len(_trc) ((_trc)->num_entries) +#define qla_trace_size(_trc) (qla_trace_record_len * \ + (_trc)->num_entries) +#define qla_trace_cur_ind(_trc) ((_trc)->trace_ind) +struct qla_trace_rec { + char buf[QLA_TRACE_LINE_SIZE]; +}; + +struct qla_trace { +#define QLA_TRACE_ENABLED 0 /* allow trace writes or not */ +#define QLA_TRACE_WRAPPED 1 +#define QLA_TRACE_QUIESCE 2 + unsigned long flags; + atomic_t ref_count; + u32 num_entries; + u32 trace_ind; + spinlock_t trc_lock; + char *name; + struct qla_trace_rec *recs; +}; +#endif /* QLA_TRACING */ + #define QLA_DFS_DEFINE_DENTRY(_debugfs_file_name) \ struct dentry *dfs_##_debugfs_file_name #define QLA_DFS_ROOT_DEFINE_DENTRY(_debugfs_file_name) \ diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index c3c8b9536ef6..98c6390ad1f1 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -489,6 +489,108 @@ qla_dfs_naqp_show(struct seq_file *s, void *unused) return 0; } +#ifdef QLA_TRACING +static char *trace_help = "\ +# Format:\n\ +# \n\ +#\n\ +# Trace control by writing:\n\ +# 'enable' - to enable this trace\n\ +# 'disable' - to disable this trace\n\ +# 'resize=' - to resize this trace to \n\ +#\n"; + +static int +qla_dfs_trace_show(struct seq_file *s, void *unused) +{ + struct qla_trace *trc = s->private; + char *buf; + u32 t_ind = 0, i; + + seq_puts(s, trace_help); + + if (qla_trace_get(trc)) + return 0; + + seq_printf(s, "# Trace max lines = %d, writes = %s\n#\n", + trc->num_entries, test_bit(QLA_TRACE_ENABLED, + &trc->flags) ? "enabled" : "disabled"); + + if (test_bit(QLA_TRACE_WRAPPED, &trc->flags)) + t_ind = qla_trace_cur_ind(trc) + 1; + + for (i = 0; i < qla_trace_len(trc); i++, t_ind++) { + t_ind = qla_trace_ind_norm(trc, t_ind); + buf = qla_trace_record(trc, t_ind); + if (!buf[0]) + continue; + seq_puts(s, buf); + } + + mb(); + qla_trace_put(trc); + return 0; +} + +#define string_is(_buf, _str_val) \ + (strncmp(_str_val, _buf, strlen(_str_val)) == 0) + +static ssize_t +qla_dfs_trace_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + struct seq_file *s = file->private_data; + struct qla_trace *trc = s->private; + char buf[32]; + ssize_t ret = count; + + memset(buf, 0, sizeof(buf)); + if (copy_from_user(buf, buffer, min(sizeof(buf), count))) + return -EFAULT; + + if (string_is(buf, "enable")) { + if (!trc->recs) { + pr_warn("qla2xxx: '%s' is empty, resize before enabling.\n", + trc->name); + return -EINVAL; + } + pr_info("qla2xxx: Enabling trace '%s'\n", trc->name); + set_bit(QLA_TRACE_ENABLED, &trc->flags); + } else if (string_is(buf, "disable")) { + pr_info("qla2xxx: Disabling trace '%s'\n", trc->name); + clear_bit(QLA_TRACE_ENABLED, &trc->flags); + } else if (string_is(buf, "resize")) { + u32 new_len; + + if (sscanf(buf, "resize=%d", &new_len) != 1) + return -EINVAL; + if (new_len == trc->num_entries) { + pr_info("qla2xxx: New trace size is same as old.\n"); + return count; + } + pr_info("qla2xxx: Changing trace '%s' size to %d\n", + trc->name, new_len); + if (qla_trace_quiesce(trc)) { + ret = -EBUSY; + goto done; + } + qla_trace_uninit(trc); + /* + * Go through init once again to start creating traces + * based on the respective tunable. + */ + qla_trace_init(trc, trc->name, new_len); + if (!trc->recs) { + pr_warn("qla2xxx: Trace allocation failed for '%s'\n", + trc->name); + ret = -ENOMEM; + } + } +done: + return ret; +} +#endif /* QLA_TRACING */ + /* * Helper macros for setting up debugfs entries. * _name: The name of the debugfs entry diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 0bd0fd1042df..0d2397069cac 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -8191,6 +8191,8 @@ qla2x00_module_init(void) BUILD_BUG_ON(sizeof(sw_info_t) != 32); BUILD_BUG_ON(sizeof(target_id_t) != 2); + qla_tracing_init(); + /* Allocate cache for SRBs. */ srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0, SLAB_HWCACHE_ALIGN, NULL); @@ -8269,6 +8271,7 @@ qla2x00_module_init(void) destroy_cache: kmem_cache_destroy(srb_cachep); + qla_tracing_exit(); return ret; } @@ -8287,6 +8290,8 @@ qla2x00_module_exit(void) fc_release_transport(qla2xxx_transport_template); qlt_exit(); kmem_cache_destroy(srb_cachep); + + qla_tracing_exit(); } module_init(qla2x00_module_init); From patchwork Fri Jul 15 06:02:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 591140 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 0B188C43334 for ; Fri, 15 Jul 2022 06:02:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230143AbiGOGCm (ORCPT ); Fri, 15 Jul 2022 02:02:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbiGOGCi (ORCPT ); Fri, 15 Jul 2022 02:02:38 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54BDF7A536 for ; Thu, 14 Jul 2022 23:02:36 -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 26EMB5Z8009903 for ; Thu, 14 Jul 2022 23:02:35 -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=aMsiJr7gIGzkLBNAywjHJEYWs+/665M5djfLk+Lthxc=; b=b1iAGvYp3rKj8TCbClEr3trIGSYx3ngLmWXwdTl8kND/EJsFvfpckX33vTX92BG5No2m J/+bn5QZ/DXWOIMduH/gXng/XvxQletKT+cfcuTzLKCN5uf+k9mWv1IviwX/e8M09WSc /NmDvIQKplZQpAJ6LSPK0DPzrSN1B13LvnSGsZSviznPHeCnJw54MRYWNAjUabOgXJ8e eVwXMABDzgs1dQvr7zpNmj51T5EchSA3bN3PqUb+s67Es2hz+BRzQsocubS02YLXL48g VQbCSlQT0eLifoRSLuSkHYduqcISyrlCarkfXLBLkAC0qc3jXHIXIz0Ut2duRagVg2ph ZQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3h9udu8g1u-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 14 Jul 2022 23:02:35 -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; Thu, 14 Jul 2022 23:02:32 -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; Thu, 14 Jul 2022 23:02:32 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 7B6473F7065; Thu, 14 Jul 2022 23:02:32 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH 3/6] qla2xxx: Add driver console messages tracing Date: Thu, 14 Jul 2022 23:02:24 -0700 Message-ID: <20220715060227.23923-4-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220715060227.23923-1-njavali@marvell.com> References: <20220715060227.23923-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: B4xt4DN73wNvor2OaxFwz2jhY8Sl5yPz X-Proofpoint-ORIG-GUID: B4xt4DN73wNvor2OaxFwz2jhY8Sl5yPz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_02,2022-07-14_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Driver messages, using the default log settings of 1 are captured by default in an internal trace buffer. Traces can be read from: /sys/kernel/debug/qla2xxx/message_trace Enable/disable/resize operations are possible by writing enable/disable/resize= to the debugfs file. Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_dbg.c | 14 +++++- drivers/scsi/qla2xxx/qla_dbg.h | 79 ++++++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_dfs.c | 30 +++++++++++++ drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_os.c | 2 + 5 files changed, 125 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index c4ba8ac51d27..3d12a5bf54b9 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -68,7 +68,7 @@ #define CREATE_TRACE_POINTS #include -static uint32_t ql_dbg_offset = 0x800; +uint32_t ql_dbg_offset = 0x800; static inline void qla2xxx_prep_dump(struct qla_hw_data *ha, struct qla2xxx_fw_dump *fw_dump) @@ -2491,6 +2491,8 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...) struct va_format vaf; char pbuf[64]; + ql_msg_trace(1, level, vha, NULL, id, fmt); + if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled()) return; @@ -2533,6 +2535,9 @@ ql_dbg_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...) if (pdev == NULL) return; + + ql_msg_trace(1, level, NULL, pdev, id, fmt); + if (!ql_mask_match(level)) return; @@ -2570,6 +2575,8 @@ ql_log(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...) if (level > ql_errlev) return; + ql_msg_trace(0, level, vha, NULL, id, fmt); + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), vha, id); va_start(va, fmt); @@ -2621,6 +2628,8 @@ ql_log_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...) if (level > ql_errlev) return; + ql_msg_trace(0, level, NULL, pdev, id, fmt); + ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, id); va_start(va, fmt); @@ -2783,9 +2792,12 @@ void qla_tracing_init(void) { if (is_kdump_kernel()) return; + + qla_trace_init(&qla_message_trace, "message_trace", ql2xnum_msg_trace); } void qla_tracing_exit(void) { + qla_trace_uninit(&qla_message_trace); } #endif /* QLA_TRACING */ diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index e0d91a1f81c0..9704cb13aacf 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h @@ -325,6 +325,24 @@ extern uint ql_errlev; #ifdef QLA_TRACING #include +#define QLA_MTRC_DEF_NUM_REC (4*1024) /* Has to be power of 2 */ +#define QLA_MESSAGE_TRACE_DEFINES \ + struct qla_trace qla_message_trace; \ + int ql2xextended_error_logging_msg_trace = 1; \ + module_param(ql2xextended_error_logging_msg_trace, int, 0600); \ + MODULE_PARM_DESC(ql2xextended_error_logging_msg_trace, \ + "Option to log console messages to buffer; uses same " \ + "ql2xextended_error_logging masks."); \ + \ + int ql2xnum_msg_trace = QLA_MTRC_DEF_NUM_REC; \ + module_param(ql2xnum_msg_trace, int, 0600); \ + MODULE_PARM_DESC(ql2xnum_msg_trace, \ + "Number of trace entries in power of 2. (default 4k)"); + +extern int ql2xnum_msg_trace; +extern int ql2xextended_error_logging_msg_trace; + +extern struct qla_trace qla_message_trace; extern void qla_tracing_init(void); extern void qla_tracing_exit(void); @@ -422,6 +440,61 @@ qla_trace_quiesce(struct qla_trace *trc) return ret; } +#define ql_msg_trace(dbg_msg, level, vha, pdev, id, fmt) do { \ + struct va_format _vaf; \ + va_list _va; \ + u32 dbg_off = dbg_msg ? ql_dbg_offset : 0; \ + \ + if (!test_bit(QLA_TRACE_ENABLED, &qla_message_trace.flags)) \ + break; \ + \ + if (dbg_msg && !ql_mask_match_ext(level, \ + &ql2xextended_error_logging_msg_trace)) \ + break; \ + \ + va_start(_va, fmt); \ + \ + _vaf.fmt = fmt; \ + _vaf.va = &_va; \ + __ql_msg_trace(&qla_message_trace, vha, pdev, \ + id + dbg_off, &_vaf); \ + \ + va_end(_va); \ +} while (0) + +/* Messages beyond QLA_TRACE_LINE_SIZE characters are not printed */ +static inline void +__ql_msg_trace(struct qla_trace *trc, scsi_qla_host_t *vha, + struct pci_dev *pdev, uint id, struct va_format *vaf) +{ + int tl; + char *buf; + u64 t_us = ktime_to_us(ktime_get()); + uint cpu = raw_smp_processor_id(); + + buf = qla_get_trace_next(trc); + if (!buf) + return; + + if (vha) { + const struct pci_dev *_pdev = vha->hw->pdev; + tl = snprintf(buf, QLA_TRACE_LINE_SIZE, + "%12llu %03u %s [%s]-%04x:%ld: %pV", t_us, cpu, + QL_MSGHDR, dev_name(&(_pdev->dev)), id, + vha->host_no, vaf); + } else { + tl = snprintf(buf, QLA_TRACE_LINE_SIZE, + "%12llu %03u %s [%s]-%04x: : %pV", t_us, cpu, QL_MSGHDR, + pdev ? dev_name(&(pdev->dev)) : "0000:00:00.0", + id, vaf); + } + + tl = min(tl, QLA_TRACE_LINE_SIZE - 1); + buf[tl] = '\0'; + + qla_trace_put(trc); +} + static inline void qla_trace_init(struct qla_trace *trc, char *name, u32 num_entries) { @@ -455,10 +528,16 @@ qla_trace_uninit(struct qla_trace *trc) } #else /* QLA_TRACING */ +#define ql_msg_trace(dbg_msg, level, vha, pdev, id, fmt) do { } while (0) #define qla_trace_init(trc, name, num) #define qla_trace_uninit(trc) #define qla_tracing_init() #define qla_tracing_exit() +#define QLA_MESSAGE_TRACE_DEFINES + +#define ql_srb_trace_ext(_level, _vha, _fcport, _fmt, _args...) do { } while (0) +#define ql_srb_trace(_level, _vha, _fmt, _args...) do { } while (0) +#define QLA_SRB_TRACE_DEFINES #endif /* QLA_TRACING */ void __attribute__((format (printf, 4, 5))) diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 98c6390ad1f1..d3f9f6af43f2 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -11,6 +11,10 @@ static struct dentry *qla2x00_dfs_root; static atomic_t qla2x00_dfs_root_count; +#ifdef QLA_TRACING +static QLA_DFS_ROOT_DEFINE_DENTRY(message_trace); /* qla_dfs_message_trace */ +#endif /* QLA_TRACING */ + #define QLA_DFS_RPORT_DEVLOSS_TMO 1 static int @@ -589,6 +593,18 @@ qla_dfs_trace_write(struct file *file, const char __user *buffer, done: return ret; } + +static int +qla_dfs_message_trace_show(struct seq_file *s, void *unused) +{ + return qla_dfs_trace_show(s, unused); +} +static ssize_t +qla_dfs_message_trace_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + return qla_dfs_trace_write(file, buffer, count, pos); +} #endif /* QLA_TRACING */ /* @@ -681,6 +697,10 @@ static const struct file_operations qla_dfs_##_name##_ops = { \ } \ } while (0) +#ifdef QLA_TRACING +QLA_DFS_SETUP_RW(message_trace, struct qla_trace *); +#endif /* QLA_TRACING */ + static int qla_dfs_naqp_open(struct inode *inode, struct file *file) { @@ -788,6 +808,11 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha) ha->tgt.dfs_tgt_sess = debugfs_create_file("tgt_sess", S_IRUSR, ha->dfs_dir, vha, &qla2x00_dfs_tgt_sess_fops); +#ifdef QLA_TRACING + QLA_DFS_ROOT_CREATE_FILE(message_trace, 0600, &qla_message_trace); + +#endif /* QLA_TRACING */ + if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) { ha->tgt.dfs_naqp = debugfs_create_file("naqp", 0400, ha->dfs_dir, vha, &dfs_naqp_ops); @@ -847,6 +872,11 @@ qla2x00_dfs_remove(scsi_qla_host_t *vha) vha->dfs_rport_root = NULL; } +#ifdef QLA_TRACING + QLA_DFS_ROOT_REMOVE_FILE(message_trace); + +#endif /* QLA_TRACING */ + if (ha->dfs_dir) { debugfs_remove(ha->dfs_dir); ha->dfs_dir = NULL; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 5dd2932382ee..8c149a3482cb 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 uint32_t ql_dbg_offset; 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 0d2397069cac..b937283f5e53 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -117,6 +117,8 @@ MODULE_PARM_DESC(ql2xextended_error_logging, "ql2xextended_error_logging=1).\n" "\t\tDo LOGICAL OR of the value to enable more than one level"); +QLA_MESSAGE_TRACE_DEFINES; + int ql2xshiftctondsd = 6; module_param(ql2xshiftctondsd, int, S_IRUGO); MODULE_PARM_DESC(ql2xshiftctondsd, From patchwork Fri Jul 15 06:02:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 591139 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 EFBEEC433EF for ; Fri, 15 Jul 2022 06:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230151AbiGOGCq (ORCPT ); Fri, 15 Jul 2022 02:02:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbiGOGCg (ORCPT ); Fri, 15 Jul 2022 02:02:36 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC20B7A53C for ; Thu, 14 Jul 2022 23:02:34 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26F1ifoA013575 for ; Thu, 14 Jul 2022 23:02:34 -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=zgOS0yBZ3xA72UvgJZ2lsFILTGx9fkGbWOJGG/H1kVo=; b=i3BjEx3FSQDUmLe4nciLlLPmTs2xgLqBSWX7D6Kupb8bOsPyC1sT8H1QdZRiHO12gXYN 4JRGCLlru/FXBv3HwTqZ5Y5rdZ6y8yvQ5mAHKVotKcmrN+DWtL+SjVwxc8ryee+iyaHC hQ43lryUMHJ3fYpfV5GGjRfXZjTnuT3ND+KzmbCrOxC7fZVfqkk9uyOCSJ+zymZtxJh3 UwB0sw8fEG0FaZem0RCN2AnQt75fQhx9C6mbtIQc1yI1Xrs3KIoOqdgDr3kkOtlQRT/N qbhA+a3PGenA9XrYWn6k2n0TuIeJEzcxDr71D72kDyacRBw0wSI4q0GOUftPWDRnZtOP Vw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3haxu9gkug-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 14 Jul 2022 23:02:34 -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; Thu, 14 Jul 2022 23:02:32 -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; Thu, 14 Jul 2022 23:02:32 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 9FDAE3F7072; Thu, 14 Jul 2022 23:02:32 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH 4/6] qla2xxx: Add srb tracing Date: Thu, 14 Jul 2022 23:02:25 -0700 Message-ID: <20220715060227.23923-5-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220715060227.23923-1-njavali@marvell.com> References: <20220715060227.23923-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: B3s9v5QdRfDW4vU5Bt5PJKY6Y3LPjowo X-Proofpoint-GUID: B3s9v5QdRfDW4vU5Bt5PJKY6Y3LPjowo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_02,2022-07-14_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Arun Easi Add a separate driver internal trace to capture srb related info. The debugfs file is: /sys/kernel/debug/qla2xxx/qla2xxx_/srb_trace Like message trace, enable/disable/resize operations are possible by writing: enable/disable/resize= ..to the debugfs file. Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_dbg.h | 67 +++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_def.h | 17 +++++--- drivers/scsi/qla2xxx/qla_dfs.c | 17 ++++++++ drivers/scsi/qla2xxx/qla_inline.h | 12 ++++++ drivers/scsi/qla2xxx/qla_iocb.c | 4 ++ drivers/scsi/qla2xxx/qla_isr.c | 5 +++ drivers/scsi/qla2xxx/qla_os.c | 28 +++++++++++++ 7 files changed, 144 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index 9704cb13aacf..056fbdbc6794 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h @@ -342,6 +342,22 @@ extern uint ql_errlev; extern int ql2xnum_msg_trace; extern int ql2xextended_error_logging_msg_trace; +#define QLA_SRB_TRACE_DEFINES \ + int ql2xextended_error_logging_srb_trace = 1; \ + module_param(ql2xextended_error_logging_srb_trace, int, \ + S_IRUGO|S_IWUSR); \ + MODULE_PARM_DESC(ql2xextended_error_logging_srb_trace, \ + "Option to log srb messages to buffer; uses same " \ + "ql2xextended_error_logging masks."); \ + \ + int ql2xnum_srb_trace = 0; \ + module_param(ql2xnum_srb_trace, int, S_IRUGO); \ + MODULE_PARM_DESC(ql2xnum_srb_trace, \ + "Number of srb trace entries in power of 2. (default 0)"); + +extern int ql2xnum_srb_trace; +extern int ql2xextended_error_logging_srb_trace; + extern struct qla_trace qla_message_trace; extern void qla_tracing_init(void); extern void qla_tracing_exit(void); @@ -495,6 +511,57 @@ __ql_msg_trace(struct qla_trace *trc, scsi_qla_host_t *vha, qla_trace_put(trc); } +#define ql_srb_trace_ext(_level, _vha, _fcport, _fmt, _args...) do { \ + if (_fcport) { \ + __ql_srb_trace(_level, _vha, \ + DBG_FCPORT_PRFMT(_fcport, _fmt, ##_args)); \ + } else { \ + __ql_srb_trace(_level, _vha, \ + "%s: " _fmt "\n", __func__, ##_args); \ + } \ +} while (0) + +#define ql_srb_trace(_level, _vha, _fmt, _args...) \ + __ql_srb_trace(_level, _vha, _fmt, ##_args) + +static inline void +__ql_srb_trace(int level, scsi_qla_host_t *vha, const char *fmt, ...) +{ + int tl; + char *buf; + u64 t_us; + uint cpu; + struct va_format vaf; + va_list va; + + if (!test_bit(QLA_TRACE_ENABLED, &vha->hw->srb_trace.flags)) + return; + + if (!ql_mask_match_ext(level, &ql2xextended_error_logging_srb_trace)) + return; + + t_us = ktime_to_us(ktime_get()); + cpu = raw_smp_processor_id(); + buf = qla_get_trace_next(&vha->hw->srb_trace); + if (!buf) + return; + + va_start(va, fmt); + + vaf.fmt = fmt; + vaf.va = &va; + + tl = snprintf(buf, QLA_TRACE_LINE_SIZE, "%12llu %03u %pV", + t_us, cpu, &vaf); + + tl = min(tl, QLA_TRACE_LINE_SIZE - 1); + buf[tl] = '\0'; + + qla_trace_put(&vha->hw->srb_trace); + + va_end(va); +} + static inline void qla_trace_init(struct qla_trace *trc, char *name, u32 num_entries) { diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 39322105e7be..e1528a4e6ee4 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4793,6 +4793,11 @@ struct qla_hw_data { spinlock_t sadb_lock; /* protects list */ struct els_reject elsrej; u8 edif_post_stop_cnt_down; + +#ifdef QLA_TRACING + QLA_DFS_DEFINE_DENTRY(srb_trace); + struct qla_trace srb_trace; +#endif /* QLA_TRACING */ }; #define RX_ELS_SIZE (roundup(sizeof(struct enode) + ELS_MAX_PAYLOAD, SMP_CACHE_BYTES)) @@ -5493,6 +5498,12 @@ struct ql_vnd_tgt_stats_resp { struct ql_vnd_stats stats; } __packed; +#define DBG_FCPORT_PRFMT(_fp, _fmt, _args...) \ + "%s: %8phC: " _fmt " (state=%d disc_state=%d scan_state=%d loopid=0x%x deleted=%d flags=0x%x)\n", \ + __func__, _fp->port_name, ##_args, atomic_read(&_fp->state), \ + _fp->disc_state, _fp->scan_state, _fp->loop_id, _fp->deleted, \ + _fp->flags + #include "qla_target.h" #include "qla_gbl.h" #include "qla_dbg.h" @@ -5501,10 +5512,4 @@ struct ql_vnd_tgt_stats_resp { #define IS_SESSION_DELETED(_fcport) (_fcport->disc_state == DSC_DELETE_PEND || \ _fcport->disc_state == DSC_DELETED) -#define DBG_FCPORT_PRFMT(_fp, _fmt, _args...) \ - "%s: %8phC: " _fmt " (state=%d disc_state=%d scan_state=%d loopid=0x%x deleted=%d flags=0x%x)\n", \ - __func__, _fp->port_name, ##_args, atomic_read(&_fp->state), \ - _fp->disc_state, _fp->scan_state, _fp->loop_id, _fp->deleted, \ - _fp->flags - #endif diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index d3f9f6af43f2..806cb4afcb30 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -599,12 +599,26 @@ qla_dfs_message_trace_show(struct seq_file *s, void *unused) { return qla_dfs_trace_show(s, unused); } + static ssize_t qla_dfs_message_trace_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos) { return qla_dfs_trace_write(file, buffer, count, pos); } + +static int +qla_dfs_srb_trace_show(struct seq_file *s, void *unused) +{ + return qla_dfs_trace_show(s, unused); +} + +static ssize_t +qla_dfs_srb_trace_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + return qla_dfs_trace_write(file, buffer, count, pos); +} #endif /* QLA_TRACING */ /* @@ -699,6 +713,7 @@ static const struct file_operations qla_dfs_##_name##_ops = { \ #ifdef QLA_TRACING QLA_DFS_SETUP_RW(message_trace, struct qla_trace *); +QLA_DFS_SETUP_RW(srb_trace, struct qla_trace *); #endif /* QLA_TRACING */ static int @@ -811,6 +826,7 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha) #ifdef QLA_TRACING QLA_DFS_ROOT_CREATE_FILE(message_trace, 0600, &qla_message_trace); + QLA_DFS_CREATE_FILE(ha, srb_trace, 0600, ha->dfs_dir, &ha->srb_trace); #endif /* QLA_TRACING */ if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) { @@ -875,6 +891,7 @@ qla2x00_dfs_remove(scsi_qla_host_t *vha) #ifdef QLA_TRACING QLA_DFS_ROOT_REMOVE_FILE(message_trace); + QLA_DFS_REMOVE_FILE(ha, srb_trace); #endif /* QLA_TRACING */ if (ha->dfs_dir) { diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index db17f7f410cd..19f334693a38 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -201,6 +201,10 @@ qla2xxx_get_qpair_sp(scsi_qla_host_t *vha, struct qla_qpair *qpair, return NULL; sp = mempool_alloc(qpair->srb_mempool, flag); + /* Avoid trace for calls from qla2x00_get_sp */ + if (vha->hw->base_qpair != qpair) + ql_srb_trace_ext(ql_dbg_io, vha, fcport, + "sp=%px", sp); if (sp) qla2xxx_init_sp(sp, vha, qpair, fcport); else @@ -214,6 +218,10 @@ void qla2xxx_rel_free_warning(srb_t *sp); static inline void qla2xxx_rel_qpair_sp(struct qla_qpair *qpair, srb_t *sp) { + /* Avoid trace for calls from qla2x00_get_sp */ + if (qpair->vha->hw->base_qpair != qpair) + ql_srb_trace_ext(ql_dbg_io, sp->vha, sp->fcport, + "sp=%px type=%d", sp, sp->type); sp->qpair = NULL; sp->done = qla2xxx_rel_done_warning; sp->free = qla2xxx_rel_free_warning; @@ -234,6 +242,7 @@ qla2x00_get_sp(scsi_qla_host_t *vha, fc_port_t *fcport, gfp_t flag) qpair = vha->hw->base_qpair; sp = qla2xxx_get_qpair_sp(vha, qpair, fcport, flag); + ql_srb_trace_ext(ql_dbg_disc, vha, fcport, "sp=%px", sp); if (!sp) goto done; @@ -247,6 +256,9 @@ qla2x00_get_sp(scsi_qla_host_t *vha, fc_port_t *fcport, gfp_t flag) static inline void qla2x00_rel_sp(srb_t *sp) { + ql_srb_trace_ext(ql_dbg_disc, sp->vha, sp->fcport, + "sp=%px type=%d", sp, sp->type); + QLA_VHA_MARK_NOT_BUSY(sp->vha); qla2xxx_rel_qpair_sp(sp->qpair, sp); } diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 42ce4e1fe744..4fe569ef27ae 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -3826,6 +3826,10 @@ qla2x00_start_sp(srb_t *sp) if (vha->hw->flags.eeh_busy) return -EIO; + ql_srb_trace_ext(ql_dbg_disc, vha, sp->fcport, + "caller=%ps sp=%px type=%d", + __builtin_return_address(0), sp, sp->type); + spin_lock_irqsave(qp->qp_lock_ptr, flags); pkt = __qla2x00_alloc_iocbs(sp->qpair, sp); if (!pkt) { diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 76e79f350a22..af368d3beeab 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3197,6 +3197,11 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) } return; } + + ql_srb_trace_ext(ql_dbg_io, vha, sp->fcport, + "sp=%px handle=0x%x type=%d done=%ps", + sp, sp->handle, sp->type, sp->done); + qla_put_iocbs(sp->qpair, &sp->iores); if (sp->cmd_type != TYPE_SRB) { diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index b937283f5e53..4f9d2c1680c1 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -119,6 +119,8 @@ MODULE_PARM_DESC(ql2xextended_error_logging, QLA_MESSAGE_TRACE_DEFINES; +QLA_SRB_TRACE_DEFINES; + int ql2xshiftctondsd = 6; module_param(ql2xshiftctondsd, int, S_IRUGO); MODULE_PARM_DESC(ql2xshiftctondsd, @@ -752,6 +754,10 @@ void qla2x00_sp_compl(srb_t *sp, int res) struct scsi_cmnd *cmd = GET_CMD_SP(sp); struct completion *comp = sp->comp; + ql_srb_trace_ext(ql_dbg_io, sp->vha, sp->fcport, + "sp=%px handle=0x%x cmd=%px res=%x", + sp, sp->handle, cmd, res); + /* kref: INIT */ kref_put(&sp->cmd_kref, qla2x00_sp_release); cmd->result = res; @@ -844,6 +850,10 @@ void qla2xxx_qpair_sp_compl(srb_t *sp, int res) struct scsi_cmnd *cmd = GET_CMD_SP(sp); struct completion *comp = sp->comp; + ql_srb_trace_ext(ql_dbg_io, sp->vha, sp->fcport, + "sp=%px handle=0x%x cmd=%px res=%x", + sp, sp->handle, cmd, res); + /* ref: INIT */ kref_put(&sp->cmd_kref, qla2x00_sp_release); cmd->result = res; @@ -870,6 +880,10 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) goto qc24_fail_command; } + ql_srb_trace_ext(ql_dbg_io, fcport->vha, fcport, + "cmd=%px mq=%d remchk=0x%x", + cmd, ha->mqenable, fc_remote_port_chkready(rport)); + if (ha->mqenable) { uint32_t tag; uint16_t hwq; @@ -877,6 +891,10 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) tag = blk_mq_unique_tag(scsi_cmd_to_rq(cmd)); hwq = blk_mq_unique_tag_to_hwq(tag); + + ql_srb_trace_ext(ql_dbg_io, fcport->vha, fcport, + "tag=%px hwq=%d", tag, hwq); + qpair = ha->queue_pair_map[hwq]; if (qpair) @@ -1298,6 +1316,10 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) vha->cmd_timeout_cnt++; + ql_srb_trace_ext(ql_dbg_io, sp->vha, sp->fcport, + "sp=%px cmd=%px fast_fail_sts=0x%x", + sp, cmd, fast_fail_status); + if ((sp->fcport && sp->fcport->deleted) || !qpair) return fast_fail_status != SUCCESS ? fast_fail_status : FAILED; @@ -3528,6 +3550,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ql_dbg(ql_dbg_init, base_vha, 0x00f2, "Init done and hba is online.\n"); + qla_trace_init(&ha->srb_trace, "srb_trace", ql2xnum_srb_trace); + if (qla_ini_mode_enabled(base_vha) || qla_dual_mode_enabled(base_vha)) scsi_scan_host(host); @@ -3600,6 +3624,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) rsp = NULL; probe_hw_failed: + qla_trace_uninit(&ha->srb_trace); + qla2x00_mem_free(ha); qla2x00_free_req_que(ha, req); qla2x00_free_rsp_que(ha, rsp); @@ -3883,6 +3909,8 @@ qla2x00_remove_one(struct pci_dev *pdev) qla2x00_delete_all_vps(ha, base_vha); + qla_trace_uninit(&ha->srb_trace); + qla2x00_dfs_remove(base_vha); qla84xx_put_chip(base_vha); From patchwork Fri Jul 15 06:02:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 591605 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 A7362C43334 for ; Fri, 15 Jul 2022 06:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbiGOGCu (ORCPT ); Fri, 15 Jul 2022 02:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbiGOGCg (ORCPT ); Fri, 15 Jul 2022 02:02:36 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2454C7A53E for ; Thu, 14 Jul 2022 23:02:35 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26F1ifoB013575 for ; Thu, 14 Jul 2022 23:02:35 -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=ALN/oPsks1/jbjujDUFPdwuWvYhVDzXAIN9iug2tAAg=; b=kAenYiscnIi9meG5TG+ma+YmRwlXHP6tXn22DsQsgvoepOxN8bPqqES3Z7Qif0TB8GXC 9SJMA/av871/Xo3YuWwKc5Tmg8sj6xldYX8EuiuxrlbMYmLxZv/F8gBdDhiFS5f4xZ2C 4rq+5JKKxpfdi1Hr991CgYhWQyNm9qeHg9XrN6F5YMsAcVs9Xbvp52aP++2YeroNa+Lh NrfJQg51EpyKnHdilS/MdxRiASKcJDt+wgW+5QJ97snYwsFrCthsgU94NVZyoT2R33NQ T8WIvg+CwPpt7XOKs0fkNFjKHgtt4BhSJte3HalWnQjGE659VOAIthMf/4kaVwvzm26e 4A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3haxu9gkug-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 14 Jul 2022 23:02:34 -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; Thu, 14 Jul 2022 23:02:32 -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; Thu, 14 Jul 2022 23:02:32 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id C43663F7073; Thu, 14 Jul 2022 23:02:32 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH 5/6] qla2xxx: Add NVMe parameters support in Auxiliary Image Status Date: Thu, 14 Jul 2022 23:02:26 -0700 Message-ID: <20220715060227.23923-6-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220715060227.23923-1-njavali@marvell.com> References: <20220715060227.23923-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 5MhcFMssAvVLD6XeqoytdVls40OHQ8U9 X-Proofpoint-GUID: 5MhcFMssAvVLD6XeqoytdVls40OHQ8U9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_02,2022-07-14_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 --- 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 e1528a4e6ee4..994b2378e24a 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4809,6 +4809,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; }; @@ -5093,6 +5094,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 Jul 15 06:02:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nilesh Javali X-Patchwork-Id: 591606 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 85FF1C433EF for ; Fri, 15 Jul 2022 06:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbiGOGCo (ORCPT ); Fri, 15 Jul 2022 02:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbiGOGCh (ORCPT ); Fri, 15 Jul 2022 02:02:37 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FEF27AB00 for ; Thu, 14 Jul 2022 23:02:35 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26F1ifoC013575 for ; Thu, 14 Jul 2022 23:02:35 -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=G+sBTl+FwbvHlY4fx8z5Cdir+avAq0GrOHCnk7QW8x9YQ6Jr9wcR910tk8tMsMaY/AL5 I+cghP8Ag1cGfFsGo+1nkaffQV0XtjXM+Tptk+TNwjjHTNbg9OfY9c1iuG6bzIOYYpUd rvezZMFPcFNAH7ZpTZ9UHArJoKNFAZcy1BF5ecQ72sBJfYN/O4+dXxQ5+CPcNc2wmowk +YffFd0kIhaISj0GBF+rzQDPna0XuMsZZ11tOT5lvCU8InJyDgKaaFBVhbxwVzlBUOGH +DDUnWCpMPMwy8B0OOurdpxJWUYohDBPBrb1rezODTULcdJ2YOQYmQsciOGvio2lI0Md /w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3haxu9gkug-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 14 Jul 2022 23:02:35 -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; Thu, 14 Jul 2022 23:02:33 -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; Thu, 14 Jul 2022 23:02:33 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id E8BE63F7076; Thu, 14 Jul 2022 23:02:32 -0700 (PDT) From: Nilesh Javali To: CC: , , , Subject: [PATCH 6/6] qla2xxx: Update version to 10.02.07.900-k Date: Thu, 14 Jul 2022 23:02:27 -0700 Message-ID: <20220715060227.23923-7-njavali@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20220715060227.23923-1-njavali@marvell.com> References: <20220715060227.23923-1-njavali@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 7fRRER-wUTflw8mi9uEdj64fEr83HPwI X-Proofpoint-GUID: 7fRRER-wUTflw8mi9uEdj64fEr83HPwI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_02,2022-07-14_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Nilesh Javali --- 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