Thread (35 messages) 35 messages, 5 authors, 2017-08-01

Re: [patch net-next 04/20] net: sched: use tcf_exts_has_actions in tcf_exts_exec

From: Jiri Pirko <jiri@resnulli.us>
Date: 2017-08-01 04:53:49

Mon, Jul 31, 2017 at 10:37:21PM CEST, xiyou.wangcong@gmail.com wrote:
On Fri, Jul 28, 2017 at 7:40 AM, Jiri Pirko [off-list ref] wrote:
quoted
+static inline int
+tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
+             struct tcf_result *res)
+{
+#ifdef CONFIG_NET_CLS_ACT
+       if (tcf_exts_has_actions(exts))
+               return tcf_action_exec(skb, exts->actions, exts->nr_actions,
+                                      res);
+#endif
+       return 0;
+}

While you are on it, can we get rid of this macro too?

tcf_action_exec() is only defined with CONFIG_NET_CLS_ACT,
not sure if compiler is kind enough to eliminate the false branch
for us:

if (false)
   return tcf_action_exec(...); // not defined but the branch is dead

At least you can add a wrapper for tcf_action_exec() to just
return 0.
Did you see?
net: sched: remove check for number of actions in tcf_exts_exec

I will add static inline stub for tcf_action_exec in case CONFIG_NET_CLS_ACT
is not set.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help