diff mbox series

[ovs-dev,RFC,ovn,3/3] northd: interoduce logical flow for localnet egress shaping

Message ID 05231fbaf932a57e2d72ebe28f3b8ad87a05dcf7.1568220566.git.lorenzo.bianconi@redhat.com
State Superseded
Headers show
Series Introduce localnet egress QoS support | expand

Commit Message

Lorenzo Bianconi Sept. 11, 2019, 5:19 p.m. UTC
Add set_queue() action for qos capable localnet port in
S_SWITCH_OUT_PORT_SEC_L2 stage of logical switch pipeline

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 northd/ovn-northd.8.xml |  7 ++++++-
 northd/ovn-northd.c     | 12 +++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

Comments

Dumitru Ceara Sept. 13, 2019, 2:13 p.m. UTC | #1
On Wed, Sep 11, 2019 at 7:22 PM Lorenzo Bianconi
<lorenzo.bianconi@redhat.com> wrote:
>
> Add set_queue() action for qos capable localnet port in
> S_SWITCH_OUT_PORT_SEC_L2 stage of logical switch pipeline
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
>  northd/ovn-northd.8.xml |  7 ++++++-
>  northd/ovn-northd.c     | 12 +++++++++++-
>  2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/northd/ovn-northd.8.xml b/northd/ovn-northd.8.xml
> index b34ef687a..d28f8965c 100644
> --- a/northd/ovn-northd.8.xml
> +++ b/northd/ovn-northd.8.xml
> @@ -1150,10 +1150,15 @@ output;
>        <code>eth.dst</code> are always accepted instead of being subject to the
>        port security rules; this is implemented through a priority-100 flow that
>        matches on <code>eth.mcast</code> with action <code>output;</code>.
> -      Finally, to ensure that even broadcast and multicast packets are not
> +      Moreover, to ensure that even broadcast and multicast packets are not
>        delivered to disabled logical ports, a priority-150 flow for each
>        disabled logical <code>outport</code> overrides the priority-100 flow
>        with a <code>drop;</code> action.
> +      Finally if egress qos has been enabled on a localnet port, the outgoing
> +      queue id is set through <code>set_queue</code> action. Please remember to
> +      mark the corresponding physical interface with
> +      <code>ovn-egress-iface</code> set to true in <ref column="external_ids"
> +      table="Interface" db="Open_vSwitch"/>
>      </p>
>
>      <h2>Logical Router Datapaths</h2>
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index 889eeb795..5bae035b3 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -5681,10 +5681,20 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
>          ds_clear(&match);
>          ds_put_format(&match, "outport == %s", op->json_key);
>          if (lsp_is_enabled(op->nbsp)) {
> +            ds_clear(&actions);
> +
> +            if (!strcmp(op->nbsp->type, "localnet")) {
> +                const char *queue_id = smap_get(&op->sb->options,
> +                                                "qdisc_queue_id");
> +                if (queue_id) {
> +                    ds_put_format(&actions, "set_queue(%s); ", queue_id);
> +                }
> +            }

Hi Lorenzo,

Might be nice to refactor this and add a build_qos() function and also
call it in build_lswitch_flows().

Thanks,
Dumitru

> +            ds_put_cstr(&actions, "output;");
>              build_port_security_l2("eth.dst", op->ps_addrs, op->n_ps_addrs,
>                                     &match);
>              ovn_lflow_add(lflows, op->od, S_SWITCH_OUT_PORT_SEC_L2, 50,
> -                          ds_cstr(&match), "output;");
> +                          ds_cstr(&match), ds_cstr(&actions));
>          } else {
>              ovn_lflow_add(lflows, op->od, S_SWITCH_OUT_PORT_SEC_L2, 150,
>                            ds_cstr(&match), "drop;");
> --
> 2.21.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/northd/ovn-northd.8.xml b/northd/ovn-northd.8.xml
index b34ef687a..d28f8965c 100644
--- a/northd/ovn-northd.8.xml
+++ b/northd/ovn-northd.8.xml
@@ -1150,10 +1150,15 @@  output;
       <code>eth.dst</code> are always accepted instead of being subject to the
       port security rules; this is implemented through a priority-100 flow that
       matches on <code>eth.mcast</code> with action <code>output;</code>.
-      Finally, to ensure that even broadcast and multicast packets are not
+      Moreover, to ensure that even broadcast and multicast packets are not
       delivered to disabled logical ports, a priority-150 flow for each
       disabled logical <code>outport</code> overrides the priority-100 flow
       with a <code>drop;</code> action.
+      Finally if egress qos has been enabled on a localnet port, the outgoing
+      queue id is set through <code>set_queue</code> action. Please remember to
+      mark the corresponding physical interface with
+      <code>ovn-egress-iface</code> set to true in <ref column="external_ids"
+      table="Interface" db="Open_vSwitch"/>
     </p>
 
     <h2>Logical Router Datapaths</h2>
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 889eeb795..5bae035b3 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -5681,10 +5681,20 @@  build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
         ds_clear(&match);
         ds_put_format(&match, "outport == %s", op->json_key);
         if (lsp_is_enabled(op->nbsp)) {
+            ds_clear(&actions);
+
+            if (!strcmp(op->nbsp->type, "localnet")) {
+                const char *queue_id = smap_get(&op->sb->options,
+                                                "qdisc_queue_id");
+                if (queue_id) {
+                    ds_put_format(&actions, "set_queue(%s); ", queue_id);
+                }
+            }
+            ds_put_cstr(&actions, "output;");
             build_port_security_l2("eth.dst", op->ps_addrs, op->n_ps_addrs,
                                    &match);
             ovn_lflow_add(lflows, op->od, S_SWITCH_OUT_PORT_SEC_L2, 50,
-                          ds_cstr(&match), "output;");
+                          ds_cstr(&match), ds_cstr(&actions));
         } else {
             ovn_lflow_add(lflows, op->od, S_SWITCH_OUT_PORT_SEC_L2, 150,
                           ds_cstr(&match), "drop;");