linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy()
@ 2023-02-24 18:18 Nathan Chancellor
  2023-02-25 16:08 ` Simon Horman
  2023-02-27 19:25 ` Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Chancellor @ 2023-02-24 18:18 UTC (permalink / raw)
  To: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni
  Cc: paulb, simon.horman, marcelo.leitner, netdev, linux-kernel,
	Nathan Chancellor

When CONFIG_NET_CLS_ACT is disabled:

  ../net/sched/cls_api.c:141:13: warning: 'tcf_exts_miss_cookie_base_destroy' defined but not used [-Wunused-function]
    141 | static void tcf_exts_miss_cookie_base_destroy(struct tcf_exts *exts)
        |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Due to the way the code is structured, it is possible for a definition
of tcf_exts_miss_cookie_base_destroy() to be present without actually
being used. Its single callsite is in an '#ifdef CONFIG_NET_CLS_ACT'
block but a definition will always be present in the file. The version
of tcf_exts_miss_cookie_base_destroy() that actually does something
depends on CONFIG_NET_TC_SKB_EXT, so the stub function is used in both
CONFIG_NET_CLS_ACT=n and CONFIG_NET_CLS_ACT=y + CONFIG_NET_TC_SKB_EXT=n
configurations.

Move the call to tcf_exts_miss_cookie_base_destroy() in
tcf_exts_destroy() out of the '#ifdef CONFIG_NET_CLS_ACT', so that it
always appears used to the compiler, while not changing any behavior
with any of the various configuration combinations.

Fixes: 80cd22c35c90 ("net/sched: cls_api: Support hardware miss to tc action")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 net/sched/cls_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 3569e2c3660c..2a6b6be0811b 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -3241,9 +3241,9 @@ EXPORT_SYMBOL(tcf_exts_init_ex);
 
 void tcf_exts_destroy(struct tcf_exts *exts)
 {
-#ifdef CONFIG_NET_CLS_ACT
 	tcf_exts_miss_cookie_base_destroy(exts);
 
+#ifdef CONFIG_NET_CLS_ACT
 	if (exts->actions) {
 		tcf_action_destroy(exts->actions, TCA_ACT_UNBIND);
 		kfree(exts->actions);

---
base-commit: ac3ad19584b26fae9ac86e4faebe790becc74491
change-id: 20230224-cls_api-wunused-function-17aa94fdef90

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy()
  2023-02-24 18:18 [PATCH net] net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy() Nathan Chancellor
@ 2023-02-25 16:08 ` Simon Horman
  2023-02-25 21:15   ` Nathan Chancellor
  2023-02-27 19:25 ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Horman @ 2023-02-25 16:08 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni, paulb,
	marcelo.leitner, netdev, linux-kernel

On Fri, Feb 24, 2023 at 11:18:49AM -0700, Nathan Chancellor wrote:
> When CONFIG_NET_CLS_ACT is disabled:
> 
>   ../net/sched/cls_api.c:141:13: warning: 'tcf_exts_miss_cookie_base_destroy' defined but not used [-Wunused-function]
>     141 | static void tcf_exts_miss_cookie_base_destroy(struct tcf_exts *exts)
>         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Due to the way the code is structured, it is possible for a definition
> of tcf_exts_miss_cookie_base_destroy() to be present without actually
> being used. Its single callsite is in an '#ifdef CONFIG_NET_CLS_ACT'
> block but a definition will always be present in the file. The version
> of tcf_exts_miss_cookie_base_destroy() that actually does something
> depends on CONFIG_NET_TC_SKB_EXT, so the stub function is used in both
> CONFIG_NET_CLS_ACT=n and CONFIG_NET_CLS_ACT=y + CONFIG_NET_TC_SKB_EXT=n
> configurations.
> 
> Move the call to tcf_exts_miss_cookie_base_destroy() in
> tcf_exts_destroy() out of the '#ifdef CONFIG_NET_CLS_ACT', so that it
> always appears used to the compiler, while not changing any behavior
> with any of the various configuration combinations.
> 
> Fixes: 80cd22c35c90 ("net/sched: cls_api: Support hardware miss to tc action")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Thanks Nathan,

I think the #ifdefs in this file could do with some work.
But as a fix this looks good to me.

Reviewed-by: Simon Horman <simon.horman@corigine.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy()
  2023-02-25 16:08 ` Simon Horman
@ 2023-02-25 21:15   ` Nathan Chancellor
  2023-02-26 12:01     ` Simon Horman
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2023-02-25 21:15 UTC (permalink / raw)
  To: Simon Horman
  Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni, paulb,
	marcelo.leitner, netdev, linux-kernel

On Sat, Feb 25, 2023 at 05:08:17PM +0100, Simon Horman wrote:
> On Fri, Feb 24, 2023 at 11:18:49AM -0700, Nathan Chancellor wrote:
> > When CONFIG_NET_CLS_ACT is disabled:
> > 
> >   ../net/sched/cls_api.c:141:13: warning: 'tcf_exts_miss_cookie_base_destroy' defined but not used [-Wunused-function]
> >     141 | static void tcf_exts_miss_cookie_base_destroy(struct tcf_exts *exts)
> >         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > Due to the way the code is structured, it is possible for a definition
> > of tcf_exts_miss_cookie_base_destroy() to be present without actually
> > being used. Its single callsite is in an '#ifdef CONFIG_NET_CLS_ACT'
> > block but a definition will always be present in the file. The version
> > of tcf_exts_miss_cookie_base_destroy() that actually does something
> > depends on CONFIG_NET_TC_SKB_EXT, so the stub function is used in both
> > CONFIG_NET_CLS_ACT=n and CONFIG_NET_CLS_ACT=y + CONFIG_NET_TC_SKB_EXT=n
> > configurations.
> > 
> > Move the call to tcf_exts_miss_cookie_base_destroy() in
> > tcf_exts_destroy() out of the '#ifdef CONFIG_NET_CLS_ACT', so that it
> > always appears used to the compiler, while not changing any behavior
> > with any of the various configuration combinations.
> > 
> > Fixes: 80cd22c35c90 ("net/sched: cls_api: Support hardware miss to tc action")
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> 
> Thanks Nathan,
> 
> I think the #ifdefs in this file could do with some work.

Yes, it is definitely an eye sore. I thought about cleaning it up but it
felt like net-next material to me, plus I have no other interest in this
code other than making the warning in my builds go away, if I am being
honest :)

> But as a fix this looks good to me.
> 
> Reviewed-by: Simon Horman <simon.horman@corigine.com>

Thanks for the quick review!

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy()
  2023-02-25 21:15   ` Nathan Chancellor
@ 2023-02-26 12:01     ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-02-26 12:01 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni, paulb,
	marcelo.leitner, netdev, linux-kernel

On Sat, Feb 25, 2023 at 02:15:27PM -0700, Nathan Chancellor wrote:
> On Sat, Feb 25, 2023 at 05:08:17PM +0100, Simon Horman wrote:
> > On Fri, Feb 24, 2023 at 11:18:49AM -0700, Nathan Chancellor wrote:
> > > When CONFIG_NET_CLS_ACT is disabled:
> > > 
> > >   ../net/sched/cls_api.c:141:13: warning: 'tcf_exts_miss_cookie_base_destroy' defined but not used [-Wunused-function]
> > >     141 | static void tcf_exts_miss_cookie_base_destroy(struct tcf_exts *exts)
> > >         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > 
> > > Due to the way the code is structured, it is possible for a definition
> > > of tcf_exts_miss_cookie_base_destroy() to be present without actually
> > > being used. Its single callsite is in an '#ifdef CONFIG_NET_CLS_ACT'
> > > block but a definition will always be present in the file. The version
> > > of tcf_exts_miss_cookie_base_destroy() that actually does something
> > > depends on CONFIG_NET_TC_SKB_EXT, so the stub function is used in both
> > > CONFIG_NET_CLS_ACT=n and CONFIG_NET_CLS_ACT=y + CONFIG_NET_TC_SKB_EXT=n
> > > configurations.
> > > 
> > > Move the call to tcf_exts_miss_cookie_base_destroy() in
> > > tcf_exts_destroy() out of the '#ifdef CONFIG_NET_CLS_ACT', so that it
> > > always appears used to the compiler, while not changing any behavior
> > > with any of the various configuration combinations.
> > > 
> > > Fixes: 80cd22c35c90 ("net/sched: cls_api: Support hardware miss to tc action")
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > 
> > Thanks Nathan,
> > 
> > I think the #ifdefs in this file could do with some work.
> 
> Yes, it is definitely an eye sore. I thought about cleaning it up but it
> felt like net-next material to me, plus I have no other interest in this
> code other than making the warning in my builds go away, if I am being
> honest :)

Yes, of course (x2) :)

