1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2015 Intel Corporation
5 #ifndef _RTE_ETH_CTRL_H_
6 #define _RTE_ETH_CTRL_H_
9 #include <rte_common.h>
10 #include "rte_ether.h"
15 * Ethernet device features and related data structures used
16 * by control APIs should be defined in this file.
25 * A packet can be identified by hardware as different flow types. Different
26 * NIC hardwares may support different flow types.
27 * Basically, the NIC hardware identifies the flow type as deep protocol as
28 * possible, and exclusively. For example, if a packet is identified as
29 * 'RTE_ETH_FLOW_NONFRAG_IPV4_TCP', it will not be any of other flow types,
30 * though it is an actual IPV4 packet.
31 * Note that the flow types are used to define RSS offload types in
34 #define RTE_ETH_FLOW_UNKNOWN 0
35 #define RTE_ETH_FLOW_RAW 1
36 #define RTE_ETH_FLOW_IPV4 2
37 #define RTE_ETH_FLOW_FRAG_IPV4 3
38 #define RTE_ETH_FLOW_NONFRAG_IPV4_TCP 4
39 #define RTE_ETH_FLOW_NONFRAG_IPV4_UDP 5
40 #define RTE_ETH_FLOW_NONFRAG_IPV4_SCTP 6
41 #define RTE_ETH_FLOW_NONFRAG_IPV4_OTHER 7
42 #define RTE_ETH_FLOW_IPV6 8
43 #define RTE_ETH_FLOW_FRAG_IPV6 9
44 #define RTE_ETH_FLOW_NONFRAG_IPV6_TCP 10
45 #define RTE_ETH_FLOW_NONFRAG_IPV6_UDP 11
46 #define RTE_ETH_FLOW_NONFRAG_IPV6_SCTP 12
47 #define RTE_ETH_FLOW_NONFRAG_IPV6_OTHER 13
48 #define RTE_ETH_FLOW_L2_PAYLOAD 14
49 #define RTE_ETH_FLOW_IPV6_EX 15
50 #define RTE_ETH_FLOW_IPV6_TCP_EX 16
51 #define RTE_ETH_FLOW_IPV6_UDP_EX 17
52 #define RTE_ETH_FLOW_PORT 18
53 /**< Consider device port number as a flow differentiator */
54 #define RTE_ETH_FLOW_VXLAN 19 /**< VXLAN protocol based flow */
55 #define RTE_ETH_FLOW_GENEVE 20 /**< GENEVE protocol based flow */
56 #define RTE_ETH_FLOW_NVGRE 21 /**< NVGRE protocol based flow */
57 #define RTE_ETH_FLOW_VXLAN_GPE 22 /**< VXLAN-GPE protocol based flow */
58 #define RTE_ETH_FLOW_MAX 23
61 * Feature filter types
63 enum rte_filter_type {
64 RTE_ETH_FILTER_NONE = 0,
65 RTE_ETH_FILTER_MACVLAN,
66 RTE_ETH_FILTER_ETHERTYPE,
67 RTE_ETH_FILTER_FLEXIBLE,
69 RTE_ETH_FILTER_NTUPLE,
70 RTE_ETH_FILTER_TUNNEL,
73 RTE_ETH_FILTER_L2_TUNNEL,
74 RTE_ETH_FILTER_GENERIC,
79 * Generic operations on filters
82 /** used to check whether the type filter is supported */
83 RTE_ETH_FILTER_NOP = 0,
84 RTE_ETH_FILTER_ADD, /**< add filter entry */
85 RTE_ETH_FILTER_UPDATE, /**< update filter entry */
86 RTE_ETH_FILTER_DELETE, /**< delete filter entry */
87 RTE_ETH_FILTER_FLUSH, /**< flush all entries */
88 RTE_ETH_FILTER_GET, /**< get filter entry */
89 RTE_ETH_FILTER_SET, /**< configurations */
90 RTE_ETH_FILTER_INFO, /**< retrieve information */
91 RTE_ETH_FILTER_STATS, /**< retrieve statistics */
98 enum rte_mac_filter_type {
99 RTE_MAC_PERFECT_MATCH = 1, /**< exact match of MAC addr. */
100 RTE_MACVLAN_PERFECT_MATCH, /**< exact match of MAC addr and VLAN ID. */
101 RTE_MAC_HASH_MATCH, /**< hash match of MAC addr. */
102 /** hash match of MAC addr and exact match of VLAN ID. */
103 RTE_MACVLAN_HASH_MATCH,
109 struct rte_eth_mac_filter {
110 uint8_t is_vf; /**< 1 for VF, 0 for port dev */
111 uint16_t dst_id; /**< VF ID, available when is_vf is 1*/
112 enum rte_mac_filter_type filter_type; /**< MAC filter type */
113 struct ether_addr mac_addr;
117 * Define all structures for Ethertype Filter type.
120 #define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */
121 #define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */
124 * A structure used to define the ethertype filter entry
125 * to support RTE_ETH_FILTER_ETHERTYPE with RTE_ETH_FILTER_ADD,
126 * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
128 struct rte_eth_ethertype_filter {
129 struct ether_addr mac_addr; /**< Mac address to match. */
130 uint16_t ether_type; /**< Ether type to match */
131 uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */
132 uint16_t queue; /**< Queue assigned to when match*/
135 #define RTE_FLEX_FILTER_MAXLEN 128 /**< bytes to use in flex filter. */
136 #define RTE_FLEX_FILTER_MASK_SIZE \
137 (RTE_ALIGN(RTE_FLEX_FILTER_MAXLEN, CHAR_BIT) / CHAR_BIT)
138 /**< mask bytes in flex filter. */
141 * A structure used to define the flex filter entry
142 * to support RTE_ETH_FILTER_FLEXIBLE with RTE_ETH_FILTER_ADD,
143 * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
145 struct rte_eth_flex_filter {
147 uint8_t bytes[RTE_FLEX_FILTER_MAXLEN]; /**< flex bytes in big endian.*/
148 uint8_t mask[RTE_FLEX_FILTER_MASK_SIZE]; /**< if mask bit is 1b, do
149 not compare corresponding byte. */
151 uint16_t queue; /**< Queue assigned to when match. */
155 * A structure used to define the TCP syn filter entry
156 * to support RTE_ETH_FILTER_SYN with RTE_ETH_FILTER_ADD,
157 * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
159 struct rte_eth_syn_filter {
160 uint8_t hig_pri; /**< 1 - higher priority than other filters,
161 0 - lower priority. */
162 uint16_t queue; /**< Queue assigned to when match */
166 * Define all structures for ntuple Filter type.
169 #define RTE_NTUPLE_FLAGS_DST_IP 0x0001 /**< If set, dst_ip is part of ntuple */
170 #define RTE_NTUPLE_FLAGS_SRC_IP 0x0002 /**< If set, src_ip is part of ntuple */
171 #define RTE_NTUPLE_FLAGS_DST_PORT 0x0004 /**< If set, dst_port is part of ntuple */
172 #define RTE_NTUPLE_FLAGS_SRC_PORT 0x0008 /**< If set, src_port is part of ntuple */
173 #define RTE_NTUPLE_FLAGS_PROTO 0x0010 /**< If set, protocol is part of ntuple */
174 #define RTE_NTUPLE_FLAGS_TCP_FLAG 0x0020 /**< If set, tcp flag is involved */
176 #define RTE_5TUPLE_FLAGS ( \
177 RTE_NTUPLE_FLAGS_DST_IP | \
178 RTE_NTUPLE_FLAGS_SRC_IP | \
179 RTE_NTUPLE_FLAGS_DST_PORT | \
180 RTE_NTUPLE_FLAGS_SRC_PORT | \
181 RTE_NTUPLE_FLAGS_PROTO)
183 #define RTE_2TUPLE_FLAGS ( \
184 RTE_NTUPLE_FLAGS_DST_PORT | \
185 RTE_NTUPLE_FLAGS_PROTO)
187 #define TCP_URG_FLAG 0x20
188 #define TCP_ACK_FLAG 0x10
189 #define TCP_PSH_FLAG 0x08
190 #define TCP_RST_FLAG 0x04
191 #define TCP_SYN_FLAG 0x02
192 #define TCP_FIN_FLAG 0x01
193 #define TCP_FLAG_ALL 0x3F
196 * A structure used to define the ntuple filter entry
197 * to support RTE_ETH_FILTER_NTUPLE with RTE_ETH_FILTER_ADD,
198 * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
200 struct rte_eth_ntuple_filter {
201 uint16_t flags; /**< Flags from RTE_NTUPLE_FLAGS_* */
202 uint32_t dst_ip; /**< Destination IP address in big endian. */
203 uint32_t dst_ip_mask; /**< Mask of destination IP address. */
204 uint32_t src_ip; /**< Source IP address in big endian. */
205 uint32_t src_ip_mask; /**< Mask of destination IP address. */
206 uint16_t dst_port; /**< Destination port in big endian. */
207 uint16_t dst_port_mask; /**< Mask of destination port. */
208 uint16_t src_port; /**< Source Port in big endian. */
209 uint16_t src_port_mask; /**< Mask of source port. */
210 uint8_t proto; /**< L4 protocol. */
211 uint8_t proto_mask; /**< Mask of L4 protocol. */
212 /** tcp_flags only meaningful when the proto is TCP.
213 The packet matched above ntuple fields and contain
214 any set bit in tcp_flags will hit this filter. */
216 uint16_t priority; /**< seven levels (001b-111b), 111b is highest,
217 used when more than one filter matches. */
218 uint16_t queue; /**< Queue assigned to when match*/
224 enum rte_eth_tunnel_type {
225 RTE_TUNNEL_TYPE_NONE = 0,
226 RTE_TUNNEL_TYPE_VXLAN,
227 RTE_TUNNEL_TYPE_GENEVE,
228 RTE_TUNNEL_TYPE_TEREDO,
229 RTE_TUNNEL_TYPE_NVGRE,
230 RTE_TUNNEL_TYPE_IP_IN_GRE,
231 RTE_L2_TUNNEL_TYPE_E_TAG,
232 RTE_TUNNEL_TYPE_VXLAN_GPE,
237 * filter type of tunneling packet
239 #define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
240 #define ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */
241 #define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
242 #define ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */
243 #define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
244 #define ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */
246 #define RTE_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \
247 ETH_TUNNEL_FILTER_IVLAN)
248 #define RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID (ETH_TUNNEL_FILTER_IMAC | \
249 ETH_TUNNEL_FILTER_IVLAN | \
250 ETH_TUNNEL_FILTER_TENID)
251 #define RTE_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \
252 ETH_TUNNEL_FILTER_TENID)
253 #define RTE_TUNNEL_FILTER_OMAC_TENID_IMAC (ETH_TUNNEL_FILTER_OMAC | \
254 ETH_TUNNEL_FILTER_TENID | \
255 ETH_TUNNEL_FILTER_IMAC)
258 * Select IPv4 or IPv6 for tunnel filters.
260 enum rte_tunnel_iptype {
261 RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4. */
262 RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6. */
266 * Tunneling Packet filter configuration.
268 struct rte_eth_tunnel_filter_conf {
269 struct ether_addr outer_mac; /**< Outer MAC address to match. */
270 struct ether_addr inner_mac; /**< Inner MAC address to match. */
271 uint16_t inner_vlan; /**< Inner VLAN to match. */
272 enum rte_tunnel_iptype ip_type; /**< IP address type. */
273 /** Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP
274 is set in filter_type, or inner destination IP address to match
275 if ETH_TUNNEL_FILTER_IIP is set in filter_type . */
277 uint32_t ipv4_addr; /**< IPv4 address in big endian. */
278 uint32_t ipv6_addr[4]; /**< IPv6 address in big endian. */
280 /** Flags from ETH_TUNNEL_FILTER_XX - see above. */
281 uint16_t filter_type;
282 enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type. */
283 uint32_t tenant_id; /**< Tenant ID to match. VNI, GRE key... */
284 uint16_t queue_id; /**< Queue assigned to if match. */
288 * Global eth device configuration type.
290 enum rte_eth_global_cfg_type {
291 RTE_ETH_GLOBAL_CFG_TYPE_UNKNOWN = 0,
292 RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN,
293 RTE_ETH_GLOBAL_CFG_TYPE_MAX,
297 * Global eth device configuration.
299 struct rte_eth_global_cfg {
300 enum rte_eth_global_cfg_type cfg_type; /**< Global config type. */
302 uint8_t gre_key_len; /**< Valid GRE key length in byte. */
303 uint64_t reserved; /**< Reserve space for future use. */
307 #define RTE_ETH_FDIR_MAX_FLEXLEN 16 /**< Max length of flexbytes. */
308 #define RTE_ETH_INSET_SIZE_MAX 128 /**< Max length of input set. */
311 * Input set fields for Flow Director and Hash filters
313 enum rte_eth_input_set_field {
314 RTE_ETH_INPUT_SET_UNKNOWN = 0,
317 RTE_ETH_INPUT_SET_L2_SRC_MAC = 1,
318 RTE_ETH_INPUT_SET_L2_DST_MAC,
319 RTE_ETH_INPUT_SET_L2_OUTER_VLAN,
320 RTE_ETH_INPUT_SET_L2_INNER_VLAN,
321 RTE_ETH_INPUT_SET_L2_ETHERTYPE,
324 RTE_ETH_INPUT_SET_L3_SRC_IP4 = 129,
325 RTE_ETH_INPUT_SET_L3_DST_IP4,
326 RTE_ETH_INPUT_SET_L3_SRC_IP6,
327 RTE_ETH_INPUT_SET_L3_DST_IP6,
328 RTE_ETH_INPUT_SET_L3_IP4_TOS,
329 RTE_ETH_INPUT_SET_L3_IP4_PROTO,
330 RTE_ETH_INPUT_SET_L3_IP6_TC,
331 RTE_ETH_INPUT_SET_L3_IP6_NEXT_HEADER,
332 RTE_ETH_INPUT_SET_L3_IP4_TTL,
333 RTE_ETH_INPUT_SET_L3_IP6_HOP_LIMITS,
336 RTE_ETH_INPUT_SET_L4_UDP_SRC_PORT = 257,
337 RTE_ETH_INPUT_SET_L4_UDP_DST_PORT,
338 RTE_ETH_INPUT_SET_L4_TCP_SRC_PORT,
339 RTE_ETH_INPUT_SET_L4_TCP_DST_PORT,
340 RTE_ETH_INPUT_SET_L4_SCTP_SRC_PORT,
341 RTE_ETH_INPUT_SET_L4_SCTP_DST_PORT,
342 RTE_ETH_INPUT_SET_L4_SCTP_VERIFICATION_TAG,
345 RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_DST_MAC = 385,
346 RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_SRC_MAC,
347 RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_VLAN,
348 RTE_ETH_INPUT_SET_TUNNEL_L4_UDP_KEY,
349 RTE_ETH_INPUT_SET_TUNNEL_GRE_KEY,
351 /* Flexible Payload */
352 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_1ST_WORD = 641,
353 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_2ND_WORD,
354 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_3RD_WORD,
355 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_4TH_WORD,
356 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_5TH_WORD,
357 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_6TH_WORD,
358 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_7TH_WORD,
359 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_8TH_WORD,
361 RTE_ETH_INPUT_SET_DEFAULT = 65533,
362 RTE_ETH_INPUT_SET_NONE = 65534,
363 RTE_ETH_INPUT_SET_MAX = 65535,
367 * Filters input set operations
369 enum rte_filter_input_set_op {
370 RTE_ETH_INPUT_SET_OP_UNKNOWN,
371 RTE_ETH_INPUT_SET_SELECT, /**< select input set */
372 RTE_ETH_INPUT_SET_ADD, /**< add input set entry */
373 RTE_ETH_INPUT_SET_OP_MAX
378 * A structure used to define the input set configuration for
379 * flow director and hash filters
381 struct rte_eth_input_set_conf {
384 enum rte_eth_input_set_field field[RTE_ETH_INSET_SIZE_MAX];
385 enum rte_filter_input_set_op op;
389 * A structure used to define the input for L2 flow
391 struct rte_eth_l2_flow {
392 uint16_t ether_type; /**< Ether type in big endian */
396 * A structure used to define the input for IPV4 flow
398 struct rte_eth_ipv4_flow {
399 uint32_t src_ip; /**< IPv4 source address in big endian. */
400 uint32_t dst_ip; /**< IPv4 destination address in big endian. */
401 uint8_t tos; /**< Type of service to match. */
402 uint8_t ttl; /**< Time to live to match. */
403 uint8_t proto; /**< Protocol, next header in big endian. */
407 * A structure used to define the input for IPV4 UDP flow
409 struct rte_eth_udpv4_flow {
410 struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
411 uint16_t src_port; /**< UDP source port in big endian. */
412 uint16_t dst_port; /**< UDP destination port in big endian. */
416 * A structure used to define the input for IPV4 TCP flow
418 struct rte_eth_tcpv4_flow {
419 struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
420 uint16_t src_port; /**< TCP source port in big endian. */
421 uint16_t dst_port; /**< TCP destination port in big endian. */
425 * A structure used to define the input for IPV4 SCTP flow
427 struct rte_eth_sctpv4_flow {
428 struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
429 uint16_t src_port; /**< SCTP source port in big endian. */
430 uint16_t dst_port; /**< SCTP destination port in big endian. */
431 uint32_t verify_tag; /**< Verify tag in big endian */
435 * A structure used to define the input for IPV6 flow
437 struct rte_eth_ipv6_flow {
438 uint32_t src_ip[4]; /**< IPv6 source address in big endian. */
439 uint32_t dst_ip[4]; /**< IPv6 destination address in big endian. */
440 uint8_t tc; /**< Traffic class to match. */
441 uint8_t proto; /**< Protocol, next header to match. */
442 uint8_t hop_limits; /**< Hop limits to match. */
446 * A structure used to define the input for IPV6 UDP flow
448 struct rte_eth_udpv6_flow {
449 struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
450 uint16_t src_port; /**< UDP source port in big endian. */
451 uint16_t dst_port; /**< UDP destination port in big endian. */
455 * A structure used to define the input for IPV6 TCP flow
457 struct rte_eth_tcpv6_flow {
458 struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
459 uint16_t src_port; /**< TCP source port to in big endian. */
460 uint16_t dst_port; /**< TCP destination port in big endian. */
464 * A structure used to define the input for IPV6 SCTP flow
466 struct rte_eth_sctpv6_flow {
467 struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
468 uint16_t src_port; /**< SCTP source port in big endian. */
469 uint16_t dst_port; /**< SCTP destination port in big endian. */
470 uint32_t verify_tag; /**< Verify tag in big endian. */
474 * A structure used to define the input for MAC VLAN flow
476 struct rte_eth_mac_vlan_flow {
477 struct ether_addr mac_addr; /**< Mac address to match. */
481 * Tunnel type for flow director.
483 enum rte_eth_fdir_tunnel_type {
484 RTE_FDIR_TUNNEL_TYPE_UNKNOWN = 0,
485 RTE_FDIR_TUNNEL_TYPE_NVGRE,
486 RTE_FDIR_TUNNEL_TYPE_VXLAN,
490 * A structure used to define the input for tunnel flow, now it's VxLAN or
493 struct rte_eth_tunnel_flow {
494 enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
495 /** Tunnel ID to match. TNI, VNI... in big endian. */
497 struct ether_addr mac_addr; /**< Mac address to match. */
501 * An union contains the inputs for all types of flow
502 * Items in flows need to be in big endian
504 union rte_eth_fdir_flow {
505 struct rte_eth_l2_flow l2_flow;
506 struct rte_eth_udpv4_flow udp4_flow;
507 struct rte_eth_tcpv4_flow tcp4_flow;
508 struct rte_eth_sctpv4_flow sctp4_flow;
509 struct rte_eth_ipv4_flow ip4_flow;
510 struct rte_eth_udpv6_flow udp6_flow;
511 struct rte_eth_tcpv6_flow tcp6_flow;
512 struct rte_eth_sctpv6_flow sctp6_flow;
513 struct rte_eth_ipv6_flow ipv6_flow;
514 struct rte_eth_mac_vlan_flow mac_vlan_flow;
515 struct rte_eth_tunnel_flow tunnel_flow;
519 * A structure used to contain extend input of flow
521 struct rte_eth_fdir_flow_ext {
523 uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
524 /**< It is filled by the flexible payload to match. */
525 uint8_t is_vf; /**< 1 for VF, 0 for port dev */
526 uint16_t dst_id; /**< VF ID, available when is_vf is 1*/
530 * A structure used to define the input for a flow director filter entry
532 struct rte_eth_fdir_input {
534 union rte_eth_fdir_flow flow;
535 /**< Flow fields to match, dependent on flow_type */
536 struct rte_eth_fdir_flow_ext flow_ext;
537 /**< Additional fields to match */
541 * Behavior will be taken if FDIR match
543 enum rte_eth_fdir_behavior {
544 RTE_ETH_FDIR_ACCEPT = 0,
546 RTE_ETH_FDIR_PASSTHRU,
550 * Flow director report status
551 * It defines what will be reported if FDIR entry is matched.
553 enum rte_eth_fdir_status {
554 RTE_ETH_FDIR_NO_REPORT_STATUS = 0, /**< Report nothing. */
555 RTE_ETH_FDIR_REPORT_ID, /**< Only report FD ID. */
556 RTE_ETH_FDIR_REPORT_ID_FLEX_4, /**< Report FD ID and 4 flex bytes. */
557 RTE_ETH_FDIR_REPORT_FLEX_8, /**< Report 8 flex bytes. */
561 * A structure used to define an action when match FDIR packet filter.
563 struct rte_eth_fdir_action {
564 uint16_t rx_queue; /**< Queue assigned to if FDIR match. */
565 enum rte_eth_fdir_behavior behavior; /**< Behavior will be taken */
566 enum rte_eth_fdir_status report_status; /**< Status report option */
568 /**< If report_status is RTE_ETH_FDIR_REPORT_ID_FLEX_4 or
569 RTE_ETH_FDIR_REPORT_FLEX_8, flex_off specifies where the reported
570 flex bytes start from in flexible payload. */
574 * A structure used to define the flow director filter entry by filter_ctrl API
575 * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_ADD and
576 * RTE_ETH_FILTER_DELETE operations.
578 struct rte_eth_fdir_filter {
580 /**< ID, an unique value is required when deal with FDIR entry */
581 struct rte_eth_fdir_input input; /**< Input set */
582 struct rte_eth_fdir_action action; /**< Action taken when match */
586 * A structure used to configure FDIR masks that are used by the device
587 * to match the various fields of RX packet headers.
589 struct rte_eth_fdir_masks {
590 uint16_t vlan_tci_mask; /**< Bit mask for vlan_tci in big endian */
591 /** Bit mask for ipv4 flow in big endian. */
592 struct rte_eth_ipv4_flow ipv4_mask;
593 /** Bit maks for ipv6 flow in big endian. */
594 struct rte_eth_ipv6_flow ipv6_mask;
595 /** Bit mask for L4 source port in big endian. */
596 uint16_t src_port_mask;
597 /** Bit mask for L4 destination port in big endian. */
598 uint16_t dst_port_mask;
599 /** 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the
600 first byte on the wire */
601 uint8_t mac_addr_byte_mask;
602 /** Bit mask for tunnel ID in big endian. */
603 uint32_t tunnel_id_mask;
604 uint8_t tunnel_type_mask; /**< 1 - Match tunnel type,
605 0 - Ignore tunnel type. */
611 enum rte_eth_payload_type {
612 RTE_ETH_PAYLOAD_UNKNOWN = 0,
617 RTE_ETH_PAYLOAD_MAX = 8,
621 * A structure used to select bytes extracted from the protocol layers to
622 * flexible payload for filter
624 struct rte_eth_flex_payload_cfg {
625 enum rte_eth_payload_type type; /**< Payload type */
626 uint16_t src_offset[RTE_ETH_FDIR_MAX_FLEXLEN];
627 /**< Offset in bytes from the beginning of packet's payload
628 src_offset[i] indicates the flexbyte i's offset in original
629 packet payload. This value should be less than
630 flex_payload_limit in struct rte_eth_fdir_info.*/
634 * A structure used to define FDIR masks for flexible payload
637 struct rte_eth_fdir_flex_mask {
639 uint8_t mask[RTE_ETH_FDIR_MAX_FLEXLEN];
640 /**< Mask for the whole flexible payload */
644 * A structure used to define all flexible payload related setting
645 * include flex payload and flex mask
647 struct rte_eth_fdir_flex_conf {
648 uint16_t nb_payloads; /**< The number of following payload cfg */
649 uint16_t nb_flexmasks; /**< The number of following mask */
650 struct rte_eth_flex_payload_cfg flex_set[RTE_ETH_PAYLOAD_MAX];
651 /**< Flex payload configuration for each payload type */
652 struct rte_eth_fdir_flex_mask flex_mask[RTE_ETH_FLOW_MAX];
653 /**< Flex mask configuration for each flow type */
657 * Flow Director setting modes: none, signature or perfect.
660 RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
661 RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
662 RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */
663 RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
664 RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode - tunnel. */
667 #define UINT64_BIT (CHAR_BIT * sizeof(uint64_t))
668 #define RTE_FLOW_MASK_ARRAY_SIZE \
669 (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT)
672 * A structure used to get the information of flow director filter.
673 * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_INFO operation.
674 * It includes the mode, flexible payload configuration information,
675 * capabilities and supported flow types, flexible payload characters.
676 * It can be gotten to help taking specific configurations per device.
678 struct rte_eth_fdir_info {
679 enum rte_fdir_mode mode; /**< Flow director mode */
680 struct rte_eth_fdir_masks mask;
681 /** Flex payload configuration information */
682 struct rte_eth_fdir_flex_conf flex_conf;
683 uint32_t guarant_spc; /**< Guaranteed spaces.*/
684 uint32_t best_spc; /**< Best effort spaces.*/
685 /** Bit mask for every supported flow type. */
686 uint64_t flow_types_mask[RTE_FLOW_MASK_ARRAY_SIZE];
687 uint32_t max_flexpayload; /**< Total flex payload in bytes. */
688 /** Flexible payload unit in bytes. Size and alignments of all flex
689 payload segments should be multiplies of this value. */
690 uint32_t flex_payload_unit;
691 /** Max number of flexible payload continuous segments.
692 Each segment should be a multiple of flex_payload_unit.*/
693 uint32_t max_flex_payload_segment_num;
694 /** Maximum src_offset in bytes allowed. It indicates that
695 src_offset[i] in struct rte_eth_flex_payload_cfg should be less
697 uint16_t flex_payload_limit;
698 /** Flex bitmask unit in bytes. Size of flex bitmasks should be a
699 multiply of this value. */
700 uint32_t flex_bitmask_unit;
701 /** Max supported size of flex bitmasks in flex_bitmask_unit */
702 uint32_t max_flex_bitmask_num;
706 * A structure used to define the statistics of flow director.
707 * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_STATS operation.
709 struct rte_eth_fdir_stats {
710 uint32_t collision; /**< Number of filters with collision. */
711 uint32_t free; /**< Number of free filters. */
713 /**< The lookup hash value of the added filter that updated the value
714 of the MAXLEN field */
715 uint32_t maxlen; /**< Longest linked list of filters. */
716 uint64_t add; /**< Number of added filters. */
717 uint64_t remove; /**< Number of removed filters. */
718 uint64_t f_add; /**< Number of failed added filters. */
719 uint64_t f_remove; /**< Number of failed removed filters. */
720 uint32_t guarant_cnt; /**< Number of filters in guaranteed spaces. */
721 uint32_t best_cnt; /**< Number of filters in best effort spaces. */
725 * Flow Director filter information types.
727 enum rte_eth_fdir_filter_info_type {
728 RTE_ETH_FDIR_FILTER_INFO_TYPE_UNKNOWN = 0,
729 /** Flow Director filter input set configuration */
730 RTE_ETH_FDIR_FILTER_INPUT_SET_SELECT,
731 RTE_ETH_FDIR_FILTER_INFO_TYPE_MAX,
735 * A structure used to set FDIR filter information, to support filter type
736 * of 'RTE_ETH_FILTER_FDIR' RTE_ETH_FDIR_FILTER_INPUT_SET_SELECT operation.
738 struct rte_eth_fdir_filter_info {
739 enum rte_eth_fdir_filter_info_type info_type; /**< Information type */
740 /** Details of fdir filter information */
742 /** Flow Director input set configuration per port */
743 struct rte_eth_input_set_conf input_set_conf;
748 * Hash filter information types.
749 * - RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT is for getting/setting the
750 * information/configuration of 'symmetric hash enable' per port.
751 * - RTE_ETH_HASH_FILTER_GLOBAL_CONFIG is for getting/setting the global
752 * configurations of hash filters. Those global configurations are valid
753 * for all ports of the same NIC.
754 * - RTE_ETH_HASH_FILTER_INPUT_SET_SELECT is for setting the global
755 * hash input set fields
757 enum rte_eth_hash_filter_info_type {
758 RTE_ETH_HASH_FILTER_INFO_TYPE_UNKNOWN = 0,
759 /** Symmetric hash enable per port */
760 RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT,
761 /** Configure globally for hash filter */
762 RTE_ETH_HASH_FILTER_GLOBAL_CONFIG,
763 /** Global Hash filter input set configuration */
764 RTE_ETH_HASH_FILTER_INPUT_SET_SELECT,
765 RTE_ETH_HASH_FILTER_INFO_TYPE_MAX,
769 * Hash function types.
771 enum rte_eth_hash_function {
772 RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
773 RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */
774 RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */
775 RTE_ETH_HASH_FUNCTION_MAX,
778 #define RTE_SYM_HASH_MASK_ARRAY_SIZE \
779 (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT)
781 * A structure used to set or get global hash function configurations which
782 * include symmetric hash enable per flow type and hash function type.
783 * Each bit in sym_hash_enable_mask[] indicates if the symmetric hash of the
784 * corresponding flow type is enabled or not.
785 * Each bit in valid_bit_mask[] indicates if the corresponding bit in
786 * sym_hash_enable_mask[] is valid or not. For the configurations gotten, it
787 * also means if the flow type is supported by hardware or not.
789 struct rte_eth_hash_global_conf {
790 enum rte_eth_hash_function hash_func; /**< Hash function type */
791 /** Bit mask for symmetric hash enable per flow type */
792 uint64_t sym_hash_enable_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
793 /** Bit mask indicates if the corresponding bit is valid */
794 uint64_t valid_bit_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
798 * A structure used to set or get hash filter information, to support filter
799 * type of 'RTE_ETH_FILTER_HASH' and its operations.
801 struct rte_eth_hash_filter_info {
802 enum rte_eth_hash_filter_info_type info_type; /**< Information type */
803 /** Details of hash filter information */
805 /** For RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT */
807 /** Global configurations of hash filter */
808 struct rte_eth_hash_global_conf global_conf;
809 /** Global configurations of hash filter input set */
810 struct rte_eth_input_set_conf input_set_conf;
815 * l2 tunnel configuration.
817 struct rte_eth_l2_tunnel_conf {
818 enum rte_eth_tunnel_type l2_tunnel_type;
819 uint16_t ether_type; /* ether type in l2 header */
820 uint32_t tunnel_id; /* port tag id for e-tag */
821 uint16_t vf_id; /* VF id for tag insertion */
822 uint32_t pool; /* destination pool for tag based forwarding */
829 #endif /* _RTE_ETH_CTRL_H_ */