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

2019-09-13 Thread Dumitru Ceara
On Wed, Sep 11, 2019 at 7:22 PM Lorenzo Bianconi
 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 
> ---
>  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;
>eth.dst are always accepted instead of being subject to 
> the
>port security rules; this is implemented through a priority-100 flow 
> that
>matches on eth.mcast with action output;.
> -  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 outport overrides the priority-100 flow
>with a drop; action.
> +  Finally if egress qos has been enabled on a localnet port, the outgoing
> +  queue id is set through set_queue action. Please remember 
> to
> +  mark the corresponding physical interface with
> +  ovn-egress-iface set to true in  +  table="Interface" db="Open_vSwitch"/>
>  
>
>  Logical Router Datapaths
> 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
> 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


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

2019-09-11 Thread Lorenzo Bianconi
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 
---
 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;
   eth.dst are always accepted instead of being subject to the
   port security rules; this is implemented through a priority-100 flow that
   matches on eth.mcast with action output;.
-  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 outport overrides the priority-100 flow
   with a drop; action.
+  Finally if egress qos has been enabled on a localnet port, the outgoing
+  queue id is set through set_queue action. Please remember to
+  mark the corresponding physical interface with
+  ovn-egress-iface set to true in 
 
 
 Logical Router Datapaths
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;");
-- 
2.21.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev