[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221130211643.01d65f46@kernel.org>
Date: Wed, 30 Nov 2022 21:16:43 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Pedro Tammela <pctammela@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, jhs@...atatu.com, xiyou.wangcong@...il.com,
jiri@...nulli.us, kuniyu@...zon.com,
Pedro Tammela <pctammela@...atatu.com>
Subject: Re: [PATCH net-next v2 1/3] net/sched: add retpoline wrapper for tc
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.
Powered by blists - more mailing lists