Subject: Re: [PATCH iproute2-next 09/10] ipstats: Expose bond stats in ipstats

From: Stephen Hemminger <[email-masked]>
Date: Thu, 26 May 2022 17:13:13 -0700

On Mon, 9 May 2022 16:00:02 +0200
Petr Machata <[email-masked]> wrote:

> Describe xstats and xstats_slave subgroups for bond netdevices.
> 
> For example:
> 
>  # ip stats show dev swp1 group xstats_slave subgroup bond
>  56: swp1: group xstats_slave subgroup bond suite 802.3ad
>                      LACPDU Rx 0
>                      LACPDU Tx 0
>                      LACPDU Unknown type Rx 0
>                      LACPDU Illegal Rx 0
>                      Marker Rx 0
>                      Marker Tx 0
>                      Marker response Rx 0
>                      Marker response Tx 0
>                      Marker unknown type Rx 0
> 
>  # ip -j stats show dev swp1 group xstats_slave subgroup bond | jq
>  [
>    {
>      "ifindex": 56,
>      "ifname": "swp1",
>      "group": "xstats_slave",
>      "subgroup": "bond",
>      "suite": "802.3ad",
>      "802.3ad": {
>        "lacpdu_rx": 0,
>        "lacpdu_tx": 0,
>        "lacpdu_unknown_rx": 0,
>        "lacpdu_illegal_rx": 0,
>        "marker_rx": 0,
>        "marker_tx": 0,
>        "marker_response_rx": 0,
>        "marker_response_tx": 0,
>        "marker_unknown_rx": 0
>      }
>    }
>  ]
> 
> Signed-off-by: Petr Machata <[email-masked]>
> Reviewed-by: Ido Schimmel <[email-masked]>
> ---
>  ip/ip_common.h   |  3 +++
>  ip/iplink_bond.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++--
>  ip/ipstats.c     |  2 ++
>  3 files changed, 58 insertions(+), 2 deletions(-)

This change won't build if clang is used to build iproute2.
It has valid warning:

    CC       iplink_bond.o
iplink_bond.c:935:10: error: initializer element is not a compile-time constant
        .desc = ipstats_stat_desc_bond_tmpl_lacp,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
iplink_bond.c:957:10: error: initializer element is not a compile-time constant
        .desc = ipstats_stat_desc_bond_tmpl_lacp,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Since desc is a structure, you can't just assign an existing data structure
to the new initializer.  It needs to be a pointer or macro.