From patchwork Tue May 9 05:40:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobuhiro MIKI X-Patchwork-Id: 1778753 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::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=yahoo-corp.jp header.i=@yahoo-corp.jp header.a=rsa-sha256 header.s=selector1 header.b=D/HKY+2K; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4QFn7r1H36z214S for ; Tue, 9 May 2023 15:40:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E1C2984535; Tue, 9 May 2023 05:40:53 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E1C2984535 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=yahoo-corp.jp header.i=@yahoo-corp.jp header.a=rsa-sha256 header.s=selector1 header.b=D/HKY+2K 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 SRLygq9GUz3z; Tue, 9 May 2023 05:40:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id ABE178457C; Tue, 9 May 2023 05:40:47 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org ABE178457C Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E74D9C0092; Tue, 9 May 2023 05:40:44 +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 BD0B6C002A for ; Tue, 9 May 2023 05:40:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 98142844E8 for ; Tue, 9 May 2023 05:40:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 98142844E8 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 upBeO7hNJ1DO for ; Tue, 9 May 2023 05:40:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 26150844E1 Received: from corp-ob09.yahoo-corp.jp (corp-ob09.yahoo-corp.jp [182.22.125.216]) by smtp1.osuosl.org (Postfix) with ESMTPS id 26150844E1 for ; Tue, 9 May 2023 05:40:41 +0000 (UTC) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01lp2109.outbound.protection.outlook.com [104.47.23.109]) by corp-ob09.yahoo-corp.jp (Postfix) with ESMTPS id E4B6B19FB182 for ; Tue, 9 May 2023 14:40:38 +0900 (JST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BqQPLOhEWaF6CZOL8i3qabl4/NeccYMd+FEFXtpSv2/5SrrwYOj7ztRz47N5Y4kWsHZ6v8wB2TcBOd48UQ24UvbH9KA6a/Mjc5O6CyzH1zNVu8oMrPhjYgyqKOU35VT7V2lu1vA+z90kkwgfuNPX/QNuqy1JNL5raePfGZVKAM5jBdJoWfMc1AKy0KNKuIuyStE72xgvrEeKlphH9Wqks+xCGKeAWZE44SevVTWhxsGvkCcjbBhsehCaraNWIpA+eRrWnjdDtZUR6UD1yp1m/HgMrkBm05xydS92+blam64L8mZie83e9wdOzQXRmh+FA+KF4wWfxQmzvixynE2l/Q== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XYYt6LXcSZnRB967fwAJAw0en8TqJirzkzs4IxHpawY=; b=haIj/Bf5TYLaeQxzmzx5LUT/hAzBiZ+sUT3/ZgRc9uzc0eE4Uw43I4Wta+ZuOgaeOObSBKEC6K/2j7PMPlZCIqagKIi6Whpz3tu3KuJlKdrnb2VfVOj4F+uA/7Jr+l4gA45yAh5mWbTLcJA7L+IcAYcfLBNcEHH3A/5SXlDPsNnTlUh/vFOE8ucFkRZTB09Wvd4w3bDWqRB/NghnVyhpAn1lYidAR670oXC2mXXbvTWSJ3ndGSrSkOv7WhjTYXS2M4t4X0olTT8BSLWIqXMWSRq+RdHJLl2olHjYRBI0DSQAMSA6K3SII0dhtpL8TIYWq/pRSgTwdFg+3arG9pAi4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=yahoo-corp.jp; dmarc=pass action=none header.from=yahoo-corp.jp; dkim=pass header.d=yahoo-corp.jp; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo-corp.jp; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XYYt6LXcSZnRB967fwAJAw0en8TqJirzkzs4IxHpawY=; b=D/HKY+2KDuXyfI+3VJuL50/nvAm5ZjVcleejSwzYrx+eegjjGAtLy5qlit8wPGTLXLtsgFSz1icd9g2xCUyBY0khUo4akO+GlhLSn1o9Bf25dHj2bbA5ZuLxFyJokhGMIWLd8pTadJF06ps4CgfsEU58eFtDJZLGlCFG0LDbgLc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=yahoo-corp.jp; Received: from TY2PR01MB4107.jpnprd01.prod.outlook.com (2603:1096:404:d8::23) by TYWPR01MB9922.jpnprd01.prod.outlook.com (2603:1096:400:230::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Tue, 9 May 2023 05:40:37 +0000 Received: from TY2PR01MB4107.jpnprd01.prod.outlook.com ([fe80::316c:fe30:7d04:4f2b]) by TY2PR01MB4107.jpnprd01.prod.outlook.com ([fe80::316c:fe30:7d04:4f2b%5]) with mapi id 15.20.6363.033; Tue, 9 May 2023 05:40:37 +0000 From: Nobuhiro MIKI To: dev@openvswitch.org Date: Tue, 9 May 2023 14:40:10 +0900 Message-Id: <20230509054010.32003-3-nmiki@yahoo-corp.jp> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230509054010.32003-1-nmiki@yahoo-corp.jp> References: <20230509054010.32003-1-nmiki@yahoo-corp.jp> X-ClientProxiedBy: PN3PR01CA0128.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:bf::13) To TY2PR01MB4107.jpnprd01.prod.outlook.com (2603:1096:404:d8::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY2PR01MB4107:EE_|TYWPR01MB9922:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d50ca94-88bf-43d1-d436-08db504feac0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3qWqlkhZK55ZY6oxBuf6kGf9wZ39qeNc3LySsuT53RrcxnOSDOA6cBN/NGcwBHPeNCxU4YQs+23zW7Yk7ggZWe6RS/6IcsLnZs3O1s3ggtSp3YrePp85SuPL0RN1wcM51afbHHuFFm4MV3awl0wsDMrcEd7m1unmVEP1GDSmpKvMir3QtLeEjAKZ0wxPH+004I7EOc2RjqRJp1w20PppKOtNc2YtfIrIRMZqZjmiPl2P3SeEO3ISWSK/wSXd/OPRC8H6dWFDWbTSEr/LVQqhZZgZjXqTfmHDvIWld36BX6tv2S4Ec4xTApuD6pHu+o0/0mMP8SBMDPLLOk8OQO8yKG+zlMHrCb3F4zJyvGaoiWhMeNRj1MslaeaB+0jyRq4fd+LFU/T63m9iN+fzZjyiheWlUPK2dQI8GuN38I2LSunQWdyY9iDh7MXQFIxXm4Lf58x5RsB5PBN/MApOHbEBFaXNNhY3OGFaKdAIpVJUajHj/6okUzOYCaW7Nvcdkq+Yia6Kt2Z9wGXSm7hikeJbySq9ZJr8l75b+oXUhuYNeq9kGeSJyNTyKiq1Y+mJdbLcPosiaYHO44VPtkDBQGvGFUtphSaMq3yGCO0Zq+92TnTc7r8eymwolLJGZmAVj+4y X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TY2PR01MB4107.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(39860400002)(376002)(396003)(366004)(451199021)(36756003)(82960400001)(38100700002)(38350700002)(86362001)(8936002)(52116002)(6486002)(6666004)(4326008)(66946007)(107886003)(966005)(5660300002)(30864003)(1076003)(6506007)(2906002)(186003)(6512007)(26005)(2616005)(83380400001)(66556008)(478600001)(6916009)(41300700001)(66476007)(8676002)(316002)(461764006); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nDc3ORE87cJmjQk2xXNr8Qy0DTmv0xBlky4tM5mnb+gd2Zi84exIbMg4RxcvULUffu+xUyEmw788jywh+H955AXV40NkcX+As+Aop/Q/tFpJXLqZd+A6U1RYsxNSMt6rS+TcJRS2wUiWNabiNtMzX1LKtOqcXrPszTEt/xWbtyfDvlXM+2XvzWKirwHKHUNAdymXrax4Dtzk41PX5p4XRp1LHdnyHYo1BbAwPH/o5xKVpJT87vHCZ7EclvAYuJahYEZqS234gZGF23Zpb7oQLpofUBj6Wd1tsNMsYavIcK5FxJh+TtQMo3Ho2FrFBZCMpJZbvJh3pv+WBl5dQbzW5W1VIqwvRYJ3Vak64L+kjPUjoFOz+EdhZt487OMSaSQMvQ14ADZyfuXZlLF9VlLzxCmaWiOSAxV5rb3j2mks8QlpACa5kQO4NXd5t1RnCaffdXdHfMRGb8y8I/3m1GaSJaNCbdkMI9+tUsOCUqcK152nGPNnAL2G+ezCwXx7R5xbADccYU0w0r+a8w3OigU81ROrEwPBsgnms1+uDCO1TsiLs0auDx8Rtb+oSknSiya9o3V3Fm2Ma8rYBNSWcENLn6/wq43Uk9howXvCyV+tX5U1MIlAJ6OsYsfM8sbNHOCRRXFQKnjN7++h9HWzACV2nitm8a+RSX/UiRrd9vQFFi9oiKKsPfcngvC9MFrp18Qiy3BpVYgeNydM5r3r7kYeSL1/rkT0yblbz+OJa3SMSAKv8wpPBkT8z4YxhHLVhdn254OeCA2IECiOAkQ6MEtLmColRb7A1WR7fBtOti0uQ2v06G2VAYGpIeKHU8djbr9cxhhe765fBQgXcRRX/9aLzSb52kheoepqe+2pjMK/MtG8NWF8m1godWtcetpdp2Rb6kq2KdEjxpuSEO2uwshyN3wK9kgi0ZtDzxoVO+V56PxSF6K29Pk1GNsNXGV3k2FoDKEMo7xzZRv64a7Rk/DT54yG6g6C2jTee+0xAqbkGiACPAYXKJq2nLQsBTtuczBh4jIIPXA9IX+3vsaiLHfRgAOzp6O4ucJCxhaIh0uZlABLq3bZKL9lIIElBRUJkB4SHwianFg65pnI41wuj2LJRpfunDhYIOvy8OsSta/PiamWFL3aeJnk4uj/mEFfaX95RPjlZdHpyx7ROo+NYC3F6fpys1CiBJ61McQv959dR2K3Lrk6BpeD8ywmLU60S40reUAyltRkV8OHLH5S+th1fT6cS8QvoD6gNQ05yBvdS4z7/fazRZqXgwl1ufv83kJCvZvhkwLHcmKuGvCT0NJcdLQOIfBzBfrJrDVIhdiku0CBwcOJ/TVr4TJ99FCAW2Tqz1bJO3xZ+vimODjJE4syil84x+7grmaL80g5VgV1DPOirT22CJoS72HmVhSgop+KVgyEYbG0qme34h+/6P37dC9OKHltXnYHShFeiXAlkbVp7G1LWqkQU2LzrDq5npRUpx7xcYxrgey1z2pzoE3bt/nLI2IdLDIUoUg3BzVakPdAkWSu+ZZB7Bm6G1xsqXDy5Wmb9xdSm0Litjf+3su8iXkDOVuhZan+qcxQRULIgO752Tk/4ZzJp5VssEr1Efs2 X-OriginatorOrg: yahoo-corp.jp X-MS-Exchange-CrossTenant-Network-Message-Id: 9d50ca94-88bf-43d1-d436-08db504feac0 X-MS-Exchange-CrossTenant-AuthSource: TY2PR01MB4107.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2023 05:40:37.7190 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a208d369-cd4e-4f87-b119-98eaf31df2c3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q0TNNSYr1GcvTSBGvlFD1oXyan7GX80Ck5HiNhBlJ+YFosK4I+COKOyeQLJNJDphHmfTe6Ok7nvkjfJbWt5rlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB9922 Subject: [ovs-dev] [PATCH v2 2/2] userspace: Add new option srv6_flowlabel in SRv6 tunnel. 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 supports flowlabel based load balancing by controlling the flowlabel of outer IPv6 header, which is already implemented in Linux kernel as seg6_flowlabel sysctl [1]. [1]: https://docs.kernel.org/networking/seg6-sysctl.html Signed-off-by: Nobuhiro MIKI --- lib/flow.c | 24 +++++++++++ lib/flow.h | 1 + lib/netdev-native-tnl.c | 22 +++++++++- lib/netdev-vport.c | 8 ++++ lib/netdev.h | 12 ++++++ tests/tunnel-push-pop-ipv6.at | 79 +++++++++++++++++++++++++++++++++++ vswitchd/vswitch.xml | 29 +++++++++++++ 7 files changed, 174 insertions(+), 1 deletion(-) diff --git a/lib/flow.c b/lib/flow.c index 9501a259e9d4..808fe6104e46 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -2734,6 +2734,30 @@ flow_hash_in_wildcards(const struct flow *flow, return hash_finish(hash, 8 * FLOW_U64S); } +uint32_t +flow_hash_srv6_flowlabel(const struct flow *flow, uint32_t basis) +{ + uint32_t hash = basis; + + if (flow->dl_type == htons(ETH_TYPE_IPV6)) { + const uint64_t *flow_u64 = (const uint64_t *) flow; + int ofs = offsetof(struct flow, ipv6_src) / 8; + int end = ofs + 2 * sizeof flow->ipv6_src / 8; + + for (;ofs < end; ofs++) { + hash = hash_add64(hash, flow_u64[ofs]); + } + + hash = hash_add(hash, flow->nw_proto); + hash = hash_add(hash, flow->ipv6_label); + } else if (flow->dl_type == htons(ETH_TYPE_IP) + || flow->dl_type == htons(ETH_TYPE_ARP)) { + hash = flow_hash_5tuple(flow, basis); + } + + return hash_finish(hash, 42) & IPV6_LABEL_MASK; /* Arbitrary number. */ +} + /* Sets the VLAN VID that 'flow' matches to 'vid', which is interpreted as an * OpenFlow 1.0 "dl_vlan" value: * diff --git a/lib/flow.h b/lib/flow.h index a9d026e1ce3b..7b8ef5164465 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -258,6 +258,7 @@ bool flow_hash_fields_valid(enum nx_hash_fields); uint32_t flow_hash_in_wildcards(const struct flow *, const struct flow_wildcards *, uint32_t basis); +uint32_t flow_hash_srv6_flowlabel(const struct flow *, uint32_t basis); bool flow_equal_except(const struct flow *a, const struct flow *b, const struct flow_wildcards *); diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c index 55e1bd567fa1..18bd9df57175 100644 --- a/lib/netdev-native-tnl.c +++ b/lib/netdev-native-tnl.c @@ -856,6 +856,7 @@ netdev_srv6_build_header(const struct netdev *netdev, struct netdev_tunnel_config *tnl_cfg; const struct in6_addr *segs; struct srv6_base_hdr *srh; + uint32_t ipv6_label = 0; struct in6_addr *s; ovs_be16 dl_type; int err = 0; @@ -882,7 +883,26 @@ netdev_srv6_build_header(const struct netdev *netdev, goto out; } - srh = netdev_tnl_ip_build_header(data, params, IPPROTO_ROUTING, 0); + switch (tnl_cfg->srv6_flowlabel) { + case SRV6_FLOWLABEL_COPY: + ipv6_label = ntohl(params->flow->ipv6_label); + break; + + case SRV6_FLOWLABEL_ZERO: + ipv6_label = 0; + break; + + case SRV6_FLOWLABEL_COMPUTE: + ipv6_label = flow_hash_srv6_flowlabel(params->flow, 0); + break; + + default: + err = EINVAL; + goto out; + } + + srh = netdev_tnl_ip_build_header(data, params, IPPROTO_ROUTING, + ipv6_label); srh->rt_hdr.segments_left = nr_segs - 1; srh->rt_hdr.type = IPV6_SRCRT_TYPE_4; srh->rt_hdr.hdrlen = 2 * nr_segs; diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 663ee8606c3b..2141621cf23e 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -792,6 +792,14 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args, char **errp) name, node->value); break; } + } else if (!strcmp(node->key, "srv6_flowlabel")) { + if (!strcmp(node->value, "zero")) { + tnl_cfg.srv6_flowlabel = SRV6_FLOWLABEL_ZERO; + } else if (!strcmp(node->value, "compute")) { + tnl_cfg.srv6_flowlabel = SRV6_FLOWLABEL_COMPUTE; + } else { + tnl_cfg.srv6_flowlabel = SRV6_FLOWLABEL_COPY; + } } else if (!strcmp(node->key, "payload_type")) { if (!strcmp(node->value, "mpls")) { tnl_cfg.payload_ethertype = htons(ETH_TYPE_MPLS); diff --git a/lib/netdev.h b/lib/netdev.h index ff207f56c28c..743a56ca1629 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -97,6 +97,17 @@ enum netdev_pt_mode { NETDEV_PT_LEGACY_L3, }; +enum netdev_srv6_flowlabel { + /* Copy the flowlabel from inner packet. */ + SRV6_FLOWLABEL_COPY, + + /* Simply set flowlabel to 0. */ + SRV6_FLOWLABEL_ZERO, + + /* Calculate a hash for some fields and set the result to flowlabel. */ + SRV6_FLOWLABEL_COMPUTE, +}; + /* Configuration specific to tunnels. */ struct netdev_tunnel_config { ovs_be64 in_key; @@ -144,6 +155,7 @@ struct netdev_tunnel_config { uint8_t srv6_num_segs; #define SRV6_MAX_SEGS 6 struct in6_addr srv6_segs[SRV6_MAX_SEGS]; + enum netdev_srv6_flowlabel srv6_flowlabel; }; void netdev_run(void); diff --git a/tests/tunnel-push-pop-ipv6.at b/tests/tunnel-push-pop-ipv6.at index e300fe3a0d26..33edc8319eed 100644 --- a/tests/tunnel-push-pop-ipv6.at +++ b/tests/tunnel-push-pop-ipv6.at @@ -1,5 +1,84 @@ AT_BANNER([tunnel_push_pop_ipv6]) +AT_SETUP([tunnel_push_pop_ipv6 - srv6]) + +OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 other-config:hwaddr=aa:55:aa:55:00:00]) +AT_CHECK([ovs-vsctl add-br int-br1 -- set bridge int-br1 datapath_type=dummy], [0]) +AT_CHECK([ovs-vsctl add-br int-br2 -- set bridge int-br2 datapath_type=dummy], [0]) +AT_CHECK([ovs-vsctl add-br int-br3 -- set bridge int-br3 datapath_type=dummy], [0]) +AT_CHECK([ovs-vsctl add-port int-br1 t1 -- set Interface t1 type=srv6 \ + options:remote_ip=2001:cafe::91 ofport_request=2 \ + options:srv6_flowlabel=copy \ + ], [0]) +AT_CHECK([ovs-vsctl add-port int-br2 t2 -- set Interface t2 type=srv6 \ + options:remote_ip=2001:cafe::92 ofport_request=3 \ + options:srv6_flowlabel=zero \ + ], [0]) +AT_CHECK([ovs-vsctl add-port int-br3 t3 -- set Interface t3 type=srv6 \ + options:remote_ip=2001:cafe::93 ofport_request=4 \ + options:srv6_flowlabel=compute \ + ], [0]) + +dnl First setup dummy interface IP address, then add the route +dnl so that tnl-port table can get valid IP address for the device. +AT_CHECK([ovs-appctl netdev-dummy/ip6addr br0 2001:cafe::88/24], [0], [OK +]) +AT_CHECK([ovs-appctl ovs/route/add 2001:cafe::0/24 br0], [0], [OK +]) +AT_CHECK([ovs-appctl tnl/neigh/set br0 2001:cafe::91 aa:55:aa:55:00:01], [0], [OK +]) +AT_CHECK([ovs-appctl tnl/neigh/set br0 2001:cafe::92 aa:55:aa:55:00:02], [0], [OK +]) +AT_CHECK([ovs-appctl tnl/neigh/set br0 2001:cafe::93 aa:55:aa:55:00:03], [0], [OK +]) +AT_CHECK([ovs-ofctl add-flow br0 action=1]) +AT_CHECK([ovs-ofctl add-flow int-br1 action=2]) +AT_CHECK([ovs-ofctl add-flow int-br2 action=3]) +AT_CHECK([ovs-ofctl add-flow int-br3 action=4]) + +dnl Check "srv6_flowlabel=copy". +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x86dd),ipv6(src=2001:beef::1,dst=2001:beef::2,label=12345,proto=47,tclass=0x0,hlimit=64)'], [0], [stdout]) +cat stdout +AT_CHECK([tail -1 stdout | grep -o 'label=[[0-9]]*'], [0], [dnl +label=12345 +]) + +dnl Check "srv6_flowlabel=zero". +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x86dd),ipv6(src=2001:beef::1,dst=2001:beef::2,label=12345,proto=47,tclass=0x0,hlimit=64)'], [0], [stdout]) +AT_CHECK([tail -1 stdout | grep -o 'label=[[0-9]]*'], [0], [dnl +label=0 +]) + +dnl Check "srv6_flowlabel=compute" for IPv4 in IPv6 tunnels. +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(4),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout]) +AT_CHECK([tail -1 stdout | grep -o 'label=[[0-9]]*'], [0], [dnl +label=944785 +]) + +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(4),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=6,tos=0,ttl=64,frag=no),tcp(src=800,dst=900)'], [0], [stdout]) +AT_CHECK([tail -1 stdout | grep -o 'label=[[0-9]]*'], [0], [dnl +label=772289 +]) + +dnl Check "srv6_flowlabel=compute" for IPv6 in IPv6 tunnels. +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(4),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x86dd),ipv6(src=2001:beef::1,dst=2001:beef::2,label=0,proto=47,tclass=0x0,hlimit=64)'], [0], [stdout]) +AT_CHECK([tail -1 stdout | grep -o 'label=[[0-9]]*'], [0], [dnl +label=468935 +]) + +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(4),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x86dd),ipv6(src=2001:beef::1,dst=2001:beef::2,label=12345,proto=47,tclass=0x0,hlimit=64)'], [0], [stdout]) +AT_CHECK([tail -1 stdout | grep -o 'label=[[0-9]]*'], [0], [dnl +label=1012207 +]) + +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(4),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x86dd),ipv6(src=2001:beef::1,dst=2001:beef::3,label=0,proto=47,tclass=0x0,hlimit=64)'], [0], [stdout]) +AT_CHECK([tail -1 stdout | grep -o 'label=[[0-9]]*'], [0], [dnl +label=629290 +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([tunnel_push_pop_ipv6 - ip6gre]) OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 other-config:hwaddr=aa:55:aa:55:00:00]) diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index edb5eafa04c3..7a0682503233 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -3287,6 +3287,35 @@ .

+ +

+ Optional. + This option controls how flowlabel in outer IPv6 header is + configured. This would give you the benefit of IPv6 flow label + based load balancing, which is supported by some popular vendor + appliances. You can choose from the following three types, as + in net.ipv6.seg6_flowlabel syscall. +

+
    +
  • + By default, or if this option is copy, copy the + flowlabel of inner IPv6 header to the flowlabel of outer IPv6 + header. If inner header is not IPv6, it is set to 0. +
  • +
  • + If this option is zero, simply set flowlabel to 0. +
  • +
  • + If this option is compute, calculate a hash for + some fields in inner header and set the result to flowlabel. + If inner packet is IPv6, src_ip, dst_ip, L4 proto, and + flowlabel are the targets of hash calculation. If it is IPv4, + src_ip, dst_ip, L4 proto, src_port, and dst_port are the targets. +
  • +
+