From patchwork Tue Oct 5 20:24:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1536912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=h9ylKlLS; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HP8Gn58ZDz9sPB for ; Wed, 6 Oct 2021 07:25:37 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id F3AEF60D5F; Tue, 5 Oct 2021 20:25:35 +0000 (UTC) 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 qirArE58h4eL; Tue, 5 Oct 2021 20:25:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4C1D960D56; Tue, 5 Oct 2021 20:25:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 24DC4C0011; Tue, 5 Oct 2021 20:25:34 +0000 (UTC) X-Original-To: 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 1727AC000D for ; Tue, 5 Oct 2021 20:25:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id ED79360D55 for ; Tue, 5 Oct 2021 20:25:32 +0000 (UTC) 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 oTVLTRrf63Pr for ; Tue, 5 Oct 2021 20:25:32 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by smtp3.osuosl.org (Postfix) with ESMTPS id 297E060D54 for ; Tue, 5 Oct 2021 20:25:32 +0000 (UTC) Received: by mail-lf1-x12e.google.com with SMTP id j5so937032lfg.8 for ; Tue, 05 Oct 2021 13:25:32 -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=Xj+aJ23f7REBMfjVVbtwX10SMo5JHWarq8DchZNcKxw=; b=h9ylKlLSKH1VqkboisRlJ9znFBE+3sZ2rA6pymJwiWKnM+Z2fIzXKv5J2Ko3VgxwBY gOSgA1ChQTCPaExucKjzdAXsnZLjxlM1t2GPRHeiN550hZbljWC9VvCF5R4nYjTD7YEX 9Th5KclKCFOJBm3JddGwY1DzXH1uB1KYb7NJtFwuTdobOR/z0+PjImys/ZoYJeXXtIJl sOJ+a3WJB0z7Wd2bFi6CedZbrkI5/Z4uvJzZsPMQwJnVzv3Gyt8Iu/o1vBRnxBh8ZEs0 eAccPt8ZUTmqa4FcsjW63OwNKULJtLBLSYKqZolPPdP+Qh8kgHS8FLJY536Hp4UVjrUJ QsVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xj+aJ23f7REBMfjVVbtwX10SMo5JHWarq8DchZNcKxw=; b=U/6C8xHnCtOWaI1x5pGIOi0NIBkYPK2emfLWoUmwevKputoEwBBxI9pLmxdAOMPGk1 emAC3NSRCgrEWg/dQ5TmdnkyM3WfzIlssVi39HlkycMB6YnVzytwiQg+a8+ApYCw9u54 COJLQzH2EJggGhURFIjijbJEgv6tHpzFXAUsEinqfsemK4LEjexmLFmTdRlYKIkoBWhN tDyD6asFxQhTsUqarnDs3khM+Mmn2zGENAGA8ph/ldrNzlDE0JPhQSOBSf1iqgTgwC8w wgpyz1YigIzSLBH/RWywiVkF4y+Q35M6YtLsBMlMqgwV8nAK+TN/zvsZSg5L9+M0yus6 +8fg== X-Gm-Message-State: AOAM532iVQaGOV2tc1UsdWUbULDUUf/XZ+nO2ade2rsvToyYP6Wg6L05 qt7r84iFmV2IRbaoOxd2NrerlVlDTy24rA== X-Google-Smtp-Source: ABdhPJyQP1cBS12HdUcs4GQmxVZBjjzDspg52PAvgr6JA8gg9J6bGhGI9L46BJYYpR6vf9l5ZqMUKA== X-Received: by 2002:a2e:9e10:: with SMTP id e16mr6706064ljk.216.1633465530025; Tue, 05 Oct 2021 13:25:30 -0700 (PDT) Received: from localhost.localdomain (109-252-131-59.dynamic.spd-mgts.ru. [109.252.131.59]) by smtp.gmail.com with ESMTPSA id 12sm2058870lfz.259.2021.10.05.13.25.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Oct 2021 13:25:29 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Tue, 5 Oct 2021 23:24:39 +0300 Message-Id: <20211005202442.85322-2-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20211005202442.85322-1-odivlad@gmail.com> References: <20211005202442.85322-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v6 1/4] 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 Acked-by: Numan Siddique --- ic/ovn-ic.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 99356253d..303e93a4f 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; }; @@ -1386,17 +1387,14 @@ 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) { @@ -1713,6 +1711,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); @@ -1763,6 +1766,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, };