Lines Matching refs:mcast

39  * qib_mcast_qp_alloc - alloc a struct to link a QP to mcast GID struct
76 struct qib_mcast *mcast;
78 mcast = kmalloc(sizeof *mcast, GFP_KERNEL);
79 if (!mcast)
82 mcast->mgid = *mgid;
83 INIT_LIST_HEAD(&mcast->qp_list);
84 init_waitqueue_head(&mcast->wait);
85 atomic_set(&mcast->refcount, 0);
86 mcast->n_attached = 0;
89 return mcast;
92 static void qib_mcast_free(struct qib_mcast *mcast)
96 list_for_each_entry_safe(p, tmp, &mcast->qp_list, list)
99 kfree(mcast);
115 struct qib_mcast *mcast;
122 mcast = rb_entry(n, struct qib_mcast, rb_node);
124 ret = memcmp(mgid->raw, mcast->mgid.raw,
131 atomic_inc(&mcast->refcount);
138 mcast = NULL;
141 return mcast;
145 * qib_mcast_add - insert mcast GID into table and attach QP struct
146 * @mcast: the mcast GID table
154 struct qib_mcast *mcast, struct qib_mcast_qp *mqp)
169 ret = memcmp(mcast->mgid.raw, tmcast->mgid.raw,
209 mcast->n_attached++;
211 list_add_tail_rcu(&mqp->list, &mcast->qp_list);
213 atomic_inc(&mcast->refcount);
214 rb_link_node(&mcast->rb_node, pn, n);
215 rb_insert_color(&mcast->rb_node, &ibp->mcast_tree);
230 struct qib_mcast *mcast;
243 mcast = qib_mcast_alloc(gid);
244 if (mcast == NULL) {
250 qib_mcast_free(mcast);
255 switch (qib_mcast_add(dev, ibp, mcast, mqp)) {
259 qib_mcast_free(mcast);
262 case EEXIST: /* The mcast wasn't used */
263 qib_mcast_free(mcast);
267 /* Exceeded the maximum number of mcast groups. */
269 qib_mcast_free(mcast);
288 struct qib_mcast *mcast = NULL;
301 /* Find the GID in the mcast table. */
310 mcast = rb_entry(n, struct qib_mcast, rb_node);
311 ret = memcmp(gid->raw, mcast->mgid.raw,
322 list_for_each_entry_safe(p, tmp, &mcast->qp_list, list) {
330 mcast->n_attached--;
333 if (list_empty(&mcast->qp_list)) {
334 rb_erase(&mcast->rb_node, &ibp->mcast_tree);
347 wait_event(mcast->wait, atomic_read(&mcast->refcount) <= 1);
351 atomic_dec(&mcast->refcount);
352 wait_event(mcast->wait, !atomic_read(&mcast->refcount));
353 qib_mcast_free(mcast);