From patchwork Fri May 3 08:13:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1930957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=20230601 header.b=Nc7krgrM; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW3W70f2Tz1ydX for ; Fri, 3 May 2024 18:14:42 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3E92240985; Fri, 3 May 2024 08:14:41 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id tXHIWB-ta3MX; Fri, 3 May 2024 08:14:38 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C16B741F53 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=20230601 header.b=Nc7krgrM Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id C16B741F53; Fri, 3 May 2024 08:14:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 88E7EC007C; Fri, 3 May 2024 08:14:37 +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 4F852C0037 for ; Fri, 3 May 2024 08:14:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DE4E340993 for ; Fri, 3 May 2024 08:14:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id IMDDCtgSUord for ; Fri, 3 May 2024 08:14:18 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::12b; helo=mail-lf1-x12b.google.com; envelope-from=odivlad@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org C15BC4071C Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C15BC4071C Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by smtp4.osuosl.org (Postfix) with ESMTPS id C15BC4071C for ; Fri, 3 May 2024 08:14:16 +0000 (UTC) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-51f17ac14daso2204220e87.1 for ; Fri, 03 May 2024 01:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714724037; x=1715328837; darn=openvswitch.org; 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=C8NVzLXxuQ+dzZWl4wJ5SvpyU8i9s4ZV1tROnGRmqyw=; b=Nc7krgrMDQQwyFWNb6GNGMGGurZXZ+AclT0Gl20h7JTVnTFP6sa0TMZoNdDKL75KeG qd7JQYCNnGXA8Ph/SfZR9h7fjhmrPuDESRx2xfwQ9zt4tol36WWGs00Lf4vWc3xVrHML glaI++o1QlSrtE4UpYiLqphGv/XT1zuzeMPQ76Qz3tgwVXkAtZcGs/lSl07QSoBmxADd cDKGeBeQuHD22EBv7vH2hONGTah5PR4a+A1iFNkscvblQM1v7ZUj/JDv5kA8ZqQLjnAS pGKbCrb+8/+zI3HWohql2joyuAyBJYFOZQMKMvLd1oKlWvN5XFQSbO+Lmn5+GrxMTvix 8qhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714724037; x=1715328837; 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=C8NVzLXxuQ+dzZWl4wJ5SvpyU8i9s4ZV1tROnGRmqyw=; b=PcPqYznfCKHyXhgNsh6PCt4w2z00Tloytr1ipuY5GW55Ar8LLk8szKREsEYOTW7Vo/ 0oo1vIHbkR/yy9+CqsKK3hXP7fL95Ka7IGjq9zHB4YFHyf/KGH/1Wm2yr0pjWMAowQ/k rMz6auHKoGzSvuDzWdAvtMcoeUKesn32PclevcF7jWCw5wdjPrzjpC3jQJS2mo1ds2fr F64qL+DyR6lHDEjqs+O09omGyge9Yh8DcR3fJ6jsiTqXWYKotp5cDuyNJ799o62scR0c K52hAQ0/0JThcTJGDBB9atna/8sXfHLZyyCOQ6KqEEa+P4rAa6zInm2EJ6ox9l/g3mN6 Id7w== X-Gm-Message-State: AOJu0YybgSL7s0tqRIyp4PZNyb9hZ0vKPjKmcOpy/SPhvjJUfKRWpnAZ Ve0wmrQZT5rZc7l///4zER8otBvePg4vdzYyqsptNSJjeVMu8REQVE4800Q5 X-Google-Smtp-Source: AGHT+IE4j9JtxNly4K2rafN8U7iS6/sVAKHK43FECqVwUHmNNP9rB9zdipssoC/ssQVAuX39g+uTlA== X-Received: by 2002:a05:6512:1583:b0:51d:67a0:2433 with SMTP id bp3-20020a056512158300b0051d67a02433mr1410584lfb.46.1714724036550; Fri, 03 May 2024 01:13:56 -0700 (PDT) Received: from ip-10-70-112-12.vpc-1e810be1.internal (c2-185-102-122-48.elastic.cloud.croc.ru. [185.102.122.48]) by smtp.gmail.com with ESMTPSA id cf9-20020a056512280900b0051e0c4137aesm465936lfb.17.2024.05.03.01.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 01:13:54 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 3 May 2024 11:13:47 +0300 Message-ID: <20240503081348.189608-3-odivlad@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240503081348.189608-1-odivlad@gmail.com> References: <20240503081348.189608-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v5 2/2] northd: Add support for disabling vxlan mode. 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" Commit [1] introduced a "VXLAN mode" concept. It brought a limitation for available tunnel IDs because of lack of space in VXLAN VNI. In VXLAN mode OVN is limited by 4095 datapaths (LRs or non-transit LSs) and 2047 logical ports per datapath. Prior to this patch VXLAN mode was enabled automatically if at least one chassis had encap of VXLAN type. In scenarios where one want to use VXLAN only for HW VTEP (RAMP) switch, such limitation makes no sence. This patch adds support for explicit disabling of VXLAN mode via Northbound database. 1: https://github.com/ovn-org/ovn/commit/b07f1bc3d068 Acked-By: Ihar Hrachyshka Fixes: b07f1bc3d068 ("Add VXLAN support for non-VTEP datapath bindings") Signed-off-by: Vladislav Odintsov --- NEWS | 4 ++++ northd/en-global-config.c | 7 ++++++- northd/northd.c | 10 ++++++++-- northd/northd.h | 3 ++- ovn-architecture.7.xml | 6 ++++++ ovn-nb.xml | 10 ++++++++++ tests/ovn-northd.at | 29 +++++++++++++++++++++++++++++ 7 files changed, 65 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 3b5e93dc9..007b27f3d 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,10 @@ Post v24.03.0 external-ids, the option is no longer needed as it became effectively "true" for all scenarios. - Added DHCPv4 relay support. + - Added new global config option NB_Global:options:disable_vxlan_mode to + extend available tunnel IDs space for datapaths from 4095 to 16711680 + when running in "VXLAN mode". For more details see man ovn-nb(5) for + mentioned option. OVN v24.03.0 - 01 Mar 2024 -------------------------- diff --git a/northd/en-global-config.c b/northd/en-global-config.c index 873649a89..f5e2a8154 100644 --- a/northd/en-global-config.c +++ b/northd/en-global-config.c @@ -115,7 +115,7 @@ en_global_config_run(struct engine_node *node , void *data) config_data->svc_monitor_mac); } - init_vxlan_mode(sbrec_chassis_table); + init_vxlan_mode(&nb->options, sbrec_chassis_table); char *max_tunid = xasprintf("%d", get_ovn_max_dp_key_local()); smap_replace(options, "max_tunid", max_tunid); free(max_tunid); @@ -533,6 +533,11 @@ check_nb_options_out_of_sync(const struct nbrec_nb_global *nb, return true; } + if (config_out_of_sync(&nb->options, &config_data->nb_options, + "disable_vxlan_mode", false)) { + return true; + } + return false; } diff --git a/northd/northd.c b/northd/northd.c index 0e0ae24db..7bdffe531 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -886,8 +886,14 @@ join_datapaths(const struct nbrec_logical_switch_table *nbrec_ls_table, } void -init_vxlan_mode(const struct sbrec_chassis_table *sbrec_chassis_table) +init_vxlan_mode(const struct smap *nb_options, + const struct sbrec_chassis_table *sbrec_chassis_table) { + if (smap_get_bool(nb_options, "disable_vxlan_mode", false)) { + vxlan_mode = false; + return; + } + const struct sbrec_chassis *chassis; SBREC_CHASSIS_TABLE_FOR_EACH (chassis, sbrec_chassis_table) { for (int i = 0; i < chassis->n_encaps; i++) { @@ -17596,7 +17602,7 @@ ovnnb_db_run(struct northd_input *input_data, use_common_zone = smap_get_bool(input_data->nb_options, "use_common_zone", false); - init_vxlan_mode(input_data->sbrec_chassis_table); + init_vxlan_mode(input_data->nb_options, input_data->sbrec_chassis_table); build_datapaths(ovnsb_txn, input_data->nbrec_logical_switch_table, diff --git a/northd/northd.h b/northd/northd.h index be480003e..d0322e621 100644 --- a/northd/northd.h +++ b/northd/northd.h @@ -792,7 +792,8 @@ lr_has_multiple_gw_ports(const struct ovn_datapath *od) } void -init_vxlan_mode(const struct sbrec_chassis_table *sbrec_chassis_table); +init_vxlan_mode(const struct smap *nb_options, + const struct sbrec_chassis_table *sbrec_chassis_table); uint32_t get_ovn_max_dp_key_local(void); diff --git a/ovn-architecture.7.xml b/ovn-architecture.7.xml index 3ecb58933..f4eae340c 100644 --- a/ovn-architecture.7.xml +++ b/ovn-architecture.7.xml @@ -2920,4 +2920,10 @@ the future, gateways that do not support encapsulations with large amounts of metadata may continue to have a reduced feature set.

