From patchwork Mon Nov 4 11:09:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 2006195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PAtZL9Ww; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XhppP0FD7z1xxN for ; Mon, 4 Nov 2024 22:17:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 30102805B0; Mon, 4 Nov 2024 11:17:15 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id KevX_0BBuhDS; Mon, 4 Nov 2024 11:17:14 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 34ECE80561 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PAtZL9Ww Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 34ECE80561; Mon, 4 Nov 2024 11:17:14 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F0192C08A8; Mon, 4 Nov 2024 11:17:13 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id D7A9EC08A3 for ; Mon, 4 Nov 2024 11:17:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C4D3D80C06 for ; Mon, 4 Nov 2024 11:10:10 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1UJqZRDHuEHE for ; Mon, 4 Nov 2024 11:10:09 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=lorenzo.bianconi@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 7CB2780849 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 7CB2780849 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 7CB2780849 for ; Mon, 4 Nov 2024 11:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730718608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BVZJrjn0JrVP/gZ9QZMhGcrA267p4v8Pq2dDSN15qMM=; b=PAtZL9WwVKeBNs2txSTTiQX+femD2TWdYcCN9Qlbjt2JocxYwGgXekB0b9AiQyW+JCe5rw i8T/WsPpGl3dQUriqJtdKK/nlCOtXk3ZAni+DzAZEan0AK/+0vUkRbjIoH1kTipnqCt83C 1qakOw1HXgTJq5OcjpN/Qxhyn/ejDrw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-85-8gLlaAErOweXsg5FCO1Ukw-1; Mon, 04 Nov 2024 06:10:07 -0500 X-MC-Unique: 8gLlaAErOweXsg5FCO1Ukw-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-37d609ef9f7so2117029f8f.3 for ; Mon, 04 Nov 2024 03:10:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730718605; x=1731323405; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BVZJrjn0JrVP/gZ9QZMhGcrA267p4v8Pq2dDSN15qMM=; b=qcDctBM9Djtw3NyZR4ux6xxkyuCLCIob9cdTSpNvMS/O3SILq3B9ZBc/sl+8yiPWCW BwCv1nbuhYDWq6uYWNr+cMCyY6q/CQteecjcV//8XBXq9PEAlFkRZ10DYjIhA2zl+rux V0HccZ3Gql6O2XjU2+lVE6cmXK7uHyA6kUysYZm69roICAE7r4pDOyZAUmtaz5S7C1ym t51b6YCScuXpdHb9ocTeb3XPW7kN8vP8iAyjHDrG0JvjXvieMMGjcMWQY2fkVdvB3LuG B43yJYRcxvgcDceJEey0aPJ33O6YFlc/CxQC8F6sLgmsvetWbwVEtOhg9LTl/Mm1EX5J IKjg== X-Gm-Message-State: AOJu0Yw5Bf59PtghPY6PR8+EBk49OnQBTuUQJzrqIDxDSmkFgOq2oe12 OYfsxnqM3mDg7RFHhxiHMxcbZOWHlygg/Z8M+Szvh9PNeUB+QjXjnlfoR5VlXI1KveZ3jYreGZU 2m3uMVipb00Nu994G0OrGdaTkujpwk9FdkXe+YHNjkTaI80ENWVOj3BqJPVhZYocWIWL4vAR4ve FEHb6CJtHZBtfpBnNhp62E20DrWewbkv0ao7HMFWvAgvBu6ITwww== X-Received: by 2002:a5d:6d05:0:b0:37c:d55a:38a5 with SMTP id ffacd0b85a97d-381be764d6cmr13704127f8f.11.1730718605537; Mon, 04 Nov 2024 03:10:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBVfXf9pkbXdO5T4tZjvmmGdPPl8pz7y5e2w8UGojyR4sS/MwjxcFN8m6acXBZwQ0wCOmi9A== X-Received: by 2002:a5d:6d05:0:b0:37c:d55a:38a5 with SMTP id ffacd0b85a97d-381be764d6cmr13704107f8f.11.1730718605089; Mon, 04 Nov 2024 03:10:05 -0800 (PST) Received: from localhost (net-93-146-37-148.cust.vodafonedsl.it. [93.146.37.148]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10eaafdsm12932585f8f.63.2024.11.04.03.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 03:10:04 -0800 (PST) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Cc: ralonsoh@redhat.com Date: Mon, 4 Nov 2024 12:09:59 +0100 Message-ID: <0c2921a51056a18495bbaeb21687d5657eb371d1.1730717990.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] controller: binding: Set HTB root max-rate according to the link speed. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Set HTB Qdisc scheduler root max-rate according to the reported link-speed if it is available (use default value if the link_speed is not reported by OvS). This patch allows more precise shaping when the NIC speed is lower than 34Gbps (current default value) and even take into account cases where NIC capacity is greater than 34 Gbps. Signed-off-by: Lorenzo Bianconi Acked-by: Ales Musil --- controller/binding.c | 11 +++++++---- controller/ovn-controller.c | 1 + tests/system-ovn.at | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 16d64e534..b453e55ad 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -244,6 +244,7 @@ add_or_del_qos_port(const char *ovn_port, bool add) static bool add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, const struct ovsrec_port *port, + const struct ovsrec_interface *iface, unsigned long long min_rate, unsigned long long max_rate, unsigned long long burst, @@ -262,7 +263,9 @@ add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, qos = ovsrec_qos_insert(ovs_idl_txn); ovsrec_qos_set_type(qos, OVN_QOS_TYPE); ovsrec_port_set_qos(port, qos); - smap_add_format(&other_config, "max-rate", "%lld", OVN_QOS_MAX_RATE); + unsigned long long link_speed = + iface->n_link_speed ? iface->link_speed[0] : OVN_QOS_MAX_RATE; + smap_add_format(&other_config, "max-rate", "%lld", link_speed); ovsrec_qos_set_other_config(qos, &other_config); smap_clear(&other_config); @@ -391,9 +394,9 @@ configure_qos(const struct sbrec_port_binding *pb, } if (iface) { /* Add new QoS entries. */ - if (add_ovs_qos_table_entry(ovs_idl_txn, port, min_rate, - max_rate, burst, queue_id, - pb->logical_port)) { + if (add_ovs_qos_table_entry(ovs_idl_txn, port, iface, + min_rate, max_rate, burst, + queue_id, pb->logical_port)) { if (!q) { q = xzalloc(sizeof *q); hmap_insert(qos_map, &q->node, hash); diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index e87274121..38287dbf2 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -827,6 +827,7 @@ ctrl_register_ovs_idl(struct ovsdb_idl *ovs_idl) ovsdb_idl_track_add_column(ovs_idl, &ovsrec_interface_col_options); ovsdb_idl_track_add_column(ovs_idl, &ovsrec_interface_col_ofport); ovsdb_idl_track_add_column(ovs_idl, &ovsrec_interface_col_external_ids); + ovsdb_idl_track_add_column(ovs_idl, &ovsrec_interface_col_link_speed); ovsdb_idl_track_add_column(ovs_idl, &ovsrec_port_col_name); ovsdb_idl_track_add_column(ovs_idl, &ovsrec_port_col_interfaces); ovsdb_idl_track_add_column(ovs_idl, &ovsrec_port_col_external_ids); diff --git a/tests/system-ovn.at b/tests/system-ovn.at index 6dfc3055a..c9d7a7a75 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -6756,7 +6756,7 @@ AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options qos_min_rate=20000 AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options qos_max_rate=300000]) OVS_WAIT_UNTIL([tc class show dev ovs-public | \ - grep -q 'class htb .* rate 12Kbit ceil 34359Mbit burst 375000b cburst 373662b']) + grep -q 'class htb .* rate 12Kbit ceil 10Gbit burst 375000b cburst 365Kb']) 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')" = ""])