FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
protocol.h
Go to the documentation of this file.
1 /*
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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 #ifndef __included_lacp_protocol_h__
17 #define __included_lacp_protocol_h__
18 
19 #include <vnet/ethernet/ethernet.h>
20 #include <vnet/bonding/node.h>
21 
22 #define LACP_CHURN_DETECTION_TIME 60
23 #define LACP_AGGREGATE_WAIT_TIME 2.0
24 
25 #define LACP_SUBTYPE 1
26 #define LACP_ACTOR_LACP_VERSION 1
27 
28 #define foreach_lacp_tlv \
29  _ (TERMINATOR_INFORMATION, 0) \
30  _ (ACTOR_INFORMATION, 1) \
31  _ (PARTNER_INFORMATION , 2) \
32  _ (COLLECTOR_INFORMATION, 3)
33 
34 typedef enum
35 {
36 #define _(f,n) LACP_##f = (n),
38 #undef _
39 } lacp_tlv_t;
40 
41 #define foreach_lacp_port \
42  _ (UNSELECTED, 0) \
43  _ (SELECTED, 1) \
44  _ (STANDBY, 2)
45 
46 typedef enum
47 {
48 #define _(f,n) LACP_PORT_##f = (n),
50 #undef _
51 } lacp_port_t;
52 
53 /* Port state */
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")
63 
64 #define LACP_STEADY_STATE (LACP_STATE_SYNCHRONIZATION | \
65  LACP_STATE_COLLECTING | \
66  LACP_STATE_DISTRIBUTING)
67 
68 typedef enum
69 {
70 #define _(a, b, c) LACP_STATE_##b = (1 << a),
72 #undef _
73 } lacp_state_t;
74 
75 #define foreach_lacp_state_flag \
76  _(0, LACP_STATE_LACP_ACTIVITY, "activity") \
77  _(1, LACP_STATE_LACP_TIMEOUT, "lacp timeout") \
78  _(2, LACP_STATE_AGGREGATION, "aggregation") \
79  _(3, LACP_STATE_SYNCHRONIZATION, "synchronization") \
80  _(4, LACP_STATE_COLLECTIING, "collecting") \
81  _(5, LACP_STATE_DISTRIBUTING, "distributing") \
82  _(6, LACP_STATE_DEFAULTED, "defaulted") \
83  _(7, LACP_STATE_EXPIRED, "expired")
84 
85 typedef struct
86 {
88  char *str;
90 
91 typedef struct
92 {
94  char *str;
96 
97 #define LACP_MAX_TX_IN_SECOND 3
98 #define LACP_DEFAULT_PORT_PRIORITY 0x00ff
99 #define LACP_DEFAULT_SYSTEM_PRIORITY 0xffff
100 
101 typedef CLIB_PACKED (struct
102  {
103  u8 tlv_type;
104  u8 tlv_length;
105  lacp_port_info_t port_info; u8 reserved[3];
106  }) lacp_actor_partner_t;
107 
108 typedef CLIB_PACKED (struct
109  {
110  u8 tlv_type; u8 tlv_length; u16 max_delay;
111  u8 reserved[12];
112  }) lacp_collector_t;
113 
114 typedef CLIB_PACKED (struct
115  {
116  u8 tlv_type; u8 tlv_length;
117  u8 pad[50];
118  }) lacp_terminator_t;
119 
120 typedef CLIB_PACKED (struct
121  {
122  u8 subtype; u8 version_number;
123  lacp_actor_partner_t actor; lacp_actor_partner_t partner;
124  lacp_collector_t collector; lacp_terminator_t terminator;
125  }) lacp_pdu_t;
126 
127 typedef CLIB_PACKED (struct
128  {
129  ethernet_header_t ethernet; lacp_pdu_t lacp;
130  }) ethernet_lacp_pdu_t;
131 
132 #define MARKER_SUBTYPE 2
133 #define MARKER_PROTOCOL_VERSION 1
134 
135 #define foreach_marker_tlv \
136  _ (TERMINATOR_INFORMATION, 0) \
137  _ (INFORMATION, 1) \
138  _ (RESPONSE_INFORMATION , 2)
139 
140 typedef enum
141 {
142 #define _(f,n) MARKER_##f = (n),
144 #undef _
145 } marker_tlv_t;
146 
147 typedef CLIB_PACKED (struct
148  {
149  u8 tlv_type; u8 tlv_length;
150  u8 reserved[90];
151  }) marker_terminator_t;
152 
153 typedef CLIB_PACKED (struct
154  {
155  u8 tlv_type;
156  u8 tlv_length;
157  u16 requester_port; u8 requester_system[6];
158  u32 requester_transaction_id; u8 pad[2];
159  }) marker_information_t;
160 
161 typedef CLIB_PACKED (struct
162  {
163  u8 subtype;
164  u8 version_number;
165  marker_information_t marker_info;
166  marker_terminator_t terminator;
167  }) marker_pdu_t;
168 
169 typedef CLIB_PACKED (struct
170  {
171  ethernet_header_t ethernet; marker_pdu_t marker;
172  }) ethernet_marker_pdu_t;
173 
174 #endif /* __included_lacp_protocol_h__ */
175 
176 /*
177  * fd.io coding-style-patch-verification: ON
178  *
179  * Local Variables:
180  * eval: (c-set-style "gnu")
181  * End:
182  */
marker_tlv_t
Definition: protocol.h:140
u8 pad[3]
log2 (size of the packing page block)
Definition: bihash_doc.h:61
#define foreach_lacp_state
Definition: protocol.h:54
unsigned char u8
Definition: types.h:56
#define foreach_marker_tlv
Definition: protocol.h:135
lacp_state_t
Definition: protocol.h:68
unsigned int u32
Definition: types.h:88
typedef CLIB_PACKED(struct { u8 tlv_type;u8 tlv_length;lacp_port_info_t port_info;u8 reserved[3];}) lacp_actor_partner_t
unsigned short u16
Definition: types.h:57
lacp_port_t
Definition: protocol.h:46
#define foreach_lacp_port
Definition: protocol.h:41
#define foreach_lacp_tlv
Definition: protocol.h:28
lacp_tlv_t
Definition: protocol.h:34