@@ -2829,7 +2829,6 @@ get_stp_port_status(struct ofport *ofport_,
s->enabled = true;
stp_port_get_status(sp, &s->port_id, &s->state, &s->role);
- s->sec_in_state = (time_msec() - ofport->stp_state_entered) / 1000;
return 0;
}
@@ -2849,6 +2848,7 @@ get_stp_port_stats(struct ofport *ofport_,
s->enabled = true;
stp_port_get_counts(sp, &s->tx_count, &s->rx_count, &s->error_count);
+ s->sec_in_state = (time_msec() - ofport->stp_state_entered) / 1000;
return 0;
}
@@ -166,7 +166,6 @@ struct ofproto_port_stp_status {
bool enabled; /* If false, ignore other members. */
int port_id;
enum stp_state state;
- unsigned int sec_in_state;
enum stp_role role;
};
@@ -175,6 +174,7 @@ struct ofproto_port_stp_stats {
int tx_count; /* Number of BPDUs transmitted. */
int rx_count; /* Number of valid BPDUs received. */
int error_count; /* Number of bad BPDUs received. */
+ unsigned int sec_in_state; /* Number of secs in stp state. */
};
struct ofproto_port_queue {
@@ -2758,7 +2758,6 @@ port_refresh_stp_status(struct port *port)
smap_init(&smap);
smap_add_format(&smap, "stp_port_id", "%d", status.port_id);
smap_add(&smap, "stp_state", stp_state_name(status.state));
- smap_add_format(&smap, "stp_sec_in_state", "%u", status.sec_in_state);
smap_add(&smap, "stp_role", stp_role_name(status.role));
ovsrec_port_set_status(port->cfg, &smap);
smap_destroy(&smap);
@@ -2770,8 +2769,8 @@ port_refresh_stp_stats(struct port *port)
struct ofproto *ofproto = port->bridge->ofproto;
struct iface *iface;
struct ofproto_port_stp_stats stats;
- const char *keys[3];
- int64_t int_values[3];
+ const char *keys[4];
+ int64_t int_values[4];
if (port_is_synthetic(port)) {
return;
@@ -2799,6 +2798,8 @@ port_refresh_stp_stats(struct port *port)
int_values[1] = stats.rx_count;
keys[2] = "stp_error_count";
int_values[2] = stats.error_count;
+ keys[3] = "stp_sec_in_state";
+ int_values[3] = stats.sec_in_state;
ovsrec_port_set_statistics(port->cfg, keys, int_values,
ARRAY_SIZE(int_values));
This commit moves the field sec_in_state field from port statistics to port status structure.This helps in reducing the number of updates sent to the controller, with the current mechanism everytime there is a change in this field a notification is sent to the controller. For this field its every second, since it's just counting the number of secs its been in that particular state. By moving this under port statistics, this can be controlled with the key "stats-update-interval". Signed-off-by: Krishna Kolakaluri <kkolakaluri@plume.com> --- ofproto/ofproto-dpif.c | 2 +- ofproto/ofproto.h | 2 +- vswitchd/bridge.c | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-)