Lines Matching refs:mcast

67 	struct rvt_mcast *mcast;  in rvt_mcast_alloc()  local
69 mcast = kzalloc(sizeof(*mcast), GFP_KERNEL); in rvt_mcast_alloc()
70 if (!mcast) in rvt_mcast_alloc()
73 mcast->mcast_addr.mgid = *mgid; in rvt_mcast_alloc()
74 mcast->mcast_addr.lid = lid; in rvt_mcast_alloc()
76 INIT_LIST_HEAD(&mcast->qp_list); in rvt_mcast_alloc()
77 init_waitqueue_head(&mcast->wait); in rvt_mcast_alloc()
78 atomic_set(&mcast->refcount, 0); in rvt_mcast_alloc()
81 return mcast; in rvt_mcast_alloc()
84 static void rvt_mcast_free(struct rvt_mcast *mcast) in rvt_mcast_free() argument
88 list_for_each_entry_safe(p, tmp, &mcast->qp_list, list) in rvt_mcast_free()
91 kfree(mcast); in rvt_mcast_free()
117 struct rvt_mcast *mcast; in rvt_mcast_find() local
119 mcast = rb_entry(n, struct rvt_mcast, rb_node); in rvt_mcast_find()
121 ret = memcmp(mgid->raw, mcast->mcast_addr.mgid.raw, in rvt_mcast_find()
129 if (mcast->mcast_addr.lid == lid) { in rvt_mcast_find()
130 atomic_inc(&mcast->refcount); in rvt_mcast_find()
131 found = mcast; in rvt_mcast_find()
152 struct rvt_mcast *mcast, struct rvt_mcast_qp *mqp) in rvt_mcast_add() argument
167 ret = memcmp(mcast->mcast_addr.mgid.raw, in rvt_mcast_add()
169 sizeof(mcast->mcast_addr.mgid)); in rvt_mcast_add()
179 if (tmcast->mcast_addr.lid != mcast->mcast_addr.lid) { in rvt_mcast_add()
214 mcast->n_attached++; in rvt_mcast_add()
216 list_add_tail_rcu(&mqp->list, &mcast->qp_list); in rvt_mcast_add()
218 atomic_inc(&mcast->refcount); in rvt_mcast_add()
219 rb_link_node(&mcast->rb_node, pn, n); in rvt_mcast_add()
220 rb_insert_color(&mcast->rb_node, &ibp->mcast_tree); in rvt_mcast_add()
243 struct rvt_mcast *mcast; in rvt_attach_mcast() local
254 mcast = rvt_mcast_alloc(gid, lid); in rvt_attach_mcast()
255 if (!mcast) in rvt_attach_mcast()
262 switch (rvt_mcast_add(rdi, ibp, mcast, mqp)) { in rvt_attach_mcast()
288 rvt_mcast_free(mcast); in rvt_attach_mcast()
306 struct rvt_mcast *mcast = NULL; in rvt_detach_mcast() local
325 mcast = rb_entry(n, struct rvt_mcast, rb_node); in rvt_detach_mcast()
326 ret = memcmp(gid->raw, mcast->mcast_addr.mgid.raw, in rvt_detach_mcast()
334 if (mcast->mcast_addr.lid != lid) { in rvt_detach_mcast()
343 list_for_each_entry_safe(p, tmp, &mcast->qp_list, list) { in rvt_detach_mcast()
351 mcast->n_attached--; in rvt_detach_mcast()
355 if (list_empty(&mcast->qp_list)) { in rvt_detach_mcast()
356 rb_erase(&mcast->rb_node, &ibp->mcast_tree); in rvt_detach_mcast()
371 wait_event(mcast->wait, atomic_read(&mcast->refcount) <= 1); in rvt_detach_mcast()
375 atomic_dec(&mcast->refcount); in rvt_detach_mcast()
376 wait_event(mcast->wait, !atomic_read(&mcast->refcount)); in rvt_detach_mcast()
377 rvt_mcast_free(mcast); in rvt_detach_mcast()