xref: /openbmc/linux/include/net/tc_act/tc_gate.h (revision a51c328d)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Copyright 2020 NXP */
3 
4 #ifndef __NET_TC_GATE_H
5 #define __NET_TC_GATE_H
6 
7 #include <net/act_api.h>
8 #include <linux/tc_act/tc_gate.h>
9 
10 struct tcfg_gate_entry {
11 	int			index;
12 	u8			gate_state;
13 	u32			interval;
14 	s32			ipv;
15 	s32			maxoctets;
16 	struct list_head	list;
17 };
18 
19 struct tcf_gate_params {
20 	s32			tcfg_priority;
21 	u64			tcfg_basetime;
22 	u64			tcfg_cycletime;
23 	u64			tcfg_cycletime_ext;
24 	u32			tcfg_flags;
25 	s32			tcfg_clockid;
26 	size_t			num_entries;
27 	struct list_head	entries;
28 };
29 
30 #define GATE_ACT_GATE_OPEN	BIT(0)
31 #define GATE_ACT_PENDING	BIT(1)
32 
33 struct tcf_gate {
34 	struct tc_action	common;
35 	struct tcf_gate_params	param;
36 	u8			current_gate_status;
37 	ktime_t			current_close_time;
38 	u32			current_entry_octets;
39 	s32			current_max_octets;
40 	struct tcfg_gate_entry	*next_entry;
41 	struct hrtimer		hitimer;
42 	enum tk_offsets		tk_offset;
43 };
44 
45 #define to_gate(a) ((struct tcf_gate *)a)
46 
47 #endif
48