From patchwork Fri Jul 27 23:02:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547805 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 23364112B for ; Fri, 27 Jul 2018 23:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1505D2C6DA for ; Fri, 27 Jul 2018 23:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 091B92C6DE; Fri, 27 Jul 2018 23:03:29 +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 26B022C6DA for ; Fri, 27 Jul 2018 23:03:28 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41ckz23VJwzF0pD for ; Sat, 28 Jul 2018 09:03:26 +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="MxksqIUl"; 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="MxksqIUl"; 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 41ckyx4VFzzF09Y for ; Sat, 28 Jul 2018 09:03:21 +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=M5IsvNx5e8H+7C3PuIRVuOzv7g/ZzU2ubmUNXPaaDAk=; b=MxksqIUleP/yqJ56iZKoFVmigz1JKTz42NTlpxkn7mQ3J42RNxIsfQ031gOsrtGEw8kV954gxmM6vR5VqkhjeYpt7DeD30nA6Y+45PmZoPB2CvqybKQuehfrLwnFjLlMmMoEpMIYfMxdWLS0AdWYJbI4ym9Rlgz2S6fPxnTxIM4= 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:03:14 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 1/6] net: ipv4: Control SKB reprioritization after forwarding In-Reply-To: References: Message-Id: Date: Sat, 28 Jul 2018 01:02:36 +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: VI1PR04CA0112.eurprd04.prod.outlook.com (2603:10a6:803:64::47) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e9eb0b26-5c43-4a8f-f51e-08d5f4152200 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:HmMc1fbKE8sDVvTHYfAGo2OI6TL1dwY7fUZkD3ueaxSwa5C/g51Dfjy+2e2gyC4p7mDqASKhFwH8gh/myHvqWcEnkmTf2NexKjwxkw6n4rouf1TB4HMVvDm3zshnA/57aAGBFQKE8BR0B2rLh+R/2fCS+k6F5Wxycp2sybw8F23SbhXt+cqA8jh0L+BFu+obVdj8sRQ/Iuagkvj1aWEysX8+iGYV22FcpG49sQ3OQTbRe6fccUBtymBY7CkmPiI6; 25:DcuCmHTEHYZ6N2z0xPaB+JOojr/PUq/i3b9sxTAlh+r/NqsmXkAzYsB+OkPdSQ6RiydlPVWirr6XDw4MUZHrIViTMi3sbEyL+A/FWOqLZ80Uo2jgpaSBrt5dfdIBVOGlsNillXoJMz9wAXjjpbOwVVJKgvZBZTkxavImB/erO99NQMPi7vKO1pXUQYLv9H07fFCNoUcvJ+WZpiuL1jWQKy00eDU7Tb7LHs+9SanLY//Nm75Shz6uYTItlM3dBTJ2Q/yeZCkI2n2IhpsyzaV3u00Res9QSYeCO6vLT5g9os/gsCT4aWoDMPgaY3s8s/i3lQQM/qQxH+RcMj3OdrwDzg==; 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vjAO7sZBhVTnRpDFLzfdZbIhRknQzL5wg== 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)(575784001)(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:AICHq65yqgxNkwFaAcvBkl2bsJWBpf7SBHu0zWNTm?= e0U7YOLlWRezlGSbqn7DFyYVNvS7jyyk2Z1bwXekLKcW+8lNi+/WUk8sZ5EemjlCrp0ShN41xhrPAM3W/0B0ooA66CvEPE/q8fPCYQAA32tE1znYQ/YVFwcSzk3aw0PICCyoq2W+n3AEXmvIdB69+Zb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VNKdmeJDu+3PXK3/CPTqPmAElDlirwm0+8fiMAcOmRMMO03XZbSROqoJ3lXsPlNPNbCfRhRLfc/XOeoTWRFo8vO3yYusUmUf7tq1wTakvLQCJpk/wmVLm0fbTfB7W2a1sivS3KQP4C+wH7mzrGGzU8cDUspt3VqAjKmMpAW/gWaG2IT41btNmeMjX64GaDnAX305eqzNh0drhlyb8WBnwdNcUsiY9wHmbdIxXz6e7XidpI57yLFOc1hNebi8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 23:03:14.3678 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9eb0b26-5c43-4a8f-f51e-08d5f4152200 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 After IPv4 packets are forwarded, the priority of the corresponding SKB is updated according to the TOS field of IPv4 header. This overrides any prioritization done earlier by e.g. an skbedit action or ingress-qos-map defined at a vlan device. Such overriding may not always be desirable. Even if the packet ends up being routed, which implies this is an L3 network node, an administrator may wish to preserve whatever prioritization was done earlier on in the pipeline. Therefore introduce a sysctl that controls this behavior. Keep the default value at 1 to maintain backward-compatible behavior. Signed-off-by: Petr Machata --- Documentation/networking/ip-sysctl.txt | 9 +++++++++ include/net/netevent.h | 1 + include/net/netns/ipv4.h | 1 + net/ipv4/af_inet.c | 1 + net/ipv4/ip_forward.c | 3 ++- net/ipv4/sysctl_net_ipv4.c | 26 ++++++++++++++++++++++++++ 6 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 77c37fb0b6a6..e74515ecaa9c 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt @@ -81,6 +81,15 @@ fib_multipath_hash_policy - INTEGER 0 - Layer 3 1 - Layer 4 +ip_forward_update_priority - INTEGER + Whether to update SKB priority from "TOS" field in IPv4 header after it + is forwarded. The new SKB priority is mapped from TOS field value + according to an rt_tos2priority table (see e.g. man tc-prio). + Default: 1 (Update priority.) + Possible values: + 0 - Do not update priority. + 1 - Update priority. + route/max_size - INTEGER Maximum number of routes allowed in the kernel. Increase this when using large numbers of interfaces and/or routes. diff --git a/include/net/netevent.h b/include/net/netevent.h index d9918261701c..4107016c3bb4 100644 --- a/include/net/netevent.h +++ b/include/net/netevent.h @@ -28,6 +28,7 @@ enum netevent_notif_type { NETEVENT_DELAY_PROBE_TIME_UPDATE, /* arg is struct neigh_parms ptr */ NETEVENT_IPV4_MPATH_HASH_UPDATE, /* arg is struct net ptr */ NETEVENT_IPV6_MPATH_HASH_UPDATE, /* arg is struct net ptr */ + NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE, /* arg is struct net ptr */ }; int register_netevent_notifier(struct notifier_block *nb); diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 661348f23ea5..e47503b4e4d1 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -98,6 +98,7 @@ struct netns_ipv4 { int sysctl_ip_default_ttl; int sysctl_ip_no_pmtu_disc; int sysctl_ip_fwd_use_pmtu; + int sysctl_ip_fwd_update_priority; int sysctl_ip_nonlocal_bind; /* Shall we try to damage output packets if routing dev changes? */ int sysctl_ip_dynaddr; diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index f2a0a3bab6b5..d3cfbd89ca3a 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1802,6 +1802,7 @@ static __net_init int inet_init_net(struct net *net) * We set them here, in case sysctl is not compiled. */ net->ipv4.sysctl_ip_default_ttl = IPDEFTTL; + net->ipv4.sysctl_ip_fwd_update_priority = true; net->ipv4.sysctl_ip_dynaddr = 0; net->ipv4.sysctl_ip_early_demux = 1; net->ipv4.sysctl_udp_early_demux = 1; diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index b54b948b0596..32662e9e5d21 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c @@ -143,7 +143,8 @@ int ip_forward(struct sk_buff *skb) !skb_sec_path(skb)) ip_rt_send_redirect(skb); - skb->priority = rt_tos2priority(iph->tos); + if (net->ipv4.sysctl_ip_fwd_update_priority) + skb->priority = rt_tos2priority(iph->tos); return NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD, net, NULL, skb, skb->dev, rt->dst.dev, diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 5fa335fd3852..6fcd1173ef9b 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -201,6 +201,23 @@ static int ipv4_ping_group_range(struct ctl_table *table, int write, return ret; } +static int ipv4_fwd_update_priority(struct ctl_table *table, int write, + void __user *buffer, + size_t *lenp, loff_t *ppos) +{ + struct net *net; + int ret; + + net = container_of(table->data, struct net, + ipv4.sysctl_ip_fwd_update_priority); + ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); + if (write && ret == 0) + call_netevent_notifiers( + NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE, net); + + return ret; +} + static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { @@ -664,6 +681,15 @@ static struct ctl_table ipv4_net_table[] = { .proc_handler = proc_dointvec, }, { + .procname = "ip_forward_update_priority", + .data = &init_net.ipv4.sysctl_ip_fwd_update_priority, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = ipv4_fwd_update_priority, + .extra1 = &zero, + .extra2 = &one, + }, + { .procname = "ip_nonlocal_bind", .data = &init_net.ipv4.sysctl_ip_nonlocal_bind, .maxlen = sizeof(int), From patchwork Fri Jul 27 23:03:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547807 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 C526C139A for ; Fri, 27 Jul 2018 23:04:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5A562C6DA for ; Fri, 27 Jul 2018 23:04:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A88832C6DD; Fri, 27 Jul 2018 23:04:27 +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 EE8CF2C6DA for ; Fri, 27 Jul 2018 23:04:26 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cl091FKBzF0kx for ; Sat, 28 Jul 2018 09:04:25 +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="U94iwnLh"; 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.43; 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="U94iwnLh"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00043.outbound.protection.outlook.com [40.107.0.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cl0609VCzF09Y for ; Sat, 28 Jul 2018 09:04:21 +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=XifDBL2a3YnELOPsjAVEI0W5RI97+X+L8ORXOKpoPJM=; b=U94iwnLh5f3QabFaSw31WhSD/ILGvQurICQu+AKbjjznAcFaQmMOx/PwhUuj+ErSspzPfFtolri8VMhG/hu9bkS3quJjXO83zfa7vD7KbSPAkFmVXtJqkEcvt2DVlSzIu4YtQxxnBMi3ULEDuTf8MoNs2UaFaa/w2+w3ruop+2k= 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:04:15 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 2/6] mlxsw: spectrum: Extract work-scheduling into a new function In-Reply-To: References: Message-Id: Date: Sat, 28 Jul 2018 01:03:14 +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: AM0PR01CA0032.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::45) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8caa3e4-4b8b-4469-189e-08d5f415464c 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:jTKHztl0VuNP9wt61WdZGR7sacJIR0i8/S5T/iBn1f6Hnl7aJhnLxp9QKr/e1yE+/Ml9J+dSqvkolC4GKJ2xxL2GlmULKw/KbZDvBqs1oMvByUa+O65mg5Q+t7vuNAGBy50Ufe3L73lUrBi13jWvy5U1st2ofLRzwiVYz59bZkFZLUrMEeaemAUIycR60PX0FKgR9y+VNtXeCCp9VozPeP8iG9JX1wRYgL6QCFX4Ga2s0KizvFxFNsvof9v2jiOm; 25:qHVwufMcrz9WQe9gLzhrlR9M5LlBk9NpWQb/Q1f/UEe/bsGY0jD9ZA1jVBHcOJtixbe1B//aa96Mo+G1Ph9ITNKOhjnq4872VkAiKBnZkKPyO5FjAWrK3LOotdg7XN2MuKuwk00gPbD1ijwEO/LBjQAQE0+og/BLuyt10KITLXHbs3cWTBaNqnM+LR2X3kqnFWwX7IPsjqU/pOGvnMlUR20iK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yioOqTDYRXTjMcDMghZKqCCxoVxl4Nf8lNEFFogB7aIKSfV6JPqb4CGleNFnncZvqKYyqxogUk9Jq5b5MqOSO29+fYA1Hy/gtBk1kfCRnNF1MYefI8q2/tbrC86yr+Gx4jcLkYGfpFwKq0nOig== 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)(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:mieIPDj+nlBS4kWbtpkGq19clvT8wYNW3PXRdiZgn?= KBzSQBo1DXjD6unuvTEwSE47Ky2qofERjeOl62+4poxassXxYqnhvrT2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RRobdHY4NWNkEMWzQlNeYvKOJL90n24AvU=; 7:45GXqF8erx7PRZc692t/6d5TqQQMDTTARbTLXS22CXYFTiEDZzPe7SlnlTkFurSurza35ldeT/uFqlfZaMw4cd89a8Ms4OMA6PXitSFjmi1u0yjBwi/H9vyYBQwEp8+2B7kGXwLqm6ImLI+K/CeE7EsWWXODHGuZ14cpaW3h3sMzNY6a3Oa+uhM3wyqTMPwMzPQ5l2ju7IwKNCwuLYyIPfhFFxODsRzVszb4Patf77B0jq/3OcRGrVD/9oCMCjs3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 23:04:15.0707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8caa3e4-4b8b-4469-189e-08d5f415464c 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 boilerplate to schedule NETEVENT_IPV4_MPATH_HASH_UPDATE and NETEVENT_IPV6_MPATH_HASH_UPDATE handling is almost equivalent to that of NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE that's coming in the next patch. The only difference is which actual worker function should be called. Extract this boilerplate into a named function in order to allow reuse. Signed-off-by: Petr Machata --- .../net/ethernet/mellanox/mlxsw/spectrum_router.c | 38 +++++++++++++--------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 1d4c02a36432..08b105bfb65d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -2402,17 +2402,36 @@ static void mlxsw_sp_router_mp_hash_event_work(struct work_struct *work) kfree(net_work); } +static int mlxsw_sp_router_schedule_work(struct net *net, + struct notifier_block *nb, + void (*cb)(struct work_struct *)) +{ + struct mlxsw_sp_netevent_work *net_work; + struct mlxsw_sp_router *router; + + if (!net_eq(net, &init_net)) + return NOTIFY_DONE; + + net_work = kzalloc(sizeof(*net_work), GFP_ATOMIC); + if (!net_work) + return NOTIFY_BAD; + + router = container_of(nb, struct mlxsw_sp_router, netevent_nb); + INIT_WORK(&net_work->work, cb); + net_work->mlxsw_sp = router->mlxsw_sp; + mlxsw_core_schedule_work(&net_work->work); + return NOTIFY_DONE; +} + static int mlxsw_sp_router_netevent_event(struct notifier_block *nb, unsigned long event, void *ptr) { struct mlxsw_sp_netevent_work *net_work; struct mlxsw_sp_port *mlxsw_sp_port; - struct mlxsw_sp_router *router; struct mlxsw_sp *mlxsw_sp; unsigned long interval; struct neigh_parms *p; struct neighbour *n; - struct net *net; switch (event) { case NETEVENT_DELAY_PROBE_TIME_UPDATE: @@ -2466,20 +2485,9 @@ static int mlxsw_sp_router_netevent_event(struct notifier_block *nb, break; case NETEVENT_IPV4_MPATH_HASH_UPDATE: case NETEVENT_IPV6_MPATH_HASH_UPDATE: - net = ptr; + return mlxsw_sp_router_schedule_work(ptr, nb, + mlxsw_sp_router_mp_hash_event_work); - if (!net_eq(net, &init_net)) - return NOTIFY_DONE; - - net_work = kzalloc(sizeof(*net_work), GFP_ATOMIC); - if (!net_work) - return NOTIFY_BAD; - - router = container_of(nb, struct mlxsw_sp_router, netevent_nb); - INIT_WORK(&net_work->work, mlxsw_sp_router_mp_hash_event_work); - net_work->mlxsw_sp = router->mlxsw_sp; - mlxsw_core_schedule_work(&net_work->work); - break; } return NOTIFY_DONE; From patchwork Fri Jul 27 23:04:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547809 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 4AB71112B for ; Fri, 27 Jul 2018 23:04:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B9C72C6DA for ; Fri, 27 Jul 2018 23:04:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 304EA2C6DD; Fri, 27 Jul 2018 23:04:56 +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 CB8F22C6DA for ; Fri, 27 Jul 2018 23:04:54 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cl0j0X0FzF0kx for ; Sat, 28 Jul 2018 09:04:53 +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="szZxjqBj"; 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.49; 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="szZxjqBj"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00049.outbound.protection.outlook.com [40.107.0.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cl0c13tBzF09Y for ; Sat, 28 Jul 2018 09:04:47 +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=Qy60Oh06zk1+H9A5BfzjM+sj5UelTdF8qe/tncLVPPk=; b=szZxjqBjqZa/4By4Tv3NZeEtqyUfR42YvspqhdooeH8CSoT5cUysf7tLDze7f59FcW4wABZfMylTfoIc1v7FgjOGVPw4Ljl220bfFIfeO4m4C/AAUPvi1sLrr+g3XlO8tBO5lk/3N70d0bASlc0JYii2K6Bke2JOejLZlEtNTRE= 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:04:42 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 3/6] mlxsw: spectrum_router: Handle sysctl_ip_fwd_update_priority In-Reply-To: References: Message-Id: Date: Sat, 28 Jul 2018 01:04:15 +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: VI1PR08CA0116.eurprd08.prod.outlook.com (2603:10a6:800:d4::18) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 051f6b6f-18d2-4bef-bc73-08d5f4155668 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:CO0FzFOa0GhVbqoLPxkuJJCORQ0cjj9wy7qSj6wPCsjorEgOPJYLXKbUQOF0xD6TvjGelolu7q7lTM/dj7OkaNgOzgxXDtQcLvC3vfXVF39Pd/jfAiYcaKdlweudODZw8OPxedeNumOljWSU+R0MSgJ3M57MfUazpZJmjifca6XBBwxB4A6itY1PDrCn7tx2o1MhQQ8DyCTDztaHckMB8SYe8lrCbpeIdXfHvTLfmtAU/jOs8FFEYPgf/Ulku3NF; 25:nMfPI1BvK058aHIOvgsPH6a5ks/17iUfq5Wk9Op5ooGR8EGpZoL62+Oe513/2bajNB13nUK1YhS/b5AcSJdR6bf7v4QORiaaPMRr/rpdDJch3Z6/POjdTDE76Adlb9I0Rm7qSa6B56gU0AV/buTnXGdAsW++JAplZbqM4Qn3H2V84NILQmrWKJNjUjFtLO2/llVTKObJQIr05O5tE+G2OFneBiVWKGMZQG2J2Oh/UwSnu0F/WLScydZCCUtYEoETgzuP5oR8WqqYR7ycJqYbnx5xRHHRohsfMp9kTyQVCZ6d4lz5yJSEssfxGrazBEKG60epqvoefv6tL2MeaxFA8w==; 31:C48e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qpdQeZNjG5JfRX2cuQ== 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:7V046csgYqrAcXUUEDJ0hOCDdoDRbIdC1q2l97VVX?= YAO4iow4y6CNOsKDvCvEyLDoM7qnU/1MFqAo3bTTwaGg9FzQrIsIPW130On0h72VHmQcEwQSnH5R+f7aocRqRQREHI1IL760Pib9m/Z7GRXnGDL+vxCLUAFC/+ndG6RbduKE2i14KoJNaHGAG51sXoDDPRYAN3qCPpP09wj3HR4RF4HBJ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KGaS70zSz320hWcxuwXf9BGNKn4YYlcJ7Er2AuwYMLQLjLIR6tf0BX0Z4ta9d5E6rnJT/VqvDJuIJ0eR4aTkYAY9m4iTKMc6KI5FqYh5x0Zlahg03EA9nXl9M16FnR+x3l9AqZ9rZ44wP7D2dNn9qgR6CDK2SrFg/Ew+34xMuRMHrkK17FdHkkQeQIYNvX5b SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 23:04:42.2894 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 051f6b6f-18d2-4bef-bc73-08d5f4155668 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 This sysctl setting controls whether packet priority should be updated after forwarding. Configure RGCR.usp accordingly so that the device is in sync with the kernel handling. Note that RGCR doesn't allow changing arbitrary parameters mid-operation, however "usp" is exempt and can be reconfigured. Also react to NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE notifications that signify change in this configuration. Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 08b105bfb65d..3a96307f51b0 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -2402,6 +2402,18 @@ static void mlxsw_sp_router_mp_hash_event_work(struct work_struct *work) kfree(net_work); } +static int __mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp); + +static void mlxsw_sp_router_update_priority_work(struct work_struct *work) +{ + struct mlxsw_sp_netevent_work *net_work = + container_of(work, struct mlxsw_sp_netevent_work, work); + struct mlxsw_sp *mlxsw_sp = net_work->mlxsw_sp; + + __mlxsw_sp_router_init(mlxsw_sp); + kfree(net_work); +} + static int mlxsw_sp_router_schedule_work(struct net *net, struct notifier_block *nb, void (*cb)(struct work_struct *)) @@ -2488,6 +2500,9 @@ static int mlxsw_sp_router_netevent_event(struct notifier_block *nb, return mlxsw_sp_router_schedule_work(ptr, nb, mlxsw_sp_router_mp_hash_event_work); + case NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE: + return mlxsw_sp_router_schedule_work(ptr, nb, + mlxsw_sp_router_update_priority_work); } return NOTIFY_DONE; @@ -7356,6 +7371,7 @@ static int mlxsw_sp_dscp_init(struct mlxsw_sp *mlxsw_sp) static int __mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp) { + bool usp = init_net.ipv4.sysctl_ip_fwd_update_priority; char rgcr_pl[MLXSW_REG_RGCR_LEN]; u64 max_rifs; int err; @@ -7366,7 +7382,7 @@ static int __mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp) mlxsw_reg_rgcr_pack(rgcr_pl, true, true); mlxsw_reg_rgcr_max_router_interfaces_set(rgcr_pl, max_rifs); - mlxsw_reg_rgcr_usp_set(rgcr_pl, true); + mlxsw_reg_rgcr_usp_set(rgcr_pl, usp); err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rgcr), rgcr_pl); if (err) return err; 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/lzyNv3tyc1IWVyUTOuHkmEn8O6tnstYPX6yjF4YoV8mrcNMWpVS6+bRd2hUEPTHeya5x+lbX/mwSkzg==; 31:Wa68lSwfqN6mM8+aVd2h9ihKgRwUKC8M9U6NQYZ63z4fzdgu4nfg33E6mtaAXgLrmWLhTgj3pOAuteddOB8+ygEaXWlmsrN+91+PDmC0lEpOi0ODrJoL2msmxl+BITbHvcOhPTh76CyX+ZHuIy3y4Sp2VJkcSAYWR3ihf2K7iyGEj9iL62yn8gBo6bAKsFR8iZbm687/DeqcriY1EgAjNX2++iXzMtXUBt6ngFm/QeQ= X-MS-TrafficTypeDiagnostic: VI1PR05MB4191: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 20:+b2gXAHoD77IdKN6+XKVRJSK75l5pacp9ca/ZyLsj9X2h+wM9oO8JEfn+SqHoeNoeHDVXqHninA80YHvieQ8TXfejPW7LdrLS4LpJEZRrYhImSM7xOhaAJGTM9p+2gCzR/RHTa8G9+Si+gmzHijrCFfemizIFLf1ZbjvpTbiBeaWKhmZSCoX9KlyHS21g4pj2H+IRBBH2b0UyrHKaozZrIrDVYVhiWU5/HPgTBBDKI5bDMhxUWIlSl8jIMKg2XXdlHB0nXhu+fCC0H1l31ju+bfypQw2xq9Yn6Y22gRGD8ifKyci9IipFaLPo+HjeKfylVrUNg827N8ACQkKqr/wNf4hBNou+p8DhyR4+xbcDf7iJ0mglLtkB5OZC+OYhRpTyjcNiD4sU35eSgiTx93osfHQ4W/AAFWREWpocpmHJfnl3Q2c5vvdnNiZm4hDHsBPWpFux+JS1RaI16C6eUSI5GaLKg4VDkI9kQ31j5fIyFHBV9XSPYw/6r3owrssWHaX; 4:r0mf4Q174ULxehYd5txjmWMjwwliwfNbb0kJIQ+Kt6IgQKXRG1pL/bhcPdiib4QZud4dLQ+CgQlsqz9QpKHC+Kwim819fuef7YCSKBezu6Spq+6UA/KSW7i7thgfLeppzvQEYDUQsvalEeSvpAk7iFglfZnNjiZpOijjOT/DjO0fHur304yMwxq9zL7dQB46kFFAcajLAtBIEg/Yheh3+oQRXH17SCXoI9dY+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/38SG1uPFcNIpKOUB3jdD3ytnUwNnIkqDUPR9JSb635nQmtkScQiRIy08X2KynWtUFjjqflyFJfGL2zBQCr/bt81JoY+xrAQ9Ye0t0v44SVADYVxBRg5DVMQizB6xVIoeIqUYsDw52rVH+jIew+Ejo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0qKgTe9hKE9/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 From patchwork Fri Jul 27 23:05: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: 10547813 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 D1B5D112B for ; Fri, 27 Jul 2018 23:06:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BED172C53E for ; Fri, 27 Jul 2018 23:06:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B25562C6DD; Fri, 27 Jul 2018 23:06:26 +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 EEE442C53E for ; Fri, 27 Jul 2018 23:06:25 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41cl2S2RdwzF0kx for ; Sat, 28 Jul 2018 09:06:24 +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="uvVcZ6HE"; 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.74; 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="uvVcZ6HE"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00074.outbound.protection.outlook.com [40.107.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cl2M187nzF09Y for ; Sat, 28 Jul 2018 09:06:18 +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=/JH6DUROXpi05ra5oZl27hxPy85eSk90DWSq2AnpmpE=; b=uvVcZ6HECo14AjaKHLlHm3EIbU+7cGIZ9WTCaBi11X7dufUQYrhq+2wUZr971IyLZkB8WZQhODJMTwQs7xX9+2YTFgb1LWNMKx6XpuGrFhyiG+aD+6vsLFXpoKmX0coTHEKRQHYIf5TbrydD/hrXGxsFSRGSztte0NqFKxEM+U0= 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:06:12 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 5/6] selftests: forwarding: lib: Move DSCP capture here In-Reply-To: References: Message-Id: Date: Sat, 28 Jul 2018 01:05:35 +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: AM5PR0701CA0005.eurprd07.prod.outlook.com (2603:10a6:203:51::15) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d83c07f-725c-4811-fbc7-08d5f4158c59 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:PoIxbuymISPDK+FR3MpMrSe5VVelI5RqABeT//kHh7d/OWpC3yzKZZOB+AvLvFzO5bk5iyZ0KaQJjaCHbiin0Ccg1N6mkYAg8jkWVJWagK1tW1JzI4lREzdJnA4Nibvv3ta32tXKupUrwDVLxWF9woQpCJoE1L4n92dYDV6v478Ky56CyX1nYaDtgxIaYxRWv8xFSyPD5O3LN8LVqs8fup5zQ2tJB/t4V1LDNXya0qNYIyUdiUBclVtqfwqiTXvO; 25:RjhsGQaEjx8P6hrokD5C9CbDP9NxVVDOHWU8f4SVP9wcx4WdEch5eDseoeVJtMAIYQjY5mM2NEYBPs00Gudqhoz/acU6xgpSAQe4C5vt42S3Wlj2ml8T/t/u7Jxh+Xwg3/C76/+CxzjKq7a9d2XIdzEeK0tVv6gBkaXqr1NgadnMBI1UWQVwgAlHqR5fGTPVvkEildbhIr8tu460anvBEmo1xvL199mgeRG+g11X9HWxJBZYJ3Mk+qLJxz8mX4U17EWygqn/jwt5wm2Xa/sCqYGQIaTBzqecU6tQcKTaYHh0R3phT4QJySnPrS/yCuHs1pYa4lugz4sYq/1HJV1rkQ==; 31:4GK1xIRJcbZsbilNe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DMlndsR2Nw== 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:QS7EOkVoex4fU/HHv0dt6Rctr/CoKCY98gltSvqyb?= wQ5Hb2IH13MDnCiozL9coxtgCs46Lsz/j7aqL4dke5BahJrJ0uuSdGxFOhFjOBIJsv+FBrOLUyzVWd8F8K7jcoKCQRZDYQg4dmKocyoLg8ESIfdWXSLPSdvA/Bc/P0/txlubAJZe9pIXcl+wWUc9z97cnZk8CUTWPvCf3Laj9O3UhxZwZBG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DmixAMGlI9lFwOHoBQQY+E27FabNj3LaW7C5yv0AqApp4jz6JTv2y0c9xGMDgdS0OU8qhn0AOoTruS259GCc4Wllbp24QAFIVU3O2Up8pUFfO7crt5FqinFUCrAJ4Inps1d2kJfmcfcovRejg89cqXOOJO2G4MW3asNTLVDewGiRqpQiTNLjhTl0b6ZhrDiU+QAci SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 23:06:12.6334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d83c07f-725c-4811-fbc7-08d5f4158c59 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 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 --- .../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 53bea3f418ad..d29d4582b13c 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 bc826a5e99df..63de86d5b170 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 From patchwork Fri Jul 27 23:06:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10547833 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 77C21112E for ; Fri, 27 Jul 2018 23:24:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6078D2C644 for ; Fri, 27 Jul 2018 23:24:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53E3A2C6D2; Fri, 27 Jul 2018 23:24:11 +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,LOTS_OF_MONEY,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 5F3762C644 for ; Fri, 27 Jul 2018 23:24:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41clQw3MNszF0tm for ; Sat, 28 Jul 2018 09:24:08 +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="lNfkhRz5"; 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.82; 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="lNfkhRz5"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00082.outbound.protection.outlook.com [40.107.0.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41cl3L6w2zzF10h for ; Sat, 28 Jul 2018 09:07:10 +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=qX3xxYzGEf/fW06BPqSVntKls0heCHSlDU6ykrBQDmQ=; b=lNfkhRz5l15O7Nnj9EbL9V+tlB9pxeVRdo3whb3yRm6uei9TLvHVk14taiYS0pPu87duWlI0iOnekf4mHwhQpK9bFY8JUgQIKJhMMYCNlZRXkCJ4s1D0LXigD7s7xEQgeX0sw4GmTAA8MtfwEd0YVrOim1fAFOusSaQPpGEtB4o= 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:07:06 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 6/6] selftests: mlxsw: Add test for ip_forward_update_priority In-Reply-To: References: Message-Id: <08fa2594ed1dd6b5a291f44219e173bc49c30c82.1532732232.git.petrm@mellanox.com> Date: Sat, 28 Jul 2018 01:06:13 +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: HE1PR0301CA0006.eurprd03.prod.outlook.com (2603:10a6:3:76::16) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1079fcc3-4452-4802-e9cd-08d5f415ac71 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:5S/A/PB6ou05HrR8sqTGrGEKSpYW4U3pvfNGP2Ko2cEVjRNpGi3FyIVshhH34lx2lUMVlpqQFyEHR7AfPABuOcQwRADPedG33l2gtosujCvgKMbfqMfuA3rD1Cyjuo6yZCKjftQKVNyDudLbOJQjUvOdm6MjWRebIJIcd5FSQyrWGHzlwvIQ2BVgZnVdRBvHI4zOsUrMbctUpP9LHhw+wfIsu2sm+RGr1uCvXelK/WlaLqfd0F3Kwgi0wRpJVjbn; 25:6zyCfL1SlZ51+QzqkvLSr68ojk96VMoyKcPe/mpa4ssJwYUecJnJeBCzUhGkKiPnW9aqjSYBoTS6VvtrShX2SGcCydKgoYbc8KQKPC+eO7OR88V0x1cc1OEwczex4pvnOfjoVyaua0Rzvtisb8ECCa4U58zIHdIu3KuRrNMlRCNldBcfg834VlxC+jTB/qs9vzrXmDn0A1P3V4LZgCbUcrfHr3O6CdOk1/7r4rBW2DFrbzHUnmzhgoedK7s/r+TTVYjZAJqN3DdAmuf3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umSMax2kjqV6Qnz1LWdN1qOOBaxn465xk5v519nj9zvABNc4vpLjl9/iG4FMkmrzkWTSMYkUvOdBPL98HFVsOn0zAqpMEP0iWIWghmQCd6dqsG0AGaw== 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)(575784001)(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:jo4TpoY5Rfz5SyWs5pwMqs5y8m8GDVusgzgGe6/J/?= 3tuj3f6BXBYEDtBoyfgYk4oJI6QahrsRKhQlYE4KtSLYojDAieCOx/lIHOS3MWEwtHDKH/5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R4UE1rzHdxwMVMiVcL2kXgkFZi08xCILiAJZc11VUapkfackCt/1LK07QNr7xlKxbaXxM=; 7:WpCVJ/trQRXXK5MGbi8LFX4Iw0j6SJSZpQ42t4PBX18v63YmSb48EyJzz5M6ug/B9sRhJLgK3ATsqFWI4afyY8b3ESaKhxZkKcIqSzoDoE4drxZ/cdJo+gnFd20AeDleDSYocxQOCI6cG6I+vrVgKFP/V4swS2f2bXhLIsQckF6Xm12QwaH4NcMBrFiayihlZGvVvk3AGCVGhftS77V+WNO+wclXhs+X6cEORj0YqezTc0suoEK1alx4VpkNJmRb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2018 23:07:06.2899 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1079fcc3-4452-4802-e9cd-08d5f415ac71 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 Verify that with that sysctl turned off, DSCP prioritization and rewrite works the same way as in qos_dscp_bridge test. However when the sysctl is charged, there should be a reprioritization after routing stage, which will be observed by a different DSCP rewrite on egress. Signed-off-by: Petr Machata --- .../selftests/drivers/net/mlxsw/qos_dscp_router.sh | 233 +++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/mlxsw/qos_dscp_router.sh diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_router.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_router.sh new file mode 100755 index 000000000000..81958cd89f13 --- /dev/null +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_router.sh @@ -0,0 +1,233 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# Test for DSCP prioritization in the router. +# +# With ip_forward_update_priority disabled, the packets are expected to keep +# their DSCP (which in this test uses only values 0..7) intact as they are +# forwarded by the switch. That is verified at $h2. ICMP responses are formed +# with the same DSCP as the requests, and likewise pass through the switch +# intact, which is verified at $h1. +# +# With ip_forward_update_priority enabled, router reprioritizes the packets +# according to the table in reprioritize(). Thus, say, DSCP 7 maps to priority +# 4, which on egress maps back to DSCP 4. The resonse packet then gets +# reprioritized to 6, getting DSCP 6 on egress. +# +# +----------------------+ +----------------------+ +# | H1 | | H2 | +# | + $h1 | | $h2 + | +# | | 192.0.2.1/28 | | 192.0.2.18/28 | | +# +----|-----------------+ +----------------|-----+ +# | | +# +----|----------------------------------------------------------------|-----+ +# | SW | | | +# | + $swp1 $swp2 + | +# | 192.0.2.2/28 192.0.2.17/28 | +# | APP=0,5,0 .. 7,5,7 APP=0,5,0 .. 7,5,7 | +# +---------------------------------------------------------------------------+ + +ALL_TESTS=" + ping_ipv4 + test_update + test_no_update +" + +lib_dir=$(dirname $0)/../../../net/forwarding + +NUM_NETIFS=4 +source $lib_dir/lib.sh + +reprioritize() +{ + local in=$1; shift + + # This is based on rt_tos2priority in include/net/route.h. Assuming 1:1 + # mapping between priorities and TOS, it yields a new priority for a + # packet with ingress priority of $in. + local -a reprio=(0 0 2 2 6 6 4 4) + + echo ${reprio[$in]} +} + +h1_create() +{ + local dscp; + + simple_if_init $h1 192.0.2.1/28 + tc qdisc add dev $h1 clsact + dscp_capture_install $h1 0 + ip route add vrf v$h1 192.0.2.16/28 via 192.0.2.2 +} + +h1_destroy() +{ + ip route del vrf v$h1 192.0.2.16/28 via 192.0.2.2 + dscp_capture_uninstall $h1 0 + tc qdisc del dev $h1 clsact + simple_if_fini $h1 192.0.2.1/28 +} + +h2_create() +{ + simple_if_init $h2 192.0.2.18/28 + tc qdisc add dev $h2 clsact + dscp_capture_install $h2 0 + ip route add vrf v$h2 192.0.2.0/28 via 192.0.2.17 +} + +h2_destroy() +{ + ip route del vrf v$h2 192.0.2.0/28 via 192.0.2.17 + dscp_capture_uninstall $h2 0 + tc qdisc del dev $h2 clsact + simple_if_fini $h2 192.0.2.18/28 +} + +dscp_map() +{ + local base=$1; shift + + for prio in {0..7}; do + echo app=$prio,5,$((base + prio)) + done +} + +switch_create() +{ + simple_if_init $swp1 192.0.2.2/28 + __simple_if_init $swp2 v$swp1 192.0.2.17/28 + + lldptool -T -i $swp1 -V APP $(dscp_map 0) >/dev/null + lldptool -T -i $swp2 -V APP $(dscp_map 0) >/dev/null + lldpad_wait_set $swp1 + lldpad_wait_set $swp2 +} + +switch_destroy() +{ + lldptool -T -i $swp2 -V APP -d $(dscp_map 0) >/dev/null + lldptool -T -i $swp1 -V APP -d $(dscp_map 0) >/dev/null + lldpad_wait_del + + __simple_if_fini $swp2 192.0.2.17/28 + simple_if_fini $swp1 192.0.2.2/28 +} + +setup_prepare() +{ + h1=${NETIFS[p1]} + swp1=${NETIFS[p2]} + + swp2=${NETIFS[p3]} + h2=${NETIFS[p4]} + + vrf_prepare + + sysctl_set net.ipv4.ip_forward_update_priority 1 + h1_create + h2_create + switch_create +} + +cleanup() +{ + pre_cleanup + + switch_destroy + h2_destroy + h1_destroy + sysctl_restore net.ipv4.ip_forward_update_priority + + vrf_cleanup +} + +ping_ipv4() +{ + ping_test $h1 192.0.2.18 +} + +dscp_ping_test() +{ + local vrf_name=$1; shift + local sip=$1; shift + local dip=$1; shift + local prio=$1; shift + local reprio=$1; shift + local dev1=$1; shift + local dev2=$1; shift + + local prio2=$($reprio $prio) # ICMP Request egress prio + local prio3=$($reprio $prio2) # ICMP Response egress prio + + local dscp=$((prio << 2)) # ICMP Request ingress DSCP + local dscp2=$((prio2 << 2)) # ICMP Request egress DSCP + local dscp3=$((prio3 << 2)) # ICMP Response egress DSCP + + RET=0 + + eval "local -A dev1_t0s=($(dscp_fetch_stats $dev1 0))" + eval "local -A dev2_t0s=($(dscp_fetch_stats $dev2 0))" + + ip vrf exec $vrf_name \ + ${PING} -Q $dscp ${sip:+-I $sip} $dip \ + -c 10 -i 0.1 -w 2 &> /dev/null + + eval "local -A dev1_t1s=($(dscp_fetch_stats $dev1 0))" + eval "local -A dev2_t1s=($(dscp_fetch_stats $dev2 0))" + + for i in {0..7}; do + local dscpi=$((i << 2)) + local expect2=0 + local expect3=0 + + if ((i == prio2)); then + expect2=10 + fi + if ((i == prio3)); then + expect3=10 + fi + + local delta=$((dev2_t1s[$i] - dev2_t0s[$i])) + ((expect2 == delta)) + check_err $? "DSCP $dscpi@$dev2: Expected to capture $expect2 packets, got $delta." + + delta=$((dev1_t1s[$i] - dev1_t0s[$i])) + ((expect3 == delta)) + check_err $? "DSCP $dscpi@$dev1: Expected to capture $expect3 packets, got $delta." + done + + log_test "DSCP rewrite: $dscp-(prio $prio2)-$dscp2-(prio $prio3)-$dscp3" +} + +__test_update() +{ + local update=$1; shift + local reprio=$1; shift + + sysctl_restore net.ipv4.ip_forward_update_priority + sysctl_set net.ipv4.ip_forward_update_priority $update + + for prio in {0..7}; do + dscp_ping_test v$h1 192.0.2.1 192.0.2.18 $prio $reprio $h1 $h2 + done +} + +test_update() +{ + __test_update 1 reprioritize +} + +test_no_update() +{ + __test_update 0 echo +} + +trap cleanup EXIT + +setup_prepare +setup_wait + +tests_run + +exit $EXIT_STATUS