From patchwork Tue Sep 21 16:24:15 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: 1530807 X-Patchwork-Delegate: zhouhan@gmail.com 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=ZHWaMq39; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4HDS1v25rNz9sf8 for ; Wed, 22 Sep 2021 02:44:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6B4EA40698; Tue, 21 Sep 2021 16:44:17 +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 s9K355xvzinr; Tue, 21 Sep 2021 16:44:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 812C14063C; Tue, 21 Sep 2021 16:44:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 54335C0011; Tue, 21 Sep 2021 16:44:15 +0000 (UTC) X-Original-To: ovs-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 1A224C000D for ; Tue, 21 Sep 2021 16:24:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E5317403B0 for ; Tue, 21 Sep 2021 16:24:22 +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 YGNq_hk4OznI for ; Tue, 21 Sep 2021 16:24:22 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2058.outbound.protection.outlook.com [40.107.237.58]) by smtp4.osuosl.org (Postfix) with ESMTPS id D2EB1403A1 for ; Tue, 21 Sep 2021 16:24:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NmvjnFtgnPv/EtuRyVgl1JXjh84VhG+o/uEJWceKFdhp05Nimdzz3vMh/j/ara5jmpe1UtCWx+q7oX9a2+SneweXF0m9B/8H+Pcf8VQ2KOjMP8N6BAgyzURhZC4YJmogndMh+qJr3v/ar8QJOViNtDBQSpn7DZ9XqHsNu3PcHt3ZSxzmUws812wBBrT+Ki1mPJE8AwI1xJ54D5t8lpEELdpsbdHTeKvUq8MfP3Htjbe/GGZRhoD+Rhh09RIYbYJr4h2HkZrdldEQPCWg1zKZRD8x82YBJh+ATcZnN0k5FVDbMGfqJNg7WHCINdyh0xY86xUI+KbCEWuwgHCDl18lMw== 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=wznpbVwYtUl83j/oZ8ccOk/MV45CDr3FuYaiRrsBY6E=; b=lcpNZFcoWE8S/NPpBRwpZJmxZf/iHJqQaf0mwhtxjQYf9or+7puqGHc99WlHQN+ogKW8ltKyDpKQUU4xBRmgvA+A9yXNY4vf07CRGVRC++o5RcwCFSMHofdPlojwwFlKglh9Gjds2N18rnGUr2f1ylhXi3GzpuGoJfDn73Pfp+yoW6p4Ff147JjR9DbSd2t9vtV4YbRzSSUpIlcL1u+5iBOEsPT28LSOGZW8yLjzEcfYHbCSrvG0JG81wSfkeTG6616Iq/4ZkXQgELff1V45ah6Euaf7E6vKF1J0p0Tal6vvb0I6wYXAgvcOBHxi1BgNv17IiilOgUrNEYuwgCRVLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=openvswitch.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=wznpbVwYtUl83j/oZ8ccOk/MV45CDr3FuYaiRrsBY6E=; b=ZHWaMq3967OsRVR067LxfiENZMWg/W6J/znNhVEYU9dgq3RnAq2KlY0AMUoYrjmABXOB48S7tOK+BlnpOsfW56KE682HRxfy1QbXbJiG43wCGRSQLRH+/+eJHAIJLQCcxCbkyyHKfPXE9bhxbxfjj5hk4Ww7cZ6u5aAONVz28r2GPVZyXHbve0UluavH4JVPQe0RD4HXVlbvSKZq4at6CCpYcY0UBye4c3a5psZuat55xd4+7PEvzwOYvlzlczZTo3p5la8L1AfjhIPvRmzZhebuhqw/7O9rVceFjOWzHCUNx2Dh7ARKJobjdYB+09SjgelIUWwVi/7LrNLVyRbf2Q== Received: from BN9PR03CA0950.namprd03.prod.outlook.com (2603:10b6:408:108::25) by BYAPR12MB4741.namprd12.prod.outlook.com (2603:10b6:a03:a2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Tue, 21 Sep 2021 16:24:17 +0000 Received: from BN8NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:408:108:cafe::fb) by BN9PR03CA0950.outlook.office365.com (2603:10b6:408:108::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Tue, 21 Sep 2021 16:24:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; openvswitch.org; dkim=none (message not signed) header.d=none; openvswitch.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT038.mail.protection.outlook.com (10.13.176.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4523.14 via Frontend Transport; Tue, 21 Sep 2021 16:24:16 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Sep 2021 09:24:15 -0700 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Sep 2021 16:24:15 +0000 Received: from nviyer-1.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 21 Sep 2021 16:24:15 +0000 To: Date: Tue, 21 Sep 2021 09:24:15 -0700 Message-ID: <20210921162415.3478-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: ee40f555-4301-495b-f29a-08d97d1c41f1 X-MS-TrafficTypeDiagnostic: BYAPR12MB4741: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fky3ootywBujYZz9eGtqiZmpAgaz0oT9l1JeRMBbS3njdgKCTGzONUpQVbAOBY0F2WUOhMUxju/WguWcQMvoPVY5rrHFqiodZJBdZB1oNWWQ7HB4dOOvIwrmgGDyy3Z8Wr5m2pLbt9Ci8x1yLGxdexsVGYM6nfdeiwGahiTCZaMHlWIaNx7CqXYV3wKlX+U9gIvxuWpJJJkPb0aE+mHOX2JNDoQrDLna+FwL/0+57gx+Qam7nQdEW/1vA7TNkDYkLqNXjT4EagxzJ1a+nfGFNhRr1C98I0CR48xWoLWidpx65uFgqLXM1hBSbxhfvd/jV7ON/7mSfKzo+NA6awriNqSgOy7r34iDKSz4So7gQ//P8AIi+1wD2zm6ZNYSpkMCQvyeCjuFUsa/M8b3eMsnsRk9IvmTrOi6A4gCz1eNHtr7oCRSRoan7HpJTihhwDYxvYUnl/8Gor0VJennh9mFnkCeyhUShh4xokT4BS4/fBgML5KmhtizxLpZsmhNUxpCUNQz/9ovIjiyRJdwKStyG/fiqCptjyzuR2IDcxtBqI6HoHlMYzxad2U2q+tk+CAlOt3uFugc4z1sJ+siAvwymXLUGbydn08aTWAmEYKZlh180w42aD0ewRkeFGOIGOZc+fJPAUoaI/cBHFHGPoQI5lbRy7kjKje+XFIhL0FTSzFTUgZBtARmeYLBd4u62FhnGiLrBMi9gjeDsPr+fIvTlg== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(2616005)(36860700001)(2876002)(6916009)(70586007)(86362001)(508600001)(4326008)(8936002)(8676002)(70206006)(1076003)(356005)(47076005)(2906002)(5660300002)(82310400003)(7696005)(36756003)(186003)(316002)(7636003)(336012)(26005)(426003)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 16:24:16.6690 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee40f555-4301-495b-f29a-08d97d1c41f1 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.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB4741 X-Mailman-Approved-At: Tue, 21 Sep 2021 16:44:14 +0000 Subject: [ovs-dev] [PATCH ovn] ovn-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: venu iyer (venugopali@nvidia.com) --- controller/encaps.c | 25 ++++++++++++++---- controller/encaps.h | 1 + controller/ovn-controller.8.xml | 7 +++++ controller/ovn-controller.c | 1 + tests/ovn-controller.at | 45 +++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 5 deletions(-) diff --git a/controller/encaps.c b/controller/encaps.c index fc93bf1ee..da24448f5 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,8 @@ 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 +300,7 @@ 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; @@ -316,11 +330,12 @@ chassis_tzones_overlap(const struct sset *transport_zones, void encaps_run(struct ovsdb_idl_txn *ovs_idl_txn, - const struct ovsrec_bridge_table *bridge_table, + const struct ovsrec_bridge_table *bridge_table, const struct ovsrec_bridge *br_int, 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 +405,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..b419cab05 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 whether the tos (DSCP) needs + to be copied, from the inner to the outer/encap header, on tunnels + created on this chassis. +
+
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..cd1617981 100644 --- a/tests/ovn-controller.at +++ b/tests/ovn-controller.at @@ -723,3 +723,48 @@ 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" +} + +# 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]) + +as hv +ovs-vsctl \ + -- set Open_vSwitch . external-ids:ovn-encap-tos="inherit" + +# now, wait for a couple of secs +sleep 2 + +tos_option=$(ovs-vsctl get interface ovn-fakech-0 options:tos) +expected_tos_option="inherit" +AT_CHECK([test "$tos_option" = "$expected_tos_option"], [0], []) + +# Gracefully terminate daemons +OVN_CLEANUP_SBOX([hv]) +OVN_CLEANUP_VSWITCH([main]) +as ovn-sb +OVS_APP_EXIT_AND_WAIT([ovsdb-server]) + +AT_CLEANUP +])