From patchwork Thu May 24 14:28:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10424901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5D2586019D for ; Thu, 24 May 2018 14:28:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 915ED29484 for ; Thu, 24 May 2018 14:28:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 862A42948D; Thu, 24 May 2018 14:28:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08BD129484 for ; Thu, 24 May 2018 14:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033314AbeEXO2L (ORCPT ); Thu, 24 May 2018 10:28:11 -0400 Received: from mail-ve1eur01on0063.outbound.protection.outlook.com ([104.47.1.63]:45493 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1031005AbeEXO2I (ORCPT ); Thu, 24 May 2018 10:28:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p3EttWzQMS+zSiUWbUH2LKVNW4VNwkkFNXht4FuAcVs=; b=vxwbhz4ZrMwcGPvS/3krNYC2j94ox7W7VvrDstjJnwb1/ZLKqSZrFSeQHcnNcJosuGi8HR6VvvSB+ul/vJYlXJC5m3F92cXGZE2PKwUIjplXwAlmGuUzL0y1J93Q+EFaQ+KLG9Ni8dl7WsmcmSBUO7ezMZZIDMMt/oO+KwU/9O8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Thu, 24 May 2018 14:28:05 +0000 From: Petr Machata To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org, idosch@mellanox.com, jiri@mellanox.com Subject: [PATCH net-next 09/10] selftests: forwarding: Test mirror-to-gre w/ UL VLAN In-Reply-To: References: Message-Id: Date: Thu, 24 May 2018 16:28:01 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: LO2P265CA0146.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::14) To DB7PR05MB4188.eurprd05.prod.outlook.com (2603:10a6:5:18::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4188; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4188; 3:av5O8neRQ5mvwrtQCloADCAcr2icGKh4hIrWNG92IB8LpPaBcVdXJ3JCks7ySzKtOH/lYyHwa+YUI73adliIf8XWBLIpzjc1mxXSDLMR1aExPS2FOuYlwYLxVUGYFkYrwE++JIPjbYX76oKhYX1sKsdeZ8YmRywd82UMH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uwOR9UwRUVcyS6/b7urpN+KiZEgrBWfonJpATK47JljxGcZkW4oy3Z/NIV6Wkdyap3bOt+H9+b9ATI2mg+fdDPtTmCFwGWjYqnkLUy2rmBIoN98HZoi9Pk+UKgPk3e0IBvEq8tN581yurpSrdjniy9G24zQVzK+xi6K0cBV7w4rhexq203+7rVkWD; 4:skEqwXm1gkTcA2LtAW0Zslscx8tZj+oJGqRCKFTgZYYBKmCXC0ycPkVW+P/3b7efdrMIsiu2pKzMHwHg+Ta3o0hi7crzHBxW73lDi4VkC8WmJFQdEHvegnaBku4qxw+ekoCzEwZtACu28ysIcG9DkWcQ+0tENo0Mxib9lI1I+vnp7wrAGyZGR40UtzDaddMEPlXoZv3/DElCDlVHQLoTZ/AcSxMf+bNaQTpBmEEYKGnOloYN+V603H0LmL+xN9s6J9Dknea2TxCKKpCjabXweA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4188; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4188; X-Forefront-PRVS: 0682FC00E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(39380400002)(39860400002)(366004)(396003)(346002)(376002)(199004)(189003)(6666003)(386003)(97736004)(86362001)(4326008)(6496006)(47776003)(6486002)(2906002)(36756003)(26005)(76176011)(5660300001)(51416003)(52116002)(478600001)(107886003)(3846002)(6116002)(16526019)(25786009)(2616005)(956004)(476003)(58126008)(486006)(316002)(53936002)(16586007)(8936002)(68736007)(446003)(66066001)(11346002)(8676002)(48376002)(118296001)(81166006)(50466002)(81156014)(105586002)(106356001)(7736002)(305945005)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4188; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB7PR05MB4188; 23:lGdk8hHwsEVMqE+dsQFSbZxH2lRU9PdEXNJB35VO8?= =?us-ascii?Q?Hk/8YEhzNpRxwWYY7MKoZCsRgsYoTsSRf9ZXEAIh3O+n2mjAzlAeW4rm3XNp?= =?us-ascii?Q?7gAxzwZ0JrJs5Xq7soW58Os6c+pn/0LiahfWr/QmPmY2390gLwfNW8YyD8cA?= =?us-ascii?Q?+t5h00yDBML/L/r/YeuGUzRZLIj77dGfm89EtXDuHgO5Gusafl0CswGpOp+X?= =?us-ascii?Q?+dxY9KwI6BggypjPLWvtUKCqONs6Fx3Q7U1tXnJMJsec1jj3dt0SYEuTImyF?= =?us-ascii?Q?fuRGNV8P7Gu9IUs5tbMpv28XgUTGDDlivcnZMHuzyshVloKnepVhkfriTDaO?= =?us-ascii?Q?PkBGiei4nugLlGcSm0iHZFDOxVlk7G7MjMqsxRyHbZ0UsBoS/AEXLo75ZZMG?= =?us-ascii?Q?NGKrPAwm336nh6MXxaX2yC3KUp3L+Pxg2su/cKDE3bZKUdwGCq+LqNZoXvYi?= =?us-ascii?Q?BjjgNOVvfXl3V/u2pyASL/yYawX01mCf2od9krotXs4lsii5nwJPHwP3qq5L?= =?us-ascii?Q?dzMOfcdyCdMb4chkvkOCjwmnLktlmt64Jnjx5aH97CxzYo+garpow2nxnt/5?= =?us-ascii?Q?VLMexX/yKe89vS+C8ZjN+FBdFcHaNO0/CX7LnJru8BF0G4BUnFpyUJNk09h8?= =?us-ascii?Q?79w3nfmuRA+AyLNn+LS2TE5isioMPqOaSSITFQN2PwMitNa6WclVJBH+u3aq?= =?us-ascii?Q?v21FR5IoJzXjc2knCvW8qy154Uz6nphTSpwmYszQiOTZs5XLDuuTQcLgaodH?= =?us-ascii?Q?Geb3YJ3WYcEQTYBdIrneXrvov2PdzF7X9/7qyjLYoq+rbaSnWgae9CVnwn9I?= =?us-ascii?Q?R95aWSgZcMV4Z0kmzdywQ3fC8RufClQq9RJFYY/HCEQxQpqW2bXFz07fD/Sl?= =?us-ascii?Q?dLN7p0gQwWquc0V2Zf9qDPB9EUGOuKedxyWj5J0TTHmE3kChP3I/eSOwfPx/?= =?us-ascii?Q?51o/MuNEQJjB0vpKHWLlPXQGE0ko441BcNLBj9x6ty1h2Iox9Vuu1bL+u0Ap?= =?us-ascii?Q?lpWQPsbkpZ04UGc63ZvJSnABA0zTA+yvbTxhpOZ9IA5sqkS1ueDaE6jzag+p?= =?us-ascii?Q?GDY9rsstoBS2DY16cvse6bSRfYnwUZ85cEKkFUHb0NRz7ymogU0lhFEmF1Jp?= =?us-ascii?Q?PL2MxDjFM8iUiVLefR/za4GKUyFTLm5rA6FnKA8L+t8mOgsmIWHv2H44RCp5?= =?us-ascii?Q?fSujWvOYz5vyRQiekoRhpxPOpTZCGihRkrDuSjltUTkFbSthYGaHejw92vDc?= =?us-ascii?Q?2zAZuSOCyW2fO7hECH3NqBY/H9NzxyqvQgnuGIF?= X-Microsoft-Antispam-Message-Info: w6ee8pET5dUpy9rPCkd3vpU6MC3isngjz4RlIhOQQEBw59AXZd/cjtHZtqCVU8AYV6hStwsHsSLuw1xOhMNe5+zkAH+UBdKpIphgLaJRa0fQpiKiitvT66eZgJAaCzbhnvRlJ5Dv8R09S4ZBBD7aTX/Vucf3l/edNDqs6GLb6/Xpy6PFGYbNLi62fP3vxanZ X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4188; 6:VlFjq3QNYkRtdhBmoJ0cqTtSLYKdkaANe+twazA7lYLU8q0ImUHJNTFNEob0p4c5NOU8HT5Qxu+hpY+qaAZOyWN0PshXJetp/Dk+DpE1F4dR6V9aulhUsll+zBxnQxGx3JC21HUt62v/lz2nexqdVTKSWOwpUqhBoo9FhUwecP0jgqwukq014QMdIEmLYoxMxMsRvJqSZxfpbXqywdY0+JdVkineILXneAWW7VaGBx1x4Dw88jjCVmuoLWYBOKx2kWOyLg2rFTfKaH5iXsc4UICjwjuLAUfCNbDDwg2v0oSIF3fJjTK6IE4UkwWfW3ZKJVdVcsuEybz0juVSEyam6GO9MlTjpG4Pg9kFgZTaOGtX8onyzChcqzS2kPKDgAVH4n0MgyAk6zv6WaLmdEoguG6r773iP5Mvmw9UXwKEZHDi8+gKAf/6t2RxDNhtbTQuk32hrg9H4tin+nXqVOLpoA==; 5:mU4W6G8vuI/HF2OJ8w8TNTZ6jJ3re4/aG+4wlCUdlEU/eodKzGuatz/W3jfWOWmAPtDU0FudPEAjyVzoEM2zv100StT9y7CorV0UZM2DsawnQMKpk7gz3uBVnK5p87d3MLGq4GdSrUIRa+VhtemxsUBJOXaMO5rcAmoaw1lxTBM=; 24:MZrNkBUGTq++dUSsz27ySDUkFP1eqZjFiWLq86NSxPyReXa0YQLJGIppw8EU5cifJGNNkdLrfbYfqaiYk5bc7ZdVfUI4eIAZ8shhdBLyaPM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4188; 7:FZIyO0OXQzYHftgj8PpYbE5A30ywmK6nI/zDWuV+dRIwKIoywsRu0ltSqIyjn7npeldaMP3+54WOTRouN9mh/x7pyuOY7bGoDpGXxvjDIusIW6m/6IdmtEu63cldAqzHGZviFTAvP39XMOcyNryRl1IO+tjV68E8YvogpKK2P8U2979yDhoCmNDKJGj/+aEeN6mv9VMQwTJeznhhhsKM1W0x5utW8STkImpPQYAGXwJmeIgWdAiSYCoc32rGgmlA X-MS-Office365-Filtering-Correlation-Id: b2d29cb6-68c5-491d-fb8c-08d5c18290c1 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2018 14:28:05.7271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2d29cb6-68c5-491d-fb8c-08d5c18290c1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4188 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Test for "tc action mirred egress mirror" that mirrors to a gretap netdevice whose underlay route points at a vlan device. Signed-off-by: Petr Machata --- .../selftests/net/forwarding/mirror_gre_vlan.sh | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_vlan.sh diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_vlan.sh b/tools/testing/selftests/net/forwarding/mirror_gre_vlan.sh new file mode 100755 index 0000000..88cecdb --- /dev/null +++ b/tools/testing/selftests/net/forwarding/mirror_gre_vlan.sh @@ -0,0 +1,92 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# This test uses standard topology for testing gretap. See +# mirror_gre_topo_lib.sh for more details. +# +# Test for "tc action mirred egress mirror" that mirrors to a gretap netdevice +# whose underlay route points at a vlan device. + +ALL_TESTS=" + test_gretap +" + +NUM_NETIFS=6 +source lib.sh +source mirror_lib.sh +source mirror_gre_lib.sh +source mirror_gre_topo_lib.sh + +setup_prepare() +{ + h1=${NETIFS[p1]} + swp1=${NETIFS[p2]} + + swp2=${NETIFS[p3]} + h2=${NETIFS[p4]} + + swp3=${NETIFS[p5]} + h3=${NETIFS[p6]} + + vrf_prepare + mirror_gre_topo_create + + ip link add name $swp3.555 link $swp3 type vlan id 555 + ip address add dev $swp3.555 192.0.2.129/32 + ip address add dev $swp3.555 2001:db8:2::1/128 + ip link set dev $swp3.555 up + + ip route add 192.0.2.130/32 dev $swp3.555 + ip -6 route add 2001:db8:2::2/128 dev $swp3.555 + + ip link add name $h3.555 link $h3 type vlan id 555 + ip link set dev $h3.555 master v$h3 + ip address add dev $h3.555 192.0.2.130/28 + ip address add dev $h3.555 2001:db8:2::2/64 + ip link set dev $h3.555 up +} + +cleanup() +{ + pre_cleanup + + ip link del dev $h3.555 + ip link del dev $swp3.555 + + mirror_gre_topo_destroy + vrf_cleanup +} + +test_gretap() +{ + full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap" + full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap" +} + +test_all() +{ + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + tests_run + + slow_path_trap_uninstall $swp1 egress + slow_path_trap_uninstall $swp1 ingress +} + +trap cleanup EXIT + +setup_prepare +setup_wait + +tcflags="skip_hw" +test_all + +if ! tc_offload_check; then + echo "WARN: Could not test offloaded functionality" +else + tcflags="skip_sw" + test_all +fi + +exit $EXIT_STATUS