From patchwork Wed Sep 22 15:26:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: patchwork-bot+netdevbpf--- via dev X-Patchwork-Id: 1531292 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=VDt5pDkr; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4HF2GD10nnz9sVq for ; Thu, 23 Sep 2021 01:27:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8C058414B3; Wed, 22 Sep 2021 15:26:57 +0000 (UTC) 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 SgH6GJCVvBoe; Wed, 22 Sep 2021 15:26:56 +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 7A719407A4; Wed, 22 Sep 2021 15:26:55 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 60A8AC000F; Wed, 22 Sep 2021 15:26:55 +0000 (UTC) X-Original-To: ovs-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 2A6C5C000D for ; Wed, 22 Sep 2021 15:26:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0BD6D401E9 for ; Wed, 22 Sep 2021 15:26:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=nvidia.com 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 qDIVaAaWLXGZ for ; Wed, 22 Sep 2021 15:26:52 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061c.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::61c]) by smtp2.osuosl.org (Postfix) with ESMTPS id 698954011D for ; Wed, 22 Sep 2021 15:26:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JzvCxiSl1lXGf/EDWSrEpd2M5Pxdv2Y04xMnodOuNAgQnej3dIN9WUf6tfJzxAYJryOUbW6epfEYB6IpRA2X18rLN89YDBj1SJb9YgGUmftbhwxJlYIJHtZvudCH/xyvwABA+4P10SaQtLhsE+VkgjgeGGZ6LZBFiN40vV3tQn51QcX/vWAn68fSAt2u62D8ERByrVTvLTJo62CwctSUTf5xiC0Fj8B8ISZGRwaI9jn3KoyGTwFsfwI6w3RfC6tPVurDOl7FogICLZiMJrIxZWyRMonty7g/Gf0lkKbAosARO1Z1gjsm9Zp/buTKxjJcohzYg6ZjvIMYwbb7eJf6sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=8is2vVxLDw/AlEOOuFS6+jcv//Zz+hKzDE3zAWZEBFc=; b=TCfAphMvgH1jBz2y8LCRW2XPkvXiToUjs/x0VsUH0TVLeNf6gCs0YU6DeiX1JIbVJUOaLRn5hx+rxmfAD7UcPPXujr+Y9iw/C+kpSYztkYC8+Hm0Ju+e50OE2X7NL6v/XiMrweql2uhGqoOTHWLMUecz3ON3qrh5pTlEbDU+IhugGKBQJLli/Nv1JjpEvK2MgNH3VgxHAAyP8Q6nbxDv4S6IBsKrweFgBJUlaR5YZwZfsxIumDmU+jv8MF1Oftagyz2zk3PQ+g4PCq1Fj+SPcN0c3H3uJkppd2etDbVVlCvpD7v/SuS0lhReQJ2bTAqE42eqkxGb4CLWWu0upqWyFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=ovn.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8is2vVxLDw/AlEOOuFS6+jcv//Zz+hKzDE3zAWZEBFc=; b=VDt5pDkrvycww8j+IaPFIYV6MpS6+yM9h58ym+xArNfSvNXamaDkSZvbA5yIuzrmv+rRLbyiU0Som/38cuW2U9Dn/cIA6F84FmwgzVKFPcp/uFpuP0yBMjOfEqxOaFk670sCd4JUM6EO5kqCRpm6e4wqppFClBjVmMIo23S2wRee11ySp59CRpY6ZgsappexdwprcLROX/0OJfqYIBSepE3IPP/Jqtz0cJhR2iKttDFml4nwLYaZ1+4v6I/oWDTffSyjUfeIFSt9yo/WdtbXMklX7tYs6vsV+PECXXClnriX+tqN0+YCdYKzxYvfL1tM1chSJUtwzBet01viLJlrJw== Received: from BN6PR13CA0017.namprd13.prod.outlook.com (2603:10b6:404:10a::27) by DM6PR12MB5518.namprd12.prod.outlook.com (2603:10b6:5:1b9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Wed, 22 Sep 2021 15:26:49 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:404:10a:cafe::b) by BN6PR13CA0017.outlook.office365.com (2603:10b6:404:10a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.7 via Frontend Transport; Wed, 22 Sep 2021 15:26:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; ovn.org; dkim=none (message not signed) header.d=none;ovn.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 15:26:49 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 22 Sep 2021 15:26:48 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 22 Sep 2021 15:26:48 +0000 Received: from nviyer-1.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 22 Sep 2021 15:26:48 +0000 To: Date: Wed, 22 Sep 2021 08:26:42 -0700 Message-ID: <20210922152642.1435-1-venugopali@nvidia.com> X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a884e82b-910f-489e-4b3a-08d97ddd65af X-MS-TrafficTypeDiagnostic: DM6PR12MB5518: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1060; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pTil2y4ntqg48RAVchCUXM9VWi+GkDu3xO4vg1YPpgK3p1F+eOOkjMYP9JpltI9QiUdiq2p/wfpFNB8xeUyutMhliqVUIqN4KarrDn4F8KN7CkfzVyP47c2LBdnobgXPoMBQJAYDSwZhrfcb/OejDGkbA0/zhVR966bXtCSetkcqxQVq5VH4sSn/DX9P8/D3b1PcaurDJjLEqKxgRFriDKxf/lZgioqT50+SbV0laX1FpKQeTKiF0EsxR0MUib4BYhTASeGqQ00SOhhSLxpG9CFE5h4CtKvzHqrrwowYLZX93rJju5ruQKjjtQ3grXowX1zV0GW7ZDssY8FW0qHS+4fhn/12BngwTO1BSAN1dd5wvgEk282KkRDlDeIYAEifNsRmiFeE3LQb/l5RmqCKCcRmFwbgl1qf2EA+Ft7JyrrCjsU8ukWk9z1YiEHr3bCH1iDqRzlJKCkEUcgOjduHvaAAMhj68vg1m4gru+cnqXw8pPpLmV3WLG+Bx0zbwDrqFLU5ixDeHn/3t8hPgN5NXmcH2UGnW5Z3iFseUPpRkkTSTb16N4OqmvyNJyHsEYO33o0KtDkYmreLNfiyzfY+MnniulApZYdBJmktCD0XpUZ89jtZF9A4ip5pwOIynWYRiAGIIDxQTFyeDD2sOPv0XsUvbMlxVB1Sj6fktUnTfbrqfPpU4JpONn8nZ/QONjPMG1Mm92rFSj4Jud9FhM+nuw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(356005)(4326008)(7636003)(336012)(2876002)(508600001)(426003)(2906002)(107886003)(7696005)(186003)(2616005)(26005)(70206006)(316002)(5660300002)(86362001)(70586007)(54906003)(6666004)(36756003)(47076005)(83380400001)(8936002)(36906005)(1076003)(82310400003)(8676002)(6916009)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 15:26:49.4358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a884e82b-910f-489e-4b3a-08d97ddd65af X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5518 Cc: ovs-dev@openvswitch.org, Venugopal Iyer Subject: [ovs-dev] [PATCH ovn v2] controller: Allow specifying tos option for tunnel interface 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: , X-Patchwork-Original-From: venugopali--- via dev From: patchwork-bot+netdevbpf--- via dev Reply-To: venugopali@nvidia.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Venugopal Iyer Currently, OVN tunnel interface supports the csum option along with remote_ip and key. There are applications (e.g. RoCE) that rely on setting the DSCP bits and expect it to be moved to the outer/ tunnel header as well. This commit adds an "ovn-encap-tos" external-id that can be used to set the tos option on the OVS tunnel interface, using: ovs-vsctl set Open_vSwitch . external_ids:ovn-encap-tos=inherit Tested by setting the external_id (as above) and checking the geneve interfaces created, e.g: options : {csum="true", key=flow, remote_ip="X.X.X.X", tos=inherit} Also, added a simple test case to make sure the tos option is carried to the tunnel interface when set. Signed-off-by: Venugopal Iyer --- controller/encaps.c | 26 ++++++++++-- controller/encaps.h | 1 + controller/ovn-controller.8.xml | 7 +++ controller/ovn-controller.c | 1 + tests/ovn-controller.at | 75 +++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 4 deletions(-) diff --git a/controller/encaps.c b/controller/encaps.c index fc93bf1ee..0666548f9 100644 --- a/controller/encaps.c +++ b/controller/encaps.c @@ -152,7 +152,8 @@ encaps_tunnel_id_match(const char *tunnel_id, const char *chassis_id, static void tunnel_add(struct tunnel_ctx *tc, const struct sbrec_sb_global *sbg, - const char *new_chassis_id, const struct sbrec_encap *encap) + const char *new_chassis_id, const struct sbrec_encap *encap, + const struct ovsrec_open_vswitch_table *ovs_table) { struct smap options = SMAP_INITIALIZER(&options); smap_add(&options, "remote_ip", encap->ip); @@ -202,6 +203,18 @@ tunnel_add(struct tunnel_ctx *tc, const struct sbrec_sb_global *sbg, smap_add(&options, "remote_name", new_chassis_id); } + const struct ovsrec_open_vswitch *cfg = + ovsrec_open_vswitch_table_first(ovs_table); + /* If the tos option is configured, get it */ + if (cfg) { + const char *encap_tos = smap_get_def(&cfg->external_ids, + "ovn-encap-tos", "none"); + + if (encap_tos && strcmp(encap_tos, "none")) { + smap_add(&options, "tos", encap_tos); + } + } + /* If there's an existing chassis record that does not need any change, * keep it. Otherwise, create a new record (if there was an existing * record, the new record will supplant it and encaps_run() will delete @@ -270,7 +283,10 @@ preferred_encap(const struct sbrec_chassis *chassis_rec) * as there are VTEP of that type (differentiated by remote_ip) on that chassis. */ static int -chassis_tunnel_add(const struct sbrec_chassis *chassis_rec, const struct sbrec_sb_global *sbg, struct tunnel_ctx *tc) +chassis_tunnel_add(const struct sbrec_chassis *chassis_rec, + const struct sbrec_sb_global *sbg, + const struct ovsrec_open_vswitch_table *ovs_table, + struct tunnel_ctx *tc) { struct sbrec_encap *encap = preferred_encap(chassis_rec); int tuncnt = 0; @@ -286,7 +302,8 @@ chassis_tunnel_add(const struct sbrec_chassis *chassis_rec, const struct sbrec_s if (tun_type != pref_type) { continue; } - tunnel_add(tc, sbg, chassis_rec->name, chassis_rec->encaps[i]); + tunnel_add(tc, sbg, chassis_rec->name, chassis_rec->encaps[i], + ovs_table); tuncnt++; } return tuncnt; @@ -321,6 +338,7 @@ encaps_run(struct ovsdb_idl_txn *ovs_idl_txn, const struct sbrec_chassis_table *chassis_table, const struct sbrec_chassis *this_chassis, const struct sbrec_sb_global *sbg, + const struct ovsrec_open_vswitch_table *ovs_table, const struct sset *transport_zones) { if (!ovs_idl_txn || !br_int) { @@ -390,7 +408,7 @@ encaps_run(struct ovsdb_idl_txn *ovs_idl_txn, continue; } - if (chassis_tunnel_add(chassis_rec, sbg, &tc) == 0) { + if (chassis_tunnel_add(chassis_rec, sbg, ovs_table, &tc) == 0) { VLOG_INFO("Creating encap for '%s' failed", chassis_rec->name); continue; } diff --git a/controller/encaps.h b/controller/encaps.h index f488393c4..25d44b034 100644 --- a/controller/encaps.h +++ b/controller/encaps.h @@ -35,6 +35,7 @@ void encaps_run(struct ovsdb_idl_txn *ovs_idl_txn, const struct sbrec_chassis_table *, const struct sbrec_chassis *, const struct sbrec_sb_global *, + const struct ovsrec_open_vswitch_table *, const struct sset *transport_zones); bool encaps_cleanup(struct ovsdb_idl_txn *ovs_idl_txn, diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml index 8c180f576..37c7efb5b 100644 --- a/controller/ovn-controller.8.xml +++ b/controller/ovn-controller.8.xml @@ -201,6 +201,13 @@ performance loss. In such cases, encapsulation checksums can be disabled. +
external_ids:ovn-encap-tos
+
+ ovn-encap-tos indicates the value to be applied to OVN + tunnel interface's option:tos as specified in the Open_vSwitch database + Interface table. Please refer to Open VSwitch Manual for details. +
+
external_ids:ovn-cms-options
A list of options that will be consumed by the CMS Plugin and which diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index aa7941eeb..a719beb0e 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -3593,6 +3593,7 @@ main(int argc, char *argv[]) sbrec_chassis_table_get(ovnsb_idl_loop.idl), chassis, sbrec_sb_global_first(ovnsb_idl_loop.idl), + ovs_table, &transport_zones); stopwatch_start(CONTROLLER_LOOP_STOPWATCH_NAME, diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at index 4ae218ed6..a1169c569 100644 --- a/tests/ovn-controller.at +++ b/tests/ovn-controller.at @@ -723,3 +723,78 @@ AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep controller | grep userdata=0 OVN_CLEANUP([hv1]) AT_CLEANUP ]) + +# Checks that ovn-controller honors the change to tunnel interface if we +# set ovn-encap-tos option +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-controller - change Encap ToS option]) +AT_KEYWORDS([ovn]) +ovn_start + +net_add n1 +sim_add hv +as hv +ovs-vsctl \ + -- add-br br-phys \ + -- add-br br-eth0 \ + -- add-br br-eth1 \ + -- add-br br-eth2 +ovn_attach n1 br-phys 192.168.0.1 + +check_tunnel_property () { + test "`ovs-vsctl get interface ovn-fakech-0 $1`" = "$2" +} + +# without any tos options +no_tos_options="{csum=\"true\", key=flow, remote_ip=\"192.168.0.2\"}" + +# +# Start off with a remote chassis supporting geneve +ovn-sbctl chassis-add fakechassis geneve 192.168.0.2 +OVS_WAIT_UNTIL([check_tunnel_property type geneve]) + +tos_option=$(ovs-vsctl get interface ovn-fakech-0 options) +AT_CHECK([test "$tos_option" = "$no_tos_options"], [0], []) + +expected_tos_option="inherit" +as hv +ovs-vsctl \ + -- set Open_vSwitch . external-ids:ovn-encap-tos="$expected_tos_option" + +# now, wait for a sec +sleep 1 + +tos_option=$(ovs-vsctl get interface ovn-fakech-0 options:tos) +AT_CHECK([test "$tos_option" = "$expected_tos_option"], [0], []) + +# Try another value +expected_tos_option="61" +as hv +ovs-vsctl \ + -- set Open_vSwitch . external-ids:ovn-encap-tos="$expected_tos_option" + +# now, wait for a sec +sleep 1 + +tos_option=$(ovs-vsctl get interface ovn-fakech-0 options:tos) +AT_CHECK([test "$tos_option" = "\"$expected_tos_option\""], [0], []) + +# Remove tos option and check if we are back to the original state +as hv +ovs-vsctl \ + -- remove Open_vSwitch . external-ids column ovn-encap-tos + +# now, wait for a sec +sleep 1 + +tos_option=$(ovs-vsctl get interface ovn-fakech-0 options) +AT_CHECK([test "$tos_option" = "$no_tos_options"], [0], []) + +# Gracefully terminate daemons +OVN_CLEANUP_SBOX([hv]) +OVN_CLEANUP_VSWITCH([main]) +as ovn-sb +OVS_APP_EXIT_AND_WAIT([ovsdb-server]) + +AT_CLEANUP +])