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:C48eamYy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QeZNjG5JfRX2cuQ== 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/+ndG6RbduKE2i14KoJNaHGAG51sXoDDPRYAN3qCPpP09wj3HR4RF4HBJZqD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S70zSz320hWcxuwXf9BGNKn4YYlcJ7Er2AuwYMLQLjLIR6tf0BX0Z4ta9d5E6rnJT/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;