Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
---
- drivers/infiniband/ulp/iser/iscsi_iser.c | 6 ++++++
- drivers/infiniband/ulp/iser/iser_initiator.c | 6 ++++++
- 2 files changed, 12 insertions(+), 0 deletions(-)
+ drivers/infiniband/ulp/iser/iscsi_iser.c | 14 ++++++++++++++
+ drivers/infiniband/ulp/iser/iser_initiator.c | 10 ++++++++++
+ drivers/infiniband/ulp/iser/iser_memory.c | 20 ++++++++++++++++++++
+ 3 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index xxxxxxx..xxxxxxx xxxxxx
/**
* iscsi_iser_conn_create() - create a new iscsi-iser connection
-@@ -897,7 +899,9 @@ static umode_t iser_attr_is_visible(int param_type, int param)
+@@ -703,6 +705,7 @@ iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *s
+ stats->custom[3].value = conn->fmr_unalign_cnt;
+ }
+
++#ifdef HAVE_ISCSI_GET_EP_PARAM
+ static int iscsi_iser_get_ep_param(struct iscsi_endpoint *ep,
+ enum iscsi_param param, char *buf)
+ {
+@@ -725,6 +728,7 @@ static int iscsi_iser_get_ep_param(struct iscsi_endpoint *ep,
+
+ return len;
+ }
++#endif
+
+ /**
+ * iscsi_iser_ep_connect() - Initiate iSER connection establishment
+@@ -853,6 +857,7 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep)
+ iscsi_destroy_endpoint(ep);
+ }
+
++#ifdef HAVE_ISCSI_ATTR_IS_VISIBLE
+ static umode_t iser_attr_is_visible(int param_type, int param)
+ {
+ switch (param_type) {
+@@ -897,7 +902,9 @@ static umode_t iser_attr_is_visible(int param_type, int param)
case ISCSI_PARAM_TGT_RESET_TMO:
case ISCSI_PARAM_IFACE_NAME:
case ISCSI_PARAM_INITIATOR_NAME:
return S_IRUGO;
default:
return 0;
-@@ -952,7 +956,9 @@ static struct iscsi_transport iscsi_iser_transport = {
+@@ -906,6 +913,7 @@ static umode_t iser_attr_is_visible(int param_type, int param)
+
+ return 0;
+ }
++#endif
+
+ static struct scsi_host_template iscsi_iser_sht = {
+ .module = THIS_MODULE,
+@@ -935,10 +943,14 @@ static struct iscsi_transport iscsi_iser_transport = {
+ .create_conn = iscsi_iser_conn_create,
+ .bind_conn = iscsi_iser_conn_bind,
+ .destroy_conn = iscsi_conn_teardown,
++#ifdef HAVE_ISCSI_ATTR_IS_VISIBLE
+ .attr_is_visible = iser_attr_is_visible,
++#endif
+ .set_param = iscsi_iser_set_param,
+ .get_conn_param = iscsi_conn_get_param,
++#ifdef HAVE_ISCSI_GET_EP_PARAM
+ .get_ep_param = iscsi_iser_get_ep_param,
++#endif
+ .get_session_param = iscsi_session_get_param,
+ .start_conn = iscsi_iser_conn_start,
+ .stop_conn = iscsi_iser_conn_stop,
+@@ -952,7 +964,9 @@ static struct iscsi_transport iscsi_iser_transport = {
.xmit_task = iscsi_iser_task_xmit,
.cleanup_task = iscsi_iser_cleanup_task,
.alloc_pdu = iscsi_iser_pdu_alloc,
/* Initial post receive buffers */
if (iser_post_recvm(iser_conn, iser_conn->min_posted_rx))
+@@ -385,7 +391,11 @@ int iser_send_command(struct iscsi_conn *conn,
+ unsigned long edtl;
+ int err;
+ struct iser_data_buf *data_buf, *prot_buf;
++#ifdef HAVE_ISCSI_SCSI_REQ
+ struct iscsi_scsi_req *hdr = (struct iscsi_scsi_req *)task->hdr;
++#else
++ struct iscsi_cmd *hdr = (struct iscsi_cmd *)task->hdr;
++#endif
+ struct scsi_cmnd *sc = task->sc;
+ struct iser_tx_desc *tx_desc = &iser_task->desc;
+ static unsigned sig_count;
+diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/infiniband/ulp/iser/iser_memory.c
++++ b/drivers/infiniband/ulp/iser/iser_memory.c
+@@ -39,7 +39,11 @@
+
+ #include "iscsi_iser.h"
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
++#define ISER_KMALLOC_THRESHOLD 0x80000 /* 512K - kmalloc limit */
++#else
+ #define ISER_KMALLOC_THRESHOLD 0x20000 /* 128K - kmalloc limit */
++#endif
+
+ /**
+ * iser_start_rdma_unaligned_sg
+@@ -79,11 +83,19 @@ static int iser_start_rdma_unaligned_sg(struct iscsi_iser_task *iser_task,
+ sgl = (struct scatterlist *)data->buf;
+ p = mem;
+ for_each_sg(sgl, sg, data->size, i) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ from = kmap_atomic(sg_page(sg));
++#else
++ from = kmap_atomic(sg_page(sg), KM_USER0);
++#endif
+ memcpy(p,
+ from + sg->offset,
+ sg->length);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ kunmap_atomic(from);
++#else
++ kunmap_atomic(from, KM_USER0);
++#endif
+ p += sg->length;
+ }
+ }
+@@ -137,11 +149,19 @@ void iser_finalize_rdma_unaligned_sg(struct iscsi_iser_task *iser_task,
+
+ p = mem;
+ for_each_sg(sgl, sg, sg_size, i) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ to = kmap_atomic(sg_page(sg));
++#else
++ to = kmap_atomic(sg_page(sg), KM_USER0);
++#endif
+ memcpy(to + sg->offset,
+ p,
+ sg->length);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ kunmap_atomic(to);
++#else
++ kunmap_atomic(to, KM_USER0);
++#endif
+ p += sg->length;
+ }
+ }