From patchwork Fri Jul 27 23:04:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547811 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 5CC84112B for ; Fri, 27 Jul 2018 23:05:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BF652C53E for ; Fri, 27 Jul 2018 23:05:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 404D32C6DD; Fri, 27 Jul 2018 23:05:45 +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 65BE72C53E for ; Fri, 27 Jul 2018 23:05:44 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cl1f5FGrzF0kx for ; Sat, 28 Jul 2018 09:05:42 +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="fNsTsIn9"; 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=40.107.0.42; helo=eur02-am5-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="fNsTsIn9"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00042.outbound.protection.outlook.com [40.107.0.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cl1b0kYczF09Y for ; Sat, 28 Jul 2018 09:05:38 +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=TR+N+M795cuD1m3DaQ5ENyi6+A9uvEI7P6wMiAbv71M=; b=fNsTsIn9J1gwpNINkkBUkZLzYJxeO3YZByh517qxPfGo3jchrYnlZu3wwJ0LkL9JydwhgoxIKZCrr8DjHsLuPR3GSvhnwJ8zmI+eplzaYhxka26YTRGp7mRA58DWOq/hPHXtzUYOL8y3IIfcB/RdP4ixjbNbsgP12QRhEhJsslg= 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.973.21; Fri, 27 Jul 2018 23:05:34 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 4/6] selftests: forwarding: lib: Move lldpad waiting here In-Reply-To: References: Message-Id: <2cefe20fc6cf7427438c20206d64f8e3b9fdcb01.1532732232.git.petrm@mellanox.com> Date: Sat, 28 Jul 2018 01:04:42 +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: HE1PR06CA0146.eurprd06.prod.outlook.com (2603:10a6:7:16::33) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d4ccc484-5b00-4132-b023-08d5f4157604 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:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:ohzSlBOK8U7QgjpTK8JPKs1a43fHyP07iy5FvAUSooWRUneBB0SYCjK2qwLnW8+JTuVJXOJASeBBpVkjvt9V3aMSwu+IcOnzIKLeuXo8fYHweRLom0i3PSDRTcTUimC/M2RMpPVlCaKTTxqStbE6XU+u0Tc+N/NnqyRRc20IkR0dC9XWit7ZFLnfvKXi/aeGZvhVxv6eObkUIfjCwS/3So8X14w2SQmMDn2/qlYC+hMrjFfipVetSSxVEHUUDQrI; 25:tYb5ST6iICNvpKLLIsP/9Iv7teTOKQr4s9PInD20a3DRjUXLZhMTeUo2H+woUUYtI9ufNgWhy15sObhwZ8w2EZzblIZuo99BNnB5oh+ip9Zi5Xgc0uMyOAOfopa8/apjRkkKDm5XX31wiW/z419/0iPWu7bU0f6rkLxCJQ/50a5g73rvhunWvgtYkAExbokJwcjN57FpyXnGpt/k2fCuREXpYh73Dp/q4NsMY3Y2NHfiLXyqd2MjgmVCkK4EkCr6sor8xM/lzyNv3tyc1IWVyUTOuHkmEn8O6tnstYPX6yjF4YoV8mrcN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SCXoI9dY+lEy9cmrCEisWoTuUxq9+gxklpgCMkmIl9z2JYf2AH1sLIprow== 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)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 07467C4D33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39860400002)(366004)(396003)(136003)(189003)(199004)(2906002)(52116002)(5660300001)(81156014)(6636002)(66066001)(6666003)(53936002)(81166006)(6862004)(47776003)(8676002)(16586007)(58126008)(11346002)(16526019)(446003)(186003)(86362001)(37006003)(26005)(386003)(14444005)(51416003)(76176011)(6496006)(48376002)(97736004)(50466002)(2351001)(25786009)(7736002)(305945005)(106356001)(316002)(105586002)(3846002)(486006)(8936002)(118296001)(68736007)(2616005)(476003)(956004)(478600001)(6486002)(36756003)(6116002); 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:/EK8HP01GrJz9jFz61h24U/aiiCSnu2KUh75xb3pt?= mox8OrAer+rEBmxsLL3vx0HlnTStWE07FMQQgJlwBE5yRSgYLKRbm5JcqeEeuyjyleYge59Dvuutw3HJ4eKiUJOMmjOJ5N64GeIyomhSnaPjDSsrlSwUS/38SG1uPFcNIpKOUB3jdD3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F4dkjUlcwQsdIQf9gvOb4tPKzjP0sGsZJOTkel7F7XEpjORb87umqLL6ItKCh1h+29WMo1nDXrvBRGiX2cOOC9YyXgkkaGfLeedkcu7ewAqQR87Gus9wkU5ZTiouP0qKgTe9hKE9/i6xz3ZrwVmXWEWFbjhTsPX0uksFGu3esWIBv+fOp/0c+bpiz68Iu8+PzpgqAnQw0jtAEqxMWz3OYPiUZCKi+tvV0EDNVqIpFPHts2EAY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 23:05:34.8677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4ccc484-5b00-4132-b023-08d5f4157604 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.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_wait_set() to recognize that what this is intended to wait on are the pending sets. For the sleeping, add a function lldpad_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..53bea3f418ad 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_wait_set $swp1 + lldpad_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_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..bc826a5e99df 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_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_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