Message ID | 5c9a2c980ce03e57d6fc81e819fe2816a45f73fc.1529971148.git.petrm@mellanox.com (mailing list archive) |
---|---|
State | New |
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 71E6D602D8 for <patchwork-linux-kselftest@patchwork.kernel.org>; Tue, 26 Jun 2018 00:08:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6335A28619 for <patchwork-linux-kselftest@patchwork.kernel.org>; Tue, 26 Jun 2018 00:08:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57D5D2870B; Tue, 26 Jun 2018 00:08: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 D691A28619 for <patchwork-linux-kselftest@patchwork.kernel.org>; Tue, 26 Jun 2018 00:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935100AbeFZAIL (ORCPT <rfc822;patchwork-linux-kselftest@patchwork.kernel.org>); Mon, 25 Jun 2018 20:08:11 -0400 Received: from mail-eopbgr50045.outbound.protection.outlook.com ([40.107.5.45]:20448 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934290AbeFZAIH (ORCPT <rfc822; linux-kselftest@vger.kernel.org>); Mon, 25 Jun 2018 20:08:07 -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=dcrONOQ+RgKeRJdRsP3coo7qC67k9JmUO4FxglZhhUY=; b=Cy8C5nwSHA+D/pospypUdOOgM5lZzutnJ4r+IO7xl2O2WkteIvxzwN20wL+0F9HGWMhs023P01rcyJOcopOmeDIkM1jcF2OHZsRthPfNKhmyAl4eF6jIEYJ2mBtDeoPYVB7MCWOsd/We7Es5hVy7erlxICUsyq+et9TydBKucHI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (89.176.83.59) 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_GCM_SHA384) id 15.20.884.23; Tue, 26 Jun 2018 00:08:04 +0000 From: Petr Machata <petrm@mellanox.com> To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org Subject: [PATCH net-next 4/6] selftests: forwarding: lib: Extract interface-init functions In-Reply-To: <cover.1529971148.git.petrm@mellanox.com> References: <cover.1529971148.git.petrm@mellanox.com> Message-Id: <5c9a2c980ce03e57d6fc81e819fe2816a45f73fc.1529971148.git.petrm@mellanox.com> Date: Tue, 26 Jun 2018 02:08:00 +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: [89.176.83.59] X-ClientProxiedBy: CWLP265CA0114.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:51::30) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4a4b88d1-a32a-4419-724f-08d5daf8e3ca 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:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:oxUwczzuRtI78wgU1kprJe7D9q3eUBxfixAOh0q01bJU9TvLMZqbijnF3nrj/hdUSmJxkcYxVRbqfJ6eqiolpl6taydQroqshhNg4F1j5uJxFmHmQseid0JxiC9ft6lzsjYrRMM0cCyCjC6GF1qufIPwaxouUwqNA7HQBxApWgE44GWeBSArISO+zxceFU3OcadDKVH7PJToUdHXftVvFZqS1qSZJ62zhpjfso/DE8/e/rNIrdL+9I9iNuxw+t10; 25:ysz2yOoL3DRpppiAcSWwBQWY6iLlJdSGtJdX6jh7Fd+31D6x1fNx38YYfE4n68iFAx0bW6HhTQV6hCTbUUv1yDgl5uyiBaPrI49EAtLXKJpvLubWJeK6M2NEiS6QzvvdoiA2Q8l/I6giDDRxaybk1lnHzLnq8KNvtsD/liwZliJbdowdVWdtOV0uZO2+io8cXX+5J1ERbqNz6GnCfbM4OHZvToV8A4Jud31c7jOVDopolIZNAmlApEe3SxGCr+O5mNGAVeoAOTzDVfbo9tlTQH0/XDOPYz4yEu7yClhb3l5oy7IzJx4dHGJsVcs1whjHMkfu1kt/i2j3clyo6IcTzg==; 31:mby38XVstRLIm2niG6u/V8LvF8kDuhtK9FCCjJ+dFBsiL7U9VmUc0mBjCYmqa1QKHC8MCWwALbwdhYE5MHgrpKcGxUjHGLDmUF7YL4cQX/kQsV71ceOd4X2tPtkK+jf2tC/dgeXNZi1aHneT+vSPQw7xoaY41X7djaBzsa+UvJYroQqof/t5i9n1y8UaAaS60y014FK1Sj0iIXEVXC3R4i+q3jkWNANv5OwMdYC4h7w= X-MS-TrafficTypeDiagnostic: VI1PR05MB4191: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 20:59A0MkYU3Qey75Mta3QGF0hoZKF1S3fvD0tT3VTDb2QwBCGq2yrSAhkHTGR39PPlWbRtTBtZh03rH7GiFw1v2gH/4vSc+k3HMievxN6ljlhmcgtYp/g8epNtHPv80URS7mydvGrFGG5X1CG7YxOJwar4jVJWWwDHzB2+RzsCZUdwmNuos3TLu+UgfPMQKWNBFo4LPSghwXHGeEYPAMKF9tKVlqEk2lag1dU18RVyMcV8CPw2+QZvrT6ob6aGrZ5jlm86KDInTCkp4NnW767uASb+24xioG3iK3yVlbdA4O2AUGHq6tzRmmVLlPsRhB6daA1WncTjmi5jGru22Tqm89JgnhPreSruZ1o6lf1NWD56T6jBoTU+JX/veahH3kF95kaCH3Nx8A4ZOkEMuRIelcSbakFUfMA4gZGVZRwFlNjJd0EvNQFYENhBMkr6B33vsm9nJzJy+tm7aQOMtLKl8mQv4l614xd925bdguQRett8hq2MGf4triRVv22vfiXi; 4:AiLTwhc5YzHRZh9kyO+Tgr9dOkU02xnoFAwXmnOWkQQKj0pYpOUwMCB8Fh+wGQwhuXaSpSdVzoontXk5qyamyiz+w//YxBeDPegWGSRhylk8MUKdeqnE86J9qlnv1uNM8/NFHuUDawEJblXvOTMw80jZ8cIm5QY5nhPffryosV3JA7ikOcv9rhEYhpp0ZkI5UzsHerre/cwrEXhX+xni3U8m1WN0ym533uBh4I6/Z9OdwXJot3G7lp2dsuxf19GYA5jGUhulfeUiztYDAqv9/Q== X-Microsoft-Antispam-PRVS: <VI1PR05MB4191246D90C010A403BF2A94DB490@VI1PR05MB4191.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)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 071518EF63 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(396003)(376002)(366004)(136003)(189003)(199004)(446003)(6666003)(86362001)(26005)(186003)(5660300001)(97736004)(11346002)(16526019)(486006)(50466002)(36756003)(386003)(76176011)(2616005)(476003)(48376002)(956004)(2906002)(6496006)(52116002)(16586007)(316002)(6116002)(3846002)(118296001)(47776003)(6486002)(66066001)(68736007)(53936002)(106356001)(305945005)(7736002)(8936002)(51416003)(8676002)(4326008)(81166006)(81156014)(105586002)(58126008)(25786009)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; 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; VI1PR05MB4191; 23:BVAgy9OLFiQyEeF7/6qd7A3MByig/NOFF+nBxdN8N?= =?us-ascii?Q?Xa4y/kqckS5RcRqakrN9iByX58CIxYepUHI7/I7c57ty/YL1k/NiaM2UA3VG?= =?us-ascii?Q?PJGqNITxCwGu8OjW86mnkbTHID5N54b+N2LW7z5Cj/Z2pWwBLE3dnYvD1MrK?= =?us-ascii?Q?pJ4GLQBTLzxYVuOZn52aYwZXhu9BYpuGVPDPISYqjyl1VcVC8w3HQ1twJNUg?= =?us-ascii?Q?XH6QBZ9wzBb+4E3798MOGeEQvIS5VN5VGxehm0yOmNelwb1DJ34BxSL8uso0?= =?us-ascii?Q?0X5PQYVV7JBcUurjoS5bSrlpxk3yYUaq5phK3avgg0ZtLmE/VktrZ48qNhHj?= =?us-ascii?Q?De9mGjKEZIBfZ8LZaRjOCQVHPqLUSAhrZD4OFpQqA5DHGA05d4fQuCdPGALR?= =?us-ascii?Q?cu0iRh9BKsdete23112z4/CeXIA0dmAX0+xeKsWtFpd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qw9TQDJng/ZroVwvdZVdE/ze/AaBcCpC6++7Yjtn2TsuSInegire98qtEYY35Kv53X7QfjQr0AJGe3dEsJk43t/nsdFpvfvF4n3EmtNRi1KhnVQDekNLstRhROernarhGrRw5IVTiI3QPpNit0eLgnhWUONC6FbQr8aFMe64hQ7BQ7F7cjxYkA+TkrTugDHWA769bpQ3oJ758ky/mU4IxFebtdAHxTgLnZJo+QrxqaFyzzSYc+fGR X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2018 00:08:04.6702 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a4b88d1-a32a-4419-724f-08d5daf8e3ca 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: <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 f94ea4bafa13..1dfdf14894e2 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -287,6 +287,29 @@ __addr_add_del() done } +__simple_if_init() +{ + local if_name=$1; shift + local vrf_name=$1; shift + local addrs=("${@}") + + ip link set dev $if_name master $vrf_name + ip link set dev $if_name up + + __addr_add_del $if_name add "${addrs[@]}" +} + +__simple_if_fini() +{ + local if_name=$1; shift + local addrs=("${@}") + + __addr_add_del $if_name del "${addrs[@]}" + + ip link set dev $if_name down + ip link set dev $if_name nomaster +} + simple_if_init() { local if_name=$1 @@ -298,11 +321,8 @@ simple_if_init() array=("${@}") vrf_create $vrf_name - ip link set dev $if_name master $vrf_name ip link set dev $vrf_name up - ip link set dev $if_name up - - __addr_add_del $if_name add "${array[@]}" + __simple_if_init $if_name $vrf_name "${array[@]}" } simple_if_fini() @@ -315,9 +335,7 @@ simple_if_fini() vrf_name=v$if_name array=("${@}") - __addr_add_del $if_name del "${array[@]}" - - ip link set dev $if_name down + __simple_if_fini $if_name "${array[@]}" vrf_destroy $vrf_name }