diff options
Diffstat (limited to 'drivers/infiniband/hw/cxgb4/iw_cxgb4.h')
-rw-r--r-- | drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 81 |
1 files changed, 57 insertions, 24 deletions
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index ed459b8f800f..4f045375c8e2 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/list.h> | 35 | #include <linux/list.h> |
36 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <linux/idr.h> | 37 | #include <linux/idr.h> |
38 | #include <linux/workqueue.h> | 38 | #include <linux/completion.h> |
39 | #include <linux/netdevice.h> | 39 | #include <linux/netdevice.h> |
40 | #include <linux/sched.h> | 40 | #include <linux/sched.h> |
41 | #include <linux/pci.h> | 41 | #include <linux/pci.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 | |||
84 | struct c4iw_wr_wait { | ||
85 | wait_queue_head_t wait; | ||
86 | int done; | ||
87 | int ret; | ||
88 | }; | ||
89 | |||
90 | static 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 | |||
97 | struct c4iw_resource { | 82 | struct c4iw_resource { |
98 | struct kfifo tpt_fifo; | 83 | struct kfifo tpt_fifo; |
99 | spinlock_t tpt_fifo_lock; | 84 | spinlock_t tpt_fifo_lock; |
@@ -127,8 +112,11 @@ struct c4iw_rdev { | |||
127 | struct c4iw_dev_ucontext uctx; | 112 | struct c4iw_dev_ucontext uctx; |
128 | struct gen_pool *pbl_pool; | 113 | struct gen_pool *pbl_pool; |
129 | struct gen_pool *rqt_pool; | 114 | struct gen_pool *rqt_pool; |
115 | struct gen_pool *ocqp_pool; | ||
130 | u32 flags; | 116 | u32 flags; |
131 | struct cxgb4_lld_info lldi; | 117 | struct cxgb4_lld_info lldi; |
118 | unsigned long oc_mw_pa; | ||
119 | void __iomem *oc_mw_kva; | ||
132 | }; | 120 | }; |
133 | 121 | ||
134 | static inline int c4iw_fatal_error(struct c4iw_rdev *rdev) | 122 | static inline int c4iw_fatal_error(struct c4iw_rdev *rdev) |
@@ -141,6 +129,52 @@ 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)); | 129 | return min((int)T4_MAX_NUM_STAG, (int)(rdev->lldi.vr->stag.size >> 5)); |
142 | } | 130 | } |
143 | 131 | ||
132 | #define C4IW_WR_TO (10*HZ) | ||
133 | |||
134 | struct c4iw_wr_wait { | ||
135 | struct completion completion; | ||
136 | int ret; | ||
137 | }; | ||
138 | |||
139 | static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp) | ||
140 | { | ||
141 | wr_waitp->ret = 0; | ||
142 | init_completion(&wr_waitp->completion); | ||
143 | } | ||
144 | |||
145 | static inline void c4iw_wake_up(struct c4iw_wr_wait *wr_waitp, int ret) | ||
146 | { | ||
147 | wr_waitp->ret = ret; | ||
148 | complete(&wr_waitp->completion); | ||
149 | } | ||
150 | |||
151 | static inline int c4iw_wait_for_reply(struct c4iw_rdev *rdev, | ||
152 | struct c4iw_wr_wait *wr_waitp, | ||
153 | u32 hwtid, u32 qpid, | ||
154 | const char *func) | ||
155 | { | ||
156 | unsigned to = C4IW_WR_TO; | ||
157 | int ret; | ||
158 | |||
159 | do { | ||
160 | ret = wait_for_completion_timeout(&wr_waitp->completion, to); | ||
161 | if (!ret) { | ||
162 | printk(KERN_ERR MOD "%s - Device %s not responding - " | ||
163 | "tid %u qpid %u\n", func, | ||
164 | pci_name(rdev->lldi.pdev), hwtid, qpid); | ||
165 | if (c4iw_fatal_error(rdev)) { | ||
166 | wr_waitp->ret = -EIO; | ||
167 | break; | ||
168 | } | ||
169 | to = to << 2; | ||
170 | } | ||
171 | } while (!ret); | ||
172 | if (wr_waitp->ret) | ||
173 | PDBG("%s: FW reply %d tid %u qpid %u\n", | ||
174 | pci_name(rdev->lldi.pdev), wr_waitp->ret, hwtid, qpid); | ||
175 | return wr_waitp->ret; | ||
176 | } | ||
177 | |||
144 | struct c4iw_dev { | 178 | struct c4iw_dev { |
145 | struct ib_device ibdev; | 179 | struct ib_device ibdev; |
146 | struct c4iw_rdev rdev; | 180 | struct c4iw_rdev rdev; |
@@ -149,10 +183,7 @@ struct c4iw_dev { | |||
149 | struct idr qpidr; | 183 | struct idr qpidr; |
150 | struct idr mmidr; | 184 | struct idr mmidr; |
151 | spinlock_t lock; | 185 | spinlock_t lock; |
152 | struct list_head entry; | ||
153 | struct delayed_work db_drop_task; | ||
154 | struct dentry *debugfs_root; | 186 | struct dentry *debugfs_root; |
155 | u8 registered; | ||
156 | }; | 187 | }; |
157 | 188 | ||
158 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) | 189 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) |
@@ -327,6 +358,7 @@ struct c4iw_qp { | |||
327 | struct c4iw_qp_attributes attr; | 358 | struct c4iw_qp_attributes attr; |
328 | struct t4_wq wq; | 359 | struct t4_wq wq; |
329 | spinlock_t lock; | 360 | spinlock_t lock; |
361 | struct mutex mutex; | ||
330 | atomic_t refcnt; | 362 | atomic_t refcnt; |
331 | wait_queue_head_t wait; | 363 | wait_queue_head_t wait; |
332 | struct timer_list timer; | 364 | struct timer_list timer; |
@@ -579,12 +611,10 @@ struct c4iw_ep_common { | |||
579 | struct c4iw_dev *dev; | 611 | struct c4iw_dev *dev; |
580 | enum c4iw_ep_state state; | 612 | enum c4iw_ep_state state; |
581 | struct kref kref; | 613 | struct kref kref; |
582 | spinlock_t lock; | 614 | struct mutex mutex; |
583 | struct sockaddr_in local_addr; | 615 | struct sockaddr_in local_addr; |
584 | struct sockaddr_in remote_addr; | 616 | struct sockaddr_in remote_addr; |
585 | wait_queue_head_t waitq; | 617 | struct c4iw_wr_wait wr_wait; |
586 | int rpl_done; | ||
587 | int rpl_err; | ||
588 | unsigned long flags; | 618 | unsigned long flags; |
589 | }; | 619 | }; |
590 | 620 | ||
@@ -654,8 +684,10 @@ int c4iw_init_resource(struct c4iw_rdev *rdev, u32 nr_tpt, u32 nr_pdid); | |||
654 | int c4iw_init_ctrl_qp(struct c4iw_rdev *rdev); | 684 | int c4iw_init_ctrl_qp(struct c4iw_rdev *rdev); |
655 | int c4iw_pblpool_create(struct c4iw_rdev *rdev); | 685 | int c4iw_pblpool_create(struct c4iw_rdev *rdev); |
656 | int c4iw_rqtpool_create(struct c4iw_rdev *rdev); | 686 | int c4iw_rqtpool_create(struct c4iw_rdev *rdev); |
687 | int c4iw_ocqp_pool_create(struct c4iw_rdev *rdev); | ||
657 | void c4iw_pblpool_destroy(struct c4iw_rdev *rdev); | 688 | void c4iw_pblpool_destroy(struct c4iw_rdev *rdev); |
658 | void c4iw_rqtpool_destroy(struct c4iw_rdev *rdev); | 689 | void c4iw_rqtpool_destroy(struct c4iw_rdev *rdev); |
690 | void c4iw_ocqp_pool_destroy(struct c4iw_rdev *rdev); | ||
659 | void c4iw_destroy_resource(struct c4iw_resource *rscp); | 691 | void c4iw_destroy_resource(struct c4iw_resource *rscp); |
660 | int c4iw_destroy_ctrl_qp(struct c4iw_rdev *rdev); | 692 | int c4iw_destroy_ctrl_qp(struct c4iw_rdev *rdev); |
661 | int c4iw_register_device(struct c4iw_dev *dev); | 693 | int c4iw_register_device(struct c4iw_dev *dev); |
@@ -721,6 +753,8 @@ u32 c4iw_rqtpool_alloc(struct c4iw_rdev *rdev, int size); | |||
721 | void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size); | 753 | void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size); |
722 | u32 c4iw_pblpool_alloc(struct c4iw_rdev *rdev, int size); | 754 | u32 c4iw_pblpool_alloc(struct c4iw_rdev *rdev, int size); |
723 | void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size); | 755 | void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size); |
756 | u32 c4iw_ocqp_pool_alloc(struct c4iw_rdev *rdev, int size); | ||
757 | void c4iw_ocqp_pool_free(struct c4iw_rdev *rdev, u32 addr, int size); | ||
724 | int c4iw_ofld_send(struct c4iw_rdev *rdev, struct sk_buff *skb); | 758 | int c4iw_ofld_send(struct c4iw_rdev *rdev, struct sk_buff *skb); |
725 | void c4iw_flush_hw_cq(struct t4_cq *cq); | 759 | void c4iw_flush_hw_cq(struct t4_cq *cq); |
726 | void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count); | 760 | void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count); |
@@ -730,7 +764,6 @@ int c4iw_flush_rq(struct t4_wq *wq, struct t4_cq *cq, int count); | |||
730 | int c4iw_flush_sq(struct t4_wq *wq, struct t4_cq *cq, int count); | 764 | int c4iw_flush_sq(struct t4_wq *wq, struct t4_cq *cq, int count); |
731 | int c4iw_ev_handler(struct c4iw_dev *rnicp, u32 qid); | 765 | int c4iw_ev_handler(struct c4iw_dev *rnicp, u32 qid); |
732 | u16 c4iw_rqes_posted(struct c4iw_qp *qhp); | 766 | u16 c4iw_rqes_posted(struct c4iw_qp *qhp); |
733 | int c4iw_post_zb_read(struct c4iw_qp *qhp); | ||
734 | int c4iw_post_terminate(struct c4iw_qp *qhp, struct t4_cqe *err_cqe); | 767 | int c4iw_post_terminate(struct c4iw_qp *qhp, struct t4_cqe *err_cqe); |
735 | u32 c4iw_get_cqid(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx); | 768 | u32 c4iw_get_cqid(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx); |
736 | void c4iw_put_cqid(struct c4iw_rdev *rdev, u32 qid, | 769 | void c4iw_put_cqid(struct c4iw_rdev *rdev, u32 qid, |