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>,
linux@armlinux.org.uk, ansuelsmth@gmail.com
Subject: Re: [PATCH net-next v13 4/6] net: dsa: mv88e6xxxx: Add RMU functionality.
Date: Sat, 17 Sep 2022 20:02:15 +0200 [thread overview]
Message-ID: <YyYLpyOrmRM/Qj/n@lunn.ch> (raw)
In-Reply-To: <20220916121817.4061532-5-mattias.forsblad@gmail.com>
On Fri, Sep 16, 2022 at 02:18:15PM +0200, Mattias Forsblad wrote:
> The Marvell SOHO switches supports a secondary control
> channel for accessing data in the switch. Special crafted
> ethernet frames can access functions in the switch.
> These frames is handled by the Remote Management Unit (RMU)
> in the switch. Accessing data structures is specially
> efficient and lessens the access contention on the MDIO
> bus.
Thanks for continually reworking this. It is nearly there now.
I said earlier, you want lots of small patches which are easy to
review. I would separate the MIB stuff into a separate patch. This
patch can provide the basic infrastructure to send a request to the
RMU, and do basic validation of the reply. Then have patches which
make use of that. One such patch is getting the ID. Another patch is
getting statistics.
> +int mv88e6xxx_state_get_stats_rmu(struct mv88e6xxx_chip *chip, int port, uint64_t *data)
> +{
> + const u64 *stats = chip->ports[port].rmu_raw_stats;
...
> +static void mv88e6xxx_rmu_stats_get(struct mv88e6xxx_chip *chip, int port, uint64_t *data)
> +{
> + u16 req[4] = { MV88E6XXX_RMU_REQ_FORMAT_SOHO,
> + MV88E6XXX_RMU_REQ_PAD,
> + MV88E6XXX_RMU_REQ_CODE_DUMP_MIB,
> + MV88E6XXX_RMU_REQ_DATA};
> + struct mv88e6xxx_dump_mib_resp resp;
> + struct mv88e6xxx_port *p;
> + u8 resp_port;
> + int resp_len;
> + int num_mibs;
> + int ret;
> + int i;
...
> + /* Copy MIB array for further processing according to chip type */
> + num_mibs = (resp_len - offsetof(struct mv88e6xxx_dump_mib_resp, mib)) / sizeof(__be32);
> + for (i = 0; i < num_mibs; i++)
> + p->rmu_raw_stats[i] = be32_to_cpu(resp.mib[i]);
> +
> + /* Update MIB for port */
> + mv88e6xxx_state_get_stats_rmu(chip, port, data);
Why copy the stats into p->rmu_raw_stats[i] when you can just pass
resp to mv88e6xxx_state_get_stats_rmu().
This is left over from the way you used the old stats function to
decode the values. But now you have a dedicated function, you can
avoid this copy.
Andrew
next prev parent reply other threads:[~2022-09-17 18:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 12:18 [PATCH net-next v13 0/6] net: dsa: qca8k, mv88e6xxx: rmon: Add RMU support Mattias Forsblad
2022-09-16 6:05 ` Christian Marangi
2022-09-16 12:18 ` [PATCH net-next v13 1/6] net: dsa: mv88e6xxx: Add RMU enable for select switches Mattias Forsblad
2022-09-16 12:18 ` [PATCH net-next v13 2/6] net: dsa: Add convenience functions for frame handling Mattias Forsblad
2022-09-16 6:06 ` Christian Marangi
2022-09-16 13:47 ` Vladimir Oltean
2022-09-16 6:26 ` Christian Marangi
2022-09-16 12:18 ` [PATCH net-next v13 3/6] net: dsa: Introduce dsa tagger data operation Mattias Forsblad
2022-09-16 12:18 ` [PATCH net-next v13 4/6] net: dsa: mv88e6xxxx: Add RMU functionality Mattias Forsblad
2022-09-17 18:02 ` Andrew Lunn [this message]
2022-09-17 18:04 ` Andrew Lunn
2022-09-16 12:18 ` [PATCH net-next v13 5/6] net: dsa: mv88e6xxx: rmon: Use RMU for reading RMON data Mattias Forsblad
2022-09-16 12:18 ` [PATCH net-next v13 6/6] net: dsa: qca8k: Use new convenience functions Mattias Forsblad
2022-09-16 6:09 ` Christian Marangi
2022-09-19 5:18 ` 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=YyYLpyOrmRM/Qj/n@lunn.ch \
--to=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--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).