diff mbox series

[ovs-dev] OVN: run local logical flows first inS_ROUTER_OUT_SNAT table

Message ID 5a94bfb33e7a0081a8c3aa0aa85f65961783e732.1558010162.git.lorenzo.bianconi@redhat.com
State Superseded
Headers show
Series [ovs-dev] OVN: run local logical flows first inS_ROUTER_OUT_SNAT table | expand

Commit Message

Lorenzo Bianconi May 16, 2019, 1:11 p.m. UTC
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@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 ovn/northd/ovn-northd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Numan Siddique June 19, 2019, 10:10 a.m. UTC | #1
On Thu, May 16, 2019 at 6:42 PM Lorenzo Bianconi <
lorenzo.bianconi@redhat.com> wrote:

> 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@redhat.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
>


Can you please update the ovn-northd documentation as well ?
Otherwise the patch LGTM.

Thanks
Numan


> ---
>  ovn/northd/ovn-northd.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
> index de0c06d4b..4348eb281 100644
> --- a/ovn/northd/ovn-northd.c
> +++ b/ovn/northd/ovn-northd.c
> @@ -6566,6 +6566,7 @@ 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"
> @@ -6575,6 +6576,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);
>                      }
> @@ -6589,8 +6591,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.20.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Lorenzo Bianconi June 19, 2019, 10:16 a.m. UTC | #2
>
>
>
> On Thu, May 16, 2019 at 6:42 PM Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:
>>
>> 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@redhat.com>
>> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
>
>
>
> Can you please update the ovn-northd documentation as well ?
> Otherwise the patch LGTM.

ack, thx Numan. v2 on the way

Regards,
Lorenzo

>
> Thanks
> Numan
>
>>
>> ---
>>  ovn/northd/ovn-northd.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
>> index de0c06d4b..4348eb281 100644
>> --- a/ovn/northd/ovn-northd.c
>> +++ b/ovn/northd/ovn-northd.c
>> @@ -6566,6 +6566,7 @@ 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"
>> @@ -6575,6 +6576,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);
>>                      }
>> @@ -6589,8 +6591,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.20.1
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index de0c06d4b..4348eb281 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -6566,6 +6566,7 @@  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"
@@ -6575,6 +6576,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);
                     }
@@ -6589,8 +6591,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));
                 }
             }