[ewg] [PATCH] RDMA/cxgb3: Add 2.6.33 backport.

Steve Wise swise at opengridcomputing.com
Fri Aug 13 06:51:51 PDT 2010


Vlad,

Please pull from

ssh://vlad@sofa.openfabrics.org/~swise/scm/ofed_kernel ofed_1_5

This commit adds the cxgb3 backport for 2.6.33.

Thanks,

Steve.

----

RDMA/cxgb3: Add 2.6.33 backport.

Signed-off-by: Steve Wise <swise at opengridcomputing.com>
---

 .../backport/2.6.33/iw_cxgb3_to_2.6.33.patch       |  238 ++++++++++++++++++++
 1 files changed, 238 insertions(+), 0 deletions(-)
 create mode 100644 kernel_patches/backport/2.6.33/iw_cxgb3_to_2.6.33.patch

diff --git a/kernel_patches/backport/2.6.33/iw_cxgb3_to_2.6.33.patch b/kernel_patches/backport/2.6.33/iw_cxgb3_to_2.6.33.patch
new file mode 100644
index 0000000..5114841
--- /dev/null
+++ b/kernel_patches/backport/2.6.33/iw_cxgb3_to_2.6.33.patch
@@ -0,0 +1,238 @@
+diff -up a/drivers/infiniband/hw/cxgb3/cxio_hal.h b/drivers/infiniband/hw/cxgb3/cxio_hal.h
+--- a/drivers/infiniband/hw/cxgb3/cxio_hal.h	2010-08-12 13:40:01.000000000 -0500
++++ b/drivers/infiniband/hw/cxgb3/cxio_hal.h	2010-08-12 11:18:49.000000000 -0500
+@@ -34,6 +34,7 @@
+ 
+ #include <linux/list.h>
+ #include <linux/mutex.h>
++#include <linux/kfifo.h>
+ 
+ #include "t3_cpl.h"
+ #include "t3cdev.h"
+@@ -75,13 +76,13 @@ struct cxio_hal_ctrl_qp {
+ };
+ 
+ struct cxio_hal_resource {
+-	struct kfifo *tpt_fifo;
++	struct kfifo tpt_fifo;
+ 	spinlock_t tpt_fifo_lock;
+-	struct kfifo *qpid_fifo;
++	struct kfifo qpid_fifo;
+ 	spinlock_t qpid_fifo_lock;
+-	struct kfifo *cqid_fifo;
++	struct kfifo cqid_fifo;
+ 	spinlock_t cqid_fifo_lock;
+-	struct kfifo *pdid_fifo;
++	struct kfifo pdid_fifo;
+ 	spinlock_t pdid_fifo_lock;
+ };
+ 
+diff -up a/drivers/infiniband/hw/cxgb3/cxio_resource.c b/drivers/infiniband/hw/cxgb3/cxio_resource.c
+--- a/drivers/infiniband/hw/cxgb3/cxio_resource.c	2010-08-12 13:40:01.000000000 -0500
++++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c	2010-08-12 13:28:30.000000000 -0500
+@@ -41,12 +41,12 @@
+ 
+ #include "genalloc.c"
+ 
+-static struct kfifo *rhdl_fifo;
++static struct kfifo rhdl_fifo;
+ static spinlock_t rhdl_fifo_lock;
+ 
+ #define RANDOM_SIZE 16
+ 
+-static int __cxio_init_resource_fifo(struct kfifo **fifo,
++static int __cxio_init_resource_fifo(struct kfifo *fifo,
+ 				   spinlock_t *fifo_lock,
+ 				   u32 nr, u32 skip_low,
+ 				   u32 skip_high,
+@@ -57,12 +57,11 @@ static int __cxio_init_resource_fifo(str
+ 	u32 rarray[16];
+ 	spin_lock_init(fifo_lock);
+ 
+-	*fifo = kfifo_alloc(nr * sizeof(u32), GFP_KERNEL, fifo_lock);
+-	if (IS_ERR(*fifo))
++	if (kfifo_alloc(fifo, nr * sizeof(u32), GFP_KERNEL))
+ 		return -ENOMEM;
+ 
+ 	for (i = 0; i < skip_low + skip_high; i++)
+-		__kfifo_put(*fifo, (unsigned char *) &entry, sizeof(u32));
++		kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32));
+ 	if (random) {
+ 		j = 0;
+ 		random_bytes = random32();
+@@ -74,33 +73,34 @@ static int __cxio_init_resource_fifo(str
+ 				random_bytes = random32();
+ 			}
+ 			idx = (random_bytes >> (j * 2)) & 0xF;
+-			__kfifo_put(*fifo,
+-				(unsigned char *) &rarray[idx],
+-				sizeof(u32));
++			kfifo_in(fifo, (unsigned char *) &rarray[idx],
++				 sizeof(u32));
+ 			rarray[idx] = i;
+ 			j++;
+ 		}
+ 		for (i = 0; i < RANDOM_SIZE; i++)
+-			__kfifo_put(*fifo,
++			kfifo_in(fifo,
+ 				(unsigned char *) &rarray[i],
+ 				sizeof(u32));
+ 	} else
+ 		for (i = skip_low; i < nr - skip_high; i++)
+-			__kfifo_put(*fifo, (unsigned char *) &i, sizeof(u32));
++			kfifo_in(fifo, (unsigned char *) &i, sizeof(u32));
+ 
+ 	for (i = 0; i < skip_low + skip_high; i++)
+-		kfifo_get(*fifo, (unsigned char *) &entry, sizeof(u32));
++		if (kfifo_out_locked(fifo, (unsigned char *) &entry,
++				     sizeof(u32), fifo_lock))
++			break;
+ 	return 0;
+ }
+ 
+-static int cxio_init_resource_fifo(struct kfifo **fifo, spinlock_t * fifo_lock,
++static int cxio_init_resource_fifo(struct kfifo *fifo, spinlock_t * fifo_lock,
+ 				   u32 nr, u32 skip_low, u32 skip_high)
+ {
+ 	return (__cxio_init_resource_fifo(fifo, fifo_lock, nr, skip_low,
+ 					  skip_high, 0));
+ }
+ 
+-static int cxio_init_resource_fifo_random(struct kfifo **fifo,
++static int cxio_init_resource_fifo_random(struct kfifo *fifo,
+ 				   spinlock_t * fifo_lock,
+ 				   u32 nr, u32 skip_low, u32 skip_high)
+ {
+@@ -115,16 +115,14 @@ static int cxio_init_qpid_fifo(struct cx
+ 
+ 	spin_lock_init(&rdev_p->rscp->qpid_fifo_lock);
+ 
+-	rdev_p->rscp->qpid_fifo = kfifo_alloc(T3_MAX_NUM_QP * sizeof(u32),
+-					      GFP_KERNEL,
+-					      &rdev_p->rscp->qpid_fifo_lock);
+-	if (IS_ERR(rdev_p->rscp->qpid_fifo))
++	if (kfifo_alloc(&rdev_p->rscp->qpid_fifo, T3_MAX_NUM_QP * sizeof(u32),
++		        GFP_KERNEL))
+ 		return -ENOMEM;
+ 
+ 	for (i = 16; i < T3_MAX_NUM_QP; i++)
+ 		if (!(i & rdev_p->qpmask))
+-			__kfifo_put(rdev_p->rscp->qpid_fifo,
+-				    (unsigned char *) &i, sizeof(u32));
++			kfifo_in(&rdev_p->rscp->qpid_fifo, (unsigned char *)&i,
++				 sizeof(u32));
+ 	return 0;
+ }
+ 
+@@ -136,7 +134,7 @@ int cxio_hal_init_rhdl_resource(u32 nr_r
+ 
+ void cxio_hal_destroy_rhdl_resource(void)
+ {
+-	kfifo_free(rhdl_fifo);
++	kfifo_free(&rhdl_fifo);
+ }
+ 
+ /* nr_* must be power of 2 */
+@@ -169,11 +167,11 @@ int cxio_hal_init_resource(struct cxio_r
+ 		goto pdid_err;
+ 	return 0;
+ pdid_err:
+-	kfifo_free(rscp->cqid_fifo);
++	kfifo_free(&rscp->cqid_fifo);
+ cqid_err:
+-	kfifo_free(rscp->qpid_fifo);
++	kfifo_free(&rscp->qpid_fifo);
+ qpid_err:
+-	kfifo_free(rscp->tpt_fifo);
++	kfifo_free(&rscp->tpt_fifo);
+ tpt_err:
+ 	return -ENOMEM;
+ }
+@@ -181,33 +179,35 @@ tpt_err:
+ /*
+  * returns 0 if no resource available
+  */
+-static u32 cxio_hal_get_resource(struct kfifo *fifo)
++static u32 cxio_hal_get_resource(struct kfifo *fifo, spinlock_t *lock)
+ {
+ 	u32 entry;
+-	if (kfifo_get(fifo, (unsigned char *) &entry, sizeof(u32)))
++	if (kfifo_out_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock))
+ 		return entry;
+ 	else
+ 		return 0;	/* fifo emptry */
+ }
+ 
+-static void cxio_hal_put_resource(struct kfifo *fifo, u32 entry)
++static void cxio_hal_put_resource(struct kfifo *fifo, u32 entry,
++				  spinlock_t *lock)
+ {
+-	BUG_ON(kfifo_put(fifo, (unsigned char *) &entry, sizeof(u32)) == 0);
++	kfifo_in_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock);
+ }
+ 
+ u32 cxio_hal_get_stag(struct cxio_hal_resource *rscp)
+ {
+-	return cxio_hal_get_resource(rscp->tpt_fifo);
++	return cxio_hal_get_resource(&rscp->tpt_fifo, &rscp->tpt_fifo_lock);
+ }
+ 
+ void cxio_hal_put_stag(struct cxio_hal_resource *rscp, u32 stag)
+ {
+-	cxio_hal_put_resource(rscp->tpt_fifo, stag);
++	cxio_hal_put_resource(&rscp->tpt_fifo, stag, &rscp->tpt_fifo_lock);
+ }
+ 
+ u32 cxio_hal_get_qpid(struct cxio_hal_resource *rscp)
+ {
+-	u32 qpid = cxio_hal_get_resource(rscp->qpid_fifo);
++	u32 qpid = cxio_hal_get_resource(&rscp->qpid_fifo,
++					 &rscp->qpid_fifo_lock);
+ 	PDBG("%s qpid 0x%x\n", __func__, qpid);
+ 	return qpid;
+ }
+@@ -215,35 +215,35 @@ u32 cxio_hal_get_qpid(struct cxio_hal_re
+ void cxio_hal_put_qpid(struct cxio_hal_resource *rscp, u32 qpid)
+ {
+ 	PDBG("%s qpid 0x%x\n", __func__, qpid);
+-	cxio_hal_put_resource(rscp->qpid_fifo, qpid);
++	cxio_hal_put_resource(&rscp->qpid_fifo, qpid, &rscp->qpid_fifo_lock);
+ }
+ 
+ u32 cxio_hal_get_cqid(struct cxio_hal_resource *rscp)
+ {
+-	return cxio_hal_get_resource(rscp->cqid_fifo);
++	return cxio_hal_get_resource(&rscp->cqid_fifo, &rscp->cqid_fifo_lock);
+ }
+ 
+ void cxio_hal_put_cqid(struct cxio_hal_resource *rscp, u32 cqid)
+ {
+-	cxio_hal_put_resource(rscp->cqid_fifo, cqid);
++	cxio_hal_put_resource(&rscp->cqid_fifo, cqid, &rscp->cqid_fifo_lock);
+ }
+ 
+ u32 cxio_hal_get_pdid(struct cxio_hal_resource *rscp)
+ {
+-	return cxio_hal_get_resource(rscp->pdid_fifo);
++	return cxio_hal_get_resource(&rscp->pdid_fifo, &rscp->pdid_fifo_lock);
+ }
+ 
+ void cxio_hal_put_pdid(struct cxio_hal_resource *rscp, u32 pdid)
+ {
+-	cxio_hal_put_resource(rscp->pdid_fifo, pdid);
++	cxio_hal_put_resource(&rscp->pdid_fifo, pdid, &rscp->pdid_fifo_lock);
+ }
+ 
+ void cxio_hal_destroy_resource(struct cxio_hal_resource *rscp)
+ {
+-	kfifo_free(rscp->tpt_fifo);
+-	kfifo_free(rscp->cqid_fifo);
+-	kfifo_free(rscp->qpid_fifo);
+-	kfifo_free(rscp->pdid_fifo);
++	kfifo_free(&rscp->tpt_fifo);
++	kfifo_free(&rscp->cqid_fifo);
++	kfifo_free(&rscp->qpid_fifo);
++	kfifo_free(&rscp->pdid_fifo);
+ 	kfree(rscp);
+ }
+ 




More information about the ewg mailing list