4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
34 #ifndef _RTE_ETH_CTRL_H_
35 #define _RTE_ETH_CTRL_H_
40 * Ethernet device features and related data structures used
41 * by control APIs should be defined in this file.
50 * Feature filter types
52 enum rte_filter_type {
53 RTE_ETH_FILTER_NONE = 0,
54 RTE_ETH_FILTER_MACVLAN,
55 RTE_ETH_FILTER_TUNNEL,
60 * Generic operations on filters
63 RTE_ETH_FILTER_NOP = 0,
64 /**< used to check whether the type filter is supported */
65 RTE_ETH_FILTER_ADD, /**< add filter entry */
66 RTE_ETH_FILTER_UPDATE, /**< update filter entry */
67 RTE_ETH_FILTER_DELETE, /**< delete filter entry */
68 RTE_ETH_FILTER_FLUSH, /**< flush all entries */
69 RTE_ETH_FILTER_GET, /**< get filter entry */
70 RTE_ETH_FILTER_SET, /**< configurations */
72 /**< get information of filter, such as status or statistics */
79 enum rte_mac_filter_type {
80 RTE_MAC_PERFECT_MATCH = 1, /**< exact match of MAC addr. */
81 RTE_MACVLAN_PERFECT_MATCH,
82 /**< exact match of MAC addr and VLAN ID. */
83 RTE_MAC_HASH_MATCH, /**< hash match of MAC addr. */
84 RTE_MACVLAN_HASH_MATCH,
85 /**< hash match of MAC addr and exact match of VLAN ID. */
91 struct rte_eth_mac_filter {
92 uint8_t is_vf; /**< 1 for VF, 0 for port dev */
93 uint16_t dst_id; /**<VF ID, available when is_vf is 1*/
94 uint16_t filter_type; /**< MAC filter type */
95 struct ether_addr mac_addr;
101 enum rte_eth_tunnel_type {
102 RTE_TUNNEL_TYPE_NONE = 0,
103 RTE_TUNNEL_TYPE_VXLAN,
104 RTE_TUNNEL_TYPE_GENEVE,
105 RTE_TUNNEL_TYPE_TEREDO,
106 RTE_TUNNEL_TYPE_NVGRE,
111 * filter type of tunneling packet
113 #define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
114 #define ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */
115 #define ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
116 #define ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */
117 #define ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
118 #define ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */
120 #define RTE_TUNNEL_FILTER_IMAC_IVLAN (ETH_TUNNEL_FILTER_IMAC | \
121 ETH_TUNNEL_FILTER_IVLAN)
122 #define RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID (ETH_TUNNEL_FILTER_IMAC | \
123 ETH_TUNNEL_FILTER_IVLAN | \
124 ETH_TUNNEL_FILTER_TENID)
125 #define RTE_TUNNEL_FILTER_IMAC_TENID (ETH_TUNNEL_FILTER_IMAC | \
126 ETH_TUNNEL_FILTER_TENID)
127 #define RTE_TUNNEL_FILTER_OMAC_TENID_IMAC (ETH_TUNNEL_FILTER_OMAC | \
128 ETH_TUNNEL_FILTER_TENID | \
129 ETH_TUNNEL_FILTER_IMAC)
132 * Select IPv4 or IPv6 for tunnel filters.
134 enum rte_tunnel_iptype {
135 RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4. */
136 RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6. */
140 * Tunneling Packet filter configuration.
142 struct rte_eth_tunnel_filter_conf {
143 struct ether_addr *outer_mac; /**< Outer MAC address filter. */
144 struct ether_addr *inner_mac; /**< Inner MAC address filter. */
145 uint16_t inner_vlan; /**< Inner VLAN filter. */
146 enum rte_tunnel_iptype ip_type; /**< IP address type. */
148 uint32_t ipv4_addr; /**< IPv4 source address to match. */
149 uint32_t ipv6_addr[4]; /**< IPv6 source address to match. */
150 } ip_addr; /**< IPv4/IPv6 source address to match (union of above). */
152 uint16_t filter_type; /**< Filter type. */
153 enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type. */
154 uint32_t tenant_id; /** < Tenant number. */
155 uint16_t queue_id; /** < queue number. */
162 #endif /* _RTE_ETH_CTRL_H_ */