All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>,
	netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>
Subject: Re: [PATCH RESEND v3 net-next 1/7] net: dsa: introduce helpers for iterating through ports using dp
Date: Wed, 20 Oct 2021 16:10:35 -0700	[thread overview]
Message-ID: <09987a3f-4137-6115-0947-784712c4678f@gmail.com> (raw)
In-Reply-To: <20211020174955.1102089-2-vladimir.oltean@nxp.com>

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@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

  reply	other threads:[~2021-10-20 23:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 17:49 [PATCH RESEND v3 net-next 0/7] Remove the "dsa_to_port in a loop" antipattern Vladimir Oltean
2021-10-20 17:49 ` [PATCH RESEND v3 net-next 1/7] net: dsa: introduce helpers for iterating through ports using dp Vladimir Oltean
2021-10-20 23:10   ` Florian Fainelli [this message]
2021-10-20 17:49 ` [PATCH RESEND v3 net-next 2/7] net: dsa: remove the "dsa_to_port in a loop" antipattern from the core Vladimir Oltean
2021-10-20 17:49 ` [PATCH RESEND v3 net-next 3/7] net: dsa: do not open-code dsa_switch_for_each_port Vladimir Oltean
2021-10-20 17:49 ` [PATCH RESEND v3 net-next 4/7] net: dsa: remove gratuitous use of dsa_is_{user,dsa,cpu}_port Vladimir Oltean
2021-10-20 17:49 ` [PATCH RESEND v3 net-next 5/7] net: dsa: convert cross-chip notifiers to iterate using dp Vladimir Oltean
2021-10-20 17:49 ` [PATCH RESEND v3 net-next 6/7] net: dsa: tag_sja1105: do not open-code dsa_switch_for_each_port Vladimir Oltean
2021-10-20 17:49 ` [PATCH RESEND v3 net-next 7/7] net: dsa: tag_8021q: make dsa_8021q_{rx,tx}_vid take dp as argument Vladimir Oltean
2021-10-21 11:50 ` [PATCH RESEND v3 net-next 0/7] Remove the "dsa_to_port in a loop" antipattern patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09987a3f-4137-6115-0947-784712c4678f@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.