From patchwork Wed May 23 16:41:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10421921 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 CE9C86053B for ; Wed, 23 May 2018 16:42:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC1A3289AA for ; Wed, 23 May 2018 16:42:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B03ED28E79; Wed, 23 May 2018 16:42:08 +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 06A6C289AA for ; Wed, 23 May 2018 16:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754771AbeEWQmH (ORCPT ); Wed, 23 May 2018 12:42:07 -0400 Received: from mail-he1eur01on0070.outbound.protection.outlook.com ([104.47.0.70]:52404 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754728AbeEWQmF (ORCPT ); Wed, 23 May 2018 12:42:05 -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=6ZShAX2atwrL7iVo9S4hGggREKwYWwe7C9c5sgQGNJY=; b=j8TKhrjRG7tNrP1cDP32xwLFlYiqayIcguVoCxRQGVzJo2CMissyeR0Ih+CQdi2uicQyws1o57CkWJOa5sNy0V9WtoHbefEuMLzID7D4DjdBjDeylHpNhUJjTy1NpvREUVsBV127vc0bKVag//SvAfODtncM1UF26d0wWNu2wps= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Wed, 23 May 2018 16:42:01 +0000 From: Petr Machata To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org Subject: [PATCH net-next] selftests: net: Test headroom handling of ip6_gre devices Message-Id: Date: Wed, 23 May 2018 18:41:56 +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: LO2P265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::28) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:Wfmxhe0MJxgXUx4mdTefXsIxxHPGtb3r+CNUs3qEIXeHSbflPQfVMJ6zoTuFnwoTdCtC7vJwNRzQjNw8g6vp6vwZQYevDA1Tq3vU679WaBhN3F951GbyiV9Zq+o1enhpMhPCqrmtOKSaHKsSbvcXRymZkv6FltL0irOH8zHDZaxNYu2NmRT4yM7C0hmNryCCL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in4S9z171dSP5sFlNSJgvaETubZlSM3w/7S9DOOcFjYwMmkpRtisgobZzNHdHmm5nSUnPMtDicznDyyExS6sfxo6Ew0gLI9uTCloNcj34hvvwNL2/e1l6sIqduFsxO08wqpCvsTEGMVTYBeLt6iYgGEGxt9AQ; 4:o46fDna1AiTtSxwNfegM4uXE4ZgveFPoPkDn/JqhzvsmW14WYvKlklq7i8KEjT/AIx4a7soHEzGkuqMwC9a9RU+jT1oAXA9vmYyp5CXAP5JxAlFLMCLesw3fd8wsmDaLYQ3YBDzlzcWIffgHtgXSyWZaO2AUpSG0J+kqAq6bv6TSNjRkIfNnUf2vkH/vr3gnWSX9BVwXf1ugrC3ZhNom6jmwuvyPGyp1tofAdFyYi++p0t1Ezfd3YklZvhQMKLo8N3efyoZcjhRgJBdP4WmPXA== 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)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 06818431B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(376002)(39860400002)(346002)(366004)(396003)(199004)(189003)(478600001)(86362001)(2616005)(476003)(36756003)(956004)(8676002)(118296001)(6486002)(81156014)(81166006)(8936002)(186003)(58126008)(16526019)(4326008)(486006)(53936002)(386003)(6666003)(52116002)(51416003)(26005)(105586002)(16586007)(316002)(106356001)(97736004)(305945005)(25786009)(2906002)(7736002)(6116002)(3846002)(5660300001)(48376002)(68736007)(47776003)(50466002)(66066001)(6496006)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; 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; VI1PR05MB4191; 23:fQK9P6O2vZF0h7G7tFw1RSJqPsA0jY/Y8Z93LKbNQ?= =?us-ascii?Q?VCV2Gl3XiLmwxCih+2HxzjCT1kSncCzY7/b11UO2dg0xgYXGl4izsnpUINId?= =?us-ascii?Q?XM7U/d4j1bAUZOIOtw27vb9JO78OAyqt4X+ciRN1cCcoesLZmzeyK/Q3IKkL?= =?us-ascii?Q?Rp7zm1E3LA6653w5mHSPZjV4/cRP6cV2ElkijbDdvIFIP5uU9idQXccaYecL?= =?us-ascii?Q?PR5DRcZvpJN0kpJKzSK4BrwIAbMZarjukIDQQaYEIuIrEAgpg7dRCx2gLvwo?= =?us-ascii?Q?JVxbhlyX2YsW+Mtnpo/S0u8KlcuoMwlyC63sBd52lVWedxY5gkQYFijnxe+W?= =?us-ascii?Q?NmLdyNbnW2jW5U+JdMONEXl3U68zPLrUULs4F/es1zFVkYmrVCh/T1R+2xmy?= =?us-ascii?Q?Gyac0xawGYwzLaR2LZFEHu37JHcoV96O8c5xa48P7f6sZoY5sIa8zd/tVU+I?= =?us-ascii?Q?Uf1EOSGbMGxKRlNgYA2FnQ1aR6dhvueLHScj1vnPTLieylMYltC+EOlVrFMp?= =?us-ascii?Q?zm8FQhcsp1cW0PHpOZ9vw0PzuA3ot16inhWndEHI+l8yTyVm7dSjnAWnooE3?= =?us-ascii?Q?tJFpvuONo7JIMUbn1TEW4zYQjzrI5yUhuil5eVV33lBt+8RXnQq5hA9WRnMZ?= =?us-ascii?Q?cNoTjpsPsy68QqUhd7YkDXMXZdITdH7E0c4DQDhIHlamFoccmw9De2Jgu3d1?= =?us-ascii?Q?b782r8XoM16Bfx8ihKr37Bd+YCmwwhWz0iYnUdXat7tZ1vhhkbG2UevrxqQo?= =?us-ascii?Q?lXSsLsv3nPfQUzWBnHuD7o252zLe8KN33VHnGXUU4wO+PE02kpY3Y9nBK3I1?= =?us-ascii?Q?c1TmSxEy+TNRk8eOy9DCsQsmc8eYz5n1kG2sdKrxzg6w4xMiTUMD7x5G//d4?= =?us-ascii?Q?DfduAb4eX410YgywDVoguedcCynXqRLcD5n69b9/JA6g4K7sa2eO7W0H9NfV?= =?us-ascii?Q?z1hRbgGjCQ6p3Vh7wkAYLCCvPh4b6+jARsag44lk3jw5TKWecomjy430fj+k?= =?us-ascii?Q?kKMwsegcPLqr55aaQ63W03mMeZ0ARO08UNqDKJfQFDqihD4NvBGn3sDIX+kp?= =?us-ascii?Q?vdRo61j6p3Ati1wFz4kXmfVTZUyUGkl527yFLjo0YJGuMkag+267hkkCaSU6?= =?us-ascii?Q?qXHpq3+pk+sj1AY0F8EvlSlBf6iVDRv?= X-Microsoft-Antispam-Message-Info: ntjSK+AKkqWa+21K5sMgv+XUSl+wqk8ZV1J+8/CK2XPe5rb0JCNCnmzH8wlzBJUwCS/MwZesTBn30B4O0I29pSGvHFzmb11A3U6rjB34f0To47aEbgIxRjtkwAQUEM6xQMhLi7y8nJpSa1fweMzsK/W14vWLwWq5vKQKbLZhvBPnCv7rJkQcrKcGcOI7eW0Y X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 6:k+8dCrDltRzKbhrzBdqJF6wBraJlIAgYFbLSjSSaJMIgf2rlGRsLFKLyS9QTrwLoF9K8WQGT1GGfbSNkDhfczx8GC3t/1hXfrEcJAHKZjBj0CWHsJDBRhEs+yKwBfT6A0z7tHeNOkBZ6JBswPMM5prOT9kN5rNUWBZOTujjURZ4LZI0xB7S1J1NOYHoposHQc7yrEZa4ZQHwP8qVnM090oFWB48TBKZFIohUYzuB0PwwLI9krrxL7lIXaSsPr5m3FvRHuyDhSaOIenvHBZEQoIqNos8Yw/AWpGEsDj9Jgw6Mbs20/TABIFhQJiqJgB6nDasPKUxr7GvLMUrOkWWxF+AcuFJ/m4AWwAIsDgp8Q7SclqTYo7SM7/eBOgm0LWDVLC+h7xyqr7DEgmKMg5oN5pk6Zfms0dgri1wzWVZidV8P4AnjK9oiHNrr+ca+7IcSuCdBu5zxlInRRj9D6Wz2XA==; 5:EG832iv2p3EH8XBrKMefgtLQSn30h6YJPiFBwBbqZ/SbwCuuoSWNBbHK48fwsG12cpc91dAWGgjaYuubnQerkvodUTHVGK/JmGbbE5PB6rq8PJouD3KXWWnI6bKtGU8aen5fkDQktXCrbkDZw46uiMUvU8qNMVsXtYQA6Wt27Fg=; 24:4EhaHEeBCa5tRV/5D/m8yAWoxJxttH74czrgRRIg9oLJ4AealAwPXdI9hAEnP6I/IXcaMIB1cDw6r3PLcPML1ZDH25N+ELvVtty+3yZvo9Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:kmRCcFV/P7Dj9AJEBQ0SsfAhxtZ5Fs9VOnQ4SzepwCN9HtUcCUnEymGXO+bcdX8dPffFYAxSsHO06rSqmD+am//IWyeSfUt3r5Fi5m8/ANIRplpiIXMsuf5lVPyM7A7cdjmhGcvNUKyx/yh8CAxUXuH8BgvoVzqn2HoKUMlUN2CxIgeJDsUnDOcITSfmqLa+KkmNVX6lQI7H7oPBmTWDwhUEyexVe6RMDkCkCwTe3MeMhI+U02nLyKcd3dsjskhR X-MS-Office365-Filtering-Correlation-Id: 81f97978-2396-471f-7241-08d5c0cc1c21 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2018 16:42:01.6546 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81f97978-2396-471f-7241-08d5c0cc1c21 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 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 --- tools/testing/selftests/net/ip6_gre_headroom.sh | 59 +++++++++++++++++++++++++ 1 file changed, 59 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 0000000..9aaf63fd --- /dev/null +++ b/tools/testing/selftests/net/ip6_gre_headroom.sh @@ -0,0 +1,59 @@ +#!/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 link set dev swp1 up + tc qdisc add dev swp1 clsact +} + +cleanup() +{ + ip link del dev swp1 + ip link del dev swp3 + ip link del dev vh3 +} + +test_headroom() +{ + ip link add name gt6 "$@" + ip link set dev gt6 up + + sleep 1 + + tc filter add dev swp1 ingress pref 1000 matchall skip_hw \ + action mirred egress mirror dev gt6 + ping -I h1 192.0.2.2 -c 1 -w 2 &> /dev/null + tc filter del dev swp1 ingress pref 1000 + + ip link del dev gt6 + + # If it doesn't panic, it passes. + printf "TEST: %-60s [PASS]\n" "$2 headroom" +} + +trap cleanup EXIT + +setup_prepare + +test_headroom type ip6erspan \ + local 2001:db8:2::1 remote 2001:db8:2::2 oseq okey 123 +test_headroom type ip6gretap \ + local 2001:db8:2::1 remote 2001:db8:2::2