+ enum stp_state state;
+
+ ovs_mutex_lock(&mutex);
+ state = p->state;
+ ovs_mutex_unlock(&mutex);
+ return state;
+}
+
+/* Returns the role of port 'p'. */
+enum stp_role
+stp_port_get_role(const struct stp_port *p)
+{
+ struct stp_port *root_port;
+ enum stp_role role;
+
+ ovs_mutex_lock(&mutex);
+ root_port = p->stp->root_port;
+ if (root_port && root_port->port_id == p->port_id) {
+ role = STP_ROLE_ROOT;
+ } else if (stp_is_designated_port(p)) {
+ role = STP_ROLE_DESIGNATED;
+ } else if (p->state == STP_DISABLED) {
+ role = STP_ROLE_DISABLED;
+ } else {
+ role = STP_ROLE_ALTERNATE;
+ }
+ ovs_mutex_unlock(&mutex);
+ return role;
+}
+
+/* Retrieves BPDU transmit and receive counts for 'p'. */
+void
+stp_port_get_counts(const struct stp_port *p,
+ int *tx_count, int *rx_count, int *error_count)
+{
+ ovs_mutex_lock(&mutex);
+ *tx_count = p->tx_count;
+ *rx_count = p->rx_count;
+ *error_count = p->error_count;
+ ovs_mutex_unlock(&mutex);