- const struct sbrec_logical_flow *lflow;
- SBREC_LOGICAL_FLOW_FOR_EACH (lflow, ctx->ovnsb_idl) {
- consider_logical_flow(lports, mcgroups, lflow, local_datapaths,
- patched_datapaths, group_table, ct_zones,
- &dhcp_opts, &conj_id_ofs);
+ if (full_logical_flow_processing) {
+ SBREC_LOGICAL_FLOW_FOR_EACH (lflow, ctx->ovnsb_idl) {
+ consider_logical_flow(lports, mcgroups, lflow, local_datapaths,
+ patched_datapaths, group_table, ct_zones,
+ &dhcp_opts, &conj_id_ofs);
+ }
+ full_logical_flow_processing = false;
+ } else {
+ /* First, remove any flows that should be removed. */
+ SBREC_LOGICAL_FLOW_FOR_EACH_TRACKED (lflow, ctx->ovnsb_idl) {
+ if (sbrec_logical_flow_is_deleted(lflow)) {
+ ofctrl_remove_flows(&lflow->header_.uuid);
+ }
+ }
+
+ /* Now, add/modify existing flows. */
+ SBREC_LOGICAL_FLOW_FOR_EACH_TRACKED (lflow, ctx->ovnsb_idl) {
+ if (!sbrec_logical_flow_is_deleted(lflow)) {
+ /* if the logical flow is a modification, just remove
+ * the flows for this row, and then add new flows. */
+ if (!sbrec_logical_flow_is_new(lflow)) {
+ ofctrl_remove_flows(&lflow->header_.uuid);
+ }
+ consider_logical_flow(lports, mcgroups, lflow,
+ local_datapaths, patched_datapaths,
+ group_table, ct_zones,
+ &dhcp_opts, &conj_id_ofs);
+ }
+ }