X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fofproto-dpif.c;h=ec5e3be2e23225216a9bf4f942bc733aaaf2e53a;hb=823518f1f26c2320c35e762c9d1bd29e68f9c5b8;hp=88ec2c0a577cfb009e9494be72ba7312dc45e4ca;hpb=54a9cbc9637e3deba7e436aac398aaa9ba110892;p=openvswitch diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 88ec2c0a..ec5e3be2 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -465,6 +465,9 @@ construct(struct ofproto *ofproto_, int *n_tablesp) ofproto->max_ports = dpif_get_max_ports(ofproto->dpif); ofproto->n_matches = 0; + dpif_flow_flush(ofproto->dpif); + dpif_recv_purge(ofproto->dpif); + error = dpif_recv_set_mask(ofproto->dpif, ((1u << DPIF_UC_MISS) | (1u << DPIF_UC_ACTION) | @@ -474,8 +477,6 @@ construct(struct ofproto *ofproto_, int *n_tablesp) dpif_close(ofproto->dpif); return error; } - dpif_flow_flush(ofproto->dpif); - dpif_recv_purge(ofproto->dpif); ofproto->netflow = NULL; ofproto->sflow = NULL; @@ -836,6 +837,10 @@ set_cfm(struct ofport *ofport_, const struct cfm_settings *s) error = 0; } else { if (!ofport->cfm) { + struct ofproto_dpif *ofproto; + + ofproto = ofproto_dpif_cast(ofport->up.ofproto); + ofproto->need_revalidate = true; ofport->cfm = cfm_create(netdev_get_name(ofport->up.netdev)); } @@ -1069,6 +1074,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, /* LACP. */ if (s->lacp) { if (!bundle->lacp) { + ofproto->need_revalidate = true; bundle->lacp = lacp_create(); } lacp_configure(bundle->lacp, s->lacp); @@ -1114,7 +1120,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, } /* Get trunked VLANs. */ - trunks = s->vlan == -1 ? NULL : s->trunks; + trunks = s->vlan == -1 ? s->trunks : NULL; if (!vlan_bitmap_equal(trunks, bundle->trunks)) { free(bundle->trunks); bundle->trunks = vlan_bitmap_clone(trunks); @@ -2881,6 +2887,26 @@ static void do_xlate_actions(const union ofp_action *in, size_t n_in, struct action_xlate_ctx *ctx); static void xlate_normal(struct action_xlate_ctx *); +static void +commit_vlan_tci(struct action_xlate_ctx *ctx, ovs_be16 vlan_tci) +{ + struct flow *base = &ctx->base_flow; + struct ofpbuf *odp_actions = ctx->odp_actions; + + if (base->vlan_tci != vlan_tci) { + if (!(vlan_tci & htons(VLAN_CFI))) { + nl_msg_put_flag(odp_actions, OVS_ACTION_ATTR_POP_VLAN); + } else { + if (base->vlan_tci != htons(0)) { + nl_msg_put_flag(odp_actions, OVS_ACTION_ATTR_POP_VLAN); + } + nl_msg_put_be16(odp_actions, OVS_ACTION_ATTR_PUSH_VLAN, + vlan_tci & ~htons(VLAN_CFI)); + } + base->vlan_tci = vlan_tci; + } +} + static void commit_odp_actions(struct action_xlate_ctx *ctx) { @@ -2908,18 +2934,7 @@ commit_odp_actions(struct action_xlate_ctx *ctx) base->nw_tos = flow->nw_tos; } - if (base->vlan_tci != flow->vlan_tci) { - if (!(flow->vlan_tci & htons(VLAN_CFI))) { - nl_msg_put_flag(odp_actions, OVS_ACTION_ATTR_POP_VLAN); - } else { - if (base->vlan_tci != htons(0)) { - nl_msg_put_flag(odp_actions, OVS_ACTION_ATTR_POP_VLAN); - } - nl_msg_put_be16(odp_actions, OVS_ACTION_ATTR_PUSH_VLAN, - flow->vlan_tci & ~htons(VLAN_CFI)); - } - base->vlan_tci = flow->vlan_tci; - } + commit_vlan_tci(ctx, flow->vlan_tci); if (base->tp_src != flow->tp_src) { nl_msg_put_be16(odp_actions, OVS_ACTION_ATTR_SET_TP_SRC, flow->tp_src); @@ -3735,8 +3750,13 @@ compose_actions(struct action_xlate_ctx *ctx, uint16_t vlan, dst_set_init(&set); compose_dsts(ctx, vlan, in_bundle, out_bundle, &set); compose_mirror_dsts(ctx, vlan, in_bundle, &set); + if (!set.n) { + dst_set_free(&set); + return; + } /* Output all the packets we can without having to change the VLAN. */ + commit_odp_actions(ctx); initial_vlan = vlan_tci_to_vid(ctx->flow.vlan_tci); if (initial_vlan == 0) { initial_vlan = OFP_VLAN_NONE; @@ -3756,19 +3776,15 @@ compose_actions(struct action_xlate_ctx *ctx, uint16_t vlan, continue; } if (dst->vlan != cur_vlan) { - if (dst->vlan == OFP_VLAN_NONE) { - nl_msg_put_flag(ctx->odp_actions, OVS_ACTION_ATTR_POP_VLAN); - } else { - ovs_be16 tci; + ovs_be16 tci; - if (cur_vlan != OFP_VLAN_NONE) { - nl_msg_put_flag(ctx->odp_actions, OVS_ACTION_ATTR_POP_VLAN); - } - tci = htons(dst->vlan & VLAN_VID_MASK); - tci |= ctx->flow.vlan_tci & htons(VLAN_PCP_MASK); - nl_msg_put_be16(ctx->odp_actions, - OVS_ACTION_ATTR_PUSH_VLAN, tci); + tci = htons(dst->vlan == OFP_VLAN_NONE ? 0 : dst->vlan); + tci |= ctx->flow.vlan_tci & htons(VLAN_PCP_MASK); + if (tci) { + tci |= htons(VLAN_CFI); } + commit_vlan_tci(ctx, tci); + cur_vlan = dst->vlan; } nl_msg_put_u32(ctx->odp_actions,