COVERAGE_DEFINE(ofproto_uninstallable);
COVERAGE_DEFINE(ofproto_update_port);
-#include "sflow_api.h"
-
/* Maximum depth of flow table recursion (due to NXAST_RESUBMIT actions) in a
* flow translation. */
#define MAX_RESUBMIT_RECURSION 16
}
void
-ofproto_get_ofproto_controller_info(const struct ofproto * ofproto,
+ofproto_get_ofproto_controller_info(const struct ofproto *ofproto,
struct shash *info)
{
const struct ofconn *ofconn;
HMAP_FOR_EACH (ofconn, hmap_node, &ofproto->controllers) {
const struct rconn *rconn = ofconn->rconn;
+ time_t now = time_now();
+ time_t last_connection = rconn_get_last_connection(rconn);
+ time_t last_disconnect = rconn_get_last_disconnect(rconn);
const int last_error = rconn_get_last_error(rconn);
struct ofproto_controller_info *cinfo = xmalloc(sizeof *cinfo);
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 (last_connection != TIME_MIN) {
+ cinfo->pairs.keys[cinfo->pairs.n] = "sec_since_connect";
+ cinfo->pairs.values[cinfo->pairs.n++]
+ = xasprintf("%ld", (long int) (now - last_connection));
+ }
+
+ if (last_disconnect != TIME_MIN) {
+ cinfo->pairs.keys[cinfo->pairs.n] = "sec_since_disconnect";
+ cinfo->pairs.values[cinfo->pairs.n++]
+ = xasprintf("%ld", (long int) (now - last_disconnect));
+ }
}
}
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);
}
}
}
/* Adds a pretty-printed description of all flows to 'results', including
- * those marked hidden by secchan (e.g., by in-band control). */
+ * hidden flows (e.g., set up by in-band control). */
void
ofproto_get_all_flows(struct ofproto *p, struct ds *results)
{
* OFPT_PACKET_IN message to each OpenFlow controller as necessary according to
* their individual configurations.
*
- * Takes ownership of 'packet'. */
+ * If 'clone' is true, the caller retains ownership of 'upcall->packet'.
+ * Otherwise, ownership is transferred to this function. */
static void
send_packet_in(struct ofproto *ofproto, struct dpif_upcall *upcall,
const struct flow *flow, bool clone)