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/zxnykw+4Dh5rkf8g0Vs71AM+PCVyf5zI5byVWaBhBLudsWlmhq9xofiwTKUDrYPK/6j6hYxqG9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sCsoXDD4UMwWwwcuzownf/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/l5EdAE36r358mWz917JiY9uXfTwiDQzPtnIevXvN8TMQ5Uk4aJ4Pb7vQL/d6VU5avzHfU1T6NGqaa5nezmN6m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ObNihdg=; 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;