From patchwork Fri Nov 18 16:20:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1705692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=O/62ISec; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NDMV24Twmz23mH for ; Sat, 19 Nov 2022 03:21:14 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6DE6C610AF; Fri, 18 Nov 2022 16:21:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6DE6C610AF 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=O/62ISec 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 AwjiJ28cRDa0; Fri, 18 Nov 2022 16:21:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 438E261070; Fri, 18 Nov 2022 16:21:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 438E261070 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EB230C002D; Fri, 18 Nov 2022 16:21:08 +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 76679C002D for ; Fri, 18 Nov 2022 16:21:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 518F8610A0 for ; Fri, 18 Nov 2022 16:21:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 518F8610A0 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 wUpoP23Yi5ZC for ; Fri, 18 Nov 2022 16:21:06 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org DF6156104E Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by smtp3.osuosl.org (Postfix) with ESMTPS id DF6156104E for ; Fri, 18 Nov 2022 16:21:05 +0000 (UTC) Received: by mail-lj1-x22e.google.com with SMTP id b9so7382862ljr.5 for ; Fri, 18 Nov 2022 08:21:05 -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=C3PouHVoNiOgH0VJEMVOujiTDRvkYQ/xhMys2jO/E5Q=; b=O/62ISeczoBAhtbR+RUnkLUrl6Dp8EgsxWH97v3JXvbhrWGH31IXiMmT0HwtFvDC03 KOJCRvKnyTwegk1r8ZcSYPKLyHERkSGIZiZlcfX9bwRviIWBUpT5Hp80+KFNGyGrS9mR fri+6wnz2ob2hhtH4ts/JIxkGHWxQePT5Yd2rHtjBjVtxfL8PCVZZDVC9fmm3H1Gh+pL xch0Tog3HW9ADksvYG4PbIHGz1gYympgvEpepwvz1wQ+gqwqVIT+2f2Uq+bzilcj7cth 7nmigQIi87kqo3M1qClYwZH+kwsUJwUDImyBMrlCg59cRh4f5f8CDc8C8JFQuieoKJgH fbDA== 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=C3PouHVoNiOgH0VJEMVOujiTDRvkYQ/xhMys2jO/E5Q=; b=lT2sPGrMluwyj8sG3U7lz5YPAGgwdQbI2kD1s6XhhSuO0UdGx8rHQvmnZK854hS+BP K9e7wlTXspjxA3fghrSTPtoRgzlXqDQPduqAllL3bhcTloYOQtDvKsnm36xmGp6Ua84Q +F8w7fvgi5fCvtLHwpy8vpTRRuCwx0+xu3fd/IKb/wnG9EVrf1BJUTqST7fg2dqQYR+W 67Z/em1ZWTj2A90fTLEzCml6btq8nSXwU5N57W4JoDG6CWrhV6jGX8ne1kNNjw1onTq8 p/pM3kktwPOGKLv1jbkSFshkBvetZ+sCv+6vfbPhD+XU8hNVHK3yKoUR09EvvalFc4dn A3oA== X-Gm-Message-State: ANoB5pmD1L/v3Hct+/LfhNDO06gZQC95XRIAhvb+J8N8uI8ShAGpeTw3 pPgIWMbyOVexWghGgIILD/Pv1h3nzrQ= X-Google-Smtp-Source: AA0mqf7fZdqdjdG22qwx5P+PhtBFKEhibwPMKmSZEfTScKoh4v2F4rcrfFH26pU94qThgRDcsQAuQw== X-Received: by 2002:a05:651c:1042:b0:279:35d4:a238 with SMTP id x2-20020a05651c104200b0027935d4a238mr1282422ljm.142.1668788463478; Fri, 18 Nov 2022 08:21:03 -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 o16-20020ac25e30000000b0049465afdd38sm717538lfg.108.2022.11.18.08.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:21:03 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 18 Nov 2022 19:20:44 +0300 Message-Id: <20221118162050.3019353-2-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221118162050.3019353-1-odivlad@gmail.com> References: <20221118162050.3019353-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [OVN RFC 1/7] ic: move routes_ad hmap insert to separate function 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 change will be useful in next commit. Signed-off-by: Vladislav Odintsov --- ic/ovn-ic.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index e5c193d9d..50ff65a26 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -881,10 +881,12 @@ ic_route_hash(const struct in6_addr *prefix, unsigned int plen, static struct ic_route_info * ic_route_find(struct hmap *routes, const struct in6_addr *prefix, unsigned int plen, const struct in6_addr *nexthop, - const char *origin, char *route_table) + const char *origin, const char *route_table, uint32_t hash) { struct ic_route_info *r; - uint32_t hash = ic_route_hash(prefix, plen, nexthop, origin, route_table); + if (!hash) { + hash = ic_route_hash(prefix, plen, nexthop, origin, route_table); + } HMAP_FOR_EACH_WITH_HASH (r, node, hash, routes) { if (ipv6_addr_equals(&r->prefix, prefix) && r->plen == plen && @@ -942,8 +944,8 @@ add_to_routes_learned(struct hmap *routes_learned, } const char *origin = smap_get_def(&nb_route->options, "origin", ""); if (ic_route_find(routes_learned, &prefix, plen, &nexthop, origin, - nb_route->route_table)) { - /* Route is already added to learned in previous iteration. */ + nb_route->route_table, 0)) { + /* Route was added to learned on previous iteration. */ return true; } @@ -1090,10 +1092,21 @@ route_need_advertise(const char *policy, } static void -add_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) +add_to_routes_ad(struct hmap *routes_ad, struct ic_route_info *ic_route) +{ + uint hash = ic_route_hash(&ic_route->prefix, ic_route->plen, + &ic_route->nexthop, ic_route->origin, + ic_route->route_table ? ic_route->route_table + : ""); + hmap_insert(routes_ad, &ic_route->node, hash); +} + +static void +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) { if (strcmp(route_table, nb_route->route_table)) { if (VLOG_IS_DBG_ENABLED()) { @@ -1149,9 +1162,7 @@ add_to_routes_ad(struct hmap *routes_ad, ic_route->nb_route = nb_route; ic_route->origin = ROUTE_ORIGIN_STATIC; ic_route->route_table = nb_route->route_table; - hmap_insert(routes_ad, &ic_route->node, - ic_route_hash(&prefix, plen, &nexthop, ROUTE_ORIGIN_STATIC, - nb_route->route_table)); + add_to_routes_ad(routes_ad, ic_route); } static void @@ -1204,9 +1215,7 @@ add_network_to_routes_ad(struct hmap *routes_ad, const char *network, /* directly-connected routes go to
route table */ ic_route->route_table = NULL; - hmap_insert(routes_ad, &ic_route->node, - ic_route_hash(&prefix, plen, &nexthop, - ROUTE_ORIGIN_CONNECTED, "")); + add_to_routes_ad(routes_ad, ic_route); } static bool @@ -1366,7 +1375,7 @@ sync_learned_routes(struct ic_context *ctx, struct ic_route_info *route_learned = ic_route_find(&ic_lr->routes_learned, &prefix, plen, &nexthop, isb_route->origin, - isb_route->route_table); + isb_route->route_table, 0); if (route_learned) { /* Sync external-ids */ struct uuid ext_id; @@ -1465,7 +1474,7 @@ advertise_routes(struct ic_context *ctx, } struct ic_route_info *route_adv = ic_route_find(routes_ad, &prefix, plen, &nexthop, - isb_route->origin, isb_route->route_table); + isb_route->origin, isb_route->route_table, 0); if (!route_adv) { /* Delete the extra route from IC-SB. */ VLOG_DBG("Delete route %s -> %s from IC-SB, which is not found" @@ -1547,8 +1556,8 @@ build_ts_routes_to_adv(struct ic_context *ctx, } } else { /* It may be a route to be advertised */ - add_to_routes_ad(routes_ad, nb_route, ts_port_addrs, - &nb_global->options, ts_route_table); + add_static_to_routes_ad(routes_ad, nb_route, ts_port_addrs, + &nb_global->options, ts_route_table); } } From patchwork Fri Nov 18 16:20:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1705694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=qsMR9qtM; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NDMV81rXhz23mH for ; Sat, 19 Nov 2022 03:21:20 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 39FDD61100; Fri, 18 Nov 2022 16:21:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 39FDD61100 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=qsMR9qtM 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 9veQhKW-zTYk; Fri, 18 Nov 2022 16:21:12 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 26BB8610E5; Fri, 18 Nov 2022 16:21:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 26BB8610E5 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DACE8C002D; Fri, 18 Nov 2022 16:21:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id CAFE6C002D for ; Fri, 18 Nov 2022 16:21:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id AE62C419BC for ; Fri, 18 Nov 2022 16:21:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org AE62C419BC Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=qsMR9qtM 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 PVqULEsZE8mG for ; Fri, 18 Nov 2022 16:21:07 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2AFCD419CA Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by smtp4.osuosl.org (Postfix) with ESMTPS id 2AFCD419CA for ; Fri, 18 Nov 2022 16:21:07 +0000 (UTC) Received: by mail-lf1-x134.google.com with SMTP id be13so8995205lfb.4 for ; Fri, 18 Nov 2022 08:21:06 -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=QOz7l5kQnfXUwc2gCJNqyaDH3sewa2dL9evQZJeoRGQ=; b=qsMR9qtMh/Yd/iUievdFBbrAKo81KdKcB60ExyDw7SLlvfmBuJK9gbkhthzxOErXww UB2T6bTT5pVkp8Yq8lduFZu7lnsYBOdBp9GJpMl4O7t3gxvH2MeEOEwqVWa4j/DayzRt yrk3mJeGWSKNqHszKbk0vE2qSHWXzYUuSx7KbRAfaS2taAHSOwFlq3QXKm/UDekRbQHb cskPP+Cq+RUFF3pl18ZoE4TgRS3lAHprlRXAaanlbB34RF3e8AQW9U9axwm6scFJjX2b eQQlbJxaNgiqKbtrfIxzioW2USSzBHW02Zx+QvfBf0hMFuFDSWYYfJcNzeX6rlLQTCAM JqQQ== 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=QOz7l5kQnfXUwc2gCJNqyaDH3sewa2dL9evQZJeoRGQ=; b=zIRBL2rNRT8WyZ3SwvrfFNpRJ0VU5s+hJsHwzUJkyEXQqE+c6tzRzKl2U/FEyMwi2Y NiemMQsAk5gf/JquUJvBOLJS0pEqw90ZvvhAV9x1sjUmD11DoCSBqJgGB35J1szt0AHG W9PgiZehgEPMTEdAcEPRyjzyIs1iu+/tPnNO2lVCJBwF2sGui1WwSX4+Ypa46UxwFLM8 cS/wn/oJHzlRK84oQ2LQiVQ7hfOqze+GNBMfiQWcoY9gAPX6tWCNrlR9dMC4r0Mvnemz wxlmhNiuXIYBs/J+7ikLOt9ZbFXjlkeb4vidIfHL4FbWFpx8J3XfOPmO6x/kwkI+jqOF ZlCQ== X-Gm-Message-State: ANoB5pkG4PUwGQwmjj7g7mngn/WG/os6ADhZP1X6QxGoGg4dofpGizfR BNwsNeJHOBADi6wirC+Va1rUQTKy37Q= X-Google-Smtp-Source: AA0mqf5x3dQaBbOQPhnfaJZVpYBCu2w90OI8Zewj5nA86GAi2GzLgd2+YZnJQNhaX1BsuqGqeCrqiw== X-Received: by 2002:a05:6512:3147:b0:4a7:7daf:905b with SMTP id s7-20020a056512314700b004a77daf905bmr2590185lfi.665.1668788464761; Fri, 18 Nov 2022 08:21:04 -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 o16-20020ac25e30000000b0049465afdd38sm717538lfg.108.2022.11.18.08.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:21:04 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 18 Nov 2022 19:20:45 +0300 Message-Id: <20221118162050.3019353-3-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221118162050.3019353-1-odivlad@gmail.com> References: <20221118162050.3019353-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [OVN RFC 2/7] ic: remove orphan ovn interconnection routes 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" Before this patch if one deletes transit switch through which there were routes in ICSB:Route table, such routes were left forever in the DB. Now we validate that each ICSB:Route has an appropriate transit switch. Signed-off-by: Vladislav Odintsov --- ic/ovn-ic.c | 40 +++++++++++++++++++++++++++ tests/ovn-ic.at | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 50ff65a26..b3790e965 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -71,6 +71,7 @@ struct ic_context { 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_az; struct ovsdb_idl_index *icsbrec_route_by_ts; struct ovsdb_idl_index *icsbrec_route_by_ts_az; }; @@ -1621,6 +1622,38 @@ advertise_lr_routes(struct ic_context *ctx, hmap_destroy(&routes_ad); } +static void +delete_orphan_ic_routes(struct ic_context *ctx, + const struct icsbrec_availability_zone *az) +{ + const struct icsbrec_route *isb_route, *isb_route_key = + icsbrec_route_index_init_row(ctx->icsbrec_route_by_az); + icsbrec_route_index_set_availability_zone(isb_route_key, az); + + const struct icnbrec_transit_switch *t_sw, *t_sw_key; + + ICSBREC_ROUTE_FOR_EACH_EQUAL (isb_route, isb_route_key, + ctx->icsbrec_route_by_az) + { + t_sw_key = icnbrec_transit_switch_index_init_row( + ctx->icnbrec_transit_switch_by_name); + icnbrec_transit_switch_index_set_name(t_sw_key, + isb_route->transit_switch); + t_sw = icnbrec_transit_switch_index_find( + ctx->icnbrec_transit_switch_by_name, t_sw_key); + icnbrec_transit_switch_index_destroy_row(t_sw_key); + + if (!t_sw) { + VLOG_WARN("Deleting orphan ICDB:Route: %s->%s (%s, rtb:%s, " + "transit switch: %s)", isb_route->ip_prefix, + isb_route->nexthop, isb_route->origin, + isb_route->route_table, isb_route->transit_switch); + icsbrec_route_delete(isb_route); + } + } + icsbrec_route_index_destroy_row(isb_route_key); +} + static void route_run(struct ic_context *ctx, const struct icsbrec_availability_zone *az) @@ -1629,6 +1662,8 @@ route_run(struct ic_context *ctx, return; } + delete_orphan_ic_routes(ctx, az); + struct hmap ic_lrs = HMAP_INITIALIZER(&ic_lrs); const struct icsbrec_port_binding *isb_pb; const struct icsbrec_port_binding *isb_pb_key = @@ -1917,6 +1952,10 @@ main(int argc, char *argv[]) &icsbrec_port_binding_col_transit_switch, &icsbrec_port_binding_col_availability_zone); + struct ovsdb_idl_index *icsbrec_route_by_az + = ovsdb_idl_index_create1(ovnisb_idl_loop.idl, + &icsbrec_route_col_availability_zone); + struct ovsdb_idl_index *icsbrec_route_by_ts = ovsdb_idl_index_create1(ovnisb_idl_loop.idl, &icsbrec_route_col_transit_switch); @@ -1971,6 +2010,7 @@ main(int argc, char *argv[]) .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_az = icsbrec_route_by_az, .icsbrec_route_by_ts = icsbrec_route_by_ts, .icsbrec_route_by_ts_az = icsbrec_route_by_ts_az, }; diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index 0bdfc55e6..e234b7fb9 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -121,6 +121,79 @@ OVN_CLEANUP_IC AT_CLEANUP ]) +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-ic -- route deletion upon TS deletion]) + +ovn_init_ic_db +net_add n1 + +# 1 GW per AZ +for i in 1 2; do + az=az$i + ovn_start $az + sim_add gw-$az + as gw-$az + check ovs-vsctl add-br br-phys + ovn_az_attach $az n1 br-phys 192.168.1.$i + check ovs-vsctl set open . external-ids:ovn-is-interconn=true + check ovn-nbctl set nb-global . \ + options:ic-route-adv=true \ + options:ic-route-adv-default=true \ + options:ic-route-learn=true \ + options:ic-route-learn-default=true +done + +create_ic_infra() { + az_id=$1 + ts_id=$2 + az=az$i + + lsp=lsp${az_id}-${ts_id} + lrp=lrp${az_id}-${ts_id} + ts=ts${az_id}-${ts_id} + lr=lr${az_id}-${ts_id} + + ovn_as $az + + check ovn-ic-nbctl ts-add $ts + check ovn-nbctl lr-add $lr + check ovn-nbctl lrp-add $lr $lrp 00:00:00:00:00:0$az_id 10.0.$az_id.1/24 + check ovn-nbctl lrp-set-gateway-chassis $lrp gw-$az + + check ovn-nbctl lsp-add $ts $lsp -- \ + lsp-set-addresses $lsp router -- \ + lsp-set-type $lsp router -- \ + lsp-set-options $lsp router-port=$lrp + + check ovn-nbctl lr-route-add $lr 192.168.0.0/16 10.0.$az_id.10 +} + +create_ic_infra 1 1 +create_ic_infra 1 2 +create_ic_infra 2 1 + +ovn_as az1 + +wait_row_count ic-sb:Route 3 ip_prefix=192.168.0.0/16 + +# remove transit switch 1 (from az1) and check if its route is deleted +# same route from another AZ and ts should remain, as +check ovn-ic-nbctl ts-del ts1-1 +sleep 2 +ovn-ic-sbctl list route +ovn-ic-nbctl list transit_switch +wait_row_count ic-sb:route 2 ip_prefix=192.168.0.0/16 +ovn-ic-sbctl list route + +for i in 1 2; do + az=az$i + OVN_CLEANUP_SBOX(gw-$az) + OVN_CLEANUP_AZ([$az]) +done +OVN_CLEANUP_IC +AT_CLEANUP +]) + OVN_FOR_EACH_NORTHD([ AT_SETUP([ovn-ic -- gateway sync]) From patchwork Fri Nov 18 16:20:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1705693 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" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=CpN66pZp; 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 4NDMV63DTxz23mH for ; Sat, 19 Nov 2022 03:21:18 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 11ED141A21; Fri, 18 Nov 2022 16:21:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 11ED141A21 Authentication-Results: smtp4.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=CpN66pZp 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 BmEaP91Z63QH; Fri, 18 Nov 2022 16:21:15 +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 3B91E41A0A; Fri, 18 Nov 2022 16:21:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3B91E41A0A Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C3EE6C0032; Fri, 18 Nov 2022 16:21:12 +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 E236FC007B for ; Fri, 18 Nov 2022 16:21:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A14AE8222E for ; Fri, 18 Nov 2022 16:21:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A14AE8222E 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=CpN66pZp 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 D-hnNS8BL34d for ; Fri, 18 Nov 2022 16:21:08 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1EDE582232 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1EDE582232 for ; Fri, 18 Nov 2022 16:21:08 +0000 (UTC) Received: by mail-lj1-x234.google.com with SMTP id a15so7369275ljb.7 for ; Fri, 18 Nov 2022 08:21:07 -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=Mfwl/P0EZ4lQ2LMc58omLKvT3OLSEI6o7EIeGaWkFXo=; b=CpN66pZpmF6GXFdd2TzBmpCjp3QkoM8bgabFWsSLDTjDuwQCNO9EPQ3JPGXi8uDf8m snxfnwibkp2miZy14zsK4EjaGjENLsINhGQt1dltkGDbi77JgyBvXlOBHfpjwrWoEXi/ VgmwNVW0qpEuI/X1NLJvRVEMoq7HK+bi5S+wiiuJ3mpsPfnOKa2eQ4rQvRiiquOEmiFw noJBepNz6IxCFExvnuIBYFGAZeD+nF5kQTBfxqwePG5X0j6uX5vot/+TxYhfx9S+fA68 4bNRgLKsCsBSOlHWxwsbIsJI8+W5obiZloIUBb318S+x05eVoJK2iEOser94/1Fn6zOW MNaQ== 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=Mfwl/P0EZ4lQ2LMc58omLKvT3OLSEI6o7EIeGaWkFXo=; b=xLBaPRbgnlF627Eh0NxQ0XMJuSB8m6UknLDsCdqVTTQqf0LtTLfHvLu8QVjNPzneOh vBhaWzl+A5gIEy8HWx2TCMpih2Joxt2smeXipSsXFWNYMvOIcX2VkLsblk88mWiPBWXk R3cCxZ874THKjdsvEktFbPhGYmtAlStT8kC9hUHS/2sOo5UdkzofFd2oOmlnppz5YhWp Vs7Qst92OfEQrhzPjI6ZzOoXJH8jXjpwmX9DwLgtZAMmgdEpWdX3Ux+T4xzQTNJjZW69 PdW+rlG+xyiygV5EsCS4VlQ5dVN1wlg2xQDlZ/lKqCThKOUeOBNydhOr/om4rGV6vDeP pAUg== X-Gm-Message-State: ANoB5plPDWHClZ7pAeWd1fapU9tq5b/70DdiVPoG24DvcEt6YSzI0bMZ 8MCTu9Eje5xYSNX0e/eE0ebFTuRaU6g= X-Google-Smtp-Source: AA0mqf7L7umG1skmEpxnrClsmw0F7uS3yGCUSi57PD7gWL8gDBx7QfmHBswX4w3WlxY2vmBvwWHEXw== X-Received: by 2002:a05:651c:110a:b0:26d:e85b:92af with SMTP id e10-20020a05651c110a00b0026de85b92afmr2562301ljo.464.1668788465856; Fri, 18 Nov 2022 08:21:05 -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 o16-20020ac25e30000000b0049465afdd38sm717538lfg.108.2022.11.18.08.21.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:21:05 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 18 Nov 2022 19:20:46 +0300 Message-Id: <20221118162050.3019353-4-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221118162050.3019353-1-odivlad@gmail.com> References: <20221118162050.3019353-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [OVN RFC 3/7] ic: lookup southbound port_binding only if needed 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" Signed-off-by: Vladislav Odintsov --- ic/ovn-ic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index b3790e965..3e02b4c98 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -757,6 +757,7 @@ port_binding_run(struct ic_context *ctx, } icsbrec_port_binding_index_destroy_row(isb_pb_key); + const struct sbrec_port_binding *sb_pb; const struct icnbrec_transit_switch *ts; ICNBREC_TRANSIT_SWITCH_FOR_EACH (ts, ctx->ovninb_idl) { const struct nbrec_logical_switch *ls = find_ts_in_nb(ctx, ts->name); @@ -788,9 +789,9 @@ port_binding_run(struct ic_context *ctx, for (int i = 0; i < ls->n_ports; i++) { lsp = ls->ports[i]; - const struct sbrec_port_binding *sb_pb = find_lsp_in_sb(ctx, lsp); if (!strcmp(lsp->type, "router")) { /* The port is local. */ + sb_pb = find_lsp_in_sb(ctx, lsp); if (!sb_pb) { continue; } @@ -807,6 +808,7 @@ port_binding_run(struct ic_context *ctx, if (!isb_pb) { nbrec_logical_switch_update_ports_delvalue(ls, lsp); } else { + sb_pb = find_lsp_in_sb(ctx, lsp); if (!sb_pb) { continue; } From patchwork Fri Nov 18 16:20:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1705696 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=isqtCdi6; 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 4NDMVC1Xblz23mZ for ; Sat, 19 Nov 2022 03:21:23 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D291D6110E; Fri, 18 Nov 2022 16:21:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D291D6110E 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=isqtCdi6 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 FrVe_0mxwvG8; Fri, 18 Nov 2022 16:21:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4F2FF610FD; Fri, 18 Nov 2022 16:21:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4F2FF610FD Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6CC4CC0082; Fri, 18 Nov 2022 16:21:14 +0000 (UTC) X-Original-To: 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 A3668C002D for ; Fri, 18 Nov 2022 16:21:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 7125E400EF for ; Fri, 18 Nov 2022 16:21:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 7125E400EF Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=isqtCdi6 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 fO6h50t_15rN for ; Fri, 18 Nov 2022 16:21:09 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 88A8140D7B Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by smtp2.osuosl.org (Postfix) with ESMTPS id 88A8140D7B for ; Fri, 18 Nov 2022 16:21:09 +0000 (UTC) Received: by mail-lj1-x22a.google.com with SMTP id u11so7371108ljk.6 for ; Fri, 18 Nov 2022 08:21:09 -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=URq4s/7rmU2CSBCohkXbsby+fBSuDvSNuWs8CdKeq7o=; b=isqtCdi6VM7jVl+pYQbtu710d1iGWjd3ykSFbwlqwlCX6ISDdaGxA5mBbk45egDFNs W4W80u+VT2mhMSAInWmvGeDE1kS1n4/oryioI09i9Gr4Ykyh7n/Ur1izm3hXeUcEBIDV TVu0tzOzx4N3+VPrFmRsJH4pYkstcWQw6+MG7ewXRKlsWu0cyqvT1ctUhekt1dxfNf9p GrNjJ+97q+YFb+Y94WzMA1I1nBxtL4BiJb2lEK7RlEqHqr2DyZ986WLzYmscDU+LxeuE CfcQ5HclN5Y3Qa2SbNCyQ82LwJWqNA5DJ6sRFcUVSBwHIXAAxAha1vw0TDeslBrW8iry o5+Q== 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=URq4s/7rmU2CSBCohkXbsby+fBSuDvSNuWs8CdKeq7o=; b=jeOBuR1AA/r56YpRfzLj5sB4/nOdnBof0CiEQOCca6yS1K+H+Q55eojKZ/Dlkq5DwX NQQXFFOE7ZSz4Y4MgCPRVQRMuPhcnZIg9mS4JiowXS0vKuPU3tmeiV60UnJKQumVkwMt Z3qz5MAiqio6JfA2qHoCHGvrgoYnxN+k9E4JjtBgjM8377NjpHJv2uXKrh1SF0Ehk9pf qyRvBXA4Sl9T8NQRjUGxSBbwUUFmypAjg66Es1qAx0Chb6sjQIm515a/IDmktD0hrcM1 oW7SKqDMTbpK7AS4sfG9uqrU4vTx0Q/eXJlbjpPems+PhWqVUgikFdWiUXIOOcN3WgHU M+UA== X-Gm-Message-State: ANoB5pnf9++k9gFutV4SOr/B+F6J/mYMl3tjAvsp+D0g/EL/KXVPnUv3 pb/OhlyK6BU9UVgT0zyoLYl15d8CQVNB8A== X-Google-Smtp-Source: AA0mqf7Eo0R8KOmpcCz7Jx5Blnz+LpJDWZhcDmX1GhCVpEJubh4hyDm8ZYlGv3+qqTL+7WYpLUauhQ== X-Received: by 2002:a05:651c:118d:b0:277:23f:5f58 with SMTP id w13-20020a05651c118d00b00277023f5f58mr2563458ljo.303.1668788467132; Fri, 18 Nov 2022 08:21:07 -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 o16-20020ac25e30000000b0049465afdd38sm717538lfg.108.2022.11.18.08.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:21:06 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 18 Nov 2022 19:20:47 +0300 Message-Id: <20221118162050.3019353-5-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221118162050.3019353-1-odivlad@gmail.com> References: <20221118162050.3019353-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [OVN RFC 4/7] actions: limit possible OF group bucket count 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" It is possible to send OpenFlow group_mod message to OVS to create a group with any number of buckets: ovs-ofctl dump-groups br-int NXST_GROUP_DESC reply (xid=0x2): group_id=4,type=select,selection_method=dp_hash,bucket=bucket_id:0,weight:100,actions=load:0x1->OXM_OF_PKT_REG4[48..63],resubmit(,20),...bucket=bucket_id:10000,... This patch introduces a limit of buckets that may be requested to 1024. In case the limit is reached, ovn-controller will write WARN log about this fact. Signed-off-by: Vladislav Odintsov --- lib/actions.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/actions.c b/lib/actions.c index adbb42db4..4322556bf 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -44,6 +44,9 @@ #include "controller/lflow.h" VLOG_DEFINE_THIS_MODULE(actions); + +#define MAX_BUCKETS_PER_GROUP 1024 + /* Prototypes for functions to be defined by each action. */ #define OVNACT(ENUM, STRUCT) \ @@ -1371,7 +1374,18 @@ encode_ct_lb(const struct ovnact_ct_lb *cl, BUILD_ASSERT(MFF_LOG_CT_ZONE < MFF_REG0 + FLOW_N_REGS); BUILD_ASSERT(MFF_LOG_DNAT_ZONE >= MFF_REG0); BUILD_ASSERT(MFF_LOG_DNAT_ZONE < MFF_REG0 + FLOW_N_REGS); - for (size_t bucket_id = 0; bucket_id < cl->n_dsts; bucket_id++) { + + int n_buckets; + bool group_overflow = false; + if (cl->n_dsts > MAX_BUCKETS_PER_GROUP) { + n_buckets = MAX_BUCKETS_PER_GROUP; + group_overflow = true; + } + else { + n_buckets = cl->n_dsts; + } + + for (size_t bucket_id = 0; bucket_id < n_buckets; bucket_id++) { const struct ovnact_ct_lb_dst *dst = &cl->dsts[bucket_id]; char ip_addr[INET6_ADDRSTRLEN]; if (dst->family == AF_INET) { @@ -1405,6 +1419,12 @@ encode_ct_lb(const struct ovnact_ct_lb *cl, /* Create an action to set the group. */ og = ofpact_put_GROUP(ofpacts); og->group_id = table_id; + + if (group_overflow) { + VLOG_WARN("OF group id '%d' is desired to have more than " + "MAX_BUCKETS_PER_GROUP (%d) buckets. Limited to maximum.", + table_id, MAX_BUCKETS_PER_GROUP); + } } static void @@ -1542,7 +1562,17 @@ encode_SELECT(const struct ovnact_select *select, struct mf_subfield sf = expr_resolve_field(&select->res_field); - for (size_t bucket_id = 0; bucket_id < select->n_dsts; bucket_id++) { + int n_buckets; + bool group_overflow = false; + if (select->n_dsts > MAX_BUCKETS_PER_GROUP) { + n_buckets = MAX_BUCKETS_PER_GROUP; + group_overflow = true; + } + else { + n_buckets = select->n_dsts; + } + + for (size_t bucket_id = 0; bucket_id < n_buckets; bucket_id++) { const struct ovnact_select_dst *dst = &select->dsts[bucket_id]; ds_put_format(&ds, ",bucket=bucket_id=%"PRIuSIZE",weight:%"PRIu16 ",actions=", bucket_id, dst->weight); @@ -1561,6 +1591,12 @@ encode_SELECT(const struct ovnact_select *select, /* Create an action to set the group. */ og = ofpact_put_GROUP(ofpacts); og->group_id = table_id; + + if (group_overflow) { + VLOG_WARN("OF group id '%d' is desired to have more than " + "MAX_BUCKETS_PER_GROUP (%d) buckets. Limited to maximum.", + table_id, MAX_BUCKETS_PER_GROUP); + } } static void From patchwork Fri Nov 18 16:20:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1705695 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.137; helo=smtp4.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=EE3pEgaG; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.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 4NDMVB2VKqz23mH for ; Sat, 19 Nov 2022 03:21:22 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B71E541A52; Fri, 18 Nov 2022 16:21:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B71E541A52 Authentication-Results: smtp4.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=EE3pEgaG 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 HkavRYqiUl1s; Fri, 18 Nov 2022 16:21:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1C7CC41A2B; Fri, 18 Nov 2022 16:21:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1C7CC41A2B Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D59B9C007B; Fri, 18 Nov 2022 16:21:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id C199FC0085 for ; Fri, 18 Nov 2022 16:21:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A82CA41A00 for ; Fri, 18 Nov 2022 16:21:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org A82CA41A00 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 3EXRo2jIQ7i3 for ; Fri, 18 Nov 2022 16:21:10 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9A5C2419CC Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9A5C2419CC for ; Fri, 18 Nov 2022 16:21:10 +0000 (UTC) Received: by mail-lj1-x22d.google.com with SMTP id d20so7330863ljc.12 for ; Fri, 18 Nov 2022 08:21:10 -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=iPuRNWahIvsVuJ4p9i3UIqHS+U5YuEN8nNCbxqXH7F4=; b=EE3pEgaG1Av2jODd4RklBLebvzmb4/t5WvB3g+VwwVt5juBjO3mJT0qJVEHXlKsEYx m2DIRH8+k+H7L/tmqA0AmZZz+p6Z8+w4y0WilTXKdvZY7K4ERbdFzF4XElfo5+hDefJ6 vGn/X+P0+T1nR7idZS3NtKECt1udHNTTpAWJWalEAMLoXvdWaQ3QyfM86jN8NIRyOAeP jpdniMK/5OnP4yHR9GH//LGPFULVyaSNRvTPS23Ln7yzomTsxcVl1BzRt3zeuLU0PK7R vUNPAyB+YvHQEITw2ttrLfBf8cUNQFDa5KSvS68Tefrc8GWGyrxR3mDRU8EdJjzo5aOR DC/g== 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=iPuRNWahIvsVuJ4p9i3UIqHS+U5YuEN8nNCbxqXH7F4=; b=hCRBwJsNxxyxHaVYM3gh4NonCdbYnQBSSbsuMFKBaAhTnV2hNiBlg4j4oOI0FmUGFF ezY7t2GXeRvn7ouxSyIkPKmSTNiEK4/yuhutTIsIeJp658Tj8jFcYvjFvyGio9u1bj5B qAzwDiTpn7iFYLfqhjOpwqQTpCkPDbuMY7kW1U0CD7+S9buUXrQMry2wtH2uMeG4b3GM my4cJHQeVYPvKAqn64VRLCYzMqY5eA7x06lRpL30YdhhYCEB8RGow69R/IqnWYdrf640 kH0qnjsDJYb7U2GY/KKy181o0H8WblUbzxB0kAHgydlvG7jKHVjjRnUENXnIis4A9NOl 90Hw== X-Gm-Message-State: ANoB5pleYcTEn2kD7UtMNCMFq2JqbTJtpoOi5VIgW9LWDRv/tqx0aIk9 KuW1BiUtiRFjIhgrb4r2ITmeUpeWklLo0A== X-Google-Smtp-Source: AA0mqf4H2fM3aC5rID8OoM/uTml1+cj3RXGm9BTbNto0K9EZRgDs6CMWNuh6lRlSl+axyfNj+Aj1BA== X-Received: by 2002:a05:651c:168d:b0:277:8a07:521c with SMTP id bd13-20020a05651c168d00b002778a07521cmr2592795ljb.335.1668788468244; Fri, 18 Nov 2022 08:21:08 -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 o16-20020ac25e30000000b0049465afdd38sm717538lfg.108.2022.11.18.08.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:21:07 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 18 Nov 2022 19:20:48 +0300 Message-Id: <20221118162050.3019353-6-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221118162050.3019353-1-odivlad@gmail.com> References: <20221118162050.3019353-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [OVN RFC 5/7] 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 route_table check in ic_route_fin(). 4. Move variable declarations out of loop. Signed-off-by: Vladislav Odintsov --- ic/ovn-ic.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 3e02b4c98..59468545d 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; } } @@ -1109,17 +1108,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, @@ -1541,13 +1531,13 @@ build_ts_routes_to_adv(struct ic_context *ctx, { const struct nbrec_logical_router *lr = ic_lr->lr; + const struct nbrec_logical_router_static_route *nb_route; + struct uuid id; + /* Check static routes of the LR */ for (int i = 0; i < lr->n_static_routes; i++) { - const struct nbrec_logical_router_static_route *nb_route - = lr->static_routes[i]; - struct uuid isb_uuid; - if (smap_get_uuid(&nb_route->external_ids, "ic-learned-route", - &isb_uuid)) { + nb_route = lr->static_routes[i]; + if (smap_get_uuid(&nb_route->external_ids, "ic-learned-route", &id)) { /* It is a learned route */ if (!add_to_routes_learned(&ic_lr->routes_learned, nb_route)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); @@ -1557,10 +1547,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); } } @@ -1593,7 +1583,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); @@ -1611,7 +1600,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); From patchwork Fri Nov 18 16:20:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1705697 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" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=kKNz7acr; 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 4NDMVF08NDz23mH for ; Sat, 19 Nov 2022 03:21:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C025841A65; Fri, 18 Nov 2022 16:21:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C025841A65 Authentication-Results: smtp4.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=kKNz7acr 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 BKzYrZeRwrw4; Fri, 18 Nov 2022 16:21:21 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5B512419F7; Fri, 18 Nov 2022 16:21:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5B512419F7 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A4B60C0032; Fri, 18 Nov 2022 16:21:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 033BCC0071 for ; Fri, 18 Nov 2022 16:21:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A53B38221C for ; Fri, 18 Nov 2022 16:21:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A53B38221C 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=kKNz7acr 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 68-m_yP8IH6l for ; Fri, 18 Nov 2022 16:21:12 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D3B4482244 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by smtp1.osuosl.org (Postfix) with ESMTPS id D3B4482244 for ; Fri, 18 Nov 2022 16:21:11 +0000 (UTC) Received: by mail-lj1-x233.google.com with SMTP id z24so7387037ljn.4 for ; Fri, 18 Nov 2022 08:21:11 -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=+bSxNDx1/9Svnf57Ff65t7ILJjLnaOySLhnpDJZwDrE=; b=kKNz7acrsiXFJBCq0gJLd8EBSm9yDkcZeMA0xp/uSWZoG/EtBP0HCDVixBgT6vc7s4 qT+O5ubT3wpU0L3ftgd8Zh99T1rQ+IW05TlhVt91GCC4/SCs3zlXEt4SBB9KeTzTFy7C EciFL/xEgChMQRN/iFZongws8/Msi+Dy15JDpkndw5rTRAjBwuBB8TpxhpNl9I6V2V3e f0Q/gInIRNqK4wceOkpZMVPjCE5uvbpE+/FSsVsvuuSucYg3QComSIvjzA/M1tqeCJAW fJIRVJ19R3JKkRYkmXaXJY0fOt0URulMlFFmGbkzpaHMzGUe3hIB+n01bnbHG/9azH5F v7Tg== 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=+bSxNDx1/9Svnf57Ff65t7ILJjLnaOySLhnpDJZwDrE=; b=lGn7mcMb/I/3Cd9fpc/F+e2wG4JZEW6jbaU29FDhYJNUXShSN+CB4SdzH5dNJXnI9/ gGXwnXiMLTRepPzQuerk4PZZk1fl+I3sslGtl80aZoBsjB49aCWmMECWnTMiRvxFuUmJ gT0t1mkeQM7NK2Ee0+etzfJfnd1f8fVV3De1LJ9cw4ce2BZMW0yFqtNYL7smXNZ3U0Hf aDLJLzvueBfnPAQgcGga8RTNtF9KfrwQDvWLgMYZDwJlmcPiz7cci1YNAyEieLP5xWxA 8RU2QI0tCqpyS0LXNdaPj+F677G/tXvyFxpTAf/Mt5uOwaIfUMFGLzu8dBQ5lJ8TJs7U 2dcA== X-Gm-Message-State: ANoB5pkXiK84LAp4VYzrnPn85KWcI5CXhzzMuQXSQCZzAsQ6Y0iTPcPf RINwAmP/szf6ENW3mHhDMQGr7vohpAhp6g== X-Google-Smtp-Source: AA0mqf5vniR5rdtlTc6fbR8iDXVjxz6p62DsTbkdU0h73S7z4Epq1xnJvd+Rd+NlPwdv8/JidkoN3Q== X-Received: by 2002:a2e:22c4:0:b0:277:515b:3db6 with SMTP id i187-20020a2e22c4000000b00277515b3db6mr2599937lji.497.1668788469334; Fri, 18 Nov 2022 08:21:09 -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 o16-20020ac25e30000000b0049465afdd38sm717538lfg.108.2022.11.18.08.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:21:09 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 18 Nov 2022 19:20:49 +0300 Message-Id: <20221118162050.3019353-7-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221118162050.3019353-1-odivlad@gmail.com> References: <20221118162050.3019353-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [OVN RFC 6/7] northd: limit ECMP group by 1024 members 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 is intended to show that currently it's possible to build ECMP group of 65k buckets. Signed-off-by: Vladislav Odintsov --- northd/northd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/northd/northd.c b/northd/northd.c index e1f3bace8..f8f7977ae 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -9271,7 +9271,7 @@ static void ecmp_groups_add_route(struct ecmp_groups_node *group, const struct parsed_route *route) { - if (group->route_count == UINT16_MAX) { + if (group->route_count == 1024) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); VLOG_WARN_RL(&rl, "too many routes in a single ecmp group."); return; From patchwork Fri Nov 18 16:20:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1705698 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=I+vgS6Sr; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NDMVN5tJNz23mH for ; Sat, 19 Nov 2022 03:21:32 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7CC9761134; Fri, 18 Nov 2022 16:21:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7CC9761134 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=I+vgS6Sr 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 S2K_eOrvpRNv; Fri, 18 Nov 2022 16:21:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 7FCFA61117; Fri, 18 Nov 2022 16:21:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7FCFA61117 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 969C2C0084; Fri, 18 Nov 2022 16:21:18 +0000 (UTC) X-Original-To: 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 1910CC007B for ; Fri, 18 Nov 2022 16:21:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 87223419FD for ; Fri, 18 Nov 2022 16:21:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 87223419FD Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=I+vgS6Sr 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 rk1lNwn22gHF for ; Fri, 18 Nov 2022 16:21:13 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org F348641A0B Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by smtp4.osuosl.org (Postfix) with ESMTPS id F348641A0B for ; Fri, 18 Nov 2022 16:21:12 +0000 (UTC) Received: by mail-lj1-x231.google.com with SMTP id z24so7387099ljn.4 for ; Fri, 18 Nov 2022 08:21:12 -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=LKQl6pesmdEOYY/ZPjiYmgcle3VIhXaG0irRr1JNUTo=; b=I+vgS6Sr16TNQ/pfAoX9bO20jNgg/C0WTexZN1Bx0OepvZJ3FQ1vW6hkFpiQxlH79F +mbkXDgM6FNWdSUkDdbeiuxv/8C8dNTK47Bi0BRcMesWzImXuTdIAgJAhl3ZftLhIfOZ SafpzN12brhvG/gqIFVP0WrAPG8WJk40Ik5sQUlrmGBC6Z6R5b4nbAJvEQ6/Jw5uH0f2 BsoQt/990Sl8u9mS7NbOYvFfvWo1dfMDogPhRhBO0yCBu6I4lNnzIHTGH0hknn+UDEeO adYB0Z3LhfF6eDV35+KkLOaYpEKuVaWdiao6qHDvb+e5NEQl0c0p1TZqY1bqyB4/Hoyq p2/A== 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=LKQl6pesmdEOYY/ZPjiYmgcle3VIhXaG0irRr1JNUTo=; b=fk64he1brUGS8SeVbkoanQ9tN43+cMyGsQcjByE9tYqWCt+Jd0D3i80C92tKZRYDJ1 7WL/Ss5tuh2Dfptq54e8uyAW39f5DLor332mEH7OWkTIbx0PrppUEvKCz9nXwtao+T5r 2JL15uq4KHtXcPZpT4G8Ap7E1MqjnT0rivWQ4I0SRoKtd4FcwyRmOLjaAfqyQ4rn91zV ciyoxNp2oFar0CiiitUjBg6p66fIOEMDtnCgzl2xeTNJ2b5Cjlw3UiCNwM3mfj4sWfAk 0F7VU2ud2Do+rATjKFK0vNgsp62D0OTk20KleVSdjpsc7Jiktd5GVOWMx189n8ZPL9dn 6sXw== X-Gm-Message-State: ANoB5plR1A7cPRhLIS6kXgSmCmp8L6Zlt3zgJAqcdRG5B31MmSQPpwDm IncWl4jQrP2n/AciSCcrJ/uxb+u5fny8WQ== X-Google-Smtp-Source: AA0mqf4vml/GJPyaq6epH12x0oEcvC0vZpZT+vUaLgsbXru3S3LbZEnAUd+Sz/zaZ4V2YhoykrOGpw== X-Received: by 2002:a05:651c:171c:b0:26f:bfd1:cc14 with SMTP id be28-20020a05651c171c00b0026fbfd1cc14mr2767555ljb.256.1668788470588; Fri, 18 Nov 2022 08:21:10 -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 o16-20020ac25e30000000b0049465afdd38sm717538lfg.108.2022.11.18.08.21.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:21:10 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 18 Nov 2022 19:20:50 +0300 Message-Id: <20221118162050.3019353-8-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221118162050.3019353-1-odivlad@gmail.com> References: <20221118162050.3019353-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [OVN RFC 7/7] ic: prevent advertising/learning multiple same routes 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" Signed-off-by: Vladislav Odintsov --- ic/ovn-ic.c | 17 ++++++++++--- ovn-ic-sb.ovsschema | 6 +++-- tests/ovn-ic.at | 60 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 5 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 59468545d..beafd133b 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -1096,11 +1096,22 @@ route_need_advertise(const char *policy, static void add_to_routes_ad(struct hmap *routes_ad, struct ic_route_info *ic_route) { + const char *route_table = ic_route->route_table ? ic_route->route_table + : ""; uint hash = ic_route_hash(&ic_route->prefix, ic_route->plen, &ic_route->nexthop, ic_route->origin, - ic_route->route_table ? ic_route->route_table - : ""); - hmap_insert(routes_ad, &ic_route->node, hash); + route_table); + + if (!ic_route_find(routes_ad, &ic_route->prefix, ic_route->plen, + &ic_route->nexthop, ic_route->origin, route_table, + hash)) { + hmap_insert(routes_ad, &ic_route->node, hash); + } + else { + VLOG_WARN("Duplicate route advertisement was suppressed! NB route " + "uuid: "UUID_FMT, + UUID_ARGS(&ic_route->nb_route->header_.uuid)); + } } static void diff --git a/ovn-ic-sb.ovsschema b/ovn-ic-sb.ovsschema index 72c9d3f3e..1d60b36d1 100644 --- a/ovn-ic-sb.ovsschema +++ b/ovn-ic-sb.ovsschema @@ -1,7 +1,7 @@ { "name": "OVN_IC_Southbound", - "version": "1.1.0", - "cksum": "2309827842 6784", + "version": "1.1.1", + "cksum": "3684563024 6914", "tables": { "IC_SB_Global": { "columns": { @@ -101,6 +101,8 @@ "external_ids": { "type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}}}, + "indexes": [["transit_switch", "availability_zone", "route_table", + "ip_prefix", "nexthop"]], "isRoot": true}, "Connection": { "columns": { diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index e234b7fb9..ceee45092 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -194,6 +194,66 @@ OVN_CLEANUP_IC AT_CLEANUP ]) +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-ic -- duplicate NB route adv/learn]) + +ovn_init_ic_db +net_add n1 + +# 1 GW per AZ +for i in 1 2; do + az=az$i + ovn_start $az + sim_add gw-$az + as gw-$az + check ovs-vsctl add-br br-phys + ovn_az_attach $az n1 br-phys 192.168.1.$i + check ovs-vsctl set open . external-ids:ovn-is-interconn=true + check ovn-nbctl set nb-global . \ + options:ic-route-adv=true \ + options:ic-route-adv-default=true \ + options:ic-route-learn=true \ + options:ic-route-learn-default=true +done + +ovn_as az1 + +# create transit switch and connect to LR +check ovn-ic-nbctl ts-add ts1 +for i in 1 2; do + ovn_as az$i + + check ovn-nbctl lr-add lr1 + check ovn-nbctl lrp-add lr1 lrp$i 00:00:00:00:0$i:01 10.0.$i.1/24 + check ovn-nbctl lrp-set-gateway-chassis lrp$i gw-az$i + + check ovn-nbctl lsp-add ts1 lsp$i -- \ + lsp-set-addresses lsp$i router -- \ + lsp-set-type lsp$i router -- \ + lsp-set-options lsp$i router-port=lrp$i +done + +ovn_as az1 + +ovn-nbctl \ + --id=@id create logical-router-static-route ip_prefix=1.1.1.1/32 nexthop=10.0.1.10 -- \ + add logical-router lr1 static_routes @id +ovn-nbctl \ + --id=@id create logical-router-static-route ip_prefix=1.1.1.1/32 nexthop=10.0.1.10 -- \ + add logical-router lr1 static_routes @id + +wait_row_count ic-sb:route 1 ip_prefix=1.1.1.1/32 + +for i in 1 2; do + az=az$i + OVN_CLEANUP_SBOX(gw-$az) + OVN_CLEANUP_AZ([$az]) +done + +OVN_CLEANUP_IC +AT_CLEANUP +]) + OVN_FOR_EACH_NORTHD([ AT_SETUP([ovn-ic -- gateway sync])