From patchwork Wed May 10 14:21:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779528 X-Patchwork-Delegate: nusiddiq@redhat.com 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=2605:bc80:3010::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=ixNTZuXw; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::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 4QGcfn0g3Gz214M for ; Thu, 11 May 2023 00:22:08 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C7F6642732; Wed, 10 May 2023 14:22:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C7F6642732 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=ixNTZuXw 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 AZYpB3LiT0Sy; Wed, 10 May 2023 14:22:01 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9A95742702; Wed, 10 May 2023 14:22:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9A95742702 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5A4EEC007C; Wed, 10 May 2023 14:22:00 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id C28B5C0036 for ; Wed, 10 May 2023 14:21:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9646942708 for ; Wed, 10 May 2023 14:21:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9646942708 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 CkeFteqmpErf for ; Wed, 10 May 2023 14:21:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 810804211E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 810804211E for ; Wed, 10 May 2023 14:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728514; 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=46Ei0B5mnlgvnHVnvRE2NiGPmVm016yOVbM3JwVpSiY=; b=ixNTZuXwo3Q2Ru+Qwd7Uvpm3DeiQb7/b0E2oUIScf7xihs94jt+qoCaFsiQ4kdSutVSkwI pgZLlE00XCrB0ZIT+oK0W6eN9B13lUmsmqqcDz2hHpzRnUr+o5KOGb6LRgV2HNR6huomue CPo728z/T1aGtH+26YjAW4B1r5ycUzc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-Pwhod2ZwO-GEV_Vvm1ZLiw-1; Wed, 10 May 2023 10:21:53 -0400 X-MC-Unique: Pwhod2ZwO-GEV_Vvm1ZLiw-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-307814dd87eso2267887f8f.0 for ; Wed, 10 May 2023 07:21:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728511; x=1686320511; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=46Ei0B5mnlgvnHVnvRE2NiGPmVm016yOVbM3JwVpSiY=; b=IX4MiPxHnH5ZxVNvuohKanY1q2LX/HvkCLtv6x4ZS0HPS4WIVNifkBXxS/7C6fOaXx KU13r75GO6AASiedZ47OBE09LpdoxGvKBGyjU4MJEP8A8F5UjNpBPS9WyIap6Qr7WPmp NPdSkaSIaQ+cRnE8LJYrsJ+RFYMekYUX/IqxXNkwQPG+WL+4pAJlaY5WXPqLftvmULA8 qP5FZW5moY82W/D+9liAgug2wU0366xqD6DR9HRrs2rT3mFFunnLCWjnhJhD5ku3Yzvq jAniL+x6jw4BueFArQYAU3/ivXoAd3+8mtFgB5iu9jnkl04tiwmPNqAbWPYuXzyno29z mzMQ== X-Gm-Message-State: AC+VfDxxH33p4q+0YNXZmeDgj83CyHzxu6j6e9agWxt8yAvUpmNQFmke L/ndK4XWzWkJjybl5E5JsjlWpOBcJOHDWnejbwNofF/TRaRoUnVYUcKxncUg6Z5+umrFhg5bGe/ PPNH1VzEuWg5gvJxDbQMjsPQfIkuT6la3HqRXgFof0k/y1eqmGtlGB6HcgIrcgeHFxeZXEEc5W8 MrkVCGWP43RvG0 X-Received: by 2002:adf:dbc8:0:b0:307:8b3e:2858 with SMTP id e8-20020adfdbc8000000b003078b3e2858mr9441256wrj.45.1683728511754; Wed, 10 May 2023 07:21:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VRpKtjFizOsgMrQ3BYmh7ojCMkCvnHFrU6jHesxbFnB1gv2yGkaZBo4cGjdJ4S6B5keJpew== X-Received: by 2002:adf:dbc8:0:b0:307:8b3e:2858 with SMTP id e8-20020adfdbc8000000b003078b3e2858mr9441239wrj.45.1683728511392; Wed, 10 May 2023 07:21:51 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id z11-20020a5d4c8b000000b003079d61a107sm7437254wrs.25.2023.05.10.07.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:21:51 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:23 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 1/9] controller: remove tunnel interfaces from egress_ifaces sset 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" Remove tunnel interfaces from egress list in order to not shape them. Acked-By: Ihar Hrachyshka Tested-by: Rodolfo Alonso Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index bd810f669..a0fbacc97 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1938,15 +1938,6 @@ build_local_bindings(struct binding_ctx_in *b_ctx_in, smap_replace(b_ctx_out->local_iface_ids, iface_rec->name, iface_id); } - - /* Check if this is a tunnel interface. */ - if (smap_get(&iface_rec->options, "remote_ip")) { - const char *tunnel_iface - = smap_get(&iface_rec->status, "tunnel_egress_iface"); - if (tunnel_iface) { - sset_add(b_ctx_out->egress_ifaces, tunnel_iface); - } - } } } } From patchwork Wed May 10 14:21:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779529 X-Patchwork-Delegate: nusiddiq@redhat.com 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=2605:bc80:3010::138; helo=smtp1.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=LAUGzNfd; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QGcfp0sNlz214c for ; Thu, 11 May 2023 00:22:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E794D84657; Wed, 10 May 2023 14:22:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E794D84657 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=LAUGzNfd X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IzFTL2hdgRC5; Wed, 10 May 2023 14:22:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6427E845C3; Wed, 10 May 2023 14:22:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6427E845C3 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1ECD0C007C; Wed, 10 May 2023 14:22:03 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8F979C0036 for ; Wed, 10 May 2023 14:22:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 69D7984346 for ; Wed, 10 May 2023 14:22:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 69D7984346 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g1zU0Okvwmhc for ; Wed, 10 May 2023 14:21:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 45E6D843F3 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 45E6D843F3 for ; Wed, 10 May 2023 14:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728516; 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=8S9vyS9IOorIZdJqs4G2SKHEJd3J9utDN660H4/oGN8=; b=LAUGzNfdl500B1s/GVPs3kyQTnM875nWCz+nHsxXLjWKqS3piN3eGToeqIUtJ9Yzx8hj01 nnH16w27FzQALDmhSN6muuGz+XCh7OsNVtsB+6sqAu9+jDOUo8PR2JSBqLeJ7f4VUfcXLp Z1ps4SAnkMSlKNRe/JqImhK55lv7Jso= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-ABJglfFPPHqFIT_alUIC5w-1; Wed, 10 May 2023 10:21:55 -0400 X-MC-Unique: ABJglfFPPHqFIT_alUIC5w-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f453ff4cdfso4461335e9.2 for ; Wed, 10 May 2023 07:21:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728514; x=1686320514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8S9vyS9IOorIZdJqs4G2SKHEJd3J9utDN660H4/oGN8=; b=L1ni/oEwkYs1wFDu4EZP0rZec5rcnFf4PDajPWD7RSKpRCZ06Pez97oeCBVz/W/GMw 1xYxTwI91m7ieBBRMu6rxd0pi3hqyStasP1sP6up7FrNgjpGvt5KY/6xPMoFeSAhGGG+ dAP/NuQ9faBs+byee7HyURLGnT1aywaUDTe3WAzhiOh3NEqLorBGg8pTq++E9GqQCeZv iM2UK84HsdYttAwSUpIhvoIqsmuxgovbxf0+dUo9vIwjiL4g9KmK3PzYsQkhVz78w7YO MItm5U7Yl3fZLa3TcH3YVNDlWd1kJ8oN5NRqvX08tR2tsLNwM594y5v35IL3WWKpflOb An4A== X-Gm-Message-State: AC+VfDxoOzXrGUEq3W+C2pZ1vNZIfQO1tgqKaDYw/7h1BJzOT27/vmhu 0RhgqKwWCCaO1r62j0QS3kJqVO9nX689s8BqBZeGGRtKvJhZIL7TcVHI52TyMXDODts8d/TJQ7v yLFc3Ync96AIkrHY3zJu5RZMz170k5plSdJuRNObjhS1OOVvxPBYfjX+I+gn+7ZhQ3dUwSouqol BrCJuLpgLmixyK X-Received: by 2002:a7b:cd89:0:b0:3f4:247c:b00a with SMTP id y9-20020a7bcd89000000b003f4247cb00amr7696415wmj.15.1683728514037; Wed, 10 May 2023 07:21:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6O21mRznB4rk0CVIONUd7DcHRyz/CkGq11feRwEj76QT+gekmbHtKGIL8VnjgkGFqfmlRcOg== X-Received: by 2002:a7b:cd89:0:b0:3f4:247c:b00a with SMTP id y9-20020a7bcd89000000b003f4247cb00amr7696388wmj.15.1683728513606; Wed, 10 May 2023 07:21:53 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id f5-20020a1c6a05000000b003f4266965fbsm8603480wmc.5.2023.05.10.07.21.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:21:53 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:24 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 2/9] controller: add incremental processing for ovn-controller qos_map 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" This is a preliminary patch to rework OVN QoS implementation in order to configure it through OVS QoS table instead of running tc command directly bypassing OVS. Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 254 +++++++++++++++++++++--------------- controller/binding.h | 3 + controller/ovn-controller.c | 8 +- 3 files changed, 162 insertions(+), 103 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index a0fbacc97..b9bcb5389 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -109,14 +109,6 @@ binding_wait(void) } } -struct qos_queue { - struct hmap_node node; - uint32_t queue_id; - uint32_t min_rate; - uint32_t max_rate; - uint32_t burst; -}; - void binding_register_ovs_idl(struct ovsdb_idl *ovs_idl) { @@ -147,8 +139,96 @@ static void update_lport_tracking(const struct sbrec_port_binding *pb, struct hmap *tracked_dp_bindings, bool claimed); +struct qos_queue { + struct hmap_node node; + + char *port; + bool stale; + + uint32_t queue_id; + uint32_t min_rate; + uint32_t max_rate; + uint32_t burst; +}; + +static struct qos_queue * +find_qos_queue(struct hmap *queue_map, uint32_t hash, const char *port, + uint32_t min_rate, uint32_t max_rate, uint32_t burst, + uint32_t queue_id) +{ + struct qos_queue *q; + HMAP_FOR_EACH_WITH_HASH (q, node, hash, queue_map) { + if (strcmp(q->port, port)) { + continue; + } + + if (q->min_rate == min_rate && q->max_rate == max_rate && + q->burst == burst && q->queue_id == queue_id) { + return q; + } + } + + return NULL; +} + +static bool +qos_queue_is_changed(const struct sbrec_port_binding *pb, + struct qos_queue *q) +{ + uint32_t queue_id = smap_get_int(&pb->options, "qdisc_queue_id", 0); + if (queue_id != q->queue_id) { + return true; + } + + uint32_t min_rate = smap_get_int(&pb->options, "qos_min_rate", 0); + if (min_rate != q->min_rate) { + return true; + } + + uint32_t max_rate = smap_get_int(&pb->options, "qos_max_rate", 0); + if (max_rate != q->max_rate) { + return true; + } + + uint32_t burst = smap_get_int(&pb->options, "qos_burst", 0); + return burst != q->burst; +} + +static void +qos_queue_gc(const struct sbrec_port_binding *pb, struct hmap *queue_map) +{ + struct qos_queue *q; + HMAP_FOR_EACH (q, node, queue_map) { + if (strcmp(q->port, pb->logical_port)) { + continue; + } + + q->stale = sbrec_port_binding_is_deleted(pb) || + qos_queue_is_changed(pb, q); + } + + HMAP_FOR_EACH_SAFE (q, node, queue_map) { + if (q->stale) { + hmap_remove(queue_map, &q->node); + free(q->port); + free(q); + } + } +} + +void +destroy_qos_map(struct hmap *qos_map) +{ + struct qos_queue *q; + HMAP_FOR_EACH_POP (q, node, qos_map) { + free(q->port); + free(q); + } + hmap_destroy(qos_map); +} + static void -get_qos_params(const struct sbrec_port_binding *pb, struct hmap *queue_map) +get_qos_queue(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); @@ -160,12 +240,18 @@ get_qos_params(const struct sbrec_port_binding *pb, struct hmap *queue_map) 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; + uint32_t hash = hash_int(queue_id, 0); + struct qos_queue *q = find_qos_queue(queue_map, hash, pb->logical_port, + min_rate, max_rate, burst, queue_id); + if (!q) { + q = xzalloc(sizeof *q); + hmap_insert(queue_map, &q->node, hash); + q->port = xstrdup(pb->logical_port); + q->min_rate = min_rate; + q->max_rate = max_rate; + q->burst = burst; + q->queue_id = queue_id; + } } static const struct ovsrec_qos * @@ -354,17 +440,6 @@ setup_qos(const char *egress_iface, struct hmap *queue_map) netdev_close(netdev_phy); } -static void -destroy_qos_map(struct hmap *qos_map) -{ - struct qos_queue *qos_queue; - HMAP_FOR_EACH_POP (qos_queue, node, qos_map) { - free(qos_queue); - } - - hmap_destroy(qos_map); -} - /* * Get the encap from the chassis for this port. The interface * may have an external_ids:encap-ip= set; if so we @@ -651,7 +726,7 @@ static struct binding_lport *local_binding_get_primary_or_localport_lport( static bool local_binding_handle_stale_binding_lports( struct local_binding *lbinding, struct binding_ctx_in *b_ctx_in, - struct binding_ctx_out *b_ctx_out, struct hmap *qos_map); + struct binding_ctx_out *b_ctx_out); static struct binding_lport *binding_lport_create( const struct sbrec_port_binding *, @@ -1469,8 +1544,7 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, bool can_bind, struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out, - struct binding_lport *b_lport, - struct hmap *qos_map) + struct binding_lport *b_lport) { bool lbinding_set = b_lport && is_lbinding_set(b_lport->lbinding); @@ -1502,8 +1576,8 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, tracked_datapath_lport_add(pb, TRACKED_RESOURCE_UPDATED, b_ctx_out->tracked_dp_bindings); } - if (b_lport->lbinding->iface && qos_map && b_ctx_in->ovs_idl_txn) { - get_qos_params(pb, qos_map); + if (b_lport->lbinding->iface && b_ctx_in->ovs_idl_txn) { + get_qos_queue(pb, b_ctx_out->qos_map); } } else { /* We could, but can't claim the lport. */ @@ -1537,8 +1611,7 @@ static bool consider_vif_lport(const struct sbrec_port_binding *pb, struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out, - struct local_binding *lbinding, - struct hmap *qos_map) + struct local_binding *lbinding) { bool can_bind = lport_can_bind_on_this_chassis(b_ctx_in->chassis_rec, pb); @@ -1570,15 +1643,13 @@ consider_vif_lport(const struct sbrec_port_binding *pb, } } - return consider_vif_lport_(pb, can_bind, b_ctx_in, b_ctx_out, - b_lport, qos_map); + return consider_vif_lport_(pb, can_bind, b_ctx_in, b_ctx_out, b_lport); } static bool consider_container_lport(const struct sbrec_port_binding *pb, struct binding_ctx_in *b_ctx_in, - struct binding_ctx_out *b_ctx_out, - struct hmap *qos_map) + struct binding_ctx_out *b_ctx_out) { struct shash *local_bindings = &b_ctx_out->lbinding_data->bindings; struct local_binding *parent_lbinding; @@ -1627,7 +1698,7 @@ consider_container_lport(const struct sbrec_port_binding *pb, /* Its possible that the parent lport is not considered yet. * So call consider_vif_lport() to process it first. */ consider_vif_lport(parent_pb, b_ctx_in, b_ctx_out, - parent_lbinding, qos_map); + parent_lbinding); parent_b_lport = binding_lport_find(binding_lports, pb->parent_port); } else { @@ -1659,14 +1730,13 @@ consider_container_lport(const struct sbrec_port_binding *pb, bool can_bind = lport_can_bind_on_this_chassis(b_ctx_in->chassis_rec, pb); return consider_vif_lport_(pb, can_bind, b_ctx_in, b_ctx_out, - container_b_lport, qos_map); + container_b_lport); } static bool consider_virtual_lport(const struct sbrec_port_binding *pb, struct binding_ctx_in *b_ctx_in, - struct binding_ctx_out *b_ctx_out, - struct hmap *qos_map) + struct binding_ctx_out *b_ctx_out) { struct shash *local_bindings = &b_ctx_out->lbinding_data->bindings; struct local_binding *parent_lbinding = @@ -1694,7 +1764,7 @@ consider_virtual_lport(const struct sbrec_port_binding *pb, /* Its possible that the parent lport is not considered yet. * So call consider_vif_lport() to process it first. */ consider_vif_lport(parent_pb, b_ctx_in, b_ctx_out, - parent_lbinding, qos_map); + parent_lbinding); } } @@ -1708,7 +1778,7 @@ consider_virtual_lport(const struct sbrec_port_binding *pb, } if (!consider_vif_lport_(pb, true, b_ctx_in, b_ctx_out, - virtual_b_lport, qos_map)) { + virtual_b_lport)) { return false; } @@ -1826,15 +1896,14 @@ consider_l3gw_lport(const struct sbrec_port_binding *pb, static void consider_localnet_lport(const struct sbrec_port_binding *pb, struct binding_ctx_in *b_ctx_in, - struct binding_ctx_out *b_ctx_out, - struct hmap *qos_map) + struct binding_ctx_out *b_ctx_out) { /* Add all localnet ports to local_ifaces so that we allocate ct zones * for them. */ update_local_lports(pb->logical_port, b_ctx_out); - if (qos_map && b_ctx_in->ovs_idl_txn) { - get_qos_params(pb, qos_map); + if (b_ctx_in->ovs_idl_txn) { + get_qos_queue(pb, b_ctx_out->qos_map); } update_related_lport(pb, b_ctx_out); @@ -1950,16 +2019,11 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) } struct shash bridge_mappings = SHASH_INITIALIZER(&bridge_mappings); - struct hmap qos_map; - hmap_init(&qos_map); if (b_ctx_in->br_int) { build_local_bindings(b_ctx_in, b_ctx_out); } - struct hmap *qos_map_ptr = - !sset_is_empty(b_ctx_out->egress_ifaces) ? &qos_map : NULL; - struct ovs_list localnet_lports = OVS_LIST_INITIALIZER(&localnet_lports); struct ovs_list external_lports = OVS_LIST_INITIALIZER(&external_lports); struct ovs_list multichassis_ports = OVS_LIST_INITIALIZER( @@ -1996,7 +2060,7 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) break; case LP_VIF: - consider_vif_lport(pb, b_ctx_in, b_ctx_out, NULL, qos_map_ptr); + consider_vif_lport(pb, b_ctx_in, b_ctx_out, NULL); if (pb->additional_chassis) { struct lport *multichassis_lport = xmalloc( sizeof *multichassis_lport); @@ -2007,11 +2071,11 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) break; case LP_CONTAINER: - consider_container_lport(pb, b_ctx_in, b_ctx_out, qos_map_ptr); + consider_container_lport(pb, b_ctx_in, b_ctx_out); break; case LP_VIRTUAL: - consider_virtual_lport(pb, b_ctx_in, b_ctx_out, qos_map_ptr); + consider_virtual_lport(pb, b_ctx_in, b_ctx_out); break; case LP_L2GATEWAY: @@ -2034,7 +2098,7 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) break; case LP_LOCALNET: { - consider_localnet_lport(pb, b_ctx_in, b_ctx_out, &qos_map); + consider_localnet_lport(pb, b_ctx_in, b_ctx_out); struct lport *lnet_lport = xmalloc(sizeof *lnet_lport); lnet_lport->pb = pb; ovs_list_push_back(&localnet_lports, &lnet_lport->list_node); @@ -2096,12 +2160,10 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) b_ctx_in->qos_table, b_ctx_out->egress_ifaces)) { const char *entry; SSET_FOR_EACH (entry, b_ctx_out->egress_ifaces) { - setup_qos(entry, &qos_map); + setup_qos(entry, b_ctx_out->qos_map); } } - destroy_qos_map(&qos_map); - cleanup_claimed_port_timestamps(); } @@ -2190,8 +2252,7 @@ static bool consider_iface_claim(const struct ovsrec_interface *iface_rec, const char *iface_id, struct binding_ctx_in *b_ctx_in, - struct binding_ctx_out *b_ctx_out, - struct hmap *qos_map) + struct binding_ctx_out *b_ctx_out) { update_local_lports(iface_id, b_ctx_out); smap_replace(b_ctx_out->local_iface_ids, iface_rec->name, iface_id); @@ -2239,7 +2300,7 @@ consider_iface_claim(const struct ovsrec_interface *iface_rec, } if (lport_type == LP_VIF && - !consider_vif_lport(pb, b_ctx_in, b_ctx_out, lbinding, qos_map)) { + !consider_vif_lport(pb, b_ctx_in, b_ctx_out, lbinding)) { return false; } @@ -2250,8 +2311,7 @@ consider_iface_claim(const struct ovsrec_interface *iface_rec, * claim the container lbindings. */ LIST_FOR_EACH (b_lport, list_node, &lbinding->binding_lports) { if (b_lport->type == LP_CONTAINER) { - if (!consider_container_lport(b_lport->pb, b_ctx_in, b_ctx_out, - qos_map)) { + if (!consider_container_lport(b_lport->pb, b_ctx_in, b_ctx_out)) { return false; } } @@ -2538,10 +2598,6 @@ binding_handle_ovs_interface_changes(struct binding_ctx_in *b_ctx_in, return false; } - struct hmap qos_map = HMAP_INITIALIZER(&qos_map); - struct hmap *qos_map_ptr = - sset_is_empty(b_ctx_out->egress_ifaces) ? NULL : &qos_map; - /* * We consider an OVS interface for claiming if the following * 2 conditions are met: @@ -2570,24 +2626,22 @@ binding_handle_ovs_interface_changes(struct binding_ctx_in *b_ctx_in, if (iface_id && ofport > 0 && is_iface_in_int_bridge(iface_rec, b_ctx_in->br_int)) { handled = consider_iface_claim(iface_rec, iface_id, b_ctx_in, - b_ctx_out, qos_map_ptr); + b_ctx_out); if (!handled) { break; } } } - if (handled && qos_map_ptr && set_noop_qos(b_ctx_in->ovs_idl_txn, - b_ctx_in->port_table, - b_ctx_in->qos_table, - b_ctx_out->egress_ifaces)) { + if (handled && set_noop_qos(b_ctx_in->ovs_idl_txn, b_ctx_in->port_table, + b_ctx_in->qos_table, + b_ctx_out->egress_ifaces)) { const char *entry; SSET_FOR_EACH (entry, b_ctx_out->egress_ifaces) { - setup_qos(entry, &qos_map); + setup_qos(entry, b_ctx_out->qos_map); } } - destroy_qos_map(&qos_map); return handled; } @@ -2686,18 +2740,17 @@ static bool handle_updated_vif_lport(const struct sbrec_port_binding *pb, enum en_lport_type lport_type, struct binding_ctx_in *b_ctx_in, - struct binding_ctx_out *b_ctx_out, - struct hmap *qos_map) + struct binding_ctx_out *b_ctx_out) { bool claimed = (pb->chassis == b_ctx_in->chassis_rec); bool handled = true; if (lport_type == LP_VIRTUAL) { - handled = consider_virtual_lport(pb, b_ctx_in, b_ctx_out, qos_map); + handled = consider_virtual_lport(pb, b_ctx_in, b_ctx_out); } else if (lport_type == LP_CONTAINER) { - handled = consider_container_lport(pb, b_ctx_in, b_ctx_out, qos_map); + handled = consider_container_lport(pb, b_ctx_in, b_ctx_out); } else { - handled = consider_vif_lport(pb, b_ctx_in, b_ctx_out, NULL, qos_map); + handled = consider_vif_lport(pb, b_ctx_in, b_ctx_out, NULL); } if (!handled) { @@ -2727,7 +2780,7 @@ handle_updated_vif_lport(const struct sbrec_port_binding *pb, LIST_FOR_EACH (b_lport, list_node, &lbinding->binding_lports) { if (b_lport->type == LP_CONTAINER) { handled = consider_container_lport(b_lport->pb, b_ctx_in, - b_ctx_out, qos_map); + b_ctx_out); if (!handled) { return false; } @@ -2792,8 +2845,7 @@ consider_patch_port_for_local_datapaths(const struct sbrec_port_binding *pb, static bool handle_updated_port(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out, - const struct sbrec_port_binding *pb, - struct hmap *qos_map_ptr) + const struct sbrec_port_binding *pb) { update_active_pb_ras_pd(pb, b_ctx_out->local_active_ports_ipv6_pd, "ipv6_prefix_delegation"); @@ -2815,7 +2867,7 @@ handle_updated_port(struct binding_ctx_in *b_ctx_in, if (b_lport->lbinding) { if (!local_binding_handle_stale_binding_lports( - b_lport->lbinding, b_ctx_in, b_ctx_out, qos_map_ptr)) { + b_lport->lbinding, b_ctx_in, b_ctx_out)) { return false; } } @@ -2829,7 +2881,7 @@ handle_updated_port(struct binding_ctx_in *b_ctx_in, case LP_VIRTUAL: update_ld_multichassis_ports(pb, b_ctx_out->local_datapaths); handled = handle_updated_vif_lport(pb, lport_type, b_ctx_in, - b_ctx_out, qos_map_ptr); + b_ctx_out); break; case LP_LOCALPORT: @@ -2889,7 +2941,7 @@ handle_updated_port(struct binding_ctx_in *b_ctx_in, break; case LP_LOCALNET: { - consider_localnet_lport(pb, b_ctx_in, b_ctx_out, qos_map_ptr); + consider_localnet_lport(pb, b_ctx_in, b_ctx_out); struct shash bridge_mappings = SHASH_INITIALIZER(&bridge_mappings); @@ -2977,6 +3029,8 @@ binding_handle_port_binding_changes(struct binding_ctx_in *b_ctx_in, } else { shash_add(&deleted_other_pbs, pb->logical_port, pb); } + + qos_queue_gc(pb, b_ctx_out->qos_map); } struct shash_node *node; @@ -3029,10 +3083,6 @@ delete_done: return false; } - struct hmap qos_map = HMAP_INITIALIZER(&qos_map); - struct hmap *qos_map_ptr = - sset_is_empty(b_ctx_out->egress_ifaces) ? NULL : &qos_map; - SBREC_PORT_BINDING_TABLE_FOR_EACH_TRACKED (pb, b_ctx_in->port_binding_table) { /* Loop to handle create and update changes only. */ @@ -3044,10 +3094,12 @@ delete_done: update_ld_peers(pb, b_ctx_out->local_datapaths); } - handled = handle_updated_port(b_ctx_in, b_ctx_out, pb, qos_map_ptr); + handled = handle_updated_port(b_ctx_in, b_ctx_out, pb); if (!handled) { break; } + + qos_queue_gc(pb, b_ctx_out->qos_map); } /* Also handle any postponed (throttled) ports. */ @@ -3061,7 +3113,7 @@ delete_done: sset_find_and_delete(b_ctx_out->postponed_ports, port_name); continue; } - handled = handle_updated_port(b_ctx_in, b_ctx_out, pb, qos_map_ptr); + handled = handle_updated_port(b_ctx_in, b_ctx_out, pb); if (!handled) { break; } @@ -3107,17 +3159,15 @@ delete_done: shash_destroy(&bridge_mappings); } - if (handled && qos_map_ptr && set_noop_qos(b_ctx_in->ovs_idl_txn, - b_ctx_in->port_table, - b_ctx_in->qos_table, - b_ctx_out->egress_ifaces)) { + if (handled && set_noop_qos(b_ctx_in->ovs_idl_txn, b_ctx_in->port_table, + b_ctx_in->qos_table, + b_ctx_out->egress_ifaces)) { const char *entry; SSET_FOR_EACH (entry, b_ctx_out->egress_ifaces) { - setup_qos(entry, &qos_map); + setup_qos(entry, b_ctx_out->qos_map); } } - destroy_qos_map(&qos_map); return handled; } @@ -3265,8 +3315,7 @@ local_binding_add_lport(struct shash *binding_lports, static bool local_binding_handle_stale_binding_lports(struct local_binding *lbinding, struct binding_ctx_in *b_ctx_in, - struct binding_ctx_out *b_ctx_out, - struct hmap *qos_map) + struct binding_ctx_out *b_ctx_out) { /* Check if this lbinding has a primary binding_lport or * localport binding_lport or not. */ @@ -3288,14 +3337,15 @@ local_binding_handle_stale_binding_lports(struct local_binding *lbinding, pb = b_lport->pb; binding_lport_delete(&b_ctx_out->lbinding_data->lports, b_lport); - handled = consider_virtual_lport(pb, b_ctx_in, b_ctx_out, qos_map); + handled = consider_virtual_lport(pb, b_ctx_in, b_ctx_out); } else if (b_lport->type == LP_CONTAINER && pb_lport_type == LP_CONTAINER) { /* For container lport, binding_lport is preserved so that when * the parent port is created, it can be considered. * consider_container_lport() creates the binding_lport for the parent * port (with iface set to NULL). */ - handled = consider_container_lport(b_lport->pb, b_ctx_in, b_ctx_out, qos_map); + handled = consider_container_lport(b_lport->pb, b_ctx_in, + b_ctx_out); } else { /* This can happen when the lport type changes from one type * to another. Eg. from normal lport to external. Release the diff --git a/controller/binding.h b/controller/binding.h index 5b73c6a4b..87ee7b540 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -92,6 +92,7 @@ struct binding_ctx_out { bool non_vif_ports_changed; struct sset *egress_ifaces; + struct hmap *qos_map; /* smap of OVS interface name as key and * OVS interface external_ids:iface-id as value. */ struct smap *local_iface_ids; @@ -260,4 +261,6 @@ void binding_wait(void); /* Clean up module state. */ void binding_destroy(void); +void destroy_qos_map(struct hmap *); + #endif /* controller/binding.h */ diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index de90025f0..ee0e495ba 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1341,6 +1341,7 @@ struct ed_type_runtime_data { /* runtime data engine private data. */ struct sset egress_ifaces; + struct hmap qos_map; struct smap local_iface_ids; /* Tracked data. See below for more details and comments. */ @@ -1400,7 +1401,7 @@ struct ed_type_runtime_data { * --------------------------------------------------------------------- * | local_iface_ids | This is used internally within the runtime data | * | egress_ifaces | engine (used only in binding.c) and hence there | - * | | there is no need to track. | + * | qos_map | there is no need to track. | * --------------------------------------------------------------------- * | | Active tunnels is built in the | * | | bfd_calculate_active_tunnels() for the tunnel | @@ -1437,6 +1438,7 @@ en_runtime_data_init(struct engine_node *node OVS_UNUSED, related_lports_init(&data->related_lports); sset_init(&data->active_tunnels); sset_init(&data->egress_ifaces); + hmap_init(&data->qos_map); smap_init(&data->local_iface_ids); local_binding_data_init(&data->lbinding_data); shash_init(&data->local_active_ports_ipv6_pd); @@ -1457,6 +1459,7 @@ en_runtime_data_cleanup(void *data) related_lports_destroy(&rt_data->related_lports); sset_destroy(&rt_data->active_tunnels); sset_destroy(&rt_data->egress_ifaces); + destroy_qos_map(&rt_data->qos_map); smap_destroy(&rt_data->local_iface_ids); local_datapaths_destroy(&rt_data->local_datapaths); shash_destroy(&rt_data->local_active_ports_ipv6_pd); @@ -1545,6 +1548,7 @@ init_binding_ctx(struct engine_node *node, b_ctx_out->related_lports_changed = false; b_ctx_out->non_vif_ports_changed = false; b_ctx_out->egress_ifaces = &rt_data->egress_ifaces; + b_ctx_out->qos_map = &rt_data->qos_map; b_ctx_out->lbinding_data = &rt_data->lbinding_data; b_ctx_out->local_iface_ids = &rt_data->local_iface_ids; b_ctx_out->postponed_ports = rt_data->postponed_ports; @@ -1575,12 +1579,14 @@ en_runtime_data_run(struct engine_node *node, void *data) related_lports_destroy(&rt_data->related_lports); sset_destroy(active_tunnels); sset_destroy(&rt_data->egress_ifaces); + destroy_qos_map(&rt_data->qos_map); smap_destroy(&rt_data->local_iface_ids); hmap_init(local_datapaths); sset_init(local_lports); related_lports_init(&rt_data->related_lports); sset_init(active_tunnels); sset_init(&rt_data->egress_ifaces); + hmap_init(&rt_data->qos_map); smap_init(&rt_data->local_iface_ids); local_binding_data_init(&rt_data->lbinding_data); } From patchwork Wed May 10 14:21:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779530 X-Patchwork-Delegate: nusiddiq@redhat.com 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=2605:bc80:3010::133; helo=smtp2.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=OzkDhDKE; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4QGcfq1n5rz214j for ; Thu, 11 May 2023 00:22:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 46ED84299B; Wed, 10 May 2023 14:22:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 46ED84299B Authentication-Results: smtp2.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=OzkDhDKE 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 tLlrYI2-ciB9; Wed, 10 May 2023 14:22:06 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id D1335429DF; Wed, 10 May 2023 14:22:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D1335429DF Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C583BC008E; Wed, 10 May 2023 14:22:03 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6FD4EC0036 for ; Wed, 10 May 2023 14:22:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4A75F6FE7B for ; Wed, 10 May 2023 14:22:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4A75F6FE7B Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OzkDhDKE 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 UXr23nGknzWo for ; Wed, 10 May 2023 14:22:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 23638616C9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 23638616C9 for ; Wed, 10 May 2023 14:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728519; 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=n+zAxeiLuzz5Hx1s94et9CTXEXY1fzbxwYshZ6mdRYU=; b=OzkDhDKEWI3kQ/8TOvrw++7fsMwBlcoVOsUXo56INw1k4dI7b+dcGnwcD6y0eYCbnHvmEh UJqP406zac44KA05IMC5Ymq9UaVHIZCCl7W5cFeDA03eZV7QbCdUnBlAm2pJNxvgX2IrpG sYhvPx3Xjrzg/GWdeIN6dENcBHj8WVM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-269-i_1XEN3sObePaVCrQB9adA-1; Wed, 10 May 2023 10:21:57 -0400 X-MC-Unique: i_1XEN3sObePaVCrQB9adA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f426ffdbc6so21575525e9.3 for ; Wed, 10 May 2023 07:21:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728516; x=1686320516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n+zAxeiLuzz5Hx1s94et9CTXEXY1fzbxwYshZ6mdRYU=; b=T3gdYmwM91M+Wl4tMq5NIai1/4VU2wWWHD+VSCvOCF4i6LyDi2WYAWQ45co4RuzlkD XMxbneZnuLtLJfPPrDpW+OEgKusprmcIJSrzOU8+UFGLcnqSBprlxuBVE4SbshbdDc25 kSzpOxhvRqgHYq0+Fyg0b2U+b+lNvU/zlZn4gMuzwsIbtqyu7N7c7tM7ZqNfeGGoTx/+ p8fSuv9wNIOy+hADGAfrHIkaJb5Mja+jzUtJv0Tnitv4uQ/bDJ5Lactb1tHh58iR0Vo4 huiWxbZ6+oKQPnLscCewP/t9/Rbq/1KdBE/keTp1Wr4oBGiTWewIbgqif5DVtrpiKhhW LnQw== X-Gm-Message-State: AC+VfDwFZZPb6rjCpZT8CAEt5S5aFpHcdJ2fOCbITv8/PyMu4UYOowcw ogIx7wAu16/waGOybEXT9ItyG0Q/MMMGCn+v2ypqydvEnGq83CwweIv+8xTK7QYT1i1qKuodncg 8TJ5R9XragEpaCtGP+B9S/8VANTz9TruIICsFyyFWj+7tlj4geP4kft3K6/AaNK8ZStZVP3F7mV TEnoxBjqNUpr1P X-Received: by 2002:adf:ee46:0:b0:2d2:f3e3:115d with SMTP id w6-20020adfee46000000b002d2f3e3115dmr13328204wro.59.1683728516157; Wed, 10 May 2023 07:21:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rv5mRb0nMwdPV1M50ZMmXtcXF34XtnywaUM0mHNaGpB537l3FJxSA39Dml66gW4eaN2IxXQ== X-Received: by 2002:adf:ee46:0:b0:2d2:f3e3:115d with SMTP id w6-20020adfee46000000b002d2f3e3115dmr13328182wro.59.1683728515888; Wed, 10 May 2023 07:21:55 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id r12-20020a5d494c000000b003077f3dfcc8sm16818991wrs.32.2023.05.10.07.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:21:55 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:25 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 3/9] northd: introduce qos_physical_network in port_binding other_config column 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" This is a preliminary patch to rework OVN QoS implementation in order to configure it through OVS QoS table instead of running tc command directly bypassing OVS. Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 7 ++++++- northd/northd.c | 8 ++++++++ ovn-sb.xml | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/controller/binding.c b/controller/binding.c index b9bcb5389..6854a162d 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -142,6 +142,7 @@ static void update_lport_tracking(const struct sbrec_port_binding *pb, struct qos_queue { struct hmap_node node; + char *network; char *port; bool stale; @@ -210,6 +211,7 @@ qos_queue_gc(const struct sbrec_port_binding *pb, struct hmap *queue_map) HMAP_FOR_EACH_SAFE (q, node, queue_map) { if (q->stale) { hmap_remove(queue_map, &q->node); + free(q->network); free(q->port); free(q); } @@ -221,6 +223,7 @@ destroy_qos_map(struct hmap *qos_map) { struct qos_queue *q; HMAP_FOR_EACH_POP (q, node, qos_map) { + free(q->network); free(q->port); free(q); } @@ -234,8 +237,9 @@ get_qos_queue(const struct sbrec_port_binding *pb, struct hmap *queue_map) 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); + const char *network = smap_get(&pb->options, "qos_physical_network"); - if ((!min_rate && !max_rate && !burst) || !queue_id) { + if ((!min_rate && !max_rate && !burst) || !queue_id || !network) { /* Qos is not configured for this port. */ return; } @@ -246,6 +250,7 @@ get_qos_queue(const struct sbrec_port_binding *pb, struct hmap *queue_map) if (!q) { q = xzalloc(sizeof *q); hmap_insert(queue_map, &q->node, hash); + q->network = xstrdup(network); q->port = xstrdup(pb->logical_port); q->min_rate = min_rate; q->max_rate = max_rate; diff --git a/northd/northd.c b/northd/northd.c index 25df0957e..53217347d 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -3505,7 +3505,15 @@ ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn, } smap_clone(&options, &op->nbsp->options); + if (queue_id) { + if (op->od->n_localnet_ports) { + struct ovn_port *port = op->od->localnet_ports[0]; + const char *physical_network = smap_get( + &port->nbsp->options, "network_name"); + smap_add(&options, "qos_physical_network", + physical_network); + } smap_add_format(&options, "qdisc_queue_id", "%d", queue_id); } diff --git a/ovn-sb.xml b/ovn-sb.xml index 8ca206109..d8c726dfa 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -3654,6 +3654,11 @@ tcp.flags = RST; interface, in bits. + + If set, indicates the name of the egress network name where traffic + shaping will be applied. + + Indicates the queue number on the physical device. This is same as the From patchwork Wed May 10 14:21:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779531 X-Patchwork-Delegate: nusiddiq@redhat.com 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.138; helo=smtp1.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=ejahrZFV; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 4QGcfw5rTQz214M for ; Thu, 11 May 2023 00:22:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4A71584692; Wed, 10 May 2023 14:22:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4A71584692 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=ejahrZFV X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Tj4JwmmkWr1m; Wed, 10 May 2023 14:22:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 13B0884676; Wed, 10 May 2023 14:22:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 13B0884676 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CD5BFC0036; Wed, 10 May 2023 14:22:08 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1ECFEC0089 for ; Wed, 10 May 2023 14:22:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 1AA67429F0 for ; Wed, 10 May 2023 14:22:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 1AA67429F0 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=ejahrZFV 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 oDbMvSroE-Bg for ; Wed, 10 May 2023 14:22:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 50D5F429C2 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 50D5F429C2 for ; Wed, 10 May 2023 14:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728522; 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=xB8178Xlwe/DfhMPApbDhqokEGggyBR2RtnZvCOEZvE=; b=ejahrZFVVH/XBGyHxE47hX5oYp8e4iuFPZg0T6ivlcWuHFxv8Zvo2KITXPXnK3aaHQV1et wTZp9u8gmj7nV5+H+HmggppSzntKuiWPoyIpipJu6/F4U6aoKiAHnPC0WnQEbwdxjC6Cl6 YAt1Gpgpf4u0EZP+jSmPvCgoY9DB+E8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-440-_NOMT8TeNVOKCpeGD0KUaw-1; Wed, 10 May 2023 10:22:00 -0400 X-MC-Unique: _NOMT8TeNVOKCpeGD0KUaw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f42ceb4a4fso7047175e9.0 for ; Wed, 10 May 2023 07:22:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728519; x=1686320519; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xB8178Xlwe/DfhMPApbDhqokEGggyBR2RtnZvCOEZvE=; b=OUp9/77ggrDjsN6S7ETwReE7MYoCT6tdOF5+/BfSo/wmyXe1CuC6zOIxKpuaTPMu1B gfK7FL2VVSk3E8ffnez1tm07VPvORv0dkTWrabCv0t7EBo2xdxRp+eFfi+ebUoJ/HvUY RiBpyO3ZsG9fCQdbLSvCJt1GRc14HmvjU2a27LCbbmbmzhiZfmde9xAL/hq3MsyenE/L 7VF317/WieC83jBpxtLwZaUN+wpg678M1ahh4nbzXJwdoYAB0jc2CMhnVSbzohqpTbSc sOt1PxMF4x/fs5/4y2qyx2KWNrZbU4ZwXnWm6XtoIdaYzASVpcbmgZvdxUA19uXbVeq7 8fgw== X-Gm-Message-State: AC+VfDzV06eKbx6Hpm1/JAV54mRRlAiOfYp/rzT+R0PgoR2OrgbconB6 u/RjXUA4Q28F2EuUIHgWRZxwjWSUmpZlFeGzigERYHlhsSVeZwe/fyMXzocEuhgma7GLQefdMfs T7/g29WEjJTS5hsb0b4+T5alKodPgP2nI/xoXx5sEzo5MFHghshqgsas0g2Jls1KtZjigDnConJ 14d/k6p3Ig8REj X-Received: by 2002:a5d:42cf:0:b0:306:3eca:1f59 with SMTP id t15-20020a5d42cf000000b003063eca1f59mr11036425wrr.36.1683728518630; Wed, 10 May 2023 07:21:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Z1pOo/dWl1EEHBsTmceoBf5eYJUQUKdDTmXXFb5i5da8MLisV1KQin5LzNQAEG59brpLjDQ== X-Received: by 2002:a5d:42cf:0:b0:306:3eca:1f59 with SMTP id t15-20020a5d42cf000000b003063eca1f59mr11036399wrr.36.1683728518140; Wed, 10 May 2023 07:21:58 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id x25-20020a1c7c19000000b003f42a75ac2asm5466807wmc.23.2023.05.10.07.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:21:57 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:26 +0200 Message-Id: <4a33b17ec27fd04701b836e013f9cb9e4dc8284d.1683728227.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 4/9] controller: configure qos through ovs qos table and do not run tc directly 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" Rework OVN QoS implementation in order to configure it through OVS QoS table instead of running tc command directly bypassing OVS. Acked-By: Ihar Hrachyshka Reviewed-by: Simon Horman Tested-by: Rodolfo Alonso Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 352 ++++++++++++++++++------------------ controller/ovn-controller.c | 6 + tests/system-ovn.at | 67 ++++++- 3 files changed, 241 insertions(+), 184 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 6854a162d..9182249ac 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -259,190 +259,198 @@ get_qos_queue(const struct sbrec_port_binding *pb, struct hmap *queue_map) } } -static const struct ovsrec_qos * -get_noop_qos(struct ovsdb_idl_txn *ovs_idl_txn, - const struct ovsrec_qos_table *qos_table) +static const struct ovsrec_interface * +get_qos_egress_port_interface(struct shash *bridge_mappings, + const struct ovsrec_port **pport, + const char *network) { - const struct ovsrec_qos *qos; - OVSREC_QOS_TABLE_FOR_EACH (qos, qos_table) { - if (!strcmp(qos->type, "linux-noop")) { - return qos; - } - } - - if (!ovs_idl_txn) { + struct ovsrec_bridge *br_ln = shash_find_data(bridge_mappings, network); + if (!br_ln) { return NULL; } - qos = ovsrec_qos_insert(ovs_idl_txn); - ovsrec_qos_set_type(qos, "linux-noop"); - return qos; -} - -static bool -set_noop_qos(struct ovsdb_idl_txn *ovs_idl_txn, - const struct ovsrec_port_table *port_table, - const struct ovsrec_qos_table *qos_table, - struct sset *egress_ifaces) -{ - if (!ovs_idl_txn) { - return false; - } - const struct ovsrec_qos *noop_qos = get_noop_qos(ovs_idl_txn, qos_table); - if (!noop_qos) { - return false; - } + /* Add egress-ifaces from the connected bridge */ + for (size_t i = 0; i < br_ln->n_ports; i++) { + const struct ovsrec_port *port = br_ln->ports[i]; + for (size_t j = 0; j < port->n_interfaces; j++) { + const struct ovsrec_interface *iface = port->interfaces[j]; - const struct ovsrec_port *port; - size_t count = 0; + if (smap_get(&iface->external_ids, "iface-id")) { + continue; + } - OVSREC_PORT_TABLE_FOR_EACH (port, port_table) { - if (sset_contains(egress_ifaces, port->name)) { - ovsrec_port_set_qos(port, noop_qos); - count++; - } - if (sset_count(egress_ifaces) == count) { - break; + bool is_egress_iface = smap_get_bool(&iface->external_ids, + "ovn-egress-iface", false); + if (is_egress_iface) { + *pport = port; + return iface; + } } } - return true; -} -static void -set_qos_type(struct netdev *netdev, const char *type) -{ - /* 34359738360 == (2^32 - 1) * 8. netdev_set_qos() doesn't support - * 64-bit rate netlink attributes, so the maximum value is 2^32 - 1 bytes. - * The 'max-rate' config option is in bits, so multiplying by 8. - * Without setting max-rate the reported link speed will be used, which - * can be unrecognized for certain NICs or reported too low for virtual - * interfaces. */ - const struct smap conf = SMAP_CONST1(&conf, "max-rate", "34359738360"); - int error = netdev_set_qos(netdev, type, &conf); - if (error) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); - VLOG_WARN_RL(&rl, "%s: could not set qdisc type \"%s\" (%s)", - netdev_get_name(netdev), type, ovs_strerror(error)); - } + return NULL; } +/* 34359738360 == (2^32 - 1) * 8. netdev_set_qos() doesn't support + * 64-bit rate netlink attributes, so the maximum value is 2^32 - 1 + * bytes. The 'max-rate' config option is in bits, so multiplying by 8. + * Without setting max-rate the reported link speed will be used, which + * can be unrecognized for certain NICs or reported too low for virtual + * interfaces. */ +#define OVN_QOS_MAX_RATE 34359738360ULL static void -setup_qos(const char *egress_iface, struct hmap *queue_map) -{ - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5); - struct netdev *netdev_phy; +add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, + const struct ovsrec_port *port, + struct qos_queue *q) +{ + struct smap other_config = SMAP_INITIALIZER(&other_config); + const struct ovsrec_qos *qos = port->qos; + if (!qos) { + 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); + ovsrec_qos_set_other_config(qos, &other_config); + smap_clear(&other_config); + } + + struct ovsrec_queue *queue; + size_t i; + for (i = 0; i < qos->n_queues; i++) { + queue = qos->value_queues[i]; + if (qos->key_queues[i] != q->queue_id) { + continue; + } - if (!egress_iface) { - /* Queues cannot be configured. */ + uint32_t max_rate = smap_get_int(&queue->other_config, "max-rate", 0); + uint32_t min_rate = smap_get_int(&queue->other_config, "min-rate", 0); + uint32_t burst = smap_get_int(&queue->other_config, "burst", 0); + + if (max_rate != q->max_rate || min_rate != q->min_rate || + burst != q->burst) { + break; + } + /* queue already configured. */ return; } - int error = netdev_open(egress_iface, NULL, &netdev_phy); - if (error) { - VLOG_WARN_RL(&rl, "%s: could not open netdev (%s)", - egress_iface, ovs_strerror(error)); - return; + if (i == qos->n_queues) { + queue = ovsrec_queue_insert(ovs_idl_txn); + ovsrec_qos_update_queues_setkey(qos, q->queue_id, queue); } - /* Check current qdisc. */ - const char *qdisc_type; - struct smap qdisc_details; + smap_add_format(&other_config, "max-rate", "%d", q->max_rate); + smap_add_format(&other_config, "min-rate", "%d", q->min_rate); + smap_add_format(&other_config, "burst", "%d", q->burst); + ovsrec_queue_verify_other_config(queue); + ovsrec_queue_set_other_config(queue, &other_config); + smap_destroy(&other_config); +} - smap_init(&qdisc_details); - if (netdev_get_qos(netdev_phy, &qdisc_type, &qdisc_details) != 0 || - qdisc_type[0] == '\0') { - smap_destroy(&qdisc_details); - netdev_close(netdev_phy); - /* Qos is not supported. */ - return; - } - smap_destroy(&qdisc_details); +struct port_queud_id_entry { + struct hmap_node key_node; + const struct ovsrec_port *port; + uint32_t queue_id; +}; - /* If we're not actually being requested to do any QoS: - * - * - If the current qdisc type is OVN_QOS_TYPE, then we clear the qdisc - * type to "". Otherwise, it's possible that our own leftover qdisc - * settings could cause strange behavior on egress. Also, QoS is - * expensive and may waste CPU time even if it's not really in use. - * - * OVN isn't the only software that can configure qdiscs, and - * physical interfaces are shared resources, so there is some risk in - * this strategy: we could disrupt some other program's QoS. - * Probably, to entirely avoid this possibility we would need to add - * a configuration setting. - * - * - Otherwise leave the qdisc alone. */ - if (hmap_is_empty(queue_map)) { - if (!strcmp(qdisc_type, OVN_QOS_TYPE)) { - set_qos_type(netdev_phy, ""); +static struct port_queud_id_entry * +port_queue_id_find(const struct ovsrec_port *port, uint32_t queue_id, + struct hmap *port_queud_map) +{ + struct port_queud_id_entry *n; + HMAP_FOR_EACH (n, key_node, port_queud_map) { + if (n->port == port && n->queue_id == queue_id) { + return n; } - netdev_close(netdev_phy); - return; } + return NULL; +} - /* Configure qdisc. */ - if (strcmp(qdisc_type, OVN_QOS_TYPE)) { - set_qos_type(netdev_phy, OVN_QOS_TYPE); - } - - /* Check and delete if needed. */ - struct netdev_queue_dump dump; - unsigned int queue_id; - struct smap queue_details; - struct qos_queue *sb_info; - struct hmap consistent_queues; - - smap_init(&queue_details); - hmap_init(&consistent_queues); - NETDEV_QUEUE_FOR_EACH (&queue_id, &queue_details, &dump, netdev_phy) { - bool is_queue_needed = false; - - HMAP_FOR_EACH_WITH_HASH (sb_info, node, hash_int(queue_id, 0), - queue_map) { - is_queue_needed = true; - 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)) { - /* This queue is consistent. */ - hmap_insert(&consistent_queues, &sb_info->node, - hash_int(queue_id, 0)); +static void +remove_stale_ovs_qos_entries(const struct ovsrec_port_table *port_table, + const struct ovsrec_qos_table *qos_table, + struct hmap *port_queud_map) +{ + const struct ovsrec_qos *qos, *qos_next; + OVSREC_QOS_TABLE_FOR_EACH_SAFE (qos, qos_next, qos_table) { + const struct ovsrec_port *port = NULL, *iter; + OVSREC_PORT_TABLE_FOR_EACH (iter, port_table) { + if (iter->qos == qos) { + port = iter; break; } } + if (!port) { + continue; + } + + int n_queue_deleted = 0, n_queues = qos->n_queues; + for (size_t i = 0; i < n_queues; i++) { + struct ovsrec_queue *queue = qos->value_queues[i]; + if (!queue) { + continue; + } + if (!port_queue_id_find(port, qos->key_queues[i], + port_queud_map)) { + ovsrec_qos_update_queues_delkey(qos, qos->key_queues[i]); + ovsrec_queue_delete(queue); + n_queue_deleted++; + } + } - if (!is_queue_needed) { - error = netdev_delete_queue(netdev_phy, queue_id); - if (error) { - VLOG_WARN_RL(&rl, "%s: could not delete queue %u (%s)", - egress_iface, queue_id, ovs_strerror(error)); + if (n_queue_deleted && n_queue_deleted == n_queues) { + if (port) { + ovsrec_port_set_qos(port, NULL); } + ovsrec_qos_delete(qos); } } +} + +static void +configure_ovs_qos(struct hmap *queue_map, + struct ovsdb_idl_txn *ovs_idl_txn, + const struct ovsrec_port_table *port_table, + const struct ovsrec_qos_table *qos_table, + struct shash *bridge_mappings) + +{ + if (!ovs_idl_txn) { + return; + } - /* Create/Update queues. */ - HMAP_FOR_EACH (sb_info, node, queue_map) { - if (hmap_contains(&consistent_queues, &sb_info->node)) { - hmap_remove(&consistent_queues, &sb_info->node); + struct hmap port_queud_map = HMAP_INITIALIZER(&port_queud_map); + struct qos_queue *q; + HMAP_FOR_EACH (q, node, queue_map) { + if (!q->network) { continue; } - 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, - &queue_details); - if (error) { - VLOG_WARN_RL(&rl, "%s: could not configure queue %u (%s)", - egress_iface, sb_info->queue_id, ovs_strerror(error)); + const struct ovsrec_port *port = NULL; + const struct ovsrec_interface *iface = + get_qos_egress_port_interface(bridge_mappings, &port, + q->network); + if (iface && port->qos && + !port_queue_id_find(port, q->queue_id, &port_queud_map)) { + struct port_queud_id_entry *n = xmalloc(sizeof *n); + n->queue_id = q->queue_id; + n->port = port; + hmap_insert(&port_queud_map, &n->key_node, + hash_int(q->queue_id, 0)); + } + if (port) { + /* Add new QoS entries. */ + add_ovs_qos_table_entry(ovs_idl_txn, port, q); } } - smap_destroy(&queue_details); - hmap_destroy(&consistent_queues); - netdev_close(netdev_phy); + /* Remove stale QoS entries. */ + remove_stale_ovs_qos_entries(port_table, qos_table, &port_queud_map); + + struct port_queud_id_entry *n; + HMAP_FOR_EACH_POP (n, key_node, &port_queud_map) { + free(n); + } + hmap_destroy(&port_queud_map); } /* @@ -2158,16 +2166,11 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) free(multichassis_lport); } - shash_destroy(&bridge_mappings); + configure_ovs_qos(b_ctx_out->qos_map, b_ctx_in->ovs_idl_txn, + b_ctx_in->port_table, b_ctx_in->qos_table, + &bridge_mappings); - if (!sset_is_empty(b_ctx_out->egress_ifaces) - && set_noop_qos(b_ctx_in->ovs_idl_txn, b_ctx_in->port_table, - b_ctx_in->qos_table, b_ctx_out->egress_ifaces)) { - const char *entry; - SSET_FOR_EACH (entry, b_ctx_out->egress_ifaces) { - setup_qos(entry, b_ctx_out->qos_map); - } - } + shash_destroy(&bridge_mappings); cleanup_claimed_port_timestamps(); } @@ -2556,12 +2559,6 @@ binding_handle_ovs_interface_changes(struct binding_ctx_in *b_ctx_in, break; } - if (smap_get(&iface_rec->external_ids, "ovn-egress-iface") || - sset_contains(b_ctx_out->egress_ifaces, iface_rec->name)) { - handled = false; - break; - } - const char *iface_id = smap_get(&iface_rec->external_ids, "iface-id"); const char *old_iface_id = smap_get(b_ctx_out->local_iface_ids, iface_rec->name); @@ -2638,13 +2635,14 @@ binding_handle_ovs_interface_changes(struct binding_ctx_in *b_ctx_in, } } - if (handled && set_noop_qos(b_ctx_in->ovs_idl_txn, b_ctx_in->port_table, - b_ctx_in->qos_table, - b_ctx_out->egress_ifaces)) { - const char *entry; - SSET_FOR_EACH (entry, b_ctx_out->egress_ifaces) { - setup_qos(entry, b_ctx_out->qos_map); - } + if (handled) { + struct shash bridge_mappings = SHASH_INITIALIZER(&bridge_mappings); + add_ovs_bridge_mappings(b_ctx_in->ovs_table, b_ctx_in->bridge_table, + &bridge_mappings); + configure_ovs_qos(b_ctx_out->qos_map, b_ctx_in->ovs_idl_txn, + b_ctx_in->port_table, b_ctx_in->qos_table, + &bridge_mappings); + shash_destroy(&bridge_mappings); } return handled; @@ -3161,16 +3159,12 @@ delete_done: } sbrec_port_binding_index_destroy_row(target); } - shash_destroy(&bridge_mappings); - } - if (handled && set_noop_qos(b_ctx_in->ovs_idl_txn, b_ctx_in->port_table, - b_ctx_in->qos_table, - b_ctx_out->egress_ifaces)) { - const char *entry; - SSET_FOR_EACH (entry, b_ctx_out->egress_ifaces) { - setup_qos(entry, b_ctx_out->qos_map); - } + configure_ovs_qos(b_ctx_out->qos_map, b_ctx_in->ovs_idl_txn, + b_ctx_in->port_table, b_ctx_in->qos_table, + &bridge_mappings); + + shash_destroy(&bridge_mappings); } return handled; diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index ee0e495ba..a58e09215 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1045,6 +1045,11 @@ ctrl_register_ovs_idl(struct ovsdb_idl *ovs_idl) ovsdb_idl_add_table(ovs_idl, &ovsrec_table_datapath); ovsdb_idl_add_column(ovs_idl, &ovsrec_datapath_col_capabilities); ovsdb_idl_add_table(ovs_idl, &ovsrec_table_flow_sample_collector_set); + ovsdb_idl_add_table(ovs_idl, &ovsrec_table_qos); + ovsdb_idl_add_column(ovs_idl, &ovsrec_qos_col_other_config); + ovsdb_idl_add_column(ovs_idl, &ovsrec_qos_col_queues); + ovsdb_idl_add_table(ovs_idl, &ovsrec_table_queue); + ovsdb_idl_add_column(ovs_idl, &ovsrec_queue_col_other_config); chassis_register_ovs_idl(ovs_idl); encaps_register_ovs_idl(ovs_idl); @@ -1059,6 +1064,7 @@ ctrl_register_ovs_idl(struct ovsdb_idl *ovs_idl) ovsdb_idl_track_add_column(ovs_idl, &ovsrec_interface_col_type); 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_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 83196af91..a4387349c 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -6530,8 +6530,10 @@ ovn_start OVS_TRAFFIC_VSWITCHD_START() ADD_BR([br-int]) +ADD_BR([br-public]) ADD_BR([br-ext]) +ovs-ofctl add-flow br-public action=normal ovs-ofctl add-flow br-ext action=normal # Set external-ids in br-int needed for ovn-controller ovs-vsctl \ @@ -6551,32 +6553,87 @@ ADD_VETH(sw01, sw01, br-int, "192.168.1.2/24", "f0:00:00:01:02:03") ovn-nbctl lsp-add sw0 sw01 \ -- lsp-set-addresses sw01 "f0:00:00:01:02:03 192.168.1.2" +ovn-nbctl ls-add sw1 + +ADD_NAMESPACES(sw11) +ADD_VETH(sw11, sw11, br-int, "192.168.4.2/24", "f0:00:00:01:04:03") +ovn-nbctl lsp-add sw1 sw11 \ + -- lsp-set-addresses sw11 "f0:00:00:01:04:03 192.168.4.2" + ADD_NAMESPACES(public) -ADD_VETH(public, public, br-ext, "192.168.2.2/24", "f0:00:00:01:02:05") +ADD_VETH(public, public, br-public, "192.168.2.2/24", "f0:00:00:01:02:05") +AT_CHECK([ovs-vsctl remove interface ovs-public external-ids iface-id=public]) -AT_CHECK([ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=phynet:br-ext]) +ADD_NAMESPACES(ext) +ADD_VETH(ext, ext, br-ext, "192.168.3.2/24", "f0:00:00:01:02:06") +AT_CHECK([ovs-vsctl remove interface ovs-ext external-ids iface-id=ext]) + +AT_CHECK([ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=public:br-public,ext:br-ext]) ovn-nbctl lsp-add sw0 public \ -- lsp-set-addresses public unknown \ -- lsp-set-type public localnet \ - -- lsp-set-options public network_name=phynet + -- lsp-set-options public network_name=public + +ovn-nbctl lsp-add sw1 ext \ + -- lsp-set-addresses ext unknown \ + -- lsp-set-type ext localnet \ + -- lsp-set-options ext network_name=ext 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]) + +AT_CHECK([ovn-nbctl set Logical_Switch_Port ext options:qos_min_rate=400000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port ext options:qos_max_rate=600000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port ext options:qos_burst=6000000]) +AT_CHECK([ovs-vsctl set interface ovs-ext 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 .* rate 200Kbit ceil 300Kbit burst 375000b cburst 375000b']) +OVS_WAIT_UNTIL([tc qdisc show | grep -q 'htb 1: dev ovs-ext']) +OVS_WAIT_UNTIL([tc class show dev ovs-ext | \ + grep -q 'class htb .* rate 400Kbit ceil 600Kbit burst 750000b cburst 750000b']) +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]) + OVS_WAIT_UNTIL([tc class show dev ovs-public | \ - grep -q 'class htb .* rate 200Kbit ceil 34359Mbit burst 375000b .*']) + grep -q 'class htb .* rate 12Kbit ceil 34359Mbit burst 375000b cburst 373662b']) -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_burst=3000000]) OVS_WAIT_UNTIL([test "$(tc qdisc show | grep 'htb 1: dev ovs-public')" = ""]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port ext options:qos_max_rate=800000]) +OVS_WAIT_UNTIL([tc class show dev ovs-ext | \ + grep -q 'class htb .* rate 400Kbit ceil 800Kbit burst 750000b cburst 750000b']) + +AT_CHECK([ovn-nbctl set Logical_Switch_Port public options:qos_min_rate=400000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port public options:qos_max_rate=800000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port public options:qos_burst=6000000]) + +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 .* rate 400Kbit ceil 800Kbit burst 750000b cburst 750000b']) + +AT_CHECK([ovn-nbctl remove Logical_Switch_Port ext options qos_min_rate=400000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port ext options qos_max_rate=800000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port ext options qos_burst=6000000]) + +OVS_WAIT_UNTIL([test "$(tc qdisc show | grep 'htb 1: dev ovs-ext')" = ""]) + +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 .* rate 400Kbit ceil 800Kbit burst 750000b cburst 750000b']) + +AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options qos_min_rate=400000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options qos_max_rate=800000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options qos_burst=6000000]) + +OVS_WAIT_UNTIL([test "$(tc qdisc show | grep 'htb 1: dev ovs-public')" = ""]) + kill $(pidof ovn-controller) as ovn-sb From patchwork Wed May 10 14:21:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779532 X-Patchwork-Delegate: nusiddiq@redhat.com 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=2605:bc80:3010::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=GMDa0ek/; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::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 4QGcg809lxz214M for ; Thu, 11 May 2023 00:22:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0920F6FEC9; Wed, 10 May 2023 14:22:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0920F6FEC9 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=GMDa0ek/ 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 U3HUUxgMtJYp; Wed, 10 May 2023 14:22:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0C1447005B; Wed, 10 May 2023 14:22:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0C1447005B Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C6064C0036; Wed, 10 May 2023 14:22:14 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 19112C007C for ; Wed, 10 May 2023 14:22:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 491FE6FE87 for ; Wed, 10 May 2023 14:22:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 491FE6FE87 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 GSnua3GEHcsk for ; Wed, 10 May 2023 14:22:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 30B576FE96 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 30B576FE96 for ; Wed, 10 May 2023 14:22:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728524; 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=EMNVfQclfogPA/ThEBBaG1E5Bj5//gjY2sHTtv32Es0=; b=GMDa0ek/snFHdLH9eZKBIM1OH64z1iq06UPjI+5K+KPlpe03jAjKkRim2CLCA9rwID7Pae 4lhHGqmGl8Iuyuwa5D4LLwaGeAxEnW6Auaz/fkMVyJPv6ISFSPwf8VQIm/jgvsNVStJ5M5 /FGs0CmqM2cBByPWBb3NNp5+ArHgbRc= 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-385-S8lB81uKPJCkrmTMgRwvxg-1; Wed, 10 May 2023 10:22:03 -0400 X-MC-Unique: S8lB81uKPJCkrmTMgRwvxg-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3078b9943d6so1666383f8f.1 for ; Wed, 10 May 2023 07:22:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728521; x=1686320521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EMNVfQclfogPA/ThEBBaG1E5Bj5//gjY2sHTtv32Es0=; b=WPQoMuHflwkL+bFZE7njmXL9dUzQ1150nnbQrgzPyKWME7/wF/kYvdgCAfvwi2cT2i rPwFPZo+NZLnXC0XhAc54APtMAYEhqi/9OBl5g1qOxhojs/BHH4qaCCDViRTjsvplfof 4VO2aeMCOtIf3ASVYfVxdzSvQcLemgLtT18nhPSQsxQCVNv1k2uEI36TzNaGrkkdxntA nCZYA6oos0SPWsIvobgS0PI0rDk9xz6I7H7xALZ4R1SUBncyR1vCnH/hzyyVO03ss/3o eU/1bLvDvZyIWPZ/MnXon18lMIr2VHST61zR0g2ic2BCDAs3Wmzi+j2/TXgCtJpavx16 fTBQ== X-Gm-Message-State: AC+VfDwkJSxm5ZhM/NGiPLiwc3mUldaICcgKQByoqqIsd0y8HuDUHiPP MaIlWgWfx6H36YythcN3xQDfdImgQzDUNx6VZq6P3+3siD5gTchmUugLtMccpvianuGsOFa+Gad uRTtvB+ROaJCxx5/B28AGr2bYEquS/ogT4hs1ik2VkcT4CbYL1nhHiDff1jwnn6AG0wfJ5Y0RM+ I2HCkMXAzfhb6g X-Received: by 2002:a5d:6e12:0:b0:2f4:a60f:3cd8 with SMTP id h18-20020a5d6e12000000b002f4a60f3cd8mr12608906wrz.49.1683728520888; Wed, 10 May 2023 07:22:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ449CTYwS8XtB6t9XVl6pF7Y3RK4qVJJgldl/dv8TDsx/3HE1kdun9xLND0JIZ7xjJudICgbw== X-Received: by 2002:a5d:6e12:0:b0:2f4:a60f:3cd8 with SMTP id h18-20020a5d6e12000000b002f4a60f3cd8mr12608886wrz.49.1683728520539; Wed, 10 May 2023 07:22:00 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id z11-20020a5d4c8b000000b003079d61a107sm7437602wrs.25.2023.05.10.07.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:22:00 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:27 +0200 Message-Id: <4b593f062aa4ad85c43f8cc9def9ae12a4be67ae.1683728227.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 5/9] controller: improve ovs port lookup by name and qos 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" Introduce ovsport_lookup_by_name and ovsport_lookup_by_qos routines in order to speed-up ovs port lookup based on port name or qos. Acked-By: Ihar Hrachyshka Tested-by: Rodolfo Alonso Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 25 +++++++++++-------------- controller/binding.h | 2 +- controller/ovn-controller.c | 13 +++++++++---- controller/ovsport.c | 32 ++++++++++++++++++++++++++++++++ controller/ovsport.h | 5 +++++ 5 files changed, 58 insertions(+), 19 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 9182249ac..b15ff98f6 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -36,6 +36,7 @@ #include "lport.h" #include "ovn-controller.h" #include "patch.h" +#include "ovsport.h" VLOG_DEFINE_THIS_MODULE(binding); @@ -367,19 +368,14 @@ port_queue_id_find(const struct ovsrec_port *port, uint32_t queue_id, } static void -remove_stale_ovs_qos_entries(const struct ovsrec_port_table *port_table, - const struct ovsrec_qos_table *qos_table, +remove_stale_ovs_qos_entries(const struct ovsrec_qos_table *qos_table, + struct ovsdb_idl_index *ovsrec_port_by_qos, struct hmap *port_queud_map) { const struct ovsrec_qos *qos, *qos_next; OVSREC_QOS_TABLE_FOR_EACH_SAFE (qos, qos_next, qos_table) { - const struct ovsrec_port *port = NULL, *iter; - OVSREC_PORT_TABLE_FOR_EACH (iter, port_table) { - if (iter->qos == qos) { - port = iter; - break; - } - } + const struct ovsrec_port *port = + ovsport_lookup_by_qos(ovsrec_port_by_qos, qos); if (!port) { continue; } @@ -410,8 +406,8 @@ remove_stale_ovs_qos_entries(const struct ovsrec_port_table *port_table, static void configure_ovs_qos(struct hmap *queue_map, struct ovsdb_idl_txn *ovs_idl_txn, - const struct ovsrec_port_table *port_table, const struct ovsrec_qos_table *qos_table, + struct ovsdb_idl_index *ovsrec_port_by_qos, struct shash *bridge_mappings) { @@ -444,7 +440,8 @@ configure_ovs_qos(struct hmap *queue_map, } } /* Remove stale QoS entries. */ - remove_stale_ovs_qos_entries(port_table, qos_table, &port_queud_map); + remove_stale_ovs_qos_entries(qos_table, ovsrec_port_by_qos, + &port_queud_map); struct port_queud_id_entry *n; HMAP_FOR_EACH_POP (n, key_node, &port_queud_map) { @@ -2167,7 +2164,7 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) } configure_ovs_qos(b_ctx_out->qos_map, b_ctx_in->ovs_idl_txn, - b_ctx_in->port_table, b_ctx_in->qos_table, + b_ctx_in->qos_table, b_ctx_in->ovsrec_port_by_qos, &bridge_mappings); shash_destroy(&bridge_mappings); @@ -2640,7 +2637,7 @@ binding_handle_ovs_interface_changes(struct binding_ctx_in *b_ctx_in, add_ovs_bridge_mappings(b_ctx_in->ovs_table, b_ctx_in->bridge_table, &bridge_mappings); configure_ovs_qos(b_ctx_out->qos_map, b_ctx_in->ovs_idl_txn, - b_ctx_in->port_table, b_ctx_in->qos_table, + b_ctx_in->qos_table, b_ctx_in->ovsrec_port_by_qos, &bridge_mappings); shash_destroy(&bridge_mappings); } @@ -3161,7 +3158,7 @@ delete_done: } configure_ovs_qos(b_ctx_out->qos_map, b_ctx_in->ovs_idl_txn, - b_ctx_in->port_table, b_ctx_in->qos_table, + b_ctx_in->qos_table, b_ctx_in->ovsrec_port_by_qos, &bridge_mappings); shash_destroy(&bridge_mappings); diff --git a/controller/binding.h b/controller/binding.h index 87ee7b540..6b97bcff0 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -46,7 +46,7 @@ struct binding_ctx_in { struct ovsdb_idl_index *sbrec_datapath_binding_by_key; struct ovsdb_idl_index *sbrec_port_binding_by_datapath; struct ovsdb_idl_index *sbrec_port_binding_by_name; - const struct ovsrec_port_table *port_table; + struct ovsdb_idl_index *ovsrec_port_by_qos; 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 a58e09215..1bf93d859 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1497,9 +1497,6 @@ init_binding_ctx(struct engine_node *node, = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id); ovs_assert(chassis); - const struct ovsrec_port_table *port_table = - EN_OVSDB_GET(engine_get_input("OVS_port", node)); - struct ed_type_ovs_interface_shadow *iface_shadow = engine_get_input_data("ovs_interface_shadow", node); @@ -1524,6 +1521,10 @@ init_binding_ctx(struct engine_node *node, engine_get_input("SB_port_binding", node), "datapath"); + struct ovsdb_idl_index *ovsrec_port_by_qos = + engine_ovsdb_node_get_index( + engine_get_input("OVS_port", node), "qos"); + struct controller_engine_ctx *ctrl_ctx = engine_get_context()->client_ctx; b_ctx_in->ovnsb_idl_txn = engine_get_context()->ovnsb_idl_txn; @@ -1531,7 +1532,7 @@ init_binding_ctx(struct engine_node *node, b_ctx_in->sbrec_datapath_binding_by_key = sbrec_datapath_binding_by_key; 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->port_table = port_table; + b_ctx_in->ovsrec_port_by_qos = ovsrec_port_by_qos; b_ctx_in->iface_table = iface_shadow->iface_table; b_ctx_in->iface_table_external_ids_old = &iface_shadow->iface_table_external_ids_old; @@ -4477,6 +4478,9 @@ main(int argc, char *argv[]) struct ovsdb_idl_index *ovsrec_port_by_name = ovsdb_idl_index_create1(ovs_idl_loop.idl, &ovsrec_port_col_name); + 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_flow_sample_collector_set_by_id = ovsdb_idl_index_create2(ovs_idl_loop.idl, &ovsrec_flow_sample_collector_set_col_bridge, @@ -4831,6 +4835,7 @@ main(int argc, char *argv[]) sbrec_chassis_template_var_index_by_chassis); 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); struct ed_type_lflow_output *lflow_output_data = engine_get_internal_data(&en_lflow_output); diff --git a/controller/ovsport.c b/controller/ovsport.c index ec38c3fca..ba260dee6 100644 --- a/controller/ovsport.c +++ b/controller/ovsport.c @@ -216,6 +216,38 @@ ovsrec_port * ovsport_lookup_by_interface( interfaces, 1); } +const struct ovsrec_port * +ovsport_lookup_by_name(struct ovsdb_idl_index *ovsrec_port_by_name, + const char *name) +{ + const struct ovsrec_port *port = + ovsrec_port_index_init_row(ovsrec_port_by_name); + ovsrec_port_index_set_name(port, name); + + const struct ovsrec_port *retval = + ovsrec_port_index_find(ovsrec_port_by_name, port); + + ovsrec_port_index_destroy_row(port); + + return retval; +} + +const struct ovsrec_port * +ovsport_lookup_by_qos(struct ovsdb_idl_index *ovsrec_port_by_qos, + const struct ovsrec_qos *qos) +{ + const struct ovsrec_port *port = + ovsrec_port_index_init_row(ovsrec_port_by_qos); + ovsrec_port_index_set_qos(port, qos); + + const struct ovsrec_port *retval = + ovsrec_port_index_find(ovsrec_port_by_qos, port); + + ovsrec_port_index_destroy_row(port); + + return retval; +} + /* Update an interface map column with the key/value pairs present in the * provided smap, only applying changes when necessary. */ static void diff --git a/controller/ovsport.h b/controller/ovsport.h index e355ff7ff..dfd4f13f0 100644 --- a/controller/ovsport.h +++ b/controller/ovsport.h @@ -33,6 +33,7 @@ struct ovsrec_bridge; struct ovsrec_port; struct ovsrec_interface; struct ovsdb_idl_index; +struct ovsrec_qos; void ovsport_create(struct ovsdb_idl_txn *ovs_idl_txn, const struct ovsrec_bridge *bridge, @@ -56,5 +57,9 @@ const struct ovsrec_port * ovsport_lookup_by_interfaces( const size_t n_interfaces); const struct ovsrec_port * ovsport_lookup_by_interface( struct ovsdb_idl_index *, struct ovsrec_interface *); +const struct ovsrec_port * ovsport_lookup_by_name( + struct ovsdb_idl_index *, const char *); +const struct ovsrec_port * ovsport_lookup_by_qos( + struct ovsdb_idl_index *, const struct ovsrec_qos *); #endif /* lib/ovsport.h */ From patchwork Wed May 10 14:21:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779536 X-Patchwork-Delegate: nusiddiq@redhat.com 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=2605:bc80:3010::133; helo=smtp2.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=b4a+D9AF; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4QGcgm4wtrz214c for ; Thu, 11 May 2023 00:23:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6DEA042C2C; Wed, 10 May 2023 14:22:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6DEA042C2C Authentication-Results: smtp2.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=b4a+D9AF 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 iH2G2lNO1VKW; Wed, 10 May 2023 14:22:56 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 4D04842C1C; Wed, 10 May 2023 14:22:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4D04842C1C Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 14486C007C; Wed, 10 May 2023 14:22:55 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 24A86C008F for ; Wed, 10 May 2023 14:22:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id ED07670030 for ; Wed, 10 May 2023 14:22:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org ED07670030 Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b4a+D9AF 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 zDudqGws_DS8 for ; Wed, 10 May 2023 14:22:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C16406FFF1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id C16406FFF1 for ; Wed, 10 May 2023 14:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728535; 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=y7uOSVPhZ3JEJItBmKE8vulfaDDkWKeaEppcKSuGlh4=; b=b4a+D9AF7Q1PoR85K8jnyQ1OycX1v2sf/w+Ct3gtp3GE3tyENc0c+TrLYbJ/KhRxjSZrCd UWAM2r14gS+zOEIw9zk8Ejp8njdSFxLok2DWoWz0ZfH9nIKcbf9xbb3bYDfxmdENAMVh1G lOa8bjI15WWI1PLS+KnhABtyha5aKWQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-351-SM23IotAOb-0-FqPkq4TZQ-1; Wed, 10 May 2023 10:22:09 -0400 X-MC-Unique: SM23IotAOb-0-FqPkq4TZQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f41ce0a69fso18839875e9.1 for ; Wed, 10 May 2023 07:22:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728523; x=1686320523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y7uOSVPhZ3JEJItBmKE8vulfaDDkWKeaEppcKSuGlh4=; b=lRVY0SaIB8h+jq9A28qyO+MpCWJKzrfMF1Cp8EeMjXViAGWv2VM7XIjDx81G50Xwbb LmbaCfoWYYebRWoQHOT1kpdhag1sLmaeLrhOd4x+MvXFDcJkPqH6RmxyIGbECdFs9/k8 v94KBN4tX73s0agzEzCCILk+Z1NErAw9Mu5HIcOfuv6ajsHKb0dzhMtjvf6Fwxa4MIr0 RAQzsYrtXGaVTAr9C7PJEWkYbnyfL2+1wnDvG/A/WGCrAd1XGIzONP60aQ7mKl9jOdyL e8GQdblGInOykHohYMmmQPUJj0eMv0OcwkcTUDBzt0OkxqBzzABWNUBnsqPpAmlyLH8U MenQ== X-Gm-Message-State: AC+VfDy54KZ/hJae6xUazLE9lhb4xNLCTCeEnpW5/0W/upo1kHLDKzLD I0SlsqzvsGx95Hd4pHr2VRF87N36/9ovtGOJMYpdyg3API+04pc42PxTSShScZTRoN8k3tITz2E 01Dua23FXAEs36fOfRc+XIaq9tT2yHUGb9/TrIXSO261iKHs0fYGa4IrtutsHoTUB7i0Zguo/kk qIbdZ2b+uC4zzC X-Received: by 2002:a05:600c:22c1:b0:3f4:2d75:72e8 with SMTP id 1-20020a05600c22c100b003f42d7572e8mr2950596wmg.28.1683728523100; Wed, 10 May 2023 07:22:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4uZTqVaxMdcSKli5HbrjN0i8jX8zel9KRr05L6YdRo5/BNq66+OXdMXG9e5/wBxO0szUrT8Q== X-Received: by 2002:a05:600c:22c1:b0:3f4:2d75:72e8 with SMTP id 1-20020a05600c22c100b003f42d7572e8mr2950573wmg.28.1683728522734; Wed, 10 May 2023 07:22:02 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id f26-20020a7bcd1a000000b003f423f5b659sm10352568wmj.10.2023.05.10.07.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:22:02 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:28 +0200 Message-Id: <7ff821b263c4ad22cb102d43b79082ad2e086380.1683728227.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 6/9] controller: use unsigned long long int for qos_max_rate/qos_min_rate/qos_burst 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" This patch allow to configure max/min rate greater than 4Gbps Acked-By: Ihar Hrachyshka Tested-by: Rodolfo Alonso Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index b15ff98f6..5502fcdeb 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -148,15 +148,15 @@ struct qos_queue { bool stale; uint32_t queue_id; - uint32_t min_rate; - uint32_t max_rate; - uint32_t burst; + unsigned long long min_rate; + unsigned long long max_rate; + unsigned long long burst; }; static struct qos_queue * find_qos_queue(struct hmap *queue_map, uint32_t hash, const char *port, - uint32_t min_rate, uint32_t max_rate, uint32_t burst, - uint32_t queue_id) + unsigned long long min_rate, unsigned long long max_rate, + unsigned long long burst, uint32_t queue_id) { struct qos_queue *q; HMAP_FOR_EACH_WITH_HASH (q, node, hash, queue_map) { @@ -182,17 +182,20 @@ qos_queue_is_changed(const struct sbrec_port_binding *pb, return true; } - uint32_t min_rate = smap_get_int(&pb->options, "qos_min_rate", 0); + unsigned long long min_rate = smap_get_ullong( + &pb->options, "qos_min_rate", 0); if (min_rate != q->min_rate) { return true; } - uint32_t max_rate = smap_get_int(&pb->options, "qos_max_rate", 0); + unsigned long long max_rate = smap_get_ullong( + &pb->options, "qos_max_rate", 0); if (max_rate != q->max_rate) { return true; } - uint32_t burst = smap_get_int(&pb->options, "qos_burst", 0); + unsigned long long burst = smap_get_ullong( + &pb->options, "qos_burst", 0); return burst != q->burst; } @@ -234,9 +237,12 @@ destroy_qos_map(struct hmap *qos_map) static void get_qos_queue(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); + unsigned long long min_rate = smap_get_ullong( + &pb->options, "qos_min_rate", 0); + unsigned long long max_rate = smap_get_ullong( + &pb->options, "qos_max_rate", 0); + unsigned long long burst = smap_get_ullong( + &pb->options, "qos_burst", 0); uint32_t queue_id = smap_get_int(&pb->options, "qdisc_queue_id", 0); const char *network = smap_get(&pb->options, "qos_physical_network"); @@ -323,9 +329,12 @@ add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, continue; } - uint32_t max_rate = smap_get_int(&queue->other_config, "max-rate", 0); - uint32_t min_rate = smap_get_int(&queue->other_config, "min-rate", 0); - uint32_t burst = smap_get_int(&queue->other_config, "burst", 0); + unsigned long long max_rate = + smap_get_ullong(&queue->other_config, "max-rate", 0); + unsigned long long min_rate = + smap_get_ullong(&queue->other_config, "min-rate", 0); + unsigned long long burst = + smap_get_ullong(&queue->other_config, "burst", 0); if (max_rate != q->max_rate || min_rate != q->min_rate || burst != q->burst) { @@ -340,9 +349,9 @@ add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, ovsrec_qos_update_queues_setkey(qos, q->queue_id, queue); } - smap_add_format(&other_config, "max-rate", "%d", q->max_rate); - smap_add_format(&other_config, "min-rate", "%d", q->min_rate); - smap_add_format(&other_config, "burst", "%d", q->burst); + smap_add_format(&other_config, "max-rate", "%lld", q->max_rate); + smap_add_format(&other_config, "min-rate", "%lld", q->min_rate); + smap_add_format(&other_config, "burst", "%lld", q->burst); ovsrec_queue_verify_other_config(queue); ovsrec_queue_set_other_config(queue, &other_config); smap_destroy(&other_config); From patchwork Wed May 10 14:21:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779535 X-Patchwork-Delegate: nusiddiq@redhat.com 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=2605:bc80:3010::133; helo=smtp2.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=jNi9rBZn; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4QGcgj1xVsz214M for ; Thu, 11 May 2023 00:22:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6E3FB429FC; Wed, 10 May 2023 14:22:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6E3FB429FC Authentication-Results: smtp2.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=jNi9rBZn 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 MsBJCrN4viK6; Wed, 10 May 2023 14:22:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2C82142C0C; Wed, 10 May 2023 14:22:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2C82142C0C Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6F12FC0093; Wed, 10 May 2023 14:22:51 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1AECFC0094 for ; Wed, 10 May 2023 14:22:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4EE856FEAA for ; Wed, 10 May 2023 14:22:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4EE856FEAA Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jNi9rBZn 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 DAE99unnix47 for ; Wed, 10 May 2023 14:22:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 34D546FE9C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 34D546FE9C for ; Wed, 10 May 2023 14:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728532; 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=LurMbk56gWD1T5AX4EMn/ukqmcCgSQ6rs+cxGzJsQaw=; b=jNi9rBZnqUEjfzz1FmlRFX/JOGsRBQ6dtoZBTKPhf0l8dYwNAQdf8IoEOTw3RiZpweJPmT 4AlS7bapbEX3raugDAxtNK4EsGzydUAYYA/XudvK2gEjEy9LwmGHpvX4A7PQdFzZtiAsOl agwCbqGgydIvXL5SJOX+vGI1Y3pMrHk= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-513-gZtsJbnUNO-chrXq8k845g-1; Wed, 10 May 2023 10:22:08 -0400 X-MC-Unique: gZtsJbnUNO-chrXq8k845g-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f420742d40so16897725e9.2 for ; Wed, 10 May 2023 07:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728525; x=1686320525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LurMbk56gWD1T5AX4EMn/ukqmcCgSQ6rs+cxGzJsQaw=; b=I69trPPRbdLTbfYVke6vc41/GTyYmfB+bT8OnbsiG6WCMITvOt+kUzoDzsON3cf8aw m9gL5BQIZDbTuYkKIGo6/ZfLYEXRLUabc2PYsV05Q0ODvcOTESEX1NUlnKA44oSVlSns wXDCDZqd0EqkD5wyIxStL3AUWLwDmrZK3NgG82TTd64jTM3I6pYj0xoOrJhaitkwXUWK xWHqG4XCUPR4NL0K0zq1AN/LWuMtSpNSbN0+3npqs8HD2czLLsxubwJPofhAS7T338Yk bgYFTiVrukyU8bUl/cb1aWnBddWAelUTYpz92g8tHWs0wx/0sXXRDmt4oufASOWC7Lm5 R34A== X-Gm-Message-State: AC+VfDywg2/XS112FkJ3ib46Llv2BcDurX43Z1E1Go2yH6qltkbtX/Zs uw5V5fWPKs/9VJkls6xi1cRKyb89J1a6o66yKzh//LHUaE82P0z9AmQIlVbIPimG9BuKJePvJML IYuxZV3dmAJr9WE/Elf4v6qk4W+Spov/bgtL1KHVIjXBalQ2GXbSgem/cDJNclq+dUe++5Sza2B FJk/igLEoaEXst X-Received: by 2002:a05:600c:ad8:b0:3f1:95ea:9342 with SMTP id c24-20020a05600c0ad800b003f195ea9342mr12532106wmr.0.1683728525341; Wed, 10 May 2023 07:22:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4OHYjy5tbGohKsIBZYXsdKyhUp96mTGjwGgagKIxuHjwEsgwr4PqUOMiwHtct0mjcFnZilNw== X-Received: by 2002:a05:600c:ad8:b0:3f1:95ea:9342 with SMTP id c24-20020a05600c0ad800b003f195ea9342mr12532076wmr.0.1683728524885; Wed, 10 May 2023 07:22:04 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id z24-20020a1cf418000000b003f3e50eb606sm22712214wma.13.2023.05.10.07.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:22:04 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:29 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 7/9] northd: apply QoS rules on the localnet port related to LSP ports 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" This patch allows to apply QoS rules on the localnet port related to logical switch ports running on the same datapath. Considering the following netowrk configuration: LSP{0,1} -- LogicalSwitch -- Localnet0 It is possible to apply the following QoS rules on Localnet0 on egress traffic entering the cluster from LSP{0,1}: - LSP0: min-rate r0, max_rate R0 - LSP1: min-rate r1, max_rate R1 Acked-By: Ihar Hrachyshka Tested-by: Rodolfo Alonso Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 6 +-- northd/northd.c | 26 +++++++--- northd/ovn-northd.8.xml | 12 +++++ tests/ovn-northd.at | 2 + tests/ovn-performance.at | 5 -- tests/ovn.at | 101 +++++++++++++++++++++++++++++++++++++++ tests/system-ovn.at | 86 ++++++++++++++++++++++++++++++++- 7 files changed, 222 insertions(+), 16 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 5502fcdeb..5ae5d4c1e 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -286,9 +286,9 @@ get_qos_egress_port_interface(struct shash *bridge_mappings, continue; } - bool is_egress_iface = smap_get_bool(&iface->external_ids, - "ovn-egress-iface", false); - if (is_egress_iface) { + if (smap_get_bool(&iface->external_ids, + "ovn-egress-iface", false) || + !strcmp(iface->type, "")) { *pport = port; return iface; } diff --git a/northd/northd.c b/northd/northd.c index 53217347d..80aad25a0 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -5784,15 +5784,29 @@ build_lswitch_port_sec_op(struct ovn_port *op, struct hmap *lflows, ds_cstr(match), ds_cstr(actions), op->key, &op->nbsp->header_); + if (!lsp_is_localnet(op->nbsp) && !op->od->n_localnet_ports) { + return; + } + + ds_clear(actions); + ds_put_format(actions, "set_queue(%s); output;", queue_id); + + ds_clear(match); if (lsp_is_localnet(op->nbsp)) { - ds_clear(match); - ds_clear(actions); ds_put_format(match, "outport == %s", op->json_key); - ds_put_format(actions, "set_queue(%s); output;", queue_id); ovn_lflow_add_with_lport_and_hint(lflows, op->od, - S_SWITCH_OUT_APPLY_PORT_SEC, 100, - ds_cstr(match), ds_cstr(actions), - op->key, &op->nbsp->header_); + S_SWITCH_OUT_APPLY_PORT_SEC, 100, + ds_cstr(match), ds_cstr(actions), + op->key, &op->nbsp->header_); + } else if (op->od->n_localnet_ports) { + ds_put_format(match, "outport == %s && inport == %s", + op->od->localnet_ports[0]->json_key, + op->json_key); + ovn_lflow_add_with_lport_and_hint(lflows, op->od, + S_SWITCH_OUT_APPLY_PORT_SEC, 110, + ds_cstr(match), ds_cstr(actions), + op->od->localnet_ports[0]->key, + &op->od->localnet_ports[0]->nbsp->header_); } } } diff --git a/northd/ovn-northd.8.xml b/northd/ovn-northd.8.xml index 70153dc9e..7da912da3 100644 --- a/northd/ovn-northd.8.xml +++ b/northd/ovn-northd.8.xml @@ -2223,6 +2223,18 @@ output;

    +
  • +

    + For each port configured with egress qos in the + column of , running a localnet port on the same logical + switch, a priority 110 flow is added which matches on the localnet + outport and on the port inport and + applies the action set_queue(id); output;". +

    +
  • +
  • For each localnet port configured with egress qos in the diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 047b8b6ad..8005c09b8 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -8065,6 +8065,7 @@ sort | sed 's/table=../table=??/' ], [0], [dnl table=??(ls_out_check_port_sec), priority=0 , match=(1), action=(reg0[[15]] = check_out_port_sec(); next;) table=??(ls_out_check_port_sec), priority=100 , match=(eth.mcast), action=(reg0[[15]] = 0; next;) table=??(ls_out_apply_port_sec), priority=0 , match=(1), action=(output;) + table=??(ls_out_apply_port_sec), priority=110 , match=(outport == "localnetport" && inport == "sw0p2"), action=(set_queue(10); output;) table=??(ls_out_apply_port_sec), priority=50 , match=(reg0[[15]] == 1), action=(drop;) ]) @@ -8095,6 +8096,7 @@ sort | sed 's/table=../table=??/' ], [0], [dnl table=??(ls_out_check_port_sec), priority=100 , match=(eth.mcast), action=(reg0[[15]] = 0; next;) table=??(ls_out_apply_port_sec), priority=0 , match=(1), action=(output;) table=??(ls_out_apply_port_sec), priority=100 , match=(outport == "localnetport"), action=(set_queue(10); output;) + table=??(ls_out_apply_port_sec), priority=110 , match=(outport == "localnetport" && inport == "sw0p2"), action=(set_queue(10); output;) table=??(ls_out_apply_port_sec), priority=50 , match=(reg0[[15]] == 1), action=(drop;) ]) diff --git a/tests/ovn-performance.at b/tests/ovn-performance.at index 8ac0a392c..ba329f0f6 100644 --- a/tests/ovn-performance.at +++ b/tests/ovn-performance.at @@ -559,11 +559,6 @@ OVN_CONTROLLER_EXPECT_NO_HIT( [ovn-nbctl --wait=hv set Logical_Switch_Port ln-public options:qos_burst=1000] ) -OVN_CONTROLLER_EXPECT_HIT( - [hv3], [lflow_run], - [as hv3 ovs-vsctl set interface vgw3 external-ids:ovn-egress-iface=true] -) - ovn-nbctl --wait=hv meter-add meter0 drop 100 pktps 10 OVN_CONTROLLER_EXPECT_NO_HIT( diff --git a/tests/ovn.at b/tests/ovn.at index 31f8d34d8..8501bbc28 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -35557,3 +35557,104 @@ check test "$current_id2" = "$prev_id2" OVN_CLEANUP([hv1]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([OVN QoS]) +ovn_start + +check ovn-nbctl ls-add ls +check ovn-nbctl lsp-add ls public +check ovn-nbctl lsp-set-addresses public unknown +check ovn-nbctl lsp-set-type public localnet +check ovn-nbctl lsp-set-options public 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 + +for i in 1 2; do + check ovn-nbctl lsp-add ls lsp$i + check ovn-nbctl lsp-set-addresses lsp$i f0:00:00:00:00:0$i +done + +for i in 1 2; do + as hv-$i + ovs-vsctl add-port br-int vif$i -- set Interface vif$i external-ids:iface-id=lsp$i \ + ofport-request=$i + OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp$i` = xup]) + + # Patch port might be created after ports are reported up + # Wait for a flow outputing to patch port + OVN_WAIT_PATCH_PORT_FLOWS(["public"], ["hv-$i"]) +done + +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp1 options:qos_min_rate=200000 +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp1 options:qos_max_rate=350000 +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp1 options:qos_burst=3000000 + +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list qos | grep -c linux-htb) -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="200000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="350000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="3000000"') -eq 1]) + +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp2 options:qos_min_rate=400000 +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp2 options:qos_max_rate=500000 +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp2 options:qos_burst=3000000 + +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list qos | grep -c linux-htb) -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list queue | grep -c 'min-rate="400000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list queue | grep -c 'max-rate="500000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list queue | grep -c 'burst="3000000"') -eq 1]) + +check ovn-nbctl lsp-add ls lsp3 +check ovn-nbctl lsp-set-addresses lsp3 f0:00:00:00:00:03 +as hv-1 +ovs-vsctl add-port br-int vif3 -- \ + set Interface vif3 external-ids:iface-id=lsp3 \ + ofport-request=3 +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp3` = xup]) + +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp3 options:qos_min_rate=700000 +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp3 options:qos_max_rate=800000 +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp3 options:qos_burst=9000000 + +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list qos | grep -c linux-htb) -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="200000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="350000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="3000000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="700000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="800000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="9000000"') -eq 1]) + +check ovn-nbctl --wait=hv remove Logical_Switch_Port lsp3 options qos_min_rate=700000 +check ovn-nbctl --wait=hv remove Logical_Switch_Port lsp3 options qos_max_rate=800000 +check ovn-nbctl --wait=hv remove Logical_Switch_Port lsp3 options qos_burst=9000000 + +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list qos | grep -c linux-htb) -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="200000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="350000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="3000000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="700000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="800000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="9000000"') -eq 0]) + +check ovn-nbctl --wait=hv set Logical_Switch_Port lsp2 options:qos_min_rate=410000 +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list queue | grep -c 'min-rate="410000"') -eq 1]) + +check ovn-nbctl --wait=hv remove Logical_Switch_Port lsp2 options qos_min_rate=410000 +check ovn-nbctl --wait=hv remove Logical_Switch_Port lsp2 options qos_max_rate=500000 +check ovn-nbctl --wait=hv remove Logical_Switch_Port lsp2 options qos_burst=3000000 + +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list qos | grep -c linux-htb) -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list queue | grep -c 'min-rate="410000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list queue | grep -c 'max-rate="500000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-2 ovs-vsctl list queue | grep -c 'burst="3000000"') -eq 0]) + +AT_CLEANUP +]) diff --git a/tests/system-ovn.at b/tests/system-ovn.at index a4387349c..8fe8e4d28 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -6553,6 +6553,11 @@ ADD_VETH(sw01, sw01, br-int, "192.168.1.2/24", "f0:00:00:01:02:03") ovn-nbctl lsp-add sw0 sw01 \ -- lsp-set-addresses sw01 "f0:00:00:01:02:03 192.168.1.2" +ADD_NAMESPACES(sw02) +ADD_VETH(sw02, sw02, br-int, "192.168.1.3/24", "f0:00:00:01:02:44") +ovn-nbctl lsp-add sw0 sw02 \ + -- lsp-set-addresses sw02 "f0:00:00:01:02:44 192.168.1.3" + ovn-nbctl ls-add sw1 ADD_NAMESPACES(sw11) @@ -6560,6 +6565,11 @@ ADD_VETH(sw11, sw11, br-int, "192.168.4.2/24", "f0:00:00:01:04:03") ovn-nbctl lsp-add sw1 sw11 \ -- lsp-set-addresses sw11 "f0:00:00:01:04:03 192.168.4.2" +ADD_NAMESPACES(sw12) +ADD_VETH(sw12, sw12, br-int, "192.168.4.3/24", "f0:00:00:03:04:03") +ovn-nbctl lsp-add sw1 sw12 \ + -- lsp-set-addresses sw11 "f0:00:00:03:04:03 192.168.4.3" + ADD_NAMESPACES(public) ADD_VETH(public, public, br-public, "192.168.2.2/24", "f0:00:00:01:02:05") AT_CHECK([ovs-vsctl remove interface ovs-public external-ids iface-id=public]) @@ -6582,12 +6592,10 @@ ovn-nbctl lsp-add sw1 ext \ 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]) AT_CHECK([ovn-nbctl set Logical_Switch_Port ext options:qos_min_rate=400000]) AT_CHECK([ovn-nbctl set Logical_Switch_Port ext options:qos_max_rate=600000]) AT_CHECK([ovn-nbctl set Logical_Switch_Port ext options:qos_burst=6000000]) -AT_CHECK([ovs-vsctl set interface ovs-ext 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 | \ @@ -6634,6 +6642,80 @@ AT_CHECK([ovn-nbctl remove Logical_Switch_Port public options qos_burst=6000000] OVS_WAIT_UNTIL([test "$(tc qdisc show | grep 'htb 1: dev ovs-public')" = ""]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw01 options:qos_min_rate=200000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw01 options:qos_max_rate=350000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw01 options:qos_burst=3000000]) + +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw11 options:qos_min_rate=400000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw11 options:qos_max_rate=700000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw11 options:qos_burst=6000000]) + +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 .* rate 200Kbit ceil 350Kbit burst 375000b cburst 374999b']) + +OVS_WAIT_UNTIL([tc qdisc show | grep -q 'htb 1: dev ovs-ext']) +OVS_WAIT_UNTIL([tc class show dev ovs-ext | \ + grep -q 'class htb .* prio 0 rate 400Kbit ceil 700Kbit burst 750000b cburst 749999b']) + +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw02 options:qos_min_rate=300000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw02 options:qos_max_rate=500000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw02 options:qos_burst=3000000]) + +OVS_WAIT_UNTIL([tc class show dev ovs-public | \ + grep -q 'class htb .* prio 0 rate 300Kbit ceil 500Kbit burst 375000b cburst 375000b']) + +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw12 options:qos_min_rate=400000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw12 options:qos_max_rate=500000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw12 options:qos_burst=3000000]) + +OVS_WAIT_UNTIL([tc class show dev ovs-ext | \ + grep -q 'class htb .* prio 0 rate 400Kbit ceil 500Kbit burst 375000b cburst 375000b']) + +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw02 options qos_min_rate=300000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw02 options qos_max_rate=500000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw02 options qos_burst=3000000]) + +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 .* rate 200Kbit ceil 350Kbit burst 375000b cburst 374999b']) +OVS_WAIT_UNTIL([test "$(tc class show dev ovs-public | \ + grep 'class htb .* prio 0 rate 300Kbit ceil 500Kbit burst 375000b cburst 375000b')" = ""]) + +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw01 options qos_min_rate=200000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw01 options qos_max_rate=350000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw01 options qos_burst=3000000]) +OVS_WAIT_UNTIL([test "$(tc qdisc show | grep 'htb 1: dev ovs-public')" = ""]) + +OVS_WAIT_UNTIL([tc qdisc show | grep -q 'htb 1: dev ovs-ext']) +OVS_WAIT_UNTIL([tc class show dev ovs-ext | \ + grep -q 'class htb .* prio 0 rate 400Kbit ceil 700Kbit burst 750000b cburst 749999b']) +OVS_WAIT_UNTIL([tc class show dev ovs-ext | \ + grep -q 'class htb .* prio 0 rate 400Kbit ceil 500Kbit burst 375000b cburst 375000b']) + +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw11 options qos_min_rate=400000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw11 options qos_max_rate=700000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw11 options qos_burst=6000000]) + +OVS_WAIT_UNTIL([tc qdisc show | grep -q 'htb 1: dev ovs-ext']) +OVS_WAIT_UNTIL([test "$(tc class show dev ovs-ext | \ + grep 'class htb .* prio 0 rate 400Kbit ceil 700Kbit burst 750000b cburst 749999b')" = ""]) +OVS_WAIT_UNTIL([tc class show dev ovs-ext | \ + grep -q 'class htb .* prio 0 rate 400Kbit ceil 500Kbit burst 375000b cburst 375000b']) + +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw12 options qos_min_rate=400000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw12 options qos_max_rate=500000]) +AT_CHECK([ovn-nbctl remove Logical_Switch_Port sw12 options qos_burst=3000000]) + +OVS_WAIT_UNTIL([test "$(tc qdisc show | grep 'htb 1: dev ovs-ext')" = ""]) + +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw02 options:qos_min_rate=5000000000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw02 options:qos_max_rate=6000000000]) +AT_CHECK([ovn-nbctl set Logical_Switch_Port sw02 options:qos_burst=1000000]) + +OVS_WAIT_UNTIL([tc class show dev ovs-public | \ + grep -q 'class htb .* prio 0 rate 5Gbit ceil 6Gbit burst 125000b cburst 124500b']) + kill $(pidof ovn-controller) as ovn-sb From patchwork Wed May 10 14:21:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779533 X-Patchwork-Delegate: nusiddiq@redhat.com 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.133; helo=smtp2.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=JxElRuGG; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 4QGcgN0fR9z214c for ; Thu, 11 May 2023 00:22:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C23AF42BAC; Wed, 10 May 2023 14:22:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C23AF42BAC Authentication-Results: smtp2.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=JxElRuGG 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 KoD4F8RYJIf8; Wed, 10 May 2023 14:22:34 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id E22D742BEC; Wed, 10 May 2023 14:22:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E22D742BEC Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A62BCC0036; Wed, 10 May 2023 14:22:32 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 18CE4C002A for ; Wed, 10 May 2023 14:22:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8DFC342A21 for ; Wed, 10 May 2023 14:22:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8DFC342A21 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 Z07coh-6IcNg for ; Wed, 10 May 2023 14:22:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 142D642A16 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 142D642A16 for ; Wed, 10 May 2023 14:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728530; 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=XI5UvLwVvBntNHFQwePZkKQStxU4Re4vas2TpSEf/h4=; b=JxElRuGGoL76cERN+muMHzjMLQvz8mT3uzQ4nbabA04IAGjJzxAZqtC6b1Birt1y4/swV6 0JBGu1VlquK7ZuIfTeyqoK5Btccxy2QrkcuTlU4yFy4UHFL8Dn9cREQhIgD6HL6Z+jwVCb 9hZYKcQ5cjz91el+M49r5xSSSny9Asg= 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-341-POi7jLJ-P5yY9rbLHdC_bw-1; Wed, 10 May 2023 10:22:08 -0400 X-MC-Unique: POi7jLJ-P5yY9rbLHdC_bw-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3062a46bf21so4258246f8f.1 for ; Wed, 10 May 2023 07:22:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728527; x=1686320527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XI5UvLwVvBntNHFQwePZkKQStxU4Re4vas2TpSEf/h4=; b=BYoiT+FVAeeXLVlgCg/hIfNrpcjtgDYe35Qy3tdrECK4nwlQPT+v8zPGkb+KKC50e6 f6EdsySHQBVsFZZ4UrDEHuXb5ZjBoqKnkg8Ve/CokeotB0GFYaOo8SxOil8GhU+QbhGw A5pnoPEEki52G2RJJUMdEYkt9XS+hE8baMNS5PhTP6ZLQyUme5BWUqqUYDEe9sk206N4 oTNFzRPucgy0AdwKlhvNb9pMwaaugNbWb05NDnLucDzOla+PN8pfreYX3hWFMKZQjSpF eG7sl6QezLIkQ++UZGzF50c36zbPKSCsWHISjERlqnV4I238VZg4Mse84ZtIYgzpwzTb Hw5w== X-Gm-Message-State: AC+VfDyVvCeRGrPiWXII/PjUOBnWGK7AOaUnsAfFNIljseExtECfEwpC Q3lbPM8ICzpul2/NirKcVzCiC/Dalk19xf5GJ1VPZHrF4FR5DutSb8JUxQ78YPlepzlhoEzxRJP Sr5DW2wm5y2QOh/msT+LViWNjnqdKSIpLRNhNaJ8k9D76cIqFn+/BmbGVAdZDlkh2VsgSxJfoyO 8k73tXlcFmvP/K X-Received: by 2002:adf:ed92:0:b0:2ce:a34b:2b0b with SMTP id c18-20020adfed92000000b002cea34b2b0bmr13049518wro.28.1683728527469; Wed, 10 May 2023 07:22:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5O779g3LKTWjeu16HtS7qw1RMpFWxcmJvBuyCnK8TuDutb7BfDhoCtDEwFvvn7nhg1C9jU0w== X-Received: by 2002:adf:ed92:0:b0:2ce:a34b:2b0b with SMTP id c18-20020adfed92000000b002cea34b2b0bmr13049492wro.28.1683728527057; Wed, 10 May 2023 07:22:07 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id f16-20020a5d6650000000b003062c0ef959sm17438523wrw.69.2023.05.10.07.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:22:06 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:30 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 8/9] controller: get rid of egress_ifaces sset 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" egress_ifaces sset is no longer used by ovn-controller, so get rid of it Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 40 ------------------------------------- controller/binding.h | 1 - controller/ovn-controller.c | 10 ++-------- 3 files changed, 2 insertions(+), 49 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 5ae5d4c1e..467900a40 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -495,39 +495,6 @@ sbrec_get_port_encap(const struct sbrec_chassis *chassis_rec, return best_encap; } -static void -add_localnet_egress_interface_mappings( - const struct sbrec_port_binding *port_binding, - struct shash *bridge_mappings, struct sset *egress_ifaces) -{ - const char *network = smap_get(&port_binding->options, "network_name"); - if (!network) { - return; - } - - struct ovsrec_bridge *br_ln = shash_find_data(bridge_mappings, network); - if (!br_ln) { - return; - } - - /* Add egress-ifaces from the connected bridge */ - for (size_t i = 0; i < br_ln->n_ports; i++) { - const struct ovsrec_port *port_rec = br_ln->ports[i]; - - for (size_t j = 0; j < port_rec->n_interfaces; j++) { - const struct ovsrec_interface *iface_rec; - - iface_rec = port_rec->interfaces[j]; - bool is_egress_iface = smap_get_bool(&iface_rec->external_ids, - "ovn-egress-iface", false); - if (!is_egress_iface) { - continue; - } - sset_add(egress_ifaces, iface_rec->name); - } - } -} - static bool is_network_plugged(const struct sbrec_port_binding *binding_rec, struct shash *bridge_mappings) @@ -568,7 +535,6 @@ update_ld_multichassis_ports(const struct sbrec_port_binding *binding_rec, static void update_ld_localnet_port(const struct sbrec_port_binding *binding_rec, struct shash *bridge_mappings, - struct sset *egress_ifaces, struct hmap *local_datapaths) { /* Ignore localnet ports for unplugged networks. */ @@ -576,9 +542,6 @@ update_ld_localnet_port(const struct sbrec_port_binding *binding_rec, return; } - add_localnet_egress_interface_mappings(binding_rec, - bridge_mappings, egress_ifaces); - struct local_datapath *ld = get_local_datapath(local_datapaths, binding_rec->datapath->tunnel_key); @@ -2148,7 +2111,6 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) struct lport *lnet_lport; LIST_FOR_EACH_POP (lnet_lport, list_node, &localnet_lports) { update_ld_localnet_port(lnet_lport->pb, &bridge_mappings, - b_ctx_out->egress_ifaces, b_ctx_out->local_datapaths); free(lnet_lport); } @@ -2958,7 +2920,6 @@ handle_updated_port(struct binding_ctx_in *b_ctx_in, b_ctx_in->bridge_table, &bridge_mappings); update_ld_localnet_port(pb, &bridge_mappings, - b_ctx_out->egress_ifaces, b_ctx_out->local_datapaths); shash_destroy(&bridge_mappings); break; @@ -3154,7 +3115,6 @@ delete_done: enum en_lport_type lport_type = get_lport_type(pb); if (lport_type == LP_LOCALNET) { update_ld_localnet_port(pb, &bridge_mappings, - b_ctx_out->egress_ifaces, b_ctx_out->local_datapaths); } else if (lport_type == LP_EXTERNAL) { update_ld_external_ports(pb, b_ctx_out->local_datapaths); diff --git a/controller/binding.h b/controller/binding.h index 6b97bcff0..84b4cb591 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -91,7 +91,6 @@ struct binding_ctx_out { */ bool non_vif_ports_changed; - struct sset *egress_ifaces; struct hmap *qos_map; /* smap of OVS interface name as key and * OVS interface external_ids:iface-id as value. */ diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 1bf93d859..6dc0fac46 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1346,7 +1346,6 @@ struct ed_type_runtime_data { struct sset active_tunnels; /* runtime data engine private data. */ - struct sset egress_ifaces; struct hmap qos_map; struct smap local_iface_ids; @@ -1406,8 +1405,8 @@ struct ed_type_runtime_data { * | local_lport_ids | is not tracked explicitly. | * --------------------------------------------------------------------- * | local_iface_ids | This is used internally within the runtime data | - * | egress_ifaces | engine (used only in binding.c) and hence there | - * | qos_map | there is no need to track. | + * | qos_map | engine (used only in binding.c) and hence there | + * | | there is no need to track. | * --------------------------------------------------------------------- * | | Active tunnels is built in the | * | | bfd_calculate_active_tunnels() for the tunnel | @@ -1443,7 +1442,6 @@ en_runtime_data_init(struct engine_node *node OVS_UNUSED, sset_init(&data->local_lports); related_lports_init(&data->related_lports); sset_init(&data->active_tunnels); - sset_init(&data->egress_ifaces); hmap_init(&data->qos_map); smap_init(&data->local_iface_ids); local_binding_data_init(&data->lbinding_data); @@ -1464,7 +1462,6 @@ en_runtime_data_cleanup(void *data) sset_destroy(&rt_data->local_lports); related_lports_destroy(&rt_data->related_lports); sset_destroy(&rt_data->active_tunnels); - sset_destroy(&rt_data->egress_ifaces); destroy_qos_map(&rt_data->qos_map); smap_destroy(&rt_data->local_iface_ids); local_datapaths_destroy(&rt_data->local_datapaths); @@ -1554,7 +1551,6 @@ init_binding_ctx(struct engine_node *node, b_ctx_out->related_lports = &rt_data->related_lports; b_ctx_out->related_lports_changed = false; b_ctx_out->non_vif_ports_changed = false; - b_ctx_out->egress_ifaces = &rt_data->egress_ifaces; b_ctx_out->qos_map = &rt_data->qos_map; b_ctx_out->lbinding_data = &rt_data->lbinding_data; b_ctx_out->local_iface_ids = &rt_data->local_iface_ids; @@ -1585,14 +1581,12 @@ en_runtime_data_run(struct engine_node *node, void *data) sset_destroy(local_lports); related_lports_destroy(&rt_data->related_lports); sset_destroy(active_tunnels); - sset_destroy(&rt_data->egress_ifaces); destroy_qos_map(&rt_data->qos_map); smap_destroy(&rt_data->local_iface_ids); hmap_init(local_datapaths); sset_init(local_lports); related_lports_init(&rt_data->related_lports); sset_init(active_tunnels); - sset_init(&rt_data->egress_ifaces); hmap_init(&rt_data->qos_map); smap_init(&rt_data->local_iface_ids); local_binding_data_init(&rt_data->lbinding_data); From patchwork Wed May 10 14:21:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1779534 X-Patchwork-Delegate: nusiddiq@redhat.com 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=2605:bc80:3010::138; helo=smtp1.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=C7930gJC; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QGcgc29vnz214M for ; Thu, 11 May 2023 00:22:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 70E89846CE; Wed, 10 May 2023 14:22:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 70E89846CE 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=C7930gJC X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QIzrcfBg6ida; Wed, 10 May 2023 14:22:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 9A9D0846A0; Wed, 10 May 2023 14:22:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 9A9D0846A0 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6F596C007C; Wed, 10 May 2023 14:22:48 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id A9C47C002A for ; Wed, 10 May 2023 14:22:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 478C86FE8B for ; Wed, 10 May 2023 14:22:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 478C86FE8B Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=C7930gJC 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 5hylNfQXPTke for ; Wed, 10 May 2023 14:22:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9BE336FE87 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9BE336FE87 for ; Wed, 10 May 2023 14:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683728532; 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=GWZY6IAa85J9Rn/wFODUoaxMulPIhUMPsbnEe6yD6RU=; b=C7930gJCOTSAkVVBqPJMx5UMDlLWkW+bgW5JB8GcQVlWarP0xb9Aj8GqSf+iX8DAfsW8wJ qZmH8tARYsyuyL/fCmnAkJ6jrsXrvnGyN45QYh5Kj1TV47Aks+mw4MR3wwDxFfcbgaLk7g u8ORwmwDL87WY7Rw3BGY0sqanj9CTBc= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-C174InMwM1ya9H1iVlqpMw-1; Wed, 10 May 2023 10:22:11 -0400 X-MC-Unique: C174InMwM1ya9H1iVlqpMw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f4221cd284so15187835e9.0 for ; Wed, 10 May 2023 07:22:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683728529; x=1686320529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GWZY6IAa85J9Rn/wFODUoaxMulPIhUMPsbnEe6yD6RU=; b=kwDJye5sKgaj3m4E34497QVhRvI3M2cMTUBlRhnkgG6ynA/uiIfnVFc3LhG+feaEGv KYFEOLYpKxm/MwurEFQBwt1YEGHZWduSgnZNSIhPeZ4FZnxoybadn+VHEVm+I95FzQ85 xh9Kggdj+5AUCkDVamm+xN9vm9FAOhg/gVed2cLVYHPPU56QR10AiXVnNYO9Sc9lq5QH 7VL/StcRWvL7BgrrNwalIWNFh767gElvlnzxp5p70tYUoOHLl7UzsM54AOjqG0tB+QKw X3Xqb6yiscj8BYdI0PxkjuhM394eurxQQkIBcHuoY6HMRRKv5F34uV35F/R9HJvPZIxh 0yGg== X-Gm-Message-State: AC+VfDzkVt/4Mwkz6iBEK3bvX9RwKB7WdYTWHGh1PSeniyJwBe2uBzAZ eGgk/3pUtnJplIV9YS0SJt0y03CpYguLsSDcaEik2Rwd3slrynmkt9HlicEaD6OiA+stKprOR7Z ge4H6ByIHDSPw6nXv5D0s5I+XCvAqeDiNeXn3YDM5sKnkwI4KdHEojQXL7Ju61/CYAUH4gnwkHd cr5YYEvjC5Q/ZU X-Received: by 2002:a7b:c3d9:0:b0:3f4:2d31:11b2 with SMTP id t25-20020a7bc3d9000000b003f42d3111b2mr3709056wmj.13.1683728529481; Wed, 10 May 2023 07:22:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5dDKwEQkuPSSDa1BQOwTUsGew4QqAlK8kRmT6ltiN9K1PY1CeazI56F4690wrOaxGnCLUlOA== X-Received: by 2002:a7b:c3d9:0:b0:3f4:2d31:11b2 with SMTP id t25-20020a7bc3d9000000b003f42d3111b2mr3709035wmj.13.1683728529132; Wed, 10 May 2023 07:22:09 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id s9-20020a5d5109000000b002ffbf2213d4sm17410185wrt.75.2023.05.10.07.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 07:22:08 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Wed, 10 May 2023 16:21:31 +0200 Message-Id: <7d4412b6cecfaf915a75fb5896361caad920a57a.1683728227.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com, simon.horman@corigine.com, i.maximets@ovn.org, ralonsoh@redhat.com Subject: [ovs-dev] [PATCH v6 ovn 9/9] update NEWS with new QoS info 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" Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2129742 Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2139100 Acked-By: Ihar Hrachyshka Signed-off-by: Lorenzo Bianconi --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 1f1ac8c5a..f467d7bbe 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,12 @@ Post v23.03.0 Listener Discovery protocols, regardless of ACLs defined. - Add IPv6 iPXE support introducing "bootfile_name" (59) and "bootfile_name_alt" (254) options to ovn dhcpv6 server. + - Rework OVN egress QoS implementation in order to rely on OvS interface + instead of directly running tc from OVN. Get rid of traffic shaping on the + tunnel interfaces. Now for LSPs running on a LogicalSwitch with a localnet + port is possible to define QoS rules to apply to the local egress localnet + port. Please note now the QoS will be applied just to the local localnet + port and not to all localnet port marked with ovn-egress iface. OVN v23.03.0 - 03 Mar 2023 --------------------------