[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09987a3f-4137-6115-0947-784712c4678f@gmail.com>
Date: Wed, 20 Oct 2021 16:10:35 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Vladimir Oltean <vladimir.oltean@....com>, netdev@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>
Cc: Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <olteanv@...il.com>
Subject: Re: [PATCH RESEND v3 net-next 1/7] net: dsa: introduce helpers for
iterating through ports using dp
On 10/20/21 10:49 AM, Vladimir Oltean wrote:
> Since the DSA conversion from the ds->ports array into the dst->ports
> list, the DSA API has encouraged driver writers, as well as the core
> itself, to write inefficient code.
>
> Currently, code that wants to filter by a specific type of port when
> iterating, like {!unused, user, cpu, dsa}, uses the dsa_is_*_port helper.
> Under the hood, this uses dsa_to_port which iterates again through
> dst->ports. But the driver iterates through the port list already, so
> the complexity is quadratic for the typical case of a single-switch
> tree.
>
> This patch introduces some iteration helpers where the iterator is
> already a struct dsa_port *dp, so that the other variant of the
> filtering functions, dsa_port_is_{unused,user,cpu_dsa}, can be used
> directly on the iterator. This eliminates the second lookup.
>
> These functions can be used both by the core and by drivers.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
--
Florian
Powered by blists - more mailing lists