Skip to content

Commit

Permalink
net: sched: fix unsued cpu variable
Browse files Browse the repository at this point in the history
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

Fix this is to use separate variables for perf and mark
and define the cpu variable inside the ifdef logic.

Fixes: 459d5f6 ("net: sched: make cls_u32 per cpu")'
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
John Fastabend authored and David S. Miller committed Sep 16, 2014
1 parent 69301ea commit 80aab73
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/sched/cls_u32.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,8 @@ static int u32_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
} else {
#ifdef CONFIG_CLS_U32_PERF
struct tc_u32_pcnt *gpf;
#endif
int cpu;
#endif

if (nla_put(skb, TCA_U32_SEL,
sizeof(n->sel) + n->sel.nkeys*sizeof(struct tc_u32_key),
Expand All @@ -816,9 +816,10 @@ static int u32_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
struct tc_u32_mark mark = {.val = n->val,
.mask = n->mask,
.success = 0};
int cpum;

for_each_possible_cpu(cpu) {
__u32 cnt = *per_cpu_ptr(n->pcpu_success, cpu);
for_each_possible_cpu(cpum) {
__u32 cnt = *per_cpu_ptr(n->pcpu_success, cpum);

mark.success += cnt;
}
Expand Down

0 comments on commit 80aab73

Please sign in to comment.