]>
Commit | Line | Data |
---|---|---|
9efd308e | 1 | /* |
eb1746e6 | 2 | * Copyright (c) 2011-2015 M3S, Srl - Italy |
9efd308e DV |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at: | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | /* | |
18 | * Rapid Spanning Tree Protocol (IEEE 802.1D-2004) common header file. | |
19 | * | |
20 | * Authors: | |
21 | * Martino Fornasa <mf@fornasa.it> | |
22 | * Daniele Venturino <daniele.venturino@m3s.it> | |
eb1746e6 | 23 | * Carlo Andreotti <c.andreotti@m3s.it> |
9efd308e DV |
24 | * |
25 | * References to IEEE 802.1D-2004 standard are enclosed in square brackets. | |
26 | * E.g. [17.3], [Table 17-1], etc. | |
27 | * | |
28 | */ | |
29 | ||
30 | #ifndef RSTP_COMMON_H | |
31 | #define RSTP_COMMON_H 1 | |
32 | ||
33 | #include "rstp.h" | |
34 | #include <stdbool.h> | |
35 | #include <stdint.h> | |
ee89ea7b | 36 | #include "openvswitch/hmap.h" |
b19bab5b | 37 | #include "openvswitch/list.h" |
9efd308e DV |
38 | #include "ovs-atomic.h" |
39 | #include "packets.h" | |
40 | ||
41 | enum admin_port_state { | |
42 | RSTP_ADMIN_BRIDGE_PORT_STATE_DISABLED = 0, | |
43 | RSTP_ADMIN_BRIDGE_PORT_STATE_ENABLED = 1 | |
44 | }; | |
45 | ||
46 | enum oper_p2p_mac_state { | |
47 | RSTP_OPER_P2P_MAC_STATE_DISABLED = 0, | |
48 | RSTP_OPER_P2P_MAC_STATE_ENABLED = 1 | |
49 | }; | |
50 | ||
51 | /* State enumerations for state machines defined in rstp-state-machines.c */ | |
52 | enum port_receive_state_machine { | |
53 | PORT_RECEIVE_SM_INIT, | |
54 | PORT_RECEIVE_SM_DISCARD_EXEC, | |
55 | PORT_RECEIVE_SM_DISCARD, | |
56 | PORT_RECEIVE_SM_RECEIVE_EXEC, | |
57 | PORT_RECEIVE_SM_RECEIVE | |
58 | }; | |
59 | enum port_transmit_state_machine { | |
60 | PORT_TRANSMIT_SM_INIT, | |
61 | PORT_TRANSMIT_SM_TRANSMIT_INIT_EXEC, | |
62 | PORT_TRANSMIT_SM_TRANSMIT_INIT, | |
63 | PORT_TRANSMIT_SM_TRANSMIT_PERIODIC_EXEC, | |
64 | PORT_TRANSMIT_SM_TRANSMIT_PERIODIC, | |
65 | PORT_TRANSMIT_SM_IDLE_EXEC, | |
66 | PORT_TRANSMIT_SM_IDLE, | |
67 | PORT_TRANSMIT_SM_TRANSMIT_CONFIG_EXEC, | |
68 | PORT_TRANSMIT_SM_TRANSMIT_CONFIG, | |
69 | PORT_TRANSMIT_SM_TRANSMIT_TCN_EXEC, | |
70 | PORT_TRANSMIT_SM_TRANSMIT_TCN, | |
71 | PORT_TRANSMIT_SM_TRANSMIT_RSTP_EXEC, | |
72 | PORT_TRANSMIT_SM_TRANSMIT_RSTP | |
73 | }; | |
74 | enum bridge_detection_state_machine { | |
75 | BRIDGE_DETECTION_SM_INIT, | |
76 | BRIDGE_DETECTION_SM_EDGE_EXEC, | |
77 | BRIDGE_DETECTION_SM_EDGE, | |
78 | BRIDGE_DETECTION_SM_NOT_EDGE_EXEC, | |
79 | BRIDGE_DETECTION_SM_NOT_EDGE | |
80 | }; | |
81 | enum port_protocol_migration_state_machine { | |
82 | PORT_PROTOCOL_MIGRATION_SM_INIT, | |
83 | PORT_PROTOCOL_MIGRATION_SM_CHECKING_RSTP_EXEC, | |
84 | PORT_PROTOCOL_MIGRATION_SM_CHECKING_RSTP, | |
85 | PORT_PROTOCOL_MIGRATION_SM_SELECTING_STP_EXEC, | |
86 | PORT_PROTOCOL_MIGRATION_SM_SELECTING_STP, | |
87 | PORT_PROTOCOL_MIGRATION_SM_SENSING_EXEC, | |
88 | PORT_PROTOCOL_MIGRATION_SM_SENSING | |
89 | }; | |
90 | enum port_information_state_machine { | |
91 | PORT_INFORMATION_SM_INIT, | |
92 | PORT_INFORMATION_SM_DISABLED_EXEC, | |
93 | PORT_INFORMATION_SM_DISABLED, | |
94 | PORT_INFORMATION_SM_AGED_EXEC, | |
95 | PORT_INFORMATION_SM_AGED, | |
96 | PORT_INFORMATION_SM_UPDATE_EXEC, | |
97 | PORT_INFORMATION_SM_UPDATE, | |
98 | PORT_INFORMATION_SM_CURRENT_EXEC, | |
99 | PORT_INFORMATION_SM_CURRENT, | |
100 | PORT_INFORMATION_SM_RECEIVE_EXEC, | |
101 | PORT_INFORMATION_SM_RECEIVE, | |
102 | PORT_INFORMATION_SM_OTHER_EXEC, | |
103 | PORT_INFORMATION_SM_OTHER, | |
104 | PORT_INFORMATION_SM_NOT_DESIGNATED_EXEC, | |
105 | PORT_INFORMATION_SM_NOT_DESIGNATED, | |
106 | PORT_INFORMATION_SM_INFERIOR_DESIGNATED_EXEC, | |
107 | PORT_INFORMATION_SM_INFERIOR_DESIGNATED, | |
108 | PORT_INFORMATION_SM_REPEATED_DESIGNATED_EXEC, | |
109 | PORT_INFORMATION_SM_REPEATED_DESIGNATED, | |
110 | PORT_INFORMATION_SM_SUPERIOR_DESIGNATED_EXEC, | |
111 | PORT_INFORMATION_SM_SUPERIOR_DESIGNATED | |
112 | }; | |
113 | enum port_role_selection_state_machine { | |
114 | PORT_ROLE_SELECTION_SM_INIT, | |
115 | PORT_ROLE_SELECTION_SM_INIT_BRIDGE_EXEC, | |
116 | PORT_ROLE_SELECTION_SM_INIT_BRIDGE, | |
117 | PORT_ROLE_SELECTION_SM_ROLE_SELECTION_EXEC, | |
118 | PORT_ROLE_SELECTION_SM_ROLE_SELECTION | |
119 | }; | |
120 | enum port_role_transition_state_machine { | |
121 | PORT_ROLE_TRANSITION_SM_INIT, | |
122 | PORT_ROLE_TRANSITION_SM_INIT_PORT_EXEC, | |
123 | PORT_ROLE_TRANSITION_SM_DISABLE_PORT_EXEC, | |
124 | PORT_ROLE_TRANSITION_SM_DISABLE_PORT, | |
125 | PORT_ROLE_TRANSITION_SM_DISABLED_PORT_EXEC, | |
126 | PORT_ROLE_TRANSITION_SM_DISABLED_PORT, | |
127 | PORT_ROLE_TRANSITION_SM_ROOT_PORT_EXEC, | |
128 | PORT_ROLE_TRANSITION_SM_ROOT_PORT, | |
129 | PORT_ROLE_TRANSITION_SM_REROOT_EXEC, | |
130 | PORT_ROLE_TRANSITION_SM_ROOT_AGREED_EXEC, | |
131 | PORT_ROLE_TRANSITION_SM_ROOT_PROPOSED_EXEC, | |
132 | PORT_ROLE_TRANSITION_SM_ROOT_FORWARD_EXEC, | |
133 | PORT_ROLE_TRANSITION_SM_ROOT_LEARN_EXEC, | |
134 | PORT_ROLE_TRANSITION_SM_REROOTED_EXEC, | |
135 | PORT_ROLE_TRANSITION_SM_DESIGNATED_PORT_EXEC, | |
136 | PORT_ROLE_TRANSITION_SM_DESIGNATED_PORT, | |
137 | PORT_ROLE_TRANSITION_SM_DESIGNATED_RETIRED_EXEC, | |
138 | PORT_ROLE_TRANSITION_SM_DESIGNATED_SYNCED_EXEC, | |
139 | PORT_ROLE_TRANSITION_SM_DESIGNATED_PROPOSE_EXEC, | |
140 | PORT_ROLE_TRANSITION_SM_DESIGNATED_FORWARD_EXEC, | |
141 | PORT_ROLE_TRANSITION_SM_DESIGNATED_LEARN_EXEC, | |
142 | PORT_ROLE_TRANSITION_SM_DESIGNATED_DISCARD_EXEC, | |
143 | PORT_ROLE_TRANSITION_SM_ALTERNATE_PORT_EXEC, | |
144 | PORT_ROLE_TRANSITION_SM_ALTERNATE_PORT, | |
7ccf8d38 | 145 | PORT_ROLE_TRANSITION_SM_ALTERNATE_AGREED_EXEC, |
9efd308e DV |
146 | PORT_ROLE_TRANSITION_SM_ALTERNATE_PROPOSED_EXEC, |
147 | PORT_ROLE_TRANSITION_SM_BLOCK_PORT_EXEC, | |
148 | PORT_ROLE_TRANSITION_SM_BLOCK_PORT, | |
149 | PORT_ROLE_TRANSITION_SM_BACKUP_PORT_EXEC | |
150 | }; | |
151 | enum port_state_transition_state_machine { | |
152 | PORT_STATE_TRANSITION_SM_INIT, | |
153 | PORT_STATE_TRANSITION_SM_DISCARDING_EXEC, | |
154 | PORT_STATE_TRANSITION_SM_DISCARDING, | |
155 | PORT_STATE_TRANSITION_SM_LEARNING_EXEC, | |
156 | PORT_STATE_TRANSITION_SM_LEARNING, | |
157 | PORT_STATE_TRANSITION_SM_FORWARDING_EXEC, | |
158 | PORT_STATE_TRANSITION_SM_FORWARDING | |
159 | }; | |
160 | enum topology_change_state_machine { | |
161 | TOPOLOGY_CHANGE_SM_INIT, | |
162 | TOPOLOGY_CHANGE_SM_INACTIVE_EXEC, | |
163 | TOPOLOGY_CHANGE_SM_INACTIVE, | |
164 | TOPOLOGY_CHANGE_SM_LEARNING_EXEC, | |
165 | TOPOLOGY_CHANGE_SM_LEARNING, | |
166 | TOPOLOGY_CHANGE_SM_DETECTED_EXEC, | |
167 | TOPOLOGY_CHANGE_SM_ACTIVE_EXEC, | |
168 | TOPOLOGY_CHANGE_SM_ACTIVE, | |
169 | TOPOLOGY_CHANGE_SM_ACKNOWLEDGED_EXEC, | |
170 | TOPOLOGY_CHANGE_SM_PROPAGATING_EXEC, | |
171 | TOPOLOGY_CHANGE_SM_NOTIFIED_TC_EXEC, | |
172 | TOPOLOGY_CHANGE_SM_NOTIFIED_TCN_EXEC, | |
173 | }; | |
174 | ||
175 | ||
176 | /* [17.18.4, 17.13, Table 17-1]. */ | |
177 | struct rstp_times { | |
178 | /* [17.13.5 - Bridge Forward Delay] The delay (expressed in seconds) used | |
179 | * by STP Bridges (17.4) to transition Root and Designated Ports to | |
180 | * Forwarding (Table 17-1). | |
181 | * Default = 15.0 s. Values in range 4.0 - 30.0 | |
182 | */ | |
183 | uint16_t forward_delay; | |
184 | ||
185 | /* [17.13.6 - Bridge Hello Time] | |
186 | * The interval between periodic transmissions of Configuration Messages | |
187 | * by Designated Ports (Table 17-1). | |
188 | * Default = 2.0 s. Fixed value | |
189 | */ | |
190 | uint16_t hello_time; | |
191 | ||
192 | /* [17.13.8 - Bridge Max Age] | |
193 | * The maximum age of the information transmitted by the Bridge when it is | |
194 | * the Root Bridge (Table 17-1). | |
195 | * Default = 20.0 s. Values in range 6.0 - 40.0 */ | |
196 | uint16_t max_age; | |
197 | ||
198 | uint16_t message_age; | |
199 | }; | |
200 | ||
201 | /* Priority vector [17.6] */ | |
202 | struct rstp_priority_vector { | |
203 | rstp_identifier root_bridge_id; | |
204 | uint32_t root_path_cost; | |
205 | rstp_identifier designated_bridge_id; | |
206 | uint16_t designated_port_id; | |
207 | uint16_t bridge_port_id; | |
208 | }; | |
209 | ||
9efd308e DV |
210 | enum rstp_bpdu_type { |
211 | CONFIGURATION_BPDU = 0x0, | |
212 | TOPOLOGY_CHANGE_NOTIFICATION_BPDU = 0x80, | |
213 | RAPID_SPANNING_TREE_BPDU = 0x2 | |
4b30ba05 | 214 | }; |
9efd308e DV |
215 | |
216 | enum rstp_bpdu_flag { | |
217 | BPDU_FLAG_TOPCHANGE = 0x01, | |
218 | BPDU_FLAG_PROPOSAL = 0x02, | |
219 | BPDU_FLAG_LEARNING = 0x10, | |
220 | BPDU_FLAG_FORWARDING = 0x20, | |
221 | BPDU_FLAG_AGREEMENT = 0x40, | |
222 | BPDU_FLAG_TOPCHANGEACK = 0x80 | |
4b30ba05 | 223 | }; |
9efd308e DV |
224 | |
225 | /* Rapid Spanning Tree BPDU [9.3.3] */ | |
226 | OVS_PACKED( | |
227 | struct rstp_bpdu { | |
228 | ovs_be16 protocol_identifier; | |
d04e914b DV |
229 | uint8_t protocol_version_identifier; |
230 | uint8_t bpdu_type; | |
231 | uint8_t flags; | |
9efd308e DV |
232 | ovs_be64 root_bridge_id; |
233 | ovs_be32 root_path_cost; | |
234 | ovs_be64 designated_bridge_id; | |
235 | ovs_be16 designated_port_id; | |
d04e914b DV |
236 | ovs_be16 message_age; |
237 | ovs_be16 max_age; | |
238 | ovs_be16 hello_time; | |
239 | ovs_be16 forward_delay; | |
240 | uint8_t version1_length; | |
241 | uint8_t padding[7]; | |
9efd308e DV |
242 | }); |
243 | ||
9efd308e DV |
244 | enum rstp_info_is { |
245 | INFO_IS_DISABLED, | |
246 | INFO_IS_RECEIVED, | |
247 | INFO_IS_AGED, | |
248 | INFO_IS_MINE | |
249 | }; | |
250 | ||
251 | enum rstp_rcvd_info { | |
252 | SUPERIOR_DESIGNATED_INFO, | |
253 | REPEATED_DESIGNATED_INFO, | |
254 | INFERIOR_DESIGNATED_INFO, | |
255 | INFERIOR_ROOT_ALTERNATE_INFO, | |
256 | OTHER_INFO | |
257 | }; | |
258 | ||
259 | struct rstp_port { | |
f025bcb7 JR |
260 | struct ovs_refcount ref_cnt; |
261 | ||
262 | struct rstp *rstp OVS_GUARDED_BY(rstp_mutex); | |
d5f31dc8 | 263 | struct hmap_node node OVS_GUARDED_BY(rstp_mutex); /* In rstp->ports. */ |
f025bcb7 JR |
264 | void *aux OVS_GUARDED_BY(rstp_mutex); |
265 | struct rstp_bpdu received_bpdu_buffer OVS_GUARDED_BY(rstp_mutex); | |
9efd308e DV |
266 | /************************************************************************* |
267 | * MAC status parameters | |
268 | ************************************************************************/ | |
269 | /* [6.4.2 - MAC_Operational] | |
270 | * The value of this parameter is TRUE if [...] the MAC entity can be used | |
271 | * to transmit and/or receive frames, and its use is permitted by | |
272 | * management. | |
273 | */ | |
f025bcb7 | 274 | bool mac_operational OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
275 | |
276 | /* [14.8.2.2] Administrative Bridge Port State */ | |
f025bcb7 | 277 | bool is_administrative_bridge_port OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
278 | |
279 | /* [6.4.3 - operPointToPointMAC] | |
280 | * a) True. The MAC is connected to a point-to-point LAN; i.e., there is | |
281 | * at most one other system attached to the LAN. | |
282 | * b) False. The MAC is connected to a non-point-to-point LAN; i.e., | |
283 | * there can be more than one other system attached to the LAN. | |
284 | * | |
285 | * If adminPointToPointMAC is set to ForceTrue, then operPointToPointMAC | |
286 | * shall be set True. If adminPointToPointMAC is set to ForceFalse, then | |
287 | * operPointToPointMAC shall be set False. | |
288 | */ | |
f025bcb7 | 289 | bool oper_point_to_point_mac OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
290 | |
291 | /* [6.4.3 - adminPointToPointMAC] | |
292 | * a) ForceTrue. The administrator requires the MAC to be treated as if it | |
293 | * is connected to a point-to-point LAN, regardless of any indications | |
294 | * to the contrary that are generated by the MAC entity. | |
295 | * b) ForceFalse. The administrator requires the MAC to be treated as | |
296 | * connected to a non-point-to-point LAN, regardless of any indications | |
297 | * to the contrary that are generated by the MAC entity. | |
298 | * c) Auto. The administrator requires the point-to-point status of the | |
299 | * MAC to be determined in accordance with the specific MAC procedures | |
300 | * defined in 6.5. | |
301 | */ | |
f025bcb7 | 302 | enum rstp_admin_point_to_point_mac_state admin_point_to_point_mac OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
303 | |
304 | ||
305 | /************************************************************************* | |
306 | * [17.3 - RSTP performance parameters] Set by management actions on the | |
307 | * bridge | |
308 | *************************************************************************/ | |
309 | ||
310 | /* [17.13.1 - Admin Edge Port] | |
311 | * The AdminEdgePort parameter for the Port (14.8.2). | |
312 | */ | |
f025bcb7 | 313 | bool admin_edge OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
314 | |
315 | /* [17.13.3 - AutoEdge] | |
316 | * The AutoEdgePort parameter for the Port (14.8.2). | |
317 | */ | |
f025bcb7 | 318 | bool auto_edge OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
319 | |
320 | ||
321 | /************************************************************************* | |
322 | * The following variables are set by management actions on the bridge | |
323 | ************************************************************************/ | |
324 | ||
325 | /* Port number and priority | |
326 | * >=1 (max 12 bits [9.2.7]) | |
327 | */ | |
f025bcb7 | 328 | uint16_t port_number OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
329 | |
330 | /* Port priority | |
331 | * Range: 0-240 in steps of 16 (table 17-2) | |
332 | */ | |
f025bcb7 | 333 | uint8_t priority OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
334 | |
335 | /* [17.13.11 - PortPathCost] | |
336 | * The Port's contribution, when it is the Root Port, to the Root Path Cost | |
337 | * (17.3.1, 17.5, 17.6) for the Bridge. | |
338 | */ | |
f025bcb7 | 339 | uint32_t port_path_cost OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
340 | |
341 | /************************************************************************* | |
342 | * The following variables are defined in [17.17 - State machine timers] | |
343 | ************************************************************************/ | |
344 | /* [17.17.1 - edgeDelayWhile] | |
345 | * The Edge Delay timer. The time remaining, in the absence of a received | |
346 | * BPDU, before this port is identified as an operEdgePort. | |
347 | */ | |
f025bcb7 | 348 | uint16_t edge_delay_while OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
349 | |
350 | /* [17.17.2 - fdWhile] | |
351 | * The Forward Delay timer. Used to delay Port State transitions until | |
352 | * other Bridges have received spanning tree information. | |
353 | */ | |
f025bcb7 | 354 | uint16_t fd_while OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
355 | |
356 | /* [17.17.3 - helloWhen] | |
357 | * The Hello timer. Used to ensure that at least one BPDU is transmitted by | |
358 | * a Designated Port in each HelloTime period. | |
359 | */ | |
f025bcb7 | 360 | uint16_t hello_when OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
361 | |
362 | /* [17.17.4 - mdelayWhile] | |
363 | * The Migration Delay timer. Used by the Port Protocol Migration state | |
364 | * machine to allow time for another RSTP Bridge on the same LAN to | |
365 | * synchronize its migration state with this Port before the receipt of a | |
366 | * BPDU can cause this Port to change the BPDU types it transmits. | |
367 | * Initialized to MigrateTime (17.13.9). | |
368 | */ | |
f025bcb7 | 369 | uint16_t mdelay_while OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
370 | |
371 | /* [17.17.5 - rbWhile] | |
372 | * The Recent Backup timer. Maintained at its initial value, twice | |
373 | * HelloTime, while the Port is a Backup Port. | |
374 | */ | |
f025bcb7 | 375 | uint16_t rb_while OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
376 | |
377 | /* [17.17.6 - rcvdInfoWhile] | |
378 | * The Received Info timer. The time remaining before the spanning tree | |
379 | * information received by this Port [portPriority (17.19.21) and portTimes | |
380 | * (17.19.22)] is aged out if not refreshed by the receipt of a further | |
381 | * Configuration Message. | |
382 | */ | |
f025bcb7 | 383 | uint16_t rcvd_info_while OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
384 | |
385 | /* [17.17.7 - rrWhile] | |
386 | * The Recent Root timer. | |
387 | */ | |
f025bcb7 | 388 | uint16_t rr_while OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
389 | |
390 | /* [17.17.8 - tcWhile] | |
391 | * The Topology Change timer. TCN Messages are sent while this timer is | |
392 | * running. | |
393 | */ | |
f025bcb7 | 394 | uint16_t tc_while OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
395 | |
396 | ||
397 | /************************************************************************* | |
398 | * The following variables are defined in [17.19 - Per-Port variables] | |
399 | ************************************************************************/ | |
400 | ||
401 | /* [17.19.1 - ageingTime] | |
402 | * Filtering database entries for this Port are aged out after ageingTime | |
403 | * has elapsed since they were first created or refreshed by the Learning | |
404 | * Process. | |
405 | * The value of this parameter is normally Ageing Time (7.9.2, Table 7-5), | |
406 | * and is changed to FwdDelay (17.20.6) for a period of FwdDelay after | |
407 | * fdbFlush (17.19.7) is set by the topology change state machine if | |
408 | * stpVersion (17.19.7) is TRUE. | |
409 | */ | |
f025bcb7 | 410 | uint32_t ageing_time OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
411 | |
412 | /* [17.19.2 - agree] | |
413 | * Set if synced is set for all other Ports. An RST BPDU with the Agreement | |
414 | * flag set is transmitted and proposed is reset when agree is first set, | |
415 | * and when proposed is set. | |
416 | * Initialized by Port Information state machine. | |
417 | */ | |
f025bcb7 | 418 | bool agree OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
419 | |
420 | /* [17.19.3 - agreed] | |
421 | * Set when an RST BPDU is received with a Port Role of Root, Alternate, or | |
422 | * Backup Port, the Agreement flag set, and a message priority the same or | |
423 | * worse than the port priority. When agreed is set, the Designated Port | |
424 | * knows that its neighbouring Bridge has confirmed that it can proceed to | |
425 | * the Forwarding state without further delay. | |
426 | * Initialized by Port Information state machine. | |
427 | */ | |
f025bcb7 | 428 | bool agreed OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
429 | |
430 | /* [17.19.4 - designatedPriority] | |
431 | * The first four components of the Port's designated priority vector | |
432 | * value, as defined in 17.6. The fifth component of the designated | |
433 | * priority vector value is portId (17.19.19). | |
434 | * (Fifth component of the structure must not be used) | |
435 | */ | |
f025bcb7 | 436 | struct rstp_priority_vector designated_priority_vector OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
437 | |
438 | /* [17.19.5 - designatedTimes] | |
439 | * The designatedTimes variable comprises the set of timer parameter values | |
440 | * (Message Age, Max Age, Forward Delay, and Hello Time) that used to | |
441 | * update Port Times when updtInfo is set. Updated by the updtRolesTree() | |
442 | * procedure (17.21.25). | |
443 | */ | |
f025bcb7 | 444 | struct rstp_times designated_times OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
445 | |
446 | /* [17.19.6 - disputed] */ | |
f025bcb7 | 447 | bool disputed OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
448 | |
449 | /* [17.19.7 - fdbFlush] | |
450 | * A boolean. Set by the topology change state machine to instruct the | |
451 | * filtering database to remove all entries for this Port, immediately if | |
452 | * rstpVersion (17.20.11) is TRUE, or by rapid ageing (17.19.1) if | |
453 | * stpVersion (17.20.12) is TRUE. Reset by the filtering database once the | |
454 | * entries are | |
455 | * removed if rstpVersion is TRUE, and immediately if stpVersion is TRUE. | |
456 | */ | |
f025bcb7 | 457 | uint8_t fdb_flush OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
458 | |
459 | /* [17.19.8 - forward] | |
460 | * Initialized by Port State Transition state machine. | |
461 | */ | |
f025bcb7 | 462 | bool forward OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
463 | |
464 | /* [17.19.9 - forwarding] | |
465 | * Initialized by Port State Transition state machine. | |
466 | */ | |
f025bcb7 | 467 | bool forwarding OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
468 | |
469 | /* [17.19.10 - infoIs] | |
470 | * A variable that takes the values Mine, Aged, Received, or Disabled, to | |
471 | * indicate the origin/state of the Port's Spanning Tree information | |
472 | * (portInfo) held for the Port, as follows: | |
473 | * a) If infoIs is Received, the port has received current (not aged out) | |
474 | * information from the Designated Bridge for the attached LAN (a | |
475 | * point-to-point bridge link being a special case of a LAN). | |
476 | * b) If infoIs is Mine, information for the port has been derived from | |
477 | * the Root Port for the Bridge (with the addition of root port cost | |
478 | * information). This includes the possibility that the Root Port is | |
479 | * "Port 0," i.e., the bridge is the Root Bridge for the Bridged Local | |
480 | * Area Network. | |
481 | * c) If infoIs is Aged, information from the Root Bridge has been aged | |
482 | * out. Just as for "reselect" (see 17.19.34), the state machine does | |
483 | * not formally allow the "Aged" state to persist. However, if there is | |
484 | * a delay in recomputing the new root port, correct processing of a | |
485 | * received BPDU is specified. | |
486 | * d) Finally if the port is disabled, infoIs is Disabled. | |
487 | */ | |
f025bcb7 | 488 | enum rstp_info_is info_is OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
489 | |
490 | /* [17.19.11 - learn] | |
491 | * Initialized by Port State Transition state machine. | |
492 | */ | |
f025bcb7 | 493 | bool learn OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
494 | |
495 | /* [17.19.12 - learning] | |
496 | * Initialized by Port State Transition state machine. | |
497 | */ | |
f025bcb7 | 498 | bool learning OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
499 | |
500 | /* [17.19.13 - mcheck] | |
501 | * A boolean. May be set by management to force the Port Protocol Migration | |
502 | * state machine to transmit RST BPDUs for a MigrateTime (17.13.9) period, | |
503 | * to test whether all STP Bridges (17.4) on the attached LAN have been | |
504 | * removed and the Port can continue to transmit RSTP BPDUs. Setting mcheck | |
505 | * has no effect if stpVersion (17.20.12) is TRUE, i.e., the Bridge is | |
506 | * operating in STP Compatibility mode. | |
507 | */ | |
f025bcb7 | 508 | bool mcheck OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
509 | |
510 | /* [17.19.14 - msgPriority] | |
511 | * The first four components of the message priority vector conveyed in a | |
512 | * received BPDU, as defined in 17.6. | |
513 | * (Fifth component of the structure must not be used). | |
514 | */ | |
f025bcb7 | 515 | struct rstp_priority_vector msg_priority OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
516 | |
517 | /* [17.19.15 - msgTimes] | |
518 | * The msgTimes variable comprises the timer parameter values (Message Age, | |
519 | * Max Age, Forward Delay, and Hello Time) conveyed in a received BPDU. | |
520 | */ | |
f025bcb7 | 521 | struct rstp_times msg_times OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
522 | |
523 | /* [17.19.16 - newInfo] | |
524 | * A boolean. Set if a BPDU is to be transmitted. Reset by the Port | |
525 | * Transmit state machine. | |
526 | */ | |
f025bcb7 | 527 | bool new_info OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
528 | |
529 | /* [17.19.17 - operEdge] | |
530 | * A boolean. The value of the operEdgePort parameter, as determined by the | |
531 | * operation of the Bridge Detection state machine (17.25). | |
532 | */ | |
f025bcb7 | 533 | bool oper_edge OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
534 | |
535 | /* [17.19.18 - portEnabled] | |
536 | * A boolean. Set if the Bridge's MAC Relay Entity and Spanning Tree | |
537 | * Protocol Entity can use the MAC Service provided by the Port's MAC | |
538 | * entity to transmit and receive frames to and from the attached LAN, | |
539 | * i.e., portEnabled is TRUE if and only if: | |
540 | * a) MAC_Operational (6.4.2) is TRUE; and | |
541 | * b) Administrative Bridge Port State (14.8.2.2) for the Port is | |
542 | * Enabled; and | |
543 | * c) AuthControlledPortStatus is Authorized [if the port is a network | |
544 | * access port (IEEE Std 802.1X)]. | |
545 | */ | |
f025bcb7 | 546 | bool port_enabled OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
547 | |
548 | /* [17.19.19 - portId] | |
549 | * The Port Identifier. This variable forms the fifth component of the port | |
550 | * priority and designated priority vectors defined in 17.6. | |
551 | */ | |
f025bcb7 | 552 | uint16_t port_id OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
553 | |
554 | /* [17.19.21 - portPriority] | |
555 | * The first four components of the Port's port priority vector value, as | |
556 | * defined in 17.6. | |
557 | * (Fifth component of the structure must not be used) | |
558 | */ | |
f025bcb7 | 559 | struct rstp_priority_vector port_priority OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
560 | |
561 | /* [17.19.22 - portTimes] | |
562 | * The portTimes variable comprises the Port's timer parameter values | |
563 | * (Message Age, Max Age, Forward Delay, and Hello Time). These timer | |
564 | * values are used in BPDUs transmitted from the Port. | |
565 | */ | |
f025bcb7 | 566 | struct rstp_times port_times OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
567 | |
568 | /* [17.19.23 - proposed] | |
569 | * Set when an RST BPDU with a Designated Port role and the Proposal flag | |
570 | * set is received. If agree is not set, proposed causes sync to be set for | |
571 | * all other Ports.of the Bridge. | |
572 | */ | |
f025bcb7 | 573 | bool proposed OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
574 | |
575 | /* [17.19.24 - proposing] | |
576 | * Set by a Designated Port that is not Forwarding, and conveyed to the | |
577 | * Root Port or Alternate Port of a neighboring Bridge in the Proposal flag | |
578 | * of an RST BPDU (9.3.3). | |
579 | */ | |
f025bcb7 | 580 | bool proposing OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
581 | |
582 | /* [17.19.25 - rcvdBPDU] | |
583 | * A boolean. Set by system dependent processes, this variable notifies the | |
584 | * Port Receive state machine (17.23) when a valid (9.3.4) Configuration, | |
585 | * TCN, or RST BPDU (9.3.1, 9.3.2, 9.3.3) is received on the Port. Reset | |
586 | * by the Port Receive state machine. | |
587 | */ | |
f025bcb7 | 588 | bool rcvd_bpdu OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
589 | |
590 | /* [17.19.26 - rcvdInfo] | |
591 | * Set to the result of the rcvInfo() procedure (17.21.8). | |
592 | */ | |
f025bcb7 | 593 | enum rstp_rcvd_info rcvd_info OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
594 | |
595 | /* [17.19.27 - rcvdMsg] */ | |
f025bcb7 | 596 | bool rcvd_msg OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
597 | |
598 | /* [17.19.28 - rcvdRSTP] */ | |
f025bcb7 | 599 | bool rcvd_rstp OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
600 | |
601 | /* [17.19.29 - rcvdSTP] */ | |
f025bcb7 | 602 | bool rcvd_stp OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
603 | |
604 | /* [17.19.30 - rcvdTc] */ | |
f025bcb7 | 605 | bool rcvd_tc OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
606 | |
607 | /* [17.19.31 - rcvdTcAck] */ | |
f025bcb7 | 608 | bool rcvd_tc_ack OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
609 | |
610 | /* [17.19.32 - rcvdTcn] */ | |
f025bcb7 | 611 | bool rcvd_tcn OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
612 | |
613 | /* [17.19.33 - reRoot] */ | |
f025bcb7 | 614 | bool re_root OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
615 | |
616 | /* [17.19.34 - reselect] */ | |
f025bcb7 | 617 | bool reselect OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
618 | |
619 | /* [17.19.35 - role] | |
620 | * The assigned Port Role (17.7). | |
621 | */ | |
f025bcb7 | 622 | enum rstp_port_role role OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
623 | |
624 | /* [17.19.36 - selected] | |
625 | * A boolean. See 17.28, 17.21.16. | |
626 | */ | |
f025bcb7 | 627 | bool selected OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
628 | |
629 | /* [17.19.37 - selectedRole] | |
630 | * The newly computed role for the Port (17.7, 17.28, 17.21.25, 17.19.35). | |
631 | */ | |
f025bcb7 | 632 | enum rstp_port_role selected_role OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
633 | |
634 | /* [17.19.38 - sendRSTP] | |
635 | * A boolean. See 17.24, 17.26. | |
636 | */ | |
f025bcb7 | 637 | bool send_rstp OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
638 | |
639 | /* [17.19.39 - sync] | |
640 | * A boolean. See 17.10. | |
641 | */ | |
f025bcb7 | 642 | bool sync OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
643 | |
644 | /* [17.19.40 - synced] | |
645 | * A boolean. See 17.10. | |
646 | */ | |
f025bcb7 | 647 | bool synced OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
648 | |
649 | /* [17.19.41 - tcAck] | |
650 | * A boolean. Set if a Configuration Message with a topology change | |
651 | * acknowledge flag set is to be transmitted. | |
652 | */ | |
f025bcb7 | 653 | bool tc_ack OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
654 | |
655 | /* [17.19.42 - tcProp] | |
656 | * A boolean. Set by the Topology Change state machine of any other Port, | |
657 | * to indicate that a topology change should be propagated through this | |
658 | * Port. | |
659 | */ | |
f025bcb7 | 660 | bool tc_prop OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
661 | |
662 | /* [17.19.43 - tick] | |
663 | * A boolean. See 17.22. | |
664 | */ | |
f025bcb7 | 665 | bool tick OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
666 | |
667 | /* [17.19.44 - txCount] | |
668 | * A counter. Incremented by the Port Transmission (17.26) state machine on | |
669 | * every BPDU transmission, and decremented used by the Port Timers state | |
670 | * machine (17.22) once a second. Transmissions are delayed if txCount | |
671 | * reaches TxHoldCount (17.13.12). | |
672 | */ | |
f025bcb7 | 673 | uint16_t tx_count OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
674 | |
675 | /* [17.19.45 - updtInfo] | |
676 | * A boolean. Set by the Port Role Selection state machine (17.28, | |
677 | * 17.21.25) to tell the Port Information state machine that it should copy | |
678 | * designatedPriority to portPriority and designatedTimes to portTimes. | |
679 | */ | |
f025bcb7 | 680 | bool updt_info OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
681 | |
682 | /* Counter for RSTP received frames - for rstpd */ | |
683 | uint32_t rx_rstp_bpdu_cnt; | |
684 | ||
685 | /* Counter for bad RSTP received frames */ | |
f025bcb7 | 686 | uint32_t error_count OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
687 | |
688 | /* [14.8.2.1.3] Outputs | |
689 | * a) Uptime count in seconds of the time elapsed since the Port was last | |
690 | * reset or initialized. | |
691 | */ | |
f025bcb7 | 692 | uint32_t uptime OVS_GUARDED_BY(rstp_mutex); |
9efd308e | 693 | |
f025bcb7 JR |
694 | enum rstp_state rstp_state OVS_GUARDED_BY(rstp_mutex); |
695 | bool state_changed OVS_GUARDED_BY(rstp_mutex); | |
9efd308e DV |
696 | |
697 | /* Per-port state machines state */ | |
f025bcb7 JR |
698 | enum port_receive_state_machine port_receive_sm_state OVS_GUARDED_BY(rstp_mutex); |
699 | enum port_protocol_migration_state_machine port_protocol_migration_sm_state OVS_GUARDED_BY(rstp_mutex); | |
700 | enum bridge_detection_state_machine bridge_detection_sm_state OVS_GUARDED_BY(rstp_mutex); | |
701 | enum port_transmit_state_machine port_transmit_sm_state OVS_GUARDED_BY(rstp_mutex); | |
702 | enum port_information_state_machine port_information_sm_state OVS_GUARDED_BY(rstp_mutex); | |
703 | enum port_role_transition_state_machine port_role_transition_sm_state OVS_GUARDED_BY(rstp_mutex); | |
704 | enum port_state_transition_state_machine port_state_transition_sm_state OVS_GUARDED_BY(rstp_mutex); | |
705 | enum topology_change_state_machine topology_change_sm_state OVS_GUARDED_BY(rstp_mutex); | |
9efd308e DV |
706 | }; |
707 | ||
708 | struct rstp { | |
ca6ba700 | 709 | struct ovs_list node OVS_GUARDED_BY(rstp_mutex); /* In rstp instances list */ |
9efd308e DV |
710 | char *name; /* Bridge name. */ |
711 | ||
712 | /* Changes in last SM execution. */ | |
f025bcb7 | 713 | bool changes OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
714 | |
715 | /* Per-bridge state machines state */ | |
f025bcb7 | 716 | enum port_role_selection_state_machine port_role_selection_sm_state OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
717 | |
718 | /* Bridge MAC address | |
719 | * (stored in the least significant 48 bits of rstp_identifier). | |
720 | */ | |
f025bcb7 | 721 | rstp_identifier address OVS_GUARDED_BY(rstp_mutex); /* [7.12.5] */ |
9efd308e DV |
722 | |
723 | /* Bridge priority */ | |
f025bcb7 | 724 | uint16_t priority OVS_GUARDED_BY(rstp_mutex); /* Valid values: 0-61440 in steps of 4096 */ |
9efd308e DV |
725 | |
726 | /************************************************************************* | |
727 | * [17.3 - RSTP performance parameters] | |
728 | ************************************************************************/ | |
729 | ||
730 | /* [17.13] | |
731 | * The Spanning Tree Protocol Entity shall be reinitialized, as specified | |
732 | * by the assertion of BEGIN (17.18.1) in the state machine specification, | |
733 | * if the following parameters are modified: | |
734 | * a) Force Protocol Version (17.13.4) | |
735 | * | |
736 | * The spanning tree priority vectors and Port Role assignments for a | |
737 | * Bridge shall be recomputed, as specified by the operation of the Port | |
738 | * Role Selection state machine (17.28) by clearing selected (17.19.36) and | |
739 | * setting reselect (17.19.34) for any Port or Ports for which the | |
740 | * following parameters are modified: | |
741 | * b) Bridge Identifier Priority (17.13.7) | |
742 | * c) Port Identifier Priority (17.13.10) | |
743 | * d) Port Path Cost (17.13.11) | |
744 | * | |
745 | * If the Transmit Hold Count is modified the value of txCount (17.19.44) | |
746 | * for all Ports shall be set to zero. | |
747 | * | |
748 | * The RSTP specification permits changes in other performance parameters | |
749 | * without exceptional actions. | |
750 | */ | |
751 | ||
752 | ||
753 | /* [17.13.2 - Ageing Time] | |
754 | * The Ageing Time parameter for the Bridge (7.9.2, Table 7-5). | |
755 | */ | |
f025bcb7 | 756 | uint32_t ageing_time OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
757 | |
758 | /* [17.13.4 - Force Protocol Version] | |
759 | * The Force Protocol Version parameter for the Bridge (17.4, 14.8.1). | |
760 | * This can take the value 0 (STP Compatibility mode) or 2 (the default, | |
761 | * normal operation). | |
762 | */ | |
f025bcb7 | 763 | enum rstp_force_protocol_version force_protocol_version OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
764 | |
765 | /* [17.13.5 - Bridge Forward Delay] | |
766 | * The delay used by STP Bridges (17.4) to transition Root and Designated | |
767 | * Ports to Forwarding (Table 17-1). | |
768 | */ | |
f025bcb7 | 769 | uint16_t bridge_forward_delay OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
770 | |
771 | /* [17.13.6 - Bridge Hello Time] | |
772 | * The interval between periodic transmissions of Configuration Messages | |
773 | * by Designated Ports (Table 17-1). | |
774 | */ | |
f025bcb7 | 775 | uint16_t bridge_hello_time OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
776 | |
777 | /* [17.13.8 - Bridge Max Age] | |
778 | * The maximum age of the information transmitted by the Bridge when it is | |
779 | * the Root Bridge (Table 17-1). | |
780 | */ | |
f025bcb7 | 781 | uint16_t bridge_max_age OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
782 | |
783 | /* [17.13.9 - Migrate Time] | |
784 | * The initial value of the mdelayWhile and edgeDelayWhile timers (17.17.4, | |
785 | * 17.17.1), fixed for all RSTP implementations conforming to this | |
786 | * specification (Table 17-1). | |
787 | */ | |
f025bcb7 | 788 | uint16_t migrate_time OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
789 | |
790 | /* [17.13.12 - Transmit Hold Count] | |
791 | * The Transmit Hold Count (Table 17-1) used by the Port Transmit state | |
792 | * machine to limit transmission rate. | |
793 | */ | |
f025bcb7 | 794 | uint16_t transmit_hold_count OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
795 | |
796 | ||
797 | /************************************************************************* | |
798 | * The following variables are defined in [17.18 - Per-Bridge variables] | |
799 | ************************************************************************/ | |
800 | ||
801 | /* [17.18.1 - BEGIN] | |
802 | * A Boolean controlled by the system initialization (17.16). If TRUE | |
803 | * causes all state machines, including per Port state machines, to | |
804 | * continuously execute their initial state. | |
805 | */ | |
f025bcb7 | 806 | bool begin OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
807 | |
808 | /* [17.18.2 BridgeIdentifier] | |
809 | * The unique Bridge Identifier assigned to this Bridge, comprising two | |
810 | * components: the Bridge Identifier Priority, which may be modified by | |
811 | * management (see 9.2.5 and 14.8.1.2) and is the more significant when | |
812 | * Bridge Identifiers are compared, and a component derived from the Bridge | |
813 | * Address (7.12.5), which guarantees uniqueness of the Bridge Identifiers | |
814 | * of different Bridges. | |
815 | */ | |
f025bcb7 | 816 | rstp_identifier bridge_identifier OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
817 | |
818 | /* [17.8.3 BridgePriority] | |
819 | * The bridge priority vector, as defined in 17.6. The first (RootBridgeID) | |
820 | * and third (DesignatedBridgeID) components are both equal to the value | |
821 | * of the Bridge Identifier (17.18.2). The other components are zero. | |
822 | */ | |
f025bcb7 | 823 | struct rstp_priority_vector bridge_priority OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
824 | |
825 | /* [17.18.4 - BridgeTimes] | |
826 | * BridgeTimes comprises four components: the current values of Bridge | |
827 | * Forward Delay, Bridge Hello Time, Bridge Max Age (17.13, Table 17-1), | |
828 | * and a Message Age of zero. | |
829 | */ | |
f025bcb7 | 830 | struct rstp_times bridge_times OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
831 | |
832 | /* [17.18.6 - rootPriority] | |
833 | * The first four components of the Bridge's root priority vector, as | |
834 | * defined in 17.6. | |
835 | */ | |
f025bcb7 | 836 | struct rstp_priority_vector root_priority OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
837 | |
838 | /* [17.18.5 - rootPortId] | |
839 | * The Port Identifier of the Root Port. This is the fifth component of | |
840 | * the root priority vector, as defined in 17.6. | |
841 | */ | |
f025bcb7 | 842 | uint16_t root_port_id OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
843 | |
844 | /* [17.18.7 - rootTimes] | |
845 | * The rootTimes variable comprises the Bridge's operational timer | |
846 | * parameter values (Message Age, Max Age, Forward Delay, and Hello Time), | |
847 | * derived from the values stored in portTimes (17.19.22) for the Root Port | |
848 | * or from BridgeTimes (17.18.4). | |
849 | */ | |
f025bcb7 | 850 | struct rstp_times root_times OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
851 | |
852 | /* 17.20 State machine conditions and parameters */ | |
853 | ||
854 | /* [17.20.11] rstpVersion | |
855 | * TRUE if Force Protocol Version (17.13.4) is greater than or equal to 2. | |
856 | */ | |
f025bcb7 | 857 | bool rstp_version OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
858 | |
859 | /* [17.20.12] stpVersion | |
860 | * TRUE if Force Protocol Version (17.13.4) is less than 2. | |
861 | */ | |
f025bcb7 | 862 | bool stp_version OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
863 | |
864 | /* Ports */ | |
d5f31dc8 | 865 | struct hmap ports OVS_GUARDED_BY(rstp_mutex); |
9efd308e DV |
866 | |
867 | struct ovs_refcount ref_cnt; | |
868 | ||
869 | /* Interface to client. */ | |
cf62fa4c | 870 | void (*send_bpdu)(struct dp_packet *bpdu, void *port_aux, void *rstp_aux); |
9efd308e | 871 | void *aux; |
2372c146 JR |
872 | |
873 | bool root_changed; | |
874 | void *old_root_aux; | |
875 | void *new_root_aux; | |
9efd308e DV |
876 | }; |
877 | ||
878 | #endif /* rstp-common.h */ |