[ewg] [PATCH 2/2] IB/iser: move open-iscsi crypto functions to kernel_addons (RHEL4)

Erez Zilber erezz at voltaire.com
Mon Jul 30 06:32:37 PDT 2007


move open-iscsi crypto functions to kernel_addons (RHEL4)

Signed-off-by: Erez Zilber <erezz at voltaire.com>
---
 .../backport/2.6.9_U3/include/linux/crypto.h       |   55 ++++++++++--
 .../backport/2.6.9_U4/include/linux/crypto.h       |   55 ++++++++++--
 .../backport/2.6.9_U5/include/linux/crypto.h       |   55 ++++++++++--
 .../backport/2.6.9_U3/add_open_iscsi.patch         |   94 --------------------
 .../backport/2.6.9_U4/add_open_iscsi.patch         |   94 --------------------
 .../backport/2.6.9_U5/add_open_iscsi.patch         |   94 --------------------
 6 files changed, 147 insertions(+), 300 deletions(-)

diff --git a/kernel_addons/backport/2.6.9_U3/include/linux/crypto.h b/kernel_addons/backport/2.6.9_U3/include/linux/crypto.h
index aecccde..0f02f6f 100644
--- a/kernel_addons/backport/2.6.9_U3/include/linux/crypto.h
+++ b/kernel_addons/backport/2.6.9_U3/include/linux/crypto.h
@@ -1,11 +1,54 @@
-#ifndef LINUX_CRYPTO_BACKPORT_H
-#define LINUX_CRYPTO_BACKPORT_H
+#ifndef BACKPORT_LINUX_CRYPTO_H
+#define BACKPORT_LINUX_CRYPTO_H
 
 #include_next <linux/crypto.h>
 
-#define crypto_hash_init(desc) crypto_digest_init(*desc)
-#define crypto_hash_digest(desc, sg, nbytes, out) crypto_digest_digest(*desc, sg, 1, out)
-#define crypto_hash_update(desc, sg, nbytes) crypto_digest_update(*desc, sg, 1)
-#define crypto_hash_final(desc, out) crypto_digest_final(*desc, out)
+#define CRYPTO_ALG_ASYNC               0x00000080
+
+struct hash_desc
+{
+	struct crypto_tfm *tfm;
+	u32 flags;
+};
+
+static inline int crypto_hash_init(struct hash_desc *desc)
+{
+	crypto_digest_init(desc->tfm);
+	return 0;
+}
+
+static inline int crypto_hash_digest(struct hash_desc *desc,
+                                    struct scatterlist *sg,
+                                    unsigned int nbytes, u8 *out)
+{
+	crypto_digest_digest(desc->tfm, sg, (nbytes+(PAGE_SIZE-1)) / PAGE_SIZE, out);
+	return nbytes;
+}
+
+static inline int crypto_hash_update(struct hash_desc *desc,
+                                    struct scatterlist *sg,
+                                    unsigned int nbytes)
+{
+	crypto_digest_update(desc->tfm, sg, (nbytes+(PAGE_SIZE-1)) / PAGE_SIZE);
+	return nbytes;
+}
+
+static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
+{
+	crypto_digest_final(desc->tfm, out);
+	return 0;
+}
+
+static inline struct crypto_tfm *crypto_alloc_hash(const char *alg_name,
+                                                   u32 type, u32 mask)
+{
+	struct crypto_tfm *ret = crypto_alloc_tfm(alg_name ,type);
+	return ret ? ret : ERR_PTR(-ENOMEM);
+}
+
+static inline void crypto_free_hash(struct crypto_tfm *tfm)
+{
+	crypto_free_tfm(tfm);
+}
 
 #endif
diff --git a/kernel_addons/backport/2.6.9_U4/include/linux/crypto.h b/kernel_addons/backport/2.6.9_U4/include/linux/crypto.h
index aecccde..0f02f6f 100644
--- a/kernel_addons/backport/2.6.9_U4/include/linux/crypto.h
+++ b/kernel_addons/backport/2.6.9_U4/include/linux/crypto.h
@@ -1,11 +1,54 @@
-#ifndef LINUX_CRYPTO_BACKPORT_H
-#define LINUX_CRYPTO_BACKPORT_H
+#ifndef BACKPORT_LINUX_CRYPTO_H
+#define BACKPORT_LINUX_CRYPTO_H
 
 #include_next <linux/crypto.h>
 
