aboutsummaryrefslogtreecommitdiff
path: root/vswitchd
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@nicira.com>2011-11-14 15:04:14 -0800
committerJustin Pettit <jpettit@nicira.com>2011-11-15 09:29:08 -0800
commit80740385d2700b1a03d28a02338d02509fd0b697 (patch)
tree4925837919dc7356f3484b3c80d70c658d38c095 /vswitchd
parent8ddc056dd1e2c150c3bf8bb16811815736beb554 (diff)
stp: Track BPDU tx and rx counts.
When debugging spanning tree, it's useful to have counters about how many BPDUs have been sent and received. This commit keeps track of these counters and stores them in a new "statistics" column of the Port table. Feature #8103
Diffstat (limited to 'vswitchd')
-rw-r--r--vswitchd/bridge.c35
-rw-r--r--vswitchd/vswitch.ovsschema7
-rw-r--r--vswitchd/vswitch.xml20
3 files changed, 51 insertions, 11 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 5100b787..6a25b959 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -240,6 +240,7 @@ bridge_init(const char *remote)
ovsdb_idl_omit(idl, &ovsrec_bridge_col_external_ids);
ovsdb_idl_omit_alert(idl, &ovsrec_port_col_status);
+ ovsdb_idl_omit_alert(idl, &ovsrec_port_col_statistics);
ovsdb_idl_omit(idl, &ovsrec_port_col_external_ids);
ovsdb_idl_omit(idl, &ovsrec_port_col_fake_bridge);
@@ -1598,7 +1599,9 @@ port_refresh_stp_status(struct port *port)
struct ofproto *ofproto = port->bridge->ofproto;
struct iface *iface;
struct ofproto_port_stp_status status;
- char *keys[4], *values[4];
+ char *keys[4];
+ char *str_values[4];
+ int64_t int_values[3];
size_t i;
if (port_is_synthetic(port)) {
@@ -1619,23 +1622,37 @@ port_refresh_stp_status(struct port *port)
if (!status.enabled) {
ovsrec_port_set_status(port->cfg, NULL, NULL, 0);
+ ovsrec_port_set_statistics(port->cfg, NULL, NULL, 0);
return;
}
- keys[0] = "stp_port_id";
- values[0] = xasprintf(STP_PORT_ID_FMT, status.port_id);
+ /* Set Status column. */
+ keys[0] = "stp_port_id";
+ str_values[0] = xasprintf(STP_PORT_ID_FMT, status.port_id);
keys[1] = "stp_state";
- values[1] = xstrdup(stp_state_name(status.state));
+ str_values[1] = xstrdup(stp_state_name(status.state));
keys[2] = "stp_sec_in_state";
- values[2] = xasprintf("%u", status.sec_in_state);
+ str_values[2] = xasprintf("%u", status.sec_in_state);
keys[3] = "stp_role";
- values[3] = xstrdup(stp_role_name(status.role));
+ str_values[3] = xstrdup(stp_role_name(status.role));
- ovsrec_port_set_status(port->cfg, keys, values, ARRAY_SIZE(values));
+ ovsrec_port_set_status(port->cfg, keys, str_values,
+ ARRAY_SIZE(str_values));
- for (i = 0; i < ARRAY_SIZE(values); i++) {
- free(values[i]);
+ for (i = 0; i < ARRAY_SIZE(str_values); i++) {
+ free(str_values[i]);
}
+
+ /* Set Statistics column. */
+ keys[0] = "stp_tx_count";
+ int_values[0] = status.tx_count;
+ keys[1] = "stp_rx_count";
+ int_values[1] = status.rx_count;
+ keys[2] = "stp_error_count";
+ int_values[2] = status.error_count;
+
+ ovsrec_port_set_statistics(port->cfg, keys, int_values,
+ ARRAY_SIZE(int_values));
}
static bool
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index 3a9c51fb..19c59227 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@
{"name": "Open_vSwitch",
- "version": "6.2.0",
- "cksum": "145151998 15203",
+ "version": "6.3.0",
+ "cksum": "1659474737 15341",
"tables": {
"Open_vSwitch": {
"columns": {
@@ -150,6 +150,9 @@
"status": {
"type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"},
"ephemeral": true},
+ "statistics": {
+ "type": {"key": "string", "value": "integer", "min": 0, "max": "unlimited"},
+ "ephemeral": true},
"other_config": {
"type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}},
"external_ids": {
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 80d9cdcc..7d2a72a7 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -986,6 +986,26 @@
</column>
</group>
+ <group title="Port Statistics">
+ <p>
+ Key-value pairs that report port statistics.
+ </p>
+ <group title="Statistics: STP transmit and receive counters">
+ <column name="statistics" key="stp_tx_count">
+ Number of STP BPDUs sent on this port by the spanning
+ tree library.
+ </column>
+ <column name="statistics" key="stp_rx_count">
+ Number of STP BPDUs received on this port and accepted by the
+ spanning tree library.
+ </column>
+ <column name="statistics" key="stp_error_count">
+ Number of bad STP BPDUs received on this port. Bad BPDUs
+ include runt packets and those with an unexpected protocol ID.
+ </column>
+ </group>
+ </group>
+
<group title="Common Columns">
The overall purpose of these columns is described under <code>Common
Columns</code> at the beginning of this document.