From patchwork Mon Jul 30 12:45:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10549035 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 7CECFA755 for ; Mon, 30 Jul 2018 12:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C62E296A7 for ; Mon, 30 Jul 2018 12:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 608A229715; Mon, 30 Jul 2018 12:46: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 9B9C8296A7 for ; Mon, 30 Jul 2018 12:46: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 41fK7P6hF7zF18k for ; Mon, 30 Jul 2018 22:46: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="oLzr6Iu0"; 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.3.85; helo=eur03-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="oLzr6Iu0"; dkim-atps=neutral Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30085.outbound.protection.outlook.com [40.107.3.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fK6w6Sz4zF13G for ; Mon, 30 Jul 2018 22:45:44 +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=x3B2SeIr8H0PLcFDkAfFy6Qn3FMvUY/87DyeBYl9fIg=; b=oLzr6Iu0xdIRCpYSe7FWXEjwGtbGQS+/Ua0FketqJP7auVuEV8CwinwoRng+jJG2Lr+Wbd0f3c7zplYi0pzKHP9Lr4VsoJedxZBMagSkGdzk30roopUC5f9G6kJbLpGgH/YxXlgthydUEHl2cXB3jOorXFMJAdKUW7/3XT5kzCY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4181.eurprd05.prod.outlook.com (2603:10a6:209:40::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.17; Mon, 30 Jul 2018 12:45:39 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 6/7] selftests: forwarding: Move DSCP capture to lib.sh In-Reply-To: References: Message-Id: <24b1322950e579e6ab1eb9fe97e4389609a2d74d.1532953818.git.petrm@mellanox.com> Date: Mon, 30 Jul 2018 14:45:35 +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: VI1PR0202CA0026.eurprd02.prod.outlook.com (2603:10a6:803:14::39) To AM6PR05MB4181.eurprd05.prod.outlook.com (2603:10a6:209:40::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca59deae-47a6-4abe-f4cf-08d5f61a5ae3 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:AM6PR05MB4181; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4181; 3:SyxhrpyIN6SjV+RwXCVyH7n8mdbJd8igknQgy8oRrLDWOCo9j7dQPNkkv2vqn9CtOzPQPDQOMHxznxPSfcyhy0ZY5Z3TZ2SWYEh54pPDVa9IruOeTb718wGcVn3rvYAhtbc1EpiJNwjorrGkxsj/U9WKuFbbVO86Q9BF8jqak2NoOQShi95b+cFfaCelWTH2SEmYbtKj/bCBS68KcrbvulOazLa0+9bNTpEE0Bbgid+FN7N3csnDiEk1IK7bxqH+; 25:zRc3xZSkWi+P8WqpP85v+5Jrqh7D+XHljtlGG9Ql1t4qoLf+Kg3vWRiip0Z+/toelUV9t0R3yHFjOSbE/1ucsbPpR3l+cscA+KHxo95dqTu/5PozaH3QOP6A+ra6uZTn6+cBSU5KNdPwwMB5tLE0bUG87LS+PfWHPSqvDDtAT/RjA8ufG+XKMfPwyjSvjQjfF/i5hTFKci1YCeb4JVIyE4Jp62YOposnJwL4Kxwc7ihLV3bftTS+0HcrNxEluVOySTU/jbcbdnQtPrDH1hvmsTCUUUN53LnelSu6f5ke5ApC91n9+greZ6BsIowXu3lZRne40kn6jJMIToScB5f6iw==; 31:9fZqeLgA3cAyZQjhKOomI48p3jIBl0FArhMzAOox7FmYbO7hS77Bc4aQev+axeuJTkxgg0cWjSUoDayjVZqekRbGyC9r6clXH/XkDQ30BHWclKeG/YYtjG6qxfqt9pGq12I3nnTDR2LbbizbIwFY+eReYlt2VBbmKPy79Hi2oeUKvsydU6qiCMFatZYiOzV4fF26eRN36xXgVBBtSxO/tzJpzaqnyGLudyOBYi4zI0E= X-MS-TrafficTypeDiagnostic: AM6PR05MB4181: X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4181; 20:BWBBybcwi7jVtJfGC9cJu8w9arezetzar9EnbSEzkGaLbVxnF5BpfK3PP9tvHDQc3Ql0DzVQ+be28NlcLZXJf9fy1GO2XjTNaFTXq7NtzgAyOOENXTGcSTdO9/sKzxIn3uyTdQtDkOzuanlZFMvLSTSHU0lgz4yIb6KRonUitVGmXSJ84YdrZSk41dJnsux212ley8F8xrVV2+6WelEipT3r3rPw/1idKjVME9rr+JyCUk+9Z4wB0U5bytrCzxc5NcnYrB2ZeQrpXM6k19YawOk8tGNMvCqRflDPea0K44SC/DqvUttSYS/G/vNdMK9Xagpj6cODBdnT6H04BuCz/DOrMil/eMEyKYwi++pjRdvPzLb2MgVKz8LrbV8jKOEeb59U3vBDOVloGcHhD+n7mbJKjL+6oJ2NjBzX95ufs+e8ISn0OS1zHNpW6E6kK2ose2kb9ihc2S7x+ftsuyktfIpDxibSfbpQr7DhOUaNbNjentJFw7AwGr8PgKms81p+; 4:iRllwqSrpAjg7VHPvyAEEgskZniJhQUaJ87qNwVbISbnyWE62qFelEtX/ynrUqYMqV7TurPrZ7H3PnJDhjg/et5NOi0WTDnoHOBamgr0FUg+M8STPH8wmMjY4PWsE1/x7A4bs0QbJwT6FxrVPfZ4guI5zCL2fU5Tvg/tj5WdniuYo2W8iHPz7klSH0F5G2kCitKrWNxzSHEbOAQb17UhcQrfgqIFADyUpmt3Tvn5mouwlI6aPhr8pSb9YdNwDJzmvRik86LBrHQqAOy5EJvtrw== 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)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM6PR05MB4181; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4181; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(346002)(376002)(39860400002)(396003)(366004)(199004)(189003)(6116002)(6862004)(3846002)(5660300001)(14444005)(68736007)(6486002)(446003)(11346002)(2906002)(6636002)(6666003)(25786009)(51416003)(52116002)(76176011)(50466002)(478600001)(8936002)(53936002)(316002)(48376002)(37006003)(58126008)(16586007)(36756003)(106356001)(2616005)(476003)(956004)(6496006)(486006)(97736004)(47776003)(118296001)(105586002)(66066001)(7736002)(8676002)(81156014)(81166006)(186003)(16526019)(26005)(386003)(2351001)(86362001)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4181; 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; AM6PR05MB4181; 23:DGy79dTCsi/IrRPEUCLu51lkwk1cDIqGR+MvfyD9e?= XryKqQ2i80M95HkP6StrEmgHxfEVGBtJqNx0zB6E7V51P036PWAn5nBGItw0jEZTNbPpgsxTLEtyJFx7c9IF53aWo2GlB0EkVxxVZSkQiwDgw6NDrN1h284yoOtRpHKRBI3WolISaUKhKWb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1ChChVl5P7pK2VKLL9h/Z7QsZlpFa880OwF+6r4pdUxlQ+IaDEKjwD1PVl/cF4XPxfZbyIuy45sKj3zVGUIrtQUBxoyyZBfFxLREUFhxJ1ZEHWSYKVAgfv7VvVsRfnLLeBQw6mQnoxmMlYmI5AhgaJeqsdvosdO3Du9vPXHuLkksAaaB81khHDE0srDN6ygVBX1iJLHgIIx5owd73szRD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 12:45:39.5623 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca59deae-47a6-4abe-f4cf-08d5f61a5ae3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4181 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 dscp_capture_install() and dscp_capture_uninstall() are going to be useful for a test added by a following patch, move them therefore to lib.sh together with related helpers. While doing so, change the rule preference from mere DSCP value to DSCP+100 is order to support adding captures of packets with DSCP of 0. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- .../selftests/drivers/net/mlxsw/qos_dscp_bridge.sh | 42 ---------------------- tools/testing/selftests/net/forwarding/lib.sh | 42 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 42 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 9e875ee8dc1c..1ca631d5aaba 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh @@ -34,36 +34,6 @@ lib_dir=$(dirname $0)/../../../net/forwarding NUM_NETIFS=4 source $lib_dir/lib.sh -__dscp_capture_add_del() -{ - local add_del=$1; shift - local dev=$1; shift - local base=$1; shift - local dscp; - - for prio in {0..7}; do - dscp=$((base + prio)) - __icmp_capture_add_del $add_del $dscp "" $dev \ - "ip_tos $((dscp << 2))" - done -} - -dscp_capture_install() -{ - local dev=$1; shift - local base=$1; shift - - __dscp_capture_add_del add $dev $base -} - -dscp_capture_uninstall() -{ - local dev=$1; shift - local base=$1; shift - - __dscp_capture_add_del del $dev $base -} - h1_create() { local dscp; @@ -155,18 +125,6 @@ cleanup() vrf_cleanup } -dscp_fetch_stats() -{ - local dev=$1; shift - local base=$1; shift - - for prio in {0..7}; do - local dscp=$((base + prio)) - local t=$(tc_rule_stats_get $dev $dscp) - echo "[$dscp]=$t " - done -} - ping_ipv4() { ping_test $h1 192.0.2.2 diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 90af5cd23417..ca53b539aa2d 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -653,6 +653,48 @@ vlan_capture_uninstall() __vlan_capture_add_del del 100 "$@" } +__dscp_capture_add_del() +{ + local add_del=$1; shift + local dev=$1; shift + local base=$1; shift + local dscp; + + for prio in {0..7}; do + dscp=$((base + prio)) + __icmp_capture_add_del $add_del $((dscp + 100)) "" $dev \ + "skip_hw ip_tos $((dscp << 2))" + done +} + +dscp_capture_install() +{ + local dev=$1; shift + local base=$1; shift + + __dscp_capture_add_del add $dev $base +} + +dscp_capture_uninstall() +{ + local dev=$1; shift + local base=$1; shift + + __dscp_capture_add_del del $dev $base +} + +dscp_fetch_stats() +{ + local dev=$1; shift + local base=$1; shift + + for prio in {0..7}; do + local dscp=$((base + prio)) + local t=$(tc_rule_stats_get $dev $((dscp + 100))) + echo "[$dscp]=$t " + done +} + matchall_sink_create() { local dev=$1; shift