xref: /dpdk/drivers/net/enic/base/vnic_flowman.h (revision e77506397fc8005c5129e22e9e2d15d5876790fd)
1ea7768b5SHyong Youb Kim /* SPDX-License-Identifier: BSD-3-Clause
2ea7768b5SHyong Youb Kim  * Copyright 2018-2019 Cisco Systems, Inc.  All rights reserved.
3ea7768b5SHyong Youb Kim  */
4ea7768b5SHyong Youb Kim #ifndef _VNIC_FLOWMAN_H_
5ea7768b5SHyong Youb Kim #define _VNIC_FLOWMAN_H_
6ea7768b5SHyong Youb Kim 
7ea7768b5SHyong Youb Kim /* This file contains Flow Manager (FM) API of the firmware */
8ea7768b5SHyong Youb Kim 
9ea7768b5SHyong Youb Kim /* Flow manager sub-ops */
10ea7768b5SHyong Youb Kim enum {
11ea7768b5SHyong Youb Kim 	FM_EXACT_TABLE_ALLOC,
12ea7768b5SHyong Youb Kim 	FM_TCAM_TABLE_ALLOC,
13ea7768b5SHyong Youb Kim 	FM_MATCH_TABLE_FREE,
14ea7768b5SHyong Youb Kim 	FM_COUNTER_BRK,
15ea7768b5SHyong Youb Kim 	FM_COUNTER_QUERY,
16ea7768b5SHyong Youb Kim 	FM_COUNTER_CLEAR_ALL,
17ea7768b5SHyong Youb Kim 	FM_COUNTER_DMA,
18ea7768b5SHyong Youb Kim 	FM_ACTION_ALLOC,
19ea7768b5SHyong Youb Kim 	FM_ACTION_FREE,
20ea7768b5SHyong Youb Kim 	FM_EXACT_ENTRY_INSTALL,
21ea7768b5SHyong Youb Kim 	FM_TCAM_ENTRY_INSTALL,
22ea7768b5SHyong Youb Kim 	FM_MATCH_ENTRY_REMOVE,
23ea7768b5SHyong Youb Kim 	FM_VNIC_FIND,
24ea7768b5SHyong Youb Kim 	FM_API_VERSION_QUERY,
25ea7768b5SHyong Youb Kim 	FM_API_VERSION_SELECT,
26ea7768b5SHyong Youb Kim 	FM_INFO_QUERY
27ea7768b5SHyong Youb Kim };
28ea7768b5SHyong Youb Kim 
29ea7768b5SHyong Youb Kim /*
30ea7768b5SHyong Youb Kim  * FKM (flow key metadata) flags used to match packet metadata
31ea7768b5SHyong Youb Kim  * (e.g. packet is tcp)
32ea7768b5SHyong Youb Kim  */
33ea7768b5SHyong Youb Kim #define FKM_BITS		\
34ea7768b5SHyong Youb Kim 	FBIT(FKM_QTAG)		\
35ea7768b5SHyong Youb Kim 	FBIT(FKM_CMD)		\
36ea7768b5SHyong Youb Kim 	FBIT(FKM_IPV4)		\
37ea7768b5SHyong Youb Kim 	FBIT(FKM_IPV6)		\
38ea7768b5SHyong Youb Kim 	FBIT(FKM_ROCE)		\
39ea7768b5SHyong Youb Kim 	FBIT(FKM_UDP)		\
40ea7768b5SHyong Youb Kim 	FBIT(FKM_TCP)		\
41ea7768b5SHyong Youb Kim 	FBIT(FKM_TCPORUDP)	\
42ea7768b5SHyong Youb Kim 	FBIT(FKM_IPFRAG)	\
43ea7768b5SHyong Youb Kim 	FBIT(FKM_NVGRE)		\
44ea7768b5SHyong Youb Kim 	FBIT(FKM_VXLAN)		\
45ea7768b5SHyong Youb Kim 	FBIT(FKM_GENEVE)	\
46ea7768b5SHyong Youb Kim 	FBIT(FKM_NSH)		\
47ea7768b5SHyong Youb Kim 	FBIT(FKM_ROCEV2)	\
48ea7768b5SHyong Youb Kim 	FBIT(FKM_VLAN_PRES)	\
49ea7768b5SHyong Youb Kim 	FBIT(FKM_IPOK)		\
50ea7768b5SHyong Youb Kim 	FBIT(FKM_L4OK)		\
51ea7768b5SHyong Youb Kim 	FBIT(FKM_ROCEOK)	\
52ea7768b5SHyong Youb Kim 	FBIT(FKM_FCSOK)		\
53ea7768b5SHyong Youb Kim 	FBIT(FKM_EG_SPAN)	\
54ea7768b5SHyong Youb Kim 	FBIT(FKM_IG_SPAN)	\
55ea7768b5SHyong Youb Kim 	FBIT(FKM_EG_HAIRPINNED)
56ea7768b5SHyong Youb Kim 
57ea7768b5SHyong Youb Kim /*
58ea7768b5SHyong Youb Kim  * FKH (flow key header) flags.
59ea7768b5SHyong Youb Kim  * This selects which headers are valid in the struct.
60ea7768b5SHyong Youb Kim  * This is distinct from metadata in that metadata is requesting actual
61ea7768b5SHyong Youb Kim  * selection criteria.  If, for example, a TCAM match with metadata "FKM_UDP"
62ea7768b5SHyong Youb Kim  * is feeding into an exact match table, there may be no need for the
63ea7768b5SHyong Youb Kim  * exact match table to also specify FKM_UDP, so FKH_UDP is used to
64ea7768b5SHyong Youb Kim  * specify that the UDP header fields should be used in the match.
65ea7768b5SHyong Youb Kim  */
66ea7768b5SHyong Youb Kim #define FKH_BITS	\
67ea7768b5SHyong Youb Kim 	FBIT(FKH_ETHER)	\
68ea7768b5SHyong Youb Kim 	FBIT(FKH_QTAG)	\
69ea7768b5SHyong Youb Kim 	FBIT(FKH_L2RAW)	\
70ea7768b5SHyong Youb Kim 	FBIT(FKH_IPV4)	\
71ea7768b5SHyong Youb Kim 	FBIT(FKH_IPV6)	\
72ea7768b5SHyong Youb Kim 	FBIT(FKH_L3RAW)	\
73ea7768b5SHyong Youb Kim 	FBIT(FKH_UDP)	\
74ea7768b5SHyong Youb Kim 	FBIT(FKH_TCP)	\
75ea7768b5SHyong Youb Kim 	FBIT(FKH_ICMP)	\
76ea7768b5SHyong Youb Kim 	FBIT(FKH_VXLAN)	\
77ea7768b5SHyong Youb Kim 	FBIT(FKH_L4RAW)
78ea7768b5SHyong Youb Kim 
79ea7768b5SHyong Youb Kim #define FBIT(X) X##_BIT,
80ea7768b5SHyong Youb Kim enum {
81ea7768b5SHyong Youb Kim 	FKM_BITS
82ea7768b5SHyong Youb Kim 	FKM_BIT_COUNT
83ea7768b5SHyong Youb Kim };
84ea7768b5SHyong Youb Kim 
85ea7768b5SHyong Youb Kim enum {
86ea7768b5SHyong Youb Kim 	FKH_BITS
87ea7768b5SHyong Youb Kim 	FKH_BIT_COUNT
88ea7768b5SHyong Youb Kim };
89ea7768b5SHyong Youb Kim #undef FBIT
90ea7768b5SHyong Youb Kim #define FBIT(X) X = (1 << X##_BIT),
91ea7768b5SHyong Youb Kim enum {
92ea7768b5SHyong Youb Kim 	FKM_BITS
93ea7768b5SHyong Youb Kim };
94ea7768b5SHyong Youb Kim enum {
95ea7768b5SHyong Youb Kim 	FKH_BITS
96ea7768b5SHyong Youb Kim };
97ea7768b5SHyong Youb Kim #undef FBIT
98ea7768b5SHyong Youb Kim 
99ea7768b5SHyong Youb Kim #define FM_ETH_ALEN 6
100ea7768b5SHyong Youb Kim #define FM_LAYER_SIZE 64
101ea7768b5SHyong Youb Kim 
102ea7768b5SHyong Youb Kim /* Header match pattern */
103*e7750639SAndre Muezerie struct __rte_packed_begin fm_header_set {
104ea7768b5SHyong Youb Kim 	uint32_t fk_metadata;       /* FKM flags */
105ea7768b5SHyong Youb Kim 	uint32_t fk_header_select;  /* FKH flags */
106ea7768b5SHyong Youb Kim 	uint16_t fk_vlan;
107ea7768b5SHyong Youb Kim 	/* L2: Ethernet Header (valid if FKH_ETHER) */
108*e7750639SAndre Muezerie 	union __rte_packed_begin {
109*e7750639SAndre Muezerie 		struct __rte_packed_begin {
110ea7768b5SHyong Youb Kim 			uint8_t fk_dstmac[FM_ETH_ALEN];
111ea7768b5SHyong Youb Kim 			uint8_t fk_srcmac[FM_ETH_ALEN];
112ea7768b5SHyong Youb Kim 			uint16_t fk_ethtype;
113*e7750639SAndre Muezerie 		} __rte_packed_end eth;
114ea7768b5SHyong Youb Kim 		uint8_t rawdata[FM_LAYER_SIZE];
115*e7750639SAndre Muezerie 	} __rte_packed_end l2;
116ea7768b5SHyong Youb Kim 	/* L3: IPv4 or IPv6 (valid if FKH_IPV4,6) */
117*e7750639SAndre Muezerie 	union __rte_packed_begin {
118ea7768b5SHyong Youb Kim 		/* Valid if FKH_IPV4 */
119*e7750639SAndre Muezerie 		struct __rte_packed_begin {
120ea7768b5SHyong Youb Kim 			uint8_t fk_ihl_vers;
121ea7768b5SHyong Youb Kim 			uint8_t fk_tos;
122ea7768b5SHyong Youb Kim 			uint16_t fk_tot_len;
123ea7768b5SHyong Youb Kim 			uint16_t fk_id;
124ea7768b5SHyong Youb Kim 			uint16_t fk_frag_off;
125ea7768b5SHyong Youb Kim 			uint8_t fk_ttl;
126ea7768b5SHyong Youb Kim 			uint8_t fk_proto;
127ea7768b5SHyong Youb Kim 			uint16_t fk_check;
128ea7768b5SHyong Youb Kim 			uint32_t fk_saddr;
129ea7768b5SHyong Youb Kim 			uint32_t fk_daddr;
130*e7750639SAndre Muezerie 		} __rte_packed_end ip4;
131ea7768b5SHyong Youb Kim 		/* Valid if FKH_IPV6 */
132*e7750639SAndre Muezerie 		struct __rte_packed_begin {
133ea7768b5SHyong Youb Kim 			union {
134ea7768b5SHyong Youb Kim 				struct {
135ea7768b5SHyong Youb Kim 					uint32_t fk_un1_flow;
136ea7768b5SHyong Youb Kim 					uint16_t fk_un1_plen;
137ea7768b5SHyong Youb Kim 					uint8_t fk_un1_nxt;
138ea7768b5SHyong Youb Kim 					uint8_t fk_un1_hlim;
139ea7768b5SHyong Youb Kim 				} unl;
140ea7768b5SHyong Youb Kim 				uint8_t fk_un2_vfc;
141ea7768b5SHyong Youb Kim 			} ctl;
142ea7768b5SHyong Youb Kim 			uint8_t fk_srcip[16];
143ea7768b5SHyong Youb Kim 			uint8_t fk_dstip[16];
144*e7750639SAndre Muezerie 		} __rte_packed_end ip6;
145ea7768b5SHyong Youb Kim 		uint8_t rawdata[FM_LAYER_SIZE];
146*e7750639SAndre Muezerie 	} __rte_packed_end l3;
147ea7768b5SHyong Youb Kim 	/* L4: UDP, TCP, or ICMP (valid if FKH_UDP,TCP,ICMP) */
148*e7750639SAndre Muezerie 	union __rte_packed_begin {
149*e7750639SAndre Muezerie 		struct __rte_packed_begin {
150ea7768b5SHyong Youb Kim 			uint16_t fk_source;
151ea7768b5SHyong Youb Kim 			uint16_t fk_dest;
152ea7768b5SHyong Youb Kim 			uint16_t fk_len;
153ea7768b5SHyong Youb Kim 			uint16_t fk_check;
154*e7750639SAndre Muezerie 		} __rte_packed_end udp;
155*e7750639SAndre Muezerie 		struct __rte_packed_begin {
156ea7768b5SHyong Youb Kim 			uint16_t fk_source;
157ea7768b5SHyong Youb Kim 			uint16_t fk_dest;
158ea7768b5SHyong Youb Kim 			uint32_t fk_seq;
159ea7768b5SHyong Youb Kim 			uint32_t fk_ack_seq;
160ea7768b5SHyong Youb Kim 			uint16_t fk_flags;
161ea7768b5SHyong Youb Kim 			uint16_t fk_window;
162ea7768b5SHyong Youb Kim 			uint16_t fk_check;
163ea7768b5SHyong Youb Kim 			uint16_t fk_urg_ptr;
164*e7750639SAndre Muezerie 		} __rte_packed_end tcp;
165*e7750639SAndre Muezerie 		struct __rte_packed_begin {
166ea7768b5SHyong Youb Kim 			uint8_t fk_code;
167ea7768b5SHyong Youb Kim 			uint8_t fk_type;
168*e7750639SAndre Muezerie 		} __rte_packed_end icmp;
169ea7768b5SHyong Youb Kim 		uint8_t rawdata[FM_LAYER_SIZE];
170*e7750639SAndre Muezerie 	} __rte_packed_end l4;
171ea7768b5SHyong Youb Kim 	/* VXLAN (valid if FKH_VXLAN) */
172*e7750639SAndre Muezerie 	struct __rte_packed_begin {
173ea7768b5SHyong Youb Kim 		uint8_t fkvx_flags;
174ea7768b5SHyong Youb Kim 		uint8_t fkvx_res0[3];
175ea7768b5SHyong Youb Kim 		uint8_t fkvx_vni[3];
176ea7768b5SHyong Youb Kim 		uint8_t fkvx_res1;
177*e7750639SAndre Muezerie 	} __rte_packed_end vxlan;
178ea7768b5SHyong Youb Kim 	/* Payload or unknown inner-most protocol */
179ea7768b5SHyong Youb Kim 	uint8_t fk_l5_data[64];
180*e7750639SAndre Muezerie } __rte_packed_end;
181ea7768b5SHyong Youb Kim 
182ea7768b5SHyong Youb Kim /*
183ea7768b5SHyong Youb Kim  * FK (flow key) template.
184ea7768b5SHyong Youb Kim  * fk_hdrset specifies a set of headers per layer of encapsulation.
185ea7768b5SHyong Youb Kim  * Currently FM supports two header sets: outer (0) and inner(1)
186ea7768b5SHyong Youb Kim  */
187ea7768b5SHyong Youb Kim #define FM_HDRSET_MAX 2
188ea7768b5SHyong Youb Kim 
189*e7750639SAndre Muezerie struct __rte_packed_begin fm_key_template {
190ea7768b5SHyong Youb Kim 	struct fm_header_set fk_hdrset[FM_HDRSET_MAX];
191ea7768b5SHyong Youb Kim 	uint32_t fk_flags;
192ea7768b5SHyong Youb Kim 	uint16_t fk_packet_tag;
193ea7768b5SHyong Youb Kim 	uint16_t fk_packet_size;
194ea7768b5SHyong Youb Kim 	uint16_t fk_port_id;
195ea7768b5SHyong Youb Kim 	uint32_t fk_wq_id;    /* WQ index */
196ea7768b5SHyong Youb Kim 	uint64_t fk_wq_vnic;  /* VNIC handle for WQ index */
197*e7750639SAndre Muezerie } __rte_packed_end;
198ea7768b5SHyong Youb Kim 
199ea7768b5SHyong Youb Kim /* Action operation types */
200ea7768b5SHyong Youb Kim enum {
201ea7768b5SHyong Youb Kim 	FMOP_NOP = 0,
202ea7768b5SHyong Youb Kim 	/* End the action chain. */
203ea7768b5SHyong Youb Kim 	FMOP_END,
204ea7768b5SHyong Youb Kim 	/* Drop packet and end the action chain. */
205ea7768b5SHyong Youb Kim 	FMOP_DROP,
206ea7768b5SHyong Youb Kim 	/* Steer packet to an RQ. */
207ea7768b5SHyong Youb Kim 	FMOP_RQ_STEER,
208ea7768b5SHyong Youb Kim 	/*
209ea7768b5SHyong Youb Kim 	 * Jump to an exact match table.
210ea7768b5SHyong Youb Kim 	 * arg1: exact match table handle
211ea7768b5SHyong Youb Kim 	 */
212ea7768b5SHyong Youb Kim 	FMOP_EXACT_MATCH,
213ea7768b5SHyong Youb Kim 	/* Apply CQ-visible mark on packet. Mark is written to RSS HASH. */
214ea7768b5SHyong Youb Kim 	FMOP_MARK,
215ea7768b5SHyong Youb Kim 	/*
216ea7768b5SHyong Youb Kim 	 * Apply CQ-visible mark on packet. Mark is written to a field in
217ea7768b5SHyong Youb Kim 	 * extended CQ. RSS HASH is preserved.
218ea7768b5SHyong Youb Kim 	 */
219ea7768b5SHyong Youb Kim 	FMOP_EXT_MARK,
220ea7768b5SHyong Youb Kim 	/*
221ea7768b5SHyong Youb Kim 	 * Apply internal tag which can be matched in subsequent
222ea7768b5SHyong Youb Kim 	 * stages or hairpin.
223ea7768b5SHyong Youb Kim 	 */
224ea7768b5SHyong Youb Kim 	FMOP_TAG,
225ea7768b5SHyong Youb Kim 	/* Hairpin packet from EG -> IG */
226ea7768b5SHyong Youb Kim 	FMOP_EG_HAIRPIN,
227ea7768b5SHyong Youb Kim 	/* Hairpin packet from IG -> EG */
228ea7768b5SHyong Youb Kim 	FMOP_IG_HAIRPIN,
229ea7768b5SHyong Youb Kim 	/* Encap with VXLAN and inner VLAN from metadata. */
230ea7768b5SHyong Youb Kim 	FMOP_ENCAP_IVLAN,
231ea7768b5SHyong Youb Kim 	/* Encap, no inner VLAN. */
232ea7768b5SHyong Youb Kim 	FMOP_ENCAP_NOIVLAN,
233ea7768b5SHyong Youb Kim 	/* Encap, add inner VLAN if present. */
234ea7768b5SHyong Youb Kim 	FMOP_ENCAP,
235ea7768b5SHyong Youb Kim 	/* Set outer VLAN. */
236ea7768b5SHyong Youb Kim 	FMOP_SET_OVLAN,
237ea7768b5SHyong Youb Kim 	/* Decap when vlan_strip is off */
238ea7768b5SHyong Youb Kim 	FMOP_DECAP_NOSTRIP,
2396faf81f1SJohn Daley 	/* Decap and strip VLAN */
2406faf81f1SJohn Daley 	FMOP_DECAP_STRIP,
2416faf81f1SJohn Daley 	/* Remove outer VLAN */
2426faf81f1SJohn Daley 	FMOP_POP_VLAN,
2436faf81f1SJohn Daley 	/* Set Egress port */
2446faf81f1SJohn Daley 	FMOP_SET_EGPORT,
2456faf81f1SJohn Daley 	/* Steer to an RQ without entering EMIT state */
2466faf81f1SJohn Daley 	FMOP_RQ_STEER_ONLY,
2476faf81f1SJohn Daley 	/* Set VLAN when replicating encapped packets */
2486faf81f1SJohn Daley 	FMOP_SET_ENCAP_VLAN,
2496faf81f1SJohn Daley 	/* Enter EMIT state */
2506faf81f1SJohn Daley 	FMOP_EMIT,
2516faf81f1SJohn Daley 	/* Enter MODIFY state */
2526faf81f1SJohn Daley 	FMOP_MODIFY,
253ea7768b5SHyong Youb Kim 	FMOP_OP_MAX,
254ea7768b5SHyong Youb Kim };
255ea7768b5SHyong Youb Kim 
256ea7768b5SHyong Youb Kim /*
257ea7768b5SHyong Youb Kim  * Action operation.
258ea7768b5SHyong Youb Kim  * Complex actions are achieved by a series of "transform operations"
259ea7768b5SHyong Youb Kim  * We can have complex transform operations like "decap" or "vxlan
260ea7768b5SHyong Youb Kim  * encap" and also simple ops like insert this data, add PACKET_LEN to
261ea7768b5SHyong Youb Kim  * this address, etc.
262ea7768b5SHyong Youb Kim  */
263*e7750639SAndre Muezerie struct __rte_packed_begin fm_action_op {
264ea7768b5SHyong Youb Kim 	uint32_t fa_op;		/* FMOP flags */
265ea7768b5SHyong Youb Kim 
266*e7750639SAndre Muezerie 	union __rte_packed_begin {
267*e7750639SAndre Muezerie 		struct __rte_packed_begin {
268ea7768b5SHyong Youb Kim 			uint8_t len1_offset;
269ea7768b5SHyong Youb Kim 			uint8_t len1_delta;
270ea7768b5SHyong Youb Kim 			uint8_t len2_offset;
271ea7768b5SHyong Youb Kim 			uint8_t len2_delta;
272ea7768b5SHyong Youb Kim 			uint16_t outer_vlan;
273ea7768b5SHyong Youb Kim 			uint8_t template_offset;
274ea7768b5SHyong Youb Kim 			uint8_t template_len;
275*e7750639SAndre Muezerie 		} __rte_packed_end encap;
276*e7750639SAndre Muezerie 		struct __rte_packed_begin {
2776faf81f1SJohn Daley 			uint16_t rq_index;
2786faf81f1SJohn Daley 			uint16_t rq_count;
279ea7768b5SHyong Youb Kim 			uint64_t vnic_handle;
280*e7750639SAndre Muezerie 		} __rte_packed_end rq_steer;
281*e7750639SAndre Muezerie 		struct __rte_packed_begin {
282ea7768b5SHyong Youb Kim 			uint16_t vlan;
283*e7750639SAndre Muezerie 		} __rte_packed_end ovlan;
284*e7750639SAndre Muezerie 		struct __rte_packed_begin {
2856faf81f1SJohn Daley 			uint16_t vlan;
286*e7750639SAndre Muezerie 		} __rte_packed_end set_encap_vlan;
287*e7750639SAndre Muezerie 		struct __rte_packed_begin {
288ea7768b5SHyong Youb Kim 			uint16_t mark;
289*e7750639SAndre Muezerie 		} __rte_packed_end mark;
290*e7750639SAndre Muezerie 		struct __rte_packed_begin {
291ea7768b5SHyong Youb Kim 			uint32_t ext_mark;
292*e7750639SAndre Muezerie 		} __rte_packed_end ext_mark;
293*e7750639SAndre Muezerie 		struct __rte_packed_begin {
294ea7768b5SHyong Youb Kim 			uint8_t tag;
295*e7750639SAndre Muezerie 		} __rte_packed_end tag;
296*e7750639SAndre Muezerie 		struct __rte_packed_begin {
297ea7768b5SHyong Youb Kim 			uint64_t handle;
298*e7750639SAndre Muezerie 		} __rte_packed_end exact;
299*e7750639SAndre Muezerie 		struct __rte_packed_begin {
3006faf81f1SJohn Daley 			uint32_t egport;
301*e7750639SAndre Muezerie 		} __rte_packed_end set_egport;
302*e7750639SAndre Muezerie 	} __rte_packed_end;
303*e7750639SAndre Muezerie } __rte_packed_end;
304ea7768b5SHyong Youb Kim 
305ea7768b5SHyong Youb Kim #define FM_ACTION_OP_MAX 64
306ea7768b5SHyong Youb Kim #define FM_ACTION_DATA_MAX 96
307ea7768b5SHyong Youb Kim 
308ea7768b5SHyong Youb Kim /*
309ea7768b5SHyong Youb Kim  * Action is a series of action operations applied to matched
310ea7768b5SHyong Youb Kim  * packet. FMA (flowman action).
311ea7768b5SHyong Youb Kim  */
312*e7750639SAndre Muezerie struct __rte_packed_begin fm_action {
313ea7768b5SHyong Youb Kim 	struct fm_action_op fma_action_ops[FM_ACTION_OP_MAX];
314ea7768b5SHyong Youb Kim 	uint8_t fma_data[FM_ACTION_DATA_MAX];
315*e7750639SAndre Muezerie } __rte_packed_end;
316ea7768b5SHyong Youb Kim 
317ea7768b5SHyong Youb Kim /* Match entry flags. FMEF (flow match entry flag) */
318ea7768b5SHyong Youb Kim #define FMEF_COUNTER    0x0001  /* counter index is valid */
319ea7768b5SHyong Youb Kim 
320ea7768b5SHyong Youb Kim /* FEM (flow exact match) entry */
321*e7750639SAndre Muezerie struct __rte_packed_begin fm_exact_match_entry {
322ea7768b5SHyong Youb Kim 	struct fm_key_template fem_data;  /* Match data. Mask is per table */
323ea7768b5SHyong Youb Kim 	uint32_t fem_flags;               /* FMEF_xxx */
324ea7768b5SHyong Youb Kim 	uint64_t fem_action;              /* Action handle */
325ea7768b5SHyong Youb Kim 	uint32_t fem_counter;             /* Counter index */
326*e7750639SAndre Muezerie } __rte_packed_end;
327ea7768b5SHyong Youb Kim 
328ea7768b5SHyong Youb Kim /* FTM (flow TCAM match) entry */
329*e7750639SAndre Muezerie struct __rte_packed_begin fm_tcam_match_entry {
330ea7768b5SHyong Youb Kim 	struct fm_key_template ftm_mask;  /* Key mask */
331ea7768b5SHyong Youb Kim 	struct fm_key_template ftm_data;  /* Match data */
332ea7768b5SHyong Youb Kim 	uint32_t ftm_flags;               /* FMEF_xxx */
333ea7768b5SHyong Youb Kim 	uint32_t ftm_position;            /* Entry position */
334ea7768b5SHyong Youb Kim 	uint64_t ftm_action;              /* Action handle */
335ea7768b5SHyong Youb Kim 	uint32_t ftm_counter;             /* Counter index */
336*e7750639SAndre Muezerie } __rte_packed_end;
337ea7768b5SHyong Youb Kim 
338ea7768b5SHyong Youb Kim /* Match directions */
339ea7768b5SHyong Youb Kim enum {
340ea7768b5SHyong Youb Kim 	FM_INGRESS,
341ea7768b5SHyong Youb Kim 	FM_EGRESS,
342ea7768b5SHyong Youb Kim 	FM_DIR_CNT
343ea7768b5SHyong Youb Kim };
344ea7768b5SHyong Youb Kim 
345ea7768b5SHyong Youb Kim /* Last stage ID, independent of the number of stages in hardware */
346ea7768b5SHyong Youb Kim #define FM_STAGE_LAST 0xff
347ea7768b5SHyong Youb Kim 
348ea7768b5SHyong Youb Kim /* Hash based exact match table. FET (flow exact match table) */
349*e7750639SAndre Muezerie struct __rte_packed_begin fm_exact_match_table {
350ea7768b5SHyong Youb Kim 	uint8_t fet_direction; /* FM_INGRESS or EGRESS*/
351ea7768b5SHyong Youb Kim 	uint8_t fet_stage;
352ea7768b5SHyong Youb Kim 	uint8_t pad[2];
353ea7768b5SHyong Youb Kim 	uint32_t fet_max_entries;
354ea7768b5SHyong Youb Kim 	uint64_t fet_dflt_action;
355ea7768b5SHyong Youb Kim 	struct fm_key_template fet_key;
356*e7750639SAndre Muezerie } __rte_packed_end;
357ea7768b5SHyong Youb Kim 
358ea7768b5SHyong Youb Kim /* TCAM based match table. FTT (flow TCAM match table) */
359*e7750639SAndre Muezerie struct __rte_packed_begin fm_tcam_match_table {
360ea7768b5SHyong Youb Kim 	uint8_t ftt_direction;
361ea7768b5SHyong Youb Kim 	uint8_t ftt_stage;
362ea7768b5SHyong Youb Kim 	uint8_t pad[2];
363ea7768b5SHyong Youb Kim 	uint32_t ftt_max_entries;
364*e7750639SAndre Muezerie } __rte_packed_end;
365ea7768b5SHyong Youb Kim 
366*e7750639SAndre Muezerie struct __rte_packed_begin fm_counter_counts {
367ea7768b5SHyong Youb Kim 	uint64_t fcc_packets;
368ea7768b5SHyong Youb Kim 	uint64_t fcc_bytes;
369*e7750639SAndre Muezerie } __rte_packed_end;
370ea7768b5SHyong Youb Kim 
371ea7768b5SHyong Youb Kim /*
372ea7768b5SHyong Youb Kim  * Return structure for FM_INFO_QUERY devcmd
373ea7768b5SHyong Youb Kim  */
374ea7768b5SHyong Youb Kim #define FM_VERSION 1		/* This header file is for version 1 */
375ea7768b5SHyong Youb Kim 
376*e7750639SAndre Muezerie struct __rte_packed_begin fm_info {
377ea7768b5SHyong Youb Kim 	uint64_t fm_op_mask;		/* Bitmask of action supported ops */
378ea7768b5SHyong Youb Kim 	uint64_t fm_current_ts;		/* Current VIC timestamp */
379ea7768b5SHyong Youb Kim 	uint64_t fm_clock_freq;		/* Timestamp clock frequency */
380ea7768b5SHyong Youb Kim 	uint16_t fm_max_ops;		/* Max ops in an action */
381ea7768b5SHyong Youb Kim 	uint8_t fm_stages;		/* Number of match-action stages */
382ea7768b5SHyong Youb Kim 	uint8_t pad[5];
383ea7768b5SHyong Youb Kim 	uint32_t fm_counter_count;	/* Number of allocated counters */
384*e7750639SAndre Muezerie } __rte_packed_end;
385ea7768b5SHyong Youb Kim 
386ea7768b5SHyong Youb Kim #endif /* _VNIC_FLOWMAN_H_ */
387