From patchwork Fri Jun 7 13:54:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1945100 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=kabEW/Gz; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VwjNp66Cxz20PW for ; Fri, 7 Jun 2024 23:54:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EF6D36154F; Fri, 7 Jun 2024 13:54:16 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id zZJd4NZBC8vF; Fri, 7 Jun 2024 13:54:15 +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 smtp3.osuosl.org 74A3961543 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=20230601 header.b=kabEW/Gz Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 74A3961543; Fri, 7 Jun 2024 13:54:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1E30FC0013; Fri, 7 Jun 2024 13:54:15 +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 95064C0012 for ; Fri, 7 Jun 2024 13:54:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 729E7812F3 for ; Fri, 7 Jun 2024 13:54:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Vl6gUglga4QK for ; Fri, 7 Jun 2024 13:54:12 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::133; helo=mail-lf1-x133.google.com; envelope-from=odivlad@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org E2C43811B3 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E2C43811B3 Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=kabEW/Gz Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by smtp1.osuosl.org (Postfix) with ESMTPS id E2C43811B3 for ; Fri, 7 Jun 2024 13:54:11 +0000 (UTC) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-52b936c958dso2558005e87.0 for ; Fri, 07 Jun 2024 06:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717768449; x=1718373249; 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=0xHqPdyoiL/4FEK+VmkRJA0eeIkTEszakCwLu6IWvt4=; b=kabEW/GzIkd+dTKMp+sY1meGjDqMnMP2szGLUqoKNDbhxQlNdgdFx0jGGLufZ6JXv4 YVe2V0URroi3Qj5RFG7ghSq/x6QoK4NpMLUPSOQFAIALEpXh2Gm/T0hw8z6vnaVf0IGu Y2S/e8cuX3oeS5cYKuflq/EhCAmVbchS2U5qjqn1JhUqjmdT1CfJM5ZMx8Q46QrOTdTJ 7ymcusMTzB75IR21DL5B0TXx8OtsCuIaKBQN8PIuhKMISL4c0VIEMVwg1jAT2d2X0tcT n6UXxrj2Ps4GTW0fxYhKcl6cU92IKaA8QJFm3chbw1oCUX+ntK9xl6VUJZRZI9fzjn9+ SNyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717768449; x=1718373249; 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=0xHqPdyoiL/4FEK+VmkRJA0eeIkTEszakCwLu6IWvt4=; b=ZWNMJBi6GB6RYJpUktP7sRevGRrf65f5VpMpp1xcfmDykXeIHFB9ol56gVg/qdN2Lm Syc3dvgVT2J4xAzZMKdruXzKwfSpXFHMTrvKF7Mp0esCa65aS7RAi42Z2zXysWZ0ZFtw YYLz02JJo3mAywmoElzzii8SrD5q26UAQhkqCHTbrrnV+qXZFIycyAUxN9WamgrY16VQ 9/0dTVMpwnj2iz967pnY3Vbg4lFkF+p7OKburpDPrF896gaMHt1f7aZ49I8OV5uPcL6Q FReXIbORN3Tu7nwVX7SCB6c4q1A5p/AtKdo0z7TGbYiycS7fVIRoMEwNeOKjJp6bTYW9 xonQ== X-Gm-Message-State: AOJu0YzEMU8+6JxTU5WUbq1nbcVc0A2XBtsnJCyNFGXY1zYINIo3MuOK N+6iUhLKsKmljFQWgLcucdVyt6BYpWG70c821k2Wa6hSrnysXjhGE9weZg== X-Google-Smtp-Source: AGHT+IERR6UXnjFq05n20kqQQgazrSkpugKPcVZ1x1ikM8U0GrkLfkwbrhWrT3h6AiL6LAarMzuuSw== X-Received: by 2002:ac2:4884:0:b0:52b:5451:996a with SMTP id 2adb3069b0e04-52bb9f8dd37mr1466595e87.31.1717768448985; Fri, 07 Jun 2024 06:54:08 -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 2adb3069b0e04-52bb421671bsm536610e87.134.2024.06.07.06.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 06:54:08 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 7 Jun 2024 16:54:02 +0300 Message-ID: <20240607135404.758245-2-odivlad@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240607135404.758245-1-odivlad@gmail.com> References: <20240607135404.758245-1-odivlad@gmail.com> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v6 1/2] northd: Make `vxlan_mode` a global variable. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladislav Odintsov Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This simplifies code and subsequent commit to explicitely disable VXLAN mode is based on these changes. Also "VXLAN mode" term is introduced in ovn-architecture man page. Signed-off-by: Vladislav Odintsov Acked-by: Ales Musil --- northd/en-global-config.c | 3 +- northd/northd.c | 76 ++++++++++++++++----------------------- northd/northd.h | 5 ++- ovn-architecture.7.xml | 10 +++--- 4 files changed, 41 insertions(+), 53 deletions(-) diff --git a/northd/en-global-config.c b/northd/en-global-config.c index 28c78a12c..df0f8e58c 100644 --- a/northd/en-global-config.c +++ b/northd/en-global-config.c @@ -116,7 +116,8 @@ en_global_config_run(struct engine_node *node , void *data) } char *max_tunid = xasprintf("%d", - get_ovn_max_dp_key_local(sbrec_chassis_table)); + get_ovn_max_dp_key_local( + is_vxlan_mode(sbrec_chassis_table))); smap_replace(options, "max_tunid", max_tunid); free(max_tunid); diff --git a/northd/northd.c b/northd/northd.c index 9f81afccb..6d118a19a 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -90,6 +90,10 @@ static bool use_ct_inv_match = true; */ static bool default_acl_drop; +/* If this option is 'true' northd will use limited 24-bit space for datapath + * and ports tunnel key allocation (12 bits for each instead of default 16). */ +static bool vxlan_mode; + #define MAX_OVN_TAGS 4096 @@ -881,7 +885,7 @@ join_datapaths(const struct nbrec_logical_switch_table *nbrec_ls_table, } } -static bool +bool is_vxlan_mode(const struct sbrec_chassis_table *sbrec_chassis_table) { const struct sbrec_chassis *chassis; @@ -896,25 +900,22 @@ is_vxlan_mode(const struct sbrec_chassis_table *sbrec_chassis_table) } uint32_t -get_ovn_max_dp_key_local(const struct sbrec_chassis_table *sbrec_chassis_table) +get_ovn_max_dp_key_local(bool _vxlan_mode) { - if (is_vxlan_mode(sbrec_chassis_table)) { - /* OVN_MAX_DP_GLOBAL_NUM doesn't apply for vxlan mode. */ + if (_vxlan_mode) { + /* OVN_MAX_DP_GLOBAL_NUM doesn't apply for VXLAN mode. */ return OVN_MAX_DP_VXLAN_KEY; } return OVN_MAX_DP_KEY - OVN_MAX_DP_GLOBAL_NUM; } static void -ovn_datapath_allocate_key(const struct sbrec_chassis_table *sbrec_ch_table, - struct hmap *datapaths, struct hmap *dp_tnlids, +ovn_datapath_allocate_key(struct hmap *datapaths, struct hmap *dp_tnlids, struct ovn_datapath *od, uint32_t *hint) { if (!od->tunnel_key) { od->tunnel_key = ovn_allocate_tnlid(dp_tnlids, "datapath", - OVN_MIN_DP_KEY_LOCAL, - get_ovn_max_dp_key_local(sbrec_ch_table), - hint); + OVN_MIN_DP_KEY_LOCAL, get_ovn_max_dp_key_local(vxlan_mode), hint); if (!od->tunnel_key) { if (od->sb) { sbrec_datapath_binding_delete(od->sb); @@ -927,7 +928,6 @@ ovn_datapath_allocate_key(const struct sbrec_chassis_table *sbrec_ch_table, static void ovn_datapath_assign_requested_tnl_id( - const struct sbrec_chassis_table *sbrec_chassis_table, struct hmap *dp_tnlids, struct ovn_datapath *od) { const struct smap *other_config = (od->nbs @@ -936,8 +936,7 @@ ovn_datapath_assign_requested_tnl_id( uint32_t tunnel_key = smap_get_int(other_config, "requested-tnl-key", 0); if (tunnel_key) { const char *interconn_ts = smap_get(other_config, "interconn-ts"); - if (!interconn_ts && is_vxlan_mode(sbrec_chassis_table) && - tunnel_key >= 1 << 12) { + if (!interconn_ts && vxlan_mode && tunnel_key >= 1 << 12) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); VLOG_WARN_RL(&rl, "Tunnel key %"PRIu32" for datapath %s is " "incompatible with VXLAN", tunnel_key, @@ -985,7 +984,6 @@ build_datapaths(struct ovsdb_idl_txn *ovnsb_txn, const struct nbrec_logical_switch_table *nbrec_ls_table, const struct nbrec_logical_router_table *nbrec_lr_table, const struct sbrec_datapath_binding_table *sbrec_dp_table, - const struct sbrec_chassis_table *sbrec_chassis_table, struct ovn_datapaths *ls_datapaths, struct ovn_datapaths *lr_datapaths, struct ovs_list *lr_list) @@ -1000,12 +998,11 @@ build_datapaths(struct ovsdb_idl_txn *ovnsb_txn, struct hmap dp_tnlids = HMAP_INITIALIZER(&dp_tnlids); struct ovn_datapath *od; LIST_FOR_EACH (od, list, &both) { - ovn_datapath_assign_requested_tnl_id(sbrec_chassis_table, &dp_tnlids, - od); + ovn_datapath_assign_requested_tnl_id(&dp_tnlids, od); } LIST_FOR_EACH (od, list, &nb_only) { - ovn_datapath_assign_requested_tnl_id(sbrec_chassis_table, &dp_tnlids, - od); } + ovn_datapath_assign_requested_tnl_id(&dp_tnlids, od); + } /* Keep nonconflicting tunnel IDs that are already assigned. */ LIST_FOR_EACH (od, list, &both) { @@ -1017,12 +1014,10 @@ build_datapaths(struct ovsdb_idl_txn *ovnsb_txn, /* Assign new tunnel ids where needed. */ uint32_t hint = 0; LIST_FOR_EACH_SAFE (od, list, &both) { - ovn_datapath_allocate_key(sbrec_chassis_table, - datapaths, &dp_tnlids, od, &hint); + ovn_datapath_allocate_key(datapaths, &dp_tnlids, od, &hint); } LIST_FOR_EACH_SAFE (od, list, &nb_only) { - ovn_datapath_allocate_key(sbrec_chassis_table, - datapaths, &dp_tnlids, od, &hint); + ovn_datapath_allocate_key(datapaths, &dp_tnlids, od, &hint); } /* Sync tunnel ids from nb to sb. */ @@ -4012,16 +4007,14 @@ ovn_port_add_tnlid(struct ovn_port *op, uint32_t tunnel_key) * that the I-P engine can fallback to recompute if needed; otherwise return * true (even if the key is not allocated). */ static bool -ovn_port_assign_requested_tnl_id( - const struct sbrec_chassis_table *sbrec_chassis_table, struct ovn_port *op) +ovn_port_assign_requested_tnl_id(struct ovn_port *op) { const struct smap *options = (op->nbsp ? &op->nbsp->options : &op->nbrp->options); uint32_t tunnel_key = smap_get_int(options, "requested-tnl-key", 0); if (tunnel_key) { - if (is_vxlan_mode(sbrec_chassis_table) && - tunnel_key >= OVN_VXLAN_MIN_MULTICAST) { + if (vxlan_mode && tunnel_key >= OVN_VXLAN_MIN_MULTICAST) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); VLOG_WARN_RL(&rl, "Tunnel key %"PRIu32" for port %s " "is incompatible with VXLAN", @@ -4041,11 +4034,10 @@ ovn_port_assign_requested_tnl_id( } static bool -ovn_port_allocate_key(const struct sbrec_chassis_table *sbrec_chassis_table, - struct ovn_port *op) +ovn_port_allocate_key(struct ovn_port *op) { if (!op->tunnel_key) { - uint8_t key_bits = is_vxlan_mode(sbrec_chassis_table)? 12 : 16; + uint8_t key_bits = vxlan_mode ? 12 : 16; op->tunnel_key = ovn_allocate_tnlid(&op->od->port_tnlids, "port", 1, (1u << (key_bits - 1)) - 1, &op->od->port_key_hint); @@ -4065,7 +4057,6 @@ ovn_port_allocate_key(const struct sbrec_chassis_table *sbrec_chassis_table, static void build_ports(struct ovsdb_idl_txn *ovnsb_txn, const struct sbrec_port_binding_table *sbrec_port_binding_table, - const struct sbrec_chassis_table *sbrec_chassis_table, const struct sbrec_mirror_table *sbrec_mirror_table, const struct sbrec_mac_binding_table *sbrec_mac_binding_table, const struct sbrec_ha_chassis_group_table *sbrec_ha_chassis_group_table, @@ -4099,10 +4090,10 @@ build_ports(struct ovsdb_idl_txn *ovnsb_txn, /* Assign explicitly requested tunnel ids first. */ struct ovn_port *op; LIST_FOR_EACH (op, list, &both) { - ovn_port_assign_requested_tnl_id(sbrec_chassis_table, op); + ovn_port_assign_requested_tnl_id(op); } LIST_FOR_EACH (op, list, &nb_only) { - ovn_port_assign_requested_tnl_id(sbrec_chassis_table, op); + ovn_port_assign_requested_tnl_id(op); } /* Keep nonconflicting tunnel IDs that are already assigned. */ @@ -4114,14 +4105,14 @@ build_ports(struct ovsdb_idl_txn *ovnsb_txn, /* Assign new tunnel ids where needed. */ LIST_FOR_EACH_SAFE (op, list, &both) { - if (!ovn_port_allocate_key(sbrec_chassis_table, op)) { + if (!ovn_port_allocate_key(op)) { sbrec_port_binding_delete(op->sb); ovs_list_remove(&op->list); ovn_port_destroy(ports, op); } } LIST_FOR_EACH_SAFE (op, list, &nb_only) { - if (!ovn_port_allocate_key(sbrec_chassis_table, op)) { + if (!ovn_port_allocate_key(op)) { ovs_list_remove(&op->list); ovn_port_destroy(ports, op); } @@ -4333,14 +4324,13 @@ ls_port_init(struct ovn_port *op, struct ovsdb_idl_txn *ovnsb_txn, struct ovn_datapath *od, const struct sbrec_port_binding *sb, const struct sbrec_mirror_table *sbrec_mirror_table, - const struct sbrec_chassis_table *sbrec_chassis_table, struct ovsdb_idl_index *sbrec_chassis_by_name, struct ovsdb_idl_index *sbrec_chassis_by_hostname) { op->od = od; parse_lsp_addrs(op); /* Assign explicitly requested tunnel ids first. */ - if (!ovn_port_assign_requested_tnl_id(sbrec_chassis_table, op)) { + if (!ovn_port_assign_requested_tnl_id(op)) { return false; } /* Keep nonconflicting tunnel IDs that are already assigned. */ @@ -4350,7 +4340,7 @@ ls_port_init(struct ovn_port *op, struct ovsdb_idl_txn *ovnsb_txn, } } /* Assign new tunnel ids where needed. */ - if (!ovn_port_allocate_key(sbrec_chassis_table, op)) { + if (!ovn_port_allocate_key(op)) { return false; } /* Create new binding, if needed. */ @@ -4374,15 +4364,13 @@ ls_port_create(struct ovsdb_idl_txn *ovnsb_txn, struct hmap *ls_ports, const char *key, const struct nbrec_logical_switch_port *nbsp, struct ovn_datapath *od, const struct sbrec_mirror_table *sbrec_mirror_table, - const struct sbrec_chassis_table *sbrec_chassis_table, struct ovsdb_idl_index *sbrec_chassis_by_name, struct ovsdb_idl_index *sbrec_chassis_by_hostname) { struct ovn_port *op = ovn_port_create(ls_ports, key, nbsp, NULL, NULL); hmap_insert(&od->ports, &op->dp_node, hmap_node_hash(&op->key_node)); - if (!ls_port_init(op, ovnsb_txn, od, NULL, - sbrec_mirror_table, sbrec_chassis_table, + if (!ls_port_init(op, ovnsb_txn, od, NULL, sbrec_mirror_table, sbrec_chassis_by_name, sbrec_chassis_by_hostname)) { ovn_port_destroy(ls_ports, op); return NULL; @@ -4397,7 +4385,6 @@ ls_port_reinit(struct ovn_port *op, struct ovsdb_idl_txn *ovnsb_txn, struct ovn_datapath *od, const struct sbrec_port_binding *sb, const struct sbrec_mirror_table *sbrec_mirror_table, - const struct sbrec_chassis_table *sbrec_chassis_table, struct ovsdb_idl_index *sbrec_chassis_by_name, struct ovsdb_idl_index *sbrec_chassis_by_hostname) { @@ -4405,8 +4392,7 @@ ls_port_reinit(struct ovn_port *op, struct ovsdb_idl_txn *ovnsb_txn, op->sb = sb; ovn_port_set_nb(op, nbsp, NULL); op->primary_port = op->cr_port = NULL; - return ls_port_init(op, ovnsb_txn, od, sb, - sbrec_mirror_table, sbrec_chassis_table, + return ls_port_init(op, ovnsb_txn, od, sb, sbrec_mirror_table, sbrec_chassis_by_name, sbrec_chassis_by_hostname); } @@ -4551,7 +4537,6 @@ ls_handle_lsp_changes(struct ovsdb_idl_txn *ovnsb_idl_txn, op = ls_port_create(ovnsb_idl_txn, &nd->ls_ports, new_nbsp->name, new_nbsp, od, ni->sbrec_mirror_table, - ni->sbrec_chassis_table, ni->sbrec_chassis_by_name, ni->sbrec_chassis_by_hostname); if (!op) { @@ -4585,7 +4570,6 @@ ls_handle_lsp_changes(struct ovsdb_idl_txn *ovnsb_idl_txn, if (!ls_port_reinit(op, ovnsb_idl_txn, new_nbsp, od, sb, ni->sbrec_mirror_table, - ni->sbrec_chassis_table, ni->sbrec_chassis_by_name, ni->sbrec_chassis_by_hostname)) { if (sb) { @@ -17621,11 +17605,12 @@ ovnnb_db_run(struct northd_input *input_data, use_common_zone = smap_get_bool(input_data->nb_options, "use_common_zone", false); + vxlan_mode = is_vxlan_mode(input_data->sbrec_chassis_table); + build_datapaths(ovnsb_txn, input_data->nbrec_logical_switch_table, input_data->nbrec_logical_router_table, input_data->sbrec_datapath_binding_table, - input_data->sbrec_chassis_table, &data->ls_datapaths, &data->lr_datapaths, &data->lr_list); build_lb_datapaths(input_data->lbs, input_data->lbgrps, @@ -17633,7 +17618,6 @@ ovnnb_db_run(struct northd_input *input_data, &data->lb_datapaths_map, &data->lb_group_datapaths_map); build_ports(ovnsb_txn, input_data->sbrec_port_binding_table, - input_data->sbrec_chassis_table, input_data->sbrec_mirror_table, input_data->sbrec_mac_binding_table, input_data->sbrec_ha_chassis_group_table, diff --git a/northd/northd.h b/northd/northd.h index 146139beb..987f82954 100644 --- a/northd/northd.h +++ b/northd/northd.h @@ -789,6 +789,9 @@ lr_has_multiple_gw_ports(const struct ovn_datapath *od) return od->n_l3dgw_ports > 1 && !od->is_gw_router; } -uint32_t get_ovn_max_dp_key_local(const struct sbrec_chassis_table *); +bool +is_vxlan_mode(const struct sbrec_chassis_table *sbrec_chassis_table); + +uint32_t get_ovn_max_dp_key_local(bool _vxlan_mode); #endif /* NORTHD_H */ diff --git a/ovn-architecture.7.xml b/ovn-architecture.7.xml index 86874f106..e32d1a9f7 100644 --- a/ovn-architecture.7.xml +++ b/ovn-architecture.7.xml @@ -2809,11 +2809,11 @@

