xref: /linux/include/net/tc_act/tc_skbedit.h (revision ff202ee1ed8f032f05b80b541664cf02e75d7080)
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>
23519afb18SAmir 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;
31*ff202ee1SJamal Hadi Salim 	u16		ptype;
32ca9b0e27SAlexander Duyck };
3386062033SWANG Cong #define to_skbedit(a) \
3486062033SWANG Cong 	container_of(a->priv, struct tcf_skbedit, common)
35ca9b0e27SAlexander Duyck 
36519afb18SAmir Vadai /* Return true iff action is mark */
37519afb18SAmir Vadai static inline bool is_tcf_skbedit_mark(const struct tc_action *a)
38519afb18SAmir Vadai {
39519afb18SAmir Vadai #ifdef CONFIG_NET_CLS_ACT
40519afb18SAmir Vadai 	if (a->ops && a->ops->type == TCA_ACT_SKBEDIT)
41519afb18SAmir Vadai 		return to_skbedit(a)->flags == SKBEDIT_F_MARK;
42519afb18SAmir Vadai #endif
43519afb18SAmir Vadai 	return false;
44519afb18SAmir Vadai }
45519afb18SAmir Vadai 
46519afb18SAmir Vadai static inline u32 tcf_skbedit_mark(const struct tc_action *a)
47519afb18SAmir Vadai {
48519afb18SAmir Vadai 	return to_skbedit(a)->mark;
49519afb18SAmir Vadai }
50519afb18SAmir Vadai 
51ca9b0e27SAlexander Duyck #endif /* __NET_TC_SKBEDIT_H */
52