aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_htb.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2014-09-12 23:05:27 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-13 12:30:25 -0400
commit25d8c0d55f241ce2d360df1bea48e23a55836ee6 (patch)
treec0aca67607e7ce560a4a2cebef5fb6d55adf4112 /net/sched/sch_htb.c
parent46e5da40aec256155cfedee96dd21a75da941f2c (diff)
net: rcu-ify tcf_proto
rcu'ify tcf_proto this allows calling tc_classify() without holding any locks. Updaters are protected by RTNL. This patch prepares the core net_sched infrastracture for running the classifier/action chains without holding the qdisc lock however it does nothing to ensure cls_xxx and act_xxx types also work without locking. Additional patches are required to address the fall out. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r--net/sched/sch_htb.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index aea942ce6008..6d16b9b81c28 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -103,7 +103,7 @@ struct htb_class {
103 u32 prio; /* these two are used only by leaves... */ 103 u32 prio; /* these two are used only by leaves... */
104 int quantum; /* but stored for parent-to-leaf return */ 104 int quantum; /* but stored for parent-to-leaf return */
105 105
106 struct tcf_proto *filter_list; /* class attached filters */ 106 struct tcf_proto __rcu *filter_list; /* class attached filters */
107 int filter_cnt; 107 int filter_cnt;
108 int refcnt; /* usage count of this class */ 108 int refcnt; /* usage count of this class */
109 109
@@ -153,7 +153,7 @@ struct htb_sched {
153 int rate2quantum; /* quant = rate / rate2quantum */ 153 int rate2quantum; /* quant = rate / rate2quantum */
154 154
155 /* filters for qdisc itself */ 155 /* filters for qdisc itself */
156 struct tcf_proto *filter_list; 156 struct tcf_proto __rcu *filter_list;
157 157
158#define HTB_WARN_TOOMANYEVENTS 0x1 158#define HTB_WARN_TOOMANYEVENTS 0x1
159 unsigned int warned; /* only one warning */ 159 unsigned int warned; /* only one warning */
@@ -223,9 +223,9 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
223 if (cl->level == 0) 223 if (cl->level == 0)
224 return cl; 224 return cl;
225 /* Start with inner filter chain if a non-leaf class is selected */ 225 /* Start with inner filter chain if a non-leaf class is selected */
226 tcf = cl->filter_list; 226 tcf = rcu_dereference_bh(cl->filter_list);
227 } else { 227 } else {
228 tcf = q->filter_list; 228 tcf = rcu_dereference_bh(q->filter_list);
229 } 229 }
230 230
231 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 231 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
@@ -251,7 +251,7 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
251 return cl; /* we hit leaf; return it */ 251 return cl; /* we hit leaf; return it */
252 252
253 /* we have got inner class; apply inner filter chain */ 253 /* we have got inner class; apply inner filter chain */
254 tcf = cl->filter_list; 254 tcf = rcu_dereference_bh(cl->filter_list);
255 } 255 }
256 /* classification failed; try to use default class */ 256 /* classification failed; try to use default class */
257 cl = htb_find(TC_H_MAKE(TC_H_MAJ(sch->handle), q->defcls), sch); 257 cl = htb_find(TC_H_MAKE(TC_H_MAJ(sch->handle), q->defcls), sch);
@@ -1519,11 +1519,12 @@ failure:
1519 return err; 1519 return err;
1520} 1520}
1521 1521
1522static struct tcf_proto **htb_find_tcf(struct Qdisc *sch, unsigned long arg) 1522static struct tcf_proto __rcu **htb_find_tcf(struct Qdisc *sch,
1523 unsigned long arg)
1523{ 1524{
1524 struct htb_sched *q = qdisc_priv(sch); 1525 struct htb_sched *q = qdisc_priv(sch);
1525 struct htb_class *cl = (struct htb_class *)arg; 1526 struct htb_class *cl = (struct htb_class *)arg;
1526 struct tcf_proto **fl = cl ? &cl->filter_list : &q->filter_list; 1527 struct tcf_proto __rcu **fl = cl ? &cl->filter_list : &q->filter_list;
1527 1528
1528 return fl; 1529 return fl;
1529} 1530}