From: "Marek Behún" <kabel@kernel.org>
To: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v0] net: dsa: mv88e6xxx: Add FID map cache
Date: Tue, 11 Jun 2024 09:50:16 +0200 [thread overview]
Message-ID: <20240611095016.7804b091@dellmb> (raw)
In-Reply-To: <20240610050724.2439780-1-aryan.srivastava@alliedtelesis.co.nz>
On Mon, 10 Jun 2024 17:07:23 +1200
Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz> wrote:
> Add a cached FID bitmap. This mitigates the need to
> walk all VTU entries to find the next free FID.
>
> Walk VTU once, then store read FID map into bitmap. Use
> and manipulate this bitmap from now on, instead of re-reading
> HW for the FID map.
>
> The repeatedly VTU walks are costly can result in taking ~40 mins
> if ~4000 vlans are added. Caching the FID map reduces this time
> to <2 mins.
>
> Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
> ---
> drivers/net/dsa/mv88e6xxx/chip.c | 25 +++++++++++++++++++------
> drivers/net/dsa/mv88e6xxx/chip.h | 4 ++++
> 2 files changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index e5bac87941f6..91816e3e35ed 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -1815,14 +1815,17 @@ int mv88e6xxx_fid_map(struct mv88e6xxx_chip *chip, unsigned long *fid_bitmap)
>
> static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid)
> {
> - DECLARE_BITMAP(fid_bitmap, MV88E6XXX_N_FID);
> int err;
>
> - err = mv88e6xxx_fid_map(chip, fid_bitmap);
> - if (err)
> - return err;
> + if (!chip->fid_populated) {
> + err = mv88e6xxx_fid_map(chip, chip->fid_bitmap);
> + if (err)
> + return err;
>
> - *fid = find_first_zero_bit(fid_bitmap, MV88E6XXX_N_FID);
> + chip->fid_populated = true;
> + }
> +
> + *fid = find_first_zero_bit(chip->fid_bitmap, MV88E6XXX_N_FID);
> if (unlikely(*fid >= mv88e6xxx_num_databases(chip)))
> return -ENOSPC;
>
> @@ -2529,6 +2532,9 @@ static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port,
> port, vid);
> }
>
> + /* Record FID used in SW FID map */
> + bitmap_set(chip->fid_bitmap, vlan.fid, 1);
> +
wouldn't it make more sense to do this bit setting in
mv88e6xxx_atu_new() and clearingin a new function
mv88e6xxx_atu_delete/drop() ?
next prev parent reply other threads:[~2024-06-11 7:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 5:07 [PATCH v0] net: dsa: mv88e6xxx: Add FID map cache Aryan Srivastava
2024-06-10 12:23 ` Andrew Lunn
2024-06-19 23:17 ` Aryan Srivastava
2024-06-11 7:50 ` Marek Behún [this message]
2024-06-19 23:22 ` Aryan Srivastava
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=20240611095016.7804b091@dellmb \
--to=kabel@kernel.org \
--cc=andrew@lunn.ch \
--cc=aryan.srivastava@alliedtelesis.co.nz \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).