|
|
@@ -113,36 +113,6 @@ static inline int tcf_exts_init(struct tcf_exts *exts, int action, int police)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * tcf_exts_is_predicative - check if a predicative extension is present
|
|
|
- * @exts: tc filter extensions handle
|
|
|
- *
|
|
|
- * Returns 1 if a predicative extension is present, i.e. an extension which
|
|
|
- * might cause further actions and thus overrule the regular tcf_result.
|
|
|
- */
|
|
|
-static inline int
|
|
|
-tcf_exts_is_predicative(struct tcf_exts *exts)
|
|
|
-{
|
|
|
-#ifdef CONFIG_NET_CLS_ACT
|
|
|
- return exts->nr_actions;
|
|
|
-#else
|
|
|
- return 0;
|
|
|
-#endif
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * tcf_exts_is_available - check if at least one extension is present
|
|
|
- * @exts: tc filter extensions handle
|
|
|
- *
|
|
|
- * Returns 1 if at least one extension is present.
|
|
|
- */
|
|
|
-static inline int
|
|
|
-tcf_exts_is_available(struct tcf_exts *exts)
|
|
|
-{
|
|
|
- /* All non-predicative extensions must be added here. */
|
|
|
- return tcf_exts_is_predicative(exts);
|
|
|
-}
|
|
|
-
|
|
|
static inline void tcf_exts_to_list(const struct tcf_exts *exts,
|
|
|
struct list_head *actions)
|
|
|
{
|
|
|
@@ -176,47 +146,62 @@ tcf_exts_stats_update(const struct tcf_exts *exts,
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 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
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 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
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* tcf_exts_exec - execute tc filter extensions
|
|
|
* @skb: socket buffer
|
|
|
* @exts: tc filter extensions handle
|
|
|
* @res: desired result
|
|
|
*
|
|
|
- * Executes all configured extensions. Returns 0 on a normal execution,
|
|
|
+ * Executes all configured extensions. Returns TC_ACT_OK on a normal execution,
|
|
|
* a negative number if the filter must be considered unmatched or
|
|
|
* a positive action code (TC_ACT_*) which must be returned to the
|
|
|
* underlying layer.
|
|
|
*/
|
|
|
static inline int
|
|
|
tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
|
|
|
- struct tcf_result *res)
|
|
|
+ struct tcf_result *res)
|
|
|
{
|
|
|
#ifdef CONFIG_NET_CLS_ACT
|
|
|
- if (exts->nr_actions)
|
|
|
- return tcf_action_exec(skb, exts->actions, exts->nr_actions,
|
|
|
- res);
|
|
|
+ return tcf_action_exec(skb, exts->actions, exts->nr_actions, res);
|
|
|
#endif
|
|
|
- return 0;
|
|
|
+ return TC_ACT_OK;
|
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_NET_CLS_ACT
|
|
|
-
|
|
|
-#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 */
|
|
|
-
|
|
|
int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
|
|
|
struct nlattr **tb, struct nlattr *rate_tlv,
|
|
|
struct tcf_exts *exts, bool ovr);
|
|
|
void tcf_exts_destroy(struct tcf_exts *exts);
|
|
|
-void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
|
|
|
- struct tcf_exts *src);
|
|
|
+void tcf_exts_change(struct tcf_exts *dst, struct tcf_exts *src);
|
|
|
int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts);
|
|
|
int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts);
|
|
|
int tcf_exts_get_dev(struct net_device *dev, struct tcf_exts *exts,
|
|
|
@@ -332,26 +317,6 @@ int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int);
|
|
|
int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *,
|
|
|
struct tcf_pkt_info *);
|
|
|
|
|
|
-/**
|
|
|
- * tcf_em_tree_change - replace ematch tree of a running classifier
|
|
|
- *
|
|
|
- * @tp: classifier kind handle
|
|
|
- * @dst: destination ematch tree variable
|
|
|
- * @src: source ematch tree (temporary tree from tcf_em_tree_validate)
|
|
|
- *
|
|
|
- * This functions replaces the ematch tree in @dst with the ematch
|
|
|
- * tree in @src. The classifier in charge of the ematch tree may be
|
|
|
- * running.
|
|
|
- */
|
|
|
-static inline void tcf_em_tree_change(struct tcf_proto *tp,
|
|
|
- struct tcf_ematch_tree *dst,
|
|
|
- struct tcf_ematch_tree *src)
|
|
|
-{
|
|
|
- tcf_tree_lock(tp);
|
|
|
- memcpy(dst, src, sizeof(*dst));
|
|
|
- tcf_tree_unlock(tp);
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* tcf_em_tree_match - evaulate an ematch tree
|
|
|
*
|
|
|
@@ -386,7 +351,6 @@ struct tcf_ematch_tree {
|
|
|
#define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)
|
|
|
#define tcf_em_tree_destroy(t) do { (void)(t); } while(0)
|
|
|
#define tcf_em_tree_dump(skb, t, tlv) (0)
|
|
|
-#define tcf_em_tree_change(tp, dst, src) do { } while(0)
|
|
|
#define tcf_em_tree_match(skb, t, info) ((void)(info), 1)
|
|
|
|
|
|
#endif /* CONFIG_NET_EMATCH */
|