From patchwork Mon Jul 30 12:45:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10549025 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 EDFD213B8 for ; Mon, 30 Jul 2018 12:45:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC04B296E2 for ; Mon, 30 Jul 2018 12:45:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF97629715; Mon, 30 Jul 2018 12:45:36 +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 06CBE296E2 for ; Mon, 30 Jul 2018 12:45:36 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fK6k1y2kzF153 for ; Mon, 30 Jul 2018 22:45:34 +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="I6w1Cm/7"; 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.4.59; helo=eur03-db5-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="I6w1Cm/7"; dkim-atps=neutral Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40059.outbound.protection.outlook.com [40.107.4.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fK6K2k6MzF0gv for ; Mon, 30 Jul 2018 22:45:12 +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=QpMk2yDNTUw+Le7wObvllE+OodmOLzFLzS5tJZYz7do=; b=I6w1Cm/70LqM4te6YjsMJGxGMcGS6koZ0Dw12AStULpmJsFXOVw6Ld261OO8angUCZE5FkdflavYV782WADgL8CmyfyMMqE/qLg5ru90Z+tm2gLZVSsbuTRPyc3fsd8Dr92VsJVuDqTs3DUnFgFIRF4/rxfv7ViUD1WvUO89Ecg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4187.eurprd05.prod.outlook.com (2603:10a6:5:18::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Mon, 30 Jul 2018 12:45:06 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 1/7] net: ipv4: Control SKB reprioritization after forwarding In-Reply-To: References: Message-Id: <6c112814d8b67a8ff0246a518ae1c96fa247c72a.1532953818.git.petrm@mellanox.com> Date: Mon, 30 Jul 2018 14:45:02 +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: AM0PR02CA0030.eurprd02.prod.outlook.com (2603:10a6:208:3e::43) To DB7PR05MB4187.eurprd05.prod.outlook.com (2603:10a6:5:18::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bdad9804-bb2d-4176-99cb-08d5f61a473b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4187; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4187; 3:UeYtM8CV01rQhtxsxNn2/ZYha73GpUuWsHsx9WvNwUv4C4zAHn7dGH6ZmjkO6pFUQdshb/5jPj/PWf1wz0lsqFovchnO8AjXj5RRk5CWNixpV4Zx9LuKtx2pt2zSVUsYCxdyofJYRuVvmuGgaB/HKHOBoPbfaaOuDaDEeWuuCyZO7NQV5LWWDkWD2F+dmZ0MK36wi2REDelTaEceJpkJl5xF9cWpRq9X22WasNSAZm+KKZa6s6qnv9K8hhPqNdU1; 25:Qw5DQHTOmObTI8Fusd43ApXz4JTxuutBLI5mgh+7WGlvwzkPkFg3lpUs9Xs93gWttPJNG+pANusmqAWH++KFw6KdCgpWiG5uT2tb7L04ZMneRuL4kJiEnPIuC5tyh64aDqjl3gzL2vHKMKr2HGkx5wQQSg+4Lf+IGDUHSN0PSp0LLEA5ay99/VwDDuud47g2jzIjnqG79KVTumc+2dPMkSoqXsdFfTMfnQVjlGw+9/dQoxJDsMeFX+9HnoREo+7AkkKmGxdXlYfOjDF9X+JznMeU454qN4XTAxBL5gesBeFwRjO8wL+Dd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X1pFKX0EF0DxEs6gT52FN9I43hKvQsfHGH7oD/GY+FXWcG3qe5Z9h2IXQAhx/5u+xxEhiQ== 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)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4187; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4187; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(136003)(396003)(346002)(376002)(199004)(189003)(5660300001)(81166006)(81156014)(48376002)(26005)(186003)(8676002)(16526019)(50466002)(6636002)(6666003)(97736004)(36756003)(68736007)(8936002)(956004)(86362001)(11346002)(575784001)(476003)(2351001)(486006)(14444005)(2616005)(316002)(106356001)(118296001)(446003)(76176011)(386003)(25786009)(478600001)(16586007)(53936002)(6486002)(6862004)(105586002)(37006003)(58126008)(305945005)(47776003)(7736002)(66066001)(6116002)(51416003)(2906002)(6496006)(3846002)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4187; 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; DB7PR05MB4187; 23:yj50zTiEKlkKbqonxUkbkliQrHzpK/ZUNaZHzYQh/?= z3yzKiG0i0tTv0pElnEjSWCRi5+yBdCJRpSLCa58xRJNtT1aGxuXbmr7ITjA9aslVIRq6XopIknE1DzEN6K84NHOFC10lWeph51kPn/Ict7GpAGqFic3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FzcMe06zQr2Gs=; 7:QbilFqht8esBVAEquypFOkPYQSZmvnhuhAi82bNqC4kDBEzVV9lEHeaGOzolIP8c2pDVbNZz06aDWdPOQG5Knd91b5DhylRby/ICdjR6inXgqmn0Fu2qupXInVpde1fCzt7CCkb6d6BZGAfnfBCjGOIbbVT3U2zQE5EH1s3ZJt/9u1rg4jOILQIkZkeYVYvvkQKyIbher/Uejp6XfKo6R+KhGThwO0VYTG5ATadgOd090bLElWOLnovZseE+TNY3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 12:45:06.4964 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdad9804-bb2d-4176-99cb-08d5f61a473b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4187 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/netns/ipv4.h | 1 + net/ipv4/af_inet.c | 1 + net/ipv4/ip_forward.c | 3 ++- net/ipv4/sysctl_net_ipv4.c | 9 +++++++++ 5 files changed, 22 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/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..e21dda015513 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -664,6 +664,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 = proc_dointvec_minmax, + .extra1 = &zero, + .extra2 = &one, + }, + { .procname = "ip_nonlocal_bind", .data = &init_net.ipv4.sysctl_ip_nonlocal_bind, .maxlen = sizeof(int), From patchwork Mon Jul 30 12:45:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10549027 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 8E241A755 for ; Mon, 30 Jul 2018 12:45:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D3D0296A7 for ; Mon, 30 Jul 2018 12:45:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71B0729715; Mon, 30 Jul 2018 12:45:39 +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 A44CA296A7 for ; Mon, 30 Jul 2018 12:45:38 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fK6l1R9MzF0jn for ; Mon, 30 Jul 2018 22:45:35 +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="x1NlI9/H"; 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.59; 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="x1NlI9/H"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00059.outbound.protection.outlook.com [40.107.0.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fK6Q4ZFWzF0gv for ; Mon, 30 Jul 2018 22:45:17 +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=TqU9DENjW9ldOcYxhYcAJzTvQpxVbCXv9ZwAIAdAmgI=; b=x1NlI9/H3wj9+QwRY+4a8lPbNst6jiamVavH5V05VNtFoaNZ0jvTDubGwacjctLVUTQIxrPJ1GGdSHSsqYf53iIm7H5yzQ+Oal7zAM1U7vfWxBd3L4GXXIRQfkHCk9XlBoRXjnHM7zxsHXrreLqxDFkxHXEBfWdodCueYtVLgDc= Received: from t540p (78.45.160.211) by AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Mon, 30 Jul 2018 12:45:12 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 2/7] net: ipv4: Notify about changes to ip_forward_update_priority In-Reply-To: References: Message-Id: Date: Mon, 30 Jul 2018 14:45:07 +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: LO2P265CA0156.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::24) To AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0ec6e67-d6eb-4573-db14-08d5f61a4aa7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4177; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 3:e5GVgvNwE7CSIPwGLeNvhOndywGxcMjABdleFFz52Om5lXA5CNAwUHNEs2Y/szt4EM90or3+rRaUKQr6pJXWGT2J5wO5Rm6LUNo6NbujCl8kaV+nnIezdmQEpchgFVaJIshQKlctmdTwcROqa0zwUFnv8VS6sYQW3sy6G4ZIR+2fUDAArm6MzFgJcpXnf2YK5XwRbEoJSskoAz6O+LJvQHPKiLRvAo0pIhXScr0PayuZzfrg7CnBxvnhgxBvBXwl; 25:CbBvOpc5/dCDGWonyVxfIpqOJJdZavBMd/fiIJb1RlCmA9x6k7+zx4LoZ3GRW0/PJlRpClgoq9N7tc1G7V84oyVapHsa54uJHQ5wQYbQpLXOoC3Cxmm/LURAe2rLb8dNBaDGxgH1kgKoZTHyhKFQxCxjXTaui9hdrd1FBS4RHn/abditZipsbnaBOYuwNpC8WDjgtuw7Kn8aTuCEwTwljklUpbTM2g0zXyQmb9W0Y5BlihVvO4KgCeYjQqqw16gxet9+4PY41Nkn81DAMAy5T6aqpuYml4Enhs2HYBqPiewuBxXsdxS60aeA8JkMZ5Sd1JZdEebIo2NsZPisPKB6zQ==; 31:WTo4eVe01h/MJgbA5xE6M8CRpYLSZqnoJPeEmAp6J9f4jT4ir//Yw7HdgVuJjgPhPhf4TBam/3UXwtx184dkWgidmaiGgC+fwuGM1QEzFEeNy83fnLGsaiWSgvMfaAmOjv5E2DAA+8gtZ2zLYDM3v38Yt1Er3K7LutSixsG0MMNvpH7wyxzYjUU8PvjXOReb3t0jX1UnuEuSDToZChZVUUg3wcffZFzk2oDM7H/b7hI= X-MS-TrafficTypeDiagnostic: AM0PR05MB4177: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 20:mFBiNWGiko422wuq0uBkDbm3pKr2KAEFfoXUL06mdTajyXRdsF/OlR01lNqIXuLkCI2Tcf1uOj7Ja0Tg5w0ugdSZRpqFEOu0EY5oK9RolHPaMtI2C6beB5i/LTDmGJMT4wgAVMb0Ep0UFGl39nCyQPQHIQuqzlp3cSklmMJ/clFV3aWGzSvSAWpsILoNDuSOZDRAwdqTnBRA2xMN3ITBygdYReHoSoAy8/fFr3Zh0hbfmJn0dDkpdg8iJVVvx5A/cO8vUztYIqPLw6PyqAQKVZYoYLb1PMcZqtcfWlyCZ/u4/U5ZSWMdIDOw3TsxUI5mAc4Twk3X9sAP6BybryAlGXoap+r382teafshkrPSUdSJvDUYP9hJxGhG2y8TeqN7ttvUWN9kb4BfF5B3OBpPgRgvwaNNfvdSId+vuJNvMUK6yp8utuByJDu4UQp0NSPR28l8N/vyUt6owdlC9sc08kZ2NFzGluLcsr2OVz+RcpBwD44q/1/e00uvBeSCY4yE; 4:xUA58SdQCR0rNLXQI/skQUqxColDzpta71FO6to0sZncuOqAW1f+3NzR+3DAdT8xyK4REqTeCs0HEdm+mZjKFHAxb9P5VooCQI9rYaR+wakHMXjteWboFz11cpewRpvH3lpq6m5v8A84iUM1n70L6aNK2SnhNFhzwjAKhn9JX2a3wnKMm9yuvrHvF4cSnxCRxRjm+KL05yCmpPKDkQkFk3MALTZ7sN6Rivq0BSyeIMo4xvv7TB8vdDFRSD6JGivkPYSHE6c27b4NCCTywF9xEg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:AM0PR05MB4177; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4177; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(39860400002)(366004)(396003)(376002)(346002)(189003)(199004)(6116002)(97736004)(25786009)(48376002)(50466002)(3846002)(2906002)(5660300001)(6862004)(6486002)(58126008)(316002)(16586007)(37006003)(6666003)(6636002)(118296001)(68736007)(8936002)(81156014)(8676002)(52116002)(81166006)(51416003)(47776003)(66066001)(76176011)(16526019)(36756003)(186003)(478600001)(6496006)(105586002)(386003)(7736002)(2616005)(956004)(2351001)(53936002)(486006)(446003)(26005)(14444005)(11346002)(305945005)(476003)(86362001)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4177; 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; AM0PR05MB4177; 23:/1jFlzkhO4bCqUZ+UVdRm24R2NJaE+uylNH+40nrf?= dLjpZ1DIerUYkASKnQnLGB0PomOgwHOgo6eWwaZCY9I4156b0XHM3fxxtYt/al8rrGioPjjP+LN3f64Vx9GDPWap9NsBhjzYGW7Rj5Lj4PUNUKVrr7m5ZPe4HFOd7TCBzI38Ist/iVs5XdUE9wAg7HPcgRB3TFqf7vfkLAoFwYXeP56RFmvXSy9/SLLNlfPZRTY3EyrlYL5FHTuvezlfEw0pdjyhjcNXWzAhBGl14OKACIVbfRN1fJTjkbMFIuIUO5Ku6j75niTdlgyFxu1y1BjR7WrpPkLBWihfEYeCdeyis3hWvCU8+pDzBD6F6tm0LiCMy0kR93xpLIRayap4D6U90Z/z+dKW0Js3OWIBvuJrm6FzTHUJCIC5oa2Ru03PcfvRzpD+sVL2vWmXQBxauvfS6pubTiTp6Gk54peV12MbRDoUVbmpyT8+oriGhPDnKX8zIeX6Z9NIr8GIRV7AWvr0f2CarrQ5x90QE9UxG/L4NVA+4IYAxfqOq06gFR3kBHS+RH6XKrv8OcZd59PleQlJ8eZddD0VB0/bt67FDWJr8Bq+0OtzHwaZd2FDuOH1VAbajTIwch5Ce4kl5qawcycr2FMW0vhhgaUXmakTinwAGYzcEXia7PotWU4I3x3FDGN3WPGv/eBxmRudf4yxEkZ0YPWdE5mZUAeGpBn1Q68XS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vwCCD9wbtz3PNZAhVHZmT0YAVImEK+I9h083YxTpV8g1KlJ4RTlLR9zJF8ctBeyWi/gFa7MtRy0kPKu1/ZPIWllq5frpx4UEtJ8dwGBmawrlcBb7SH5ocZ2S1jWxVFJvnmwXJCy1Rxgu/GO7/oUMvmu430ItXf+MtO+xLBgrPm51dYV1l+hrFgeIgYO7tpEbhMzssY67I8N1e6WehZszPnW2Qx9x/mIoTxoLIeV1HpcjDmGJOZXAb2lpDeUYRHbNEdWt+9Ga71oLeTBPVkpBXFGAoh6fTGN6tNdS6Fn4tvw9G3UKYJTKjnstgBE/qyKCygXXQ==; 5:0MMANzqB1ybkjpvc1w91VHQkHhPA+/xzJQtmYmKGbVUPuxkKDSgUmru98pI8c5z9A/R0To6uQgblFTXArGsh+ISggDe1QhbbgdLNqj56wMeXVOD/K+DE8ypj9CQhcwr4juCluW4WYVBmc+o4kinHSkGdP6vKjDD84StaufKNPnw=; 7:fPE4JCvH/RIrTxs+/cwsotANGqPzC5JI63mH8d0fHWK1wr8fOPnF9bhQb3UT0+MqznNcHmnDRRnp911Rghs3ZTUYQDmYdzaDKzpg3a259VBUnpnKbznGSx5Y8tAMvQsfo65jWbyQPtDIC9Sdtp3v0idrMWA1AyOXxNC9pNGr9O83FKcab34Xd//4mKcJOymndkSxiO5hFgThDwuxSOMxZJAXu1HHDxtcbsWC9Dra3VlOtVarFG8UszOA/cKMenZg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 12:45:12.2939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0ec6e67-d6eb-4573-db14-08d5f61a4aa7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4177 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 Drivers may make offloading decision based on whether ip_forward_update_priority is enabled or not. Therefore distribute netevent notifications to give them a chance to react to a change. Signed-off-by: Petr Machata --- include/net/netevent.h | 1 + net/ipv4/sysctl_net_ipv4.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) 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/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index e21dda015513..b92f422f2fa8 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) { @@ -668,7 +685,7 @@ static struct ctl_table ipv4_net_table[] = { .data = &init_net.ipv4.sysctl_ip_fwd_update_priority, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec_minmax, + .proc_handler = ipv4_fwd_update_priority, .extra1 = &zero, .extra2 = &one, }, From patchwork Mon Jul 30 12:45:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10549029 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 E4AA9A755 for ; Mon, 30 Jul 2018 12:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D42D5296A7 for ; Mon, 30 Jul 2018 12:45:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8976296EC; Mon, 30 Jul 2018 12:45:51 +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 19666296A7 for ; Mon, 30 Jul 2018 12:45:51 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fK706wgNzF0xv for ; Mon, 30 Jul 2018 22:45:48 +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="CW524RBb"; 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=104.47.2.71; helo=eur01-db5-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="CW524RBb"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0071.outbound.protection.outlook.com [104.47.2.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fK6Z35mnzF153 for ; Mon, 30 Jul 2018 22:45:25 +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=MIwL2zxLm2r7QE2NAU+Di5Rqo8F5O+WbJgokPRYxJxc=; b=CW524RBbIoAbrfDtVfMTUy2KhAQybRb/b9CU8vwS224WA7Rm2IxKJvUgnHj7hc9vmC28avPBSzRWloPEA75xAy0r/Ji+kksSCZEDfArSxYo25x28bEd7ri8ZZaTxrsbDMQfe/5ELHKrFl/aSx1Xsk9Z1G0LLIzzgarP47o4c2R0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4186.eurprd05.prod.outlook.com (2603:10a6:5:18::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.20; Mon, 30 Jul 2018 12:45:19 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 3/7] mlxsw: spectrum: Extract work-scheduling into a new function In-Reply-To: References: Message-Id: Date: Mon, 30 Jul 2018 14:45:12 +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: HE1PR0701CA0048.eurprd07.prod.outlook.com (2603:10a6:3:9e::16) To DB7PR05MB4186.eurprd05.prod.outlook.com (2603:10a6:5:18::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3fc311da-7fa2-4d58-78be-08d5f61a4ef3 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4186; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4186; 3:C1U2BFP8y717g4ai18W77j55AeSIO7ti+2YOVP/n766eCdIIAkc8ZtbnCq2mMU1qBMJ+kjx8iD6R505VL6OLbUJlOacudMkreByA0gmxAU7jiZHNHcj6RzuYpxYTVlegSzbUR4CW+q1JtqJsT7xf77RMEdoDKB+aGn3MWEcw1mVnyrsAyy4vLpe840mRLWm1FNmwjqXltp+AjQvF3x2Taz8OixQ7XpUCmjZX4+kbbEolYLT3jsVDSn/qpvHZOG89; 25:BAsQgTdI07wsMmwk6tWwZ025yTT/qtDP2xgdL3mBB/TiV1dJ+n1WrvDYP7DSHd+vptKL1be9f9Ty0Dhi014hKD0npqptlDpJar8UwMBuOVpRTn1/EZ5ExWXObIJhkB+9+QOvNPvwzM6swElGW3dFjBAzDXB+kjS5/xodED46I7rUyU20rpjh4By+TKrUk43VvnJDH/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buseBrXXTsl6uPcnY9m2ienhPprd7iOG5KHkv4Xav0KtXtfugDhXxPchaGUE0r5UW7jG5Fa33Yyw2FtadHLMhI+q7WORdA6cpmi9ue5pDwR8k84xz4QGEyuFOk4XB3GskxsbZ+EZbow8QDH1bZS2refM99fs2xXC8BjJWSGpd1TlZAUQ== 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:DB7PR05MB4186; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4186; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(376002)(39860400002)(366004)(346002)(199004)(189003)(478600001)(50466002)(2351001)(48376002)(305945005)(7736002)(8676002)(81156014)(47776003)(66066001)(8936002)(105586002)(25786009)(106356001)(81166006)(2616005)(476003)(3846002)(486006)(956004)(97736004)(118296001)(6486002)(36756003)(53936002)(68736007)(5660300001)(2906002)(16526019)(14444005)(6862004)(446003)(11346002)(6116002)(86362001)(37006003)(58126008)(316002)(26005)(6666003)(76176011)(186003)(6496006)(51416003)(16586007)(52116002)(386003)(6636002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4186; 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; DB7PR05MB4186; 23:p6J7LlT2//W/Z/S4hELFUNfgpkPyzniuqZHBPDnNk?= 0bMH2BvjwoCGSF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JjBBGEAgYbyKhRthjXKjvCgvDK18nNknrllxS+O7cggHSvptBrcRQ4DFhRVmKM7RTJ6EihATlKcNzRDmRGS3uqSw74=; 7:F7O473f2tUaVayya2MMvFn/Z8wvjqMJsZi5KTzl6niVspWap3Sb+hgxRdSuVIsq3Jm5XNOZIIlvSfb2PU2rzaORidKhQ/60850SpvopY0xLEU3Pc5eM/pGDeG3a6px4htJqqyrvUjcssk0UA9msWwhEgyHsDA853q/vwG5jbwNCuqPr3kbQXtfK98PGDgXpvSthzf4UJTfoAQ8d0ZnuWC4+bkGFr5XhREOReU4bC81PjuJ8uIkmhhXq51Ix+wlTS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 12:45:19.2251 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3fc311da-7fa2-4d58-78be-08d5f61a4ef3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4186 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 Reviewed-by: Ido Schimmel --- .../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 Mon Jul 30 12:45:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10549031 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 0B0D213B8 for ; Mon, 30 Jul 2018 12:46:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE9A5296A7 for ; Mon, 30 Jul 2018 12:46:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2B17296E2; Mon, 30 Jul 2018 12:46:01 +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 32770296EC for ; Mon, 30 Jul 2018 12:46:01 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fK7C1Ck2zF12X for ; Mon, 30 Jul 2018 22:45:59 +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="KBEmoIoJ"; 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.43; 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="KBEmoIoJ"; dkim-atps=neutral Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30043.outbound.protection.outlook.com [40.107.3.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 41fK6k31fSzF15Z for ; Mon, 30 Jul 2018 22:45:34 +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=HHLaGaPeElmdNrfqI0CKjzmZrq8neddiohQKx//MWNw=; b=KBEmoIoJKRPRwySv+/eobUbGHB6t5O63ZTPX9TfNdC3jQRmv6uy919+OfreB+BhA95TzMkN9eB4sFjM5KUk2KUck3D7yAGerRGn9qKd33FiPubSQMluPGJLllzpD3/5PkZexbcWgXQKK9GiQTnNyrqhKL6Y1x+JnX4/zEOT9s7Y= 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:25 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 4/7] mlxsw: spectrum_router: Handle sysctl_ip_fwd_update_priority In-Reply-To: References: Message-Id: <148edc60513956d533f71000a83b5e14a617eccd.1532953818.git.petrm@mellanox.com> Date: Mon, 30 Jul 2018 14:45:20 +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: DB6P193CA0001.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::11) To AM6PR05MB4181.eurprd05.prod.outlook.com (2603:10a6:209:40::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 203ac548-cceb-4fa8-ec53-08d5f61a525e 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:X7Nx++FmGge4/hzgLyOKEyhm4nKBCNqt901OTYIQLS6q19M1BKpXujnaPQEC+pX3XrZDn3TkwbKGuY3iL7A4k9mrAGK0GL558Zh+tP1Q/kNFojlRFsYKfL9JtjeNSF+TqLMsfI4xERJs8BzKmr0/T0IGMjlVMI93TFWpKI+N0iq/zNYYVEd+0Z4Cj2aXu9Jgb5CIzJHnLUVoK1BInpw1dY7oKx0qhTDeSrYTgSn7oe3mrfy7cpzO63rFcKf3hpGG; 25:l36mFklHKH7ZuFLQ63iE6x6l97u+ruyPinmlM9Zqf9eu3p+A/ADUf7vjHwQUoTdRZwMykDaxLteeMflajWzRGz+e5d2lSNItOXGSstC3JtSuRLwc46MIRwCUEnGcXgQVa3Hct0LQAmQsGrC/mtpI3NOxAzA92e2h+3c3ELnYI4jCHQ3k32zz3KgreGTxeFa6r9m4ZomUS/TZPZCb5MMaCGj7yCS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5H3iqJS4zqHhKZ2jh7/xW34Pu72mVfF8EQ8a4DT1zhkjvVDTJqGEGsiNJuMKTwcgTY+HmrSsCsoXDD4UMwWwwcuzownf/HWksiWcPouXOBivLwOW5RcJVlbLPdByI4FdMqjIEodYXgqDTsY6t0LqA== 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:xS3hD3SgEV2nk+LdT/6ILGf/6WP3dt4cSmNLC1S53?= 83Zuww1NtJoQeMDTGoiPATPM67YAX/l5EdAE36r358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MRw9UJ1KbYtkKoFZ/myZ+A1Pa6dytWB76b5lA1Qn72N8uZkLbnk2+gDpX8BFviF1my6R2K5UbObNihdg=; 7:XKvTfA0irckdROtQx9pV0rbfKz4ZcqicgKP3eEHWOPvY361OBJAnwBYpzXmm/LDBO8RRStUCfD7LN+qE/jDzucwdP5Fpkhy8Cv0s8GJ6lxT4aL7qw5xq4raYcn1CLGz/B6h5g8bcaBYLV73EiuiqFbFtA0A+ES0VfuEZUjQgI2Q/k4hK9aBHeXQ8tv6aqwpdtC0BaXamRo1tXhAamvZle2aNieQWonsIY1EZZbISvpra52eDkKFqLM68cu/jVgLj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 12:45:25.1246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 203ac548-cceb-4fa8-ec53-08d5f61a525e 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 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 Reviewed-by: Ido Schimmel --- 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 Mon Jul 30 12:45:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10549033 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7A7E13B8 for ; Mon, 30 Jul 2018 12:46:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A681B296A7 for ; Mon, 30 Jul 2018 12:46:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AD98296EC; Mon, 30 Jul 2018 12:46:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CCDCC296A7 for ; Mon, 30 Jul 2018 12:46:04 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fK7G3gM5zF152 for ; Mon, 30 Jul 2018 22:46:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="mVPHkm8k"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=2a01:111:f400:fe05::61a; helo=eur02-he1-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="mVPHkm8k"; dkim-atps=neutral Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on061a.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe05::61a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fK6t5tyczF12j for ; Mon, 30 Jul 2018 22:45:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZDBB8TsRSHkUjkKSvMWxO4amTdCA8EVQtfSY3S4cq/g=; b=mVPHkm8k1dIij2OPloRde69RJrt0MPT4Rp6DyLPJcpzoIa2LC9vz37zk5JNxpED+IMcroioEq0uHQxzNEBys9gMalNAcfZuT85wVIp+ykm9XMutIJr86kGOqik0uAcNAASFN6SscesS7JA/rdZHr8eP+C//2P9H2akdOxeoyes4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4182.eurprd05.prod.outlook.com (2603:10a6:209:40::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Mon, 30 Jul 2018 12:45:35 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 5/7] selftests: forwarding: Move lldpad waiting to lib.sh In-Reply-To: References: Message-Id: <8663b5c8afd0cac36c0e4bc529c7d5b7e5b9038e.1532953818.git.petrm@mellanox.com> Date: Mon, 30 Jul 2018 14:45:25 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: VI1PR0501CA0040.eurprd05.prod.outlook.com (2603:10a6:800:60::26) To AM6PR05MB4182.eurprd05.prod.outlook.com (2603:10a6:209:40::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 187d604b-18fe-47f7-5335-08d5f61a583a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4182; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4182; 3:JVqa7nHs31GH7tfc7r7fgUBcxNEx/Kug+8qXS7csrBCFfqAL1L9mXJDRRPeJjVT+ITo5bH1RjzZxmktd08Li1LGpiU3NV6qM40abW32CDpyGp6+M/EZsb5kvZ5kY0OhQvjuEEFdIDkz5iMQ4ppe+nEzMhaXkWDPtmRWYL0AROxKCjCy+o0gUHK1SXxwTWKSlmF7/tck+g5fIikKLJ7ghH2LO3+5rFZBH2mOh5YfXJZrMFPs+mgUnGgBEq/cQwnrU; 25:w5UhVkhOW2EboPyYszEK/wFaDJUH/Y4I9Mk0w9fypTSr0HhyK4Q94sBKtNDM22rm05xxX4E7gjtUfEisYMNUhNOnBrqPY462qFKHijCXFABgk11MP/5hRlqqQqM7XLfSPjuOteYD0/hsSy8z2uCS+VrzNHfw2HS2huEuIufPRqim8jxgv4gF0Id6+3iWi512+oxiEXegMTXb5i9y0a5ueZ+xNQcn0HmgynJr24JiUgoyzI7hicxsDtwkVPABpI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uP0cAUiSLTa6bRrxYOIbUdXdo/uvAxnmI0BeeVSG2nhA3A0F4drBuqLBMXaPvowz+219d8XZHukvFW2twVU/MnZ2dvY8SFYJtpB25mJpkUUZnA0Lx81Eh/ui8EqIZZpw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:AM6PR05MB4182; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4182; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(366004)(376002)(136003)(396003)(199004)(189003)(66066001)(25786009)(53936002)(48376002)(47776003)(26005)(7736002)(76176011)(86362001)(16586007)(316002)(37006003)(58126008)(3846002)(6116002)(486006)(50466002)(81166006)(8676002)(51416003)(6862004)(81156014)(8936002)(52116002)(5660300001)(305945005)(6496006)(16526019)(186003)(386003)(6666003)(2906002)(6636002)(11346002)(446003)(68736007)(97736004)(36756003)(118296001)(14444005)(105586002)(106356001)(2351001)(6486002)(478600001)(2616005)(956004)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4182; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR05MB4182; 23:N/y1ToIdF+3d0xPdN1nUludDH472vcM+xM+CmHrn5?= tzUAakE4WpYPcvgvFSy7skCWVXAEaipQKUCA3rMTUwH8hc1S1lb/Tmo0R7HraVr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TprcEEqad2cZ0bYN3r3wlf2hsq5O2f6Xb9Xmc9oF25V7v3jnLZ+hpvhiZ7eeIgOLZA=; 7:VtBbhbsfUQAd1io1k6YAVt/1MCE7mlePSeXLuaIBXdkWTpBVkfmnwC/Y4iEkuwBKPUfascsZFIMls4yAusQK3FiMAfcC9qB7PHfX5QoXOhGr2Ktap/vBaLQwhQ8KtqU6bHAMM8ieWkgiHyIwP5JBl0KLf1ZygcrWMWNKWzTSoKHWbUkqWs+az/WiTtEtlNBE9C7RQRplIB3iGRWXnT3gaoEMhF6+G1uUUj0sYseuajR2mzKdUD23ukZW0380T2Cv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 12:45:35.0881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 187d604b-18fe-47f7-5335-08d5f61a583a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4182 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP The function lldpad_wait() will be useful for a test added by a following patch. Likewise would the "sleep 5" with its extensive comment. Therefore move lldpad_wait() to lib.sh in order to allow reuse. Rename it to lldpad_app_wait_set() to recognize that what this is intended to wait on are the pending APP sets. For the sleeping, add a function lldpad_app_wait_del(). That will serve to hold the related explanatory comment (which edit for clarity), and as a token in the caller to identify the sites where this sort of waiting takes place. That will serve when/if a better way to handle this business is found. Signed-off-by: Petr Machata --- .../selftests/drivers/net/mlxsw/qos_dscp_bridge.sh | 23 +++------------------- tools/testing/selftests/net/forwarding/lib.sh | 21 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh index cc527660a022..9e875ee8dc1c 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh @@ -103,16 +103,6 @@ dscp_map() done } -lldpad_wait() -{ - local dev=$1; shift - - while lldptool -t -i $dev -V APP -c app | grep -q pending; do - echo "$dev: waiting for lldpad to push pending APP updates" - sleep 5 - done -} - switch_create() { ip link add name br1 type bridge vlan_filtering 1 @@ -124,22 +114,15 @@ switch_create() lldptool -T -i $swp1 -V APP $(dscp_map 10) >/dev/null lldptool -T -i $swp2 -V APP $(dscp_map 20) >/dev/null - lldpad_wait $swp1 - lldpad_wait $swp2 + lldpad_app_wait_set $swp1 + lldpad_app_wait_set $swp2 } switch_destroy() { lldptool -T -i $swp2 -V APP -d $(dscp_map 20) >/dev/null lldptool -T -i $swp1 -V APP -d $(dscp_map 10) >/dev/null - - # Give lldpad a chance to push down the changes. If the device is downed - # too soon, the updates will be left pending, but will have been struck - # off the lldpad's DB already, and we won't be able to tell. Then on - # next test iteration this would cause weirdness as newly-added APP - # rules conflict with the old ones, sometimes getting stuck in an - # "unknown" state. - sleep 5 + lldpad_app_wait_del ip link set dev $swp2 nomaster ip link set dev $swp1 nomaster diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 843a6715924f..90af5cd23417 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -247,6 +247,27 @@ setup_wait() sleep $WAIT_TIME } +lldpad_app_wait_set() +{ + local dev=$1; shift + + while lldptool -t -i $dev -V APP -c app | grep -q pending; do + echo "$dev: waiting for lldpad to push pending APP updates" + sleep 5 + done +} + +lldpad_app_wait_del() +{ + # Give lldpad a chance to push down the changes. If the device is downed + # too soon, the updates will be left pending. However, they will have + # been struck off the lldpad's DB already, so we won't be able to tell + # they are pending. Then on next test iteration this would cause + # weirdness as newly-added APP rules conflict with the old ones, + # sometimes getting stuck in an "unknown" state. + sleep 5 +} + pre_cleanup() { if [ "${PAUSE_ON_CLEANUP}" = "yes" ]; then 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-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4Q==; 5:MJYXafvXPnSwfHhtfE1AojS6YMA3mCCW4Tc2PcJpLGGBlIKLKvf+JWez7Ak2C9rXcmPxH+cr6ORvjAZKhgkBdSv76aLeQueecTEjZ3SJkpFwJ+86a1pLPenSgvA7mndfDVefeP7uTxFI0I82IaSYYlwJyW00WAzbGvY6ubhBTIE=; 7:a0D9L/l3sHpa6jCV0KECWJ7HNM8ErcPYR0St6UT5umm1ChChVl5P7pK2VKLL9h/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 From patchwork Mon Jul 30 12:45:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10549037 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 31B44A755 for ; Mon, 30 Jul 2018 12:46:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20B71296A7 for ; Mon, 30 Jul 2018 12:46:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15162296EC; Mon, 30 Jul 2018 12:46:13 +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 26D91296E2 for ; Mon, 30 Jul 2018 12:46:12 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fK7Q2P3BzF19d for ; Mon, 30 Jul 2018 22:46:10 +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="LbktkloW"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=2a01:111:f400:fe0a::631; helo=eur03-db5-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="LbktkloW"; dkim-atps=neutral Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0631.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::631]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fK762V9pzF14Y for ; Mon, 30 Jul 2018 22:45:54 +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=5EN6NKCIp/5HkrnYxZsfnPA6lprStfSxqZHHAgzVX6k=; b=LbktkloWIEfmoDVeR/ImygRy0tPPEni/ouF9fPyH6cxMlhTP5igtO9+7TlnVPrdgbLtNEKjxsAFJcQUZDZngnSz1aAtbiMxRGujY4GtpSa4FBj8tl9uLkAmZ9Hmv3DMrDN4TSH9NdanJuV2CXC2Tr9Nl0kTO8+UiLKHGvE+sBMk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4184.eurprd05.prod.outlook.com (2603:10a6:209:40::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Mon, 30 Jul 2018 12:45:45 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 7/7] selftests: mlxsw: Add test for ip_forward_update_priority In-Reply-To: References: Message-Id: <4f6d92464634aed8728f3a6ae8a3eb1ad6c7fba2.1532953818.git.petrm@mellanox.com> Date: Mon, 30 Jul 2018 14:45:40 +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: HE1PR05CA0154.eurprd05.prod.outlook.com (2603:10a6:7:28::41) To AM6PR05MB4184.eurprd05.prod.outlook.com (2603:10a6:209:40::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 131afd74-cf86-43c7-6937-08d5f61a5edc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4184; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4184; 3:aaKOl7uc8Vn9BUl88sPgA7vk8NOmU2dHP4nlhsPbSZIEUQ1KVL2i7su9pMmYUO2lQHRXHM3Ul8PAfa0+IAZmlpjO8Khx1r2viUv6tMLnDe72Q2iRD2R2NG9s5lfbkU/1Trln9AisU0b642pnr5/eRonXCabikpz6U8bl7qtXpPr/wWdzoiiyuYboKd4Hdzc0MpABSF+4Kvwuo4O3NaRR/xd545g3nJIBB1h8u65vaEj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Mh5HYOHiK/Tt5O2wXkbB/Dqoag44qdShPMj9VQZzV5z5rKAa3FelKHQxUFJo8i27imA9dB20vnng3y0Y77AdK4QQQb2moxXWyyM8dC/ba3bczTAMeINz; 4:zAyCuScyc/zJwsa09tACxfOKk+LzqzAaSsQX64CvljRpByZL9q23a11PAOVp+j/znEfCmMdXgrmsFox9oh8AD4/LZReD5UY8UCvAZ7ORe1SLX+pdYAoq1oB+cCtMXI/Uijh0v3PjzvmPjiddnzZgtX4gxcDqIFivKxkI2PaHtj/mJgw/pvqdbrqtuyZZjhiolO0hVL55iMImuyzqX1JmmNkzfPgqiplfQviyPyVfhddTEdOZ4xlOosTYaHwvUbhoe5Bvy89EuPotaFoFb76F2w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM6PR05MB4184; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4184; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(366004)(346002)(136003)(189003)(199004)(6666003)(8936002)(7736002)(956004)(446003)(2616005)(11346002)(476003)(2906002)(6636002)(305945005)(50466002)(68736007)(48376002)(37006003)(58126008)(186003)(86362001)(575784001)(316002)(81166006)(81156014)(486006)(47776003)(16526019)(26005)(14444005)(66066001)(8676002)(25786009)(53936002)(6862004)(386003)(106356001)(2351001)(97736004)(6486002)(16586007)(5660300001)(6496006)(76176011)(51416003)(3846002)(105586002)(118296001)(6116002)(478600001)(52116002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4184; 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; AM6PR05MB4184; 23:YDUFYDfwneITxMWaFz4NydavJkrs6jzpYqKTH2Le5?= 0OQ6X6+z8M8N7HSSDDqPLfH1h9AemCBzTE7P1twTxPzFGCRXw1nygnrQ0QRO3SMJQwSK8BR7X2EEhsKt7Qu58ZVVX4l5z8vTRcadZdqrY0DLYEOB3f0Z+UPeaHe7gG15gg75aPpnP0zUtJltu9rx0u/3A5yVYz474+15N0g6v4TBYb5eP3lzRim4lHfo5ZK1gM2c/UjhFtaQ6bHlVHJc42/3Hz3fQ47d8Z4NYsTKBLqGi3D96w+jpwToiMI2qbUUFseeuWkx7apaGM/r4MWWxEOt2PXQ4i2r6JAhfzeRddJkds+iZMX7lJuVyBA5sfNebH2vuvltHZ9PSFNtL1Fv7rf0R2lLoivhPcq7klafK1GVLtjAwRL5BdORnmoTgHmePI5BDSq4ZL9m2z1+3Hbz3J8APbsK9d30xvRpbWajvkdlzXhG3FEOs8Md4J1FVQPXq9fNKgkOlUIMEtIQEYazZCvAM2pAoHA72vNksgA+Tbj7ljA3RMs6+0LyrWWNM5t7R4xs6zTCKy1Dck6oYTdlgHnfjqLLpDTqVtrq9Xps5p+ZrG1sT4UigqpX9tDXOo+NZo0cyhXqEK5LXhJoObA/2mGErtZSgMVlcX+Ie+N0xahXP6qrTCvq3+9VNCaar7Z9I5VG/q0uRqjzlWHyjlw5jytcHcYgL2ow9tzoexEQTmEdgMp9ldwTdR6n1OVq65IvQK7iYxcEX95p39XQbkAJVFvgxT4FrAFLl/MxPIJFLuoV7PargD28oPqKmsASmw0nFCZ2nteO/KCGEmtRwXA4lOHRz8ImhuTaLhUshEHYQ4dUqxZfhbIdsuZygTtCGeFfgK75Z7N59/iPa2KH0xL9vxfSc862d5nB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lXz2ubgb0MB3Xj5DAWegUiZhMEWXaCut4Af20y7tCtFNm1ShZWe5bG1a3SOtid2I2nZfOnJX9lCdT+eijdodSuURepjowVEVUaCKpIbzfgpB3LFDvZ7l3Bl4rx2k+taThbGwbzGq9IRgJKNWbne462M9MKT7MAg9rVpVeIi2w==; 5:1DQuXNKYfOgMU1GL1bZuWlJkrpk5M0ws7IeyJfX7aPRqF5y0f7442u8MLzBWwDXinA4RJESp+2V0gmO+1a/g5TRJZkL75aOSMXk+XUZ216Vj7rPWfMYW5ChzZncUU+n97SRoiXmc56wXjRv+R2Z/dIzKvf888P/D4E6KsmxWAFM=; 7:srNdAk2V5Z2nJTg8+4KbT4wF3lKj2LvzZ12ut5Mw2wptzRDEJLTutEkDZRr6x1n1N7eP45xnPfCPV5LjKjK09elcSmmiYu4dGTMxC+ep8+NS4sAtz08akUtdCYughOGuOsa3566GeCNCK1xOGlS8QVjPGYTtxkklpOZvX2n1qVnk9T6qxqb8XbUbLfmdwbgmpRgtY2K68FgQ84pN244IBhrFIs2oEnnUGScYRig/Kj5rB7c9orKUosR34KcW8BDb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 12:45:45.9503 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 131afd74-cf86-43c7-6937-08d5f61a5edc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4184 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 Reviewed-by: Ido Schimmel --- .../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..281d90766e12 --- /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 response 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_app_wait_set $swp1 + lldpad_app_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_app_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