OVS_REQUIRES(rstp_mutex);
static void reinitialize_port__(struct rstp_port *p)
OVS_REQUIRES(rstp_mutex);
+static bool rstp_is_root_bridge__(const struct rstp *rstp)
+ OVS_REQUIRES(rstp_mutex);
+static uint32_t rstp_get_root_path_cost__(const struct rstp *rstp)
+ OVS_REQUIRES(rstp_mutex);
+static struct rstp_port *rstp_get_root_port__(const struct rstp *rstp)
+ OVS_REQUIRES(rstp_mutex);
+static rstp_identifier rstp_get_root_id__(const struct rstp *rstp)
+ OVS_REQUIRES(rstp_mutex);
+static void rstp_unixctl_tcn(struct unixctl_conn *, int argc,
+ const char *argv[], void *aux);
const char *
rstp_state_name(enum rstp_state state)
return number;
}
-static void rstp_unixctl_tcn(struct unixctl_conn *, int argc,
- const char *argv[], void *aux);
-
/* Decrements the State Machines' timers. */
void
rstp_tick_timers(struct rstp *rstp)
}
/* Gets the root path cost. */
+static uint32_t
+rstp_get_root_path_cost__(const struct rstp *rstp)
+ OVS_REQUIRES(rstp_mutex)
+{
+ return rstp->root_priority.root_path_cost;
+}
+
uint32_t
rstp_get_root_path_cost(const struct rstp *rstp)
OVS_EXCLUDED(rstp_mutex)
uint32_t cost;
ovs_mutex_lock(&rstp_mutex);
- cost = rstp->root_priority.root_path_cost;
+ cost = rstp_get_root_path_cost__(rstp);
ovs_mutex_unlock(&rstp_mutex);
return cost;
}
}
/* Returns the root bridge id. */
+static rstp_identifier
+rstp_get_root_id__(const struct rstp *rstp)
+ OVS_REQUIRES(rstp_mutex)
+{
+ return rstp->root_priority.root_bridge_id;
+}
+
rstp_identifier
rstp_get_root_id(const struct rstp *rstp)
OVS_EXCLUDED(rstp_mutex)
rstp_identifier root_id;
ovs_mutex_lock(&rstp_mutex);
- root_id = rstp->root_priority.root_bridge_id;
+ root_id = rstp_get_root_id__(rstp);
ovs_mutex_unlock(&rstp_mutex);
return root_id;
/* Returns true if the bridge believes to the be root of the spanning tree,
* false otherwise.
*/
+static bool
+rstp_is_root_bridge__(const struct rstp *rstp)
+ OVS_REQUIRES(rstp_mutex)
+{
+ return rstp->bridge_identifier ==
+ rstp->root_priority.designated_bridge_id;
+}
+
bool
rstp_is_root_bridge(const struct rstp *rstp)
OVS_EXCLUDED(rstp_mutex)
bool is_root;
ovs_mutex_lock(&rstp_mutex);
- is_root = rstp->bridge_identifier ==
- rstp->root_priority.designated_bridge_id;
+ is_root = rstp_is_root_bridge__(rstp);
ovs_mutex_unlock(&rstp_mutex);
return is_root;
/* Returns the port connecting 'rstp' to the root bridge, or a null pointer if
* there is no such port.
*/
-struct rstp_port *
-rstp_get_root_port(struct rstp *rstp)
- OVS_EXCLUDED(rstp_mutex)
+static struct rstp_port *
+rstp_get_root_port__(const struct rstp *rstp)
+ OVS_REQUIRES(rstp_mutex)
{
struct rstp_port *p;
- ovs_mutex_lock(&rstp_mutex);
HMAP_FOR_EACH (p, node, &rstp->ports) {
if (p->port_id == rstp->root_port_id) {
- ovs_mutex_unlock(&rstp_mutex);
return p;
}
}
- ovs_mutex_unlock(&rstp_mutex);
return NULL;
}
+struct rstp_port *
+rstp_get_root_port(const struct rstp *rstp)
+ OVS_EXCLUDED(rstp_mutex)
+{
+ ovs_mutex_lock(&rstp_mutex);
+ struct rstp_port *p = rstp_get_root_port__(rstp);
+ ovs_mutex_unlock(&rstp_mutex);
+ return p;
+}
+
/* Returns the state of port 'p'. */
enum rstp_state
rstp_port_get_state(const struct rstp_port *p)