From: John Fastabend <john.fastabend@gmail.com> Date: 2014-09-16 02:47:52
kbuild test robot reported an unused variable cpu in cls_u32.c
after the patch below. This happens when PERF and MARK config
variables are disabled
commit 459d5f626da75573e985a7197b0919c3b143146c
Author: John Fastabend [off-list ref]
Date: Fri Sep 12 20:08:47 2014 -0700
net: sched: make cls_u32 per cpu
Fix this is to use separate variables for perf and mark
and define the cpu variable inside the ifdef logic.
Signed-off-by: John Fastabend <redacted>
---
net/sched/cls_u32.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
@@ -788,8 +788,8 @@ static int u32_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,}else{#ifdef CONFIG_CLS_U32_PERFstructtc_u32_pcnt*gpf;-#endifintcpu;+#endifif(nla_put(skb,TCA_U32_SEL,sizeof(n->sel)+n->sel.nkeys*sizeof(structtc_u32_key),
@@ -816,9 +816,10 @@ static int u32_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,structtc_u32_markmark={.val=n->val,.mask=n->mask,.success=0};+intcpum;-for_each_possible_cpu(cpu){-__u32cnt=*per_cpu_ptr(n->pcpu_success,cpu);+for_each_possible_cpu(cpum){+__u32cnt=*per_cpu_ptr(n->pcpu_success,cpum);mark.success+=cnt;}
@@ -127,16 +127,16 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,err=nla_parse_nested(tb,TCA_CGROUP_MAX,tca[TCA_OPTIONS],cgroup_policy);if(err<0)-returnerr;+gotoerrout;tcf_exts_init(&e,TCA_CGROUP_ACT,TCA_CGROUP_POLICE);err=tcf_exts_validate(net,tp,tb,tca[TCA_RATE],&e,ovr);if(err<0)-returnerr;+gotoerrout;err=tcf_em_tree_validate(tp,tb[TCA_CGROUP_EMATCHES],&t);if(err<0)-returnerr;+gotoerrout;
I think you need to call tcf_exts_destroy() too after tcf_exts_validate(),
while you are on it. :)
Yep, and did a quick audit looks like its handled correctly in the other
classifiers.
Also there is a needed fix for cls_fw I'll include with the update for this patch.
.John
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -607,7 +607,8 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,if(TC_U32_KEY(n->handle)==0)return-EINVAL;-returnu32_set_parms(net,tp,base,n->ht_up,n,tb,+returnu32_set_parms(net,tp,base,+rtnl_dereference(n->ht_up),n,tb,tca[TCA_RATE],ovr);}
@@ -681,7 +682,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,#endifmemcpy(&n->sel,s,sizeof(*s)+s->nkeys*sizeof(structtc_u32_key));-n->ht_up=ht;+rcu_assign_pointer(n->ht_up,ht);
also believe this should be RCU_INIT_POINTER() the rcu_assign_pointer() to attach
n to the hash table happens below so there are no concurrent readers until after
the assign.
however while reviewing this I realize there is a 'copy'/'update' pattern I
missed in the u32_set_parms case when the classid and ifindex is changed. So
a fix coming for that shortly.
n->handle = handle;
n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0;
tcf_exts_init(&n->exts, TCA_U32_ACT, TCA_U32_POLICE);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html