From patchwork Fri Sep 3 10:34:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1524201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=N/qWLdEP; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H1DhV2TMFz9s5R for ; Fri, 3 Sep 2021 20:35:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2582B83B53; Fri, 3 Sep 2021 10:35:18 +0000 (UTC) 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 51YSmM2dPig6; Fri, 3 Sep 2021 10:35:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3CF4783AF0; Fri, 3 Sep 2021 10:35:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 869F4C0029; Fri, 3 Sep 2021 10:35:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2140DC0028 for ; Fri, 3 Sep 2021 10:35:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0324261551 for ; Fri, 3 Sep 2021 10:35:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 BRmN5o2qDQ7c for ; Fri, 3 Sep 2021 10:35:13 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by smtp3.osuosl.org (Postfix) with ESMTPS id D7591606DB for ; Fri, 3 Sep 2021 10:35:12 +0000 (UTC) Received: by mail-ed1-x535.google.com with SMTP id j13so7320641edv.13 for ; Fri, 03 Sep 2021 03:35:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4drxCxjH0H4aweSrRyiQ6GVys7VxmBtD38/0Xgn44Os=; b=N/qWLdEPa0nq8H7ql9wRDziWYLQBC1IpQmIUVVrrGLkmbzxdORSP1SP/ee11fHX0q9 hKiZJYOwPStwVdE3GaIurnnxbF24mAxekZRJ1PsYQzeBIublpB0vDtb/srcXnUoqgmBW H0brf3UDXXuS8OaixiktU0qFHkFNhuBWYW1qvFQnHXnz7776hjyTb3yPi1YSTVB5JXB6 mj2fA229KUqJQrPy76IjSAwv5tgSG8Zst8WZG6GMv5EGLXYiio9pjhowCYC2oINIpL/y kzS7N667WWwnyngQf9J1QmnmMmZsVQvRS6bn9Gotk/zEC8axSjGOWmAMVbY8hywFr0bE 9POQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4drxCxjH0H4aweSrRyiQ6GVys7VxmBtD38/0Xgn44Os=; b=DbNv8VjgHOuZNGidGPrg8PV1B+0RPyE2Ay1PVius7c7dV/VVHxXV1xOwLn6wN2C7Js VUGRNQYAWpkSrfbgXs2+8NvdPjDhmPTQvNQfsAkcPhG+8FyUgECBmkjDy0jDdQPgDIGt juE6WGDUxS7z//nfpDvIdpHEiEHHLIYyvdFOZbd12SPfakK9KZfa61Y6b/knHqFpXRTp TT38l2GSlZsIkjGWBKN3eVx9NwZFgJfHuOGDU7OxdhOFDPcd+F+CPzecgviqnE4fm9hC xuhh+L4hSIUalB9ljRoV6rWxlObC12rQnUkuw6R1Ds5RP1SmtRCPn7VM1U3fcpzSb/hT 2foQ== X-Gm-Message-State: AOAM531nT8Kh9xelZnpCL+/EFbhcngQKF0/E+k3CvnG2JRTjpdFe6Tqw CoxyyqxgbSI9Hx1EEqdqVJe92jYHIIc= X-Google-Smtp-Source: ABdhPJywgz7yNhes03lPcP1wIlVD5FrN/znQnclwM2sV4TDW1SAQv6NdSDyLqyBxdaTJZF6820eAFQ== X-Received: by 2002:a50:cc04:: with SMTP id m4mr3242161edi.358.1630665310956; Fri, 03 Sep 2021 03:35:10 -0700 (PDT) Received: from localhost.localdomain ([85.187.18.127]) by smtp.gmail.com with ESMTPSA id d22sm2609897ejj.47.2021.09.03.03.35.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Sep 2021 03:35:10 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 3 Sep 2021 13:34:37 +0300 Message-Id: <20210903103441.33178-3-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210903103441.33178-1-odivlad@gmail.com> References: <20210903103441.33178-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v2 2/6] ic: process only local port_bindings 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 commit adds a small optimization by utilizing ovsdb_index to iterate over port_bindings. Prior to this change each iteration checked availability_zone and continued processing only if port_binding belons to local AZ. Now we run against port_bindings from local AZ only and don't check availability_zone. Signed-off-by: Vladislav Odintsov --- ic/ovn-ic.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 418f19147..980000d3e 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -68,6 +68,7 @@ struct ic_context { struct ovsdb_idl_index *sbrec_port_binding_by_name; struct ovsdb_idl_index *icsbrec_port_binding_by_az; struct ovsdb_idl_index *icsbrec_port_binding_by_ts; + struct ovsdb_idl_index *icsbrec_port_binding_by_ts_az; struct ovsdb_idl_index *icsbrec_route_by_ts; struct ovsdb_idl_index *icsbrec_route_by_ts_az; }; @@ -1391,17 +1392,15 @@ route_run(struct ic_context *ctx, const struct icsbrec_port_binding *isb_pb; const struct icsbrec_port_binding *isb_pb_key = icsbrec_port_binding_index_init_row( - ctx->icsbrec_port_binding_by_ts); + ctx->icsbrec_port_binding_by_ts_az); icsbrec_port_binding_index_set_transit_switch(isb_pb_key, ts->name); + icsbrec_port_binding_index_set_availability_zone(isb_pb_key, az); /* Each port on TS maps to a logical router, which is stored in the * external_ids:router-id of the IC SB port_binding record. */ ICSBREC_PORT_BINDING_FOR_EACH_EQUAL (isb_pb, isb_pb_key, - ctx->icsbrec_port_binding_by_ts) { - if (isb_pb->availability_zone != az) { - continue; - } - + ctx->icsbrec_port_binding_by_ts_az) + { const char *ts_lrp_name = get_lrp_name_by_ts_port_name(ctx, isb_pb->logical_port); if (!ts_lrp_name) { @@ -1718,6 +1717,11 @@ main(int argc, char *argv[]) = ovsdb_idl_index_create1(ovnisb_idl_loop.idl, &icsbrec_port_binding_col_transit_switch); + struct ovsdb_idl_index *icsbrec_port_binding_by_ts_az + = ovsdb_idl_index_create2(ovnisb_idl_loop.idl, + &icsbrec_port_binding_col_transit_switch, + &icsbrec_port_binding_col_availability_zone); + struct ovsdb_idl_index *icsbrec_route_by_ts = ovsdb_idl_index_create1(ovnisb_idl_loop.idl, &icsbrec_route_col_transit_switch); @@ -1768,6 +1772,7 @@ main(int argc, char *argv[]) .sbrec_chassis_by_name = sbrec_chassis_by_name, .icsbrec_port_binding_by_az = icsbrec_port_binding_by_az, .icsbrec_port_binding_by_ts = icsbrec_port_binding_by_ts, + .icsbrec_port_binding_by_ts_az = icsbrec_port_binding_by_ts_az, .icsbrec_route_by_ts = icsbrec_route_by_ts, .icsbrec_route_by_ts_az = icsbrec_route_by_ts_az, };