-#define crypto_hash_init(desc) crypto_digest_init(*desc)
-#define crypto_hash_digest(desc, sg, nbytes, out) crypto_digest_digest(*desc, sg, 1, out)
-#define crypto_hash_update(desc, sg, nbytes) crypto_digest_update(*desc, sg, 1)
-#define crypto_hash_final(desc, out) crypto_digest_final(*desc, out)
+#define CRYPTO_ALG_ASYNC               0x00000080
+
+struct hash_desc
+{
+	struct crypto_tfm *tfm;
+	u32 flags;
+};
+
+static inline int crypto_hash_init(struct hash_desc *desc)
+{
+	crypto_digest_init(desc->tfm);
+	return 0;
+}
+
+static inline int crypto_hash_digest(struct hash_desc *desc,
+                                    struct scatterlist *sg,
+                                    unsigned int nbytes, u8 *out)
+{
+	crypto_digest_digest(desc->tfm, sg, (nbytes+(PAGE_SIZE-1)) / PAGE_SIZE, out);
+	return nbytes;
+}
+
+static inline int crypto_hash_update(struct hash_desc *desc,
+                                    struct scatterlist *sg,
+                                    unsigned int nbytes)
+{
+	crypto_digest_update(desc->tfm, sg, (nbytes+(PAGE_SIZE-1)) / PAGE_SIZE);
+	return nbytes;
+}
+
+static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
+{
+	crypto_digest_final(desc->tfm, out);
+	return 0;
+}
+
+static inline struct crypto_tfm *crypto_alloc_hash(const char *alg_name,
+                                                   u32 type, u32 mask)
+{
+	struct crypto_tfm *ret = crypto_alloc_tfm(alg_name ,type);
+	return ret ? ret : ERR_PTR(-ENOMEM);
+}
+
+static inline void crypto_free_hash(struct crypto_tfm *tfm)
+{
+	crypto_free_tfm(tfm);
+}
 
 #endif
diff --git a/kernel_addons/backport/2.6.9_U5/include/linux/crypto.h b/kernel_addons/backport/2.6.9_U5/include/linux/crypto.h
index aecccde..0f02f6f 100644
--- a/kernel_addons/backport/2.6.9_U5/include/linux/crypto.h
+++ b/kernel_addons/backport/2.6.9_U5/include/linux/crypto.h
@@ -1,11 +1,54 @@
-#ifndef LINUX_CRYPTO_BACKPORT_H
-#define LINUX_CRYPTO_BACKPORT_H
+#ifndef BACKPORT_LINUX_CRYPTO_H
+#define BACKPORT_LINUX_CRYPTO_H
 
 #include_next <linux/crypto.h>
 
-#define crypto_hash_init(desc) crypto_digest_init(*desc)
-#define crypto_hash_digest(desc, sg, nbytes, out) crypto_digest_digest(*desc, sg, 1, out)
-#define crypto_hash_update(desc, sg, nbytes) crypto_digest_update(*desc, sg, 1)
-#define crypto_hash_final(desc, out) crypto_digest_final(*desc, out)
+#define CRYPTO_ALG_ASYNC               0x00000080
+
+struct hash_desc
+{
+	struct crypto_tfm *tfm;
+	u32 flags;
+};
+
+static inline int crypto_hash_init(struct hash_desc *desc)
+{
+	crypto_digest_init(desc->tfm);
+	return 0;
+}
+
+static inline int crypto_hash_digest(struct hash_desc *desc,
+                                    struct scatterlist *sg,
+                                    unsigned int nbytes, u8 *out)
+{
+	crypto_digest_digest(desc->tfm, sg, (nbytes+(PAGE_SIZE-1)) / PAGE_SIZE, out);
+	return nbytes;
+}
+
+static inline int crypto_hash_update(struct hash_desc *desc,
+                                    struct scatterlist *sg,
+                                    unsigned int nbytes)
+{
+	crypto_digest_update(desc->tfm, sg, (nbytes+(PAGE_SIZE-1)) / PAGE_SIZE);
+	return nbytes;
+}
+
+static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
+{
+	crypto_digest_final(desc->tfm, out);
+	return 0;
+}
+
+static inline struct crypto_tfm *crypto_alloc_hash(const char *alg_name,
+                                                   u32 type, u32 mask)
+{
+	struct crypto_tfm *ret = crypto_alloc_tfm(alg_name ,type);
+	return ret ? ret : ERR_PTR(-ENOMEM);
+}
+
+static inline void crypto_free_hash(struct crypto_tfm *tfm)
+{
+	crypto_free_tfm(tfm);
+}
 
 #endif
