net: sched: fix unsued cpu variable
Subsystems (3)
RFC PATCH 1/1 net: sched: fix unsued cpu variable
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 <[email protected]> Date: Fri Sep 12 20:08:47 2014 -0700
net: sched: make cls_u32 per cpu
One way to fix this is to use separate variables for perf and mark and define the cpu variable inside the ifdef logic.
I don't really like this though so I'm wondering if I can clean up the ifdef/endif logic to make this easier to read. So RFC patch until I convince myself there isn't a better way. Thought it might be worth sending out in case someone else has an idea.
--- net/sched/cls_u32.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/sched/cls_u32.c +4 -3
@@ -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),
@@ -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; }
Quoted 14 lines · John Fastabend
kbuild test robot reported an unused variable cpu in
cls_u32.cafter the patch below. This happens when PERF and MARK config variables are disabledcommit
459d5f626da75573e985a7197b0919c3b143146cAuthor: John Fastabend <[email protected]> Date: Fri Sep 12 20:08:47 2014 -0700net: sched: make
cls_u32per cpuOne way to fix this is to use separate variables for perf and mark and define the cpu variable inside the ifdef logic.
Quoted 7 lines
I don't really like this though so I'm wondering if I can clean up the ifdef/endif logic to make this easier to read. So RFC patch until I convince myself there isn't a better way. Thought it might be worth sending out in case someone else has an idea.
Signed-off-by John Fastabend <[email protected]>
kbuild robot kicked me another warning I missed I'll send out a couple patches tonight or tomorrow morning to resolve them.
Thanks,
John