DPDK  16.07.2
rte_eth_ctrl.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of Intel Corporation nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _RTE_ETH_CTRL_H_
35 #define _RTE_ETH_CTRL_H_
36 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /*
50  * A packet can be identified by hardware as different flow types. Different
51  * NIC hardwares may support different flow types.
52  * Basically, the NIC hardware identifies the flow type as deep protocol as
53  * possible, and exclusively. For example, if a packet is identified as
54  * 'RTE_ETH_FLOW_NONFRAG_IPV4_TCP', it will not be any of other flow types,
55  * though it is an actual IPV4 packet.
56  * Note that the flow types are used to define RSS offload types in
57  * rte_ethdev.h.
58  */
59 #define RTE_ETH_FLOW_UNKNOWN 0
60 #define RTE_ETH_FLOW_RAW 1
61 #define RTE_ETH_FLOW_IPV4 2
62 #define RTE_ETH_FLOW_FRAG_IPV4 3
63 #define RTE_ETH_FLOW_NONFRAG_IPV4_TCP 4
64 #define RTE_ETH_FLOW_NONFRAG_IPV4_UDP 5
65 #define RTE_ETH_FLOW_NONFRAG_IPV4_SCTP 6
66 #define RTE_ETH_FLOW_NONFRAG_IPV4_OTHER 7
67 #define RTE_ETH_FLOW_IPV6 8
68 #define RTE_ETH_FLOW_FRAG_IPV6 9
69 #define RTE_ETH_FLOW_NONFRAG_IPV6_TCP 10
70 #define RTE_ETH_FLOW_NONFRAG_IPV6_UDP 11
71 #define RTE_ETH_FLOW_NONFRAG_IPV6_SCTP 12
72 #define RTE_ETH_FLOW_NONFRAG_IPV6_OTHER 13
73 #define RTE_ETH_FLOW_L2_PAYLOAD 14
74 #define RTE_ETH_FLOW_IPV6_EX 15
75 #define RTE_ETH_FLOW_IPV6_TCP_EX 16
76 #define RTE_ETH_FLOW_IPV6_UDP_EX 17
77 #define RTE_ETH_FLOW_PORT 18
78 
79 #define RTE_ETH_FLOW_VXLAN 19
80 #define RTE_ETH_FLOW_GENEVE 20
81 #define RTE_ETH_FLOW_NVGRE 21
82 #define RTE_ETH_FLOW_MAX 22
83 
88  RTE_ETH_FILTER_NONE = 0,
89  RTE_ETH_FILTER_MACVLAN,
90  RTE_ETH_FILTER_ETHERTYPE,
91  RTE_ETH_FILTER_FLEXIBLE,
92  RTE_ETH_FILTER_SYN,
93  RTE_ETH_FILTER_NTUPLE,
94  RTE_ETH_FILTER_TUNNEL,
95  RTE_ETH_FILTER_FDIR,
96  RTE_ETH_FILTER_HASH,
97  RTE_ETH_FILTER_L2_TUNNEL,
98  RTE_ETH_FILTER_MAX
99 };
100 
115  RTE_ETH_FILTER_OP_MAX
116 };
117 
127 };
128 
133  uint8_t is_vf;
134  uint16_t dst_id;
136  struct ether_addr mac_addr;
137 };
138 
143 #define RTE_ETHTYPE_FLAGS_MAC 0x0001
144 #define RTE_ETHTYPE_FLAGS_DROP 0x0002
151 struct rte_eth_ethertype_filter {
152  struct ether_addr mac_addr;
153  uint16_t ether_type;
154  uint16_t flags;
155  uint16_t queue;
156 };
157 
158 #define RTE_FLEX_FILTER_MAXLEN 128
159 #define RTE_FLEX_FILTER_MASK_SIZE \
160  (RTE_ALIGN(RTE_FLEX_FILTER_MAXLEN, CHAR_BIT) / CHAR_BIT)
161 
169  uint16_t len;
173  uint8_t priority;
174  uint16_t queue;
175 };
176 
183  uint8_t hig_pri;
185  uint16_t queue;
186 };
187 
192 #define RTE_NTUPLE_FLAGS_DST_IP 0x0001
193 #define RTE_NTUPLE_FLAGS_SRC_IP 0x0002
194 #define RTE_NTUPLE_FLAGS_DST_PORT 0x0004
195 #define RTE_NTUPLE_FLAGS_SRC_PORT 0x0008
196 #define RTE_NTUPLE_FLAGS_PROTO 0x0010
197 #define RTE_NTUPLE_FLAGS_TCP_FLAG 0x0020
199 #define RTE_5TUPLE_FLAGS ( \
200  RTE_NTUPLE_FLAGS_DST_IP | \
201  RTE_NTUPLE_FLAGS_SRC_IP | \
202  RTE_NTUPLE_FLAGS_DST_PORT | \
203  RTE_NTUPLE_FLAGS_SRC_PORT | \
204  RTE_NTUPLE_FLAGS_PROTO)
205 
206 #define RTE_2TUPLE_FLAGS ( \
207  RTE_NTUPLE_FLAGS_DST_PORT | \
208  RTE_NTUPLE_FLAGS_PROTO)
209 
210 #define TCP_URG_FLAG 0x20
211 #define TCP_ACK_FLAG 0x10
212 #define TCP_PSH_FLAG 0x08
213 #define TCP_RST_FLAG 0x04
214 #define TCP_SYN_FLAG 0x02
215 #define TCP_FIN_FLAG 0x01
216 #define TCP_FLAG_ALL 0x3F
217 
224  uint16_t flags;
225  uint32_t dst_ip;
226  uint32_t dst_ip_mask;
227  uint32_t src_ip;
228  uint32_t src_ip_mask;
229  uint16_t dst_port;
230  uint16_t dst_port_mask;
231  uint16_t src_port;
232  uint16_t src_port_mask;
233  uint8_t proto;
234  uint8_t proto_mask;
238  uint8_t tcp_flags;
239  uint16_t priority;
241  uint16_t queue;
242 };
243 
248  RTE_TUNNEL_TYPE_NONE = 0,
249  RTE_TUNNEL_TYPE_VXLAN,
250  RTE_TUNNEL_TYPE_GENEVE,
251  RTE_TUNNEL_TYPE_TEREDO,
252  RTE_TUNNEL_TYPE_NVGRE,
253  RTE_TUNNEL_TYPE_IP_IN_GRE,
254  RTE_L2_TUNNEL_TYPE_E_TAG,
255  RTE_TUNNEL_TYPE_MAX,
256 };
257 
261 #define ETH_TUNNEL_FILTER_OMAC 0x01
262 #define ETH_TUNNEL_FILTER_OIP 0x02
263 #define ETH_TUNNEL_FILTER_TENID 0x04
264 #define ETH_TUNNEL_FILTER_IMAC 0x08
265 #define ETH_TUNNEL_FILTER_IVLAN 0x10
266 #define ETH_TUNNEL_FILTER_IIP 0x20
268 #define RTE_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \
269  ETH_TUNNEL_FILTER_IVLAN)
270 #define RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID (ETH_TUNNEL_FILTER_IMAC | \
271  ETH_TUNNEL_FILTER_IVLAN | \
272  ETH_TUNNEL_FILTER_TENID)
273 #define RTE_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \
274  ETH_TUNNEL_FILTER_TENID)
275 #define RTE_TUNNEL_FILTER_OMAC_TENID_IMAC (ETH_TUNNEL_FILTER_OMAC | \
276  ETH_TUNNEL_FILTER_TENID | \
277  ETH_TUNNEL_FILTER_IMAC)
278 
285 };
286 
293  uint16_t inner_vlan;
298  union {
299  uint32_t ipv4_addr;
300  uint32_t ipv6_addr[4];
301  } ip_addr;
303  uint16_t filter_type;
305  uint32_t tenant_id;
306  uint16_t queue_id;
307 };
308 
313  RTE_ETH_GLOBAL_CFG_TYPE_UNKNOWN = 0,
314  RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN,
315  RTE_ETH_GLOBAL_CFG_TYPE_MAX,
316 };
317 
323  union {
324  uint8_t gre_key_len;
325  uint64_t reserved;
326  } cfg;
327 };
328 
329 #define RTE_ETH_FDIR_MAX_FLEXLEN 16
330 #define RTE_ETH_INSET_SIZE_MAX 128
335 enum rte_eth_input_set_field {
336  RTE_ETH_INPUT_SET_UNKNOWN = 0,
337 
338  /* L2 */
339  RTE_ETH_INPUT_SET_L2_SRC_MAC = 1,
340  RTE_ETH_INPUT_SET_L2_DST_MAC,
341  RTE_ETH_INPUT_SET_L2_OUTER_VLAN,
342  RTE_ETH_INPUT_SET_L2_INNER_VLAN,
343  RTE_ETH_INPUT_SET_L2_ETHERTYPE,
344 
345  /* L3 */
346  RTE_ETH_INPUT_SET_L3_SRC_IP4 = 129,
347  RTE_ETH_INPUT_SET_L3_DST_IP4,
348  RTE_ETH_INPUT_SET_L3_SRC_IP6,
349  RTE_ETH_INPUT_SET_L3_DST_IP6,
350  RTE_ETH_INPUT_SET_L3_IP4_TOS,
351  RTE_ETH_INPUT_SET_L3_IP4_PROTO,
352  RTE_ETH_INPUT_SET_L3_IP6_TC,
353  RTE_ETH_INPUT_SET_L3_IP6_NEXT_HEADER,
354  RTE_ETH_INPUT_SET_L3_IP4_TTL,
355  RTE_ETH_INPUT_SET_L3_IP6_HOP_LIMITS,
356 
357  /* L4 */
358  RTE_ETH_INPUT_SET_L4_UDP_SRC_PORT = 257,
359  RTE_ETH_INPUT_SET_L4_UDP_DST_PORT,
360  RTE_ETH_INPUT_SET_L4_TCP_SRC_PORT,
361  RTE_ETH_INPUT_SET_L4_TCP_DST_PORT,
362  RTE_ETH_INPUT_SET_L4_SCTP_SRC_PORT,
363  RTE_ETH_INPUT_SET_L4_SCTP_DST_PORT,
364  RTE_ETH_INPUT_SET_L4_SCTP_VERIFICATION_TAG,
365 
366  /* Tunnel */
367  RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_DST_MAC = 385,
368  RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_SRC_MAC,
369  RTE_ETH_INPUT_SET_TUNNEL_L2_INNER_VLAN,
370  RTE_ETH_INPUT_SET_TUNNEL_L4_UDP_KEY,
371  RTE_ETH_INPUT_SET_TUNNEL_GRE_KEY,
372 
373  /* Flexible Payload */
374  RTE_ETH_INPUT_SET_FLEX_PAYLOAD_1ST_WORD = 641,
375  RTE_ETH_INPUT_SET_FLEX_PAYLOAD_2ND_WORD,
376  RTE_ETH_INPUT_SET_FLEX_PAYLOAD_3RD_WORD,
377  RTE_ETH_INPUT_SET_FLEX_PAYLOAD_4TH_WORD,
378  RTE_ETH_INPUT_SET_FLEX_PAYLOAD_5TH_WORD,
379  RTE_ETH_INPUT_SET_FLEX_PAYLOAD_6TH_WORD,
380  RTE_ETH_INPUT_SET_FLEX_PAYLOAD_7TH_WORD,
381  RTE_ETH_INPUT_SET_FLEX_PAYLOAD_8TH_WORD,
382 
383  RTE_ETH_INPUT_SET_DEFAULT = 65533,
384  RTE_ETH_INPUT_SET_NONE = 65534,
385  RTE_ETH_INPUT_SET_MAX = 65535,
386 };
387 
392  RTE_ETH_INPUT_SET_OP_UNKNOWN,
395  RTE_ETH_INPUT_SET_OP_MAX
396 };
397 
398 
404  uint16_t flow_type;
405  uint16_t inset_size;
407  enum rte_filter_input_set_op op;
408 };
409 
414  uint16_t ether_type;
415 };
416 
421  uint32_t src_ip;
422  uint32_t dst_ip;
423  uint8_t tos;
424  uint8_t ttl;
425  uint8_t proto;
426 };
427 
433  uint16_t src_port;
434  uint16_t dst_port;
435 };
436 
442  uint16_t src_port;
443  uint16_t dst_port;
444 };
445 
451  uint16_t src_port;
452  uint16_t dst_port;
453  uint32_t verify_tag;
454 };
455 
460  uint32_t src_ip[4];
461  uint32_t dst_ip[4];
462  uint8_t tc;
463  uint8_t proto;
464  uint8_t hop_limits;
465 };
466 
472  uint16_t src_port;
473  uint16_t dst_port;
474 };
475 
481  uint16_t src_port;
482  uint16_t dst_port;
483 };
484 
490  uint16_t src_port;
491  uint16_t dst_port;
492  uint32_t verify_tag;
493 };
494 
500 };
501 
506  RTE_FDIR_TUNNEL_TYPE_UNKNOWN = 0,
507  RTE_FDIR_TUNNEL_TYPE_NVGRE,
508  RTE_FDIR_TUNNEL_TYPE_VXLAN,
509 };
510 
518  uint32_t tunnel_id;
520 };
521 
527  struct rte_eth_l2_flow l2_flow;
528  struct rte_eth_udpv4_flow udp4_flow;
529  struct rte_eth_tcpv4_flow tcp4_flow;
530  struct rte_eth_sctpv4_flow sctp4_flow;
531  struct rte_eth_ipv4_flow ip4_flow;
532  struct rte_eth_udpv6_flow udp6_flow;
533  struct rte_eth_tcpv6_flow tcp6_flow;
534  struct rte_eth_sctpv6_flow sctp6_flow;
535  struct rte_eth_ipv6_flow ipv6_flow;
536  struct rte_eth_mac_vlan_flow mac_vlan_flow;
537  struct rte_eth_tunnel_flow tunnel_flow;
538 };
539 
544  uint16_t vlan_tci;
547  uint8_t is_vf;
548  uint16_t dst_id;
549 };
550 
555  uint16_t flow_type;
560 };
561 
566  RTE_ETH_FDIR_ACCEPT = 0,
567  RTE_ETH_FDIR_REJECT,
568  RTE_ETH_FDIR_PASSTHRU,
569 };
570 
580 };
581 
586  uint16_t rx_queue;
589  uint8_t flex_off;
593 };
594 
601  uint32_t soft_id;
605 };
606 
612  uint16_t vlan_tci_mask;
618  uint16_t src_port_mask;
620  uint16_t dst_port_mask;
625  uint32_t tunnel_id_mask;
628 };
629 
634  RTE_ETH_PAYLOAD_UNKNOWN = 0,
635  RTE_ETH_RAW_PAYLOAD,
636  RTE_ETH_L2_PAYLOAD,
637  RTE_ETH_L3_PAYLOAD,
638  RTE_ETH_L4_PAYLOAD,
639  RTE_ETH_PAYLOAD_MAX = 8,
640 };
641 
653 };
654 
660  uint16_t flow_type;
663 };
664 
670  uint16_t nb_payloads;
671  uint16_t nb_flexmasks;
672  struct rte_eth_flex_payload_cfg flex_set[RTE_ETH_PAYLOAD_MAX];
674  struct rte_eth_fdir_flex_mask flex_mask[RTE_ETH_FLOW_MAX];
676 };
677 
687 };
688 
689 #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
690 #define RTE_FLOW_MASK_ARRAY_SIZE \
691  (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
692 
702  struct rte_eth_fdir_masks mask;
705  uint32_t guarant_spc;
706  uint32_t best_spc;
708  uint32_t flow_types_mask[RTE_FLOW_MASK_ARRAY_SIZE];
709  uint32_t max_flexpayload;
725 };
726 
732  uint32_t collision;
733  uint32_t free;
734  uint32_t maxhash;
737  uint32_t maxlen;
738  uint64_t add;
739  uint64_t remove;
740  uint64_t f_add;
741  uint64_t f_remove;
742  uint32_t guarant_cnt;
743  uint32_t best_cnt;
744 };
745 
750  RTE_ETH_FDIR_FILTER_INFO_TYPE_UNKNOWN = 0,
753  RTE_ETH_FDIR_FILTER_INFO_TYPE_MAX,
754 };
755 
763  union {
766  } info;
767 };
768 
780  RTE_ETH_HASH_FILTER_INFO_TYPE_UNKNOWN = 0,
787  RTE_ETH_HASH_FILTER_INFO_TYPE_MAX,
788 };
789 
794  RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
797  RTE_ETH_HASH_FUNCTION_MAX,
798 };
799 
800 #define RTE_SYM_HASH_MASK_ARRAY_SIZE \
801  (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
802 
814  uint32_t sym_hash_enable_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
816  uint32_t valid_bit_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
817 };
818 
826  union {
828  uint8_t enable;
833  } info;
834 };
835 
840  enum rte_eth_tunnel_type l2_tunnel_type;
841  uint16_t ether_type; /* ether type in l2 header */
842  uint32_t tunnel_id; /* port tag id for e-tag */
843  uint16_t vf_id; /* VF id for tag insertion */
844  uint32_t pool; /* destination pool for tag based forwarding */
845 };
846 
847 #ifdef __cplusplus
848 }
849 #endif
850 
851 #endif /* _RTE_ETH_CTRL_H_ */