mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-17 12:46:27 +00:00
qla2x00t-32gbit: Backport to older kernel versions
Commit 7c15fc8f0d93 ("qla2x00t-32gbit: Enhance driver tracing with
separate tunable and more") introduced the use of the trace.h/trace_events.h
API.
Due to support for older kernel versions, limit the minimum kernel version to
use this enhance driver tracing to v5.5.
See also commit 288797871473 ("tracing: Adding new functions for kernel
access to Ftrace instances") # v5.5.
This commit is contained in:
@@ -2494,6 +2494,7 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
|
||||
struct va_format vaf;
|
||||
char pbuf[64];
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
ql_ktrace(1, level, pbuf, NULL, vha, id, fmt);
|
||||
|
||||
if (!ql_mask_match(level))
|
||||
@@ -2501,13 +2502,27 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
|
||||
|
||||
if (!pbuf[0]) /* set by ql_ktrace */
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, vha, id);
|
||||
#else
|
||||
if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled())
|
||||
return;
|
||||
#endif
|
||||
|
||||
va_start(va, fmt);
|
||||
|
||||
vaf.fmt = fmt;
|
||||
vaf.va = &va;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
pr_warn("%s%pV", pbuf, &vaf);
|
||||
#else
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, vha, id);
|
||||
|
||||
if (!ql_mask_match(level))
|
||||
trace_ql_dbg_log(pbuf, &vaf);
|
||||
else
|
||||
pr_warn("%s%pV", pbuf, &vaf);
|
||||
|
||||
#endif
|
||||
|
||||
va_end(va);
|
||||
|
||||
@@ -2537,7 +2552,9 @@ ql_dbg_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...)
|
||||
if (pdev == NULL)
|
||||
return;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
ql_ktrace(1, level, pbuf, pdev, NULL, id, fmt);
|
||||
#endif
|
||||
|
||||
if (!ql_mask_match(level))
|
||||
return;
|
||||
@@ -2547,9 +2564,14 @@ ql_dbg_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...)
|
||||
vaf.fmt = fmt;
|
||||
vaf.va = &va;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
if (!pbuf[0]) /* set by ql_ktrace */
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), pdev, NULL,
|
||||
id + ql_dbg_offset);
|
||||
#else
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), pdev, NULL,
|
||||
id + ql_dbg_offset);
|
||||
#endif
|
||||
pr_warn("%s%pV", pbuf, &vaf);
|
||||
|
||||
va_end(va);
|
||||
@@ -2578,10 +2600,14 @@ ql_log(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
|
||||
if (level > ql_errlev)
|
||||
return;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
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);
|
||||
#else
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, vha, id);
|
||||
#endif
|
||||
|
||||
va_start(va, fmt);
|
||||
|
||||
@@ -2632,10 +2658,14 @@ ql_log_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...)
|
||||
if (level > ql_errlev)
|
||||
return;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
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);
|
||||
#else
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), pdev, NULL, id);
|
||||
#endif
|
||||
|
||||
va_start(va, fmt);
|
||||
|
||||
@@ -2730,11 +2760,16 @@ ql_log_qp(uint32_t level, struct qla_qpair *qpair, int32_t id,
|
||||
if (level > ql_errlev)
|
||||
return;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
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);
|
||||
#else
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, qpair ? qpair->vha : NULL, id);
|
||||
|
||||
#endif
|
||||
|
||||
va_start(va, fmt);
|
||||
|
||||
@@ -2780,7 +2815,9 @@ ql_dbg_qp(uint32_t level, struct qla_qpair *qpair, int32_t id,
|
||||
struct va_format vaf;
|
||||
char pbuf[128];
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
ql_ktrace(1, level, pbuf, NULL, qpair ? qpair->vha : NULL, id, fmt);
|
||||
#endif
|
||||
|
||||
if (!ql_mask_match(level))
|
||||
return;
|
||||
@@ -2790,9 +2827,14 @@ ql_dbg_qp(uint32_t level, struct qla_qpair *qpair, int32_t id,
|
||||
vaf.fmt = fmt;
|
||||
vaf.va = &va;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
if (!pbuf[0]) /* set by ql_ktrace */
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL,
|
||||
qpair ? qpair->vha : NULL, id + ql_dbg_offset);
|
||||
#else
|
||||
ql_dbg_prefix(pbuf, ARRAY_SIZE(pbuf), NULL, qpair ? qpair->vha : NULL,
|
||||
id + ql_dbg_offset);
|
||||
#endif
|
||||
|
||||
pr_warn("%s%pV", pbuf, &vaf);
|
||||
|
||||
|
||||
@@ -395,6 +395,8 @@ ql_mask_match_ext(uint level, int *log_tunable)
|
||||
return (level & *log_tunable) == level;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
|
||||
/* Assumes local variable pbuf and pbuf_ready present. */
|
||||
#define ql_ktrace(dbg_msg, level, pbuf, pdev, vha, id, fmt) do { \
|
||||
struct va_format _vaf; \
|
||||
@@ -428,3 +430,5 @@ ql_mask_match_ext(uint level, int *log_tunable)
|
||||
#else /* QLA_ENABLE_KERNEL_TRACING */
|
||||
#define QLA_TRACE_ENABLE(_tr)
|
||||
#endif /* QLA_ENABLE_KERNEL_TRACING */
|
||||
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) */
|
||||
|
||||
@@ -163,7 +163,9 @@ extern int ql2xrdpenable;
|
||||
extern int ql2xsmartsan;
|
||||
extern int ql2xallocfwdump;
|
||||
extern int ql2xextended_error_logging;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
extern int ql2xextended_error_logging_ktrace;
|
||||
#endif
|
||||
extern int ql2xiidmaenable;
|
||||
extern int ql2xmqsupport;
|
||||
extern int ql2xfwloadbin;
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
#include <linux/refcount.h>
|
||||
#endif
|
||||
#include <linux/crash_dump.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
#include <linux/trace_events.h>
|
||||
#include <linux/trace.h>
|
||||
#endif
|
||||
|
||||
#include <scsi/scsi_tcq.h>
|
||||
#include <scsi/scsicam.h>
|
||||
@@ -50,7 +52,9 @@ static int apidev_major;
|
||||
*/
|
||||
struct kmem_cache *srb_cachep;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
struct trace_array *qla_trc_array;
|
||||
#endif
|
||||
|
||||
int ql2xfulldump_on_mpifail;
|
||||
module_param(ql2xfulldump_on_mpifail, int, S_IRUGO | S_IWUSR);
|
||||
@@ -134,10 +138,12 @@ MODULE_PARM_DESC(ql2xextended_error_logging,
|
||||
"ql2xextended_error_logging=1).\n"
|
||||
"\t\tDo LOGICAL OR of the value to enable more than one level");
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
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");
|
||||
#endif
|
||||
|
||||
int ql2xshiftctondsd = 6;
|
||||
module_param(ql2xshiftctondsd, int, S_IRUGO);
|
||||
@@ -2890,6 +2896,7 @@ static void qla2x00_iocb_work_fn(struct work_struct *work)
|
||||
spin_unlock_irqrestore(&vha->work_lock, flags);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
static void
|
||||
qla_trace_init(void)
|
||||
{
|
||||
@@ -2910,6 +2917,7 @@ qla_trace_uninit(void)
|
||||
return;
|
||||
trace_array_put(qla_trc_array);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PCI driver interface
|
||||
@@ -8323,7 +8331,9 @@ qla2x00_module_init(void)
|
||||
BUILD_BUG_ON(sizeof(sw_info_t) != 32);
|
||||
BUILD_BUG_ON(sizeof(target_id_t) != 2);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
qla_trace_init();
|
||||
#endif
|
||||
|
||||
/* Allocate cache for SRBs. */
|
||||
srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
|
||||
@@ -8409,7 +8419,9 @@ qlt_exit:
|
||||
destroy_cache:
|
||||
kmem_cache_destroy(srb_cachep);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
qla_trace_uninit();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -8428,7 +8440,10 @@ qla2x00_module_exit(void)
|
||||
fc_release_transport(qla2xxx_transport_template);
|
||||
qlt_exit();
|
||||
kmem_cache_destroy(srb_cachep);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
qla_trace_uninit();
|
||||
#endif
|
||||
}
|
||||
|
||||
module_init(qla2x00_module_init);
|
||||
|
||||
Reference in New Issue
Block a user