From patchwork Tue Jun 5 10:39:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 10448007 X-Patchwork-Delegate: jiri@resnulli.us Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9ED0B60284 for ; Tue, 5 Jun 2018 10:40:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C40429036 for ; Tue, 5 Jun 2018 10:40:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F1CD29041; Tue, 5 Jun 2018 10:40:35 +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 CE29B29036 for ; Tue, 5 Jun 2018 10:40:34 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 410Sxs0SDdzF1my for ; Tue, 5 Jun 2018 20:40:33 +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="OlAfqkzX"; 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.58; helo=eur02-am5-obe.outbound.protection.outlook.com; envelope-from=idosch@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="OlAfqkzX"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00058.outbound.protection.outlook.com [40.107.0.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 410Sxg3TTZzF1lS for ; Tue, 5 Jun 2018 20:40:22 +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=rg5q6KmDp2740ZA/LJ9efelepuDmkTcwlGpm1BciNO0=; b=OlAfqkzXfI4mRfkFJ69ff7eFBS/ZNuxPxCW7xc8TffptmrhmyCLV3RIt0O4XeiEaNpoTeUi90RrfEhT35cgDVdYNdu8zo+PASg5AfQHQmvVgYHYivDYXgXH5OV3O0s5SRnfB3uEIuKJH9God2WWpnNvtH9cILD2yjI4rtKymgY4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; Received: from splinter.mtl.com (193.47.165.251) by VI1PR0501MB2334.eurprd05.prod.outlook.com (2603:10a6:800:2c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.15; Tue, 5 Jun 2018 10:40:09 +0000 From: Ido Schimmel To: linux-internal@mellanox.com Subject: [PATCH net-next mlxsw 1/3] ipv6: Only emit append events for appended routes Date: Tue, 5 Jun 2018 13:39:38 +0300 Message-Id: <20180605103940.5248-2-idosch@mellanox.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180605103940.5248-1-idosch@mellanox.com> References: <20180605103940.5248-1-idosch@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [193.47.165.251] X-ClientProxiedBy: CWLP265CA0005.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:10::17) To VI1PR0501MB2334.eurprd05.prod.outlook.com (2603:10a6:800:2c::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2334; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2334; 3:qBhamXi6/irA+WdFRqKG610rXP3oTOtxqElpuM+SfxcGOGuYDwCTV7DpCuBSjoRNoEWGs7txExPDfCGf6ob6oFSJV6X9yne6tQdCKZdWLqg3mmLvrs/N/XBKYjIAtm5I2cqeeetTIVcUsqA1yO2ypV+5Tcey/Vo0OFnrAoDZ21x+8nGxdm0m/rHU7bigQ0u1YvkvPLAy33Dk8PFjPNK+6O3Pu36NLBfYc/93kEsrM7mk9sPvam91jeVPIdCT7+cE; 25:W1+RguSHAJmZ0kSAU8btB8ESnzfGaPq51sKVYJEYmXzCbHOeQ+s2oHdciHeLy6TJKOBS1MZNxmHxyCodmkL8v0+Kq3hxLU4Sy75k0nTxm9p3mj9mu74BIZw4TPCris/JySCXUWq8OLNSd7Oy0dBtOOkFhJuOfy37Iliyvhmtz/Num8zCcz65qPu7Ew6Pr1gA6IMdWPXhwzwAHTHvYhFvUbJh9G/YiMC7tFFw4eVShVZkHLwTO3ToMV9L2haXegT0Vk/5nlsuEbbFVWqvBEC17S/OEgXRPgMVqe3ct3RAD3H0tjqo0UbwSWF22tkWox9rv02Zw4NP+5NoQNiqAIHnqg==; 31:mb1Uwh1JN3jg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eoxQ9URCCUFV7CTO/ibED3uaSL7gUMnb4CfuV3Llj0X4kESyGNstZ7NwK0g+8 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2334; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2334; X-Forefront-PRVS: 0694C54398 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(39860400002)(366004)(376002)(346002)(199004)(189003)(81166006)(66066001)(4326008)(81156014)(97736004)(8676002)(476003)(76176011)(6486002)(6506007)(7736002)(52116002)(386003)(37006003)(59450400001)(86362001)(106356001)(47776003)(16586007)(51416003)(305945005)(316002)(50226002)(486006)(8936002)(2906002)(956004)(5660300001)(6636002)(6666003)(68736007)(3846002)(6116002)(446003)(6512007)(2616005)(48376002)(50466002)(16526019)(26005)(2361001)(478600001)(2351001)(53416004)(53936002)(105586002)(34206002)(11346002)(25786009)(36756003)(107886003)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2334; H:splinter.mtl.com; 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; VI1PR0501MB2334; 23:dIQ0sjdzsRwwezKPWLPVf13iUnZlsB1xMrbh00c?= =?us-ascii?Q?rDotcP56GARFhmAa6Mq8SkRhDiTx9XMGMtIg73HfTrlPhejzBUZ/YVEpotTG?= =?us-ascii?Q?Fdt9+6b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xpaV2+Npr7Cu/BU6rr8Jenb46pgM4b+r4vG0FM5EPt4GbAms9ewl3Ib1MC2LofbRzbsJgInNqc0rHNg==; 5:dXQ3TOq14Rhe56rQ3xZv2ywEJqHkHAfHQhKr2rk+WXjhZxYp0BXHpelDts4i3ajPIXnIf1kz/Fse/PCZqgKD0cT9Dgk/yG4Ul/AmC2S+tw60xWfw2YeDayCZ+zBOzkzbEsrdttUT2PAufxZlL8Uh5+mwkszoOHSlbRbt5ahfHs4=; 24:2yUGEeXwnsJfIDwsMtCOpR+Z1KzMUFIxlX/qZmu1CIrdnkQZXCvNcXV0zTp3DpY+eQJEXolif5oBfjc1zbgaLoR5SjlXsSMMX4l+kzqaHFs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2334; 7:B8qogdAuznrMveje2AuAYIGHqyvaRgS07VAHX2mGZNVQ+C1HBLzPf5+ajVZj0Zbq+e/6CgDMw9tjRAxOOX5+xRXERA/2HPlUKGjNVfvByTnwfri1sKel6FHhtysYpgJkkCCDaDdsgxxhVz89xwLQqT/+GbZ9Att+Vr/QkfPR0CM0eXiUeWOF1wwIdIEcFwUTcrEX0fkuOYKRGlQnDoh5TDBgSCJZ9LpejIelXrKSBonYVgMnx0z8CbWrUTDPLdmQ X-MS-Office365-Filtering-Correlation-Id: f44e02d7-d4c3-4e67-4f97-08d5cad0b627 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2018 10:40:09.6299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f44e02d7-d4c3-4e67-4f97-08d5cad0b627 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2334 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 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 Current code will emit an append event in the FIB notification chain for any route added with NLM_F_APPEND set, even if the route was not appended to any existing route. This is inconsistent with IPv4 where such an event is only emitted when the new route is appended after an existing one. Align IPv6 behavior with IPv4, thereby allowing listeners to more easily handle these events. Fixes: f34436a43092 ("net/ipv6: Simplify route replace and appending into multipath route") Signed-off-by: Ido Schimmel --- net/ipv6/ip6_fib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index f9132a6de917..cd18b2e8e3e6 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -934,6 +934,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt, { struct fib6_info *leaf = rcu_dereference_protected(fn->leaf, lockdep_is_held(&rt->fib6_table->tb6_lock)); + enum fib_event_type event = FIB_EVENT_ENTRY_ADD; struct fib6_info *iter = NULL, *match = NULL; struct fib6_info __rcu **ins; int replace = (info->nlh && @@ -1013,6 +1014,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt, "Can not append to a REJECT route"); return -EINVAL; } + event = FIB_EVENT_ENTRY_APPEND; rt->fib6_nsiblings = match->fib6_nsiblings; list_add_tail(&rt->fib6_siblings, &match->fib6_siblings); match->fib6_nsiblings++; @@ -1034,15 +1036,12 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt, * insert node */ if (!replace) { - enum fib_event_type event; - if (!add) pr_warn("NLM_F_CREATE should be set when creating new route\n"); add: nlflags |= NLM_F_CREATE; - event = append ? FIB_EVENT_ENTRY_APPEND : FIB_EVENT_ENTRY_ADD; err = call_fib6_entry_notifiers(info->nl_net, event, rt, extack); if (err)