net: rcu-ify tcf_proto
[linux-drm-fsl-dcu.git] / net / sched / sch_htb.c
index aea942ce6008c542982ab503555b925733ede962..6d16b9b81c284502c27a2c72a263aae5162ced3f 100644 (file)
@@ -103,7 +103,7 @@ struct htb_class {
        u32                     prio;           /* these two are used only by leaves... */
        int                     quantum;        /* but stored for parent-to-leaf return */
 
-       struct tcf_proto        *filter_list;   /* class attached filters */
+       struct tcf_proto __rcu  *filter_list;   /* class attached filters */
        int                     filter_cnt;
        int                     refcnt;         /* usage count of this class */
 
@@ -153,7 +153,7 @@ struct htb_sched {
        int                     rate2quantum;   /* quant = rate / rate2quantum */
 
        /* filters for qdisc itself */
-       struct tcf_proto        *filter_list;
+       struct tcf_proto __rcu  *filter_list;
 
 #define HTB_WARN_TOOMANYEVENTS 0x1
        unsigned int            warned; /* only one warning */
@@ -223,9 +223,9 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
                if (cl->level == 0)
                        return cl;
                /* Start with inner filter chain if a non-leaf class is selected */
-               tcf = cl->filter_list;
+               tcf = rcu_dereference_bh(cl->filter_list);
        } else {
-               tcf = q->filter_list;
+               tcf = rcu_dereference_bh(q->filter_list);
        }
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
@@ -251,7 +251,7 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
                        return cl;      /* we hit leaf; return it */
 
                /* we have got inner class; apply inner filter chain */
-               tcf = cl->filter_list;
+               tcf = rcu_dereference_bh(cl->filter_list);
        }
        /* classification failed; try to use default class */
        cl = htb_find(TC_H_MAKE(TC_H_MAJ(sch->handle), q->defcls), sch);
@@ -1519,11 +1519,12 @@ failure:
        return err;
 }
 
-static struct tcf_proto **htb_find_tcf(struct Qdisc *sch, unsigned long arg)
+static struct tcf_proto __rcu **htb_find_tcf(struct Qdisc *sch,
+                                            unsigned long arg)
 {
        struct htb_sched *q = qdisc_priv(sch);
        struct htb_class *cl = (struct htb_class *)arg;
-       struct tcf_proto **fl = cl ? &cl->filter_list : &q->filter_list;
+       struct tcf_proto __rcu **fl = cl ? &cl->filter_list : &q->filter_list;
 
        return fl;
 }