Message ID | 62e6587e5459918306bda15380ac6b5e37024b4f.1527171860.git.petrm@mellanox.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show
Return-Path: <linux-kselftest-owner@kernel.org> 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 A741D60327 for <patchwork-linux-kselftest@patchwork.kernel.org>; Thu, 24 May 2018 14:27:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC7CE28987 for <patchwork-linux-kselftest@patchwork.kernel.org>; Thu, 24 May 2018 14:27:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F101295D9; Thu, 24 May 2018 14:27:54 +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 3661828987 for <patchwork-linux-kselftest@patchwork.kernel.org>; Thu, 24 May 2018 14:27:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033296AbeEXO1w (ORCPT <rfc822;patchwork-linux-kselftest@patchwork.kernel.org>); Thu, 24 May 2018 10:27:52 -0400 Received: from mail-eopbgr30048.outbound.protection.outlook.com ([40.107.3.48]:10908 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1031005AbeEXO1v (ORCPT <rfc822; linux-kselftest@vger.kernel.org>); Thu, 24 May 2018 10:27:51 -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=WnDpXvgxHdQDUzGyl5DeYeL3cOA98iukVVT74VavQuQ=; b=mDFFfsFvdKFYYrtMoI4fYMnEEdHvxesNPdxZ857PzcDGr+cxrzwkOvk7vgScIekJpjtFYKsfD7SjatUK8LDUZ3QF3XQaeoIIw3JbzapStBe8KVvEmUcGh2Pb9Vi2cmAIKm0Q5x4kxLnBH6uoIQFVIOvwI3llCXCZpLvTUhFXz2E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4190.eurprd05.prod.outlook.com (2603:10a6:803:4e::16) 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:27:47 +0000 From: Petr Machata <petrm@mellanox.com> 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 06/10] selftests: forwarding: lib: Extract trap_{,un}install() In-Reply-To: <cover.1527171860.git.petrm@mellanox.com> References: <cover.1527171860.git.petrm@mellanox.com> Message-Id: <62e6587e5459918306bda15380ac6b5e37024b4f.1527171860.git.petrm@mellanox.com> Date: Thu, 24 May 2018 16:27:35 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: LO2P265CA0128.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::20) To VI1PR05MB4190.eurprd05.prod.outlook.com (2603:10a6:803:4e::16) 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:VI1PR05MB4190; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 3:dVwrUYvN7/B4vaFFog+K0rLvHpS/jet9/7jVfC55bw2aFDXLIYRfbM/pJYfnWxQCQJzak5v22jycPp/6nmJhxOEvw3XhnslbM6IhXyrWVJ4v2JvdfLh12BRO99WQqn1xhkp85gaM3ReZhjiThRE3vhMp2kNdfsIkbGf6pStV4jHjqqF+4jbY2XagY9ZLhSEH7lbxCMmhKJf2goXyFzY61dmZI0s2c4CoWnmr3kwmvu3qxBuF7uADbhTHAnb1X68m; 25:SC9WJxbKHnKcKLSyjADCzcigzT7PhTwtRoC6fl3E3C53dewGoxUGBgCtQBmnpXEZ/1Xu2naUtCKH8tF1Vll74+hGY90wFKJBGNiIRZKX13MWNrVm5e73ZvbuMu9Y4JHMqPu63ozpc4Y49ExpGq5AFgtEOIqy9QRTpBWL+ANx0xfQ9HP2YiSN9qUb7Kxc4GrBH5cHMtO9T2EjPaF3OD9nFnsE6VY0zi3UePDRnXhGzz4+h1gL43g+QEu5LIrZnhZBVe/toRAEZdhKuZbJIhS3qAkQtrhmvjk5/KsaRByVLXf9ApDkis/Ro9n1jPyRu0VslDzeSRDg5n7DEDhsC7NKRw==; 31:w3ricMAabSZJzrFUbn4GCkSHqpRSCbo6mTB9I94iwXNfuZOP4FKFOEZhMLQMMl1Sd3VgPGt2q6dWmVEpW174pEVdtP1nzDPnJ4q/OJD2wZmY2WAAsbq5nW5iCVQwZLC1mMadvA9FZUTTI6s1w4cP5++Huw+oNip1099HSIGKzLHwy4s+Vm23dsy/FFMkdOfSoureVOG/wzqTAysOcNH/qUa2Vwj6oMQwTmZr6ALVCII= X-MS-TrafficTypeDiagnostic: VI1PR05MB4190: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 20:DC8ZtlHDOHuC0uC0RHKWkTpLF2od33wrpF9tm57w8Pc9jjrDHMLaABSxQ1NOjUNJUvBnInInGLnAeb9b7JhtSJHvPT4EahKETAKaM+TtQZMnh81YTzxs+dwR/eN9NQkkz/z5e+b6Fdc+QBM/Q6CpLPoWiE3iMkmB4UEtjPBhS6j5updvgWfwEckQ1Lz3knLDQ4JtW63E3pg6lFTswAjNaT8f3CofazMJO8ZaiGkl0ZRZmxR6G3r9UpYUInun0R3UvmgrnOl+Re24A/YSEjOaF3BBUki6MJ7ZjMeM9eHJbwdaVJCZNzwvzQrpNVwwNcPj/blKp4LpBxdf60AFC5V5h8Yd230yw1jYhge9W2Rj3U6+gkcK2/UU3BTVwSw3AV98PSQCHUO8cErO9W5cRIuvrciREv1d4efJY0yECU8uwoznSK7+KD1EHy3kwuhp0+3cCbVkK5Fb7N3WIxe+C6APoNXLa5ZAiEDnJhBXxbU9FtmayOk29MvREnuj0OqneqfF; 4:iDLXDuwVMOVTcSeaFAsRZdDTQqdVRs2adwF14LsoPxmVf+dgEuxxWt/7KI2n3RtihM7jGOZ0GSlAlsINPmWvlK59EKy6c0WWeCinm56nlwnxgM2uQx8Cq7U/ogcVuFREdyBzTLlDTljRFrDP58i7jIN/mY4+qNt40gLpjJonno/yYY32/jORFkpkewt25vlOgOTzkN/z5ZXlrsYH8JTfpsEZRnSn0k98R6rhmnM3rgrYT28oLAK9IVXCTo91pr9X4QdwQRr+mcJZ0DKgjd4ZHw== X-Microsoft-Antispam-PRVS: <VI1PR05MB4190A20E955D3D978C360F64DB6A0@VI1PR05MB4190.eurprd05.prod.outlook.com> 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)(3002001)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4190; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4190; X-Forefront-PRVS: 0682FC00E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(39860400002)(39380400002)(396003)(199004)(189003)(118296001)(6486002)(68736007)(8936002)(53936002)(4326008)(81156014)(81166006)(8676002)(7736002)(106356001)(305945005)(16526019)(47776003)(97736004)(107886003)(66066001)(26005)(486006)(5660300001)(476003)(6496006)(51416003)(76176011)(52116002)(48376002)(2616005)(11346002)(6666003)(86362001)(2906002)(25786009)(956004)(446003)(50466002)(478600001)(386003)(36756003)(3846002)(6116002)(16586007)(316002)(105586002)(58126008); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4190; 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; VI1PR05MB4190; 23:BJkd3rCt+HER5X+cNMIKG7U0R1C9/1C3HRPVmPkcx?= =?us-ascii?Q?WAF7NKIw/yOR3wzD3MWiPJdLW5AFy7hqLgcp59Bxd6QGD9/pK38i89MvJ176?= =?us-ascii?Q?h+EVPfOS2kFQ80Uq82DTqakw/7tcUUznCbWyRUrGPYT3hz1LEcHvU+RTRvm6?= =?us-ascii?Q?shAWqzGvBaZ65FiZJQX+RrwXwJfVZ8p1Ql5hQIolkGvDJ+/FUmacT5gbxWku?= =?us-ascii?Q?8Xot1FNfx308yogEDVk2vFFHh73pehDL3wQj7hQ79G8c4FDjKqz1A7ebSuAp?= =?us-ascii?Q?qzxovDjrtLbuNN17lVamR79wANoqKVNa6gr0jTZEQR9nN2v9JGbNK8L3xkea?= =?us-ascii?Q?NKGIsh47m5iAcNu+KpBKcwyVRfKvADm8EiNtnQR7aSouaME2uXF19/ZSVbM6?= =?us-ascii?Q?F5mQhYJ4r+OfIDG+BTo3aLND5c2JYJFQ7FJxbeFkaWj5+mKmJ8ja65gdPKSf?= =?us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k2QL2DnABwoXZrWOnVyP2BdjINvrS3tuzwOs4deZZtP06x4OZ3AY8JDG57s0+VrMKi5pzfYsWdE3qfrNCz/uPta X-MS-Office365-Filtering-Correlation-Id: df8dfeb0-20de-4036-9d14-08d5c182863c X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2018 14:27:47.9352 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df8dfeb0-20de-4036-9d14-08d5c182863c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4190 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kselftest.vger.kernel.org> X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 11c481c..e78ee7e 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -472,26 +472,35 @@ tc_offload_check() return 0 } -slow_path_trap_install() +trap_install() { local dev=$1; shift local direction=$1; shift - if [ "${tcflags/skip_hw}" != "$tcflags" ]; then - # For slow-path testing, we need to install a trap to get to - # slow path the packets that would otherwise be switched in HW. - tc filter add dev $dev $direction pref 1 \ - flower skip_sw action trap - fi + # For slow-path testing, we need to install a trap to get to + # slow path the packets that would otherwise be switched in HW. + tc filter add dev $dev $direction pref 1 flower skip_sw action trap } -slow_path_trap_uninstall() +trap_uninstall() { local dev=$1; shift local direction=$1; shift + tc filter del dev $dev $direction pref 1 flower skip_sw +} + +slow_path_trap_install() +{ + if [ "${tcflags/skip_hw}" != "$tcflags" ]; then + trap_install "$@" + fi +} + +slow_path_trap_uninstall() +{ if [ "${tcflags/skip_hw}" != "$tcflags" ]; then - tc filter del dev $dev $direction pref 1 flower skip_sw + trap_uninstall "$@" fi }
A mirror-to-vlan test that's coming next needs to install the trap unconditionally. Therefore extract from slow_path_trap_{,un}install() a more generic functions trap_install() and trap_uninstall(), and covert the former two to conditional wrappers around these. Signed-off-by: Petr Machata <petrm@mellanox.com> --- tools/testing/selftests/net/forwarding/lib.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)