- When VXLAN is enabled on any hypervisor in a cluster, datapath and egress - port identifier ranges are reduced to 12-bits. This is done because only - STT and Geneve provide the large space for metadata (over 32 bits per - packet). To accommodate for VXLAN, 24 bits available are split as - follows: + When VXLAN is enabled on any hypervisor in a cluster, datapath and egress + port identifier ranges are reduced to 12-bits. This is done because only + STT and Geneve provide the large space for metadata (over 32 bits per + packet). The mode with reduced ranges is called VXLAN mode. + To accommodate for VXLAN, 24 bits available are split as follows:

    From patchwork Fri Jun 7 13:54:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1945101 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=YAKddy+g; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4VwjNt1lb7z20PW for ; Fri, 7 Jun 2024 23:54:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id ADBA641A76; Fri, 7 Jun 2024 13:54:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qVH8bjCu_F80; Fri, 7 Jun 2024 13:54:18 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5047741A69 Authentication-Results: smtp2.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=YAKddy+g Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 5047741A69; Fri, 7 Jun 2024 13:54:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 385B9C0014; Fri, 7 Jun 2024 13:54:18 +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 C6230C0011 for ; Fri, 7 Jun 2024 13:54:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A710861548 for ; Fri, 7 Jun 2024 13:54:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wjTbEI92CKV9 for ; Fri, 7 Jun 2024 13:54:13 +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 smtp3.osuosl.org 39C9A6153F Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 39C9A6153F Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=YAKddy+g Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by smtp3.osuosl.org (Postfix) with ESMTPS id 39C9A6153F for ; Fri, 7 Jun 2024 13:54:13 +0000 (UTC) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-52b7e693b8aso3075809e87.1 for ; Fri, 07 Jun 2024 06:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717768451; x=1718373251; 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=VDwR/rP0YbTHca72mk/UPrELOT8pyoBA8fPLkq7nwUE=; b=YAKddy+gNoz1olNx9l/TM0dVnXa9fORkOdWbNnagNUVdlUAHmA7oFgKHdHjkYBXXYq wjbe6yVqQQ/wRQehZKb2yycRbbwbgjIi+fnrNpFa0cd/VJK6/bC/As7LIR57Lj0SElHL LAr3XYDG1gEhlrnfxXQaL63347eZrJgB4fErdKhDsNeJYTMDCM10x8S5elQCOmttCBXE 5OxYBgNXKs1BZEoF9dkZEDIX37DBWqeIY5Ygx1c3ga1KQOLwzqd2zwlcaxTFG8HvR3VJ 6xbBMLuj+95N/hY4d0oS+Kb8DGHnhfIQARS3WSJ03+YuL1+R9Z99tBWczk5Vkm0xyX0w W7/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717768451; x=1718373251; 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=VDwR/rP0YbTHca72mk/UPrELOT8pyoBA8fPLkq7nwUE=; b=m+akOERFAVw5+92jZETviM+okakv7YFsASRuCVDhe9v6qDM4MPA/zF/71yAUjYPooG mKCyEvzMb57jTaOkACqSKy5bho0TYPjszCzyrYrY8aw0Bmw1fFubKP6rMjqc6ALL8scl g6xVFnAOMh3VLefMyDwI7RRO3o2c3sCJjWw9DCbJnCtbd2LG+4nW5epBbZ8euSHiFka/ ns/aEc4ACcDrFmaebx2YyHMgSCC+iHua7JaLYU1hMGQDJH5wvKFaCuNgRCyKJTxKic1J rrlXw+804CAwURGG6bbbxiXa9F+d8rr0f3ZvLzvT8yRKGc6FAkInEaunfkRaTH1TZlia h5kA== X-Gm-Message-State: AOJu0Yw329yXTNnS0IjSZUhfll+OaAMn+c3M/Bfgd2xiqtaKfj567D1/ U9tyZdlFkblKRTrgbXO9J6xJLd4XO/mz0He4dNHy3lc5wqU+MSmUaf5+Tw== X-Google-Smtp-Source: AGHT+IHopFt4I0ZBX8AbmwOA4411IqzxiJU5B98DzMvISTCgvmtmJk3YVr5GRPGD93PGIeHkbJi20g== X-Received: by 2002:a05:6512:3196:b0:52b:8a10:9b75 with SMTP id 2adb3069b0e04-52bb21863c9mr2221406e87.10.1717768450569; Fri, 07 Jun 2024 06:54:10 -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 2adb3069b0e04-52bb421671bsm536610e87.134.2024.06.07.06.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 06:54:09 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Fri, 7 Jun 2024 16:54:03 +0300 Message-ID: <20240607135404.758245-3-odivlad@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240607135404.758245-1-odivlad@gmail.com> References: <20240607135404.758245-1-odivlad@gmail.com> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v6 2/2] northd: Add support for disabling vxlan mode. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladislav Odintsov 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 Acked-by: Ales Musil --- NEWS | 4 ++++ northd/en-global-config.c | 8 +++++++- 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, 66 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 3bdc55172..aa1669d9c 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,10 @@ Post v24.03.0 has been renamed to "options:ic-route-denylist" in order to comply with inclusive language guidelines. The previous name is still recognized to aid with backwards compatibility. + - Added new global config option NB_Global:options:vxlan_mode to support + ability to disable "VXLAN mode" to extend available tunnel IDs space for + datapaths from 4095 to 16711680. 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 df0f8e58c..784538a14 100644 --- a/northd/en-global-config.c +++ b/northd/en-global-config.c @@ -117,7 +117,8 @@ en_global_config_run(struct engine_node *node , void *data) char *max_tunid = xasprintf("%d", get_ovn_max_dp_key_local( - is_vxlan_mode(sbrec_chassis_table))); + is_vxlan_mode(&nb->options, + sbrec_chassis_table))); smap_replace(options, "max_tunid", max_tunid); free(max_tunid); @@ -534,6 +535,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, + "vxlan_mode", false)) { + return true; + } + return false; } diff --git a/northd/northd.c b/northd/northd.c index 6d118a19a..a4937b472 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -886,8 +886,13 @@ join_datapaths(const struct nbrec_logical_switch_table *nbrec_ls_table, } bool -is_vxlan_mode(const struct sbrec_chassis_table *sbrec_chassis_table) +is_vxlan_mode(const struct smap *nb_options, + const struct sbrec_chassis_table *sbrec_chassis_table) { + if (!smap_get_bool(nb_options, "vxlan_mode", true)) { + return false; + } + const struct sbrec_chassis *chassis; SBREC_CHASSIS_TABLE_FOR_EACH (chassis, sbrec_chassis_table) { for (int i = 0; i < chassis->n_encaps; i++) { @@ -17605,7 +17610,8 @@ ovnnb_db_run(struct northd_input *input_data, use_common_zone = smap_get_bool(input_data->nb_options, "use_common_zone", false); - vxlan_mode = is_vxlan_mode(input_data->sbrec_chassis_table); + vxlan_mode = is_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 987f82954..2f2fdb673 100644 --- a/northd/northd.h +++ b/northd/northd.h @@ -790,7 +790,8 @@ lr_has_multiple_gw_ports(const struct ovn_datapath *od) } bool -is_vxlan_mode(const struct sbrec_chassis_table *sbrec_chassis_table); +is_vxlan_mode(const struct smap *nb_options, + const struct sbrec_chassis_table *sbrec_chassis_table); uint32_t get_ovn_max_dp_key_local(bool _vxlan_mode); diff --git a/ovn-architecture.7.xml b/ovn-architecture.7.xml index e32d1a9f7..640944faf 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 vxlan_mode for more details. +

    diff --git a/ovn-nb.xml b/ovn-nb.xml index 83f3d5f83..abc96502c 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 8a1db5fc0..2f9fe693b 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:vxlan_mode=false + +check_row_count nb:Logical_Switch 4097 +wait_row_count sb:Datapath_Binding 4097 + AT_CLEANUP ])