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
This commit is contained in:
Bart Van Assche
2015-07-10 22:27:37 +00:00
parent ae9de304c4
commit 993f290908
3 changed files with 35 additions and 5 deletions

View File

@@ -40,6 +40,13 @@
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <rdma/ib_verbs.h>
#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 == 5
static inline u16 vlan_dev_vlan_id(const void *dev)
{
BUG();
return 0;
}
#endif
#include <rdma/rdma_cm.h>
#include "iser_hdr.h"

View File

@@ -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,

View File

@@ -38,7 +38,12 @@
#include <linux/fs.h> /* everything... */
#include <linux/errno.h> /* error codes */
#include <linux/poll.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
#include <linux/freezer.h>
#else
#define wait_event_freezable(wq, cond) ({ wait_event(wq, cond); 0; })
#endif
#include <linux/file.h>
#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();