From patchwork Tue Jun 20 13:58:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1797355 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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=I3L/f1wN; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QlpCC714Kz20XS for ; Tue, 20 Jun 2023 23:59:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id F3B4341B55; Tue, 20 Jun 2023 13:59:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org F3B4341B55 Authentication-Results: smtp4.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=I3L/f1wN X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rPhU9KX81Pny; Tue, 20 Jun 2023 13:59:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id B01AB41A49; Tue, 20 Jun 2023 13:58:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B01AB41A49 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 920DAC008D; Tue, 20 Jun 2023 13:58:57 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9EE18C008D for ; Tue, 20 Jun 2023 13:58:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0F9FF41A60 for ; Tue, 20 Jun 2023 13:58:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0F9FF41A60 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D_QFufp7z9Rd for ; Tue, 20 Jun 2023 13:58:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6B32A41977 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 6B32A41977 for ; Tue, 20 Jun 2023 13:58:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687269526; 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: in-reply-to:in-reply-to:references:references; bh=G/Diu+yqcPxid7PnFb7iY3FRoUfYdc393UnhB8rfX3k=; b=I3L/f1wNgE2OHhO6rUiWdHsd2IpQ6ZJD3+iTDrHCi6uljIAJiSSuoNyqqi6QPo7fr/WUcU a9fDWQfOyWUPWKFsVzuVxkPf2kbjYajqZSHCahR8uVGIfjjUk5nF3h1+VFBCZwCv6uccan 7qPqKVi+/1L0TY4riiR9liHtApgKuOc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-DNnb-uDVP6yWAKlswL4ZVw-1; Tue, 20 Jun 2023 09:58:45 -0400 X-MC-Unique: DNnb-uDVP6yWAKlswL4ZVw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5373E3814943 for ; Tue, 20 Jun 2023 13:58:44 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.ntdv.lab.eng.bos.redhat.com [10.19.188.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DC76112132C; Tue, 20 Jun 2023 13:58:44 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 20 Jun 2023 15:58:42 +0200 Message-Id: <20230620135843.2273523-1-xsimonar@redhat.com> In-Reply-To: <20230607172834.3851733-2-xsimonar@redhat.com> References: <20230607172834.3851733-2-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2 1/2] qos: fix potential double deletion of ovs idl row X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" If an interface with an qos option is deleted at the same time as an ofport notification from ovs (causing runtime_data recompute) is received, the binding module was trying to delete twice the same qos queue, causing ovs to raise an exception. Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2213219 Fixes: 7d1d111ff213 ("controller: configure qos through ovs qos table and do not run tc directly") Signed-off-by: Xavier Simonart Acked-by: Ales Musil --- v2: rebased on origin/main --- controller/binding.c | 22 ++++++++++++ controller/binding.h | 1 + controller/ovn-controller.c | 12 +++++++ tests/ovn-macros.at | 34 ++++++++++++++++++ tests/ovn.at | 70 +++++++++++++++++++++++++++++++++++++ tests/system-ovn.at | 18 ---------- 6 files changed, 139 insertions(+), 18 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 486095ca7..8069a2e0d 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -396,9 +396,23 @@ configure_qos(const struct sbrec_port_binding *pb, q->burst = burst; } +static const struct ovsrec_queue * +find_qos_queue_by_external_ids(const struct smap *external_ids, + struct ovsdb_idl_index *ovsrec_queue_by_external_ids) +{ + const struct ovsrec_queue *queue = + ovsrec_queue_index_init_row(ovsrec_queue_by_external_ids); + ovsrec_queue_index_set_external_ids(queue, external_ids); + const struct ovsrec_queue *retval = + ovsrec_queue_index_find(ovsrec_queue_by_external_ids, queue); + ovsrec_queue_index_destroy_row(queue); + return retval; +} + static void ovs_qos_entries_gc(struct ovsdb_idl_txn *ovs_idl_txn, struct ovsdb_idl_index *ovsrec_port_by_qos, + struct ovsdb_idl_index *ovsrec_queue_by_external_ids, const struct ovsrec_qos_table *qos_table, struct hmap *queue_map) { @@ -414,6 +428,13 @@ ovs_qos_entries_gc(struct ovsdb_idl_txn *ovs_idl_txn, if (!queue) { continue; } + const struct ovsrec_queue *ovsrec_queue = + find_qos_queue_by_external_ids(&queue->external_ids, + ovsrec_queue_by_external_ids); + if (!ovsrec_queue) { + VLOG_DBG("queue already deleted !"); + continue; + } const char *port = smap_get(&queue->external_ids, "ovn_port"); if (!port) { @@ -2165,6 +2186,7 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) shash_destroy(&bridge_mappings); /* Remove stale QoS entries. */ ovs_qos_entries_gc(b_ctx_in->ovs_idl_txn, b_ctx_in->ovsrec_port_by_qos, + b_ctx_in->ovsrec_queue_by_external_ids, b_ctx_in->qos_table, b_ctx_out->qos_map); cleanup_claimed_port_timestamps(); diff --git a/controller/binding.h b/controller/binding.h index 0e57f02ee..e3ab1d7ca 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -47,6 +47,7 @@ struct binding_ctx_in { struct ovsdb_idl_index *sbrec_port_binding_by_datapath; struct ovsdb_idl_index *sbrec_port_binding_by_name; struct ovsdb_idl_index *ovsrec_port_by_qos; + struct ovsdb_idl_index *ovsrec_queue_by_external_ids; const struct ovsrec_qos_table *qos_table; const struct sbrec_port_binding_table *port_binding_table; const struct ovsrec_bridge *br_int; diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index a47406979..bb84554fc 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1116,6 +1116,7 @@ enum sb_engine_node { OVS_NODE(port, "port") \ OVS_NODE(interface, "interface") \ OVS_NODE(qos, "qos") \ + OVS_NODE(queue, "queue") \ OVS_NODE(flow_sample_collector_set, "flow_sample_collector_set") enum ovs_engine_node { @@ -1576,6 +1577,10 @@ init_binding_ctx(struct engine_node *node, engine_ovsdb_node_get_index( engine_get_input("OVS_port", node), "qos"); + struct ovsdb_idl_index *ovsrec_queue_by_external_ids = + engine_ovsdb_node_get_index( + engine_get_input("OVS_queue", node), "external_ids"); + struct controller_engine_ctx *ctrl_ctx = engine_get_context()->client_ctx; b_ctx_in->ovnsb_idl_txn = engine_get_context()->ovnsb_idl_txn; @@ -1584,6 +1589,7 @@ init_binding_ctx(struct engine_node *node, b_ctx_in->sbrec_port_binding_by_datapath = sbrec_port_binding_by_datapath; b_ctx_in->sbrec_port_binding_by_name = sbrec_port_binding_by_name; b_ctx_in->ovsrec_port_by_qos = ovsrec_port_by_qos; + b_ctx_in->ovsrec_queue_by_external_ids = ovsrec_queue_by_external_ids; b_ctx_in->iface_table = iface_shadow->iface_table; b_ctx_in->iface_table_external_ids_old = &iface_shadow->iface_table_external_ids_old; @@ -4599,6 +4605,9 @@ main(int argc, char *argv[]) struct ovsdb_idl_index *ovsrec_port_by_qos = ovsdb_idl_index_create1(ovs_idl_loop.idl, &ovsrec_port_col_qos); + struct ovsdb_idl_index *ovsrec_queue_by_external_ids + = ovsdb_idl_index_create1(ovs_idl_loop.idl, + &ovsrec_queue_col_external_ids); struct ovsdb_idl_index *ovsrec_flow_sample_collector_set_by_id = ovsdb_idl_index_create2(ovs_idl_loop.idl, &ovsrec_flow_sample_collector_set_col_bridge, @@ -4899,6 +4908,7 @@ main(int argc, char *argv[]) engine_add_input(&en_runtime_data, &en_ovs_open_vswitch, NULL); engine_add_input(&en_runtime_data, &en_ovs_bridge, NULL); engine_add_input(&en_runtime_data, &en_ovs_qos, NULL); + engine_add_input(&en_runtime_data, &en_ovs_queue, NULL); engine_add_input(&en_runtime_data, &en_sb_chassis, NULL); engine_add_input(&en_runtime_data, &en_sb_datapath_binding, @@ -4960,6 +4970,8 @@ main(int argc, char *argv[]) engine_ovsdb_node_add_index(&en_ovs_flow_sample_collector_set, "id", ovsrec_flow_sample_collector_set_by_id); engine_ovsdb_node_add_index(&en_ovs_port, "qos", ovsrec_port_by_qos); + engine_ovsdb_node_add_index(&en_ovs_queue, "external_ids", + ovsrec_queue_by_external_ids); struct ed_type_lflow_output *lflow_output_data = engine_get_internal_data(&en_lflow_output); diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index 6f2d085ae..7223846ef 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -840,6 +840,40 @@ fmt_pkt() { print(out.decode())" | $PYTHON3 } +sleep_sb() { + echo SB going to sleep + AT_CHECK([kill -STOP $(cat ovn-sb/ovsdb-server.pid)]) +} +wake_up_sb() { + echo SB waking up + AT_CHECK([kill -CONT $(cat ovn-sb/ovsdb-server.pid)]) +} +sleep_controller() { + echo Controller $hv going to sleep + hv=$1 + as $hv + check ovn-appctl debug/pause + OVS_WAIT_UNTIL([test x$(ovn-appctl -t ovn-controller debug/status) = "xpaused"]) +} +wake_up_controller() { + hv=$1 + as $hv + echo Controller $hv waking up + ovn-appctl debug/resume + OVS_WAIT_UNTIL([test x$(ovn-appctl -t ovn-controller debug/status) = "xrunning"]) +} +sleep_ovs() { + hv=$1 + echo ovs $hv going to sleep + AT_CHECK([kill -STOP $(cat $hv/ovs-vswitchd.pid)]) +} + +wake_up_ovs() { + hv=$1 + echo ovs $hv going to sleep + AT_CHECK([kill -CONT $(cat $hv/ovs-vswitchd.pid)]) +} + OVS_END_SHELL_HELPERS m4_define([OVN_POPULATE_ARP], [AT_CHECK(ovn_populate_arp__, [0], [ignore])]) diff --git a/tests/ovn.at b/tests/ovn.at index 544fba187..2c221a05c 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -36458,3 +36458,73 @@ OVN_CHECK_PACKETS_REMOVE_BROADCAST([hv2/vif1-tx.pcap], [expected]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([OVN QoS port deletion]) +ovn_start + +check ovn-nbctl ls-add ls1 +check ovn-nbctl lsp-add ls1 public1 +check ovn-nbctl lsp-set-addresses public1 unknown +check ovn-nbctl lsp-set-type public1 localnet +check ovn-nbctl lsp-set-options public1 network_name=phys +net_add n + +# two hypervisors, each connected to the same network +for i in 1 2; do + sim_add hv-$i + as hv-$i + ovs-vsctl add-br br-phys + ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys + ovn_attach n br-phys 192.168.0.$i +done + +check ovn-nbctl lsp-add ls1 lsp1 +check ovn-nbctl lsp-set-addresses lsp1 f0:00:00:00:00:03 +as hv-1 +ovs-vsctl add-port br-int vif1 -- \ + set Interface vif1 external-ids:iface-id=lsp1 \ + ofport-request=3 + +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp1` = xup]) + +check ovn-nbctl set Logical_Switch_Port lsp1 options:qos_max_rate=800000 +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp1 options:qos_burst=9000000 + +AS_BOX([$(date +%H:%M:%S.%03N) checking deletion of port with qos options]) +check ovn-nbctl ls-add ls2 +check ovn-nbctl lsp-add ls2 lsp2 +check ovn-nbctl lsp-set-addresses lsp2 f0:00:00:00:00:05 +as hv-1 +ovs-vsctl add-port br-int vif2 -- \ + set Interface vif2 external-ids:iface-id=lsp2 \ + ofport-request=5 +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp2` = xup]) + +# Sleep ovs to postpone ofport notification to ovn +sleep_ovs hv-1 + +# Create localnet; this will cause patch-port creation +check ovn-nbctl lsp-add ls2 public2 +check ovn-nbctl lsp-set-addresses public2 unknown +check ovn-nbctl lsp-set-type public2 localnet +check ovn-nbctl --wait=sb set Logical_Switch_Port public2 options:qos_min_rate=6000000000 options:qos_max_rate=7000000000 options:qos_burst=8000000000 options:network_name=phys + +# Let's now send ovn controller to sleep, so it will receive both ofport notification and ls deletion simultaneously +sleep_controller hv-1 + +# Tme to wake up ovs +wake_up_ovs hv-1 + +# Delete lsp1 +check ovn-nbctl --wait=sb lsp-del lsp1 + +# And finally wake up controller +wake_up_controller hv-1 + +# Make sure ovn-controller is still OK +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list qos | grep -c linux-htb) -eq 1]) + +AT_CLEANUP +]) diff --git a/tests/system-ovn.at b/tests/system-ovn.at index 44a8072d6..18a79410e 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -10897,20 +10897,6 @@ wait_for_local_bindings() { [kill -CONT $(cat ovn-sb/ovsdb-server.pid)] ) } -sleep_sb() { - echo SB going to sleep - AT_CHECK([kill -STOP $(cat ovn-sb/ovsdb-server.pid)]) -} -wake_up_sb() { - echo SB waking up - AT_CHECK([kill -CONT $(cat ovn-sb/ovsdb-server.pid)]) -} -sleep_controller() { - echo Controller going to sleep - ovn-appctl debug/pause - OVS_WAIT_UNTIL([test x$(ovn-appctl -t ovn-controller debug/status) = "xpaused"]) -} - stop_ovsdb_controller_updates() { TCP_PORT=$1 echo Stopping updates from ovn-controller to ovsdb using port $TCP_PORT @@ -10922,10 +10908,6 @@ restart_ovsdb_controller_updates() { echo Restarting updates from ovn-controller to ovsdb iptables -D INPUT -p tcp --destination-port $TCP_PORT -j DROP } -wake_up_controller() { - echo Controller waking up - ovn-appctl debug/resume -} ensure_controller_run() { # We want to make sure controller could run at least one full loop. # We can't use wait=hv as sb might be sleeping. From patchwork Tue Jun 20 13:58:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1797354 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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=fqr/n8Fg; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QlpC75scjz20XS for ; Tue, 20 Jun 2023 23:58:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id F14646131B; Tue, 20 Jun 2023 13:58:57 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org F14646131B Authentication-Results: smtp3.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=fqr/n8Fg X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 64RcOPrRfveJ; Tue, 20 Jun 2023 13:58:57 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 1FF0460AFD; Tue, 20 Jun 2023 13:58:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1FF0460AFD Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C3869C008C; Tue, 20 Jun 2023 13:58:55 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 65983C007C for ; Tue, 20 Jun 2023 13:58:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 93333416F8 for ; Tue, 20 Jun 2023 13:58:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 93333416F8 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fqr/n8Fg X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TroeybSquWoq for ; Tue, 20 Jun 2023 13:58:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 997C0416FF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 997C0416FF for ; Tue, 20 Jun 2023 13:58:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687269526; 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: in-reply-to:in-reply-to:references:references; bh=4nCCpbj2dbYIGvXpgLRqLmP/I/HdIol6cqVX+ryUpdE=; b=fqr/n8FgQsdRQLfIflnAeqJTmbiV6OHzcdqoZFV72eqDN1PNmxx7Z/ZU76YiIXnPYjEPuy u7iRdLlTFDtdJNxfF+RDFHXyCw2bfyjeMH8JblKavHqVOJBspe1+/21BA63PqcR0AkegGK +k1oCHYE/7exFruyhtWdJ/a6r14wzQ4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-58-eZYDRng_Prubad1CHcvGSQ-1; Tue, 20 Jun 2023 09:58:44 -0400 X-MC-Unique: eZYDRng_Prubad1CHcvGSQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7B8908631DB for ; Tue, 20 Jun 2023 13:58:44 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.ntdv.lab.eng.bos.redhat.com [10.19.188.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B4EB112132C; Tue, 20 Jun 2023 13:58:44 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 20 Jun 2023 15:58:43 +0200 Message-Id: <20230620135843.2273523-2-xsimonar@redhat.com> In-Reply-To: <20230620135843.2273523-1-xsimonar@redhat.com> References: <20230607172834.3851733-2-xsimonar@redhat.com> <20230620135843.2273523-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2 2/2] binding: fixed qos when no iface X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Before this patch, if iface did not exist when qos I+P was run the first time a qos queue was still created and qos I+P was not applying qos to OVS. qos was potentially applied later, if/when (for any reason) runtime_data had to be recomputed. Fixes: 7d1d111ff213 ("controller: configure qos through ovs qos table and do not run tc directly") Signed-off-by: Xavier Simonart Acked-by: Ales Musil --- v2: - handled Lorenzo's comments - updated test case to also test null network (as referenced by Lorenzo) - rebased on origin/main --- controller/binding.c | 26 ++++++++++++-------------- tests/ovn.at | 8 ++++++++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 8069a2e0d..355b73070 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -362,7 +362,7 @@ configure_qos(const struct sbrec_port_binding *pb, struct qos_queue *q = find_qos_queue(b_ctx_out->qos_map, hash, pb->logical_port); if (!q || q->min_rate != min_rate || q->max_rate != max_rate || - q->burst != burst) { + q->burst != burst || (network && strcmp(network, q->network))) { struct shash bridge_mappings = SHASH_INITIALIZER(&bridge_mappings); add_ovs_bridge_mappings(b_ctx_in->ovs_table, b_ctx_in->bridge_table, &bridge_mappings); @@ -378,22 +378,20 @@ configure_qos(const struct sbrec_port_binding *pb, add_ovs_qos_table_entry(b_ctx_in->ovs_idl_txn, port, min_rate, max_rate, burst, queue_id, pb->logical_port); + if (!q) { + q = xzalloc(sizeof *q); + hmap_insert(b_ctx_out->qos_map, &q->node, hash); + q->port = xstrdup(pb->logical_port); + q->queue_id = queue_id; + } + free(q->network); + q->network = network ? xstrdup(network) : NULL; + q->min_rate = min_rate; + q->max_rate = max_rate; + q->burst = burst; } shash_destroy(&bridge_mappings); } - - if (!q) { - q = xzalloc(sizeof *q); - hmap_insert(b_ctx_out->qos_map, &q->node, hash); - q->port = xstrdup(pb->logical_port); - q->queue_id = queue_id; - } - - free(q->network); - q->network = network ? xstrdup(network) : NULL; - q->min_rate = min_rate; - q->max_rate = max_rate; - q->burst = burst; } static const struct ovsrec_queue * diff --git a/tests/ovn.at b/tests/ovn.at index 2c221a05c..8d69c35d9 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -36235,6 +36235,7 @@ check ovn-nbctl ls-add ls1 check ovn-nbctl lsp-add ls1 public1 check ovn-nbctl lsp-set-addresses public1 unknown check ovn-nbctl lsp-set-type public1 localnet +check ovn-nbctl lsp-set-options public1 network_name=phys check ovn-nbctl lsp-add ls1 lsp5 check ovn-nbctl lsp-set-addresses lsp5 f0:00:00:00:00:05 @@ -36244,6 +36245,12 @@ ovs-vsctl add-port br-int vif5 -- \ ofport-request=5 OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp5` = xup]) +# Delete and add back public1 +check ovn-nbctl --wait=hv lsp-del public1 +check ovn-nbctl lsp-add ls1 public1 +check ovn-nbctl lsp-set-addresses public1 unknown +check ovn-nbctl lsp-set-type public1 localnet + check ovn-nbctl set Logical_Switch_Port public1 options:qos_min_rate=6000000000 check ovn-nbctl set Logical_Switch_Port public1 options:qos_max_rate=7000000000 check ovn-nbctl set Logical_Switch_Port public1 options:qos_burst=8000000000 @@ -36509,6 +36516,7 @@ check ovn-nbctl lsp-add ls2 public2 check ovn-nbctl lsp-set-addresses public2 unknown check ovn-nbctl lsp-set-type public2 localnet check ovn-nbctl --wait=sb set Logical_Switch_Port public2 options:qos_min_rate=6000000000 options:qos_max_rate=7000000000 options:qos_burst=8000000000 options:network_name=phys +check ovn-nbctl --wait=sb lsp-set-options public2 qos_min_rate=6000000000 qos_max_rate=7000000000 qos_burst=8000000000 # Let's now send ovn controller to sleep, so it will receive both ofport notification and ls deletion simultaneously sleep_controller hv-1