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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 415BEC49EA4 for ; Mon, 21 Jun 2021 13:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C27E61042 for ; Mon, 21 Jun 2021 13:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbhFUN5d (ORCPT ); Mon, 21 Jun 2021 09:57:33 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:47682 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbhFUN53 (ORCPT ); Mon, 21 Jun 2021 09:57:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=0y2AG1KVARbZJSAErpRPTxZwN4qEY/8lMyi8ZL6CDdI=; b=dCabUN7Zaz9cX57l2rnk4XrXcs CYTzJc2t50zqXaqUItVT1fWpcJxtuLALnTUVLxqJ9xb3Jenvh3LvUGJSP3SjrF6Vz5rjPuiFpAfC8 /tWgXylYpXG59HhQxKe5CkEcEcHwZkftozHDE/DAHz9Pgvg0rS7gOD+Qd9vhWuJZfYEE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1lvKOO-00AVt7-My; Mon, 21 Jun 2021 15:55:12 +0200 Date: Mon, 21 Jun 2021 15:55:12 +0200 From: Andrew Lunn To: Vladimir Oltean Cc: Jakub Kicinski , "David S. Miller" , netdev@vger.kernel.org, Florian Fainelli , Vivien Didelot , Vladimir Oltean Subject: Re: [PATCH net-next 2/6] net: dsa: export the dsa_port_is_{user,cpu,dsa} helpers Message-ID: References: <20210618183017.3340769-1-olteanv@gmail.com> <20210618183017.3340769-3-olteanv@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210618183017.3340769-3-olteanv@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Jun 18, 2021 at 09:30:13PM +0300, Vladimir Oltean wrote: > From: Vladimir Oltean > > The difference between dsa_is_user_port and dsa_port_is_user is that the > former needs to look up the list of ports of the DSA switch tree in > order to find the struct dsa_port, while the latter directly receives it > as an argument. > > dsa_is_user_port is already in widespread use and has its place, so > there isn't any chance of converting all callers to a single form. > But being able to do: > dsa_port_is_user(dp) > instead of > dsa_is_user_port(dp->ds, dp->index) > > is much more efficient too, especially when the "dp" comes from an > iterator over the DSA switch tree - this reduces the complexity from > quadratic to linear. > > Move these helpers from dsa2.c to include/net/dsa.h so that others can > use them too. > > Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn Andrew