Lines Matching refs:mcast

109 	struct rvt_mcast *mcast;  in rvt_mcast_alloc()  local
111 mcast = kzalloc(sizeof(*mcast), GFP_KERNEL); in rvt_mcast_alloc()
112 if (!mcast) in rvt_mcast_alloc()
115 mcast->mcast_addr.mgid = *mgid; in rvt_mcast_alloc()
116 mcast->mcast_addr.lid = lid; in rvt_mcast_alloc()
118 INIT_LIST_HEAD(&mcast->qp_list); in rvt_mcast_alloc()
119 init_waitqueue_head(&mcast->wait); in rvt_mcast_alloc()
120 atomic_set(&mcast->refcount, 0); in rvt_mcast_alloc()
123 return mcast; in rvt_mcast_alloc()
126 static void rvt_mcast_free(struct rvt_mcast *mcast) in rvt_mcast_free() argument
130 list_for_each_entry_safe(p, tmp, &mcast->qp_list, list) in rvt_mcast_free()
133 kfree(mcast); in rvt_mcast_free()
159 struct rvt_mcast *mcast; in rvt_mcast_find() local
161 mcast = rb_entry(n, struct rvt_mcast, rb_node); in rvt_mcast_find()
163 ret = memcmp(mgid->raw, mcast->mcast_addr.mgid.raw, in rvt_mcast_find()
171 if (mcast->mcast_addr.lid == lid) { in rvt_mcast_find()
172 atomic_inc(&mcast->refcount); in rvt_mcast_find()
173 found = mcast; in rvt_mcast_find()
194 struct rvt_mcast *mcast, struct rvt_mcast_qp *mqp) in rvt_mcast_add() argument
209 ret = memcmp(mcast->mcast_addr.mgid.raw, in rvt_mcast_add()
211 sizeof(mcast->mcast_addr.mgid)); in rvt_mcast_add()
221 if (tmcast->mcast_addr.lid != mcast->mcast_addr.lid) { in rvt_mcast_add()
256 mcast->n_attached++; in rvt_mcast_add()
258 list_add_tail_rcu(&mqp->list, &mcast->qp_list); in rvt_mcast_add()
260 atomic_inc(&mcast->refcount); in rvt_mcast_add()
261 rb_link_node(&mcast->rb_node, pn, n); in rvt_mcast_add()
262 rb_insert_color(&mcast->rb_node, &ibp->mcast_tree); in rvt_mcast_add()
285 struct rvt_mcast *mcast; in rvt_attach_mcast() local
296 mcast = rvt_mcast_alloc(gid, lid); in rvt_attach_mcast()
297 if (!mcast) in rvt_attach_mcast()
304 switch (rvt_mcast_add(rdi, ibp, mcast, mqp)) { in rvt_attach_mcast()
330 rvt_mcast_free(mcast); in rvt_attach_mcast()
348 struct rvt_mcast *mcast = NULL; in rvt_detach_mcast() local
367 mcast = rb_entry(n, struct rvt_mcast, rb_node); in rvt_detach_mcast()
368 ret = memcmp(gid->raw, mcast->mcast_addr.mgid.raw, in rvt_detach_mcast()
376 if (mcast->mcast_addr.lid != lid) { in rvt_detach_mcast()
385 list_for_each_entry_safe(p, tmp, &mcast->qp_list, list) { in rvt_detach_mcast()
393 mcast->n_attached--; in rvt_detach_mcast()
397 if (list_empty(&mcast->qp_list)) { in rvt_detach_mcast()
398 rb_erase(&mcast->rb_node, &ibp->mcast_tree); in rvt_detach_mcast()
413 wait_event(mcast->wait, atomic_read(&mcast->refcount) <= 1); in rvt_detach_mcast()
417 atomic_dec(&mcast->refcount); in rvt_detach_mcast()
418 wait_event(mcast->wait, !atomic_read(&mcast->refcount)); in rvt_detach_mcast()
419 rvt_mcast_free(mcast); in rvt_detach_mcast()