aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_sfb.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_sfb.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_sfb.c')
-rw-r--r--net/sched/sch_sfb.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index 9b0f7093d970..1562fb2b3f46 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -55,7 +55,7 @@ struct sfb_bins {
55 55
56struct sfb_sched_data { 56struct sfb_sched_data {
57 struct Qdisc *qdisc; 57 struct Qdisc *qdisc;
58 struct tcf_proto *filter_list; 58 struct tcf_proto __rcu *filter_list;
59 unsigned long rehash_interval; 59 unsigned long rehash_interval;
60 unsigned long warmup_time; /* double buffering warmup time in jiffies */ 60 unsigned long warmup_time; /* double buffering warmup time in jiffies */
61 u32 max; 61 u32 max;
@@ -253,13 +253,13 @@ static bool sfb_rate_limit(struct sk_buff *skb, struct sfb_sched_data *q)
253 return false; 253 return false;
254} 254}
255 255
256static bool sfb_classify(struct sk_buff *skb, struct sfb_sched_data *q, 256static bool sfb_classify(struct sk_buff *skb, struct tcf_proto *fl,
257 int *qerr, u32 *salt) 257 int *qerr, u32 *salt)
258{ 258{
259 struct tcf_result res; 259 struct tcf_result res;
260 int result; 260 int result;
261 261
262 result = tc_classify(skb, q->filter_list, &res); 262 result = tc_classify(skb, fl, &res);
263 if (result >= 0) { 263 if (result >= 0) {
264#ifdef CONFIG_NET_CLS_ACT 264#ifdef CONFIG_NET_CLS_ACT
265 switch (result) { 265 switch (result) {
@@ -281,6 +281,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
281 281
282 struct sfb_sched_data *q = qdisc_priv(sch); 282 struct sfb_sched_data *q = qdisc_priv(sch);
283 struct Qdisc *child = q->qdisc; 283 struct Qdisc *child = q->qdisc;
284 struct tcf_proto *fl;
284 int i; 285 int i;
285 u32 p_min = ~0; 286 u32 p_min = ~0;
286 u32 minqlen = ~0; 287 u32 minqlen = ~0;
@@ -306,9 +307,10 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
306 } 307 }
307 } 308 }
308 309
309 if (q->filter_list) { 310 fl = rcu_dereference_bh(q->filter_list);
311 if (fl) {
310 /* If using external classifiers, get result and record it. */ 312 /* If using external classifiers, get result and record it. */
311 if (!sfb_classify(skb, q, &ret, &salt)) 313 if (!sfb_classify(skb, fl, &ret, &salt))
312 goto other_drop; 314 goto other_drop;
313 keys.src = salt; 315 keys.src = salt;
314 keys.dst = 0; 316 keys.dst = 0;
@@ -660,7 +662,8 @@ static void sfb_walk(struct Qdisc *sch, struct qdisc_walker *walker)
660 } 662 }
661} 663}
662 664
663static struct tcf_proto **sfb_find_tcf(struct Qdisc *sch, unsigned long cl) 665static struct tcf_proto __rcu **sfb_find_tcf(struct Qdisc *sch,
666 unsigned long cl)
664{ 667{
665 struct sfb_sched_data *q = qdisc_priv(sch); 668 struct sfb_sched_data *q = qdisc_priv(sch);
666 669