36 #include <linux/slab.h>
43 return mlx4_buf_offset(&srq->
buf, n << srq->
msrq.wqe_shift);
49 struct ib_srq *ibsrq = &to_mibsrq(srq)->ibsrq;
53 event.element.srq = ibsrq;
62 pr_warn(
"Unexpected event type %d "
63 "on SRQ %06x\n", type, srq->
srqn);
87 if (init_attr->
attr.max_wr >= dev->
dev->caps.max_srq_wqes ||
88 init_attr->
attr.max_sge > dev->
dev->caps.max_srq_sge)
98 srq->
msrq.max_gs = init_attr->
attr.max_sge;
100 desc_size =
max(32
UL,
106 buf_size = srq->
msrq.max * desc_size;
111 if (ib_copy_from_udata(&ucmd, udata,
sizeof ucmd)) {
118 if (IS_ERR(srq->
umem)) {
119 err = PTR_ERR(srq->
umem);
152 for (i = 0; i < srq->
msrq.max; ++
i) {
153 next = get_wqe(srq, i);
157 for (scatter = (
void *) (next + 1);
158 (
void *) scatter < (
void *) next + desc_size;
180 to_mcq(init_attr->
ext.
xrc.cq)->mcq.cqn : 0;
182 to_mxrcd(init_attr->
ext.
xrc.xrcd)->xrcdn :
183 (
u16) dev->
dev->caps.reserved_xrcds;
189 srq->
msrq.event = mlx4_ib_srq_event;
190 srq->
ibsrq.ext.xrc.srq_num = srq->
msrq.srqn;
198 init_attr->
attr.max_wr = srq->
msrq.max - 1;
299 spin_lock(&srq->
lock);
301 next = get_wqe(srq, srq->
tail);
303 srq->
tail = wqe_index;
305 spin_unlock(&srq->
lock);
321 for (nreq = 0;
wr; ++nreq, wr = wr->
next) {
336 next = get_wqe(srq, srq->
head);
340 for (i = 0; i < wr->num_sge; ++
i) {
346 if (i < srq->msrq.max_gs) {
365 spin_unlock_irqrestore(&srq->
lock, flags);