Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>, Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	Arun Ramadoss <arun.ramadoss@microchip.com>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next v1 4/7] net: dsa: microchip: ksz8_r_sta_mac_table(): Avoid using error code for empty entries
Date: Tue, 4 Apr 2023 14:58:10 +0300	[thread overview]
Message-ID: <20230404115810.eznhi7jck7g2loje@skbuf> (raw)
In-Reply-To: <20230404101842.1382986-5-o.rempel@pengutronix.de> <20230404101842.1382986-5-o.rempel@pengutronix.de>

On Tue, Apr 04, 2023 at 12:18:39PM +0200, Oleksij Rempel wrote:
> Prepare for the next patch by ensuring that ksz8_r_sta_mac_table() does
> not use error codes for empty entries. This change will enable better
> handling of read/write errors in the upcoming patch.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

FWIW, it looks like for port_fdb_add(), you could skip the search in the
static MAC table, as long as you just keep a reference to the last
populated index, because the bridge won't allow, to my knowledge, adding
the same MAC address twice (this has changed when we stopped allowing
bridge bypass operations in commit b117e1e8a86d ("net: dsa: delete
dsa_legacy_fdb_add and dsa_legacy_fdb_del")), and so, having space would
mean that the last populated index is < dev->info->num_statics - 1.

This guarantee and optimization possibility is different from
port_mdb_add(), because there, you might be asked to modify an existing
entry, and so, you still need the search to find it. But still, you
could limit the search for the remaining 3 operations - port_fdb_del(),
port_mdb_add(), port_mdb_del() - just from 0 to that last populated
entry, not to dev->info->num_statics, which should still accelerate the
operations a bit.

  reply	other threads:[~2023-04-04 11:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 10:18 [PATCH net-next v1 0/7] net: dsa: microchip: ksz8: Enhance static MAC table operations and error handling Oleksij Rempel
2023-04-04 10:18 ` [PATCH net-next v1 1/7] net: dsa: microchip: ksz8: Separate static MAC table operations for code reuse Oleksij Rempel
2023-04-04 11:28   ` Vladimir Oltean
2023-04-04 10:18 ` [PATCH net-next v1 2/7] net: dsa: microchip: ksz8: Implement add/del_fdb and use static MAC table operations Oleksij Rempel
2023-04-04 11:31   ` Vladimir Oltean
2023-04-04 12:19     ` Oleksij Rempel
2023-04-04 12:50       ` Vladimir Oltean
2023-04-04 13:06         ` Oleksij Rempel
2023-04-04 10:18 ` [PATCH net-next v1 3/7] net: dsa: microchip: ksz8: Make ksz8_r_sta_mac_table() static Oleksij Rempel
2023-04-04 11:34   ` Vladimir Oltean
2023-04-04 15:11   ` Arun.Ramadoss
2023-04-04 16:00     ` Oleksij Rempel
2023-04-04 10:18 ` [PATCH net-next v1 4/7] net: dsa: microchip: ksz8_r_sta_mac_table(): Avoid using error code for empty entries Oleksij Rempel
2023-04-04 11:58   ` Vladimir Oltean [this message]
2023-04-04 10:18 ` [PATCH net-next v1 5/7] net: dsa: microchip: ksz8_r_sta_mac_table(): Utilize error values from read/write functions Oleksij Rempel
2023-04-04 15:12   ` Arun.Ramadoss
2023-04-04 10:18 ` [PATCH net-next v1 6/7] net: dsa: microchip: Make ksz8_w_sta_mac_table() static Oleksij Rempel
2023-04-04 15:13   ` Arun.Ramadoss
2023-04-04 10:18 ` [PATCH net-next v1 7/7] net: dsa: microchip: Utilize error values in ksz8_w_sta_mac_table() Oleksij Rempel
2023-04-04 15:15   ` Arun.Ramadoss
2023-04-06  9:40 ` [PATCH net-next v1 0/7] net: dsa: microchip: ksz8: Enhance static MAC table operations and error handling 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=20230404115810.eznhi7jck7g2loje@skbuf \
    --to=olteanv@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=arun.ramadoss@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=woojung.huh@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox