From 993f290908b6954eb330c2eb4408f63f6a3f1a73 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 10 Jul 2015 22:27:37 +0000 Subject: [PATCH] isert-scst: Port this driver to RHEL 5 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6416 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser.h | 7 +++++++ iscsi-scst/kernel/isert-scst/iser_rdma.c | 18 +++++++++++++++--- iscsi-scst/kernel/isert-scst/isert_login.c | 15 +++++++++++++-- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser.h b/iscsi-scst/kernel/isert-scst/iser.h index c01e6af67..b6e77d0bd 100644 --- a/iscsi-scst/kernel/isert-scst/iser.h +++ b/iscsi-scst/kernel/isert-scst/iser.h @@ -40,6 +40,13 @@ #include #include #include +#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 == 5 +static inline u16 vlan_dev_vlan_id(const void *dev) +{ + BUG(); + return 0; +} +#endif #include #include "iser_hdr.h" diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index a2b763ba5..d739374d4 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -604,14 +604,21 @@ static int isert_poll_cq(struct isert_cq *cq) } /* callback function for isert_dev->[cq]->cq_comp_work */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) && !defined(BACKPORT_LINUX_WORKQUEUE_TO_2_6_19) +/* A vanilla 2.6.19 or older kernel without backported OFED kernel headers. */ +static void isert_cq_comp_work_cb(void *ctx) +{ + struct isert_cq *cq_desc = ctx; +#else static void isert_cq_comp_work_cb(struct work_struct *work) { - struct isert_cq *cq_desc; + struct isert_cq *cq_desc = + container_of(work, struct isert_cq, cq_comp_work); +#endif int ret; TRACE_ENTRY(); - cq_desc = container_of(work, struct isert_cq, cq_comp_work); ret = isert_poll_cq(cq_desc); if (unlikely(ret < 0)) { /* poll error */ pr_err("ib_poll_cq failed\n"); @@ -636,8 +643,12 @@ static void isert_cq_comp_handler(struct ib_cq *cq, void *context) { struct isert_cq *cq_desc = context; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) + queue_work(cq_desc->cq_workqueue, &cq_desc->cq_comp_work); +#else queue_work_on(smp_processor_id(), cq_desc->cq_workqueue, &cq_desc->cq_comp_work); +#endif } static const char *ib_event_type_str(enum ib_event_type ev_type) @@ -1571,7 +1582,8 @@ struct isert_portal *isert_portal_create(void) goto err_alloc; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) && !defined(RHEL_MAJOR) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5) cm_id = rdma_create_id(isert_cm_evt_handler, portal, RDMA_PS_TCP); #else cm_id = rdma_create_id(isert_cm_evt_handler, portal, RDMA_PS_TCP, diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index f0d6c25bf..158574793 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -38,7 +38,12 @@ #include /* everything... */ #include /* error codes */ #include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) #include +#else +#define wait_event_freezable(wq, cond) ({ wait_event(wq, cond); 0; }) +#endif #include #include "isert_dbg.h" #include "../iscsi.h" @@ -887,7 +892,10 @@ static void __init isert_setup_cdev(struct isert_conn_dev *dev, PRINT_ERROR("Error %d adding "ISER_CONN_DEV_PREFIX"%d", err, index); - dev->dev = device_create(isert_class, NULL, dev->devno, NULL, + dev->dev = device_create(isert_class, NULL, dev->devno, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) + NULL, +#endif ISER_CONN_DEV_PREFIX"%d", index); TRACE_EXIT(); @@ -914,7 +922,10 @@ static void __init isert_setup_listener_cdev(struct isert_listener_dev *dev) if (unlikely(err)) PRINT_ERROR("Error %d adding isert_scst", err); - dev->dev = device_create(isert_class, NULL, dev->devno, NULL, + dev->dev = device_create(isert_class, NULL, dev->devno, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) + NULL, +#endif "isert_scst"); TRACE_EXIT();