Re: [PATCH net-next] net: phy: Maintain MDIO device and bus statistics

From: Florian Fainelli
Date: Sun Jan 12 2020 - 23:55:52 EST




On 1/12/2020 8:53 PM, Florian Fainelli wrote:
> Maintain per MDIO device and MDIO bus statistics comprised of the number
> of transfers/operations, reads and writes and errors. This is useful for
> tracking the per-device and global MDIO bus bandwidth and doing
> optimizations as necessary.
>
> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
> ---

[snip]

> +#define MDIO_BUS_STATS_SHOW_NAME(name, file, field, format_string) \
> +static ssize_t mdio_bus_stats_##name##_show(struct mdio_bus_stats *s, \
> + char *buf) \
> +{ \
> + unsigned int start; \
> + ssize_t len; \
> + u64 tmp; \
> + do { \
> + start = u64_stats_fetch_begin(&s->syncp); \
> + tmp = u64_stats_read(&s->field); \
> + } while (u64_stats_fetch_retry(&s->syncp, start)); \
> + len = sprintf(buf, format_string ## "\n", tmp); \

^ ===== that hunk right there does not build, I sent a non-fixed up
patch, I would still appreciate comments though.
--
Florian