From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BD5CC35280 for ; Wed, 2 Oct 2019 08:41:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11950206C0 for ; Wed, 2 Oct 2019 08:41:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gVlEVc8k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727907AbfJBIlk (ORCPT ); Wed, 2 Oct 2019 04:41:40 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:55611 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfJBIlg (ORCPT ); Wed, 2 Oct 2019 04:41:36 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 322D62071B; Wed, 2 Oct 2019 04:41:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 02 Oct 2019 04:41:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=2Z9sA0nkZlXc+zR9KCPyEKa47IuMW3mWcyjqw3366XE=; b=gVlEVc8k xgIpsyWeZaKhin1ItrEAs4nkoY+VhgyQh+4QHyQSqKMj2EoqUfInWYd7o/38eTOr ekm4hmm4YKZ0JYgGDqDljsOwnZwlQ5o3X0TNhNZ+VaF7x5xcKceq8CizMl77a0UI vF/ClP5/Iclvb5QW1wwF2caR42pBcN1i+lJOld/wve4cy14XoiN9tU6hoGG1xO8+ +Yns1gw01EeGaETRZDK9pANoJKTESL0XhK9klpiTviqFGapg+yNeVdjNB8VgnL3b NxPK0f0Mx89+pXKM8e3Yv4ShlHqmKPJBwXbHxz8JgH/yvvBKAQUMxn0iW6rAYaQC DZ3eWfGl9Zq6Hw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrgeeigddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhs tghhrdhorhhgqeenucfkphepudelfedrgeejrdduieehrddvhedunecurfgrrhgrmhepmh grihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhgnecuvehluhhsthgvrhfu ihiivgepfe X-ME-Proxy: Received: from splinter.mtl.com (unknown [193.47.165.251]) by mail.messagingengine.com (Postfix) with ESMTPA id 93311D60065; Wed, 2 Oct 2019 04:41:34 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, dsahern@gmail.com, jiri@mellanox.com, jakub.kicinski@netronome.com, saeedm@mellanox.com, mlxsw@mellanox.com, Ido Schimmel Subject: [RFC PATCH net-next 04/15] ipv4: Notify newly added route if should be offloaded Date: Wed, 2 Oct 2019 11:40:52 +0300 Message-Id: <20191002084103.12138-5-idosch@idosch.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191002084103.12138-1-idosch@idosch.org> References: <20191002084103.12138-1-idosch@idosch.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel When a route is added, it should only be notified in case it is the first route in the FIB alias list with the given {prefix, prefix length, table ID}. Otherwise, it is not used in the data path and should not be considered by switch drivers. Signed-off-by: Ido Schimmel --- net/ipv4/fib_trie.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 8387b275721c..e5896729dcb9 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1311,6 +1311,16 @@ int fib_table_insert(struct net *net, struct fib_table *tb, if (WARN_ON_ONCE(!l)) goto out_free_new_fa; + if (fib_find_first_alias(&l->leaf, new_fa->fa_slen, tb->tb_id) == + new_fa) { + enum fib_event_type fib_event; + + fib_event = FIB_EVENT_ENTRY_REPLACE_TMP; + err = call_fib_entry_notifiers(net, fib_event, key, plen, + new_fa, extack); + if (err) + goto out_remove_new_fa; + } err = call_fib_entry_notifiers(net, event, key, plen, new_fa, extack); if (err) goto out_remove_new_fa; -- 2.21.0