Lines Matching refs:srq

51 	struct ipath_srq *srq = to_isrq(ibsrq);  in ipath_post_srq_receive()  local
61 if ((unsigned) wr->num_sge > srq->rq.max_sge) { in ipath_post_srq_receive()
67 spin_lock_irqsave(&srq->rq.lock, flags); in ipath_post_srq_receive()
68 wq = srq->rq.wq; in ipath_post_srq_receive()
70 if (next >= srq->rq.size) in ipath_post_srq_receive()
73 spin_unlock_irqrestore(&srq->rq.lock, flags); in ipath_post_srq_receive()
79 wqe = get_rwqe_ptr(&srq->rq, wq->head); in ipath_post_srq_receive()
87 spin_unlock_irqrestore(&srq->rq.lock, flags); in ipath_post_srq_receive()
106 struct ipath_srq *srq; in ipath_create_srq() local
126 srq = kmalloc(sizeof(*srq), GFP_KERNEL); in ipath_create_srq()
127 if (!srq) { in ipath_create_srq()
135 srq->rq.size = srq_init_attr->attr.max_wr + 1; in ipath_create_srq()
136 srq->rq.max_sge = srq_init_attr->attr.max_sge; in ipath_create_srq()
137 sz = sizeof(struct ib_sge) * srq->rq.max_sge + in ipath_create_srq()
139 srq->rq.wq = vmalloc_user(sizeof(struct ipath_rwq) + srq->rq.size * sz); in ipath_create_srq()
140 if (!srq->rq.wq) { in ipath_create_srq()
151 u32 s = sizeof(struct ipath_rwq) + srq->rq.size * sz; in ipath_create_srq()
153 srq->ip = in ipath_create_srq()
156 srq->rq.wq); in ipath_create_srq()
157 if (!srq->ip) { in ipath_create_srq()
162 err = ib_copy_to_udata(udata, &srq->ip->offset, in ipath_create_srq()
163 sizeof(srq->ip->offset)); in ipath_create_srq()
169 srq->ip = NULL; in ipath_create_srq()
174 spin_lock_init(&srq->rq.lock); in ipath_create_srq()
175 srq->rq.wq->head = 0; in ipath_create_srq()
176 srq->rq.wq->tail = 0; in ipath_create_srq()
177 srq->limit = srq_init_attr->attr.srq_limit; in ipath_create_srq()
189 if (srq->ip) { in ipath_create_srq()
191 list_add(&srq->ip->pending_mmaps, &dev->pending_mmaps); in ipath_create_srq()
195 ret = &srq->ibsrq; in ipath_create_srq()
199 kfree(srq->ip); in ipath_create_srq()
201 vfree(srq->rq.wq); in ipath_create_srq()
203 kfree(srq); in ipath_create_srq()
219 struct ipath_srq *srq = to_isrq(ibsrq); in ipath_modify_srq() local
231 attr->srq_limit : srq->limit) > attr->max_wr) { in ipath_modify_srq()
237 srq->rq.max_sge * sizeof(struct ib_sge); in ipath_modify_srq()
262 spin_lock_irq(&srq->rq.lock); in ipath_modify_srq()
267 owq = srq->rq.wq; in ipath_modify_srq()
269 if (head >= srq->rq.size) in ipath_modify_srq()
272 if (tail >= srq->rq.size) in ipath_modify_srq()
276 n += srq->rq.size - tail; in ipath_modify_srq()
289 wqe = get_rwqe_ptr(&srq->rq, tail); in ipath_modify_srq()
296 if (++tail >= srq->rq.size) in ipath_modify_srq()
299 srq->rq.wq = wq; in ipath_modify_srq()
300 srq->rq.size = size; in ipath_modify_srq()
304 srq->limit = attr->srq_limit; in ipath_modify_srq()
305 spin_unlock_irq(&srq->rq.lock); in ipath_modify_srq()
309 if (srq->ip) { in ipath_modify_srq()
310 struct ipath_mmap_info *ip = srq->ip; in ipath_modify_srq()
311 struct ipath_ibdev *dev = to_idev(srq->ibsrq.device); in ipath_modify_srq()
334 spin_lock_irq(&srq->rq.lock); in ipath_modify_srq()
335 if (attr->srq_limit >= srq->rq.size) in ipath_modify_srq()
338 srq->limit = attr->srq_limit; in ipath_modify_srq()
339 spin_unlock_irq(&srq->rq.lock); in ipath_modify_srq()
344 spin_unlock_irq(&srq->rq.lock); in ipath_modify_srq()
353 struct ipath_srq *srq = to_isrq(ibsrq); in ipath_query_srq() local
355 attr->max_wr = srq->rq.size - 1; in ipath_query_srq()
356 attr->max_sge = srq->rq.max_sge; in ipath_query_srq()
357 attr->srq_limit = srq->limit; in ipath_query_srq()
367 struct ipath_srq *srq = to_isrq(ibsrq); in ipath_destroy_srq() local
373 if (srq->ip) in ipath_destroy_srq()
374 kref_put(&srq->ip->ref, ipath_release_mmap_info); in ipath_destroy_srq()
376 vfree(srq->rq.wq); in ipath_destroy_srq()
377 kfree(srq); in ipath_destroy_srq()