Looks good, thanks

Acked-by: Ales Musil <amu...@redhat.com>

On Wed, Apr 27, 2022 at 2:03 AM Ihar Hrachyshka <ihrac...@redhat.com> wrote:

> Reported-At: https://bugzilla.redhat.com/show_bug.cgi?id=2060310
> Signed-off-by: Ihar Hrachyshka <ihrac...@redhat.com>
> ---
>  NEWS                 |  2 ++
>  controller/binding.c | 13 ++++++++++---
>  ovn-nb.xml           |  5 +++++
>  ovn-sb.xml           |  5 +++++
>  tests/system-ovn.at  |  4 +++-
>  5 files changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index dbe89e9cf..244824e3f 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -7,6 +7,8 @@ Post v22.03.0
>    - Support NAT for logical routers with multiple distributed gateway
> ports.
>    - Add global option (NB_Global.options:default_acl_drop) to enable
>      implicit drop behavior on logical switches with ACLs applied.
> +  - Support (LSP.options:qos_min_rate) to guarantee minimal bandwidth
> available
> +    for a logical port.
>
>  OVN v22.03.0 - 11 Mar 2022
>  --------------------------
> diff --git a/controller/binding.c b/controller/binding.c
> index 7281b0485..0f08281ab 100644
> --- a/controller/binding.c
> +++ b/controller/binding.c
> @@ -51,6 +51,7 @@ VLOG_DEFINE_THIS_MODULE(binding);
>  struct qos_queue {
>      struct hmap_node node;
>      uint32_t queue_id;
> +    uint32_t min_rate;
>      uint32_t max_rate;
>      uint32_t burst;
>  };
> @@ -88,17 +89,19 @@ static void update_lport_tracking(const struct
> sbrec_port_binding *pb,
>  static void
>  get_qos_params(const struct sbrec_port_binding *pb, struct hmap
> *queue_map)
>  {
> +    uint32_t min_rate = smap_get_int(&pb->options, "qos_min_rate", 0);
>      uint32_t max_rate = smap_get_int(&pb->options, "qos_max_rate", 0);
>      uint32_t burst = smap_get_int(&pb->options, "qos_burst", 0);
>      uint32_t queue_id = smap_get_int(&pb->options, "qdisc_queue_id", 0);
>
> -    if ((!max_rate && !burst) || !queue_id) {
> +    if ((!min_rate && !max_rate && !burst) || !queue_id) {
>          /* Qos is not configured for this port. */
>          return;
>      }
>
>      struct qos_queue *node = xzalloc(sizeof *node);
>      hmap_insert(queue_map, &node->node, hash_int(queue_id, 0));
> +    node->min_rate = min_rate;
>      node->max_rate = max_rate;
>      node->burst = burst;
>      node->queue_id = queue_id;
> @@ -238,9 +241,12 @@ setup_qos(const char *egress_iface, struct hmap
> *queue_map)
>          HMAP_FOR_EACH_WITH_HASH (sb_info, node, hash_int(queue_id, 0),
>                                   queue_map) {
>              is_queue_needed = true;
> -            if (sb_info->max_rate ==
> +            if (sb_info->min_rate ==
> +                smap_get_int(&queue_details, "min-rate", 0)
> +                && sb_info->max_rate ==
>                  smap_get_int(&queue_details, "max-rate", 0)
> -                && sb_info->burst == smap_get_int(&queue_details,
> "burst", 0)) {
> +                && sb_info->burst ==
> +                smap_get_int(&queue_details, "burst", 0)) {
>                  /* This queue is consistent. */
>                  hmap_insert(&consistent_queues, &sb_info->node,
>                              hash_int(queue_id, 0));
> @@ -265,6 +271,7 @@ setup_qos(const char *egress_iface, struct hmap
> *queue_map)
>          }
>
>          smap_clear(&queue_details);
> +        smap_add_format(&queue_details, "min-rate", "%d",
> sb_info->min_rate);
>          smap_add_format(&queue_details, "max-rate", "%d",
> sb_info->max_rate);
>          smap_add_format(&queue_details, "burst", "%d", sb_info->burst);
>          error = netdev_set_queue(netdev_phy, sb_info->queue_id,
> diff --git a/ovn-nb.xml b/ovn-nb.xml
> index 9010240a8..626ddf266 100644
> --- a/ovn-nb.xml
> +++ b/ovn-nb.xml
> @@ -1036,6 +1036,11 @@
>            <ref table="Interface" db="Open_vSwitch"/> table.
>          </column>
>
> +        <column name="options" key="qos_min_rate">
> +          If set, indicates the minimum guaranteed rate available for
> data sent
> +          from this interface, in bit/s.
> +        </column>
> +
>          <column name="options" key="qos_max_rate">
>            If set, indicates the maximum rate for data sent from this
> interface,
>            in bit/s. The traffic will be shaped according to this limit.
> diff --git a/ovn-sb.xml b/ovn-sb.xml
> index 1ffb24e7a..b0b11b8ee 100644
> --- a/ovn-sb.xml
> +++ b/ovn-sb.xml
> @@ -3254,6 +3254,11 @@ tcp.flags = RST;
>          <ref table="Interface" db="Open_vSwitch"/> table.
>        </column>
>
> +      <column name="options" key="qos_min_rate">
> +        If set, indicates the minimum guaranteed rate available for data
> sent
> +        from this interface, in bit/s.
> +      </column>
> +
>        <column name="options" key="qos_max_rate">
>          If set, indicates the maximum rate for data sent from this
> interface,
>          in bit/s. The traffic will be shaped according to this limit.
> diff --git a/tests/system-ovn.at b/tests/system-ovn.at
> index 1454f99d2..4bf22593a 100644
> --- a/tests/system-ovn.at
> +++ b/tests/system-ovn.at
> @@ -6338,13 +6338,15 @@ ovn-nbctl lsp-add sw0 public \
>          -- lsp-set-type public localnet \
>          -- lsp-set-options public network_name=phynet
>
> +AT_CHECK([ovn-nbctl set Logical_Switch_Port public
> options:qos_min_rate=200000])
>  AT_CHECK([ovn-nbctl set Logical_Switch_Port public
> options:qos_max_rate=300000])
>  AT_CHECK([ovn-nbctl set Logical_Switch_Port public
> options:qos_burst=3000000])
>  AT_CHECK([ovs-vsctl set interface ovs-public
> external-ids:ovn-egress-iface=true])
>  OVS_WAIT_UNTIL([tc qdisc show | grep -q 'htb 1: dev ovs-public'])
>  OVS_WAIT_UNTIL([tc class show dev ovs-public | \
> -                grep -q 'class htb .* ceil 300Kbit burst 375000b cburst
> 375000b'])
> +                grep -q 'class htb .* rate 200Kbit ceil 300Kbit burst
> 375000b cburst 375000b'])
>
> +AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options
> qos_min_rate=200000])
>  AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options
> qos_max_rate=300000])
>  AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options
> qos_burst=3000000])
>  OVS_WAIT_UNTIL([test "$(tc qdisc show | grep 'htb 1: dev ovs-public')" =
> ""])
> --
> 2.34.1
>
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>

-- 

Ales Musil

Senior Software Engineer - RHV Network

Red Hat EMEA <https://www.redhat.com>

amu...@redhat.com    IM: amusil
<https://red.ht/sig>
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to