Skip to content

Commit

Permalink
lib/rstp: Better debug messages, style fixes.
Browse files Browse the repository at this point in the history
Remove unused struct rstp_priority_vector4 definition, fix coding
style, fix sparse warnings.

Signed-off-by: Jarno Rajahalme <[email protected]>
Acked-by: Daniele Venturino <[email protected]>
  • Loading branch information
Jarno Rajahalme committed Sep 9, 2014
1 parent fb20b0b commit 4b30ba0
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 96 deletions.
11 changes: 2 additions & 9 deletions lib/rstp-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,11 @@ struct rstp_priority_vector {
uint16_t bridge_port_id;
};

struct rstp_priority_vector4 {
rstp_identifier root_bridge_id;
uint32_t root_path_cost;
rstp_identifier designated_bridge_id;
uint16_t designated_port_id;
};

enum rstp_bpdu_type {
CONFIGURATION_BPDU = 0x0,
TOPOLOGY_CHANGE_NOTIFICATION_BPDU = 0x80,
RAPID_SPANNING_TREE_BPDU = 0x2
} bpdu_type_t;
};

enum rstp_bpdu_flag {
BPDU_FLAG_TOPCHANGE = 0x01,
Expand All @@ -225,7 +218,7 @@ enum rstp_bpdu_flag {
BPDU_FLAG_FORWARDING = 0x20,
BPDU_FLAG_AGREEMENT = 0x40,
BPDU_FLAG_TOPCHANGEACK = 0x80
} bpdu_flag;
};

/* Rapid Spanning Tree BPDU [9.3.3] */
OVS_PACKED(
Expand Down
29 changes: 15 additions & 14 deletions lib/rstp-state-machines.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ process_received_bpdu(struct rstp_port *p, const void *bpdu, size_t bpdu_size)
rstp->changes = true;
move_rstp(rstp);
} else {
VLOG_DBG("Bad BPDU received");
VLOG_DBG("%s, port %u: Bad BPDU received", p->rstp->name,
p->port_number);
p->error_count++;
}
}
Expand Down Expand Up @@ -296,7 +297,7 @@ updt_roles_tree(struct rstp *r)
}
r->root_priority = best_vector;
r->root_port_id = best_vector.bridge_port_id;
VLOG_DBG("%s: new Root is "RSTP_ID_FMT"", r->name,
VLOG_DBG("%s: new Root is "RSTP_ID_FMT, r->name,
RSTP_ID_ARGS(r->root_priority.root_bridge_id));
/* Letters d) e) */
if (r->ports_count > 0) {
Expand Down Expand Up @@ -423,8 +424,8 @@ port_role_selection_sm(struct rstp *r)
}
if (old_state != r->port_role_selection_sm_state) {
r->changes = true;
VLOG_DBG("Port_role_selection_sm %d -> %d", old_state,
r->port_role_selection_sm_state);
VLOG_DBG("%s: Port_role_selection_sm %d -> %d", r->name,
old_state, r->port_role_selection_sm_state);
}
return 0;
}
Expand Down Expand Up @@ -823,10 +824,9 @@ tx_rstp(struct rstp_port *p)
bpdu.flags = PORT_ALT_BACK << ROLE_FLAG_SHIFT;
break;
case ROLE_DISABLED:
/* should not happen! */
/* Should not happen! */
VLOG_ERR("%s transmitting bpdu in disabled role on port "
""RSTP_PORT_ID_FMT"", p->rstp->name, p->port_id);
OVS_NOT_REACHED();
RSTP_PORT_ID_FMT, p->rstp->name, p->port_id);
break;
}
if (p->agree) {
Expand Down Expand Up @@ -899,6 +899,8 @@ port_transmit_sm(struct rstp_port *p)
/* no break */
case PORT_TRANSMIT_SM_IDLE:
if (p->role == ROLE_DISABLED) {
VLOG_DBG("%s, port %u: port_transmit_sm ROLE == DISABLED.",
p->rstp->name, p->port_number);
break;
}
else if (p->send_rstp && p->new_info &&
Expand Down Expand Up @@ -1085,9 +1087,8 @@ port_information_sm(struct rstp_port *p)
case PORT_INFORMATION_SM_DISABLED:
if (p->port_enabled) {
p->port_information_sm_state = PORT_INFORMATION_SM_AGED_EXEC;
}
else if (p->rcvd_msg) {
p->port_information_sm_state = PORT_INFORMATION_SM_DISABLED_EXEC;
} else if (p->rcvd_msg) {
p->port_information_sm_state = PORT_INFORMATION_SM_DISABLED_EXEC;
}
break;
case PORT_INFORMATION_SM_AGED_EXEC:
Expand Down Expand Up @@ -1225,8 +1226,8 @@ port_information_sm(struct rstp_port *p)
}
if (old_state != p->port_information_sm_state) {
r->changes = true;
VLOG_DBG("Port_information_sm %d -> %d", old_state,
p->port_information_sm_state);
VLOG_DBG("%s, port %u: Port_information_sm %d -> %d", p->rstp->name,
p->port_number, old_state, p->port_information_sm_state);
}
return 0;
}
Expand Down Expand Up @@ -1945,8 +1946,8 @@ topology_change_sm(struct rstp_port *p)
}
if (old_state != p->topology_change_sm_state) {
r->changes = true;
VLOG_DBG("Topology_change_sm %d -> %d",old_state,
p->topology_change_sm_state);
VLOG_DBG("%s, port %u: Topology_change_sm %d -> %d", p->rstp->name,
p->port_number, old_state, p->topology_change_sm_state);
}
return 0;
}
Expand Down
Loading

0 comments on commit 4b30ba0

Please sign in to comment.