X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fofproto.c;h=f44d8a2c00291c2f68e14e82070ec64e3057e1b7;hb=898bf89d807e140b7cf1966d2efc9c6410f71c9d;hp=e25ce28c669a06c72451da618ebdd56e6c4cef1b;hpb=f1670a487adf5d5352eaf32f15bcf2958cdb1771;p=openvswitch diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index e25ce28c..f44d8a2c 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1277,6 +1277,15 @@ ofproto_port_del(struct ofproto *ofproto, uint16_t odp_port) return error; } +/* Checks if 'ofproto' thinks 'odp_port' should be included in floods. Returns + * true if 'odp_port' exists and should be included, false otherwise. */ +bool +ofproto_port_is_floodable(struct ofproto *ofproto, uint16_t odp_port) +{ + struct ofport *ofport = get_port(ofproto, odp_port); + return ofport && !(ofport->opp.config & OFPPC_NO_FLOOD); +} + int ofproto_send_packet(struct ofproto *p, const struct flow *flow, const union ofp_action *actions, size_t n_actions, @@ -1363,6 +1372,8 @@ reinit_ports(struct ofproto *p) size_t n_odp_ports; size_t i; + COVERAGE_INC(ofproto_reinit_ports); + svec_init(&devnames); HMAP_FOR_EACH (ofport, hmap_node, &p->ports) { svec_add (&devnames, (char *) ofport->opp.name); @@ -2577,6 +2588,7 @@ xlate_output_action__(struct action_xlate_ctx *ctx, case OFPP_FLOOD: flood_packets(ctx->ofproto, ctx->flow.in_port, OFPPC_NO_FLOOD, &ctx->nf_output_iface, ctx->out); + break; case OFPP_ALL: flood_packets(ctx->ofproto, ctx->flow.in_port, 0, &ctx->nf_output_iface, ctx->out); @@ -2758,16 +2770,15 @@ do_xlate_actions(const union ofp_action *in, size_t n_in, case OFPAT_SET_VLAN_VID: oa = odp_actions_add(ctx->out, ODPAT_SET_DL_TCI); - oa->dl_tci.tci = ia->vlan_vid.vlan_vid & htons(VLAN_VID_MASK); - oa->dl_tci.mask = htons(VLAN_VID_MASK); + oa->dl_tci.tci = ia->vlan_vid.vlan_vid; + oa->dl_tci.tci |= htons(ctx->flow.dl_vlan_pcp << VLAN_PCP_SHIFT); ctx->flow.dl_vlan = ia->vlan_vid.vlan_vid; break; case OFPAT_SET_VLAN_PCP: oa = odp_actions_add(ctx->out, ODPAT_SET_DL_TCI); - oa->dl_tci.tci = htons((ia->vlan_pcp.vlan_pcp << VLAN_PCP_SHIFT) - & VLAN_PCP_MASK); - oa->dl_tci.mask = htons(VLAN_PCP_MASK); + oa->dl_tci.tci = htons(ia->vlan_pcp.vlan_pcp << VLAN_PCP_SHIFT); + oa->dl_tci.tci |= ctx->flow.dl_vlan; ctx->flow.dl_vlan_pcp = ia->vlan_pcp.vlan_pcp; break; @@ -3337,6 +3348,8 @@ flow_stats_ds_cb(struct cls_rule *rule_, void *cbdata_) ofp_print_match(results, &match, true); if (act_len > 0) { ofp_print_actions(results, &rule->actions->header, act_len); + } else { + ds_put_cstr(results, "drop"); } ds_put_cstr(results, "\n"); }