[ewg] [PATCH 2/2] IB/iser: handle non-sg data with the new sg list api

Erez Zilber erezz at voltaire.com
Tue Sep 11 06:54:07 PDT 2007


In old kerenels (e.g. RH4), the data buffer of a scsi cmd may be a single
data buffer or an sg array. If a single data buffer is used, the new sg list
api doesn't handle it correctly.

Signed-off-by: Erez Zilber <erezz at voltaire.com>
---
 .../backport/2.6.9_U3/iser_cmd_to_2_6_22.patch     |   16 ++++++++++++++++
 .../backport/2.6.9_U4/iser_cmd_to_2_6_22.patch     |   16 ++++++++++++++++
 .../backport/2.6.9_U5/iser_cmd_to_2_6_22.patch     |   16 ++++++++++++++++
 3 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100644 kernel_patches/backport/2.6.9_U3/iser_cmd_to_2_6_22.patch
 create mode 100644 kernel_patches/backport/2.6.9_U4/iser_cmd_to_2_6_22.patch
 create mode 100644 kernel_patches/backport/2.6.9_U5/iser_cmd_to_2_6_22.patch

diff --git a/kernel_patches/backport/2.6.9_U3/iser_cmd_to_2_6_22.patch b/kernel_patches/backport/2.6.9_U3/iser_cmd_to_2_6_22.patch
new file mode 100644
index 0000000..e34c23a
--- /dev/null
+++ b/kernel_patches/backport/2.6.9_U3/iser_cmd_to_2_6_22.patch
@@ -0,0 +1,16 @@
+diff -rup ofa_kernel-1.3-orig/drivers/infiniband/ulp/iser/iser_initiator.c ofa_kernel-1.3-sg-fix/drivers/infiniband/ulp/iser/iser_initiator.c
+--- ofa_kernel-1.3-orig/drivers/infiniband/ulp/iser/iser_initiator.c	2007-09-10 13:11:06.000000000 +0300
++++ ofa_kernel-1.3-sg-fix/drivers/infiniband/ulp/iser/iser_initiator.c	2007-09-10 13:12:38.000000000 +0300
+@@ -354,6 +354,12 @@ int iser_send_command(struct iscsi_conn 
+ 	if (scsi_sg_count(sc)) { /* using a scatter list */
+ 		data_buf->buf  = scsi_sglist(sc);
+ 		data_buf->size = scsi_sg_count(sc);
++	} else if (sc->request_bufflen) {
++		/* using a single buffer - convert it into one entry SG */
++		sg_init_one(&data_buf->sg_single,
++			    sc->request_buffer, sc->request_bufflen);
++		data_buf->buf = &data_buf->sg_single;
++		data_buf->size = 1;
+ 	}
+ 
+ 	data_buf->data_len = scsi_bufflen(sc);
diff --git a/kernel_patches/backport/2.6.9_U4/iser_cmd_to_2_6_22.patch b/kernel_patches/backport/2.6.9_U4/iser_cmd_to_2_6_22.patch
new file mode 100644
index 0000000..e34c23a
--- /dev/null
+++ b/kernel_patches/backport/2.6.9_U4/iser_cmd_to_2_6_22.patch
@@ -0,0 +1,16 @@
+diff -rup ofa_kernel-1.3-orig/drivers/infiniband/ulp/iser/iser_initiator.c ofa_kernel-1.3-sg-fix/drivers/infiniband/ulp/iser/iser_initiator.c
+--- ofa_kernel-1.3-orig/drivers/infiniband/ulp/iser/iser_initiator.c	2007-09-10 13:11:06.000000000 +0300
++++ ofa_kernel-1.3-sg-fix/drivers/infiniband/ulp/iser/iser_initiator.c	2007-09-10 13:12:38.000000000 +0300
+@@ -354,6 +354,12 @@ int iser_send_command(struct iscsi_conn 
+ 	if (scsi_sg_count(sc)) { /* using a scatter list */
+ 		data_buf->buf  = scsi_sglist(sc);
+ 		data_buf->size = scsi_sg_count(sc);
++	} else if (sc->request_bufflen) {
++		/* using a single buffer - convert it into one entry SG */
++		sg_init_one(&data_buf->sg_single,
++			    sc->request_buffer, sc->request_bufflen);
++		data_buf->buf = &data_buf->sg_single;
++		data_buf->size = 1;
+ 	}
+ 
+ 	data_buf->data_len = scsi_bufflen(sc);
diff --git a/kernel_patches/backport/2.6.9_U5/iser_cmd_to_2_6_22.patch b/kernel_patches/backport/2.6.9_U5/iser_cmd_to_2_6_22.patch
new file mode 100644
index 0000000..e34c23a
--- /dev/null
+++ b/kernel_patches/backport/2.6.9_U5/iser_cmd_to_2_6_22.patch
@@ -0,0 +1,16 @@
+diff -rup ofa_kernel-1.3-orig/drivers/infiniband/ulp/iser/iser_initiator.c ofa_kernel-1.3-sg-fix/drivers/infiniband/ulp/iser/iser_initiator.c
+--- ofa_kernel-1.3-orig/drivers/infiniband/ulp/iser/iser_initiator.c	2007-09-10 13:11:06.000000000 +0300
++++ ofa_kernel-1.3-sg-fix/drivers/infiniband/ulp/iser/iser_initiator.c	2007-09-10 13:12:38.000000000 +0300
+@@ -354,6 +354,12 @@ int iser_send_command(struct iscsi_conn 
+ 	if (scsi_sg_count(sc)) { /* using a scatter list */
+ 		data_buf->buf  = scsi_sglist(sc);
+ 		data_buf->size = scsi_sg_count(sc);
++	} else if (sc->request_bufflen) {
++		/* using a single buffer - convert it into one entry SG */
++		sg_init_one(&data_buf->sg_single,
++			    sc->request_buffer, sc->request_bufflen);
++		data_buf->buf = &data_buf->sg_single;
++		data_buf->size = 1;
+ 	}
+ 
+ 	data_buf->data_len = scsi_bufflen(sc);
-- 
1.5.3





More information about the ewg mailing list