Message ID | 142136c42b9e83517e36eba2709b5d3025e79a88.1529013676.git.petrm@mellanox.com (mailing list archive) |
---|---|
State | Not Applicable |
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 34AC66020F for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 14 Jun 2018 22:18:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 184BC28896 for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 14 Jun 2018 22:18:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D65E28C2C; Thu, 14 Jun 2018 22:18:12 +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 5793928C3C for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 14 Jun 2018 22:18:11 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 416J0d4VqpzF116 for <patchwork-linux-mlxsw@patchwork.kernel.org>; Fri, 15 Jun 2018 08:18:09 +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="u5S17kqf"; 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.66; 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="u5S17kqf"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0066.outbound.protection.outlook.com [104.47.0.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 416J0V6wLWzF0sk for <linux-mlxsw@lists.ozlabs.org>; Fri, 15 Jun 2018 08:18:02 +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=fBn70uUhkb/lszY4ojIfLFjbQ4w4AuGxiTh3QkVWT6Y=; b=u5S17kqfa7X7BQIURDAxMs7Jafd+3t8S9HGUpE5COMqZULLa57xP1aDtjz4v/M6w0zc/HQ6gEsryVJQ+7WXOTWPEjCfyk/h/2Y+a0QjydFaiS6wBGQlvoyQeB8eD3ryiaazQi1Bthm4HXiKBZJLfUS8oMiJC7rFN7c2UUrKCvAU= 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.863.16; Thu, 14 Jun 2018 22:17:56 +0000 From: Petr Machata <petrm@mellanox.com> To: <linux-internal@mellanox.com> Subject: [PATCH net-next mlxsw 4/5] selftests: forwarding: lib: Extract interface-init functions In-Reply-To: <cover.1529013676.git.petrm@mellanox.com> References: <cover.1529013676.git.petrm@mellanox.com> Message-Id: <142136c42b9e83517e36eba2709b5d3025e79a88.1529013676.git.petrm@mellanox.com> Date: Fri, 15 Jun 2018 00:17:53 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [89.176.83.59] X-ClientProxiedBy: CWLP265CA0216.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4e::36) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b520edaf-3fae-4d81-f9df-08d5d244ae8e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:EkcPxWgPsqmzJZuwC9crijSJKQvjACtbk+V6m33itcSLmqKR4BF3rlZ8x7JQ0QObwG6pd8pDTuW822MiU6jB5TDy9fioozB0NDpipPRfBxB13QIKYWzevK/q56F18S7isIteNAtjKTZEpplckS9usixEHYRqcq7B5KpJvZh8yKSiWCm9DKMeWxQcM/Yxin/d3+K1BOqgqq8dlmTM5OZsTZoP0vXaigirTVi/SLrwGfAdjXrPpru19LfLWS7V1tLp; 25:PoSIslnInpwGgOEQf7wX6VhL4WUH6Q3M26FWMjRExEqrgU33v5kRQq0Cf+OksHCn5P7TbQf40lVhUPoEqFJs+Hy4dP8d0VknMDTWjEVN2GSN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GpYhu5SNYC6vaA37isB3Rgq7cetFX3/PN2nKUPGVuSVLl1eJEyySzFqCeQ1aQyx6rhirlzalAxY9bXWgmBl8pg/Irn3rgQO5Srn2Htdn9GGOmY9tc2csnn39LdVBj+VfP6IVbVH8+8GzUzaPnEGpQWO+7vRm6pXtAsUrFxzYdtmBpZJhmE6LCFLrNxBYHkUYGcs9/EitJiSr9P1UOZwhaublcoxPu8HJDkZMgNLzW8+zGgNh4CxGikcbfWqWPeg== X-Microsoft-Antispam-PRVS: <VI1PR05MB41913FA36CEFA104CC5B9B13DB7D0@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)(5005006)(8121501046)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(396003)(346002)(39860400002)(366004)(189003)(199004)(86362001)(16526019)(53936002)(26005)(25786009)(50466002)(97736004)(68736007)(3846002)(6116002)(2351001)(186003)(6862004)(2906002)(36756003)(106356001)(48376002)(386003)(6486002)(11346002)(105586002)(8936002)(6496006)(446003)(486006)(305945005)(81166006)(81156014)(8676002)(5660300001)(6666003)(6636002)(2616005)(76176011)(118296001)(476003)(956004)(51416003)(52116002)(16586007)(47776003)(37006003)(7736002)(58126008)(66066001)(316002)(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:Z5OO3NixMPVI547x8AgbxnoLEJKvknGHGl58GezbL?= =?us-ascii?Q?QB3zHUB9p7Jd3zbpGgyxPgbRdE/QFBQoXcKFD9gXFqywH8S8EIJcsApkQrC0?= =?us-ascii?Q?EO0YZSoLjmVNSFCLJF+xS4EnEUwNRhs6DS7ROBL8FFMBr1e3cfChVzNrGVIt?= =?us-ascii?Q?76yiZB2EUs0PP5DJZc9QDlvTp7QvO5rVUerB0hldIUBGXEK1vPEPAC6lTUBV?= =?us-ascii?Q?iloSvPV4ginp85vw5HMgsl8emsOW9neGUb2cPF7jiX4ppONxxB0w4NteqAJj?= =?us-ascii?Q?6eaJ5zqyeg3T515wNxXbLujKTyWwAaEAaQwQfYBsibsIoYymYy0NeZm+wsqc?= =?us-ascii?Q?oTKD/7W281hc0cB2e1bDAn9ynCqyxpSNWbjDFXIAeU38UQewbTyZKPiLG+S7?= =?us-ascii?Q?cNuFYUi26Gj2HNQJ/w/GTBpyn9mzutaDM3U2IfQsD6ZjlyQzzSXkb17PRCsF?= =?us-ascii?Q?Zdn375n/wcX9060t2c1ko/7LRr5hDaHU6C9Sl51/nRje3yVRwapzFdyW5SLz?= =?us-ascii?Q?Ey2oHEfcVFpqR6ff+EnWFWmuHnDTHujQ9ea7C1eHtU+ca0T3tv64fQ157TUU?= =?us-ascii?Q?y7AO91LYXYTUk4eNZQ9CNupdD8AsJJkf/GjwBa9km5hdFzYjzqDzSwMI3r56?= =?us-ascii?Q?SmRNbgCNetAe3k7OdcBRA52hK73mIkKr/lheVTjeU3vKSH0uV02oSgS8X1GP?= =?us-ascii?Q?6aHu4HB6fArWCOJGVvgU8gplVMerybedCA+MsMg/PhXwsWfSpMAzwh/rnyxg?= =?us-ascii?Q?EGg2jFA1JtHkZOQc/GAC/TqWpH8vN+DzOGDNa8EfPAUDgml2YkeTJlffmljn?= =?us-ascii?Q?gSdUhiho8YUTW5tlRXTN5rGKa8yEp9wDhvvs8+UPExdFf+WneS085uCX0ufH?= =?us-ascii?Q?I+MrCW82BDEJtqTzCSb9l+EtyGSeq64F5ShJVHkGvJjzx/lMcC7oAXe0rQhu?= =?us-ascii?Q?M0G0YjDk16aYROwqvEAKR0OH6hNs/fsyNZnKXBiW6LcylTqgNjjVISyE1QH3?= =?us-ascii?Q?Deet7t52yGIo5889fDebUwa5+QMEdi17aBDZ0n0ufXf8X1HLKUM+zu89Wt5u?= =?us-ascii?Q?fIpNWkzE9aK3rLBzXgVDxQ2wT+560/c+jEbFKkk07tP0dh+dyn+qRTU5BJqp?= =?us-ascii?Q?lB698UfuxhukqjMArOLfUsvJYiBmUKZipm28AUVIEqa6rzASil6z0FEZvuwK?= =?us-ascii?Q?cijhTkcP+LsJXEkMQA614C3BA62inbZJx3P0XQ3t5d/knWQs50wzqruqA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: sBNvIMmtqL+ItfwB5Nawi4hM9brLqjCzmWAiEPCTDxQiN06oXNztC3Xvo9SMgJlZboBAtFEgIU5pS1Epo26rfKXar75yL17eAFKOcx7OmMBilrfnOnu7/c67+pqvQf/BPufQViaRVyjaV+QmZHss0y9GESyZv5yXxtAlxbHgZiVopJN2oow+WcX4rTFzPtAh X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 6:lFSjI7rzFyDlvCM+GXDthAIO7wGX7pJwhuTa066KhV8kbHd7vhH7K6UC2IbMQUNt0w/Z0Ej5PShSQovNyCOmnVvH/di2d4gCjXiZEnvYRBhUfHe5noqi0yJUXfKHJZUn0/s+QW74ll5HMp3KQibIXhOYHnVJZlE0PWRmhPyygg+LwBRw4RnQ5Jt8czutc383+9mjmNPMX1QWwgc15AJRfrC9Igqnf+i5fbmJpxDRhq5xejZqYna1xbyNo+4ulLK46Ght8KlY2kp2V6QJtAtQs6OY9VNvnWoQix786szzb+TWgWi6UotxGfmt4tATyGpRUqCYGcVzcnvR9F9ILahKW1AsWcFEro718SdR2N0sTXlE8s8vDHWW15NJygHeBg1VjOTB+Mkc9MwtLX4sNFPknOaV/AeNRVZipC4zz2l/CqRxOZxqgy9osueCew4Pi+0zVk2GSMPPpPY/3LhMm/sZMg==; 5:1+a+C1c4sxOmd5upwJkXPfW8demFeZxmhfVQXI0c0d8wUoaE8BY6X3J9fzS6ui+KugAlwBhNPwEllX+/hToSedfA1q4wnAYXOqoIFIE/7/HY691wUkfR73T9QbZGlaloAV3+QSnusZJFFELSZQu2yfJM/T5cCeCVRKGDfm15k04=; 24:MghpizOOHb73ZYhXRSLiVEPcPkjdc18Z0U3jcoEKtNaUz23of+levk2kQM+1EkZgYtHGIvmsQlkDvpQsE/ivE54JxKK3dQNf9Q5F0pIv+wE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:TMu9ZFLYTdsI9+x41i1vr81rbv/CsatQ3gZcYYd6gJ2puODOqr0hBT3BXBQqrwG5Fhimh5dXz+p0YHxxvA7z6lvY3XnS7f6YwJrt+IJMN1rGbCg42rLsgoIAy7uYmfFcelMQsf16dlD+DNtmrCK5JaFE+gbLnHVVHsKfDPJppW24CPetIjwks1rD47ZGu2XKLoiZDxOS3iP410Zd9yNClLr5waC7XoSJ5oUTdJhVbaJJUept/KCYhZp4rYEwyZIb X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 22:17:56.7885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b520edaf-3fae-4d81-f9df-08d5d244ae8e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 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 cdfc8e8b76b2..b48634f3b3bf 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(-)