aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2010-09-10 12:15:25 -0400
committerRoland Dreier <rolandd@cisco.com>2010-09-28 13:46:34 -0400
commitaadc4df3087a33ca7fc37f91a024e7b7efdafa75 (patch)
tree41e5da5350ce779d1f6058329166ab9da0cc4c61 /drivers/infiniband/hw/cxgb4/iw_cxgb4.h
parent9e8d1fa3420f489da8a5da47c026511aa71fa50b (diff)
RDMA/cxgb4: Centralize the wait logic
Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4/iw_cxgb4.h')
-rw-r--r--drivers/infiniband/hw/cxgb4/iw_cxgb4.h57
1 files changed, 39 insertions, 18 deletions
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index ed459b8f800f..77801163cd0e 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -79,21 +79,6 @@ static inline void *cplhdr(struct sk_buff *skb)
79 return skb->data; 79 return skb->data;
80} 80}
81 81
82#define C4IW_WR_TO (10*HZ)
83
84struct c4iw_wr_wait {
85 wait_queue_head_t wait;
86 int done;
87 int ret;
88};
89
90static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp)
91{
92 wr_waitp->ret = 0;
93 wr_waitp->done = 0;
94 init_waitqueue_head(&wr_waitp->wait);
95}
96
97struct c4iw_resource { 82struct c4iw_resource {
98 struct kfifo tpt_fifo; 83 struct kfifo tpt_fifo;
99 spinlock_t tpt_fifo_lock; 84 spinlock_t tpt_fifo_lock;
@@ -141,6 +126,44 @@ static inline int c4iw_num_stags(struct c4iw_rdev *rdev)
141 return min((int)T4_MAX_NUM_STAG, (int)(rdev->lldi.vr->stag.size >> 5)); 126 return min((int)T4_MAX_NUM_STAG, (int)(rdev->lldi.vr->stag.size >> 5));
142} 127}
143 128
129#define C4IW_WR_TO (10*HZ)
130
131struct c4iw_wr_wait {
132 wait_queue_head_t wait;
133 int done;
134 int ret;
135};
136
137static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp)
138{
139 wr_waitp->ret = 0;
140 wr_waitp->done = 0;
141 init_waitqueue_head(&wr_waitp->wait);
142}
143
144static inline int c4iw_wait_for_reply(struct c4iw_rdev *rdev,
145 struct c4iw_wr_wait *wr_waitp,
146 u32 hwtid, u32 qpid,
147 const char *func)
148{
149 unsigned to = C4IW_WR_TO;
150 do {
151
152 wait_event_timeout(wr_waitp->wait, wr_waitp->done, to);
153 if (!wr_waitp->done) {
154 printk(KERN_ERR MOD "%s - Device %s not responding - "
155 "tid %u qpid %u\n", func,
156 pci_name(rdev->lldi.pdev), hwtid, qpid);
157 to = to << 2;
158 }
159 } while (!wr_waitp->done);
160 if (wr_waitp->ret)
161 printk(KERN_WARNING MOD "%s: FW reply %d tid %u qpid %u\n",
162 pci_name(rdev->lldi.pdev), wr_waitp->ret, hwtid, qpid);
163 return wr_waitp->ret;
164}
165
166
144struct c4iw_dev { 167struct c4iw_dev {
145 struct ib_device ibdev; 168 struct ib_device ibdev;
146 struct c4iw_rdev rdev; 169 struct c4iw_rdev rdev;
@@ -582,9 +605,7 @@ struct c4iw_ep_common {
582 spinlock_t lock; 605 spinlock_t lock;
583 struct sockaddr_in local_addr; 606 struct sockaddr_in local_addr;
584 struct sockaddr_in remote_addr; 607 struct sockaddr_in remote_addr;
585 wait_queue_head_t waitq; 608 struct c4iw_wr_wait wr_wait;
586 int rpl_done;
587 int rpl_err;
588 unsigned long flags; 609 unsigned long flags;
589}; 610};
590 611