public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Petr Machata <petrm@nvidia.com>
Cc: David Ahern <dsahern@gmail.com>,
	netdev@vger.kernel.org, Nikolay Aleksandrov <razor@blackwall.org>
Subject: Re: [PATCH iproute2-next 1/4] ip: ipstats: Iterate all xstats attributes
Date: Sun, 8 Jun 2025 17:23:47 +0300	[thread overview]
Message-ID: <aEWc81vmd3kr57XP@shredder> (raw)
In-Reply-To: <fc317232104be45d52cc2827e90f01a0676441c1.1749220201.git.petrm@nvidia.com>

On Fri, Jun 06, 2025 at 05:04:50PM +0200, Petr Machata wrote:
> @@ -600,15 +601,14 @@ int ipstats_stat_desc_show_xstats(struct ipstats_stat_show_attrs *attrs,
>  	if (at == NULL)
>  		return err;
>  
> -	tb = alloca(sizeof(*tb) * (xdesc->inner_max + 1));
> -	err = parse_rtattr_nested(tb, xdesc->inner_max, at);
> -	if (err != 0)
> -		return err;
> -
> -	if (tb[xdesc->inner_at] != NULL) {
> -		print_nl();
> -		xdesc->show_cb(tb[xdesc->inner_at]);
> +	rem = RTA_PAYLOAD(at);
> +	for (i = RTA_DATA(at); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {

Use rtattr_for_each_nested() ?

> +		if (i->rta_type == xdesc->inner_at) {
> +			print_nl();
> +			xdesc->show_cb(i);
> +		}
>  	}
> +
>  	return 0;
>  }
>  
> -- 
> 2.49.0
> 

  reply	other threads:[~2025-06-08 14:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 15:04 [PATCH iproute2-next 0/4] ip: Support bridge VLAN stats in `ip stats' Petr Machata
2025-06-06 15:04 ` [PATCH iproute2-next 1/4] ip: ipstats: Iterate all xstats attributes Petr Machata
2025-06-08 14:23   ` Ido Schimmel [this message]
2025-06-09 14:10     ` Petr Machata
2025-06-06 15:04 ` [PATCH iproute2-next 2/4] ip: ip_common: Drop ipstats_stat_desc_xstats::inner_max Petr Machata
2025-06-08 14:24   ` Ido Schimmel
2025-06-06 15:04 ` [PATCH iproute2-next 3/4] lib: bridge: Add a module for bridge-related helpers Petr Machata
2025-06-06 15:32   ` Nikolay Aleksandrov
2025-06-09 13:39     ` Petr Machata
2025-06-08 14:26   ` Ido Schimmel
2025-06-09 14:42     ` Petr Machata
2025-06-06 15:04 ` [PATCH iproute2-next 4/4] ip: iplink_bridge: Support bridge VLAN stats in `ip stats' Petr Machata
2025-06-08 14:44   ` Ido Schimmel
2025-06-09 14:10     ` Petr Machata

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=aEWc81vmd3kr57XP@shredder \
    --to=idosch@nvidia.com \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    /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