From: Gleb C. <lno...@gm...> - 2022-02-23 12:16:06
|
Commit: 6d353e0 GitHub URL: https://github.com/SCST-project/scst/commit/6d353e0a06db8f635f2fe38f12ed291750020191 Author: Gleb Chesnokov Date: 2022-02-23T15:15:18+03:00 Log Message: ----------- qla2x00t-32gbit: Backport to older kernel versions Unbreak the build for the previous commit against kernel versions before v4.15. See also commit ac7fe82b6fcf ("nvme-fc: add a dev_loss_tmo field to the remoteport") v4.15. Modified Paths: -------------- qla2x00t-32gbit/qla_attr.c | 4 ++++ qla2x00t-32gbit/qla_nvme.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_attr.c b/qla2x00t-32gbit/qla_attr.c index c802484..bba716c 100644 --- a/qla2x00t-32gbit/qla_attr.c +++ b/qla2x00t-32gbit/qla_attr.c @@ -2768,13 +2768,17 @@ qla2x00_get_starget_port_id(struct scsi_target *starget) static inline void qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) fc_port_t *fcport = *(fc_port_t **)rport->dd_data; +#endif rport->dev_loss_tmo = timeout ? timeout : 1; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) if (IS_ENABLED(CONFIG_NVME_FC) && fcport && fcport->nvme_remote_port) nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, rport->dev_loss_tmo); +#endif } static void diff --git a/qla2x00t-32gbit/qla_nvme.c b/qla2x00t-32gbit/qla_nvme.c index e38c01d..97d6562 100644 --- a/qla2x00t-32gbit/qla_nvme.c +++ b/qla2x00t-32gbit/qla_nvme.c @@ -83,8 +83,10 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) return ret; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, fcport->dev_loss_tmo); +#endif if (fcport->nvme_prli_service_param & NVME_PRLI_SP_SLER) ql_log(ql_log_info, vha, 0x212a, @@ -752,7 +754,7 @@ void qla_nvme_unregister_remote_port(struct fc_port *fcport) "%s: unregister remoteport on %p %8phN\n", __func__, fcport, fcport->port_name); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) if (test_bit(PFLG_DRIVER_REMOVING, &fcport->vha->pci_flags)) nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0); #endif |
From: Gleb C. <lna...@ya...> - 2022-09-13 07:52:43
|
Commit: c3b8db1 GitHub URL: https://github.com/SCST-project/scst/commit/c3b8db1d416eec956cb6f18382f7d49887de31a1 Author: Gleb Chesnokov Date: 2022-09-13T10:49:31+03:00 Log Message: ----------- qla2x00t-32gbit: Backport to older kernel versions The commit ec325c9913bd ("qla2x00t-32gbit: edif: Add bsg interface to read doorbell events") introduced the use of the sg_copy_buffer() function. The kernel has only exported this function since version v4.2, so use sg_pcopy_from_buffer() instead, which is already supported by older kernel versions. Modified Paths: -------------- qla2x00t-32gbit/qla_edif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_edif.c b/qla2x00t-32gbit/qla_edif.c index 312848f..9b4020b 100644 --- a/qla2x00t-32gbit/qla_edif.c +++ b/qla2x00t-32gbit/qla_edif.c @@ -1142,9 +1142,9 @@ static int qla_edif_consume_dbell(scsi_qla_host_t *vha, BSG_JOB_TYPE *bsg_job) /* 8 = sizeof(ap.event_code + ap.event_data_size) */ dat_size += 8; if (keep) - sg_skip += sg_copy_buffer(bsg_job->reply_payload.sg_list, + sg_skip += sg_pcopy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, - &ap, dat_size, sg_skip, false); + &ap, dat_size, sg_skip); ql_dbg(ql_dbg_edif, vha, 0x09102, "%s Doorbell consumed : type=%d %p\n", |
From: Gleb C. <lna...@ya...> - 2022-11-09 07:49:33
|
Commit: c477948 GitHub URL: https://github.com/SCST-project/scst/commit/c47794811b52409ccb787b4592b0cd0d1d79a701 Author: Gleb Chesnokov Date: 2022-11-09T10:46:27+03:00 Log Message: ----------- 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. Modified Paths: -------------- qla2x00t-32gbit/qla_dbg.c | 42 +++++++++++++++ qla2x00t-32gbit/qla_dbg.h | 4 ++ qla2x00t-32gbit/qla_gbl.h | 2 + qla2x00t-32gbit/qla_os.c | 15 ++++++ 4 files changed, 63 insertions(+) =================================================================== diff --git a/qla2x00t-32gbit/qla_dbg.c b/qla2x00t-32gbit/qla_dbg.c index d7e8454..d9f9dda 100644 --- a/qla2x00t-32gbit/qla_dbg.c +++ b/qla2x00t-32gbit/qla_dbg.c @@ -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); diff --git a/qla2x00t-32gbit/qla_dbg.h b/qla2x00t-32gbit/qla_dbg.h index 70482b5..4ea3463 100644 --- a/qla2x00t-32gbit/qla_dbg.h +++ b/qla2x00t-32gbit/qla_dbg.h @@ -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) */ diff --git a/qla2x00t-32gbit/qla_gbl.h b/qla2x00t-32gbit/qla_gbl.h index 85b99e9..81f1541 100644 --- a/qla2x00t-32gbit/qla_gbl.h +++ b/qla2x00t-32gbit/qla_gbl.h @@ -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; diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 3532820..f3a9aec 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -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); |
From: Gleb C. <lna...@ya...> - 2023-03-13 12:00:24
|
Commit: f3b50fb GitHub URL: https://github.com/SCST-project/scst/commit/f3b50fb570162ad981690028bf5a6b28f7b0343f Author: Gleb Chesnokov Date: 2023-03-13T14:58:28+03:00 Log Message: ----------- qla2x00t-32gbit: Backport to older kernel versions Commit ccf2e9c8fab7 ("qla2x00t-32gbit: Select qpair depending on which CPU post_cmd() gets called") introduced an optimization based on the pci_irq_get_affinity() API. Due to support for older kernel versions, limit the minimum kernel version to use this optimization to v4.9. See also commit ee8d41e53efe ("pci/msi: Retrieve affinity for a vector") # v4.9. Modified Paths: -------------- qla2x00t-32gbit/qla_init.c | 6 ++++++ qla2x00t-32gbit/qla_inline.h | 4 ++++ qla2x00t-32gbit/qla_isr.c | 5 +++++ 3 files changed, 15 insertions(+) =================================================================== diff --git a/qla2x00t-32gbit/qla_init.c b/qla2x00t-32gbit/qla_init.c index 46d4d75..6eeb0a1 100644 --- a/qla2x00t-32gbit/qla_init.c +++ b/qla2x00t-32gbit/qla_init.c @@ -9429,6 +9429,12 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, qpair->req = ha->req_q_map[req_id]; qpair->rsp->req = qpair->req; qpair->rsp->qpair = qpair; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(7, 5)) + /* init qpair to this cpu. Will adjust at run time. */ + qla_cpu_update(qpair, raw_smp_processor_id()); +#endif if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) { if (ha->fw_attributes & BIT_4) diff --git a/qla2x00t-32gbit/qla_inline.h b/qla2x00t-32gbit/qla_inline.h index 7dd8f05..c3f1b3b 100644 --- a/qla2x00t-32gbit/qla_inline.h +++ b/qla2x00t-32gbit/qla_inline.h @@ -541,6 +541,9 @@ qla_mapq_init_qp_cpu_map(struct qla_hw_data *ha, struct qla_msix_entry *msix, struct qla_qpair *qpair) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) || \ + (defined(RHEL_RELEASE_CODE) && \ + RHEL_RELEASE_CODE -0 >= RHEL_RELEASE_VERSION(7, 5)) const struct cpumask *mask; unsigned int cpu; @@ -552,6 +555,7 @@ qla_mapq_init_qp_cpu_map(struct qla_hw_data *ha, ha->qp_cpu_map[cpu] = qpair; } msix->cpuid = qpair->cpuid; +#endif } static inline void diff --git a/qla2x00t-32gbit/qla_isr.c b/qla2x00t-32gbit/qla_isr.c index e9df2ef..966c1b9 100644 --- a/qla2x00t-32gbit/qla_isr.c +++ b/qla2x00t-32gbit/qla_isr.c @@ -3793,6 +3793,11 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, if (rsp->qpair->cpuid != raw_smp_processor_id() || !rsp->qpair->rcv_intr) { rsp->qpair->rcv_intr = 1; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(7, 5)) + qla_cpu_update(rsp->qpair, raw_smp_processor_id()); +#endif } #define __update_rsp_in(_is_shadow_hba, _rsp, _rsp_in) \ |
From: Gleb C. <lna...@ya...> - 2023-06-05 10:47:48
|
Commit: 596800c GitHub URL: https://github.com/SCST-project/scst/commit/596800ce2d75ea9dd01e68c8a14b5baa0e6bd6e5 Author: Gleb Chesnokov Date: 2023-06-05T13:35:03+03:00 Log Message: ----------- qla2x00t-32gbit: Backport to older kernel versions Backport the change from a previous commit to kernel versions prior to v6.0, where commit f26e58bf6f54 ("PCI/AER: Enable error reporting when AER is native") hasn't been introduced. Modified Paths: -------------- qla2x00t-32gbit/qla_def.h | 6 ++++++ qla2x00t-32gbit/qla_os.c | 12 ++++++++++++ 2 files changed, 18 insertions(+) =================================================================== diff --git a/qla2x00t-32gbit/qla_def.h b/qla2x00t-32gbit/qla_def.h index 437200a..b403107 100644 --- a/qla2x00t-32gbit/qla_def.h +++ b/qla2x00t-32gbit/qla_def.h @@ -6,6 +6,9 @@ #ifndef __QLA_DEF_H #define __QLA_DEF_H +#ifndef INSIDE_KERNEL_TREE +#include <linux/version.h> +#endif #include <linux/kernel.h> #include <linux/init.h> #include <linux/types.h> @@ -22,6 +25,9 @@ #include <linux/interrupt.h> #include <linux/workqueue.h> #include <linux/firmware.h> +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#include <linux/aer.h> +#endif #include <linux/mutex.h> #include <linux/btree.h> #include <linux/version.h> diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index fc071df..490568e 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -3010,6 +3010,11 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ql2xallocfwdump = 0; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) + /* This may fail but that's ok */ + pci_enable_pcie_error_reporting(pdev); +#endif + ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL); if (!ha) { ql_log_pci(ql_log_fatal, pdev, 0x0009, @@ -4019,6 +4024,10 @@ qla2x00_remove_one(struct pci_dev *pdev) pci_release_selected_regions(ha->pdev, ha->bars); kfree(ha); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) + pci_disable_pcie_error_reporting(pdev); +#endif + pci_disable_device(pdev); } @@ -6894,6 +6903,9 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work) qla2x00_unmap_iobases(ha); pci_release_selected_regions(ha->pdev, ha->bars); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) + pci_disable_pcie_error_reporting(pdev); +#endif pci_disable_device(pdev); /* |
From: Gleb C. <lna...@ya...> - 2023-07-19 08:37:19
|
Commit: 7a1d0dd GitHub URL: https://github.com/SCST-project/scst/commit/7a1d0ddaf53e3b7d709c17140302e1e139185f2c Author: Gleb Chesnokov Date: 2023-07-19T11:35:51+03:00 Log Message: ----------- qla2x00t-32gbit: Backport to older kernel versions Unbreak the build for the previous commit against kernel versions before v5.1. Modified Paths: -------------- scst/include/backport.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) =================================================================== diff --git a/scst/include/backport.h b/scst/include/backport.h index 80683bc..4e693ae 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -687,6 +687,19 @@ static inline bool list_entry_in_list(const struct list_head *entry) return !list_empty(entry); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(8, 1)) +/* + * See also commit 70b44595eafe ("mm, compaction: use free lists to quickly + * locate a migration source") # v5.1. + */ +static inline int list_is_first(const struct list_head *list, const struct list_head *head) +{ + return list->prev == head; +} +#endif + /* <linux/lockdep.h> */ /* |
From: Gleb C. <lna...@ya...> - 2023-07-19 08:38:55
|
Commit: d74330a GitHub URL: https://github.com/SCST-project/scst/commit/d74330aed223228e2051050ae1875d3c5a78ebeb Author: Gleb Chesnokov Date: 2023-07-19T11:35:51+03:00 Log Message: ----------- qla2x00t-32gbit: Backport to older kernel versions Unbreak the build for the previous commit against kernel versions before v5.16. See also commit 3080ea5553cc ("stddef: Introduce DECLARE_FLEX_ARRAY() helper") # v5.16. Modified Paths: -------------- scst/include/backport.h | 8 ++++++++ 1 file changed, 8 insertions(+) =================================================================== diff --git a/scst/include/backport.h b/scst/include/backport.h index 4e693ae..f4fc281 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1314,6 +1314,14 @@ static inline void __user *KERNEL_SOCKPTR(void *p) #define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) #endif +#ifndef DECLARE_FLEX_ARRAY +#define DECLARE_FLEX_ARRAY(TYPE, NAME) \ + struct { \ + struct { } __empty_ ## NAME; \ + TYPE NAME[]; \ + } +#endif + /* <linux/string.h> */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) && \ |
From: Gleb C. <lna...@ya...> - 2023-10-10 12:11:54
|
Commit: c94fdd8 GitHub URL: https://github.com/SCST-project/scst/commit/c94fdd810a84885047ee9619064bd7ca540f20b7 Author: Gleb Chesnokov Date: 2023-10-10T15:10:02+03:00 Log Message: ----------- qla2x00t-32gbit: Backport to older kernel versions Unbreak the build for the previous commit against kernel versions before v5.8. See also commit 72e6329f86c7 ("nvme-fc and nvmet-fc: revise LLDD api for LS reception and LS request") # v5.8. Modified Paths: -------------- qla2x00t-32gbit/qla_def.h | 6 ++++++ qla2x00t-32gbit/qla_gbl.h | 2 +- qla2x00t-32gbit/qla_isr.c | 4 ++++ qla2x00t-32gbit/qla_nvme.c | 10 ++++++++++ qla2x00t-32gbit/qla_nvme.h | 4 ++++ qla2x00t-32gbit/qla_os.c | 6 ++++++ 6 files changed, 31 insertions(+), 1 deletion(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_def.h b/qla2x00t-32gbit/qla_def.h index 4c143b3..f009d2c 100644 --- a/qla2x00t-32gbit/qla_def.h +++ b/qla2x00t-32gbit/qla_def.h @@ -389,11 +389,13 @@ struct name_list_extended { u8 sent; }; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) struct qla_nvme_fc_rjt { struct fcnvme_ls_rjt *c; dma_addr_t cdma; u16 size; }; +#endif struct els_reject { struct fc_els_ls_rjt *c; @@ -552,6 +554,7 @@ struct ct_arg { port_id_t id; }; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) struct qla_nvme_lsrjt_pt_arg { struct fc_port *fcport; u8 opcode; @@ -565,6 +568,7 @@ struct qla_nvme_lsrjt_pt_arg { u32 tx_byte_count, rx_byte_count; dma_addr_t tx_addr, rx_addr; }; +#endif /* * SRB extensions. @@ -4890,7 +4894,9 @@ struct qla_hw_data { struct els_reject elsrej; u8 edif_post_stop_cnt_down; struct qla_vp_map *vp_map; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) struct qla_nvme_fc_rjt lsrjt; +#endif struct qla_fw_res fwres ____cacheline_aligned; }; diff --git a/qla2x00t-32gbit/qla_gbl.h b/qla2x00t-32gbit/qla_gbl.h index 767b382..ea684de 100644 --- a/qla2x00t-32gbit/qla_gbl.h +++ b/qla2x00t-32gbit/qla_gbl.h @@ -613,7 +613,7 @@ void qla24xx_queue_purex_item(scsi_qla_host_t *, struct purex_item *, void (*process_item)(struct scsi_qla_host *, struct purex_item *)); void __qla_consume_iocb(struct scsi_qla_host *, void **, struct rsp_que **); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) void qla2xxx_process_purls_iocb(void **pkt, struct rsp_que **rsp); #endif diff --git a/qla2x00t-32gbit/qla_isr.c b/qla2x00t-32gbit/qla_isr.c index 0a2b6b5..a6209b2 100644 --- a/qla2x00t-32gbit/qla_isr.c +++ b/qla2x00t-32gbit/qla_isr.c @@ -3981,7 +3981,9 @@ 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; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) struct pt_ls4_rx_unsol *p; +#endif u16 rsp_in = 0, cur_ring_index; int is_shadow_hba; @@ -4154,6 +4156,7 @@ process_err: qla28xx_sa_update_iocb_entry(vha, rsp->req, (struct sa_update_28xx *)pkt); break; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) case PT_LS4_UNSOL: p = (void *)pkt; if (qla_chk_cont_iocb_avail(vha, rsp, (response_t *)pkt, rsp_in)) { @@ -4167,6 +4170,7 @@ process_err: } qla2xxx_process_purls_iocb((void **)&pkt, &rsp); break; +#endif default: /* Type Not Supported. */ ql_dbg(ql_dbg_async, vha, 0x5042, diff --git a/qla2x00t-32gbit/qla_nvme.c b/qla2x00t-32gbit/qla_nvme.c index acd9b6b..1dcae7a 100644 --- a/qla2x00t-32gbit/qla_nvme.c +++ b/qla2x00t-32gbit/qla_nvme.c @@ -17,6 +17,7 @@ #include <linux/blk-mq.h> static struct nvme_fc_port_template qla_nvme_fc_transport; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) static int qla_nvme_ls_reject_iocb(struct scsi_qla_host *vha, struct qla_qpair *qp, struct qla_nvme_lsrjt_pt_arg *a, @@ -37,6 +38,7 @@ struct qla_nvme_unsol_ctx { int comp_status; spinlock_t cmd_lock; }; +#endif int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) { @@ -251,6 +253,7 @@ static void qla_nvme_sp_ls_done(srb_t *sp, int res) schedule_work(&priv->ls_work); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) static void qla_nvme_release_lsrsp_cmd_kref(struct kref *kref) { struct srb *sp = container_of(kref, struct srb, cmd_kref); @@ -299,6 +302,7 @@ static void qla_nvme_sp_lsrsp_done(srb_t *sp, int res) INIT_WORK(&uctx->lsrsp_work, qla_nvme_lsrsp_complete); schedule_work(&uctx->lsrsp_work); } +#endif /* it assumed that QPair lock is held. */ static void qla_nvme_sp_done(srb_t *sp, int res) @@ -372,6 +376,7 @@ out: kref_put(&sp->cmd_kref, sp->put_fn); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) static int qla_nvme_xmt_ls_rsp(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, struct nvmefc_ls_rsp *fd_resp) @@ -457,6 +462,7 @@ out: kfree(uctx); return rval; } +#endif static void qla_nvme_ls_abort(struct nvme_fc_local_port *lport, struct nvme_fc_remote_port *rport, struct nvmefc_ls_req *fd) @@ -896,7 +902,9 @@ static struct nvme_fc_port_template qla_nvme_fc_transport = { .ls_abort = qla_nvme_ls_abort, .fcp_io = qla_nvme_post_cmd, .fcp_abort = qla_nvme_fcp_abort, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) .xmt_ls_rsp = qla_nvme_xmt_ls_rsp, +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) .map_queues = qla_nvme_map_queues, #endif @@ -1024,6 +1032,7 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha) return ret; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) static void qla_nvme_fc_format_rjt(void *buf, u8 ls_cmd, u8 reason, u8 explanation, u8 vendor) { @@ -1266,6 +1275,7 @@ out: __qla_consume_iocb(vha, pkt, rsp); } } +#endif #else diff --git a/qla2x00t-32gbit/qla_nvme.h b/qla2x00t-32gbit/qla_nvme.h index cd73ce7..c36b7e8 100644 --- a/qla2x00t-32gbit/qla_nvme.h +++ b/qla2x00t-32gbit/qla_nvme.h @@ -24,7 +24,9 @@ #define Q2T_NVME_NUM_TAGS 2048 #define QLA_MAX_FC_SEGMENTS 64 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) struct qla_nvme_unsol_ctx; +#endif struct scsi_qla_host; struct qla_hw_data; struct req_que; @@ -41,7 +43,9 @@ struct nvme_private { struct qla_nvme_rport { struct fc_port *fcport; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) struct qla_nvme_unsol_ctx *uctx; +#endif }; #define COMMAND_NVME 0x88 /* Command Type FC-NVMe IOCB */ diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 1626e87..dbdf67f 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -4538,6 +4538,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len, ha->elsrej.c->er_reason = ELS_RJT_LOGIC; ha->elsrej.c->er_explan = ELS_EXPL_UNAB_DATA; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) ha->lsrjt.size = sizeof(struct fcnvme_ls_rjt); ha->lsrjt.c = dma_alloc_coherent(&ha->pdev->dev, ha->lsrjt.size, &ha->lsrjt.cdma, GFP_KERNEL); @@ -4546,12 +4547,15 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len, "Alloc failed for nvme fc reject cmd.\n"); goto fail_lsrjt; } +#endif return 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) fail_lsrjt: dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, ha->elsrej.c, ha->elsrej.cdma); +#endif fail_elsrej: dma_pool_destroy(ha->purex_dma_pool); fail_flt: @@ -5081,11 +5085,13 @@ qla2x00_mem_free(struct qla_hw_data *ha) ha->elsrej.c = NULL; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) if (ha->lsrjt.c) { dma_free_coherent(&ha->pdev->dev, ha->lsrjt.size, ha->lsrjt.c, ha->lsrjt.cdma); ha->lsrjt.c = NULL; } +#endif ha->init_cb = NULL; ha->init_cb_dma = 0; |