+

+ VXLAN mode is recommended to be disabled if VXLAN encap at + hypervisors is needed only to support HW VTEP L2 Gateway functionality. + See man ovn-nb(5) for table NB_Global column + options key disable_vxlan_mode for more details. +

diff --git a/ovn-nb.xml b/ovn-nb.xml index 5cb6ba640..84f1e07b6 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -381,6 +381,16 @@ of SB changes would be very noticeable. + + By default if at least one chassis in OVN cluster has VXLAN encap, + northd will run in a VXLAN mode. See man + ovn-architecture(7) Tunnel Encapsulations paragraph for + more details. In case VXLAN encaps are needed on chassis only to + support HW VTEP functionality and main encap type is GENEVE or STT, set + this option to false to use default + non-VXLAN mode tunnel IDs allocation logic. + +

These options control how routes are advertised between OVN diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 680d96675..9ddd7d177 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -2847,6 +2847,35 @@ AT_CHECK( get_tunnel_keys AT_CHECK([test $lsp02 = 3 && test $ls1 = 123]) +AT_CLEANUP +]) +OVN_FOR_EACH_NORTHD_NO_HV([ +AT_SETUP([check VXLAN mode disabling]) +ovn_start + +# Create a fake chassis with vxlan encap to implicitly enable VXLAN mode. +ovn-sbctl \ + --id=@e create encap chassis_name=hv1 ip="192.168.0.1" type="vxlan" \ + -- --id=@c create chassis name=hv1 encaps=@e + +cmd="ovn-nbctl --wait=sb" +for i in {1..4097..1}; do + cmd="${cmd} -- ls-add lsw-${i}" +done + +check $cmd + +check_row_count nb:Logical_Switch 4097 +wait_row_count sb:Datapath_Binding 4095 + +OVS_WAIT_UNTIL([grep "all datapath tunnel ids exhausted" northd/ovn-northd.log]) + +# Explicitly disable VXLAN mode and check that two remaining datapaths were created. +check ovn-nbctl set NB_Global . options:disable_vxlan_mode=true + +check_row_count nb:Logical_Switch 4097 +wait_row_count sb:Datapath_Binding 4097 + AT_CLEANUP ])