> > But as a fix this looks good to me.
> > 
> > Reviewed-by: Simon Horman <simon.horman@corigine.com>
> 
> Thanks for the quick review!
> 
> Cheers,
> Nathan
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy()
  2023-02-24 18:18 [PATCH net] net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy() Nathan Chancellor
  2023-02-25 16:08 ` Simon Horman
@ 2023-02-27 19:25 ` Jakub Kicinski
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2023-02-27 19:25 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, pabeni, paulb,
	simon.horman, marcelo.leitner, netdev, linux-kernel

On Fri, 24 Feb 2023 11:18:49 -0700 Nathan Chancellor wrote:
> When CONFIG_NET_CLS_ACT is disabled:
> 
>   ../net/sched/cls_api.c:141:13: warning: 'tcf_exts_miss_cookie_base_destroy' defined but not used [-Wunused-function]
>     141 | static void tcf_exts_miss_cookie_base_destroy(struct tcf_exts *exts)
>         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Due to the way the code is structured, it is possible for a definition
> of tcf_exts_miss_cookie_base_destroy() to be present without actually
> being used. Its single callsite is in an '#ifdef CONFIG_NET_CLS_ACT'
> block but a definition will always be present in the file. The version
> of tcf_exts_miss_cookie_base_destroy() that actually does something
> depends on CONFIG_NET_TC_SKB_EXT, so the stub function is used in both
> CONFIG_NET_CLS_ACT=n and CONFIG_NET_CLS_ACT=y + CONFIG_NET_TC_SKB_EXT=n
> configurations.
> 
> Move the call to tcf_exts_miss_cookie_base_destroy() in
> tcf_exts_destroy() out of the '#ifdef CONFIG_NET_CLS_ACT', so that it
> always appears used to the compiler, while not changing any behavior
> with any of the various configuration combinations.
> 
> Fixes: 80cd22c35c90 ("net/sched: cls_api: Support hardware miss to tc action")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Applied, thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-27 19:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 18:18 [PATCH net] net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy() Nathan Chancellor
2023-02-25 16:08 ` Simon Horman
2023-02-25 21:15   ` Nathan Chancellor
2023-02-26 12:01     ` Simon Horman
2023-02-27 19:25 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).