From: Andrew Lunn <andrew@lunn.ch>
To: Mattias Forsblad <mattias.forsblad@gmail.com>
Cc: netdev@vger.kernel.org, Vivien Didelot <vivien.didelot@gmail.com>,
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>
Subject: Re: [RFC net-next PATCH 3/3] mv88e6xxx: rmon: Use RMU to collect rmon data.
Date: Thu, 18 Aug 2022 17:36:12 +0200 [thread overview]
Message-ID: <Yv5cbL7xUFRo02Bu@lunn.ch> (raw)
In-Reply-To: <20220818102924.287719-4-mattias.forsblad@gmail.com>
> @@ -1310,16 +1323,22 @@ static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port,
> struct mv88e6xxx_chip *chip = ds->priv;
> int ret;
>
> - mv88e6xxx_reg_lock(chip);
> + if (chip->rmu.ops && chip->rmu.ops->get_rmon) {
> + ret = chip->rmu.ops->get_rmon(chip, port, data);
> + if (ret == -ETIMEDOUT)
> + return;
> + } else {
>
> - ret = mv88e6xxx_stats_snapshot(chip, port);
> - mv88e6xxx_reg_unlock(chip);
> + mv88e6xxx_reg_lock(chip);
>
> - if (ret < 0)
> - return;
> + ret = mv88e6xxx_stats_snapshot(chip, port);
> + mv88e6xxx_reg_unlock(chip);
>
> - mv88e6xxx_get_stats(chip, port, data);
> + if (ret < 0)
> + return;
>
> + mv88e6xxx_get_stats(chip, port, data);
> + }
> }
I don't particularly like the way this is all mixed together.
Could you try to split it, so there is an MDIO set of functions and an
RMU set of functions. Maybe you have some helpers which are used by
both.
I would also suggest you try to think about ATU dump and VTU dump. You
ideally want a code structure which is very similar for all these dump
operations. Take a look at how qca8k-8xxx.c does things.
Is it documented in the datasheet that when RMU is used a snapshot is
not required?
Andrew
next prev parent reply other threads:[~2022-08-18 15:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 10:29 [RFC net-next PATCH 0/3] net: dsa: mv88e6xxx: Add RMU support Mattias Forsblad
2022-08-18 10:29 ` [RFC net-next PATCH 1/3] dsa: Add ability to handle RMU frames Mattias Forsblad
2022-08-18 12:44 ` Andrew Lunn
2022-08-19 5:21 ` Mattias Forsblad
2022-08-18 10:29 ` [RFC net-next PATCH 2/3] mv88e6xxx: Implement remote management support (RMU) Mattias Forsblad
2022-08-18 13:21 ` Andrew Lunn
2022-08-19 5:28 ` Mattias Forsblad
2022-08-19 12:29 ` Andrew Lunn
2022-08-18 10:29 ` [RFC net-next PATCH 3/3] mv88e6xxx: rmon: Use RMU to collect rmon data Mattias Forsblad
2022-08-18 15:36 ` Andrew Lunn [this message]
2022-08-19 5:47 ` Mattias Forsblad
2022-08-18 11:58 ` [RFC net-next PATCH 0/3] net: dsa: mv88e6xxx: Add RMU support Vladimir Oltean
2022-08-19 5:07 ` Mattias Forsblad
2022-08-18 12:31 ` Andrew Lunn
2022-08-19 5:14 ` Mattias Forsblad
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=Yv5cbL7xUFRo02Bu@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=mattias.forsblad@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.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).