From patchwork Sat Jun 30 00:46:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10497775 Return-Path: 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 00B73602CC for ; Sat, 30 Jun 2018 00:47:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7561295AD for ; Sat, 30 Jun 2018 00:47:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA48F295AC; Sat, 30 Jun 2018 00:47:14 +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 CDA94295AC for ; Sat, 30 Jun 2018 00:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934665AbeF3ArM (ORCPT ); Fri, 29 Jun 2018 20:47:12 -0400 Received: from mail-db5eur01on0080.outbound.protection.outlook.com ([104.47.2.80]:65264 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934248AbeF3ArL (ORCPT ); Fri, 29 Jun 2018 20:47:11 -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=I2G7bUc9pvYn9S0bEdH/wKMykIK/d+Wh8dZBRfg7PPk=; b=sgRzN7hDTmu49QiTE2UTRdrrtpHFRIwJYjn6YtE+7j4BKnXfKKmjMwg7PEDTaBt4bisw0cKG8bC69cVjuj0+opznH+3hbEPKXSbEpKc/VHGrSyEdfrSl42C8WZcqiStdpXi2RCY3iPZCbSTSsWsYpEYEAnfB7W7AcM/zktEPBIA= 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.906.25; Sat, 30 Jun 2018 00:47:08 +0000 From: Petr Machata To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: jiri@mellanox.com, idosch@mellanox.com, shuah@kernel.org, davem@davemloft.net Subject: [PATCH net-next 03/13] selftests: forwarding: lib: Parameterize NUM_NETIFS in two functions In-Reply-To: References: Message-Id: Date: Sat, 30 Jun 2018 02:46:05 +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: VI1P193CA0018.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::28) 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: dec0e7ab-5335-48b4-9ca1-08d5de23023c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(48565401081)(5600052)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:TVuqoqVbjRKroysAmJJEkaL6zw/rSDAfwIByxksrRndry53AKM18HW+pQ0g2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BysgbpULTBQSIugWLfcuyWyj9dVYpnoK2/07M0SQ1+L3Bs6qVc47hUmugiv2hhoJwGDY9Jnz8iCAbPTQhCW0pmKNtj8SfHcyu0d5fBeHXgzToMgJa+4dftrphQV8bndF4X5cW4rV5qjX7PvAZVoSCUvwPMLzWVembAoK6rLKu8pE4e0TaFBybOhdDLABLn5Q8DpYlwP5askqCueu7imkAwH1Uaq73y1k8mEwyLRsqLlkbwOqO0KnnOAt/yMrN2x72azyG8rmmDMn5GpOC4CSjhJBHPLxpMwGj; 4:qFfL3mW8fkNgfQTqSttpv6rjTf/PetUuf11ebu1pgk5jGtL4PA0sZqRPAt6uSzW93NuoKPtJNhsDxrYEYGa3bM2Eoo9zevUbQHfLA6Ca7tV11q9lLnJbgHL4i/0SAawNZlza+an7329O4LXIYs0oAI9GIyBKim7/4ZIgT7hlpjo+vgDnd16yVS1v+RLBCd0YJkvHuBQhRvmEKEdqBKd1WWaXoU/OAEHvD+k2RlAAsqi00aBXajvOO9N92YPCO5FsKoftxn0CQLEyUNuwKnDotw== 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)(3231254)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0719EC6A9A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(366004)(39860400002)(396003)(136003)(189003)(199004)(86362001)(478600001)(476003)(486006)(68736007)(956004)(2616005)(6116002)(6496006)(2906002)(66066001)(52116002)(3846002)(47776003)(76176011)(53936002)(5660300001)(4326008)(14444005)(446003)(11346002)(51416003)(6486002)(36756003)(48376002)(118296001)(386003)(50466002)(16526019)(105586002)(186003)(26005)(106356001)(97736004)(25786009)(8936002)(316002)(6666003)(81166006)(7736002)(16586007)(8676002)(305945005)(58126008)(81156014); 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:kCE/C7KivJCSVyw80H2lMezJEqUUNlnVF744S8Z+j?= =?us-ascii?Q?9yiokr+x1cpJgsnJOmBcd2jFRDbduvV/Xn/+YAgPBsjFROT/VwLnk8tE7+6b?= =?us-ascii?Q?wHt+X/7k2wHpr9xqTKhXSRPKPG2l0UqDDQW2GK+fOzSVXGlZUdqT+Tgyq2b8?= =?us-ascii?Q?Qd9/goD8q6lalXUQA7Ou0uUHGQaE31jQhYHEyIaBSlQKEo4anZe8bGrm2KyW?= =?us-ascii?Q?4QQmH8h3dmfTGlguSP40/TTwtdR08edIQ3ynz0fklmp4MdbTW122OOCEK4IR?= =?us-ascii?Q?I1RTrIri7F42e3jUnR+f37cvusEfdl9V8bxjSLmogyCaIR7zYpJ1pVbd7zr6?= =?us-ascii?Q?a8iUZH1Vho64a/vSGtSPLyP1ti+e9OCGUz45fFL9Y1RPz9l4EedWI4NE736x?= =?us-ascii?Q?hkc5+yTX8Xr+djmFSkb0Q7SgHH1aNe0VVLnXceIYF/UtY5OeO5cpPqAWR9mR?= =?us-ascii?Q?rWLFNErGqkMFjHWn0wXvR6UwQAZM4HGIQXfdYeL5C20W/83xW+y1D4WIjPjw?= =?us-ascii?Q?86YWvHkevq/XiQ8+hnb4z2TDKHkiR8ovAJXM6QsIam1XyDAd+UIX2OKJukfs?= =?us-ascii?Q?JFG+sazrhrIHRe4KysgovrOWwSHCNjA8eDDez5yzf5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g= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 6:eYSoCkDUCvQJed3vDhuWyf5XpW8oJp4rAWl1vuIdNC6byhUZ0ykzlI0yV55aZDLp2v1q2ou8g+t2SNoNm5bDIgUICnN62gGY/6nC8+769ARr8yrPlq2Czi1YVAHGUUWx0592gc+zN23CxRR/hgsyGAvB+F9QQ/MoHBh5Mo3g9HgkRciwW8X+DqNIsxcrwswQfczz3llqPBm4F6PBRin5MctoVzLpaplaYvCDOgn2//NGhrBn9tC3euZzt6YiLIQL+u22Zm1J+ZGjr8G2xAWy2MK01rdqwTttofxWT3MYsFTptY29IKbBJZKtvm7RWQJgaZ3YdVMtCL7MxkcqsDA6pJHFpoMI2RD6AXJWCndtMtbFTJiz7rzYSU/cxWd/tOwjWy9rWKitVYu7n6c6pa913vxHk/OQLSx4ztyc1W6JvcSk1BSntKNVm/AANGJD/15MZJJ8/6DqcXooxP0iJLw0kA==; 5:ZQKD8eHGa8FzvPDgI+vmZqG01nJ2lqtnNXs6yVpacPR9p3SbG9jLntL1PhbLSqEXyYBPutZKyQXQcBd/mrKxLKxbvH9cp2gf3EJ663caTKLMSb2cMHJGrVA9h84xbA8dY0I3y9nmW9CSjxT+GtVeMdC3TwsFYI9rE9VeJ+9WwvI=; 24:AoioeOKvrP78SbinJrKuWlvtdz3Us1RN48VVjEzIbGOjgDf6mRfwOjuVqEzVQySz4OAlfz1RoBSKm7DrbYjZAEgSjPOwGDcCwR0aEkQ6wkw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:DCUVedXomv8mud9Q8f6mgvPQvV+UXgiy4rop63tNrcToN+F86qUIw567y1DyU83cuWz9/8I5UeBnb9NKQvnB2/QpeN/aBb8HQWmhrSy3BAlYPvEps5z9TSVtR4wHC39qIMZQ4N2OO40WaXFciNsUBI35k7A03lIYHIr0uvqq13TvcD3+835L7HdWAp6jD0in+dHxMa/ZIAd6Nk3QVRWvb/VCvCc2NM2EHXDJcmsLSzVFjKhr6is3eJUhSMVULC2r X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2018 00:47:08.4060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dec0e7ab-5335-48b4-9ca1-08d5de23023c 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: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP setup_wait() and tc_offload_check() both assume that all NUM_NETIFS interfaces are relevant for a given test. However, the scale test script acts as an umbrella for a number of sub-tests, some of which may not require all the interfaces. Thus it's suboptimal for tc_offload_check() to query all the interfaces. In case of setup_wait() it's incorrect, because the sub-test in question of course doesn't configure any interfaces beyond what it needs, and setup_wait() then ends up waiting indefinitely for the extraneous interfaces to come up. For that reason, give setup_wait() and tc_offload_check() an optional parameter with a number of interfaces to probe. Fall back to global NUM_NETIFS if the parameter is not given. Signed-off-by: Petr Machata Reviewed-by: Yuval Mintz --- tools/testing/selftests/net/forwarding/lib.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 5f4b7ed2c65a..e073918bbe15 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -220,7 +220,9 @@ setup_wait_dev() setup_wait() { - for i in $(eval echo {1..$NUM_NETIFS}); do + local num_netifs=${1:-$NUM_NETIFS} + + for ((i = 1; i <= num_netifs; ++i)); do setup_wait_dev ${NETIFS[p$i]} done @@ -481,7 +483,9 @@ forwarding_restore() tc_offload_check() { - for i in $(eval echo {1..$NUM_NETIFS}); do + local num_netifs=${1:-$NUM_NETIFS} + + for ((i = 1; i <= num_netifs; ++i)); do ethtool -k ${NETIFS[p$i]} \ | grep "hw-tc-offload: on" &> /dev/null if [[ $? -ne 0 ]]; then