Reported-At: https://bugzilla.redhat.com/show_bug.cgi?id=2060310 Signed-off-by: Ihar Hrachyshka <ihrac...@redhat.com> Acked-by: Ales Musil <amu...@redhat.com> Signed-off-by: Mark Michelson <mmich...@redhat.com> (cherry picked from commit dbf12e5fe1f7ab2acef4152854c239b999b70188) --- 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 3e1c6fb11..73f92b447 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ OVN v22.03.2 - xx xxx xxxx -------------------------- + - Support (LSP.options:qos_min_rate) to guarantee minimal bandwidth available + for a logical port. OVN v22.03.1 - 03 Jun 2022 -------------------------- diff --git a/controller/binding.c b/controller/binding.c index 9eaaddbd0..e4c041ae3 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 215256eea..db13e0ee5 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -1029,6 +1029,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 3edefffaf..d36f55236 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -3270,6 +3270,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 19fd28c12..9ebe643ed 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -6342,13 +6342,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