/* Initializes the group references of the flow entry. */ static void init_group_refs(struct flow_entry *entry) { struct group_ref_entry *e; size_t i,j; for (i=0; i<entry->stats->instructions_num; i++) { if (entry->stats->instructions[i]->type == OFPIT_APPLY_ACTIONS || entry->stats->instructions[i]->type == OFPIT_WRITE_ACTIONS) { struct ofl_instruction_actions *ia = (struct ofl_instruction_actions *)entry->stats->instructions[i]; for (j=0; j < ia->actions_num; j++) { if (ia->actions[j]->type == OFPAT_GROUP) { struct ofl_action_group *ag = (struct ofl_action_group *)(ia->actions[j]); if (!has_group_ref(entry, ag->group_id)) { struct group_ref_entry *gre = xmalloc(sizeof(struct group_ref_entry)); gre->group_id = ag->group_id; list_insert(&entry->group_refs, &gre->node); } } } } } /* notify groups of the new referencing flow entry */ LIST_FOR_EACH(e, struct group_ref_entry, node, &entry->group_refs) { struct group_entry *group = group_table_find(entry->dp->groups, e->group_id); if (group != NULL) { group_entry_add_flow_ref(group, entry); } else { VLOG_WARN_RL(LOG_MODULE, &rl, "Trying to access non-existing group(%u).", e->group_id); } } }
/* Initializes the group references of the flow entry. */ static void init_group_refs(struct flow_entry *entry) { struct group_ref_entry *e; size_t i,j; for (i=0; i<entry->stats->instructions_num; i++) { if (entry->stats->instructions[i]->type == OFPIT_APPLY_ACTIONS || entry->stats->instructions[i]->type == OFPIT_WRITE_ACTIONS) { struct ofl_instruction_actions *ia = (struct ofl_instruction_actions *)entry->stats->instructions[i]; for (j=0; j < ia->actions_num; j++) { if (ia->actions[j]->type == OFPAT_GROUP) { struct ofl_action_group *ag = (struct ofl_action_group *)(ia->actions[i]); if (!has_group_ref(entry, ag->group_id)) { struct group_ref_entry *gre = xmalloc(sizeof(struct group_ref_entry)); gre->entry = group_table_find(entry->dp->groups, ag->group_id); list_insert(&entry->group_refs, &gre->node); } } } } } /* notify groups of the new referencing flow entry */ LIST_FOR_EACH(e, struct group_ref_entry, node, &entry->group_refs) { group_entry_add_flow_ref(e->entry, entry); } }