From patchwork Mon Jun 25 14:43:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10486467 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 822836038C for ; Mon, 25 Jun 2018 14:44:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7099A283C7 for ; Mon, 25 Jun 2018 14:44:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62B3B2847B; Mon, 25 Jun 2018 14:44:06 +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 C31C2283C7 for ; Mon, 25 Jun 2018 14:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934325AbeFYOoF (ORCPT ); Mon, 25 Jun 2018 10:44:05 -0400 Received: from mail-db5eur01on0047.outbound.protection.outlook.com ([104.47.2.47]:48288 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934266AbeFYOoD (ORCPT ); Mon, 25 Jun 2018 10:44:03 -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=pjONoVdtq2FSn+pMpsRrPGDeT5qkcMOm0m8DGperON0=; b=Cz/M0eHO6MPmAL/w7xxzI4P96dt4pBsJovPhzb0V81RLzKY6Ky/OVl4C6Q3lfD2bjoQtJ3nvFmBG7/EBxDdJKsrGxDQG4ang2C0/Op7rwk8AKrJHV6i3Q9e6PP0ZgrMLxqOUJ8cMXfuLnjG0OFbM7rULmWTf/gY69NGO4VfA25g= Received: from t540p (78.45.160.211) by AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.20; Mon, 25 Jun 2018 14:44:01 +0000 From: Petr Machata To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org, u9012063@gmail.com Subject: [PATCH net-next v2] selftests: net: Test headroom handling of ip6_gre devices Message-Id: <2071eab42614e7019ece0e2d6f89fdde55815347.1529937619.git.petrm@mellanox.com> Date: Mon, 25 Jun 2018 16:43:55 +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: CWLP265CA0173.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4d::17) To AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77db0a58-ce72-4d9c-1d6b-08d5daaa1763 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4177; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 3:aB8d8lnBiQAfOraBAzxZzeIop4DL3gpM0Da0Ew6O3slkoxm16oMKg2zOry0jl4VCmTrgjVTGoxb6unqQciq7XucmFa7ApaXJP8zp4NF7/b4p7SUjXYDeZGkVeVFd0T/4xqA5We1fRBpMEL16KZcoft+RFxA5/XWDHZn5Xf5bz+Y9qzR4BnoTjKP9saaE5Pvi47Fi/sO01nWmCoYTsGsdz7DXU+RF44VctvCxh/+PG6QMMX3+qLuagYC+hCsPZhxU; 25:8sfQ0ES33PV2OS3kY2dEvN0aZGpVR6d1jQR0LR3oWzhuf/5G9cmaGZ1OUaBPawe4HiWkkmtbvVI05zmyxFJHzfu67UHbABaYaob1VtqwNvH3Vft+wKvZ7owHmTMaJqNGCwTf5Q7KySprVeU42vQIzfx2TFFuIWObPHOCmnCulq4SnAZE7EJgc/SI/lHAuNNQ1KCSUge4GOycYUK6tDjPzjWhrQa3Z/nPbDYriAfF425F5COEJuXZUDWyr4EdNuYIpylxfTrT8SBRQj7JQ0IC/eIPXSxAe7EE110tSnXxYtwjfncoVOHzCK4+ZL0ToYeXPrAsvD/KDUAiSbikREt/kg==; 31:aa0nG5Y1a/dwqHk+cVix4eDSWzvhgm3xsuY18QQpTdCTNccSw2XTJ/Opo0AfC7g4d/9OGxDYtbKbw/ka6uSqrJdIFJzb8rwPObg+i27lPnvBMKAuM8xTTWbvAzqK4Akw8FvWZVTu72+SCve6+DwcbK99UBRO/qMn4NRMf2UjKqaZtBKQSxzZEli/cl4AO6mST/TRpObPQ96amnJ90pakh4tVy+XykjCMSDS2L80y6pA= X-MS-TrafficTypeDiagnostic: AM0PR05MB4177: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 20:HxGQPXk72Aq4msPbFj9YJK7kQUovmrlCPvhoH+hn10B+UfjmuEkAXW0vs6JtbZQ9ALBvv+6SnJqug6WYmbrdvnUl6obunsZMI6ZWH5WWQEQLPXLOJki0WrhcK/UkLOfrHbPCcOGxMeD/bLs1ppiJcEq9EfTk8F+QN2VNenLicWi0Hpz/lWHVa5kgVy8dmRlNAUo+6CMpdjz4/Gm8aHJLM5h69fS8eceByLy9iREuIBVve14rhAMH2UYlf91dmpU+I66WUTQrOqWwyUnDM9McIQ8os8jMOu6qyTvFzhzI2qTpimQ8OzL35a8wPCu9LDLE3E1zHy1Zw6lCCXg/5SuH9Ev8/TVPdVng/YhiPNfPJp41R6XHFygvTKCDTRltvo0ydabyhnVOxjG+SZJHkg+aXACP2MNqjEOEBXFeSlj1eNHuk14hoeREypaVQX0dqNn2IqoFTbWWUQveFiJCsuKFo++WrF+FL/3hSLkgiLC+XmtTrkdS+VBlI4FS0RgIjVjD; 4:umIk8MEJL3qnlFxnkZP41tL6IwWJSuj7EnL93ghXQUOI4JIdqLz2itqll5XrujS7O45pyUHAbYdHrZc75tmfuEfDAcbXW+y1JK6SJ8CnomA/B6FoMN2v0E54lQnDdnxoN44hl9VIRTIto4W254z5x1pARgn5garSleA+nNPscdk7kNIFFuf/2TfwAHJ7uE7pAFwcz+U6QUVR2Uy2UBRw2TBTRBRWKE7QqFyJs3aWlwrVXyvbFQ7oXZLRWsF0q9oO/Zl0tc2B1hoSsj4973nhJg== 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)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4177; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4177; X-Forefront-PRVS: 0714841678 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(39380400002)(396003)(366004)(199004)(189003)(956004)(2616005)(386003)(106356001)(186003)(53936002)(16526019)(478600001)(4326008)(68736007)(118296001)(486006)(105586002)(86362001)(52116002)(3846002)(51416003)(36756003)(8936002)(6666003)(5660300001)(316002)(7736002)(305945005)(97736004)(48376002)(39060400002)(6486002)(66066001)(25786009)(59450400001)(26005)(476003)(47776003)(16586007)(81156014)(58126008)(81166006)(8676002)(6116002)(50466002)(2906002)(6496006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4177; 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; AM0PR05MB4177; 23:44xiXvIOoP8nc8uUEPMGUa94xpHZWpOYAS2pQMzGf?= =?us-ascii?Q?Xatsa8Xx6xWjdgx5Eoo7Kj9sQ0xHDkiSZginLWGx6OGdSe0NDmYaYQGK+N3a?= =?us-ascii?Q?/Ni/ovpYZluKVzsXGMJ1q8eJh0fCjDG5+3iSXXOMQPHUX/Qt9bS+sDOa9PJj?= =?us-ascii?Q?0vOoZD1FT3nHFdN+mQAbLKLKDZroJWuFnkD8JHNAoQKlekiEs+Knr1T5qW8g?= =?us-ascii?Q?sS0+Ng7DKXjiA+QwUKR35dQy+wIrfaI0G8QgMWwRUaNpIptrtIuhL3bJCVZJ?= =?us-ascii?Q?hDYn7c2HaNtIWJ9l6FVRQkH64IhTqNIVQdWEJfSrMumwZxxybfkd69Suwr0V?= =?us-ascii?Q?g5GIGh9g9H7UTUjVi3au+VauzYfUQOPT6zQGcNSCHC274n2qBDwlphaheudG?= =?us-ascii?Q?rWMihSFYVBqemHUXfsoL5ULDfP/MNOnU0Zgl09WW6os0wwSh6Ku/M1BfoiZ0?= =?us-ascii?Q?PYtHmiNm4uBrSLZwZpinYUNI4K0Bmwy4LRmat+57CnH5XoJuJHlGRGJKFpme?= =?us-ascii?Q?HmTwH5PeHbiimGyJfJ0p9loyPuzHvha9wlEjJ8Tj9lfNwyG14abvcxZygNlB?= =?us-ascii?Q?nlN4Yk7rls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HLChfOlIPHDqv4AJ6ybBRzXdQRXfH4z9tH+DH5vLP3JHC0+/1M/oR9XfsjGTQZQ8JvXDg6dY4cpzjTXGkY X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2018 14:44:01.0727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77db0a58-ce72-4d9c-1d6b-08d5daaa1763 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4177 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 Commit 5691484df961 ("net: ip6_gre: Fix headroom request in ip6erspan_tunnel_xmit()") and commit 01b8d064d58b ("net: ip6_gre: Request headroom in __gre6_xmit()") fix problems in reserving headroom in the packets tunneled through ip6gre/tap and ip6erspan netdevices. These two patches included snippets that reproduced the issues. This patch elevates the snippets to a full-fledged test case. Suggested-by: David Miller Signed-off-by: Petr Machata --- Notes: Changes between v1 and v2: - Move tunnel construction to setup() and destruction to cleanup(). tools/testing/selftests/net/ip6_gre_headroom.sh | 65 +++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 tools/testing/selftests/net/ip6_gre_headroom.sh diff --git a/tools/testing/selftests/net/ip6_gre_headroom.sh b/tools/testing/selftests/net/ip6_gre_headroom.sh new file mode 100755 index 000000000000..5b41e8bb6e2d --- /dev/null +++ b/tools/testing/selftests/net/ip6_gre_headroom.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# Test that enough headroom is reserved for the first packet passing through an +# IPv6 GRE-like netdevice. + +setup_prepare() +{ + ip link add h1 type veth peer name swp1 + ip link add h3 type veth peer name swp3 + + ip link set dev h1 up + ip address add 192.0.2.1/28 dev h1 + + ip link add dev vh3 type vrf table 20 + ip link set dev h3 master vh3 + ip link set dev vh3 up + ip link set dev h3 up + + ip link set dev swp3 up + ip address add dev swp3 2001:db8:2::1/64 + ip address add dev swp3 2001:db8:2::3/64 + + ip link set dev swp1 up + tc qdisc add dev swp1 clsact + + ip link add name er6 type ip6erspan \ + local 2001:db8:2::1 remote 2001:db8:2::2 oseq okey 123 + ip link set dev er6 up + + ip link add name gt6 type ip6gretap \ + local 2001:db8:2::3 remote 2001:db8:2::4 + ip link set dev gt6 up + + sleep 1 +} + +cleanup() +{ + ip link del dev gt6 + ip link del dev er6 + ip link del dev swp1 + ip link del dev swp3 + ip link del dev vh3 +} + +test_headroom() +{ + local type=$1; shift + local tundev=$1; shift + + tc filter add dev swp1 ingress pref 1000 matchall skip_hw \ + action mirred egress mirror dev $tundev + ping -I h1 192.0.2.2 -c 1 -w 2 &> /dev/null + tc filter del dev swp1 ingress pref 1000 + + # If it doesn't panic, it passes. + printf "TEST: %-60s [PASS]\n" "$type headroom" +} + +trap cleanup EXIT + +setup_prepare +test_headroom ip6gretap gt6 +test_headroom ip6erspan er6