/*
- * Copyright (c) 2011-2014 M3S, Srl - Italy
+ * Copyright (c) 2011-2015 M3S, Srl - Italy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Authors:
* Martino Fornasa <mf@fornasa.it>
* Daniele Venturino <daniele.venturino@m3s.it>
+ * Carlo Andreotti <c.andreotti@m3s.it>
*
* References to IEEE 802.1D-2004 standard are enclosed in square brackets.
* E.g. [17.3], [Table 17-1], etc.
#define RSTP_MAX_PORTS 4095
-struct ofpbuf;
+struct dp_packet;
/* Bridge priority defaults [Table 17-2] */
#define RSTP_MIN_PRIORITY 0
ROLE_DISABLED
};
+enum rstp_admin_point_to_point_mac_state {
+ RSTP_ADMIN_P2P_MAC_FORCE_FALSE,
+ RSTP_ADMIN_P2P_MAC_FORCE_TRUE,
+ RSTP_ADMIN_P2P_MAC_AUTO
+};
+
struct rstp;
struct rstp_port;
struct ofproto_rstp_settings;
OVS_EXCLUDED(rstp_mutex);
struct rstp * rstp_create(const char *, rstp_identifier bridge_id,
- void (*send_bpdu)(struct ofpbuf *, void *port_aux,
+ void (*send_bpdu)(struct dp_packet *, void *port_aux,
void *rstp_aux),
void *aux)
OVS_EXCLUDED(rstp_mutex);
void rstp_port_received_bpdu(struct rstp_port *, const void *bpdu,
size_t bpdu_size)
OVS_EXCLUDED(rstp_mutex);
-bool rstp_check_and_reset_fdb_flush(struct rstp *)
+void *rstp_check_and_reset_fdb_flush(struct rstp *, struct rstp_port **)
OVS_EXCLUDED(rstp_mutex);
void *rstp_get_next_changed_port_aux(struct rstp *, struct rstp_port **)
OVS_EXCLUDED(rstp_mutex);
void rstp_port_set_mac_operational(struct rstp_port *,
bool new_mac_operational)
OVS_EXCLUDED(rstp_mutex);
+bool rstp_shift_root_learned_address(struct rstp *)
+ OVS_EXCLUDED(rstp_mutex);
+void *rstp_get_old_root_aux(struct rstp *)
+ OVS_EXCLUDED(rstp_mutex);
+void *rstp_get_new_root_aux(struct rstp *)
+ OVS_EXCLUDED(rstp_mutex);
+void rstp_reset_root_changed(struct rstp *)
+ OVS_EXCLUDED(rstp_mutex);
/* Bridge setters */
void rstp_set_bridge_address(struct rstp *, rstp_identifier bridge_address)
void rstp_port_set(struct rstp_port *, uint16_t port_num, int priority,
uint32_t path_cost, bool is_admin_edge, bool is_auto_edge,
- bool do_mcheck, void *aux)
+ enum rstp_admin_point_to_point_mac_state admin_p2p_mac_state,
+ bool admin_port_state, bool do_mcheck, void *aux)
OVS_EXCLUDED(rstp_mutex);
enum rstp_state rstp_port_get_state(const struct rstp_port *)
void rstp_port_get_status(const struct rstp_port *, uint16_t *id,
enum rstp_state *state, enum rstp_port_role *role,
- int *tx_count, int *rx_count, int *error_count,
- int *uptime)
+ rstp_identifier *designated_bridge_id,
+ uint16_t *designated_port_id,
+ uint32_t *designated_path_cost, int *tx_count,
+ int *rx_count, int *error_count, int *uptime)
OVS_EXCLUDED(rstp_mutex);
-void * rstp_get_port_aux(struct rstp *rstp, uint16_t port_number)
- OVS_EXCLUDED(rstp_mutex);
+void * rstp_get_port_aux__(struct rstp *rstp, uint16_t port_number)
+ OVS_REQUIRES(rstp_mutex);
\f
/* Internal API for rstp-state-machines.c */
/* Returns true if 'state' is one in which packets received on a port should
* be forwarded, false otherwise.
- *
- * Returns true if 'state' is RSTP_DISABLED, since presumably in that case the
- * port should still work, just not have RSTP applied to it.
*/
static inline bool
rstp_forward_in_state(enum rstp_state state)
{
- return (state == RSTP_DISABLED || state == RSTP_FORWARDING);
+ return (state == RSTP_FORWARDING);
}
/* Returns true if 'state' is one in which MAC learning should be done on
* packets received on a port, false otherwise.
- *
- * Returns true if 'state' is RSTP_DISABLED, since presumably in that case the
- * port should still work, just not have RSTP applied to it. */
+ */
static inline bool
rstp_learn_in_state(enum rstp_state state)
{
- return (state == RSTP_DISABLED || state == RSTP_LEARNING ||
- state == RSTP_FORWARDING);
+ return (state == RSTP_LEARNING || state == RSTP_FORWARDING);
}
#endif /* rstp.h */