diff --git a/kernel_patches/backport/2.6.9_U3/add_open_iscsi.patch b/kernel_patches/backport/2.6.9_U3/add_open_iscsi.patch
index 32e5d58..f912a4f 100644
--- a/kernel_patches/backport/2.6.9_U3/add_open_iscsi.patch
+++ b/kernel_patches/backport/2.6.9_U3/add_open_iscsi.patch
@@ -2,77 +2,6 @@ Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/sc
 ===================================================================
 --- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/iscsi_tcp.c	2007-06-10 06:56:12.000000000 -0700
 +++ ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.c	2007-06-10 07:01:47.000000000 -0700
-@@ -676,7 +676,7 @@ iscsi_tcp_copy(struct iscsi_conn *conn, 
- }
- 
- static inline void
--partial_sg_digest_update(struct hash_desc *desc, struct scatterlist *sg,
-+partial_sg_digest_update(struct crypto_tfm *desc, struct scatterlist *sg,
- 			 int offset, int length)
- {
- 	struct scatterlist temp;
-@@ -684,7 +684,7 @@ partial_sg_digest_update(struct hash_des
- 	memcpy(&temp, sg, sizeof(struct scatterlist));
- 	temp.offset = offset;
- 	temp.length = length;
--	crypto_hash_update(desc, &temp, length);
-+	crypto_hash_update(&desc, &temp, length);
- }
- 
- static void
-@@ -1774,32 +1774,18 @@ iscsi_tcp_conn_create(struct iscsi_cls_s
- 	/* initial operational parameters */
- 	tcp_conn->hdr_size = sizeof(struct iscsi_hdr);
- 
--	tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0,
--						  CRYPTO_ALG_ASYNC);
--	tcp_conn->tx_hash.flags = 0;
--	if (IS_ERR(tcp_conn->tx_hash.tfm)) {
--		printk(KERN_ERR "Could not create connection due to crc32c "
--		       "loading error %ld. Make sure the crc32c module is "
--		       "built as a module or into the kernel\n",
--			PTR_ERR(tcp_conn->tx_hash.tfm));
-+	tcp_conn->tx_hash = crypto_alloc_tfm("crc32c", 0);
-+	if (!tcp_conn->tx_hash)
- 		goto free_tcp_conn;
--	}
- 
--	tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0,
--						  CRYPTO_ALG_ASYNC);
--	tcp_conn->rx_hash.flags = 0;
--	if (IS_ERR(tcp_conn->rx_hash.tfm)) {
--		printk(KERN_ERR "Could not create connection due to crc32c "
--		       "loading error %ld. Make sure the crc32c module is "
--		       "built as a module or into the kernel\n",
--			PTR_ERR(tcp_conn->rx_hash.tfm));
-+	tcp_conn->rx_hash = crypto_alloc_tfm("crc32c", 0);
-+	if (!tcp_conn->rx_hash)
- 		goto free_tx_tfm;
--	}
- 
- 	return cls_conn;
- 
- free_tx_tfm:
--	crypto_free_hash(tcp_conn->tx_hash.tfm);
-+	crypto_free_tfm(tcp_conn->tx_hash);
- free_tcp_conn:
- 	kfree(tcp_conn);
- tcp_conn_alloc_fail:
-@@ -1833,10 +1819,10 @@ iscsi_tcp_conn_destroy(struct iscsi_cls_
- 	iscsi_tcp_release_conn(conn);
- 	iscsi_conn_teardown(cls_conn);
- 
--	if (tcp_conn->tx_hash.tfm)
--		crypto_free_hash(tcp_conn->tx_hash.tfm);
--	if (tcp_conn->rx_hash.tfm)
--		crypto_free_hash(tcp_conn->rx_hash.tfm);
-+	if (tcp_conn->tx_hash)
-+		crypto_free_tfm(tcp_conn->tx_hash);
-+	if (tcp_conn->rx_hash)
-+		crypto_free_tfm(tcp_conn->rx_hash);
- 
- 	kfree(tcp_conn);
- }
 @@ -2145,7 +2131,6 @@ static void iscsi_tcp_session_destroy(st
  static struct scsi_host_template iscsi_sht = {
  	.name			= "iSCSI Initiator over TCP/IP",
@@ -81,29 +10,6 @@ Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/sc
  	.can_queue		= ISCSI_DEF_XMIT_CMDS_MAX - 1,
  	.sg_tablesize		= ISCSI_SG_TABLESIZE,
  	.max_sectors		= 0xFFFF,
-Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.h
-===================================================================
---- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/iscsi_tcp.h	2007-06-10 06:56:12.000000000 -0700
-+++ ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.h	2007-06-10 06:57:25.000000000 -0700
-@@ -49,7 +49,6 @@
- #define ISCSI_SG_TABLESIZE		SG_ALL
- #define ISCSI_TCP_MAX_CMD_LEN		16
- 
--struct crypto_hash;
- struct socket;
- 
- /* Socket connection recieve helper */
-@@ -93,8 +92,8 @@ struct iscsi_tcp_conn {
- 	void			(*old_write_space)(struct sock *);
- 
- 	/* data and header digests */
--	struct hash_desc	tx_hash;	/* CRC32C (Tx) */
--	struct hash_desc	rx_hash;	/* CRC32C (Rx) */
-+	struct crypto_tfm	*tx_hash;	/* CRC32C (Tx) */
-+	struct crypto_tfm	*rx_hash;	/* CRC32C (Rx) */
- 
- 	/* MIB custom statistics */
- 	uint32_t		sendpage_failures_cnt;
 Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/libiscsi.c
 ===================================================================
 --- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/libiscsi.c	2007-06-10 06:56:12.000000000 -0700
diff --git a/kernel_patches/backport/2.6.9_U4/add_open_iscsi.patch b/kernel_patches/backport/2.6.9_U4/add_open_iscsi.patch
index 32e5d58..f912a4f 100644
--- a/kernel_patches/backport/2.6.9_U4/add_open_iscsi.patch
+++ b/kernel_patches/backport/2.6.9_U4/add_open_iscsi.patch
@@ -2,77 +2,6 @@ Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/sc
 ===================================================================
 --- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/iscsi_tcp.c	2007-06-10 06:56:12.000000000 -0700
 +++ ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.c	2007-06-10 07:01:47.000000000 -0700
-@@ -676,7 +676,7 @@ iscsi_tcp_copy(struct iscsi_conn *conn, 
- }
- 
- static inline void
--partial_sg_digest_update(struct hash_desc *desc, struct scatterlist *sg,
-+partial_sg_digest_update(struct crypto_tfm *desc, struct scatterlist *sg,
- 			 int offset, int length)
- {
- 	struct scatterlist temp;
-@@ -684,7 +684,7 @@ partial_sg_digest_update(struct hash_des
- 	memcpy(&temp, sg, sizeof(struct scatterlist));
- 	temp.offset = offset;
- 	temp.length = length;
--	crypto_hash_update(desc, &temp, length);
-+	crypto_hash_update(&desc, &temp, length);
- }
- 
- static void
-@@ -1774,32 +1774,18 @@ iscsi_tcp_conn_create(struct iscsi_cls_s
- 	/* initial operational parameters */
- 	tcp_conn->hdr_size = sizeof(struct iscsi_hdr);
- 
--	tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0,
--						  CRYPTO_ALG_ASYNC);
--	tcp_conn->tx_hash.flags = 0;
--	if (IS_ERR(tcp_conn->tx_hash.tfm)) {
--		printk(KERN_ERR "Could not create connection due to crc32c "
--		       "loading error %ld. Make sure the crc32c module is "
--		       "built as a module or into the kernel\n",
--			PTR_ERR(tcp_conn->tx_hash.tfm));
-+	tcp_conn->tx_hash = crypto_alloc_tfm("crc32c", 0);
-+	if (!tcp_conn->tx_hash)
- 		goto free_tcp_conn;
--	}
- 
--	tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0,
--						  CRYPTO_ALG_ASYNC);
--	tcp_conn->rx_hash.flags = 0;
--	if (IS_ERR(tcp_conn->rx_hash.tfm)) {
--		printk(KERN_ERR "Could not create connection due to crc32c "
--		       "loading error %ld. Make sure the crc32c module is "
--		       "built as a module or into the kernel\n",
--			PTR_ERR(tcp_conn->rx_hash.tfm));
-+	tcp_conn->rx_hash = crypto_alloc_tfm("crc32c", 0);
-+	if (!tcp_conn->rx_hash)
- 		goto free_tx_tfm;
--	}
- 
- 	return cls_conn;
- 
- free_tx_tfm:
--	crypto_free_hash(tcp_conn->tx_hash.tfm);
-+	crypto_free_tfm(tcp_conn->tx_hash);
- free_tcp_conn:
- 	kfree(tcp_conn);
- tcp_conn_alloc_fail:
-@@ -1833,10 +1819,10 @@ iscsi_tcp_conn_destroy(struct iscsi_cls_
- 	iscsi_tcp_release_conn(conn);
- 	iscsi_conn_teardown(cls_conn);
- 
--	if (tcp_conn->tx_hash.tfm)
--		crypto_free_hash(tcp_conn->tx_hash.tfm);
--	if (tcp_conn->rx_hash.tfm)
--		crypto_free_hash(tcp_conn->rx_hash.tfm);
-+	if (tcp_conn->tx_hash)
-+		crypto_free_tfm(tcp_conn->tx_hash);
-+	if (tcp_conn->rx_hash)
-+		crypto_free_tfm(tcp_conn->rx_hash);
- 
- 	kfree(tcp_conn);
- }
 @@ -2145,7 +2131,6 @@ static void iscsi_tcp_session_destroy(st
  static struct scsi_host_template iscsi_sht = {
  	.name			= "iSCSI Initiator over TCP/IP",
@@ -81,29 +10,6 @@ Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/sc
  	.can_queue		= ISCSI_DEF_XMIT_CMDS_MAX - 1,
  	.sg_tablesize		= ISCSI_SG_TABLESIZE,
  	.max_sectors		= 0xFFFF,
-Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.h
-===================================================================
---- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/iscsi_tcp.h	2007-06-10 06:56:12.000000000 -0700
-+++ ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.h	2007-06-10 06:57:25.000000000 -0700
-@@ -49,7 +49,6 @@
- #define ISCSI_SG_TABLESIZE		SG_ALL
- #define ISCSI_TCP_MAX_CMD_LEN		16
- 
--struct crypto_hash;
- struct socket;
- 
- /* Socket connection recieve helper */
-@@ -93,8 +92,8 @@ struct iscsi_tcp_conn {
- 	void			(*old_write_space)(struct sock *);
- 
- 	/* data and header digests */
--	struct hash_desc	tx_hash;	/* CRC32C (Tx) */
--	struct hash_desc	rx_hash;	/* CRC32C (Rx) */
-+	struct crypto_tfm	*tx_hash;	/* CRC32C (Tx) */
-+	struct crypto_tfm	*rx_hash;	/* CRC32C (Rx) */
- 
- 	/* MIB custom statistics */
- 	uint32_t		sendpage_failures_cnt;
 Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/libiscsi.c
 ===================================================================
 --- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/libiscsi.c	2007-06-10 06:56:12.000000000 -0700
diff --git a/kernel_patches/backport/2.6.9_U5/add_open_iscsi.patch b/kernel_patches/backport/2.6.9_U5/add_open_iscsi.patch
index 32e5d58..f912a4f 100644
--- a/kernel_patches/backport/2.6.9_U5/add_open_iscsi.patch
+++ b/kernel_patches/backport/2.6.9_U5/add_open_iscsi.patch
@@ -2,77 +2,6 @@ Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/sc
 ===================================================================
 --- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/iscsi_tcp.c	2007-06-10 06:56:12.000000000 -0700
 +++ ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.c	2007-06-10 07:01:47.000000000 -0700
-@@ -676,7 +676,7 @@ iscsi_tcp_copy(struct iscsi_conn *conn, 
- }
- 
- static inline void
--partial_sg_digest_update(struct hash_desc *desc, struct scatterlist *sg,
-+partial_sg_digest_update(struct crypto_tfm *desc, struct scatterlist *sg,
- 			 int offset, int length)
- {
- 	struct scatterlist temp;
-@@ -684,7 +684,7 @@ partial_sg_digest_update(struct hash_des
- 	memcpy(&temp, sg, sizeof(struct scatterlist));
- 	temp.offset = offset;
- 	temp.length = length;
--	crypto_hash_update(desc, &temp, length);
-+	crypto_hash_update(&desc, &temp, length);
- }
- 
- static void
-@@ -1774,32 +1774,18 @@ iscsi_tcp_conn_create(struct iscsi_cls_s
- 	/* initial operational parameters */
- 	tcp_conn->hdr_size = sizeof(struct iscsi_hdr);
- 
--	tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0,
--						  CRYPTO_ALG_ASYNC);
--	tcp_conn->tx_hash.flags = 0;
--	if (IS_ERR(tcp_conn->tx_hash.tfm)) {
--		printk(KERN_ERR "Could not create connection due to crc32c "
--		       "loading error %ld. Make sure the crc32c module is "
--		       "built as a module or into the kernel\n",
--			PTR_ERR(tcp_conn->tx_hash.tfm));
-+	tcp_conn->tx_hash = crypto_alloc_tfm("crc32c", 0);
-+	if (!tcp_conn->tx_hash)
- 		goto free_tcp_conn;
--	}
- 
--	tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0,
--						  CRYPTO_ALG_ASYNC);
--	tcp_conn->rx_hash.flags = 0;
--	if (IS_ERR(tcp_conn->rx_hash.tfm)) {
--		printk(KERN_ERR "Could not create connection due to crc32c "
--		       "loading error %ld. Make sure the crc32c module is "
--		       "built as a module or into the kernel\n",
--			PTR_ERR(tcp_conn->rx_hash.tfm));
-+	tcp_conn->rx_hash = crypto_alloc_tfm("crc32c", 0);
-+	if (!tcp_conn->rx_hash)
- 		goto free_tx_tfm;
--	}
- 
- 	return cls_conn;
- 
- free_tx_tfm:
--	crypto_free_hash(tcp_conn->tx_hash.tfm);
-+	crypto_free_tfm(tcp_conn->tx_hash);
- free_tcp_conn:
- 	kfree(tcp_conn);
- tcp_conn_alloc_fail:
-@@ -1833,10 +1819,10 @@ iscsi_tcp_conn_destroy(struct iscsi_cls_
- 	iscsi_tcp_release_conn(conn);
- 	iscsi_conn_teardown(cls_conn);
- 
--	if (tcp_conn->tx_hash.tfm)
--		crypto_free_hash(tcp_conn->tx_hash.tfm);
--	if (tcp_conn->rx_hash.tfm)
--		crypto_free_hash(tcp_conn->rx_hash.tfm);
-+	if (tcp_conn->tx_hash)
-+		crypto_free_tfm(tcp_conn->tx_hash);
-+	if (tcp_conn->rx_hash)
-+		crypto_free_tfm(tcp_conn->rx_hash);
- 
- 	kfree(tcp_conn);
- }
 @@ -2145,7 +2131,6 @@ static void iscsi_tcp_session_destroy(st
  static struct scsi_host_template iscsi_sht = {
  	.name			= "iSCSI Initiator over TCP/IP",
@@ -81,29 +10,6 @@ Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/sc
  	.can_queue		= ISCSI_DEF_XMIT_CMDS_MAX - 1,
  	.sg_tablesize		= ISCSI_SG_TABLESIZE,
  	.max_sectors		= 0xFFFF,
-Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.h
-===================================================================
---- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/iscsi_tcp.h	2007-06-10 06:56:12.000000000 -0700
-+++ ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/iscsi_tcp.h	2007-06-10 06:57:25.000000000 -0700
-@@ -49,7 +49,6 @@
- #define ISCSI_SG_TABLESIZE		SG_ALL
- #define ISCSI_TCP_MAX_CMD_LEN		16
- 
--struct crypto_hash;
- struct socket;
- 
- /* Socket connection recieve helper */
-@@ -93,8 +92,8 @@ struct iscsi_tcp_conn {
- 	void			(*old_write_space)(struct sock *);
- 
- 	/* data and header digests */
--	struct hash_desc	tx_hash;	/* CRC32C (Tx) */
--	struct hash_desc	rx_hash;	/* CRC32C (Rx) */
-+	struct crypto_tfm	*tx_hash;	/* CRC32C (Tx) */
-+	struct crypto_tfm	*rx_hash;	/* CRC32C (Rx) */
- 
- 	/* MIB custom statistics */
- 	uint32_t		sendpage_failures_cnt;
 Index: ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check/drivers/scsi/libiscsi.c
 ===================================================================
 --- ofa_1_2_kernel-20070610-0656_linux-2.6.9-42.ELsmp_x86_64_check.orig/drivers/scsi/libiscsi.c	2007-06-10 06:56:12.000000000 -0700
-- 
1.5.2





More information about the ewg mailing list