#include "lacp.h"
#include "learn.h"
#include "mac-learning.h"
+#include "meta-flow.h"
#include "multipath.h"
#include "netdev.h"
#include "netlink.h"
if (stp_learn_in_state(ofport->stp_state)
!= stp_learn_in_state(state)) {
/* xxx Learning action flows should also be flushed. */
- mac_learning_flush(ofproto->ml);
+ mac_learning_flush(ofproto->ml, &ofproto->revalidate_set);
}
fwd_change = stp_forward_in_state(ofport->stp_state)
!= stp_forward_in_state(state);
update_stp_port_state(ofport);
}
}
+
+ if (stp_check_and_reset_fdb_flush(ofproto->stp)) {
+ mac_learning_flush(ofproto->ml, &ofproto->revalidate_set);
+ }
}
}
}
bond_run(bundle->bond, &bundle->ofproto->revalidate_set,
- lacp_negotiated(bundle->lacp));
+ lacp_status(bundle->lacp));
if (bond_should_send_learning_packets(bundle->bond)) {
bundle_send_learning_packets(bundle);
}
}
ofproto->need_revalidate = true;
- mac_learning_flush(ofproto->ml);
+ mac_learning_flush(ofproto->ml, &ofproto->revalidate_set);
mirror_update_dups(ofproto);
return 0;
ofproto = mirror->ofproto;
ofproto->need_revalidate = true;
- mac_learning_flush(ofproto->ml);
+ mac_learning_flush(ofproto->ml, &ofproto->revalidate_set);
mirror_bit = MIRROR_MASK_C(1) << mirror->idx;
HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
{
struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
if (mac_learning_set_flood_vlans(ofproto->ml, flood_vlans)) {
- ofproto->need_revalidate = true;
- mac_learning_flush(ofproto->ml);
+ mac_learning_flush(ofproto->ml, &ofproto->revalidate_set);
}
return 0;
}
};
struct flow_miss_op {
- union dpif_op dpif_op;
+ struct dpif_op dpif_op;
struct subfacet *subfacet;
};
* OpenFlow controller as necessary according to their individual
* configurations. */
static void
-send_packet_in_miss(struct ofproto_dpif *ofproto, struct ofpbuf *packet,
+send_packet_in_miss(struct ofproto_dpif *ofproto, const struct ofpbuf *packet,
const struct flow *flow)
{
struct ofputil_packet_in pin;
struct flow_miss_op *op;
struct dpif_execute *execute;
- list_remove(&packet->list_node);
ofproto->n_matches++;
if (facet->rule->up.cr.priority == FAIL_OPEN_PRIORITY) {
dpif_flow_stats_extract(&facet->flow, packet, &stats);
subfacet_update_stats(subfacet, &stats);
+ if (!subfacet->actions_len) {
+ /* No actions to execute, so skip talking to the dpif. */
+ continue;
+ }
+
if (flow->vlan_tci != subfacet->initial_tci) {
/* This packet was received on a VLAN splinter port. We added
* a VLAN to the packet to make the packet resemble the flow,
}
op = &ops[(*n_ops)++];
- execute = &op->dpif_op.execute;
+ execute = &op->dpif_op.u.execute;
op->subfacet = subfacet;
- execute->type = DPIF_OP_EXECUTE;
+ op->dpif_op.type = DPIF_OP_EXECUTE;
execute->key = miss->key;
execute->key_len = miss->key_len;
execute->actions = (facet->may_install
if (facet->may_install && subfacet->key_fitness != ODP_FIT_TOO_LITTLE) {
struct flow_miss_op *op = &ops[(*n_ops)++];
- struct dpif_flow_put *put = &op->dpif_op.flow_put;
+ struct dpif_flow_put *put = &op->dpif_op.u.flow_put;
op->subfacet = subfacet;
- put->type = DPIF_OP_FLOW_PUT;
+ op->dpif_op.type = DPIF_OP_FLOW_PUT;
put->flags = DPIF_FP_CREATE | DPIF_FP_MODIFY;
put->key = miss->key;
put->key_len = miss->key_len;
struct dpif_upcall *upcall;
struct flow_miss *miss, *next_miss;
struct flow_miss_op flow_miss_ops[FLOW_MISS_MAX_BATCH * 2];
- union dpif_op *dpif_ops[FLOW_MISS_MAX_BATCH * 2];
+ struct dpif_op *dpif_ops[FLOW_MISS_MAX_BATCH * 2];
struct hmap todo;
size_t n_ops;
size_t i;
/* Process each element in the to-do list, constructing the set of
* operations to batch. */
n_ops = 0;
- HMAP_FOR_EACH_SAFE (miss, next_miss, hmap_node, &todo) {
+ HMAP_FOR_EACH (miss, hmap_node, &todo) {
handle_flow_miss(ofproto, miss, flow_miss_ops, &n_ops);
- ofpbuf_list_delete(&miss->packets);
- hmap_remove(&todo, &miss->hmap_node);
- free(miss);
}
assert(n_ops <= ARRAY_SIZE(flow_miss_ops));
- hmap_destroy(&todo);
/* Execute batch. */
for (i = 0; i < n_ops; i++) {
for (i = 0; i < n_ops; i++) {
struct flow_miss_op *op = &flow_miss_ops[i];
struct dpif_execute *execute;
- struct dpif_flow_put *put;
switch (op->dpif_op.type) {
case DPIF_OP_EXECUTE:
- execute = &op->dpif_op.execute;
+ execute = &op->dpif_op.u.execute;
if (op->subfacet->actions != execute->actions) {
free((struct nlattr *) execute->actions);
}
- ofpbuf_delete((struct ofpbuf *) execute->packet);
break;
case DPIF_OP_FLOW_PUT:
- put = &op->dpif_op.flow_put;
- if (!put->error) {
+ if (!op->dpif_op.error) {
op->subfacet->installed = true;
}
break;
}
}
+ HMAP_FOR_EACH_SAFE (miss, next_miss, hmap_node, &todo) {
+ ofpbuf_list_delete(&miss->packets);
+ hmap_remove(&todo, &miss->hmap_node);
+ free(miss);
+ }
+ hmap_destroy(&todo);
}
static void
struct rule_dpif *rule;
struct subfacet *subfacet;
+ bool may_log = false;
bool ok;
/* Check the rule for consistency. */
}
return false;
} else if (rule != facet->rule) {
- struct ds s;
+ may_log = !VLOG_DROP_WARN(&rl);
+ ok = false;
+ if (may_log) {
+ struct ds s;
- ds_init(&s);
- flow_format(&s, &facet->flow);
- ds_put_format(&s, ": facet associated with wrong rule (was "
- "table=%"PRIu8",", facet->rule->up.table_id);
- cls_rule_format(&facet->rule->up.cr, &s);
- ds_put_format(&s, ") (should have been table=%"PRIu8",",
- rule->up.table_id);
- cls_rule_format(&rule->up.cr, &s);
- ds_put_char(&s, ')');
-
- VLOG_WARN("%s", ds_cstr(&s));
- ds_destroy(&s);
+ ds_init(&s);
+ flow_format(&s, &facet->flow);
+ ds_put_format(&s, ": facet associated with wrong rule (was "
+ "table=%"PRIu8",", facet->rule->up.table_id);
+ cls_rule_format(&facet->rule->up.cr, &s);
+ ds_put_format(&s, ") (should have been table=%"PRIu8",",
+ rule->up.table_id);
+ cls_rule_format(&rule->up.cr, &s);
+ ds_put_char(&s, ')');
- ok = false;
+ VLOG_WARN("%s", ds_cstr(&s));
+ ds_destroy(&s);
+ }
} else {
ok = true;
}
|| memcmp(subfacet->actions, odp_actions->data,
subfacet->actions_len));
if (should_install != subfacet->installed || actions_changed) {
- struct odputil_keybuf keybuf;
- struct ofpbuf key;
- struct ds s;
+ if (ok) {
+ may_log = !VLOG_DROP_WARN(&rl);
+ ok = false;
+ }
- ok = false;
+ if (may_log) {
+ struct odputil_keybuf keybuf;
+ struct ofpbuf key;
+ struct ds s;
- ds_init(&s);
- subfacet_get_key(subfacet, &keybuf, &key);
- odp_flow_key_format(key.data, key.size, &s);
-
- ds_put_cstr(&s, ": inconsistency in subfacet");
- if (should_install != subfacet->installed) {
- enum odp_key_fitness fitness = subfacet->key_fitness;
-
- ds_put_format(&s, " (should%s have been installed)",
- should_install ? "" : " not");
- ds_put_format(&s, " (may_set_up_flow=%s, fitness=%s)",
- ctx.may_set_up_flow ? "true" : "false",
- odp_key_fitness_to_string(fitness));
- }
- if (actions_changed) {
- ds_put_cstr(&s, " (actions were: ");
- format_odp_actions(&s, subfacet->actions,
- subfacet->actions_len);
- ds_put_cstr(&s, ") (correct actions: ");
- format_odp_actions(&s, odp_actions->data,
- odp_actions->size);
- ds_put_char(&s, ')');
- } else {
- ds_put_cstr(&s, " (actions: ");
- format_odp_actions(&s, subfacet->actions,
- subfacet->actions_len);
- ds_put_char(&s, ')');
+ ds_init(&s);
+ subfacet_get_key(subfacet, &keybuf, &key);
+ odp_flow_key_format(key.data, key.size, &s);
+
+ ds_put_cstr(&s, ": inconsistency in subfacet");
+ if (should_install != subfacet->installed) {
+ enum odp_key_fitness fitness = subfacet->key_fitness;
+
+ ds_put_format(&s, " (should%s have been installed)",
+ should_install ? "" : " not");
+ ds_put_format(&s, " (may_set_up_flow=%s, fitness=%s)",
+ ctx.may_set_up_flow ? "true" : "false",
+ odp_key_fitness_to_string(fitness));
+ }
+ if (actions_changed) {
+ ds_put_cstr(&s, " (actions were: ");
+ format_odp_actions(&s, subfacet->actions,
+ subfacet->actions_len);
+ ds_put_cstr(&s, ") (correct actions: ");
+ format_odp_actions(&s, odp_actions->data,
+ odp_actions->size);
+ ds_put_char(&s, ')');
+ } else {
+ ds_put_cstr(&s, " (actions: ");
+ format_odp_actions(&s, subfacet->actions,
+ subfacet->actions_len);
+ ds_put_char(&s, ')');
+ }
+ VLOG_WARN("%s", ds_cstr(&s));
+ ds_destroy(&s);
}
- VLOG_WARN("%s", ds_cstr(&s));
- ds_destroy(&s);
}
next:
xlate_output_reg_action(struct action_xlate_ctx *ctx,
const struct nx_action_output_reg *naor)
{
+ struct mf_subfield src;
uint64_t ofp_port;
- ofp_port = nxm_read_field_bits(naor->src, naor->ofs_nbits, &ctx->flow);
+ nxm_decode(&src, naor->src, naor->ofs_nbits);
+ ofp_port = mf_get_subfield(&src, &ctx->flow);
if (ofp_port <= UINT16_MAX) {
xlate_output_action__(ctx, ofp_port, ntohs(naor->max_len));
}
static void
-ofproto_unixctl_fdb_flush(struct unixctl_conn *conn, int argc OVS_UNUSED,
+ofproto_unixctl_fdb_flush(struct unixctl_conn *conn, int argc,
const char *argv[], void *aux OVS_UNUSED)
{
- const struct ofproto_dpif *ofproto;
+ struct ofproto_dpif *ofproto;
- ofproto = ofproto_dpif_lookup(argv[1]);
- if (!ofproto) {
- unixctl_command_reply(conn, 501, "no such bridge");
- return;
+ if (argc > 1) {
+ ofproto = ofproto_dpif_lookup(argv[1]);
+ if (!ofproto) {
+ unixctl_command_reply(conn, 501, "no such bridge");
+ return;
+ }
+ mac_learning_flush(ofproto->ml, &ofproto->revalidate_set);
+ } else {
+ HMAP_FOR_EACH (ofproto, all_ofproto_dpifs_node, &all_ofproto_dpifs) {
+ mac_learning_flush(ofproto->ml, &ofproto->revalidate_set);
+ }
}
- mac_learning_flush(ofproto->ml);
unixctl_command_reply(conn, 200, "table successfully flushed");
}
unixctl_command_register(
"ofproto/trace",
"bridge {tun_id in_port packet | odp_flow [-generate]}",
- 2, 4, ofproto_unixctl_trace, NULL);
- unixctl_command_register("fdb/flush", "bridge", 1, 1,
+ 2, 5, ofproto_unixctl_trace, NULL);
+ unixctl_command_register("fdb/flush", "[bridge]", 0, 1,
ofproto_unixctl_fdb_flush, NULL);
unixctl_command_register("fdb/show", "bridge", 1, 1,
ofproto_unixctl_fdb_show, NULL);