From patchwork Thu May 18 09:48: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: 1783099 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=PJCq6Gqh; 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 4QMQD13Lv3z20dy for ; Thu, 18 May 2023 19:49:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2399042877; Thu, 18 May 2023 09:49:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2399042877 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=PJCq6Gqh 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 j6WX9LhHNtA7; Thu, 18 May 2023 09:49:02 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id E310C4282B; Thu, 18 May 2023 09:49:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E310C4282B Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CE264C008B; Thu, 18 May 2023 09:48:58 +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 96B57C002A for ; Thu, 18 May 2023 09:48:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 71C8C42A4C for ; Thu, 18 May 2023 09:48:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 71C8C42A4C 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=PJCq6Gqh 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 PRTaP1vS-x5P for ; Thu, 18 May 2023 09:48:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C866140CB3 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 C866140CB3 for ; Thu, 18 May 2023 09:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403334; 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=BGLTQDViOF7ltSgGkPnREmPvsNr16gfSXo5CBfGGloQ=; b=PJCq6Gqhys6FFXYAQhEe49lN5mOPp283wmJKMw+AsG4JDdB+PIRK3UN5KmayRnZk1uD8+Z QwwoGiOQ/7JdjRh0T6lFbxjmhAxBycN3QIoiZUixHWltT86zIjnvUCd/pErQHZXpnaRa2R 9RvetO+AHk0U4oWfSYeJgzRHXb+KdlI= 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-148-MKWR9uadOfKQY25L0vAFVw-1; Thu, 18 May 2023 05:48:53 -0400 X-MC-Unique: MKWR9uadOfKQY25L0vAFVw-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3094e661decso82113f8f.2 for ; Thu, 18 May 2023 02:48:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403332; x=1686995332; 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=BGLTQDViOF7ltSgGkPnREmPvsNr16gfSXo5CBfGGloQ=; b=WIxLAn/wNQo7/EyDG5dG4R1UrY7Ku5wMomqAvZ3dYNK0EWsGzYOEvdxOIGtX5P16bW dp0HK89dBGSkJsmX1NZ25w++jKSFs6u5m0YzyLENLlTXKz2qsa1pdVqQD82fK4eIvPsu 1CSImon+9UfR8gai1f34pdUmmhtSyfKyYrw5x9WOu7FN1FuGoOe5gUj1o69M6nkoyfmW J3EOwt0W+vJU4379RggSY+p6fHS7BELJih/NNZF9hq6SmsduwHns6salpoTSHgZ6g/TV 3in6iW92FYufo2LEkgy6MaprpiyTyqPQsNUtlAWgaCOKz9OgKaFvK0vEy78DdMU+Ud5X KCoQ== X-Gm-Message-State: AC+VfDwIJrchK7Ai7affdUarQ32dNhSnZlFEhRaUtSxGBxsDkDDlXucl uLj5YuDeIJistZRUJLrnMIxMr3mH79Euks9L6J5kMPI+2FPPhzhBw/E8mDdlgY1uhIhhsAbWV47 5uL5OWeX24vaKdIKJg5ZY7OIEK33tj/axLqJ2R3XwAf1aItMPf2gobKdfQKwnLYimNQf+f6N+/m aYCghSGnDibBzR X-Received: by 2002:adf:fd41:0:b0:304:6762:2490 with SMTP id h1-20020adffd41000000b0030467622490mr1098639wrs.3.1684403332132; Thu, 18 May 2023 02:48:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4JZcQz8QXY5rKVck4ox2H/OVgGW5wss1tP0QbFd8/Mfl7oFU4mi8OGeEO/yJRV9Dc9d1ldhQ== X-Received: by 2002:adf:fd41:0:b0:304:6762:2490 with SMTP id h1-20020adffd41000000b0030467622490mr1098616wrs.3.1684403331762; Thu, 18 May 2023 02:48: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 k17-20020a5d5251000000b003079693eff2sm1594186wrc.41.2023.05.18.02.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:48:51 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:31 +0200 Message-Id: <969d8b59ae073b5a562b4d657b39a834a325d4cc.1684403044.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 v9 ovn 01/10] 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: Numan Siddique 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 Thu May 18 09:48:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783100 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=Y0E/KlpY; 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 4QMQD55vGYz20dn for ; Thu, 18 May 2023 19:49:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D0F1F843D1; Thu, 18 May 2023 09:49:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D0F1F843D1 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=Y0E/KlpY 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 xbsbfHHBiTdV; Thu, 18 May 2023 09:49:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 29B4D83F17; Thu, 18 May 2023 09:49:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 29B4D83F17 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 62C97C0037; Thu, 18 May 2023 09:49:01 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 087DFC0035 for ; Thu, 18 May 2023 09:49:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C220F42A5C for ; Thu, 18 May 2023 09:48:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C220F42A5C 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=Y0E/KlpY 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 xP28aZ1qWZhb for ; Thu, 18 May 2023 09:48:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 390F042A4C 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 390F042A4C for ; Thu, 18 May 2023 09:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403337; 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=3ofOuj+JyqFGQBRYmebWZ12kTtL1Oe3cVLJf2/ZxeoM=; b=Y0E/KlpY6ccRyql5OxjPHvuBKQkZsNXUf8ORXlQubH3siET6lQlSKcOKdpb5dC6Jtf2X6N /aI9fhj16d/WwG+qs0+YB1WBADf4QzsiR0paV/nOHaxi/W8YMVIT41kEwCYqfSc9wVVqQR YhWh6DAI2PCM9BO610Vahv5CQdb3Wy0= 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-575-f_Mglc5XOQK1ZDgkxyABNQ-1; Thu, 18 May 2023 05:48:56 -0400 X-MC-Unique: f_Mglc5XOQK1ZDgkxyABNQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f518f2900eso12259345e9.2 for ; Thu, 18 May 2023 02:48:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403334; x=1686995334; 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=3ofOuj+JyqFGQBRYmebWZ12kTtL1Oe3cVLJf2/ZxeoM=; b=NkLzReqL64oovukt8JiQ0G0eVfQkz3jY5eJ4D7QY9FXV1RzM35iKh0BVeEED2M9adw sUgWL9Zus3H9jOVRyDb6EKVyeB3rjldO9+FB1pm1JOW8IJiDDUjTa2XTZCulCBCQK+1E qHTEH/rlL54Goglw9CTVnOJZkT4budu3BuNB2ZW2NWRLHJ3/LwYKsQVXmmhH2BKqm2zd /xcuu6BKLALzygVZQAc98m2ZVoQqAJTXbYkV3a+/FHWjq0cuDNMpK7XA+qcJIWhW41m0 tlc6GQgf7c++eCNeuOkiOek3hOc7gihtle5bKCQiJpWZbhHWA8V01iL9Rcd9dAamdr2t G8Aw== X-Gm-Message-State: AC+VfDxTlvu8cptQKnGNYWXjZvQsgWrBT2lULYpbiw7FDcg2ZPhDGFcB iqJov7wcl3Wujh7ToSU1N6+Xx1yYYVHze0aF5lBst5nu0WKlp4EOE9uXCYMSF5FCmWh+dse954D nJXSzgHsbI2f5cJr9bV07BcFwVNtLsNFBhGKphiAuLWMk5ZVqRatuQ6sK953emtBw2QxhARDf5N Rw2Kwz+175AkDm X-Received: by 2002:a7b:c8c4:0:b0:3f4:f0c2:143 with SMTP id f4-20020a7bc8c4000000b003f4f0c20143mr1029515wml.20.1684403334462; Thu, 18 May 2023 02:48:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6VD4xOOPioqrtY7yx8urNkI9eRw/3yUKQAzpz7NQezgEBNQkgr8rQN3Hc2rx2zsbkUHSAvjA== X-Received: by 2002:a7b:c8c4:0:b0:3f4:f0c2:143 with SMTP id f4-20020a7bc8c4000000b003f4f0c20143mr1029493wml.20.1684403333937; Thu, 18 May 2023 02:48: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 f10-20020a7bcd0a000000b003f17848673fsm1483509wmj.27.2023.05.18.02.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:48:53 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:32 +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 v9 ovn 02/10] 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" Introduce support to process incrementally ovn-controller QoS configuration received from ovn-northd adding qos_map hash map. 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. Acked-by: Numan Siddique Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 201 ++++++++++++++++++------------------ controller/binding.h | 3 + controller/ovn-controller.c | 8 +- 3 files changed, 109 insertions(+), 103 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index a0fbacc97..ad19a4092 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,48 @@ 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; + + 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) +{ + struct qos_queue *q; + HMAP_FOR_EACH_WITH_HASH (q, node, hash, queue_map) { + if (!strcmp(q->port, port)) { + return q; + } + } + return NULL; +} + static void -get_qos_params(const struct sbrec_port_binding *pb, struct hmap *queue_map) +qos_queue_erase_entry(struct qos_queue *q) +{ + 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) { + qos_queue_erase_entry(q); + } + hmap_destroy(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); @@ -160,12 +192,17 @@ 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_string(pb->logical_port, 0); + struct qos_queue *q = find_qos_queue(queue_map, hash, pb->logical_port); + if (!q) { + q = xzalloc(sizeof *q); + hmap_insert(queue_map, &q->node, hash); + q->port = xstrdup(pb->logical_port); + q->queue_id = queue_id; + } + q->min_rate = min_rate; + q->max_rate = max_rate; + q->burst = burst; } static const struct ovsrec_qos * @@ -354,17 +391,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 +677,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 +1495,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 +1527,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 +1562,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 +1594,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 +1649,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 +1681,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 +1715,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 +1729,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 +1847,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 +1970,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 +2011,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 +2022,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 +2049,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 +2111,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 +2203,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 +2251,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 +2262,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 +2549,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 +2577,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 +2691,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 +2731,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 +2796,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 +2818,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 +2832,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 +2892,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); @@ -3029,10 +3032,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,7 +3043,7 @@ 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; } @@ -3061,7 +3060,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 +3106,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 +3262,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 +3284,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 Thu May 18 09:48:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783101 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=UMoFDHxW; 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 4QMQD76MmKz20dn for ; Thu, 18 May 2023 19:49:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E043E42A86; Thu, 18 May 2023 09:49:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E043E42A86 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=UMoFDHxW 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 RGLGvmUtiPn3; Thu, 18 May 2023 09:49:05 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2959642A7B; Thu, 18 May 2023 09:49:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2959642A7B Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 748D8C0097; Thu, 18 May 2023 09:49:02 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 44AC1C0035 for ; Thu, 18 May 2023 09:49:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0D8614285A for ; Thu, 18 May 2023 09:49:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0D8614285A Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UMoFDHxW 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 aM2CVpMltkE6 for ; Thu, 18 May 2023 09:49:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E639A4271E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id E639A4271E for ; Thu, 18 May 2023 09:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403338; 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=OXUTLjEYeM6RhpIHfx08a2DHi2rFJt51D779nkz65f0=; b=UMoFDHxWYiVDNr3+4NLaUftVTuxoz6ADgM/leQMCwgHB1RkPJlFFJM+3DNu2+/GiUOi87H wVxKYmlkXyfUUwFhx1zjjbDopTah5/bM0MSNXDxM8WC0Xw6ecmw8uaOaGJIzrm1SmuHVsK Olt/mV3m1M1qQXfoUI3KcrrlV3QSgaE= 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-595-wEMJZpJDNJuIPm3W9TEuDg-1; Thu, 18 May 2023 05:48:58 -0400 X-MC-Unique: wEMJZpJDNJuIPm3W9TEuDg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f4221cd284so6860415e9.0 for ; Thu, 18 May 2023 02:48:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403336; x=1686995336; 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=OXUTLjEYeM6RhpIHfx08a2DHi2rFJt51D779nkz65f0=; b=YMybhYdZHpU38/l32PCo8Nv42rA2JMQr4VPjOaaBqJSqg+0QAKYHlfDj+sMzi+87/1 T27ytvhpJkAAcm7MzsnQwTS3QkbLX/AlzcYQAVGS496+fdvivLaCLCguYCSiHTFtBNfe j3emlWsU/yCig8wsssT6d5AKA1BL+SReDS4USn0svWDCYm4y3JCBxQzfiIZ30HCCTDwq q+x3W0lIYsa9yf7viQ+9970rVyMLV0HIlBkx1oS6m32p5Q3kvRFjokZPvLMb5YGUAdju dvNjDVr2tTvmv/ofqH26JjR/CAwtfzMjKo66csgD9/CqmDB6o0sXFjdpUOPXuqAgPlTw Xa0Q== X-Gm-Message-State: AC+VfDwLgiYFab1CLimLOHXACANH4rqH0W+YtMbUlqnBzb/IhMKdN94t OQdGMqmjv3qMnqppysKI2gzI7fOWE4yNy7fwRGdxY464vcQ7UDHck0+vdsMo96r0xZFwBU8pvtO DvvhsjyVAl2QSDguS1Uxk8zGYRFC4pyRslbUkUY6e/J7vqLxRdHziUQxY4JMRh3Y0JFkinKunxx 7bPOqGo5RyAScw X-Received: by 2002:a7b:ca49:0:b0:3f4:298f:4cf2 with SMTP id m9-20020a7bca49000000b003f4298f4cf2mr998645wml.24.1684403336551; Thu, 18 May 2023 02:48:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4OStoyoN28U5UIAzXuFc8q/CRf0AHbpAd6TLLd0OtfQYyYTcsS3EvrqdNjnt+8csRwTHsXVQ== X-Received: by 2002:a7b:ca49:0:b0:3f4:298f:4cf2 with SMTP id m9-20020a7bca49000000b003f4298f4cf2mr998627wml.24.1684403336160; Thu, 18 May 2023 02:48:56 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id l24-20020a1ced18000000b003f4f1b884cdsm4783818wmh.36.2023.05.18.02.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:48:55 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:33 +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 v9 ovn 03/10] northd: add qos_physical_network in port_binding 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" Introduce qos_physical_network in port_binding config column in order to indicate the name of the egress network name where traffic shaping will be applied. 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. Acked-by: Numan Siddique Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 6 ++++++ northd/northd.c | 10 ++++++++++ ovn-sb.xml | 5 +++++ tests/ovn-northd.at | 22 ++++++++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/controller/binding.c b/controller/binding.c index ad19a4092..5040b426f 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; uint32_t queue_id; @@ -165,6 +166,7 @@ find_qos_queue(struct hmap *queue_map, uint32_t hash, const char *port) static void qos_queue_erase_entry(struct qos_queue *q) { + free(q->network); free(q->port); free(q); } @@ -186,6 +188,7 @@ 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) { /* Qos is not configured for this port. */ @@ -200,6 +203,9 @@ get_qos_queue(const struct sbrec_port_binding *pb, struct hmap *queue_map) q->port = xstrdup(pb->logical_port); q->queue_id = queue_id; } + + free(q->network); + q->network = network ? xstrdup(network) : NULL; q->min_rate = min_rate; q->max_rate = max_rate; q->burst = burst; diff --git a/northd/northd.c b/northd/northd.c index 7190cd18f..470f76809 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -3505,7 +3505,17 @@ 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"); + if (physical_network) { + 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 ead9efcab..0988cb1f8 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -3691,6 +3691,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 diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 1f6169b77..a9af0f76a 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -9064,3 +9064,25 @@ mac_binding_timestamp: true AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD_NO_HV([ +AT_SETUP([check OVN QoS]) +AT_KEYWORDS([OVN-QoS]) +ovn_start + +check ovn-nbctl ls-add ls +check ovn-nbctl lsp-add ls public +check ovn-nbctl lsp-set-type public localnet +check ovn-nbctl lsp-set-addresses public unknown + +check_column "" sb:Port_Binding options logical_port=public + +check ovn-nbctl --wait=sb set Logical_Switch_Port public options:qos_min_rate=200000 +AT_CHECK([fetch_column sb:Port_Binding options logical_port=public |grep -q 'qos_min_rate=200000']) +AT_CHECK([fetch_column sb:Port_Binding options logical_port=public |grep -q 'qos_physical_network'],[1]) + +check ovn-nbctl --wait=sb set Logical_Switch_Port public options:qos_min_rate=200000 options:network_name=phys +AT_CHECK([fetch_column sb:Port_Binding options logical_port=public |grep -q 'qos_physical_network=phys']) + +AT_CLEANUP +]) From patchwork Thu May 18 09:48:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783102 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=Infi0mxB; 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 4QMQDB52SCz20dn for ; Thu, 18 May 2023 19:49:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5C85C42A9B; Thu, 18 May 2023 09:49:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5C85C42A9B 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=Infi0mxB 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 O7n7jVfD0SrA; Thu, 18 May 2023 09:49:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 49FDC42A4D; Thu, 18 May 2023 09:49:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 49FDC42A4D Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0D2DEC0037; Thu, 18 May 2023 09:49:09 +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 2B542C008A for ; Thu, 18 May 2023 09:49:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 450116FF6F for ; Thu, 18 May 2023 09:49:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 450116FF6F 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=Infi0mxB 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 O8p6nQg34DYk for ; Thu, 18 May 2023 09:49:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0DB406FF52 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 0DB406FF52 for ; Thu, 18 May 2023 09:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403342; 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=VTSrC9BN+LjOfjTSBbwPBqw/OUrUrynr7ZH1tAc0MbA=; b=Infi0mxBnW2iarKg6V5n7xuA1mlfK1u3Vws/+H7pnxMn7oPgLlcJE1D+S/2SNCCneDqMF2 uSnqz5wC2rMx4ZX8de8C9O/EmMFprtucKKRc65ryQPw3nVYMvoa+HyGHKLWcboonvuq4zB bkKeG6H5//FEd7AkIKFPFxgZXTrgfBA= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-191-R0E6-7QvPOm9Lupc4As-jg-1; Thu, 18 May 2023 05:49:00 -0400 X-MC-Unique: R0E6-7QvPOm9Lupc4As-jg-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-307bac4c949so1157517f8f.0 for ; Thu, 18 May 2023 02:49:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403339; x=1686995339; 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=VTSrC9BN+LjOfjTSBbwPBqw/OUrUrynr7ZH1tAc0MbA=; b=i+1IBHwH1g0PZ0Mga0cAhYLiJcWnLsXumeJCxvjHpfyMCfCcVImJiavIosQzTrHcwt WFeNQCDCYPmgZ1Zks1WdU1+jCSzfc3y/NQuFHu0B+KQ7I0f/v0M6GcXrhOH6GanhhJXl 3jQqMSRsNCJqmRqb/p7VTzKNR4TwhYIsDCuMo6G7p45hwUNQ06laHXGxH25sdIjVFDtq TABP8MrOyGHVd9Mm1Xx+uuee6yYsxMjfGu85PR7avjjc7Kyurx1Fb0ueo784NfU+kO8p Uz3zoR7CxzOfOJezSQum+6Dr8/gjWxJ4Q4ucU11WYyd7Pir0uPB/c1O0DXiawngre49C 1acw== X-Gm-Message-State: AC+VfDzAx3GLajHAbVMoP0pZGAXr8wpKEE9kfK5xZLjdjmBZbstRk5h3 NWj6T5lcFuRquu6pPQSSi6YQ/gQCDDVhmXH9Fs6jt5h0ahi2d075yJcOB6X/l9nWELgDwdT49/u dCpMCjOdQvIo9WBVrIt6c6/GZjcaosbbZu0CfxqMVjLhFNbDgu1gZn1OG4EVto2fHCqZtJuFPbL 1D9HZjB+FkM6OJ X-Received: by 2002:a5d:4e05:0:b0:307:8b3e:285a with SMTP id p5-20020a5d4e05000000b003078b3e285amr936192wrt.67.1684403338868; Thu, 18 May 2023 02:48:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Myb+xXpVyDSQXpSUCSnrG6JpfLBTeR6w14fLIq5XjZFPbxLe02HNcctIU9+V3AuP1UxXtRw== X-Received: by 2002:a5d:4e05:0:b0:307:8b3e:285a with SMTP id p5-20020a5d4e05000000b003078b3e285amr936173wrt.67.1684403338317; Thu, 18 May 2023 02:48: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 d10-20020adff84a000000b00307c46f4f08sm1624615wrq.79.2023.05.18.02.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:48:58 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:34 +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 v9 ovn 04/10] 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 | 428 +++++++++++++++++++----------------- controller/ovn-controller.c | 8 + tests/ovn-performance.at | 5 - tests/system-ovn.at | 67 +++++- 4 files changed, 296 insertions(+), 212 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 5040b426f..36e63ed64 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -181,220 +181,266 @@ destroy_qos_map(struct hmap *qos_map) hmap_destroy(qos_map); } -static void -get_qos_queue(const struct sbrec_port_binding *pb, struct hmap *queue_map) +static const struct ovsrec_interface * +get_qos_egress_port_interface(struct shash *bridge_mappings, + const struct ovsrec_port **pport, + const char *network) { - uint32_t min_rate = smap_get_int(&pb->options, "qos_min_rate", 0); - uint32_t max_rate = smap_get_int(&pb->options, "qos_max_rate", 0); - uint32_t burst = smap_get_int(&pb->options, "qos_burst", 0); - uint32_t queue_id = smap_get_int(&pb->options, "qdisc_queue_id", 0); - const char *network = smap_get(&pb->options, "qos_physical_network"); + struct ovsrec_bridge *br_ln = shash_find_data(bridge_mappings, network); + if (!br_ln) { + return NULL; + } - if ((!min_rate && !max_rate && !burst) || !queue_id) { - /* Qos is not configured for this port. */ + /* 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]; + + if (smap_get(&iface->external_ids, "iface-id")) { + continue; + } + + bool is_egress_iface = smap_get_bool(&iface->external_ids, + "ovn-egress-iface", false); + if (is_egress_iface) { + *pport = port; + return iface; + } + } + } + + 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 +add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, + const struct ovsrec_port *port, + uint32_t min_rate, uint32_t max_rate, + uint32_t burst, uint32_t queue_id, + const char *ovn_port) +{ + struct smap external_ids = SMAP_INITIALIZER(&external_ids); + struct smap other_config = SMAP_INITIALIZER(&other_config); + + const struct ovsrec_qos *qos = port->qos; + if (qos && !smap_get_bool(&qos->external_ids, "ovn_qos", false)) { + /* External configured QoS, do not overwrite it. */ return; } - uint32_t hash = hash_string(pb->logical_port, 0); - struct qos_queue *q = find_qos_queue(queue_map, hash, pb->logical_port); - if (!q) { - q = xzalloc(sizeof *q); - hmap_insert(queue_map, &q->node, hash); - q->port = xstrdup(pb->logical_port); - q->queue_id = queue_id; + 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); + + smap_add(&external_ids, "ovn_qos", "true"); + ovsrec_qos_set_external_ids(qos, &external_ids); + smap_clear(&external_ids); } - free(q->network); - q->network = network ? xstrdup(network) : NULL; - q->min_rate = min_rate; - q->max_rate = max_rate; - q->burst = burst; -} + struct ovsrec_queue *queue; + size_t i; + for (i = 0; i < qos->n_queues; i++) { + queue = qos->value_queues[i]; -static const struct ovsrec_qos * -get_noop_qos(struct ovsdb_idl_txn *ovs_idl_txn, - const struct ovsrec_qos_table *qos_table) -{ - const struct ovsrec_qos *qos; - OVSREC_QOS_TABLE_FOR_EACH (qos, qos_table) { - if (!strcmp(qos->type, "linux-noop")) { - return qos; + const char *p = smap_get(&queue->external_ids, "ovn_port"); + if (p && !strcmp(p, ovn_port)) { + break; } } - if (!ovs_idl_txn) { - return NULL; + if (i == qos->n_queues) { + queue = ovsrec_queue_insert(ovs_idl_txn); + ovsrec_qos_update_queues_setkey(qos, queue_id, queue); } - qos = ovsrec_qos_insert(ovs_idl_txn); - ovsrec_qos_set_type(qos, "linux-noop"); - return qos; + + smap_add_format(&other_config, "max-rate", "%d", max_rate); + smap_add_format(&other_config, "min-rate", "%d", min_rate); + smap_add_format(&other_config, "burst", "%d", burst); + ovsrec_queue_verify_other_config(queue); + ovsrec_queue_set_other_config(queue, &other_config); + smap_destroy(&other_config); + + smap_add(&external_ids, "ovn_port", ovn_port); + ovsrec_queue_verify_external_ids(queue); + ovsrec_queue_set_external_ids(queue, &external_ids); + smap_destroy(&external_ids); } -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) +static void +remove_stale_qos_entry(struct ovsdb_idl_txn *ovs_idl_txn, + const struct sbrec_port_binding *pb, + const struct ovsrec_port_table *port_table, + const struct ovsrec_qos_table *qos_table, + struct hmap *queue_map) { if (!ovs_idl_txn) { - return false; + return; } - const struct ovsrec_qos *noop_qos = get_noop_qos(ovs_idl_txn, qos_table); - if (!noop_qos) { - return false; + struct qos_queue *q = find_qos_queue( + queue_map, hash_string(pb->logical_port, 0), + pb->logical_port); + if (!q) { + return; } - const struct ovsrec_port *port; - size_t count = 0; + const struct ovsrec_qos *qos; + OVSREC_QOS_TABLE_FOR_EACH (qos, qos_table) { + for (size_t i = 0; i < qos->n_queues; i++) { + struct ovsrec_queue *queue = qos->value_queues[i]; + if (!queue) { + 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; + const char *ovn_port = smap_get( + &queue->external_ids, "ovn_port"); + if (!ovn_port || strcmp(ovn_port, q->port)) { + continue; + } + + ovsrec_qos_update_queues_delkey(qos, qos->key_queues[i]); + ovsrec_queue_delete(queue); + + if (qos->n_queues == 1) { + const struct ovsrec_port *port = NULL, *iter; + OVSREC_PORT_TABLE_FOR_EACH (iter, port_table) { + if (iter->qos == qos) { + port = iter; + break; + } + } + if (port) { + ovsrec_port_set_qos(port, NULL); + } + ovsrec_qos_delete(qos); + } + + hmap_remove(queue_map, &q->node); + qos_queue_erase_entry(q); + + return; } } - return true; } static void -set_qos_type(struct netdev *netdev, const char *type) +configure_qos(const struct sbrec_port_binding *pb, + struct binding_ctx_in *b_ctx_in, + struct binding_ctx_out *b_ctx_out) { - /* 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)); - } -} -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; + uint32_t min_rate = smap_get_int(&pb->options, "qos_min_rate", 0); + uint32_t max_rate = smap_get_int(&pb->options, "qos_max_rate", 0); + uint32_t burst = smap_get_int(&pb->options, "qos_burst", 0); + uint32_t queue_id = smap_get_int(&pb->options, "qdisc_queue_id", 0); - if (!egress_iface) { - /* Queues cannot be configured. */ + if ((!min_rate && !max_rate && !burst) || !queue_id) { + /* Qos is not configured for this port. */ + remove_stale_qos_entry(b_ctx_in->ovs_idl_txn, pb, + b_ctx_in->port_table, + b_ctx_in->qos_table, + b_ctx_out->qos_map); 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; - } + const char *network = smap_get(&pb->options, "qos_physical_network"); + uint32_t hash = hash_string(pb->logical_port, 0); + struct qos_queue *q = find_qos_queue(b_ctx_out->qos_map, hash, + pb->logical_port); + if (!q || q->min_rate != min_rate || q->max_rate != max_rate || + q->burst != burst) { + struct shash bridge_mappings = SHASH_INITIALIZER(&bridge_mappings); + add_ovs_bridge_mappings(b_ctx_in->ovs_table, b_ctx_in->bridge_table, + &bridge_mappings); - /* Check current qdisc. */ - const char *qdisc_type; - struct smap qdisc_details; + const struct ovsrec_port *port = NULL; + const struct ovsrec_interface *iface = NULL; + if (network) { + iface = get_qos_egress_port_interface(&bridge_mappings, &port, + network); + } + if (iface) { + /* Add new QoS entries. */ + add_ovs_qos_table_entry(b_ctx_in->ovs_idl_txn, port, min_rate, + max_rate, burst, queue_id, + pb->logical_port); + } + shash_destroy(&bridge_mappings); + } - 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; + if (!q) { + q = xzalloc(sizeof *q); + hmap_insert(b_ctx_out->qos_map, &q->node, hash); + q->port = xstrdup(pb->logical_port); + q->queue_id = queue_id; } - smap_destroy(&qdisc_details); - /* 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, ""); - } - netdev_close(netdev_phy); + free(q->network); + q->network = network ? xstrdup(network) : NULL; + q->min_rate = min_rate; + q->max_rate = max_rate; + q->burst = burst; +} + +static void +ovs_qos_entries_gc(struct ovsdb_idl_txn *ovs_idl_txn, + const struct ovsrec_port_table *port_table, + const struct ovsrec_qos_table *qos_table, + struct hmap *queue_map) +{ + if (!ovs_idl_txn) { return; } - /* 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)); - break; + const struct ovsrec_qos *qos, *qos_next; + OVSREC_QOS_TABLE_FOR_EACH_SAFE (qos, qos_next, qos_table) { + 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 (!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)); + const char *port = smap_get(&queue->external_ids, "ovn_port"); + if (!port) { + continue; } - } - } - /* 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); - continue; + struct qos_queue *q = find_qos_queue(queue_map, + hash_string(port, 0), port); + if (!q) { + ovsrec_qos_update_queues_delkey(qos, qos->key_queues[i]); + ovsrec_queue_delete(queue); + n_queue_deleted++; + } } - 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)); + if (n_queue_deleted && n_queue_deleted == n_queues) { + const struct ovsrec_port *port = NULL, *iter; + OVSREC_PORT_TABLE_FOR_EACH (iter, port_table) { + if (iter->qos == qos) { + port = iter; + break; + } + } + if (port) { + ovsrec_port_set_qos(port, NULL); + } + ovsrec_qos_delete(qos); } } - smap_destroy(&queue_details); - hmap_destroy(&consistent_queues); - netdev_close(netdev_phy); } /* @@ -1534,7 +1580,7 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, b_ctx_out->tracked_dp_bindings); } if (b_lport->lbinding->iface && b_ctx_in->ovs_idl_txn) { - get_qos_queue(pb, b_ctx_out->qos_map); + configure_qos(pb, b_ctx_in, b_ctx_out); } } else { /* We could, but can't claim the lport. */ @@ -1860,7 +1906,7 @@ consider_localnet_lport(const struct sbrec_port_binding *pb, update_local_lports(pb->logical_port, b_ctx_out); if (b_ctx_in->ovs_idl_txn) { - get_qos_queue(pb, b_ctx_out->qos_map); + configure_qos(pb, b_ctx_in, b_ctx_out); } update_related_lport(pb, b_ctx_out); @@ -2111,15 +2157,9 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) } shash_destroy(&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); - } - } + /* Remove stale QoS entries. */ + ovs_qos_entries_gc(b_ctx_in->ovs_idl_txn, b_ctx_in->port_table, + b_ctx_in->qos_table, b_ctx_out->qos_map); cleanup_claimed_port_timestamps(); } @@ -2336,6 +2376,10 @@ consider_iface_release(const struct ovsrec_interface *iface_rec, b_ctx_out, ld); } + remove_stale_qos_entry(b_ctx_in->ovs_idl_txn, b_lport->pb, + b_ctx_in->port_table, b_ctx_in->qos_table, + b_ctx_out->qos_map); + /* Release the primary binding lport and other children lports if * any. */ LIST_FOR_EACH (b_lport, list_node, &lbinding->binding_lports) { @@ -2508,12 +2552,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); @@ -2590,15 +2628,6 @@ 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); - } - } - return handled; } @@ -2986,6 +3015,9 @@ binding_handle_port_binding_changes(struct binding_ctx_in *b_ctx_in, } else { shash_add(&deleted_other_pbs, pb->logical_port, pb); } + + remove_stale_qos_entry(b_ctx_in->ovs_idl_txn, pb, b_ctx_in->port_table, + b_ctx_in->qos_table, b_ctx_out->qos_map); } struct shash_node *node; @@ -3109,16 +3141,8 @@ 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); - } + shash_destroy(&bridge_mappings); } return handled; diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index ee0e495ba..c11678653 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1045,6 +1045,13 @@ 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_external_ids); + 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); + ovsdb_idl_add_column(ovs_idl, &ovsrec_queue_col_external_ids); chassis_register_ovs_idl(ovs_idl); encaps_register_ovs_idl(ovs_idl); @@ -1059,6 +1066,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/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/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 Thu May 18 09:48:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783103 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=IWNec/VO; 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 4QMQDF6fpDz20dn for ; Thu, 18 May 2023 19:49:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 12AE342875; Thu, 18 May 2023 09:49:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 12AE342875 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=IWNec/VO 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 BOIacbEOf2Hb; Thu, 18 May 2023 09:49:14 +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 80841428A9; Thu, 18 May 2023 09:49:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 80841428A9 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F0B39C008B; Thu, 18 May 2023 09:49:09 +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 26B80C007A for ; Thu, 18 May 2023 09:49:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 80CA842A61 for ; Thu, 18 May 2023 09:49:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 80CA842A61 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=IWNec/VO 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 ymwDFXbYUS2D for ; Thu, 18 May 2023 09:49:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 7741142A7E 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 7741142A7E for ; Thu, 18 May 2023 09:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403343; 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=ftHtMlmN2Z+Ucxb66DdNQBSZSsCRVK2mAQ8zbBzv+Fw=; b=IWNec/VOMF8Je8zyscgL8WMkrbDWmPTwFd8qQvV5mVA/UdyiKWWgFAKgga3vEdqXOLSHbs UksCPClAT/DHpd30Pvq1liYZXFN3v7YvxhsJf9abedEW/AZGG5oGZCj8LoVvjdbgWgiDlF bYoLoqRkt/aoT0PWXBgnBSX76Mny1R4= 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-507-Tsks8ziLNomDbo0if5-FNw-1; Thu, 18 May 2023 05:49:02 -0400 X-MC-Unique: Tsks8ziLNomDbo0if5-FNw-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-30634323dfeso802360f8f.3 for ; Thu, 18 May 2023 02:49:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403341; x=1686995341; 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=ftHtMlmN2Z+Ucxb66DdNQBSZSsCRVK2mAQ8zbBzv+Fw=; b=OyaXYkt265WSiIBOkWsGEUmn33OiGf+vHjpmzEDa1qLpbL6zIt0FsGRc7pB2Om1uTR v8x0Dv9J7tzIxSZbCOUZ1W6QkbMxcvBFT0o6H5nYjRqsOR2cupMwIfMDUTktZgiAEoPv ZpArbGl/blGBjgPa31jGAhs/hSdA9eDOHcMXb2bJsQm76eXhWw7iw13rU/qaDZQbldsb DiSLUk5freh2QxVPkW0OcAaLgrYY5MXC7unDvFrUDCZ6+aew6KI2EtViytgploxLwazh Ap5AOs9bhu0kk7P4CrCmYPpylcJ+fi1Mm9JmYNuzNKAlAim65u52oWyfiU2SpZy1k+Vi 5RCA== X-Gm-Message-State: AC+VfDyDmeBbUcCW8e054gCqy3vcNKcpu0WxrB1PMIWDeGHzqAEg/tzs yt7Ut0t5TnCm/abEtBZWzao9NWLfS6qu0VK6Trgtbtr62eb2a0BoafgAYYU3QontiUSfklrJFhP g2LPDFaPsUY5Knc8TEvaw5timboKKjizKR0215SeGmzUl5a5zlix+FMGzjaKdFCt6WfIDCrH/G1 YHNhUKXMhsLaY4 X-Received: by 2002:adf:f285:0:b0:306:31e0:964 with SMTP id k5-20020adff285000000b0030631e00964mr1029316wro.55.1684403340817; Thu, 18 May 2023 02:49:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BdLWDsuqFO7YULhs/HbnYbXoc4cgtu2AT1OVgnb9ZbuakeJWtTsCLJT8l0+9WVZJk3dOCtw== X-Received: by 2002:adf:f285:0:b0:306:31e0:964 with SMTP id k5-20020adff285000000b0030631e00964mr1029297wro.55.1684403340405; Thu, 18 May 2023 02:49: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 j17-20020a5d4531000000b002ffbf2213d4sm1604485wra.75.2023.05.18.02.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:49:00 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:35 +0200 Message-Id: <03a0c2754d46c456d23b9fdda5a6b6c29db6393f.1684403044.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 v9 ovn 05/10] controller: improve ovs port lookup by 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_qos routine in order to speed-up ovs port lookup based on port qos. Acked-by: Numan Siddique Acked-By: Ihar Hrachyshka Tested-by: Rodolfo Alonso Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 37 ++++++++++++++----------------------- controller/binding.h | 2 +- controller/ovn-controller.c | 13 +++++++++---- controller/ovsport.c | 16 ++++++++++++++++ controller/ovsport.h | 3 +++ 5 files changed, 43 insertions(+), 28 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 36e63ed64..99015b315 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); @@ -281,7 +282,7 @@ add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, static void remove_stale_qos_entry(struct ovsdb_idl_txn *ovs_idl_txn, const struct sbrec_port_binding *pb, - const struct ovsrec_port_table *port_table, + struct ovsdb_idl_index *ovsrec_port_by_qos, const struct ovsrec_qos_table *qos_table, struct hmap *queue_map) { @@ -314,13 +315,8 @@ remove_stale_qos_entry(struct ovsdb_idl_txn *ovs_idl_txn, ovsrec_queue_delete(queue); if (qos->n_queues == 1) { - 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) { ovsrec_port_set_qos(port, NULL); } @@ -349,9 +345,8 @@ configure_qos(const struct sbrec_port_binding *pb, if ((!min_rate && !max_rate && !burst) || !queue_id) { /* Qos is not configured for this port. */ remove_stale_qos_entry(b_ctx_in->ovs_idl_txn, pb, - b_ctx_in->port_table, - b_ctx_in->qos_table, - b_ctx_out->qos_map); + b_ctx_in->ovsrec_port_by_qos, + b_ctx_in->qos_table, b_ctx_out->qos_map); return; } @@ -396,7 +391,7 @@ configure_qos(const struct sbrec_port_binding *pb, static void ovs_qos_entries_gc(struct ovsdb_idl_txn *ovs_idl_txn, - const struct ovsrec_port_table *port_table, + struct ovsdb_idl_index *ovsrec_port_by_qos, const struct ovsrec_qos_table *qos_table, struct hmap *queue_map) { @@ -428,13 +423,8 @@ ovs_qos_entries_gc(struct ovsdb_idl_txn *ovs_idl_txn, } if (n_queue_deleted && n_queue_deleted == n_queues) { - 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) { ovsrec_port_set_qos(port, NULL); } @@ -2158,7 +2148,7 @@ binding_run(struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) shash_destroy(&bridge_mappings); /* Remove stale QoS entries. */ - ovs_qos_entries_gc(b_ctx_in->ovs_idl_txn, b_ctx_in->port_table, + ovs_qos_entries_gc(b_ctx_in->ovs_idl_txn, b_ctx_in->ovsrec_port_by_qos, b_ctx_in->qos_table, b_ctx_out->qos_map); cleanup_claimed_port_timestamps(); @@ -2377,8 +2367,8 @@ consider_iface_release(const struct ovsrec_interface *iface_rec, } remove_stale_qos_entry(b_ctx_in->ovs_idl_txn, b_lport->pb, - b_ctx_in->port_table, b_ctx_in->qos_table, - b_ctx_out->qos_map); + b_ctx_in->ovsrec_port_by_qos, + b_ctx_in->qos_table, b_ctx_out->qos_map); /* Release the primary binding lport and other children lports if * any. */ @@ -3016,7 +3006,8 @@ binding_handle_port_binding_changes(struct binding_ctx_in *b_ctx_in, shash_add(&deleted_other_pbs, pb->logical_port, pb); } - remove_stale_qos_entry(b_ctx_in->ovs_idl_txn, pb, b_ctx_in->port_table, + remove_stale_qos_entry(b_ctx_in->ovs_idl_txn, pb, + b_ctx_in->ovsrec_port_by_qos, b_ctx_in->qos_table, b_ctx_out->qos_map); } 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 c11678653..e238f5c22 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1499,9 +1499,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); @@ -1526,6 +1523,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; @@ -1533,7 +1534,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; @@ -4479,6 +4480,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, @@ -4833,6 +4837,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..0503241ac 100644 --- a/controller/ovsport.c +++ b/controller/ovsport.c @@ -216,6 +216,22 @@ ovsrec_port * ovsport_lookup_by_interface( interfaces, 1); } +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..ef1ff50b8 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,7 @@ 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_qos( + struct ovsdb_idl_index *, const struct ovsrec_qos *); #endif /* lib/ovsport.h */ From patchwork Thu May 18 09:48:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783104 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=KbH39Y+r; 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 4QMQDL1gHxz20dn for ; Thu, 18 May 2023 19:49:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C394A42AC9; Thu, 18 May 2023 09:49:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C394A42AC9 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=KbH39Y+r 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 pMmU7REOqTJ3; Thu, 18 May 2023 09:49:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 415DB42AAC; Thu, 18 May 2023 09:49:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 415DB42AAC Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B088C0098; Thu, 18 May 2023 09:49:12 +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 04008C0091 for ; Thu, 18 May 2023 09:49:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 126726FF5B for ; Thu, 18 May 2023 09:49:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 126726FF5B 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=KbH39Y+r 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 F6r2XjtGuBOf for ; Thu, 18 May 2023 09:49:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6EE5C6FF71 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 6EE5C6FF71 for ; Thu, 18 May 2023 09:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403345; 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=TaTfSAq5t17Rh+OE5rdNaR4TjhPHCiMmp8t1wDwikhM=; b=KbH39Y+rLY98Z5/tKJZWuzCjdJj8SaDMJ1+Dje9SrhfCAanLnn8nIav18ULa975GQmJqVY duRyokdpbNKEkGpBWQ6/qwnzciiMCB4QDBRjUy0N6vBMInLlNFfDEIFUsi68dh6J8b9ccx sIRBRQmSM/H/pbSUDMR9ndbPWlPJz8U= 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-640-euJLM0e9PTiZM2pKoYA75w-1; Thu, 18 May 2023 05:49:04 -0400 X-MC-Unique: euJLM0e9PTiZM2pKoYA75w-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f41dcf1e28so6797955e9.3 for ; Thu, 18 May 2023 02:49:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403343; x=1686995343; 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=TaTfSAq5t17Rh+OE5rdNaR4TjhPHCiMmp8t1wDwikhM=; b=YiyjMm77XH2E0L//xM7//kC8hcRVY2/FEqDjvmK/7r0rl6pVqLG7x2jf7p3kTQ8G+X l0sjaJJxDvWdb6YzNUARup/IounD4VCZiB3lcZSJo5tVpsV6VnflqLyxxS8riwCXIVOH Z9FjAV05oMhmJJylcJOWnolRbQxYfopbt6ke6cKRnlbtEJv1SGrVCv0X6fLezPwhdsMe CInwjwIbAYkPOBkMvPNULp6fu1PW3UyPDk3Uxhu4G9aZvqxCvM9Pt/6TGOGG5op4rF38 HPR/vIZ/JaEDX2nmNb5Y3STQZY+fLhPxVzsiJXMbw+SpEjkcqAvMU68Ix5KB7OPDvrxA FTFw== X-Gm-Message-State: AC+VfDx7c/JeVzI0xRHO5pxHEwVAmB62tEVU3K6AnM0LiVi8voWM26M5 P0Rw+RQpKOZ6f1+Rcdztfk/k8PyOEpOLcwY/t9CYcF4bu6rMotE43g/u2HlyiFP55BqaIhgga5J zv+HlRV49AXw+jhdCg9YRdBWzEEDizJhVOgDiisnJ7zAyXggeL0PbKuVxVRIJpy+EDIneSBtzWl Y+CfpbmcWzpxXH X-Received: by 2002:a05:600c:2116:b0:3f4:2c8f:d2d3 with SMTP id u22-20020a05600c211600b003f42c8fd2d3mr1041985wml.20.1684403342908; Thu, 18 May 2023 02:49:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ49vkc5uyco7z6I8hYw6HgGCCrtXc9bnHET7M5HTkLte3Y4vOBc4r31LDF+eGMglJxi+J8BGA== X-Received: by 2002:a05:600c:2116:b0:3f4:2c8f:d2d3 with SMTP id u22-20020a05600c211600b003f42c8fd2d3mr1041968wml.20.1684403342663; Thu, 18 May 2023 02:49: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 z2-20020a1cf402000000b003f4f9274d10sm1492750wma.16.2023.05.18.02.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:49:02 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:36 +0200 Message-Id: <639e2067615d4aff879d99c8c06dacbc480caa2c.1684403044.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 v9 ovn 06/10] 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: Numan Siddique Acked-By: Ihar Hrachyshka Tested-by: Rodolfo Alonso Signed-off-by: Lorenzo Bianconi --- controller/binding.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 99015b315..de89795ae 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -147,9 +147,9 @@ struct qos_queue { char *port; 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 * @@ -224,9 +224,10 @@ get_qos_egress_port_interface(struct shash *bridge_mappings, static void add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, const struct ovsrec_port *port, - uint32_t min_rate, uint32_t max_rate, - uint32_t burst, uint32_t queue_id, - const char *ovn_port) + unsigned long long min_rate, + unsigned long long max_rate, + unsigned long long burst, + uint32_t queue_id, const char *ovn_port) { struct smap external_ids = SMAP_INITIALIZER(&external_ids); struct smap other_config = SMAP_INITIALIZER(&other_config); @@ -266,9 +267,9 @@ add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn, ovsrec_qos_update_queues_setkey(qos, queue_id, queue); } - smap_add_format(&other_config, "max-rate", "%d", max_rate); - smap_add_format(&other_config, "min-rate", "%d", min_rate); - smap_add_format(&other_config, "burst", "%d", burst); + smap_add_format(&other_config, "max-rate", "%llu", max_rate); + smap_add_format(&other_config, "min-rate", "%llu", min_rate); + smap_add_format(&other_config, "burst", "%llu", burst); ovsrec_queue_verify_other_config(queue); ovsrec_queue_set_other_config(queue, &other_config); smap_destroy(&other_config); @@ -336,10 +337,12 @@ configure_qos(const struct sbrec_port_binding *pb, struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) { - - 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); if ((!min_rate && !max_rate && !burst) || !queue_id) { From patchwork Thu May 18 09:48:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783105 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=O651bRbo; 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 4QMQDW0RHyz20dn for ; Thu, 18 May 2023 19:49:31 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 97281428EC; Thu, 18 May 2023 09:49:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 97281428EC 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=O651bRbo 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 QGmQ_FZU4U0c; Thu, 18 May 2023 09:49:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 2D1FF42883; Thu, 18 May 2023 09:49:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2D1FF42883 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DDE9EC0035; Thu, 18 May 2023 09:49:19 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2A92FC0037 for ; Thu, 18 May 2023 09:49:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6C8CB843D8 for ; Thu, 18 May 2023 09:49:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6C8CB843D8 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=O651bRbo 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 BbgxL44Hod4A for ; Thu, 18 May 2023 09:49:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 913E3843E3 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 913E3843E3 for ; Thu, 18 May 2023 09:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403347; 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=FWXqHuoUtDmJysPpBVtOwUU601rZtbu86+ARI9EaUR4=; b=O651bRbo6SI3sSiwG5KuNHU0I3++WPv6MNEnO8v4hU3rsj3E7qa6/IJzzGNuT20McyJa6e NFwLLF9CFtA4GenC6h6Jv8/9LUMWQCxja/VZUQrUbEN6jHfjhEZveCpocrOGRYBkvYXHkX QKUa6kQbwH9WqTuGoX1hYtV04qv7B9I= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237--VRLtk4_N-aCgyzVh7eHjA-1; Thu, 18 May 2023 05:49:06 -0400 X-MC-Unique: -VRLtk4_N-aCgyzVh7eHjA-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-30629b36d9bso772865f8f.0 for ; Thu, 18 May 2023 02:49:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403345; x=1686995345; 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=xXCJRBX2cvoDALTeeHKthJYssSIsZQZ/+5QGlWUaraQ=; b=j6fh6hq3eeyNB/4/uzSKM5pEkHp8g54WTumJPbvJrakibAHEnSqY7HzlvKJr6eCGQ0 mwTDjkaBDLx9DHxRxQ4UIOtPlPbDnFXxCPVVhfxFIlFZ68VB7flWJyHJvOIlZCvW1JMY CXm1kVrxhfSSoCysrHmnqrsDS8Dud3bLsPZiKDoiJtRH5ev5vdIDGoF71HajbAxCNrBR x64y2sGAzhk/k3dcxyZhjwkqAc3Em4/FgRGaxo1P8dhvAO0aIzjc7lzQOYPvkFuldXvo dulzeVO3nJQxbf1mEzMl1HFNWtLVmK9VG6SGeC6GdoBcP3rHZkq8GWK+aGxQbOZZebe3 xl3g== X-Gm-Message-State: AC+VfDwQbokMYFOt5DgWsH7f6Hr4DKeqRIWwNgB7OvMAE3ve9xJ8one4 Mo/aNLx7vsz3f7Tik1G/oE0zDu2yU+wft1+ECHbigYDKWnVECAfQkWFh4DELwb8bAobIMKyqq2q Eq/9/ldG19qAiwYlI8iytAYxNmCNyVxpU5qP7tS+v3kXY4e6wenKcOfqjVc/kjRln4lwuRAsgww rHyArtJOdlfnGG X-Received: by 2002:adf:cd88:0:b0:309:382e:be27 with SMTP id q8-20020adfcd88000000b00309382ebe27mr1118184wrj.33.1684403345186; Thu, 18 May 2023 02:49:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nOERmq5fcVCC70qWovp3ftg41vhVhx2K772RTQCUg4pf011etyb9o6862ByeVJEBhOo8fQw== X-Received: by 2002:adf:cd88:0:b0:309:382e:be27 with SMTP id q8-20020adfcd88000000b00309382ebe27mr1118165wrj.33.1684403344810; Thu, 18 May 2023 02:49: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 o15-20020a5d62cf000000b0030789698eebsm1576976wrv.89.2023.05.18.02.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:49:04 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:37 +0200 Message-Id: <5ea843f0e5734b1abbe23d5d91950ae2360a242e.1684403044.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 v9 ovn 07/10] northd: make queue_id allocation global for the ovn cluster 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" In order to avoid possible queue_id clash when we have a localnet and a LSP ports on the same hv, make QoS queue_id allocation global for the ovn cluster. Acked-by: Numan Siddique Signed-off-by: Lorenzo Bianconi --- northd/northd.c | 127 ++++++++---------------------------------------- 1 file changed, 20 insertions(+), 107 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 470f76809..c107fe33a 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -469,94 +469,20 @@ build_chassis_features(const struct sbrec_chassis_table *sbrec_chassis_table, } } } - -struct ovn_chassis_qdisc_queues { - struct hmap_node key_node; - uint32_t queue_id; - struct uuid chassis_uuid; -}; static uint32_t -hash_chassis_queue(const struct uuid *chassis_uuid, uint32_t queue_id) -{ - return hash_2words(uuid_hash(chassis_uuid), queue_id); -} - -static void -destroy_chassis_queues(struct hmap *set) -{ - struct ovn_chassis_qdisc_queues *node; - HMAP_FOR_EACH_POP (node, key_node, set) { - free(node); - } - hmap_destroy(set); -} - -static void -add_chassis_queue(struct hmap *set, const struct uuid *chassis_uuid, - uint32_t queue_id) +allocate_queueid(unsigned long *queue_id_bitmap) { - struct ovn_chassis_qdisc_queues *node = xmalloc(sizeof *node); - node->queue_id = queue_id; - node->chassis_uuid = *chassis_uuid; - hmap_insert(set, &node->key_node, - hash_chassis_queue(chassis_uuid, queue_id)); -} - -static bool -chassis_queueid_in_use(const struct hmap *set, const struct uuid *chassis_uuid, - uint32_t queue_id) -{ - const struct ovn_chassis_qdisc_queues *node; - HMAP_FOR_EACH_WITH_HASH (node, key_node, - hash_chassis_queue(chassis_uuid, queue_id), set) { - if (uuid_equals(chassis_uuid, &node->chassis_uuid) - && node->queue_id == queue_id) { - return true; - } - } - return false; -} - -static uint32_t -allocate_chassis_queueid(struct hmap *set, const struct uuid *uuid, char *name) -{ - if (!uuid) { + uint32_t queue_id = bitmap_scan(queue_id_bitmap, 0, 1, + QDISC_MAX_QUEUE_ID + 1); + if (queue_id == QDISC_MAX_QUEUE_ID + 1) { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); + VLOG_WARN_RL(&rl, "all queue ids exhausted"); return 0; } + bitmap_set1(queue_id_bitmap, queue_id); - for (uint32_t queue_id = QDISC_MIN_QUEUE_ID + 1; - queue_id <= QDISC_MAX_QUEUE_ID; - queue_id++) { - if (!chassis_queueid_in_use(set, uuid, queue_id)) { - add_chassis_queue(set, uuid, queue_id); - return queue_id; - } - } - - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); - VLOG_WARN_RL(&rl, "all %s queue ids exhausted", name); - return 0; -} - -static void -free_chassis_queueid(struct hmap *set, const struct uuid *uuid, - uint32_t queue_id) -{ - if (!uuid) { - return; - } - - struct ovn_chassis_qdisc_queues *node; - HMAP_FOR_EACH_WITH_HASH (node, key_node, - hash_chassis_queue(uuid, queue_id), set) { - if (uuid_equals(uuid, &node->chassis_uuid) - && node->queue_id == queue_id) { - hmap_remove(set, &node->key_node); - free(node); - break; - } - } + return queue_id; } static inline bool @@ -2472,7 +2398,7 @@ tag_alloc_create_new_tag(struct hmap *tag_alloc_table, static void join_logical_ports(const struct sbrec_port_binding_table *sbrec_pb_table, struct hmap *ls_datapaths, struct hmap *lr_datapaths, - struct hmap *ports, struct hmap *chassis_qdisc_queues, + struct hmap *ports, unsigned long *queue_id_bitmap, struct hmap *tag_alloc_table, struct ovs_list *sb_only, struct ovs_list *nb_only, struct ovs_list *both) { @@ -2537,11 +2463,8 @@ join_logical_ports(const struct sbrec_port_binding_table *sbrec_pb_table, uint32_t queue_id = smap_get_int(&op->sb->options, "qdisc_queue_id", 0); - if (queue_id && op->sb->chassis) { - add_chassis_queue( - chassis_qdisc_queues, - &op->sb->chassis->header_.uuid, - queue_id); + if (queue_id) { + bitmap_set1(queue_id_bitmap, queue_id); } ovs_list_push_back(both, &op->list); @@ -3359,7 +3282,7 @@ ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn, struct ovsdb_idl_index *sbrec_ha_chassis_grp_by_name, const struct sbrec_mirror_table *sbrec_mirror_table, const struct ovn_port *op, - struct hmap *chassis_qdisc_queues, + unsigned long *queue_id_bitmap, struct sset *active_ha_chassis_grps) { sbrec_port_binding_set_datapath(op->sb, op->od->sb); @@ -3484,23 +3407,12 @@ ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn, uint32_t queue_id = smap_get_int( &op->sb->options, "qdisc_queue_id", 0); bool has_qos = port_has_qos_params(&op->nbsp->options); - const struct uuid *uuid = NULL; struct smap options; - char *name = ""; - - if (lsp_is_localnet(op->nbsp)) { - uuid = &op->sb->header_.uuid; - name = "localnet"; - } else if (op->sb->chassis) { - uuid = &op->sb->chassis->header_.uuid; - name = op->sb->chassis->name; - } if (has_qos && !queue_id) { - queue_id = allocate_chassis_queueid(chassis_qdisc_queues, - uuid, name); + queue_id = allocate_queueid(queue_id_bitmap); } else if (!has_qos && queue_id) { - free_chassis_queueid(chassis_qdisc_queues, uuid, queue_id); + bitmap_set0(queue_id_bitmap, queue_id); queue_id = 0; } @@ -4678,7 +4590,8 @@ build_ports(struct ovsdb_idl_txn *ovnsb_txn, { struct ovs_list sb_only, nb_only, both; struct hmap tag_alloc_table = HMAP_INITIALIZER(&tag_alloc_table); - struct hmap chassis_qdisc_queues = HMAP_INITIALIZER(&chassis_qdisc_queues); + unsigned long *queue_id_bitmap = bitmap_allocate(QDISC_MAX_QUEUE_ID + 1); + bitmap_set1(queue_id_bitmap, 0); /* sset which stores the set of ha chassis group names used. */ struct sset active_ha_chassis_grps = @@ -4688,7 +4601,7 @@ build_ports(struct ovsdb_idl_txn *ovnsb_txn, * We will split them later. */ struct hmap *ports = ls_ports; join_logical_ports(sbrec_port_binding_table, ls_datapaths, lr_datapaths, - ports, &chassis_qdisc_queues, + ports, queue_id_bitmap, &tag_alloc_table, &sb_only, &nb_only, &both); /* Purge stale Mac_Bindings if ports are deleted. */ @@ -4736,7 +4649,7 @@ build_ports(struct ovsdb_idl_txn *ovnsb_txn, sbrec_chassis_by_hostname, sbrec_ha_chassis_grp_by_name, sbrec_mirror_table, - op, &chassis_qdisc_queues, + op, queue_id_bitmap, &active_ha_chassis_grps); } @@ -4747,7 +4660,7 @@ build_ports(struct ovsdb_idl_txn *ovnsb_txn, sbrec_chassis_by_hostname, sbrec_ha_chassis_grp_by_name, sbrec_mirror_table, - op, &chassis_qdisc_queues, + op, queue_id_bitmap, &active_ha_chassis_grps); sbrec_port_binding_set_logical_port(op->sb, op->key); } @@ -4776,7 +4689,7 @@ build_ports(struct ovsdb_idl_txn *ovnsb_txn, } tag_alloc_destroy(&tag_alloc_table); - destroy_chassis_queues(&chassis_qdisc_queues); + bitmap_free(queue_id_bitmap); cleanup_sb_ha_chassis_groups(sbrec_ha_chassis_group_table, &active_ha_chassis_grps); sset_destroy(&active_ha_chassis_grps); From patchwork Thu May 18 09:48:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783106 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=TbMJjBMt; 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 4QMQDd6FmPz20dn for ; Thu, 18 May 2023 19:49:37 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 4C68442A7A; Thu, 18 May 2023 09:49:35 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4C68442A7A 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=TbMJjBMt 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 vlrIozDN89oD; Thu, 18 May 2023 09:49:31 +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 6B72042A93; Thu, 18 May 2023 09:49:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6B72042A93 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 23A21C0035; Thu, 18 May 2023 09:49:26 +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 237FAC007A for ; Thu, 18 May 2023 09:49:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3E5C142A77 for ; Thu, 18 May 2023 09:49:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 3E5C142A77 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 Hn4MGCts2k3Y for ; Thu, 18 May 2023 09:49:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 44FFF4048D 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 44FFF4048D for ; Thu, 18 May 2023 09:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403350; 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=vsmRHeO9tmIDvS0QbdbTTKAYqlWJ1+JYwwT2bJ/hopw=; b=TbMJjBMtIlk93E3bVoNP+q415CBHhYj7DNXQIYk7ixMHYTG5R1l1dGMFgx8cl74pD+CdLg 1epHxvgT7U/UIXsqv7rQSSBgkKIU1aZ8tI7MlqoM7ulrwGYaCDmDdUnBB0pkkNeVcn92lD gjkkImWY3Cr5bZrgUWoZuAeHBy3TIDw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-beyySyWCOaGrUGn_Goe6PQ-1; Thu, 18 May 2023 05:49:09 -0400 X-MC-Unique: beyySyWCOaGrUGn_Goe6PQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3093b0cf714so713138f8f.2 for ; Thu, 18 May 2023 02:49:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403348; x=1686995348; 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=vsmRHeO9tmIDvS0QbdbTTKAYqlWJ1+JYwwT2bJ/hopw=; b=UYw2gfjJdmCJTfeYw4i7tlM0+sc2KJxMJGbNbtexFroUIvWngX1ZMdsniLy5G6ohif bIr3se3u9cu4sLqxHjhjy4G9eocQL81jZhaK/FXXe2DECwCjDRABI6zlGxAAwsMyI1SC If8IVUqTK9cVcek2anSg1YskIF2qZzpbo+E251Fqi/evDok+xW1vJhJgfGkfrFI8CF+V IATBNG1Aw7uSvQy9a0Gg3/WqhcdbzVcMUwL+fGL5/YqKMPdah2T6XJKjSi7+/yC6rvKq 1ZsQoOzXo2x32BXM3gYz+UW+HvVAr6dGABI0XOXBSex4e07/Q2w27MW7Epx8c1tp4mJA eC6g== X-Gm-Message-State: AC+VfDzuxaYS+xFcgj9XsMSr7rO/JawjImv6rSM1YYyjwD1HzZd0yVu5 xrfERtUGZWDUita+2IIplfK3MZlgFH1WHuhAYJ6QuvFvAn0z3eQtk/g2jvDdmTQ4afMh5OUvTyi 2Gy4Brpr06J9D9iPYkeQYV8Q5FzfsZUcddd8HdYrrOUZAA45HiFIcQCp0UAvaCQGDq14JQvzf4I +aJ+qAFw657vp2 X-Received: by 2002:a5d:694f:0:b0:306:475d:92ff with SMTP id r15-20020a5d694f000000b00306475d92ffmr1268267wrw.3.1684403347571; Thu, 18 May 2023 02:49:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7OUWxyoVKGaPyXPbDfWd4+QaZi+s+TB1nERNS4wK+7S2ZPUC/jX+arW2oY8hDbcq7cWRDISQ== X-Received: by 2002:a5d:694f:0:b0:306:475d:92ff with SMTP id r15-20020a5d694f000000b00306475d92ffmr1268234wrw.3.1684403347014; Thu, 18 May 2023 02:49: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 k17-20020a5d5251000000b003079693eff2sm1594919wrc.41.2023.05.18.02.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:49:06 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:38 +0200 Message-Id: <0870889efc42b81787a319889757bf97dc20857a.1684403044.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 v9 ovn 08/10] 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: Numan Siddique 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.at | 185 ++++++++++++++++++++++++++++++++++++++++ tests/system-ovn.at | 86 ++++++++++++++++++- 6 files changed, 306 insertions(+), 11 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index de89795ae..befe3abda 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -202,9 +202,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 c107fe33a..2f96d15a4 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -5737,15 +5737,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 a9af0f76a..c52f86490 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -8154,6 +8154,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;) ]) @@ -8184,6 +8185,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.at b/tests/ovn.at index 2ef370c26..161fb000a 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -35623,3 +35623,188 @@ 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 ls0 +check ovn-nbctl lsp-add ls0 public0 +check ovn-nbctl lsp-set-addresses public0 unknown +check ovn-nbctl lsp-set-type public0 localnet +check ovn-nbctl lsp-set-options public0 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 ls0 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(["public0"], ["hv-$i"]) +done + +check ovn-nbctl set Logical_Switch_Port lsp1 options:qos_min_rate=200000 + +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="0"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="0"') -eq 1]) + +check ovn-nbctl set Logical_Switch_Port lsp1 options:qos_max_rate=350000 +check ovn-nbctl set Logical_Switch_Port lsp1 options:qos_burst=3000000 + +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 set Logical_Switch_Port lsp2 options:qos_min_rate=400000 +check ovn-nbctl set Logical_Switch_Port lsp2 options:qos_max_rate=500000 +check ovn-nbctl 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 ls0 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 lsp-add ls0 lsp4 +check ovn-nbctl lsp-set-addresses lsp4 f0:00:00:00:00:04 +as hv-1 +ovs-vsctl add-port br-int vif4 -- \ + set Interface vif4 external-ids:iface-id=lsp4 \ + ofport-request=4 +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp4` = xup]) + +check ovn-nbctl set Logical_Switch_Port lsp3 options:qos_min_rate=700000 +check ovn-nbctl set Logical_Switch_Port lsp3 options:qos_max_rate=800000 +check ovn-nbctl 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 remove Logical_Switch_Port lsp3 options qos_min_rate=700000 +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="0"') -eq 1]) + +check ovn-nbctl remove Logical_Switch_Port lsp3 options qos_max_rate=800000 +check ovn-nbctl 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 set Logical_Switch_Port lsp4 options:qos_min_rate=1700000 +check ovn-nbctl set Logical_Switch_Port lsp4 options:qos_max_rate=1800000 +check ovn-nbctl set Logical_Switch_Port lsp4 options:qos_burst=19000000 +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="1700000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="1800000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="19000000"') -eq 1]) + +as hv-1 +ovs-vsctl remove Interface vif4 external-ids iface-id +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="1700000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="1800000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="19000000"') -eq 0]) + +check ovn-nbctl 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 remove Logical_Switch_Port lsp2 options qos_min_rate=410000 +check ovn-nbctl remove Logical_Switch_Port lsp2 options qos_max_rate=500000 +check ovn-nbctl 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]) + +check ovn-nbctl lsp-del lsp1 +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list qos | grep -c linux-htb) -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="200000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="350000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="3000000"') -eq 0]) + +check ovn-nbctl set Logical_Switch_Port public0 options:qos_min_rate=100000 +check ovn-nbctl set Logical_Switch_Port public0 options:qos_max_rate=200000 +check ovn-nbctl set Logical_Switch_Port public0 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="100000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="200000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="3000000"') -eq 1]) + +check ovn-nbctl ls-add ls1 +check ovn-nbctl lsp-add ls1 public1 +check ovn-nbctl lsp-set-addresses public1 unknown +check ovn-nbctl lsp-set-type public1 localnet + +check ovn-nbctl lsp-add ls1 lsp5 +check ovn-nbctl lsp-set-addresses lsp5 f0:00:00:00:00:05 +as hv-1 +ovs-vsctl add-port br-int vif5 -- \ + set Interface vif5 external-ids:iface-id=lsp5 \ + ofport-request=5 +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp5` = xup]) + +check ovn-nbctl set Logical_Switch_Port public1 options:qos_min_rate=6000000000 +check ovn-nbctl set Logical_Switch_Port public1 options:qos_max_rate=7000000000 +check ovn-nbctl set Logical_Switch_Port public1 options:qos_burst=8000000000 + +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="6000000000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="7000000000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="8000000000"') -eq 0]) + +check ovn-nbctl set Logical_Switch_Port public1 options:qos_min_rate=6000000000 options:qos_max_rate=7000000000 options:qos_burst=8000000000 options:network_name=phys + +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="6000000000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="7000000000"') -eq 1]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="8000000000"') -eq 1]) + +check ovn-nbctl lsp-del public0 +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="100000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="200000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="3000000"') -eq 0]) + +check ovn-nbctl remove Logical_Switch_Port public1 options qos_min_rate=6000000000 +check ovn-nbctl remove Logical_Switch_Port public1 options qos_max_rate=7000000000 +check ovn-nbctl remove Logical_Switch_Port public1 options qos_burst=8000000000 + +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list qos | grep -c linux-htb) -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'min-rate="6000000000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'max-rate="7000000000"') -eq 0]) +OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list queue | grep -c 'burst="8000000000"') -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 Thu May 18 09:48:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783107 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=fjGtVtpG; 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 4QMQDk4L4rz20dn for ; Thu, 18 May 2023 19:49:42 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 759E142A68; Thu, 18 May 2023 09:49:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 759E142A68 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=fjGtVtpG 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 EKbMkOVaaAch; Thu, 18 May 2023 09:49:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 5C35642A4E; Thu, 18 May 2023 09:49:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5C35642A4E Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 10905C0037; Thu, 18 May 2023 09:49:30 +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 07A5EC0035 for ; Thu, 18 May 2023 09:49:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6E8426FF95 for ; Thu, 18 May 2023 09:49:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6E8426FF95 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=fjGtVtpG 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 PEmSll9JkKRJ for ; Thu, 18 May 2023 09:49:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8E54B6FF82 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 8E54B6FF82 for ; Thu, 18 May 2023 09:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403352; 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=GWLXyeIiX6GpJMXtGHguiP0Q7P6pH3pYXp7MVYpbONU=; b=fjGtVtpGMDMT7zLTTLtmaZKOOgcAxnGDsjFvILw217FQT/Kj2P0aqhQAXNdL7RhXctu1K6 SbvwCSgjgqTVKwqqbzmZr3a9BbpW+iT5JSwUz3NdYyq/yc0+pq4jYZ6HdACC0/Jpwd/w39 Bi+AXqO14xB61g3Mh6LZ+h3CpHhkXTA= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-KfQ10yV5ON23blTAAbhWDQ-1; Thu, 18 May 2023 05:49:11 -0400 X-MC-Unique: KfQ10yV5ON23blTAAbhWDQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3f420ec766dso12271485e9.1 for ; Thu, 18 May 2023 02:49:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403349; x=1686995349; 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=GWLXyeIiX6GpJMXtGHguiP0Q7P6pH3pYXp7MVYpbONU=; b=cZ+yIlZg+LELy3unEVBQyzWY1w2xLnthFT7lWqhPirbaI7OhGjD6QhiKvVZyCv9+lJ HOtlwX6AWigzv4e9ZeIyhWUBtLhWlEdN3fFyHR6+tJKUHy2MnIrlaZPuuu33JqAbR6io EVZIXxjyb7Cx0616ny28lUAMXpBTz9Oxe1U+tp/D+tPD/71VCEP75iEHlm5fLaHmWmmE Cfz6zqlF2lSXuK0mwL74QAFPoILQSG1NspEypVfOsfkJ3e5+xtxdmxaatyhiUzI71460 +vUdVALFRz+Yu4AgdtE6x5/keerelo15xfTqBqfvQlffIlpdnwtbP+meNoXmDND8pbTC EZOA== X-Gm-Message-State: AC+VfDxFSSha5IpIBA3bDFIR3zXqTonebYkdbsB/n15BcBao9QDeesV8 cW2lqx1YYXprrOS6RslmpmS7VWcVU0N7xEGyQYsihw1ixDkHGrXhFAeBNTzWe8UHWTSPSJ8Ut5K TZPJZYOLlMa3+uMxSZilBeGCrzI4HJZC2ojPmo54NP/IZtpyWzAO3GpvwaKTihlXBAXLEFm3pT+ rMP31ylS/7z+SE X-Received: by 2002:a05:600c:2315:b0:3f1:979f:a734 with SMTP id 21-20020a05600c231500b003f1979fa734mr1035920wmo.11.1684403349657; Thu, 18 May 2023 02:49:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Zxmc2i+wlJH0I/6Sk+WaW29BZHZJ8l/pSf+oyXPuH65tgANMD5xwVCNhMmlygmqRRvdTBlA== X-Received: by 2002:a05:600c:2315:b0:3f1:979f:a734 with SMTP id 21-20020a05600c231500b003f1979fa734mr1035887wmo.11.1684403349220; Thu, 18 May 2023 02:49: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 n6-20020adff086000000b002f6176cc6desm1560958wro.110.2023.05.18.02.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:49:08 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:39 +0200 Message-Id: <5dee53817040515e15ec62e3c41c8252afdd7a96.1684403044.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 v9 ovn 09/10] 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 Acked-by: Numan Siddique 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 befe3abda..28218b2e8 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -472,39 +472,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) @@ -545,7 +512,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. */ @@ -553,9 +519,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); @@ -2125,7 +2088,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); } @@ -2928,7 +2890,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; @@ -3124,7 +3085,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 e238f5c22..94481f0c5 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1348,7 +1348,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; @@ -1408,8 +1407,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 | @@ -1445,7 +1444,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); @@ -1466,7 +1464,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); @@ -1556,7 +1553,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; @@ -1587,14 +1583,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 Thu May 18 09:48:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1783108 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=F6+Pqe3v; 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 4QMQDm22j0z20dn for ; Thu, 18 May 2023 19:49:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6915C84451; Thu, 18 May 2023 09:49:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6915C84451 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=F6+Pqe3v 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 gqO-w57ke4YK; Thu, 18 May 2023 09:49:39 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4050D84408; Thu, 18 May 2023 09:49:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4050D84408 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B96BCC008B; Thu, 18 May 2023 09:49:30 +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 1AD45C0037 for ; Thu, 18 May 2023 09:49:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 106DB42AAB for ; Thu, 18 May 2023 09:49:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 106DB42AAB 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=F6+Pqe3v 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 VCbhrNgAoPkm for ; Thu, 18 May 2023 09:49:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 556CD42A4E 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 556CD42A4E for ; Thu, 18 May 2023 09:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684403354; 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=2lnJoRFyU8TIa/xZCguBAK0m3SJNw1opqll5iQm8mL8=; b=F6+Pqe3vkrIUymDqrZydP2KEYfXm09Ruwh8G8qLlJt1vO719KTMhe80idiZsAnXsI95gO+ 2mgdHzrueViK6Y4Nx+RCdUFyAD8mpHMCSuhea/TETEdSumcAX99syyyIjxPdMTrLrAjcE1 RdyhrL388CMF48DE0cmxGuWPZBdUHac= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-523-sh7Sk2I9ODCmBQrJm95Jww-1; Thu, 18 May 2023 05:49:13 -0400 X-MC-Unique: sh7Sk2I9ODCmBQrJm95Jww-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-30629b36d9bso772908f8f.0 for ; Thu, 18 May 2023 02:49:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684403351; x=1686995351; 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=2lnJoRFyU8TIa/xZCguBAK0m3SJNw1opqll5iQm8mL8=; b=TVHJM+w8m94kDiTP+c1W4mH3/hVOEHDsiyNCy+Rs5PN8S1kVJH0fmrfoRqIUssYWz2 OBuNtHn0J7nGMWA/uNRX4XbMqnbwp61pdod3rUydOVYNSPXaWJ6BOxxPqKekYL9GCOYh iJXdU3snbNHBUsWeAc0Ouxz4bNuWnu+6g/SEUQJWmraGMdHXn19WYN1+7+W43N0XNYdv oH8XEdrO3gq6d3n1ROyjzSWG0txipkRq0wOdpwydUGWZmcKeP1eiWORXLNwGsXOB3mi7 w+Nll+6erKwv/gb7z/c7+ZxW8JVZ90OdNDLBHQFAgKujJ2MkXIO9669GntvAkEcFdKkA LG2Q== X-Gm-Message-State: AC+VfDzUYSphWRa6/qU8UdcgJ6ugyi/YkmtVbXCO+XNOoTej81bSopOg 7qePY74XiR76paDLXzpDxaSMxle8D+NvnK3K/zqccr2Uhmuan0+Eff8lOW91F/AphEEJAOOQo4N LGpayAEExijOlMGaaxdbTLfXu9NQW0OUCDoGnQJdGCFLGQU2+pUfyBNRbRV64lWA2GsUMJ8GqQl /M4RIBVkIuI8hj X-Received: by 2002:adf:f8d0:0:b0:2d5:39d:514f with SMTP id f16-20020adff8d0000000b002d5039d514fmr1195506wrq.65.1684403351686; Thu, 18 May 2023 02:49:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ljI9LZFnvliw6i5+QDTVQVHJe59tfoyoNJU8BRVWHdwGMm0QmVAQ8XoaIOXle4+DTK5l9/w== X-Received: by 2002:adf:f8d0:0:b0:2d5:39d:514f with SMTP id f16-20020adff8d0000000b002d5039d514fmr1195485wrq.65.1684403351304; Thu, 18 May 2023 02:49:11 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id d17-20020a1c7311000000b003f17eaae2c9sm1514144wmb.1.2023.05.18.02.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 02:49:11 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Thu, 18 May 2023 11:48:40 +0200 Message-Id: <79dc7e13c34a9af34ec1a7e6f17fcea2fe210577.1684403044.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 v9 ovn 10/10] 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: Numan Siddique Acked-By: Ihar Hrachyshka Signed-off-by: Lorenzo Bianconi --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 0f1c5f985..a7a11061f 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,12 @@ Post v23.03.0 databases for ovn-nbctl and ovn-sbctl respectively. See man ovn-nb and man ovn-sb for 'nbctl_probe_interval' and 'sbctl_probe_interval' options for more details. + - 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 --------------------------