xref: /linux/include/net/tc_act/tc_skbedit.h (revision 519afb1813eab066a0c9995a08861fd0af75d5ae)
1ca9b0e27SAlexander Duyck /*
2ca9b0e27SAlexander Duyck  * Copyright (c) 2008, Intel Corporation.
3ca9b0e27SAlexander Duyck  *
4ca9b0e27SAlexander Duyck  * This program is free software; you can redistribute it and/or modify it
5ca9b0e27SAlexander Duyck  * under the terms and conditions of the GNU General Public License,
6ca9b0e27SAlexander Duyck  * version 2, as published by the Free Software Foundation.
7ca9b0e27SAlexander Duyck  *
8ca9b0e27SAlexander Duyck  * This program is distributed in the hope it will be useful, but WITHOUT
9ca9b0e27SAlexander Duyck  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10ca9b0e27SAlexander Duyck  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11ca9b0e27SAlexander Duyck  * more details.
12ca9b0e27SAlexander Duyck  *
13ca9b0e27SAlexander Duyck  * You should have received a copy of the GNU General Public License along with
14a6227e26SJeff Kirsher  * this program; if not, see <http://www.gnu.org/licenses/>.
15ca9b0e27SAlexander Duyck  *
16ca9b0e27SAlexander Duyck  * Author: Alexander Duyck <alexander.h.duyck@intel.com>
17ca9b0e27SAlexander Duyck  */
18ca9b0e27SAlexander Duyck 
19ca9b0e27SAlexander Duyck #ifndef __NET_TC_SKBEDIT_H
20ca9b0e27SAlexander Duyck #define __NET_TC_SKBEDIT_H
21ca9b0e27SAlexander Duyck 
22ca9b0e27SAlexander Duyck #include <net/act_api.h>
23*519afb18SAmir Vadai #include <linux/tc_act/tc_skbedit.h>
24ca9b0e27SAlexander Duyck 
25ca9b0e27SAlexander Duyck struct tcf_skbedit {
26ca9b0e27SAlexander Duyck 	struct tcf_common	common;
27ca9b0e27SAlexander Duyck 	u32			flags;
28ca9b0e27SAlexander Duyck 	u32     		priority;
291c55d62eSjamal 	u32     		mark;
30ca9b0e27SAlexander Duyck 	u16			queue_mapping;
311c55d62eSjamal 	/* XXX: 16-bit pad here? */
32ca9b0e27SAlexander Duyck };
3386062033SWANG Cong #define to_skbedit(a) \
3486062033SWANG Cong 	container_of(a->priv, struct tcf_skbedit, common)
35ca9b0e27SAlexander Duyck 
36*519afb18SAmir Vadai /* Return true iff action is mark */
37*519afb18SAmir Vadai static inline bool is_tcf_skbedit_mark(const struct tc_action *a)
38*519afb18SAmir Vadai {
39*519afb18SAmir Vadai #ifdef CONFIG_NET_CLS_ACT
40*519afb18SAmir Vadai 	if (a->ops && a->ops->type == TCA_ACT_SKBEDIT)
41*519afb18SAmir Vadai 		return to_skbedit(a)->flags == SKBEDIT_F_MARK;
42*519afb18SAmir Vadai #endif
43*519afb18SAmir Vadai 	return false;
44*519afb18SAmir Vadai }
45*519afb18SAmir Vadai 
46*519afb18SAmir Vadai static inline u32 tcf_skbedit_mark(const struct tc_action *a)
47*519afb18SAmir Vadai {
48*519afb18SAmir Vadai 	return to_skbedit(a)->mark;
49*519afb18SAmir Vadai }
50*519afb18SAmir Vadai 
51ca9b0e27SAlexander Duyck #endif /* __NET_TC_SKBEDIT_H */
52