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_BOND_8023AD_H_
35 #define RTE_ETH_BOND_8023AD_H_
37 #include <rte_ether.h>
44 * Actor/partner states
46 #define STATE_LACP_ACTIVE 0x01
47 #define STATE_LACP_SHORT_TIMEOUT 0x02
48 #define STATE_AGGREGATION 0x04
49 #define STATE_SYNCHRONIZATION 0x08
50 #define STATE_COLLECTING 0x10
51 #define STATE_DISTRIBUTING 0x20
52 /** Partners parameters are defaulted */
53 #define STATE_DEFAULTED 0x40
54 #define STATE_EXPIRED 0x80
56 #define TLV_TYPE_ACTOR_INFORMATION 0x01
57 #define TLV_TYPE_PARTNER_INFORMATION 0x02
58 #define TLV_TYPE_COLLECTOR_INFORMATION 0x03
59 #define TLV_TYPE_TERMINATOR_INFORMATION 0x00
61 #define SLOW_SUBTYPE_LACP 0x01
62 #define SLOW_SUBTYPE_MARKER 0x02
64 #define MARKER_TLV_TYPE_INFO 0x01
65 #define MARKER_TLV_TYPE_RESP 0x02
67 enum rte_bond_8023ad_selection {
73 /** Generic slow protocol structure */
74 struct slow_protocol {
76 uint8_t reserved_119[119];
77 } __attribute__((__packed__));
79 /** Generic slow protocol frame type structure */
80 struct slow_protocol_frame {
81 struct ether_hdr eth_hdr;
82 struct slow_protocol slow_protocol;
83 } __attribute__((__packed__));
86 uint16_t system_priority;
87 /**< System priority (unused in current implementation) */
88 struct ether_addr system;
89 /**< System ID - Slave MAC address, same as bonding MAC address */
91 /**< Speed information (implementation dependednt) and duplex. */
92 uint16_t port_priority;
93 /**< Priority of this (unused in current implementation) */
95 /**< Port number. It corresponds to slave port id. */
96 } __attribute__((__packed__));
98 struct lacpdu_actor_partner_params {
99 uint8_t tlv_type_info;
101 struct port_params port_params;
103 uint8_t reserved_3[3];
104 } __attribute__((__packed__));
106 /** LACPDU structure (5.4.2 in 802.1AX documentation). */
109 uint8_t version_number;
111 struct lacpdu_actor_partner_params actor;
112 struct lacpdu_actor_partner_params partner;
114 uint8_t tlv_type_collector_info;
115 uint8_t collector_info_length;
116 uint16_t collector_max_delay;
117 uint8_t reserved_12[12];
119 uint8_t tlv_type_terminator;
120 uint8_t terminator_length;
121 uint8_t reserved_50[50];
122 } __attribute__((__packed__));
124 /** LACPDU frame: Contains ethernet header and LACPDU. */
125 struct lacpdu_header {
126 struct ether_hdr eth_hdr;
127 struct lacpdu lacpdu;
128 } __attribute__((__packed__));
132 uint8_t version_number;
134 uint8_t tlv_type_marker;
136 uint16_t requester_port;
137 struct ether_addr requester_system;
138 uint32_t requester_transaction_id;
139 uint8_t reserved_2[2];
141 uint8_t tlv_type_terminator;
142 uint8_t terminator_length;
143 uint8_t reserved_90[90];
144 } __attribute__((__packed__));
146 struct marker_header {
147 struct ether_hdr eth_hdr;
148 struct marker marker;
149 } __attribute__((__packed__));
151 struct rte_eth_bond_8023ad_conf {
152 uint32_t fast_periodic_ms;
153 uint32_t slow_periodic_ms;
154 uint32_t short_timeout_ms;
155 uint32_t long_timeout_ms;
156 uint32_t aggregate_wait_timeout_ms;
157 uint32_t tx_period_ms;
158 uint32_t rx_marker_period_ms;
159 uint32_t update_timeout_ms;
162 struct rte_eth_bond_8023ad_slave_info {
163 enum rte_bond_8023ad_selection selected;
165 struct port_params actor;
166 uint8_t partner_state;
167 struct port_params partner;
174 * Function returns current configuration of 802.3AX mode.
176 * @param port_id Bonding device id
177 * @param conf Pointer to timeout structure.
181 * -EINVAL if conf is NULL
184 rte_eth_bond_8023ad_conf_get(uint8_t port_id,
185 struct rte_eth_bond_8023ad_conf *conf);
190 * Function set new configuration of 802.3AX mode.
192 * @param port_id Bonding device id
193 * @param conf Configuration, if NULL set default configuration.
196 * -EINVAL if configuration is invalid.
199 rte_eth_bond_8023ad_setup(uint8_t port_id,
200 struct rte_eth_bond_8023ad_conf *conf);
205 * Function returns current state of given slave device.
207 * @param slave_id Port id of valid slave.
208 * @param conf buffer for configuration
211 * -EINVAL if conf is NULL or slave id is invalid (not a slave of given
212 * bonded device or is not inactive).
215 rte_eth_bond_8023ad_slave_info(uint8_t port_id, uint8_t slave_id,
216 struct rte_eth_bond_8023ad_slave_info *conf);
222 #endif /* RTE_ETH_BOND_8023AD_H_ */