X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=secchan%2Fofproto.c;h=94c4bfe3fab19e3402baf4c7e730b91d49f53102;hb=cdd35cff225bf39767ea9e2e535cf2940b0e5127;hp=de1252a36d1d2b9bdc1a72185c73e71481b1aa0d;hpb=7778bd15dacc1e410b60ff6ec2996c475a875e6e;p=openvswitch diff --git a/secchan/ofproto.c b/secchan/ofproto.c index de1252a3..94c4bfe3 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -1930,9 +1930,21 @@ static void add_output_action(struct action_xlate_ctx *ctx, uint16_t port) { const struct ofport *ofport = port_array_get(&ctx->ofproto->ports, port); - if (!ofport || !(ofport->opp.config & OFPPC_NO_FWD)) { - odp_actions_add(ctx->out, ODPAT_OUTPUT)->output.port = port; + + if (ofport) { + if (ofport->opp.config & OFPPC_NO_FWD) { + /* Forwarding disabled on port. */ + return; + } + } else { + /* + * We don't have an ofport record for this port, but it doesn't hurt to + * allow forwarding to it anyhow. Maybe such a port will appear later + * and we're pre-populating the flow table. + */ } + + odp_actions_add(ctx->out, ODPAT_OUTPUT)->output.port = port; } static struct rule * @@ -2408,19 +2420,22 @@ query_stats(struct ofproto *p, struct rule *rule, struct odp_flow *odp_flows; size_t n_odp_flows; + packet_count = rule->packet_count; + byte_count = rule->byte_count; + n_odp_flows = rule->cr.wc.wildcards ? list_size(&rule->list) : 1; odp_flows = xcalloc(1, n_odp_flows * sizeof *odp_flows); if (rule->cr.wc.wildcards) { size_t i = 0; LIST_FOR_EACH (subrule, struct rule, list, &rule->list) { odp_flows[i++].key = subrule->cr.flow; + packet_count += subrule->packet_count; + byte_count += subrule->byte_count; } } else { odp_flows[0].key = rule->cr.flow; } - packet_count = rule->packet_count; - byte_count = rule->byte_count; if (!dpif_flow_get_multiple(&p->dpif, odp_flows, n_odp_flows)) { size_t i; for (i = 0; i < n_odp_flows; i++) {