public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@intel•com>
To: Vladimir Oltean <vladimir.oltean@nxp•com>, netdev@vger•kernel.org
Cc: David Ahern <dsahern@kernel•org>,
	Stephen Hemminger <stephen@networkplumber•org>
Subject: Re: [PATCH iproute2 1/2] tc/taprio: don't print netlink attributes which weren't reported by the kernel
Date: Mon, 07 Aug 2023 13:15:45 -0700	[thread overview]
Message-ID: <87r0oea9se.fsf@intel.com> (raw)
In-Reply-To: <20230807160827.4087483-1-vladimir.oltean@nxp.com>

Vladimir Oltean <vladimir.oltean@nxp•com> writes:

> When an admin schedule is pending and hasn't yet become operational, the
> kernel will report only the parameters of the admin schedule in a nested
> TCA_TAPRIO_ATTR_ADMIN_SCHED attribute.
>
> However, we default to printing zeroes even for the parameters of the
> operational base time, when that doesn't exist.
>
> Link: https://lore.kernel.org/netdev/87il9w0xx7.fsf@intel.com/
> Fixes: 0dd16449356f ("tc: Add support for configuring the taprio scheduler")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp•com>
> ---
>  tc/q_taprio.c | 91 ++++++++++++++++++++++++++++++---------------------
>  1 file changed, 53 insertions(+), 38 deletions(-)
>
> diff --git a/tc/q_taprio.c b/tc/q_taprio.c
> index 913197f68caa..795c013c1c2a 100644
> --- a/tc/q_taprio.c
> +++ b/tc/q_taprio.c
> @@ -416,14 +416,11 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
>  	return 0;
>  }
>  
> -static int print_sched_list(FILE *f, struct rtattr *list)
> +static void print_sched_list(FILE *f, struct rtattr *list)
>  {
> -	struct rtattr *item;
> +	struct rtattr *item, *nla;
>  	int rem;
>  
> -	if (list == NULL)
> -		return 0;
> -
>  	rem = RTA_PAYLOAD(list);
>  
>  	open_json_array(PRINT_JSON, "schedule");
> @@ -432,60 +429,78 @@ static int print_sched_list(FILE *f, struct rtattr *list)
>  
>  	for (item = RTA_DATA(list); RTA_OK(item, rem); item = RTA_NEXT(item, rem)) {
>  		struct rtattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1];
> -		__u32 index = 0, gatemask = 0, interval = 0;
> -		__u8 command = 0;
> +		__u32 index, gatemask, interval;
> +		__u8 command;

nitpick, optional: as you are already opening blocks for each of the
fields, you could move these declarations there. (same comment for the
next patch)

For the series:

Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel•com>


Cheers,
-- 
Vinicius

  parent reply	other threads:[~2023-08-07 20:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 16:08 [PATCH iproute2 1/2] tc/taprio: don't print netlink attributes which weren't reported by the kernel Vladimir Oltean
2023-08-07 16:08 ` [PATCH iproute2 2/2] tc/taprio: fix JSON output when TCA_TAPRIO_ATTR_ADMIN_SCHED is present Vladimir Oltean
2023-08-07 20:15 ` Vinicius Costa Gomes [this message]
2023-08-07 22:00   ` [PATCH iproute2 1/2] tc/taprio: don't print netlink attributes which weren't reported by the kernel Vladimir Oltean

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=87r0oea9se.fsf@intel.com \
    --to=vinicius.gomes@intel$(echo .)com \
    --cc=dsahern@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=stephen@networkplumber$(echo .)org \
    --cc=vladimir.oltean@nxp$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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