[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YNCaQK8Yfj2m2txE@lunn.ch>
Date: Mon, 21 Jun 2021 15:55:12 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Vladimir Oltean <olteanv@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <vladimir.oltean@....com>
Subject: Re: [PATCH net-next 2/6] net: dsa: export the
dsa_port_is_{user,cpu,dsa} helpers
On Fri, Jun 18, 2021 at 09:30:13PM +0300, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@....com>
>
> 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 <vladimir.oltean@....com>
Reviewed-by: Andrew Lunn <andrew@...n.ch>
Andrew
Powered by blists - more mailing lists