I agree with Han Zhou, This patch can reduce the flow to vswitchd, but can not reduce the flow calculation of ovn-controller. It may be better to move the check for local_lport_ids before the parse happens. Add a lport column in logical flow may be more efficient.
Thanks. Han Zhou <zhou...@gmail.com> 发件人: ovs-dev-boun...@openvswitch.org 2017/09/19 07:31 收件人: Russell Bryant <russ...@ovn.org>, 抄送: "d...@openvswitch.org" <d...@openvswitch.org>, Miguel Angel Ajo Pelayo <majop...@redhat.com> 主题: Re: [ovs-dev] [PATCH] ovn: Discard flows for non-local ports. Thanks Russell for the quick work! On Mon, Sep 18, 2017 at 8:24 AM, Russell Bryant <russ...@ovn.org> wrote: > @@ -301,6 +305,22 @@ consider_logical_flow(struct controller_ctx *ctx, > if (m->match.wc.masks.conj_id) { > m->match.flow.conj_id += *conj_id_ofs; > } > + if (is_switch(ldp)) { > + unsigned int reg_index > + = (ingress ? MFF_LOG_INPORT : MFF_LOG_OUTPORT) - MFF_REG0; > + int64_t port_id = m->match.flow.regs[reg_index]; > + if (port_id) { > + int64_t dp_id = lflow->logical_datapath->tunnel_key; > + char buf[16]; > + snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64, dp_id, port_id); > + if (!sset_contains(local_lport_ids, buf)) { > + //VLOG_INFO("Matching on port id %"PRId64" dp %"PRId64", is NOT local", port_id, dp_id); > + continue; > + } else { > + //VLOG_INFO("Matching on port id %"PRId64" dp %"PRId64", is local", port_id, dp_id); > + } > + } > + } > if (!m->n) { > ofctrl_add_flow(flow_table, ptable, lflow->priority, > lflow->header_.uuid.parts[0], &m->match, &ofpacts); I remember the expr_parse_string() is one of the biggest cost in ovn-controller, so I wonder would it be better to move the check for local_lport_ids before the parse happens, i.e. check against logical flows instead of ovs flows? Acked-by: Han Zhou <zhou...@gmail.com> _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev