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"
14 * @deprecated Please use rte_flow API instead of this legacy one.
17 * Ethernet device features and related data structures used
18 * by control APIs should be defined in this file.
26 * Feature filter types
28 enum rte_filter_type
{
29 RTE_ETH_FILTER_NONE
= 0,
30 RTE_ETH_FILTER_MACVLAN
,
31 RTE_ETH_FILTER_ETHERTYPE
,
32 RTE_ETH_FILTER_FLEXIBLE
,
34 RTE_ETH_FILTER_NTUPLE
,
35 RTE_ETH_FILTER_TUNNEL
,
38 RTE_ETH_FILTER_L2_TUNNEL
,
39 RTE_ETH_FILTER_GENERIC
,
44 * Generic operations on filters
47 /** used to check whether the type filter is supported */
48 RTE_ETH_FILTER_NOP
= 0,
49 RTE_ETH_FILTER_ADD
, /**< add filter entry */
50 RTE_ETH_FILTER_UPDATE
, /**< update filter entry */
51 RTE_ETH_FILTER_DELETE
, /**< delete filter entry */
52 RTE_ETH_FILTER_FLUSH
, /**< flush all entries */
53 RTE_ETH_FILTER_GET
, /**< get filter entry */
54 RTE_ETH_FILTER_SET
, /**< configurations */
55 RTE_ETH_FILTER_INFO
, /**< retrieve information */
56 RTE_ETH_FILTER_STATS
, /**< retrieve statistics */
63 enum rte_mac_filter_type
{
64 RTE_MAC_PERFECT_MATCH
= 1, /**< exact match of MAC addr. */
65 RTE_MACVLAN_PERFECT_MATCH
, /**< exact match of MAC addr and VLAN ID. */
66 RTE_MAC_HASH_MATCH
, /**< hash match of MAC addr. */
67 /** hash match of MAC addr and exact match of VLAN ID. */
68 RTE_MACVLAN_HASH_MATCH
,
74 struct rte_eth_mac_filter
{
75 uint8_t is_vf
; /**< 1 for VF, 0 for port dev */
76 uint16_t dst_id
; /**< VF ID, available when is_vf is 1*/
77 enum rte_mac_filter_type filter_type
; /**< MAC filter type */
78 struct ether_addr mac_addr
;
82 * Define all structures for Ethertype Filter type.
85 #define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */
86 #define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */
89 * A structure used to define the ethertype filter entry
90 * to support RTE_ETH_FILTER_ETHERTYPE with RTE_ETH_FILTER_ADD,
91 * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
93 struct rte_eth_ethertype_filter
{
94 struct ether_addr mac_addr
; /**< Mac address to match. */
95 uint16_t ether_type
; /**< Ether type to match */
96 uint16_t flags
; /**< Flags from RTE_ETHTYPE_FLAGS_* */
97 uint16_t queue
; /**< Queue assigned to when match*/
100 #define RTE_FLEX_FILTER_MAXLEN 128 /**< bytes to use in flex filter. */
101 #define RTE_FLEX_FILTER_MASK_SIZE \
102 (RTE_ALIGN(RTE_FLEX_FILTER_MAXLEN, CHAR_BIT) / CHAR_BIT)
103 /**< mask bytes in flex filter. */
106 * A structure used to define the flex filter entry
107 * to support RTE_ETH_FILTER_FLEXIBLE with RTE_ETH_FILTER_ADD,
108 * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
110 struct rte_eth_flex_filter
{
112 uint8_t bytes
[RTE_FLEX_FILTER_MAXLEN
]; /**< flex bytes in big endian.*/
113 uint8_t mask
[RTE_FLEX_FILTER_MASK_SIZE
]; /**< if mask bit is 1b, do
114 not compare corresponding byte. */
116 uint16_t queue
; /**< Queue assigned to when match. */
120 * A structure used to define the TCP syn filter entry
121 * to support RTE_ETH_FILTER_SYN with RTE_ETH_FILTER_ADD,
122 * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
124 struct rte_eth_syn_filter
{
125 uint8_t hig_pri
; /**< 1 - higher priority than other filters,
126 0 - lower priority. */
127 uint16_t queue
; /**< Queue assigned to when match */
131 * Define all structures for ntuple Filter type.
134 #define RTE_NTUPLE_FLAGS_DST_IP 0x0001 /**< If set, dst_ip is part of ntuple */
135 #define RTE_NTUPLE_FLAGS_SRC_IP 0x0002 /**< If set, src_ip is part of ntuple */
136 #define RTE_NTUPLE_FLAGS_DST_PORT 0x0004 /**< If set, dst_port is part of ntuple */
137 #define RTE_NTUPLE_FLAGS_SRC_PORT 0x0008 /**< If set, src_port is part of ntuple */
138 #define RTE_NTUPLE_FLAGS_PROTO 0x0010 /**< If set, protocol is part of ntuple */
139 #define RTE_NTUPLE_FLAGS_TCP_FLAG 0x0020 /**< If set, tcp flag is involved */
141 #define RTE_5TUPLE_FLAGS ( \
142 RTE_NTUPLE_FLAGS_DST_IP | \
143 RTE_NTUPLE_FLAGS_SRC_IP | \
144 RTE_NTUPLE_FLAGS_DST_PORT | \
145 RTE_NTUPLE_FLAGS_SRC_PORT | \
146 RTE_NTUPLE_FLAGS_PROTO)
148 #define RTE_2TUPLE_FLAGS ( \
149 RTE_NTUPLE_FLAGS_DST_PORT | \
150 RTE_NTUPLE_FLAGS_PROTO)
152 #define TCP_URG_FLAG 0x20
153 #define TCP_ACK_FLAG 0x10
154 #define TCP_PSH_FLAG 0x08
155 #define TCP_RST_FLAG 0x04
156 #define TCP_SYN_FLAG 0x02
157 #define TCP_FIN_FLAG 0x01
158 #define TCP_FLAG_ALL 0x3F
161 * A structure used to define the ntuple filter entry
162 * to support RTE_ETH_FILTER_NTUPLE with RTE_ETH_FILTER_ADD,
163 * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
165 struct rte_eth_ntuple_filter
{
166 uint16_t flags
; /**< Flags from RTE_NTUPLE_FLAGS_* */
167 uint32_t dst_ip
; /**< Destination IP address in big endian. */
168 uint32_t dst_ip_mask
; /**< Mask of destination IP address. */
169 uint32_t src_ip
; /**< Source IP address in big endian. */
170 uint32_t src_ip_mask
; /**< Mask of destination IP address. */
171 uint16_t dst_port
; /**< Destination port in big endian. */
172 uint16_t dst_port_mask
; /**< Mask of destination port. */
173 uint16_t src_port
; /**< Source Port in big endian. */
174 uint16_t src_port_mask
; /**< Mask of source port. */
175 uint8_t proto
; /**< L4 protocol. */
176 uint8_t proto_mask
; /**< Mask of L4 protocol. */
177 /** tcp_flags only meaningful when the proto is TCP.
178 The packet matched above ntuple fields and contain
179 any set bit in tcp_flags will hit this filter. */
181 uint16_t priority
; /**< seven levels (001b-111b), 111b is highest,
182 used when more than one filter matches. */
183 uint16_t queue
; /**< Queue assigned to when match*/
187 * filter type of tunneling packet
189 #define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
190 #define ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */
191 #define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
192 #define ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */
193 #define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
194 #define ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */
196 #define RTE_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \
197 ETH_TUNNEL_FILTER_IVLAN)
198 #define RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID (ETH_TUNNEL_FILTER_IMAC | \
199 ETH_TUNNEL_FILTER_IVLAN | \
200 ETH_TUNNEL_FILTER_TENID)
201 #define RTE_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \
202 ETH_TUNNEL_FILTER_TENID)
203 #define RTE_TUNNEL_FILTER_OMAC_TENID_IMAC (ETH_TUNNEL_FILTER_OMAC | \
204 ETH_TUNNEL_FILTER_TENID | \
205 ETH_TUNNEL_FILTER_IMAC)
208 * Select IPv4 or IPv6 for tunnel filters.
210 enum rte_tunnel_iptype
{
211 RTE_TUNNEL_IPTYPE_IPV4
= 0, /**< IPv4. */
212 RTE_TUNNEL_IPTYPE_IPV6
, /**< IPv6. */
216 * Tunneling Packet filter configuration.
218 struct rte_eth_tunnel_filter_conf
{
219 struct ether_addr outer_mac
; /**< Outer MAC address to match. */
220 struct ether_addr inner_mac
; /**< Inner MAC address to match. */
221 uint16_t inner_vlan
; /**< Inner VLAN to match. */
222 enum rte_tunnel_iptype ip_type
; /**< IP address type. */
223 /** Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP
224 is set in filter_type, or inner destination IP address to match
225 if ETH_TUNNEL_FILTER_IIP is set in filter_type . */
227 uint32_t ipv4_addr
; /**< IPv4 address in big endian. */
228 uint32_t ipv6_addr
[4]; /**< IPv6 address in big endian. */
230 /** Flags from ETH_TUNNEL_FILTER_XX - see above. */
231 uint16_t filter_type
;
232 enum rte_eth_tunnel_type tunnel_type
; /**< Tunnel Type. */
233 uint32_t tenant_id
; /**< Tenant ID to match. VNI, GRE key... */
234 uint16_t queue_id
; /**< Queue assigned to if match. */
238 * Global eth device configuration type.
240 enum rte_eth_global_cfg_type
{
241 RTE_ETH_GLOBAL_CFG_TYPE_UNKNOWN
= 0,
242 RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN
,
243 RTE_ETH_GLOBAL_CFG_TYPE_MAX
,
247 * Global eth device configuration.
249 struct rte_eth_global_cfg
{
250 enum rte_eth_global_cfg_type cfg_type
; /**< Global config type. */
252 uint8_t gre_key_len
; /**< Valid GRE key length in byte. */
253 uint64_t reserved
; /**< Reserve space for future use. */
257 #define RTE_ETH_FDIR_MAX_FLEXLEN 16 /**< Max length of flexbytes. */
258 #define RTE_ETH_INSET_SIZE_MAX 128 /**< Max length of input set. */
261 * Input set fields for Flow Director and Hash filters
263 enum rte_eth_input_set_field
{
264 RTE_ETH_INPUT_SET_UNKNOWN
= 0,
267 RTE_ETH_INPUT_SET_L2_SRC_MAC
= 1,
268 RTE_ETH_INPUT_SET_L2_DST_MAC
,
269 RTE_ETH_INPUT_SET_L2_OUTER_VLAN
,
270 RTE_ETH_INPUT_SET_L2_INNER_VLAN
,
271 RTE_ETH_INPUT_SET_L2_ETHERTYPE
,
274 RTE_ETH_INPUT_SET_L3_SRC_IP4
= 129,
275 RTE_ETH_INPUT_SET_L3_DST_IP4
,
276 RTE_ETH_INPUT_SET_L3_SRC_IP6
,
277 RTE_ETH_INPUT_SET_L3_DST_IP6
,
278 RTE_ETH_INPUT_SET_L3_IP4_TOS
,
279 RTE_ETH_INPUT_SET_L3_IP4_PROTO
,
280 RTE_ETH_INPUT_SET_L3_IP6_TC
,
281 RTE_ETH_INPUT_SET_L3_IP6_NEXT_HEADER
,
282 RTE_ETH_INPUT_SET_L3_IP4_TTL
,
283 RTE_ETH_INPUT_SET_L3_IP6_HOP_LIMITS
,
286 RTE_ETH_INPUT_SET_L4_UDP_SRC_PORT
= 257,
287 RTE_ETH_INPUT_SET_L4_UDP_DST_PORT
,
288 RTE_ETH_INPUT_SET_L4_TCP_SRC_PORT
,
289 RTE_ETH_INPUT_SET_L4_TCP_DST_PORT
,
290 RTE_ETH_INPUT_SET_L4_SCTP_SRC_PORT
,
291 RTE_ETH_INPUT_SET_L4_SCTP_DST_PORT
,
292 RTE_ETH_INPUT_SET_L4_SCTP_VERIFICATION_TAG
,
295 RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_DST_MAC
= 385,
296 RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_SRC_MAC
,
297 RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_VLAN
,
298 RTE_ETH_INPUT_SET_TUNNEL_L4_UDP_KEY
,
299 RTE_ETH_INPUT_SET_TUNNEL_GRE_KEY
,
301 /* Flexible Payload */
302 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_1ST_WORD
= 641,
303 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_2ND_WORD
,
304 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_3RD_WORD
,
305 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_4TH_WORD
,
306 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_5TH_WORD
,
307 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_6TH_WORD
,
308 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_7TH_WORD
,
309 RTE_ETH_INPUT_SET_FLEX_PAYLOAD_8TH_WORD
,
311 RTE_ETH_INPUT_SET_DEFAULT
= 65533,
312 RTE_ETH_INPUT_SET_NONE
= 65534,
313 RTE_ETH_INPUT_SET_MAX
= 65535,
317 * Filters input set operations
319 enum rte_filter_input_set_op
{
320 RTE_ETH_INPUT_SET_OP_UNKNOWN
,
321 RTE_ETH_INPUT_SET_SELECT
, /**< select input set */
322 RTE_ETH_INPUT_SET_ADD
, /**< add input set entry */
323 RTE_ETH_INPUT_SET_OP_MAX
328 * A structure used to define the input set configuration for
329 * flow director and hash filters
331 struct rte_eth_input_set_conf
{
334 enum rte_eth_input_set_field field
[RTE_ETH_INSET_SIZE_MAX
];
335 enum rte_filter_input_set_op op
;
339 * A structure used to define the input for L2 flow
341 struct rte_eth_l2_flow
{
342 uint16_t ether_type
; /**< Ether type in big endian */
346 * A structure used to define the input for IPV4 flow
348 struct rte_eth_ipv4_flow
{
349 uint32_t src_ip
; /**< IPv4 source address in big endian. */
350 uint32_t dst_ip
; /**< IPv4 destination address in big endian. */
351 uint8_t tos
; /**< Type of service to match. */
352 uint8_t ttl
; /**< Time to live to match. */
353 uint8_t proto
; /**< Protocol, next header in big endian. */
357 * A structure used to define the input for IPV4 UDP flow
359 struct rte_eth_udpv4_flow
{
360 struct rte_eth_ipv4_flow ip
; /**< IPv4 fields to match. */
361 uint16_t src_port
; /**< UDP source port in big endian. */
362 uint16_t dst_port
; /**< UDP destination port in big endian. */
366 * A structure used to define the input for IPV4 TCP flow
368 struct rte_eth_tcpv4_flow
{
369 struct rte_eth_ipv4_flow ip
; /**< IPv4 fields to match. */
370 uint16_t src_port
; /**< TCP source port in big endian. */
371 uint16_t dst_port
; /**< TCP destination port in big endian. */
375 * A structure used to define the input for IPV4 SCTP flow
377 struct rte_eth_sctpv4_flow
{
378 struct rte_eth_ipv4_flow ip
; /**< IPv4 fields to match. */
379 uint16_t src_port
; /**< SCTP source port in big endian. */
380 uint16_t dst_port
; /**< SCTP destination port in big endian. */
381 uint32_t verify_tag
; /**< Verify tag in big endian */
385 * A structure used to define the input for IPV6 flow
387 struct rte_eth_ipv6_flow
{
388 uint32_t src_ip
[4]; /**< IPv6 source address in big endian. */
389 uint32_t dst_ip
[4]; /**< IPv6 destination address in big endian. */
390 uint8_t tc
; /**< Traffic class to match. */
391 uint8_t proto
; /**< Protocol, next header to match. */
392 uint8_t hop_limits
; /**< Hop limits to match. */
396 * A structure used to define the input for IPV6 UDP flow
398 struct rte_eth_udpv6_flow
{
399 struct rte_eth_ipv6_flow ip
; /**< IPv6 fields to match. */
400 uint16_t src_port
; /**< UDP source port in big endian. */
401 uint16_t dst_port
; /**< UDP destination port in big endian. */
405 * A structure used to define the input for IPV6 TCP flow
407 struct rte_eth_tcpv6_flow
{
408 struct rte_eth_ipv6_flow ip
; /**< IPv6 fields to match. */
409 uint16_t src_port
; /**< TCP source port to in big endian. */
410 uint16_t dst_port
; /**< TCP destination port in big endian. */
414 * A structure used to define the input for IPV6 SCTP flow
416 struct rte_eth_sctpv6_flow
{
417 struct rte_eth_ipv6_flow ip
; /**< IPv6 fields to match. */
418 uint16_t src_port
; /**< SCTP source port in big endian. */
419 uint16_t dst_port
; /**< SCTP destination port in big endian. */
420 uint32_t verify_tag
; /**< Verify tag in big endian. */
424 * A structure used to define the input for MAC VLAN flow
426 struct rte_eth_mac_vlan_flow
{
427 struct ether_addr mac_addr
; /**< Mac address to match. */
431 * Tunnel type for flow director.
433 enum rte_eth_fdir_tunnel_type
{
434 RTE_FDIR_TUNNEL_TYPE_UNKNOWN
= 0,
435 RTE_FDIR_TUNNEL_TYPE_NVGRE
,
436 RTE_FDIR_TUNNEL_TYPE_VXLAN
,
440 * A structure used to define the input for tunnel flow, now it's VxLAN or
443 struct rte_eth_tunnel_flow
{
444 enum rte_eth_fdir_tunnel_type tunnel_type
; /**< Tunnel type to match. */
445 /** Tunnel ID to match. TNI, VNI... in big endian. */
447 struct ether_addr mac_addr
; /**< Mac address to match. */
451 * An union contains the inputs for all types of flow
452 * Items in flows need to be in big endian
454 union rte_eth_fdir_flow
{
455 struct rte_eth_l2_flow l2_flow
;
456 struct rte_eth_udpv4_flow udp4_flow
;
457 struct rte_eth_tcpv4_flow tcp4_flow
;
458 struct rte_eth_sctpv4_flow sctp4_flow
;
459 struct rte_eth_ipv4_flow ip4_flow
;
460 struct rte_eth_udpv6_flow udp6_flow
;
461 struct rte_eth_tcpv6_flow tcp6_flow
;
462 struct rte_eth_sctpv6_flow sctp6_flow
;
463 struct rte_eth_ipv6_flow ipv6_flow
;
464 struct rte_eth_mac_vlan_flow mac_vlan_flow
;
465 struct rte_eth_tunnel_flow tunnel_flow
;
469 * A structure used to contain extend input of flow
471 struct rte_eth_fdir_flow_ext
{
473 uint8_t flexbytes
[RTE_ETH_FDIR_MAX_FLEXLEN
];
474 /**< It is filled by the flexible payload to match. */
475 uint8_t is_vf
; /**< 1 for VF, 0 for port dev */
476 uint16_t dst_id
; /**< VF ID, available when is_vf is 1*/
480 * A structure used to define the input for a flow director filter entry
482 struct rte_eth_fdir_input
{
484 union rte_eth_fdir_flow flow
;
485 /**< Flow fields to match, dependent on flow_type */
486 struct rte_eth_fdir_flow_ext flow_ext
;
487 /**< Additional fields to match */
491 * Behavior will be taken if FDIR match
493 enum rte_eth_fdir_behavior
{
494 RTE_ETH_FDIR_ACCEPT
= 0,
496 RTE_ETH_FDIR_PASSTHRU
,
500 * Flow director report status
501 * It defines what will be reported if FDIR entry is matched.
503 enum rte_eth_fdir_status
{
504 RTE_ETH_FDIR_NO_REPORT_STATUS
= 0, /**< Report nothing. */
505 RTE_ETH_FDIR_REPORT_ID
, /**< Only report FD ID. */
506 RTE_ETH_FDIR_REPORT_ID_FLEX_4
, /**< Report FD ID and 4 flex bytes. */
507 RTE_ETH_FDIR_REPORT_FLEX_8
, /**< Report 8 flex bytes. */
511 * A structure used to define an action when match FDIR packet filter.
513 struct rte_eth_fdir_action
{
514 uint16_t rx_queue
; /**< Queue assigned to if FDIR match. */
515 enum rte_eth_fdir_behavior behavior
; /**< Behavior will be taken */
516 enum rte_eth_fdir_status report_status
; /**< Status report option */
518 /**< If report_status is RTE_ETH_FDIR_REPORT_ID_FLEX_4 or
519 RTE_ETH_FDIR_REPORT_FLEX_8, flex_off specifies where the reported
520 flex bytes start from in flexible payload. */
524 * A structure used to define the flow director filter entry by filter_ctrl API
525 * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_ADD and
526 * RTE_ETH_FILTER_DELETE operations.
528 struct rte_eth_fdir_filter
{
530 /**< ID, an unique value is required when deal with FDIR entry */
531 struct rte_eth_fdir_input input
; /**< Input set */
532 struct rte_eth_fdir_action action
; /**< Action taken when match */
536 * A structure used to configure FDIR masks that are used by the device
537 * to match the various fields of RX packet headers.
539 struct rte_eth_fdir_masks
{
540 uint16_t vlan_tci_mask
; /**< Bit mask for vlan_tci in big endian */
541 /** Bit mask for ipv4 flow in big endian. */
542 struct rte_eth_ipv4_flow ipv4_mask
;
543 /** Bit mask for ipv6 flow in big endian. */
544 struct rte_eth_ipv6_flow ipv6_mask
;
545 /** Bit mask for L4 source port in big endian. */
546 uint16_t src_port_mask
;
547 /** Bit mask for L4 destination port in big endian. */
548 uint16_t dst_port_mask
;
549 /** 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the
550 first byte on the wire */
551 uint8_t mac_addr_byte_mask
;
552 /** Bit mask for tunnel ID in big endian. */
553 uint32_t tunnel_id_mask
;
554 uint8_t tunnel_type_mask
; /**< 1 - Match tunnel type,
555 0 - Ignore tunnel type. */
561 enum rte_eth_payload_type
{
562 RTE_ETH_PAYLOAD_UNKNOWN
= 0,
567 RTE_ETH_PAYLOAD_MAX
= 8,
571 * A structure used to select bytes extracted from the protocol layers to
572 * flexible payload for filter
574 struct rte_eth_flex_payload_cfg
{
575 enum rte_eth_payload_type type
; /**< Payload type */
576 uint16_t src_offset
[RTE_ETH_FDIR_MAX_FLEXLEN
];
577 /**< Offset in bytes from the beginning of packet's payload
578 src_offset[i] indicates the flexbyte i's offset in original
579 packet payload. This value should be less than
580 flex_payload_limit in struct rte_eth_fdir_info.*/
584 * A structure used to define FDIR masks for flexible payload
587 struct rte_eth_fdir_flex_mask
{
589 uint8_t mask
[RTE_ETH_FDIR_MAX_FLEXLEN
];
590 /**< Mask for the whole flexible payload */
594 * A structure used to define all flexible payload related setting
595 * include flex payload and flex mask
597 struct rte_eth_fdir_flex_conf
{
598 uint16_t nb_payloads
; /**< The number of following payload cfg */
599 uint16_t nb_flexmasks
; /**< The number of following mask */
600 struct rte_eth_flex_payload_cfg flex_set
[RTE_ETH_PAYLOAD_MAX
];
601 /**< Flex payload configuration for each payload type */
602 struct rte_eth_fdir_flex_mask flex_mask
[RTE_ETH_FLOW_MAX
];
603 /**< Flex mask configuration for each flow type */
607 * Flow Director setting modes: none, signature or perfect.
610 RTE_FDIR_MODE_NONE
= 0, /**< Disable FDIR support. */
611 RTE_FDIR_MODE_SIGNATURE
, /**< Enable FDIR signature filter mode. */
612 RTE_FDIR_MODE_PERFECT
, /**< Enable FDIR perfect filter mode. */
613 RTE_FDIR_MODE_PERFECT_MAC_VLAN
, /**< Enable FDIR filter mode - MAC VLAN. */
614 RTE_FDIR_MODE_PERFECT_TUNNEL
, /**< Enable FDIR filter mode - tunnel. */
617 #define UINT64_BIT (CHAR_BIT * sizeof(uint64_t))
618 #define RTE_FLOW_MASK_ARRAY_SIZE \
619 (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT)
622 * A structure used to get the information of flow director filter.
623 * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_INFO operation.
624 * It includes the mode, flexible payload configuration information,
625 * capabilities and supported flow types, flexible payload characters.
626 * It can be gotten to help taking specific configurations per device.
628 struct rte_eth_fdir_info
{
629 enum rte_fdir_mode mode
; /**< Flow director mode */
630 struct rte_eth_fdir_masks mask
;
631 /** Flex payload configuration information */
632 struct rte_eth_fdir_flex_conf flex_conf
;
633 uint32_t guarant_spc
; /**< Guaranteed spaces.*/
634 uint32_t best_spc
; /**< Best effort spaces.*/
635 /** Bit mask for every supported flow type. */
636 uint64_t flow_types_mask
[RTE_FLOW_MASK_ARRAY_SIZE
];
637 uint32_t max_flexpayload
; /**< Total flex payload in bytes. */
638 /** Flexible payload unit in bytes. Size and alignments of all flex
639 payload segments should be multiplies of this value. */
640 uint32_t flex_payload_unit
;
641 /** Max number of flexible payload continuous segments.
642 Each segment should be a multiple of flex_payload_unit.*/
643 uint32_t max_flex_payload_segment_num
;
644 /** Maximum src_offset in bytes allowed. It indicates that
645 src_offset[i] in struct rte_eth_flex_payload_cfg should be less
647 uint16_t flex_payload_limit
;
648 /** Flex bitmask unit in bytes. Size of flex bitmasks should be a
649 multiply of this value. */
650 uint32_t flex_bitmask_unit
;
651 /** Max supported size of flex bitmasks in flex_bitmask_unit */
652 uint32_t max_flex_bitmask_num
;
656 * A structure used to define the statistics of flow director.
657 * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_STATS operation.
659 struct rte_eth_fdir_stats
{
660 uint32_t collision
; /**< Number of filters with collision. */
661 uint32_t free
; /**< Number of free filters. */
663 /**< The lookup hash value of the added filter that updated the value
664 of the MAXLEN field */
665 uint32_t maxlen
; /**< Longest linked list of filters. */
666 uint64_t add
; /**< Number of added filters. */
667 uint64_t remove
; /**< Number of removed filters. */
668 uint64_t f_add
; /**< Number of failed added filters. */
669 uint64_t f_remove
; /**< Number of failed removed filters. */
670 uint32_t guarant_cnt
; /**< Number of filters in guaranteed spaces. */
671 uint32_t best_cnt
; /**< Number of filters in best effort spaces. */
675 * Flow Director filter information types.
677 enum rte_eth_fdir_filter_info_type
{
678 RTE_ETH_FDIR_FILTER_INFO_TYPE_UNKNOWN
= 0,
679 /** Flow Director filter input set configuration */
680 RTE_ETH_FDIR_FILTER_INPUT_SET_SELECT
,
681 RTE_ETH_FDIR_FILTER_INFO_TYPE_MAX
,
685 * A structure used to set FDIR filter information, to support filter type
686 * of 'RTE_ETH_FILTER_FDIR' RTE_ETH_FDIR_FILTER_INPUT_SET_SELECT operation.
688 struct rte_eth_fdir_filter_info
{
689 enum rte_eth_fdir_filter_info_type info_type
; /**< Information type */
690 /** Details of fdir filter information */
692 /** Flow Director input set configuration per port */
693 struct rte_eth_input_set_conf input_set_conf
;
698 * Hash filter information types.
699 * - RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT is for getting/setting the
700 * information/configuration of 'symmetric hash enable' per port.
701 * - RTE_ETH_HASH_FILTER_GLOBAL_CONFIG is for getting/setting the global
702 * configurations of hash filters. Those global configurations are valid
703 * for all ports of the same NIC.
704 * - RTE_ETH_HASH_FILTER_INPUT_SET_SELECT is for setting the global
705 * hash input set fields
707 enum rte_eth_hash_filter_info_type
{
708 RTE_ETH_HASH_FILTER_INFO_TYPE_UNKNOWN
= 0,
709 /** Symmetric hash enable per port */
710 RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT
,
711 /** Configure globally for hash filter */
712 RTE_ETH_HASH_FILTER_GLOBAL_CONFIG
,
713 /** Global Hash filter input set configuration */
714 RTE_ETH_HASH_FILTER_INPUT_SET_SELECT
,
715 RTE_ETH_HASH_FILTER_INFO_TYPE_MAX
,
718 #define RTE_SYM_HASH_MASK_ARRAY_SIZE \
719 (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT)
721 * A structure used to set or get global hash function configurations which
722 * include symmetric hash enable per flow type and hash function type.
723 * Each bit in sym_hash_enable_mask[] indicates if the symmetric hash of the
724 * corresponding flow type is enabled or not.
725 * Each bit in valid_bit_mask[] indicates if the corresponding bit in
726 * sym_hash_enable_mask[] is valid or not. For the configurations gotten, it
727 * also means if the flow type is supported by hardware or not.
729 struct rte_eth_hash_global_conf
{
730 enum rte_eth_hash_function hash_func
; /**< Hash function type */
731 /** Bit mask for symmetric hash enable per flow type */
732 uint64_t sym_hash_enable_mask
[RTE_SYM_HASH_MASK_ARRAY_SIZE
];
733 /** Bit mask indicates if the corresponding bit is valid */
734 uint64_t valid_bit_mask
[RTE_SYM_HASH_MASK_ARRAY_SIZE
];
738 * A structure used to set or get hash filter information, to support filter
739 * type of 'RTE_ETH_FILTER_HASH' and its operations.
741 struct rte_eth_hash_filter_info
{
742 enum rte_eth_hash_filter_info_type info_type
; /**< Information type */
743 /** Details of hash filter information */
745 /** For RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT */
747 /** Global configurations of hash filter */
748 struct rte_eth_hash_global_conf global_conf
;
749 /** Global configurations of hash filter input set */
750 struct rte_eth_input_set_conf input_set_conf
;
755 * l2 tunnel configuration.
757 struct rte_eth_l2_tunnel_conf
{
758 enum rte_eth_tunnel_type l2_tunnel_type
;
759 uint16_t ether_type
; /* ether type in l2 header */
760 uint32_t tunnel_id
; /* port tag id for e-tag */
761 uint16_t vf_id
; /* VF id for tag insertion */
762 uint32_t pool
; /* destination pool for tag based forwarding */
769 #endif /* _RTE_ETH_CTRL_H_ */