From patchwork Mon Jul 30 12:45:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10549033 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7A7E13B8 for ; Mon, 30 Jul 2018 12:46:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A681B296A7 for ; Mon, 30 Jul 2018 12:46:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AD98296EC; Mon, 30 Jul 2018 12:46:05 +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 CCDCC296A7 for ; Mon, 30 Jul 2018 12:46:04 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fK7G3gM5zF152 for ; Mon, 30 Jul 2018 22:46:02 +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="mVPHkm8k"; 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=2a01:111:f400:fe05::61a; helo=eur02-he1-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) 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="mVPHkm8k"; dkim-atps=neutral Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on061a.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe05::61a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fK6t5tyczF12j for ; Mon, 30 Jul 2018 22:45:42 +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=ZDBB8TsRSHkUjkKSvMWxO4amTdCA8EVQtfSY3S4cq/g=; b=mVPHkm8k1dIij2OPloRde69RJrt0MPT4Rp6DyLPJcpzoIa2LC9vz37zk5JNxpED+IMcroioEq0uHQxzNEBys9gMalNAcfZuT85wVIp+ykm9XMutIJr86kGOqik0uAcNAASFN6SscesS7JA/rdZHr8eP+C//2P9H2akdOxeoyes4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4182.eurprd05.prod.outlook.com (2603:10a6:209:40::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Mon, 30 Jul 2018 12:45:35 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 5/7] selftests: forwarding: Move lldpad waiting to lib.sh In-Reply-To: References: Message-Id: <8663b5c8afd0cac36c0e4bc529c7d5b7e5b9038e.1532953818.git.petrm@mellanox.com> Date: Mon, 30 Jul 2018 14:45:25 +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: VI1PR0501CA0040.eurprd05.prod.outlook.com (2603:10a6:800:60::26) To AM6PR05MB4182.eurprd05.prod.outlook.com (2603:10a6:209:40::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 187d604b-18fe-47f7-5335-08d5f61a583a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4182; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4182; 3:JVqa7nHs31GH7tfc7r7fgUBcxNEx/Kug+8qXS7csrBCFfqAL1L9mXJDRRPeJjVT+ITo5bH1RjzZxmktd08Li1LGpiU3NV6qM40abW32CDpyGp6+M/EZsb5kvZ5kY0OhQvjuEEFdIDkz5iMQ4ppe+nEzMhaXkWDPtmRWYL0AROxKCjCy+o0gUHK1SXxwTWKSlmF7/tck+g5fIikKLJ7ghH2LO3+5rFZBH2mOh5YfXJZrMFPs+mgUnGgBEq/cQwnrU; 25:w5UhVkhOW2EboPyYszEK/wFaDJUH/Y4I9Mk0w9fypTSr0HhyK4Q94sBKtNDM22rm05xxX4E7gjtUfEisYMNUhNOnBrqPY462qFKHijCXFABgk11MP/5hRlqqQqM7XLfSPjuOteYD0/hsSy8z2uCS+VrzNHfw2HS2huEuIufPRqim8jxgv4gF0Id6+3iWi512+oxiEXegMTXb5i9y0a5ueZ+xNQcn0HmgynJr24JiUgoyzI7hicxsDtwkVPABpIIJP3rV3JA+E21h1Mm9C5g26AtLL0O1Ql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I0BeeVSG2nhA3A0F4drBuqLBMXaPvowz+219d8XZHukvFW2twVU/MnZ2dvY8SFYJtpB25mJpkUUZnA0Lx81Eh/ui8EqIZZpw== 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)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:AM6PR05MB4182; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4182; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(366004)(376002)(136003)(396003)(199004)(189003)(66066001)(25786009)(53936002)(48376002)(47776003)(26005)(7736002)(76176011)(86362001)(16586007)(316002)(37006003)(58126008)(3846002)(6116002)(486006)(50466002)(81166006)(8676002)(51416003)(6862004)(81156014)(8936002)(52116002)(5660300001)(305945005)(6496006)(16526019)(186003)(386003)(6666003)(2906002)(6636002)(11346002)(446003)(68736007)(97736004)(36756003)(118296001)(14444005)(105586002)(106356001)(2351001)(6486002)(478600001)(2616005)(956004)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4182; 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; AM6PR05MB4182; 23:N/y1ToIdF+3d0xPdN1nUludDH472vcM+xM+CmHrn5?= tzUAakE4WpYPcvgvFSy7skCWVXAEaipQKUCA3rMTUwH8hc1S1lb/Tmo0R7HraVrSwLv35PV+41RKsK4BmC1RwhFOCy2zXsfesK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b9Xmc9oF25V7v3jnLZ+hpvhiZ7eeIgOLZA=; 7:VtBbhbsfUQAd1io1k6YAVt/1MCE7mlePSeXLuaIBXdkWTpBVkfmnwC/Y4iEkuwBKPUfascsZFIMls4yAusQK3FiMAfcC9qB7PHfX5QoXOhGr2Ktap/vBaLQwhQ8KtqU6bHAMM8ieWkgiHyIwP5JBl0KLf1ZygcrWMWNKWzTSoKHWbUkqWs+az/WiTtEtlNBE9C7RQRplIB3iGRWXnT3gaoEMhF6+G1uUUj0sYseuajR2mzKdUD23ukZW0380T2Cv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 12:45:35.0881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 187d604b-18fe-47f7-5335-08d5f61a583a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4182 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP The function lldpad_wait() will be useful for a test added by a following patch. Likewise would the "sleep 5" with its extensive comment. Therefore move lldpad_wait() to lib.sh in order to allow reuse. Rename it to lldpad_app_wait_set() to recognize that what this is intended to wait on are the pending APP sets. For the sleeping, add a function lldpad_app_wait_del(). That will serve to hold the related explanatory comment (which edit for clarity), and as a token in the caller to identify the sites where this sort of waiting takes place. That will serve when/if a better way to handle this business is found. Signed-off-by: Petr Machata --- .../selftests/drivers/net/mlxsw/qos_dscp_bridge.sh | 23 +++------------------- tools/testing/selftests/net/forwarding/lib.sh | 21 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh index cc527660a022..9e875ee8dc1c 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh @@ -103,16 +103,6 @@ dscp_map() done } -lldpad_wait() -{ - local dev=$1; shift - - while lldptool -t -i $dev -V APP -c app | grep -q pending; do - echo "$dev: waiting for lldpad to push pending APP updates" - sleep 5 - done -} - switch_create() { ip link add name br1 type bridge vlan_filtering 1 @@ -124,22 +114,15 @@ switch_create() lldptool -T -i $swp1 -V APP $(dscp_map 10) >/dev/null lldptool -T -i $swp2 -V APP $(dscp_map 20) >/dev/null - lldpad_wait $swp1 - lldpad_wait $swp2 + lldpad_app_wait_set $swp1 + lldpad_app_wait_set $swp2 } switch_destroy() { lldptool -T -i $swp2 -V APP -d $(dscp_map 20) >/dev/null lldptool -T -i $swp1 -V APP -d $(dscp_map 10) >/dev/null - - # Give lldpad a chance to push down the changes. If the device is downed - # too soon, the updates will be left pending, but will have been struck - # off the lldpad's DB already, and we won't be able to tell. Then on - # next test iteration this would cause weirdness as newly-added APP - # rules conflict with the old ones, sometimes getting stuck in an - # "unknown" state. - sleep 5 + lldpad_app_wait_del ip link set dev $swp2 nomaster ip link set dev $swp1 nomaster diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 843a6715924f..90af5cd23417 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -247,6 +247,27 @@ setup_wait() sleep $WAIT_TIME } +lldpad_app_wait_set() +{ + local dev=$1; shift + + while lldptool -t -i $dev -V APP -c app | grep -q pending; do + echo "$dev: waiting for lldpad to push pending APP updates" + sleep 5 + done +} + +lldpad_app_wait_del() +{ + # Give lldpad a chance to push down the changes. If the device is downed + # too soon, the updates will be left pending. However, they will have + # been struck off the lldpad's DB already, so we won't be able to tell + # they are pending. Then on next test iteration this would cause + # weirdness as newly-added APP rules conflict with the old ones, + # sometimes getting stuck in an "unknown" state. + sleep 5 +} + pre_cleanup() { if [ "${PAUSE_ON_CLEANUP}" = "yes" ]; then