Lines Matching refs:mcast
54 #include "mcast.h"
72 * mcast_qp_alloc - alloc a struct to link a QP to mcast GID struct
109 struct rvt_mcast *mcast;
111 mcast = kzalloc(sizeof(*mcast), GFP_KERNEL);
112 if (!mcast)
115 mcast->mcast_addr.mgid = *mgid;
116 mcast->mcast_addr.lid = lid;
118 INIT_LIST_HEAD(&mcast->qp_list);
119 init_waitqueue_head(&mcast->wait);
120 atomic_set(&mcast->refcount, 0);
123 return mcast;
126 static void rvt_mcast_free(struct rvt_mcast *mcast)
130 list_for_each_entry_safe(p, tmp, &mcast->qp_list, list)
133 kfree(mcast);
159 struct rvt_mcast *mcast;
161 mcast = rb_entry(n, struct rvt_mcast, rb_node);
163 ret = memcmp(mgid->raw, mcast->mcast_addr.mgid.raw,
171 if (mcast->mcast_addr.lid == lid) {
172 atomic_inc(&mcast->refcount);
173 found = mcast;
184 * mcast_add - insert mcast GID into table and attach QP struct
185 * @mcast: the mcast GID table
194 struct rvt_mcast *mcast, struct rvt_mcast_qp *mqp)
209 ret = memcmp(mcast->mcast_addr.mgid.raw,
211 sizeof(mcast->mcast_addr.mgid));
221 if (tmcast->mcast_addr.lid != mcast->mcast_addr.lid) {
256 mcast->n_attached++;
258 list_add_tail_rcu(&mqp->list, &mcast->qp_list);
260 atomic_inc(&mcast->refcount);
261 rb_link_node(&mcast->rb_node, pn, n);
262 rb_insert_color(&mcast->rb_node, &ibp->mcast_tree);
285 struct rvt_mcast *mcast;
296 mcast = rvt_mcast_alloc(gid, lid);
297 if (!mcast)
304 switch (rvt_mcast_add(rdi, ibp, mcast, mqp)) {
309 case EEXIST: /* The mcast wasn't used */
313 /* Exceeded the maximum number of mcast groups. */
330 rvt_mcast_free(mcast);
348 struct rvt_mcast *mcast = NULL;
359 /* Find the GID in the mcast table. */
367 mcast = rb_entry(n, struct rvt_mcast, rb_node);
368 ret = memcmp(gid->raw, mcast->mcast_addr.mgid.raw,
376 if (mcast->mcast_addr.lid != lid) {
385 list_for_each_entry_safe(p, tmp, &mcast->qp_list, list) {
393 mcast->n_attached--;
397 if (list_empty(&mcast->qp_list)) {
398 rb_erase(&mcast->rb_node, &ibp->mcast_tree);
413 wait_event(mcast->wait, atomic_read(&mcast->refcount) <= 1);
417 atomic_dec(&mcast->refcount);
418 wait_event(mcast->wait, !atomic_read(&mcast->refcount));
419 rvt_mcast_free(mcast);
429 *rvt_mast_tree_empty - determine if any qps are attached to any mcast group