netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Pedro Tammela <pctammela@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com,
	jiri@resnulli.us, kuniyu@amazon.com,
	Pedro Tammela <pctammela@mojatatu.com>
Subject: Re: [PATCH net-next v2 1/3] net/sched: add retpoline wrapper for tc
Date: Wed, 30 Nov 2022 21:16:43 -0800	[thread overview]
Message-ID: <20221130211643.01d65f46@kernel.org> (raw)
In-Reply-To: <20221128154456.689326-2-pctammela@mojatatu.com>

On Mon, 28 Nov 2022 12:44:54 -0300 Pedro Tammela wrote:
> On kernels compiled with CONFIG_RETPOLINE and CONFIG_NET_TC_INDIRECT_WRAPPER,
> optimize actions and filters that are compiled as built-ins into a direct call.
> The calls are ordered alphabetically, but new ones should be ideally
> added last.
> 
> On subsequent patches we expose the classifiers and actions functions
> and wire up the wrapper into tc.

> +#if IS_ENABLED(CONFIG_RETPOLINE) && IS_ENABLED(CONFIG_NET_TC_INDIRECT_WRAPPER)

The latter 'depends on' former, so just check the latter.

> +static inline int __tc_act(struct sk_buff *skb, const struct tc_action *a,
> +			   struct tcf_result *res)
> +{
> +	if (0) { /* noop */ }
> +#if IS_BUILTIN(CONFIG_NET_ACT_BPF)
> +	else if (a->ops->act == tcf_bpf_act)
> +		return tcf_bpf_act(skb, a, res);
> +#endif

How does the 'else if' ladder compare to a switch statement?

> +#ifdef CONFIG_NET_CLS_ACT
> +static inline int __tc_act(struct sk_buff *skb, const struct tc_action *a,
> +			   struct tcf_result *res)
> +{
> +	return a->ops->act(skb, a, res);
> +}
> +#endif
> +
> +#ifdef CONFIG_NET_CLS
> +static inline int __tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
> +				struct tcf_result *res)
> +{
> +	return tp->classify(skb, tp, res);
> +}
> +#endif

please don't wrap the static inline helpers in #ifdefs unless it's
actually necessary for build to pass.

  reply	other threads:[~2022-12-01  5:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 15:44 [PATCH net-next v2 0/3] net/sched: retpoline wrappers for tc Pedro Tammela
2022-11-28 15:44 ` [PATCH net-next v2 1/3] net/sched: add retpoline wrapper " Pedro Tammela
2022-12-01  5:16   ` Jakub Kicinski [this message]
2022-12-01 16:40     ` Pedro Tammela
2022-12-01 22:38       ` Jakub Kicinski
2022-12-02 12:48         ` Pedro Tammela
2022-12-02 18:13           ` Jakub Kicinski
2022-12-01 11:10   ` Paolo Abeni
2022-12-05  4:56   ` Eric Dumazet
2022-11-28 15:44 ` [PATCH net-next v2 2/3] net/sched: avoid indirect act functions on retpoline kernels Pedro Tammela
2022-11-28 15:44 ` [PATCH net-next v2 3/3] net/sched: avoid indirect classify " Pedro Tammela
2022-12-01 11:05 ` [PATCH net-next v2 0/3] net/sched: retpoline wrappers for tc Paolo Abeni
2022-12-01 12:34   ` Jamal Hadi Salim
2022-12-04 23:13     ` Pedro Tammela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221130211643.01d65f46@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@gmail.com \
    --cc=pctammela@mojatatu.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).