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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 C8D32C43603 for ; Wed, 11 Dec 2019 19:47:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B3A62077B for ; Wed, 11 Dec 2019 19:47:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DICqxrmh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729599AbfLKTrU (ORCPT ); Wed, 11 Dec 2019 14:47:20 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:60587 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbfLKTrU (ORCPT ); Wed, 11 Dec 2019 14:47:20 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 3791B220FF; Wed, 11 Dec 2019 14:47:19 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 11 Dec 2019 14:47:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type: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=fm1; bh=AA6JNm PLFiwugb2/Q/Tds6Me1AQ4yG0OAPhoGdszRdU=; b=DICqxrmhZ0GJRy50488zpT m3XrIkPTy4IPTQRcpoSE1lChda1v/Xmz0lOFtBFI4rguvw/P9TuSkTKEvbsqQGDQ ulNoSnmKZld+LcWebqWmZPZ8II3lTTvxcHIMPcSQKgmpYrgCIuVAooejOJn1cgLw QfYJHx2Qi2YEwrtTi65yVq247xI5uGBI0ve10SVeHRSSo/wj8M5F0+kBh5ES1zEN c7wI2rfQ3ctQg7+cT+44QJ4d8waXhOKT5po3EqQ0GT/uDjkSQu1fweaNYdJKdjbP EPFPnim6btOY2S3ENP1c7a4Jpq3tvJCHmZYQk2IXhszXzSogrmp1OTJCWysL90Yg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudelhedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujggfsehttdertddtredvnecuhfhrohhmpefkugho ucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucfkphepje ejrddufeekrddvgeelrddvtdelnecurfgrrhgrmhepmhgrihhlfhhrohhmpehiughoshgt hhesihguohhstghhrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (unknown [77.138.249.209]) by mail.messagingengine.com (Postfix) with ESMTPA id 2581780064; Wed, 11 Dec 2019 14:47:17 -0500 (EST) Date: Wed, 11 Dec 2019 21:47:05 +0200 From: Ido Schimmel To: David Ahern Cc: netdev@vger.kernel.org, davem@davemloft.net, jiri@mellanox.com, roopa@cumulusnetworks.com, mlxsw@mellanox.com, Ido Schimmel Subject: Re: [PATCH net-next 3/9] ipv4: Notify route if replacing currently offloaded one Message-ID: <20191211194705.GA486739@splinter> References: <20191210172402.463397-1-idosch@idosch.org> <20191210172402.463397-4-idosch@idosch.org> <112373c1-cdb6-86bf-33ac-f555b93db735@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <112373c1-cdb6-86bf-33ac-f555b93db735@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Dec 11, 2019 at 10:40:09AM -0700, David Ahern wrote: > On 12/10/19 10:23 AM, Ido Schimmel wrote: > > +/* Return the first fib alias matching prefix length and table ID. */ > > +static struct fib_alias *fib_find_first_alias(struct hlist_head *fah, u8 slen, > > + u32 tb_id) > > +{ > > + struct fib_alias *fa; > > + > > + hlist_for_each_entry(fa, fah, fa_list) { > > + if (fa->fa_slen < slen) > > + continue; > > + if (fa->fa_slen != slen) > > + break; > > + if (fa->tb_id > tb_id) > > + continue; > > + if (fa->tb_id != tb_id) > > + break; > > + return fa; > > Rather than duplicating fib_find_alias, how about adding a 'bool > find_first' argument and bail on it: > > if (find_first) > return fa; > > continue to tos and priority compares. Sure, I'll change this tomorrow morning. Thanks, David! > > > + } > > + > > + return NULL; > > +}