Message ID | 970cb8b551f874d75ebdedd9dbbccce633f3a4bd.1529492104.git.petrm@mellanox.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Ido Schimmel |
Headers | show
Return-Path: <linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.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 1FB2060383 for <patchwork-linux-mlxsw@patchwork.kernel.org>; Wed, 20 Jun 2018 10:58:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11EB728E0C for <patchwork-linux-mlxsw@patchwork.kernel.org>; Wed, 20 Jun 2018 10:58:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 068DC28E24; Wed, 20 Jun 2018 10:58:17 +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=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E7EE28E0C for <patchwork-linux-mlxsw@patchwork.kernel.org>; Wed, 20 Jun 2018 10:58:16 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 419hdL3DpTzF0tX for <patchwork-linux-mlxsw@patchwork.kernel.org>; Wed, 20 Jun 2018 20:58:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="bsZ08YtQ"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=104.47.0.55; helo=eur01-he1-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=<UNKNOWN>) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="bsZ08YtQ"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0055.outbound.protection.outlook.com [104.47.0.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 419hdB573CzF0nB for <linux-mlxsw@lists.ozlabs.org>; Wed, 20 Jun 2018 20:58:06 +1000 (AEST) 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=pELo2C60/9oR0U2JJqvzr0tAl+pWTAmBbDYUrm5K4OY=; b=bsZ08YtQlHM1iFNUrcaBVRATkxxhMN4z00vYHaHwO6OYK7UEnYFxBrLLKmw7qi9ZfclHpiDa3FfDARVCnFQlstuSqoyAwkjrnyPqcD6CqRQXau0ME4hiW4zF8v0OAXyEreMELCCPzZH+m4CgtcPW6Pya+ojdRrof09C2b07u54U= Received: from t540p (78.45.160.211) by AM0PR05MB4180.eurprd05.prod.outlook.com (2603:10a6:208:57::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Wed, 20 Jun 2018 10:58:00 +0000 From: Petr Machata <petrm@mellanox.com> To: <linux-internal@mellanox.com> Subject: [PATCH net-next mlxsw v2 4/6] selftests: forwarding: lib: Extract interface-init functions In-Reply-To: <cover.1529492104.git.petrm@mellanox.com> References: <cover.1529492104.git.petrm@mellanox.com> Message-Id: <970cb8b551f874d75ebdedd9dbbccce633f3a4bd.1529492104.git.petrm@mellanox.com> Date: Wed, 20 Jun 2018 12:57: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: CWLP265CA0205.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::25) To AM0PR05MB4180.eurprd05.prod.outlook.com (2603:10a6:208:57::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 86f69627-ac62-4482-8c64-08d5d69cb0b5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4180; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 3:KkNWGghczZhNWHBgvJNDvsgH2VztcPyihKQiLXJ+6QAiFa8Fq0ys8r16Ls+JWk1JYy84w9wYxNDfe6v8Wzz2HL5DVzZbO9gODWeJY7I88S7fkvxdCk2W7bX7KbZuMkoXtjAdCxpiy7pTYURYvwNRpEQtVs5/wuUFUMp8gxCrdVvzdG21ORe1pV7zOXha14rwlY1b0vqpTLAPBEiwVp5cliCvZsOuVGXS5A4xCQwQVNQoa1X92YEDXWLfZJ587SZU; 25:3Y1S0wQTXrOy5UeY8vS+6v6XMWY59adJ33T9FWFo7j7mR1dQ3dNk9Luaq/8wJmnFdt4cPYkKAiHATIuYa/FC5qtv4SxxOEDhW/8aeoyUucC5IVb3xI1KJ9rXKCAKptmr7xZ06RlryWHkgfvQCs85H1bHUmhOdxyTtfk7b3nH9Bgd7TPqQle49oZBORwh0mTy3DQ1VmmBCBufC3LpWHQChr52kvYQZJk6+NDP/+DYRCEXNKyO1usH245hLvDDk0QJyWyDRRKl5XY09DXFR7DMnc/hOnBSJc4xZqi1NjBHGU0hM99MLnJyOsPBsBhIXTfr7gUZrG0tCJmWX2FYlWKZYA==; 31:k/iWZEd/Px6A1FTaXjJvEV9u1mhHIP8Dm1Uit1nlyOyH3J65E1xYYz+TZoSrdEAbESrHk++Ul5/2TNOizyhFRLKQ2Dk+/XQ1pXvTV1X+apqLSL58EraqNVVJipz/y6dy8JmVJRWSmj9xEEp+3jaNZYUwM4E2flO2Z5cUGLnqgreTPVr0eaWROAfFgSGYlh3Eu7yJCskYL+FEr5J6U3Xe2HklmhXhaqG+4rJ+6GHqjU8= X-MS-TrafficTypeDiagnostic: AM0PR05MB4180: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 20:MyWWnDm0VDO4Kfg5Vvo51tBLaUTLJkyojljjjUc0jQLHt7rQBuJLvQk+CNxok3fe0dLxCndAUiJkhUU8kxlI7EICzk1NVHLC7KkZOC+nbV2XxbkDexWQB6+lu1hCVrlf5Jsah8wrk3xkLQ7PY9gGu28W34OxQMq5O8EHtww5TZgocdt1dTExX5nvYgdYSxszABjbBU1xnj7/62OTQJh9lb/MMxYKh9VsGq8+vsub8eSGVMe7G62588jo+5lLNKbOve72oZGDSxfp2PAOGKBbtajXkfjplcTRA4mcMuGNeVcyhwZWCaKoWuW2VwL5lZCjCom+CR6rmysMiWBBEdqDkG6kFHp3qq8rMmLvCvP/pwHW+VT+uTczefpn5ejiaSoAV77yQxkf14AJQwb80fooICwlckSIBdxLtFBAGZDMJu5J62GlKK3Lj2VQUdgl+OukNGXgLGTyGU66QGOWIlFPrxaGVQ/0sBxqGNQjmReqaNEYrkpo3DCsOac0Pm2k+Ly6; 4:9KqJei9oNO6ZkpGgFObSxVbC8LkLDx8id+CTwOsA0Av+PjIPmT04ji49pg7FHmgo9iCKmucahTo13DAiRIP2eSrNkUjlQ0hRmI7/wOLgXwZD3i2EKob/geAzZcPw7KAdQ5mcDv7UT6sLq13sw1rS7Ne3mk0AwhIKrQXcYkpFzAXvzarHwr746ZwV7fY5u5O/VE1NIocp9fiLTHZzodgOfns3bO9TD/P3z7ZSgsuK+47rkEDzldalL2nwHNjrVFjQX8uhsYT0YN6YvmYsmHtYAg== X-Microsoft-Antispam-PRVS: <AM0PR05MB4180F1D6EA1C8615D4B4C949DB770@AM0PR05MB4180.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)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4180; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4180; X-Forefront-PRVS: 070912876F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(376002)(366004)(346002)(396003)(39860400002)(189003)(199004)(478600001)(105586002)(446003)(11346002)(186003)(2616005)(68736007)(66066001)(97736004)(6666003)(6636002)(956004)(386003)(106356001)(16526019)(86362001)(476003)(26005)(16586007)(37006003)(76176011)(51416003)(52116002)(316002)(36756003)(58126008)(6496006)(5660300001)(6862004)(25786009)(6116002)(486006)(118296001)(81166006)(3846002)(7736002)(2906002)(81156014)(47776003)(8676002)(48376002)(53936002)(305945005)(8936002)(6486002)(2351001)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4180; 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; AM0PR05MB4180; 23:XfmByXVrJKMYCNIYEe3yoqBbLUN0MH68+5JZnXzJe?= =?us-ascii?Q?1CHBqzJIHzRCqGl5IJUqExFaGFnkPeAevV7IKnUDRduQ3/rJt29mh7IwqjY0?= =?us-ascii?Q?cmPN0n7ZXT1yrTPJkVfoBVd+aIJm+kzTKoXKujOUl6FV06Ar9Aom7Cx9RE+L?= =?us-ascii?Q?IUWfCvbY32TI/ri/Mm743Xh8HwbmG4vtOWA7M5Iw7hhYCy6Ep1PhPT0RRTs1?= =?us-ascii?Q?947LB2JPCcy+W/+2bjYIxAOC9pfKV5EiSHAL3dBg1/4W7T7258mFJXhmh6W0?= =?us-ascii?Q?1wEZysFAoe79K4l67kC5Vox0VSiBzuWrCsf4TRGgQ2jHiA2+QdYd7Vbt35hH?= =?us-ascii?Q?z6O1CyRyAKTb7TokZblwQ2aG8RlmZpvJoQyTvth6Y7RpY5NB8SzAO+5SNDja?= =?us-ascii?Q?B2xX2rzTCy+kRgauG37xQeJG2J1ql5Tc85X11bRqqTENnicVdtUv3Xd0mcGQ?= =?us-ascii?Q?3U5tDAnfgvARdZqIwn9Df91BpY58OW+DuGF9ZggL1SJhZ3eKUveaAC6vCZTm?= =?us-ascii?Q?EhgfQATc1P7/DVQPIn3hVvF9WGaUODMcQdz9wW26KgjsFt8BnFUZXH18ykRI?= =?us-ascii?Q?eCAUUlrf0lnBTA/j/NmhysdC+lxmRHfDnxsvvnBM4s1s9LyJMTcGQSrDr7mc?= =?us-ascii?Q?J+3HVXifYdbU/KTFGoS0LGLkrw2t1YycYyDVl4T20L9Nqpal9aWzpP70gQT9?= =?us-ascii?Q?QMEPjk6JJdRpIoo2MGZ1Iw23XAvuWy49avSINKjNfL7hvb3aa4dLQwimoQCB?= =?us-ascii?Q?BkeLwJQ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9mk0plIkS+F5nHFP2maxYlbTpT8Mftd1+wT4OyOL7YPTugQkkMMfb/ZvtF0g5Lrq4te9qlMUadeDafPycYJJCV+cLhw9ZOb0Yka37cmmKkFRwt1lNe6SYd5xAHVB4p9tbWGBnmdgwcixuviqJEcrgkcGXtmzSQpn2XJVIgfxdC2aSmg0E3TTv15Z0ShTD2nPSpI3k8+hy529/GVHjwIzbz3q4zT3DHaSizHqfi9wcCpQ24AgmpImAX4Jfd36n2jF9WQI/oeB10VHBbzutg0GmXCnOiT5Gk+8iUv4Qzix16BPM8Yw29bJETVpNV+mXdZR7hYqTpxClRcYnzIwV0oUt7Jwd2AYKHRslYlUfRjJTepbNINpU+bJ9dx41OXS78vQWWNz9Q==; 5:18ZUW+N7tTQNDhtsLocka+xqncm5Q3hhuAO85uwXafhPmzvOPULP6Cp3MBMq0dxfyURh35JsrnM4w0bkG0pX844rDLjPAHipOi6MRXc/k51Ncobk6Hu1be9h/QIHRogv4xbpF1rirVdsn5wTOXu+8pr+e4OLg0GGscSCiJnTLTk=; 24:H3+em+tZFeqnHSbH4lf4TI498LgenOnIDUj2q6Mw4TuhHYUlU8RfNc6seTqjnKbHAh2LOehZXiOWBeW4e3gaIEyaT4cTIVis0ZFlnKVNoi0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 7:5CqqzE+TPM++RwXVvlwPCrR8NZUmhLyJWI0SxMA+4Y+HmoPRphg8m2146qFTqS2TZXFmvO3Gb5QiHjElO3QZWX/VeXBeJhZa5azx0TJbu6JOGEUM4mDWPB6tBP83YzRsUpvsJW3J/fN270fYTYVgkqVKP99FTDUhaxkjwpz9De5WcGdS1H1J8Hrx4kCVetM2gQ8zIzfE4kciynuLsoEiUC0V6cINUunTDcw2eIA8vDcl3AxVE5APSWoVh6F1VyPX X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2018 10:58:00.6350 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86f69627-ac62-4482-8c64-08d5d69cb0b5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4180 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development <linux-mlxsw.lists.ozlabs.org> List-Unsubscribe: <https://lists.ozlabs.org/options/linux-mlxsw>, <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=unsubscribe> List-Archive: <http://lists.ozlabs.org/pipermail/linux-mlxsw/> List-Post: <mailto:linux-mlxsw@lists.ozlabs.org> List-Help: <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=help> List-Subscribe: <https://lists.ozlabs.org/listinfo/linux-mlxsw>, <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.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 51e45a2750f0..932d25761a14 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -321,6 +321,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 @@ -332,11 +355,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() @@ -349,9 +369,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 }
The function simple_if_init() does two things: it creates a VRF, then moves an interface into this VRF and configures addresses. The latter comes in handy when adding more interfaces into a VRF later on. The situation is similar for simple_if_fini(). Therefore split the interface remastering and address de/initialization logic to a new pair of helpers __simple_if_init() / __simple_if_fini(), and defer to these helpers from simple_if_init() and simple_if_fini(). Signed-off-by: Petr Machata <petrm@mellanox.com> --- tools/testing/selftests/net/forwarding/lib.sh | 32 +++++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-)