X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fofproto.c;h=c7872baf7a3baac5b57542c66e19db8d515cb5df;hb=a4b2e516ffd0aa466f2d0182c89a91ce5d23d9a4;hp=61d08ea482997d15bae5dd40daa4edb83d10f4f7;hpb=a2c6a63cc06f4edbce32b6ae5f500b89b3dcd1a6;p=openvswitch diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 61d08ea4..c7872baf 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1396,9 +1396,15 @@ ofproto_get_ofproto_controller_info(const struct ofproto * ofproto, cinfo->pairs.values[cinfo->pairs.n++] = xstrdup(rconn_get_state(rconn)); - cinfo->pairs.keys[cinfo->pairs.n] = "time_in_state"; - cinfo->pairs.values[cinfo->pairs.n++] = - xasprintf("%u", rconn_get_state_elapsed(rconn)); + if (rconn_is_admitted(rconn)) { + cinfo->pairs.keys[cinfo->pairs.n] = "time_connected"; + cinfo->pairs.values[cinfo->pairs.n++] = + xasprintf("%ld", time_now() - rconn_get_last_connection(rconn)); + } else { + cinfo->pairs.keys[cinfo->pairs.n] = "time_disconnected"; + cinfo->pairs.values[cinfo->pairs.n++] = + xasprintf("%d", rconn_failure_duration(rconn)); + } } } @@ -2161,12 +2167,10 @@ facet_execute(struct ofproto *ofproto, struct facet *facet, assert(ofpbuf_headroom(packet) >= sizeof(struct ofp_packet_in)); flow_extract_stats(&facet->flow, packet, &stats); + stats.used = time_msec(); if (execute_odp_actions(ofproto, &facet->flow, facet->actions, facet->actions_len, packet)) { - facet->used = time_msec(); facet_update_stats(ofproto, facet, &stats); - netflow_flow_update_time(ofproto->netflow, - &facet->nf_flow, facet->used); } } @@ -3543,7 +3547,16 @@ put_ofp_flow_stats(struct ofconn *ofconn, struct rule *rule, static bool is_valid_table(uint8_t table_id) { - return table_id == 0 || table_id == 0xff; + if (table_id == 0 || table_id == 0xff) { + return true; + } else { + /* It would probably be better to reply with an error but there doesn't + * seem to be any appropriate value, so that might just be + * confusing. */ + VLOG_WARN_RL(&rl, "controller asked for invalid table %"PRIu8, + table_id); + return false; + } } static int @@ -3887,7 +3900,7 @@ static void facet_update_stats(struct ofproto *ofproto, struct facet *facet, const struct dpif_flow_stats *stats) { - if (stats->n_packets) { + if (stats->n_packets || stats->used > facet->used) { facet_update_time(ofproto, facet, stats->used); facet->packet_count += stats->n_packets; facet->byte_count += stats->n_bytes;