From patchwork Tue Dec 6 10:20:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1712646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=gIsXGyvu; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NRGdy0cdQz23ys for ; Tue, 6 Dec 2022 21:20:54 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 41CD360FBB; Tue, 6 Dec 2022 10:20:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 41CD360FBB Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=gIsXGyvu 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 kYCslyW7K1vh; Tue, 6 Dec 2022 10:20:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6137E60FB8; Tue, 6 Dec 2022 10:20:46 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6137E60FB8 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CABF0C0083; Tue, 6 Dec 2022 10:20:43 +0000 (UTC) X-Original-To: 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 146D3C002D for ; Tue, 6 Dec 2022 10:20:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D382981E3E for ; Tue, 6 Dec 2022 10:20:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D382981E3E Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=gIsXGyvu 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 pKzLehtcDlWf for ; Tue, 6 Dec 2022 10:20:40 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6228381E20 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6228381E20 for ; Tue, 6 Dec 2022 10:20:40 +0000 (UTC) Received: by mail-lf1-x136.google.com with SMTP id 1so9291420lfz.4 for ; Tue, 06 Dec 2022 02:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3auUt9Lx9JNUzh7TpLNV9ba41DRcfZpn3khXR/mO+Sg=; b=gIsXGyvuuqxQpIELsSCAarQb6MABQ/gK6gfws0AS7pZ8qBk81K1RX6FQGkF+xzIX/B Ulb2sU1yKE73pWK7hHnqylpqAwvdcFjXYbWSzptkpY2K4JQTXlFQOg6SQ903R64hBIbH Hoi1RFF5NUHVges2PyqMlH9jSZ+7kuV9BbaR+5anXVrN5kiDXvJNv2SZZNRtIBsgtGOf MjUdfoAQi8auZ7AFwSHMLjddj9xgQPBEQZGxDnouiBMepPbtloAG6lp3GvltmxbnpUS5 71BzzBoIOu8Nb82Do7wOIecflRHlCToWvQsioUaUhEVvJncDtPSTW9ECTTj9XbZlMAGl Tk3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=3auUt9Lx9JNUzh7TpLNV9ba41DRcfZpn3khXR/mO+Sg=; b=UCNOEDCMEc2Y+IssRzXqu8SPf3GbpySrqiCGYT0+AaqRqG/nr5Ktq/w+GUCX+zh06i Xi2HEHlpx91v8EkeSPt1a7xx8BZNgPuILvKP1lRGDyOXLV13wWeLk3FsV6mwN3yIZMFJ KSwVtkeZPhIAI1opVL3FbAUj0gsD1sEk+sRKBHdbNsojy9igA1h+LoicUY+tcXwf3lSL kFbUaiaBzpZyv3LTK44uQGk8A9WBhrNde2UcZSVVp9NVkuyZ6gcctZk+YkT+ST5wIOZb 22d59JXd61WwmIsI9AmxHB8yudqx2ENuLfABiCVNKwzkQC7LEOXxRltGJTmLWIU+BfRQ qmtg== X-Gm-Message-State: ANoB5pnIUmoeTaj7dbXiqQj/ccZQ7C71aLjfjIjHvS8WvSgBBomjsMAG VhHRFMGbXh4XVBj8CWEbB2XibJTD4+lhxDX4 X-Google-Smtp-Source: AA0mqf7YTlpAe9IQVQP1FxaIZjTBOjfHCBazDqR2nVaRB3VPIvUVgP6b3qZ1TAXSvCvFiUotC/oC3Q== X-Received: by 2002:a05:6512:693:b0:4b5:5384:aa3c with SMTP id t19-20020a056512069300b004b55384aa3cmr5606035lfe.150.1670322038133; Tue, 06 Dec 2022 02:20:38 -0800 (PST) Received: from ip-10-70-112-12.vpc-1e810be1.internal (c2-178-216-98-9.elastic.cloud.croc.ru. [178.216.98.9]) by smtp.gmail.com with ESMTPSA id m1-20020a056512114100b004b515f9d117sm2409614lfg.271.2022.12.06.02.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 02:20:37 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Tue, 6 Dec 2022 13:20:01 +0300 Message-Id: <20221206102001.3058710-5-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221206102001.3058710-1-odivlad@gmail.com> References: <20221206102001.3058710-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov , dragen15051@gmail.com Subject: [ovs-dev] [PATCH ovn v2 4/4] ic: minor code improvements 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" 1. Remove excess nbrec_logical_router variable. 2. Remove excess call to add_static_to_routes_ad(). 3. Remove double nexthop check in ic_route_find(). Signed-off-by: Vladislav Odintsov Acked-by: Dumitru Ceara --- ic/ovn-ic.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 64307d8c4..fb6cdfad8 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -895,8 +895,7 @@ ic_route_find(struct hmap *routes, const struct in6_addr *prefix, r->plen == plen && ipv6_addr_equals(&r->nexthop, nexthop) && !strcmp(r->origin, origin) && - !strcmp(r->route_table ? r->route_table : "", route_table) && - ipv6_addr_equals(&r->nexthop, nexthop)) { + !strcmp(r->route_table ? r->route_table : "", route_table)) { return r; } } @@ -1130,17 +1129,8 @@ add_static_to_routes_ad( struct hmap *routes_ad, const struct nbrec_logical_router_static_route *nb_route, const struct lport_addresses *nexthop_addresses, - const struct smap *nb_options, const char *route_table) + const struct smap *nb_options) { - if (strcmp(route_table, nb_route->route_table)) { - if (VLOG_IS_DBG_ENABLED()) { - VLOG_DBG("Skip advertising route %s -> %s as its route table %s !=" - " %s of TS port", nb_route->ip_prefix, nb_route->nexthop, - nb_route->route_table, route_table); - } - return; - } - struct in6_addr prefix, nexthop; unsigned int plen; if (!parse_route(nb_route->ip_prefix, nb_route->nexthop, @@ -1565,10 +1555,10 @@ build_ts_routes_to_adv(struct ic_context *ctx, nbrec_logical_router_update_static_routes_delvalue(lr, nb_route); } - } else { + } else if (!strcmp(ts_route_table, nb_route->route_table)) { /* It may be a route to be advertised */ add_static_to_routes_ad(routes_ad, nb_route, ts_port_addrs, - &nb_global->options, ts_route_table); + &nb_global->options); } } @@ -1601,7 +1591,6 @@ advertise_lr_routes(struct ic_context *ctx, const struct icsbrec_port_binding *isb_pb; const char *lrp_name, *ts_name, *route_table; struct lport_addresses ts_port_addrs; - const struct nbrec_logical_router *lr = ic_lr->lr; const struct icnbrec_transit_switch *key; struct hmap routes_ad = HMAP_INITIALIZER(&routes_ad); @@ -1619,7 +1608,7 @@ advertise_lr_routes(struct ic_context *ctx, VLOG_INFO_RL(&rl, "Route sync ignores port %s on ts %s for router" " %s because the addresses are invalid.", isb_pb->logical_port, isb_pb->transit_switch, - lr->name); + ic_lr->lr->name); continue; } lrp_name = get_lrp_name_by_ts_port_name(ctx, isb_pb->logical_port);