2 * Copyright (c) 2017 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef __included_lacp_protocol_h__
17 #define __included_lacp_protocol_h__
19 #include <vnet/ethernet/ethernet.h>
20 #include <vnet/bonding/node.h>
22 #define LACP_CHURN_DETECTION_TIME 60
23 #define LACP_AGGREGATE_WAIT_TIME 2.0
25 #define LACP_SUBTYPE 1
26 #define LACP_ACTOR_LACP_VERSION 1
28 #define foreach_lacp_tlv \
29 _ (TERMINATOR_INFORMATION, 0) \
30 _ (ACTOR_INFORMATION, 1) \
31 _ (PARTNER_INFORMATION , 2) \
32 _ (COLLECTOR_INFORMATION, 3)
36 #define _(f,n) LACP_##f = (n),
41 #define foreach_lacp_port \
48 #define _(f,n) LACP_PORT_##f = (n),
54 #define foreach_lacp_state \
55 _(0, LACP_ACTIVITY, "activity") \
56 _(1, LACP_TIMEOUT, "lacp timeout") \
57 _(2, AGGREGATION, "aggregation") \
58 _(3, SYNCHRONIZATION, "synchronization") \
59 _(4, COLLECTING, "collecting") \
60 _(5, DISTRIBUTING, "distributing") \
61 _(6, DEFAULTED, "defaulted") \
62 _(7, EXPIRED, "expired")
66 #define _(a, b, c) LACP_STATE_##b = (1 << a),
71 #define foreach_lacp_state_flag \
72 _(0, LACP_STATE_LACP_ACTIViTY, "activity") \
73 _(1, LACP_STATE_LACP_TIMEOUT, "lacp timeout") \
74 _(2, LACP_STATE_AGGREGATION, "aggregation") \
75 _(3, LACP_STATE_SYNCHRONIZATION, "synchronization") \
76 _(4, LACP_STATE_COLLECTIING, "collecting") \
77 _(5, LACP_STATE_DISTRIBUTING, "distributing") \
78 _(6, LACP_STATE_DEFAULTED, "defaulted") \
79 _(7, LACP_STATE_EXPIRED, "expired")
93 #define LACP_MAX_TX_IN_SECOND 3
94 #define LACP_DEFAULT_PORT_PRIORITY 0x00ff
95 #define LACP_DEFAULT_SYSTEM_PRIORITY 0xffff
97 typedef CLIB_PACKED (struct
101 lacp_port_info_t port_info; u8 reserved[3];
102 }) lacp_actor_partner_t;
104 typedef CLIB_PACKED (struct
106 u8 tlv_type; u8 tlv_length; u16 max_delay;
110 typedef CLIB_PACKED (struct
112 u8 tlv_type; u8 tlv_length;
114 }) lacp_terminator_t;
116 typedef CLIB_PACKED (struct
118 u8 subtype; u8 version_number;
119 lacp_actor_partner_t actor; lacp_actor_partner_t partner;
120 lacp_collector_t collector; lacp_terminator_t terminator;
123 typedef CLIB_PACKED (struct
125 ethernet_header_t ethernet; lacp_pdu_t lacp;
126 }) ethernet_lacp_pdu_t;
128 #define MARKER_SUBTYPE 2
129 #define MARKER_PROTOCOL_VERSION 1
131 #define foreach_marker_tlv \
132 _ (TERMINATOR_INFORMATION, 0) \
134 _ (RESPONSE_INFORMATION , 2)
138 #define _(f,n) MARKER_##f = (n),
143 typedef CLIB_PACKED (struct
145 u8 tlv_type; u8 tlv_length;
147 }) marker_terminator_t;
149 typedef CLIB_PACKED (struct
153 u16 requester_port; u8 requester_system[6];
154 u32 requester_transaction_id; u8 pad[2];
155 }) marker_information_t;
157 typedef CLIB_PACKED (struct
161 marker_information_t marker_info;
162 marker_terminator_t terminator;
165 typedef CLIB_PACKED (struct
167 ethernet_header_t ethernet; marker_pdu_t marker;
168 }) ethernet_marker_pdu_t;
170 #endif /* __included_lacp_protocol_h__ */
173 * fd.io coding-style-patch-verification: ON
176 * eval: (c-set-style "gnu")