[ovs-dev] [PATCH v3] OVN: run local logical flows first in S_ROUTER_OUT_SNAT table
Lorenzo Bianconi
lorenzo.bianconi at redhat.com
Sat Jul 6 10:45:00 UTC 2019
Run local logical flows first if the gw router port is scheduled
on the local chassis in order to properly manage snat traffic
Tested-by: Eran Kuris <ekuris at redhat.com>
Acked-by: Numan Siddique <nusiddiq at redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
---
Changes since v2:
- fix compilation error
Changes since v1:
- add priority change in ovn-northd.8.xml
---
ovn/northd/ovn-northd.8.xml | 3 ++-
ovn/northd/ovn-northd.c | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml
index 193aa210f..d2267de0e 100644
--- a/ovn/northd/ovn-northd.8.xml
+++ b/ovn/northd/ovn-northd.8.xml
@@ -2428,7 +2428,8 @@ nd_ns {
<p>
If the NAT rule cannot be handled in a distributed manner, then
the flow above is only programmed on the
- <code>redirect-chassis</code>.
+ <code>redirect-chassis</code> increasing flow priority by 128 in
+ order to be run first
</p>
<p>
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index ba2719321..ce382ac89 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -6634,6 +6634,8 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
count_1bits(ntohl(mask)) + 1,
ds_cstr(&match), ds_cstr(&actions));
} else {
+ uint16_t priority = count_1bits(ntohl(mask)) + 1;
+
/* Distributed router. */
ds_clear(&match);
ds_put_format(&match, "ip && ip4.src == %s"
@@ -6643,6 +6645,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
if (!distributed && od->l3redirect_port) {
/* Flows for NAT rules that are centralized are only
* programmed on the "redirect-chassis". */
+ priority += 128;
ds_put_format(&match, " && is_chassis_resident(%s)",
od->l3redirect_port->json_key);
}
@@ -6657,8 +6660,8 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
* nat->logical_ip with the longest mask gets a higher
* priority. */
ovn_lflow_add(lflows, od, S_ROUTER_OUT_SNAT,
- count_1bits(ntohl(mask)) + 1,
- ds_cstr(&match), ds_cstr(&actions));
+ priority, ds_cstr(&match),
+ ds_cstr(&actions));
}
}
--
2.21.0
More information about the dev
mailing list