35 #include <linux/sched.h>
36 #include <linux/slab.h>
46 static struct rb_root mcast_tree;
94 INIT_LIST_HEAD(&mcast->
qp_list);
103 static void ipath_mcast_free(
struct ipath_mcast *mcast)
108 ipath_mcast_qp_free(p);
128 n = mcast_tree.rb_node;
142 spin_unlock_irqrestore(&mcast_lock, flags);
146 spin_unlock_irqrestore(&mcast_lock, flags);
167 struct rb_node **
n = &mcast_tree.rb_node;
171 spin_lock_irq(&mcast_lock);
192 list_for_each_entry_rcu(p, &tmcast->
qp_list,
list) {
193 if (p->
qp == mqp->
qp) {
225 rb_link_node(&mcast->
rb_node, pn, n);
231 spin_unlock_irq(&mcast_lock);
248 mcast = ipath_mcast_alloc(gid);
253 mqp = ipath_mcast_qp_alloc(qp);
255 ipath_mcast_free(mcast);
259 switch (ipath_mcast_add(dev, mcast, mqp)) {
262 ipath_mcast_qp_free(mqp);
263 ipath_mcast_free(mcast);
267 ipath_mcast_free(mcast);
271 ipath_mcast_qp_free(mqp);
272 ipath_mcast_free(mcast);
295 spin_lock_irq(&mcast_lock);
298 n = mcast_tree.rb_node;
301 spin_unlock_irq(&mcast_lock);
325 list_del_rcu(&p->
list);
329 if (list_empty(&mcast->
qp_list)) {
336 spin_unlock_irq(&mcast_lock);
344 ipath_mcast_qp_free(p);
349 ipath_mcast_free(mcast);
363 return mcast_tree.rb_node ==
NULL;