summaryrefslogtreecommitdiffstats
path: root/include/net/pkt_cls.h
diff options
context:
space:
mode:
authorJiri Pirko2017-08-04 14:28:58 +0200
committerDavid S. Miller2017-08-04 20:21:23 +0200
commit3bcc0cec818fa969fe555b44443347211ed787a3 (patch)
treedc098e58871f221b46f01c33de9d12a02ae4a5a0 /include/net/pkt_cls.h
parentnet: sched: remove unneeded tcf_em_tree_change (diff)
downloadkernel-qcow2-linux-3bcc0cec818fa969fe555b44443347211ed787a3.tar.gz
kernel-qcow2-linux-3bcc0cec818fa969fe555b44443347211ed787a3.tar.xz
kernel-qcow2-linux-3bcc0cec818fa969fe555b44443347211ed787a3.zip
net: sched: change names of action number helpers to be aligned with the rest
The rest of the helpers are named tcf_exts_*, so change the name of the action number helpers to be aligned. While at it, change to inline functions. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/pkt_cls.h')
-rw-r--r--include/net/pkt_cls.h36
1 files changed, 27 insertions, 9 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index f4462ec8b2f4..7f2563636df0 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -199,17 +199,35 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
return 0;
}
+/**
+ * tcf_exts_has_actions - check if at least one action is present
+ * @exts: tc filter extensions handle
+ *
+ * Returns true if at least one action is present.
+ */
+static inline bool tcf_exts_has_actions(struct tcf_exts *exts)
+{
#ifdef CONFIG_NET_CLS_ACT
+ return exts->nr_actions;
+#else
+ return false;
+#endif
+}
-#define tc_no_actions(_exts) ((_exts)->nr_actions == 0)
-#define tc_single_action(_exts) ((_exts)->nr_actions == 1)
-
-#else /* CONFIG_NET_CLS_ACT */
-
-#define tc_no_actions(_exts) true
-#define tc_single_action(_exts) false
-
-#endif /* CONFIG_NET_CLS_ACT */
+/**
+ * tcf_exts_has_one_action - check if exactly one action is present
+ * @exts: tc filter extensions handle
+ *
+ * Returns true if exactly one action is present.
+ */
+static inline bool tcf_exts_has_one_action(struct tcf_exts *exts)
+{
+#ifdef CONFIG_NET_CLS_ACT
+ return exts->nr_actions == 1;
+#else
+ return false;
+#endif
+}
int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
struct nlattr **tb, struct nlattr *rate_tlv,