aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_api.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_api.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_api.c')
-rw-r--r--net/sched/sch_api.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 58bed7599db7..ca6248345937 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1781,7 +1781,7 @@ int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
1781 __be16 protocol = skb->protocol; 1781 __be16 protocol = skb->protocol;
1782 int err; 1782 int err;
1783 1783
1784 for (; tp; tp = tp->next) { 1784 for (; tp; tp = rcu_dereference_bh(tp->next)) {
1785 if (tp->protocol != protocol && 1785 if (tp->protocol != protocol &&
1786 tp->protocol != htons(ETH_P_ALL)) 1786 tp->protocol != htons(ETH_P_ALL))
1787 continue; 1787 continue;
@@ -1833,15 +1833,15 @@ void tcf_destroy(struct tcf_proto *tp)
1833{ 1833{
1834 tp->ops->destroy(tp); 1834 tp->ops->destroy(tp);
1835 module_put(tp->ops->owner); 1835 module_put(tp->ops->owner);
1836 kfree(tp); 1836 kfree_rcu(tp, rcu);
1837} 1837}
1838 1838
1839void tcf_destroy_chain(struct tcf_proto **fl) 1839void tcf_destroy_chain(struct tcf_proto __rcu **fl)
1840{ 1840{
1841 struct tcf_proto *tp; 1841 struct tcf_proto *tp;
1842 1842
1843 while ((tp = *fl) != NULL) { 1843 while ((tp = rtnl_dereference(*fl)) != NULL) {
1844 *fl = tp->next; 1844 RCU_INIT_POINTER(*fl, tp->next);
1845 tcf_destroy(tp); 1845 tcf_destroy(tp);
1846 } 1846 }
1847} 1847}