bool flow_entry_overlaps(struct flow_entry *entry, struct ofl_msg_flow_mod *mod) { return (entry->stats->priority == mod->priority && (mod->out_port == OFPP_ANY || flow_entry_has_out_port(entry, mod->out_port)) && (mod->out_group == OFPG_ANY || flow_entry_has_out_group(entry, mod->out_group)) && flow_entry_matches(entry, mod, false)); }
bool flow_entry_overlaps(struct flow_entry *entry, struct ofl_msg_flow_mod *mod) { return (entry->stats->priority == mod->priority && (mod->out_port == OFPP_ANY || flow_entry_has_out_port(entry, mod->out_port)) && (mod->out_group == OFPG_ANY || flow_entry_has_out_group(entry, mod->out_group)) && match_std_overlap((struct ofl_match *)entry->stats->match, (struct ofl_match *)mod->match)); }
void flow_table_aggregate_stats(struct flow_table *table, struct ofl_msg_stats_request_flow *msg, uint64_t *packet_count, uint64_t *byte_count, uint32_t *flow_count) { struct flow_entry *entry; LIST_FOR_EACH(entry, struct flow_entry, match_node, &table->match_entries) { if ((msg->out_port == OFPP_ANY || flow_entry_has_out_port(entry, msg->out_port)) && (msg->out_group == OFPG_ANY || flow_entry_has_out_group(entry, msg->out_group))) { (*packet_count) += entry->stats->packet_count; (*byte_count) += entry->stats->byte_count; (*flow_count)++; } } }
void flow_table_stats(struct flow_table *table, struct ofl_msg_stats_request_flow *msg, struct ofl_flow_stats ***stats, size_t *stats_size, size_t *stats_num) { struct flow_entry *entry; LIST_FOR_EACH(entry, struct flow_entry, match_node, &table->match_entries) { if ((msg->out_port == OFPP_ANY || flow_entry_has_out_port(entry, msg->out_port)) && (msg->out_group == OFPG_ANY || flow_entry_has_out_group(entry, msg->out_group)) && match_std_nonstrict((struct ofl_match *)msg->match, (struct ofl_match *)entry->stats->match)) { flow_entry_update(entry); if ((*stats_size) == (*stats_num)) { (*stats) = xrealloc(*stats, (sizeof(struct ofl_flow_stats *)) * (*stats_size) * 2); *stats_size *= 2; } (*stats)[(*stats_num)] = entry->stats; (*stats_num)++; } } }