From patchwork Thu May 31 17:52:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10441571 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 70F96602BC for ; Thu, 31 May 2018 17:52:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F5AF28ECF for ; Thu, 31 May 2018 17:52:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5373928F30; Thu, 31 May 2018 17:52:25 +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 CC25128ECF for ; Thu, 31 May 2018 17:52:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755916AbeEaRwW (ORCPT ); Thu, 31 May 2018 13:52:22 -0400 Received: from mail-ve1eur01on0043.outbound.protection.outlook.com ([104.47.1.43]:28256 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755912AbeEaRwS (ORCPT ); Thu, 31 May 2018 13:52:18 -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=HX6ZtpJVRFm1ab7oOu9DsqMu72t5V7phpmGQFNfrkOk=; b=Ak0x6rhWKlPAKRITBNhBfL2tqzpwOTSauu0h0457ZSxgGjxGbhQPcMkGXcUKAvvxBYwCEsFjRtSts81tr1/jc4gqsUGTmCMKRYUeZ70lhZPx7feTx7ZJ7DNQUmpLnrLwiU+VgKFK2Cka4a61FNjNMYdUwmNSd3fbh00nAnQhwrE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4187.eurprd05.prod.outlook.com (2603:10a6:5:18::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Thu, 31 May 2018 17:52:14 +0000 From: Petr Machata To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org, idosch@mellanox.com Subject: [PATCH net-next 2/9] selftests: forwarding: mirror_lib: Move here do_test_span_vlan_dir_ips() In-Reply-To: References: Message-Id: Date: Thu, 31 May 2018 19:52:09 +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: CWLP265CA0054.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:12::18) To DB7PR05MB4187.eurprd05.prod.outlook.com (2603:10a6:5:18::28) 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:DB7PR05MB4187; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4187; 3:GHMm3U6ccmsVqQGyYTcxA2IjZ5eN9GAHid72z7eHGjkJ/sAV5q2CFPFATIzTXO+uLmlv4iLr2Pw4iOJhpXdmo0qt5ht63A4uzxA4ZFlvmYyc94RPIV+Y6KVVdN34iU+jrrREzR+9vJ5Wxmis/uAub8B52v14kgjP6CbY8Nv91jd1L32V6er7RY+kg0zTg7osA7yhWaeYlDf0Wwxl9kUr409Yz1gc7Haem4FIphDnnQUkfRSlaonAxGg/5rPrKanK; 25:Rl1an/TJARDcK31Qo9aRlyXwgNaGJcy64wYydiZLTUNDcn1vq1eLP/mnmzulkNBmT5Myf4XUQHb3A5xvwrqlZLHRDxduJZM6GzzPk31g93jfUXK+2CKdSPKMzIe+WhORuRPzkQGw/Vf4uCGGVQQ9o96SJOKU69QCvT+HTn9TijqH7/qJHKyj257P0aDWkL7SGJmLhN5Mlzbm3q7Q5z3vmW2c2kxdkRSgdkKypzNfWlHwzUEXxJZ9q/PXQ4BofZL+wF5jCUd7RdlHJNDTM+WiiLTxnF2lfueMS9MpDmlo7uto37qcsqfVdvpHucfpXC55EMktcVGzLJXohE40XKwHIA==; 31:Ku/cnBpW8kDi6uskwzkX96eF9G1mL+HzIG60LHsHCbvIwXIK2XOManejTg1XYGqYOZRWCa+c2GXuOVKTJCdQCExJEbwsvav3d6mmNfnEjNXhAaq868klYMvlXZT27vE5T2//2f8beZr3YhwHf3pO9dvCAfXprB1WpI7FtDv2ih0oqBqLUAEIqdcUjLXT0HtDl8vW/vROjs0RoJESMx66RX7uq6d92TR3CukZscWFoGM= X-MS-TrafficTypeDiagnostic: DB7PR05MB4187: X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4187; 20:XEAH6Y6C8UlL13h/87bQ82xEZINI+zsXF0GnOJDW2+QqVquR5t7cgejq7kBm+wDyxech849OURcgjrRZLuIdhld7rheCmJkdbuswMl4qrSCyYH703suONbGuY7kf2OE3AfuJ4x1TbiWoBLntxiT1kTfArH0U/+emGvGlnqL60h0t3jCxxppBmaXeeTL9WtaukrphhQRrKzki2TNoOfoPpPMPlEkjfGET/evccNUVyaiXTaPMW1EsIprNiU6CXKquZ/B71XCIp+e51e4woQPGKszHIcUNB4OrWgxw0iUc3LibuTebKld1p34MJHFrFJ1OXyG1SuOsi6kNmGVe4llWGOmkrrFExn/YISARJLbXorhxe61xKudHb0qXM/HtvE8skA41hiUibVuOPUBo7T831+Qa3/Zg/vpCf1guN8QO2v+M9UCjljDnUqgiWte/IkYee2lKyVPkbVUhXu2R7Dh3YVPb2LY6wT0c+g3G4wVgfRWupTqxgqcENGwF+ewM/J/s; 4:x1T148abvD+j85+CH9L8n54zo495bMaEbonp4BShCKRL5h/lX+GqM9WZM3t12vkN2IlROsy15ziJGoB34lnrhH/0SDecT2fdaUmQ9PxTEjIR2sg+Fh2GGQWsahuOdPXQXzqxGX7Q1sGWTeRjuQRV+xARf3acckZS7RDqPYYghOM9tTzXXp1xyFG7Zxhtb11513JRWaZClBUzSxEjx70UzIMUmTPSo7XTHixhm2VGhE9TgyTUuKHOjrr/G8sfVRNwWDYu7akjXqVpt8C8j8OueQ== 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)(5005006)(8121501046)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4187; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4187; X-Forefront-PRVS: 06891E23FB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(346002)(366004)(39860400002)(396003)(376002)(189003)(199004)(7736002)(81166006)(97736004)(5660300001)(26005)(50466002)(16526019)(8676002)(11346002)(66066001)(68736007)(81156014)(47776003)(86362001)(53936002)(4326008)(36756003)(305945005)(48376002)(107886003)(8936002)(58126008)(25786009)(118296001)(51416003)(6666003)(16586007)(386003)(52116002)(316002)(2906002)(105586002)(76176011)(6496006)(3846002)(446003)(6486002)(478600001)(486006)(956004)(476003)(106356001)(2616005)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4187; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB7PR05MB4187; 23:mpCkhKcCTlGrO5l3RegIeAv8lq/+7CtrrywH+gWFA?= =?us-ascii?Q?2xSM0mJZ4C0Kl/44qW3shsQHLxpYCzPJVO9IMUIS8WDfQ6neq8kROxZzHz3y?= =?us-ascii?Q?HyYMTAKgdzTspJCVWBtv+FkMYxG1f2I/dJEFhqhoagNHFMKfGpS9hy3Ga2rg?= =?us-ascii?Q?EJXaFipq4L0OkVFABNrMVzCTmUT5+mjMtRfu+pTJci0Ei/rUSwi1tqYIopmo?= =?us-ascii?Q?1sJBRoOhGJBSRZYlco8eL1yu7NFX8gWfgzcnvJZVBEtoFWfS5KU5YfpAc8zC?= =?us-ascii?Q?rcgoEqPzNgP56ujTULBPWC0pVL0kquvLNmLyF005EZ75lYinjuvBILvADDfU?= =?us-ascii?Q?QrKQrDa5FKB///yHpQc9afeO13Zr3vEZYrL4VlBJi8/El70fe8e+ZOMHt36k?= =?us-ascii?Q?0xxVKZnQsTyRxtShXHfXiS8hnu/o15sTSpGu2KEX5E5qMqnRBuTiAp0XI64O?= =?us-ascii?Q?kteDqsk1vU5rSqdRUtGlfp8f7zKdgA4dd7tG8pNNxn/YbYYMiMGed8aCh05T?= =?us-ascii?Q?PzTjbMs8AyGcWRU7AWy8/d1IDo8AcnZPNV8qiTH4+VWpNisPrwReWggQKqSc?= =?us-ascii?Q?+t8od/g4JHRAxlKSx1JrgnL9orlAVXWhQfaZUnp+pSzBr8tzYXclS3m6Fluq?= =?us-ascii?Q?Mm40VqnEegd/fxeUX7fs8qMJZUBc0wVG5b7uLhIFlXzMdd32LHaVouJw+Pkx?= =?us-ascii?Q?/7CjlkNtFypGf0GW0BvzrhOE1bqK7JdLF82HtwyHM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uIKVoZnk3RHH0gg7ftbiqysVGe8Mfcrthi37VolaL4KiriC9+JkPtjwg5sQkolRtRDJ+Lm7bQyvKsOuJzAI6Nw+Xn5mrMTv/S0N+dE8TtEFp4/UpN4NwnslPVTHBnDL4ATqKqrnfAaQ7dG/fz74zumdbrTPna048MxXv0X8XEJzujCRNfZnEbQYBx3sd3C5GLAwQ==; 5:o10KUeIwlZxZZSZgNkCjoPz2CwK8Qp9OBoBEBGaVaBiYCVp1ailI5EnDhdBoouLikid5rVBGN00e5QVDqE/dWInhlP9H5/QlzApkiqHf/89CIMtCkAR5cRtm+si7jghJ8ISt0wLda1r9jTIlRDhUevPj6xpTmTGzyMDRHiHhv5U=; 24:xlV+jVhc9V5Gjx7tqlz3IumW210siT+Pz4r8DwjHN37b4Kg/HumsHvDPFKg5NzCpx0QVmR8Qge5ECedMnjzfxjtMSoBQf8dqkAycB2Q5DjE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4187; 7:6IFGuL2P5FI9rz89ooAWnkeEdW8/3eEgs55qrYMvuA+dLLxwVBhHC+vMgxGi1bZA/yvr8ilF4SK0tgA3i/+Ey2js/uHbDutSqbmVqNVH1a6XM0NhCdTnfNeCIzmtVZV/CqGAVTMPbmtqj4HfKBZCeOWgTlSE/MJ3T8IjMqPLqTJ5dY0+LGkcOwws+u2FX0TWomjeM+HB87HIwhtY8I7FY/UI5JhGlwdyFY8NJH9LmzTvNP53MGcO4VK4u/eb6vpD X-MS-Office365-Filtering-Correlation-Id: eb5cb421-47de-4a87-1996-08d5c71f3e48 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2018 17:52:14.1713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb5cb421-47de-4a87-1996-08d5c71f3e48 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4187 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 Move the function do_test_span_vlan_dir_ips() from mirror_vlan.sh test to a library file mirror_lib.sh to allow reuse. Fill in other entry points similar to other testing functions in mirror_lib.sh, they will be useful in following patches. Signed-off-by: Petr Machata --- .../testing/selftests/net/forwarding/mirror_lib.sh | 35 ++++++++++++++++++++++ .../selftests/net/forwarding/mirror_vlan.sh | 15 ---------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/mirror_lib.sh b/tools/testing/selftests/net/forwarding/mirror_lib.sh index 04cbc38..67efe25 100644 --- a/tools/testing/selftests/net/forwarding/mirror_lib.sh +++ b/tools/testing/selftests/net/forwarding/mirror_lib.sh @@ -92,3 +92,38 @@ test_span_dir() { test_span_dir_ips "$@" 192.0.2.1 192.0.2.2 } + +do_test_span_vlan_dir_ips() +{ + local expect=$1; shift + local dev=$1; shift + local vid=$1; shift + local direction=$1; shift + local ip1=$1; shift + local ip2=$1; shift + + vlan_capture_install $dev "vlan_id $vid" + mirror_test v$h1 $ip1 $ip2 $dev 100 $expect + mirror_test v$h2 $ip2 $ip1 $dev 100 $expect + vlan_capture_uninstall $dev +} + +quick_test_span_vlan_dir_ips() +{ + do_test_span_vlan_dir_ips 10 "$@" +} + +fail_test_span_vlan_dir_ips() +{ + do_test_span_vlan_dir_ips 0 "$@" +} + +quick_test_span_vlan_dir() +{ + quick_test_span_vlan_dir_ips "$@" 192.0.2.1 192.0.2.2 +} + +fail_test_span_vlan_dir() +{ + fail_test_span_vlan_dir_ips "$@" 192.0.2.1 192.0.2.2 +} diff --git a/tools/testing/selftests/net/forwarding/mirror_vlan.sh b/tools/testing/selftests/net/forwarding/mirror_vlan.sh index 758b6d0..20b37a5 100755 --- a/tools/testing/selftests/net/forwarding/mirror_vlan.sh +++ b/tools/testing/selftests/net/forwarding/mirror_vlan.sh @@ -76,21 +76,6 @@ test_vlan() test_vlan_dir egress 0 8 } -do_test_span_vlan_dir_ips() -{ - local expect=$1; shift - local dev=$1; shift - local vid=$1; shift - local direction=$1; shift - local ip1=$1; shift - local ip2=$1; shift - - vlan_capture_install $dev "vlan_id $vid" - mirror_test v$h1 $ip1 $ip2 $dev 100 $expect - mirror_test v$h2 $ip2 $ip1 $dev 100 $expect - vlan_capture_uninstall $dev -} - test_tagged_vlan_dir() { local direction=$1; shift