From 721d7ea63ea72c807e9b44d9c3193a8f6c79c60f Mon Sep 17 00:00:00 2001 From: Chesnokov Gleb Date: Sat, 11 Dec 2021 21:51:25 +0300 Subject: [PATCH] qla2x00t-32gbit: Remove support for kernel versions before 3.10 The SCST has dropped support for kernels older than 3.10.0 (RHEL 7 / Centos 7) since SCST v3.6. --- qla2x00t-32gbit/btree-backport.h | 286 -------------------- qla2x00t-32gbit/qla_def.h | 6 - qla2x00t-32gbit/qla_fw.h | 2 - qla2x00t-32gbit/qla_os.c | 7 +- qla2x00t-32gbit/qla_target.h | 4 - qla2x00t-32gbit/target_core_base-backport.h | 29 -- 6 files changed, 1 insertion(+), 333 deletions(-) delete mode 100644 qla2x00t-32gbit/btree-backport.h delete mode 100644 qla2x00t-32gbit/target_core_base-backport.h diff --git a/qla2x00t-32gbit/btree-backport.h b/qla2x00t-32gbit/btree-backport.h deleted file mode 100644 index e1800bdde..000000000 --- a/qla2x00t-32gbit/btree-backport.h +++ /dev/null @@ -1,286 +0,0 @@ -#ifndef _BTREE_BACKPORT_H_ -#define _BTREE_BACKPORT_H_ - -struct btree_head32 { - struct list_head head; -}; - -struct btree_node32 { - struct list_head entry; - u32 key; - void *val; -}; - -struct btree_head64 { - struct list_head head; -}; - -struct btree_node64 { - struct list_head entry; - u64 key; - void *val; -}; - -/** - * btree_init - initialise a btree - * - * @head: the btree head to initialise - * - * This function allocates the memory pool that the - * btree needs. Returns zero or a negative error code - * (-%ENOMEM) when memory allocation fails. - */ -static inline int __must_check btree_init32(struct btree_head32 *head) -{ - INIT_LIST_HEAD(&head->head); - return 0; -} - -static inline int __must_check btree_init64(struct btree_head64 *head) -{ - INIT_LIST_HEAD(&head->head); - return 0; -} - -/** - * btree_destroy - destroy mempool - * - * @head: the btree head to destroy - * - * This function destroys the internal memory pool, use only - * when using btree_init(), not with btree_init_mempool(). - */ -static inline void btree_destroy32(struct btree_head32 *head) -{ -} - -static inline void btree_destroy64(struct btree_head64 *head) -{ -} - -/** - * btree_lookup - look up a key in the btree - * - * @head: the btree to look in - * @geo: the btree geometry - * @key: the key to look up - * - * This function returns the value for the given key, or %NULL. - */ -static inline void *btree_lookup32(struct btree_head32 *head, u32 key) -{ - struct btree_node32 *n; - - list_for_each_entry(n, &head->head, entry) { - if (n->key == key) - return n->val; - } - return NULL; -} - -static inline void *btree_lookup64(struct btree_head64 *head, u64 key) -{ - struct btree_node64 *n; - - list_for_each_entry(n, &head->head, entry) { - if (n->key == key) - return n->val; - } - return NULL; -} - -/** - * btree_insert - insert an entry into the btree - * - * @head: the btree to add to - * @geo: the btree geometry - * @key: the key to add (must not already be present) - * @val: the value to add (must not be %NULL) - * @gfp: allocation flags for node allocations - * - * This function returns 0 if the item could be added, or an - * error code if it failed (may fail due to memory pressure). - */ -static inline int __must_check btree_insert32(struct btree_head32 *head, - u32 key, void *val, gfp_t gfp) -{ - struct btree_node32 *n, *p; - - n = kmalloc(sizeof(*n), gfp); - if (IS_ERR(n)) - return PTR_ERR(n); - n->key = key; - n->val = val; - list_for_each_entry(p, &head->head, entry) { - if (p->key > key) - break; - } - list_add(&n->entry, p->entry.prev); - return 0; -} - -static inline int __must_check btree_insert64(struct btree_head64 *head, - u64 key, void *val, gfp_t gfp) -{ - struct btree_node64 *n, *p; - - n = kmalloc(sizeof(*n), gfp); - if (IS_ERR(n)) - return PTR_ERR(n); - n->key = key; - n->val = val; - list_for_each_entry(p, &head->head, entry) { - if (p->key > key) - break; - } - list_add(&n->entry, p->entry.prev); - return 0; -} - -/** - * btree_update - update an entry in the btree - * - * @head: the btree to update - * @geo: the btree geometry - * @key: the key to update - * @val: the value to change it to (must not be %NULL) - * - * This function returns 0 if the update was successful, or - * -%ENOENT if the key could not be found. - */ -static inline int btree_update32(struct btree_head32 *head, u32 key, void *val) -{ - struct btree_node32 *p; - - list_for_each_entry(p, &head->head, entry) { - if (p->key == key) { - p->val = val; - return 0; - } - } - return -ENOENT; -} - -/** - * btree_remove - remove an entry from the btree - * - * @head: the btree to update - * @geo: the btree geometry - * @key: the key to remove - * - * This function returns the removed entry, or %NULL if the key - * could not be found. - */ -static inline void *btree_remove32(struct btree_head32 *head, u32 key) -{ - struct btree_node32 *p; - void *val; - - list_for_each_entry(p, &head->head, entry) { - if (p->key == key) { - val = p->val; - list_del(&p->entry); - kfree(p); - return val; - } - } - return NULL; -} - -static inline void *btree_remove64(struct btree_head64 *head, u64 key) -{ - struct btree_node64 *p; - void *val; - - list_for_each_entry(p, &head->head, entry) { - if (p->key == key) { - val = p->val; - list_del(&p->entry); - kfree(p); - return val; - } - } - return NULL; -} - -/** - * btree_last - get last entry in btree - * - * @head: btree head - * @geo: btree geometry - * @key: last key - * - * Returns the last entry in the btree, and sets @key to the key - * of that entry; returns NULL if the tree is empty, in that case - * key is not changed. - */ -static inline void *btree_last32(struct btree_head32 *head, u32 *key) -{ - struct btree_node32 *p; - - if (list_empty(&head->head)) - return NULL; - p = list_last_entry(&head->head, typeof(*p), entry); - *key = p->key; - return p->val; -} - -static inline void *btree_last64(struct btree_head64 *head, u64 *key) -{ - struct btree_node64 *p; - - if (list_empty(&head->head)) - return NULL; - p = list_last_entry(&head->head, typeof(*p), entry); - *key = p->key; - return p->val; -} - -/** - * btree_get_prev - get previous entry - * - * @head: btree head - * @geo: btree geometry - * @key: pointer to key - * - * The function returns the next item right before the value pointed to by - * @key, and updates @key with its key, or returns %NULL when there is no - * entry with a key smaller than the given key. - */ -static inline void *btree_get_prev32(struct btree_head32 *head, u32 *key) -{ - struct btree_node32 *p; - - list_for_each_entry_reverse(p, &head->head, entry) { - if (p->key < *key) { - *key = p->key; - return p->val; - } - } - return NULL; -} - -static inline void *btree_get_prev64(struct btree_head64 *head, u64 *key) -{ - struct btree_node64 *p; - - list_for_each_entry_reverse(p, &head->head, entry) { - if (p->key < *key) { - *key = p->key; - return p->val; - } - } - return NULL; -} - -#define btree_for_each_safe32(head, key, val) \ - for (val = btree_last32(head, &key); \ - val; \ - val = btree_get_prev32(head, &key)) - -#define btree_for_each_safe64(head, key, val) \ - for (val = btree_last64(head, &key); \ - val; \ - val = btree_get_prev64(head, &key)) - -#endif /* _BTREE_BACKPORT_H_ */ diff --git a/qla2x00t-32gbit/qla_def.h b/qla2x00t-32gbit/qla_def.h index d2000abe5..d94f6644f 100644 --- a/qla2x00t-32gbit/qla_def.h +++ b/qla2x00t-32gbit/qla_def.h @@ -25,17 +25,11 @@ #include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) #include /* struct bsg_job */ -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) /* * See also commit 5db53f3e80de ("[LogFS] add new flash file system") # v2.6.34. */ #include -#else -#include "btree-backport.h" -#endif #include #include diff --git a/qla2x00t-32gbit/qla_fw.h b/qla2x00t-32gbit/qla_fw.h index af99a61de..1384d36e6 100644 --- a/qla2x00t-32gbit/qla_fw.h +++ b/qla2x00t-32gbit/qla_fw.h @@ -7,9 +7,7 @@ #define __QLA_FW_H #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(RHEL_MAJOR) #include -#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) #include #endif diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index e7f04658c..264c4701e 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -8064,12 +8064,7 @@ static void qla_pci_reset_notify(struct pci_dev *dev, bool prepare) } #endif -static -/* See also commit 494530284f16 ("PCI: Make pci_error_handlers const") # v3.7 */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) || defined(RHEL_MAJOR) -const -#endif -struct pci_error_handlers qla2xxx_err_handler = { +static const struct pci_error_handlers qla2xxx_err_handler = { .error_detected = qla2xxx_pci_error_detected, .mmio_enabled = qla2xxx_pci_mmio_enabled, .slot_reset = qla2xxx_pci_slot_reset, diff --git a/qla2x00t-32gbit/qla_target.h b/qla2x00t-32gbit/qla_target.h index cbdc5b874..efb92e0f0 100644 --- a/qla2x00t-32gbit/qla_target.h +++ b/qla2x00t-32gbit/qla_target.h @@ -736,15 +736,11 @@ struct qla_tgt_func_tmpl { int qla2x00_wait_for_hba_online(struct scsi_qla_host *); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) /* * See also commit c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0") * # v2.6.38. */ #include -#else -#include "target_core_base-backport.h" -#endif #define QLA_TGT_TIMEOUT 10 /* in seconds */ diff --git a/qla2x00t-32gbit/target_core_base-backport.h b/qla2x00t-32gbit/target_core_base-backport.h deleted file mode 100644 index 5f2e42b19..000000000 --- a/qla2x00t-32gbit/target_core_base-backport.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _TARGET_CORE_BASE_BACKPORT_H_ -#define _TARGET_CORE_BASE_BACKPORT_H_ - -#define TRANSPORT_SENSE_BUFFER 96 - -enum se_cmd_flags_table { - SCF_OVERFLOW_BIT = 0x00001000, - SCF_UNDERFLOW_BIT = 0x00002000, -}; - -/* for sam_task_attr */ -#define TCM_SIMPLE_TAG 0x20 -#define TCM_HEAD_TAG 0x21 -#define TCM_ORDERED_TAG 0x22 -#define TCM_ACA_TAG 0x24 - -struct se_cmd { - u64 tag; /* SAM command identifier aka task tag */ - u32 se_cmd_flags; - u32 residual_count; - u64 t_task_lba; - int cpuid; -}; - -struct se_session { - void *fabric_sess_ptr; -}; - -#endif /* _TARGET_CORE_BASE_BACKPORT_H_ */