From: Donald Hunter <donald.hunter@gmail.com>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Jiri Pirko <jiri@resnulli.us>
Subject: Re: [PATCH net-next] doc/netlink/specs: Add vlan attr in rt_link spec
Date: Fri, 08 Mar 2024 13:05:45 +0000 [thread overview]
Message-ID: <m2sf10g9g6.fsf@gmail.com> (raw)
In-Reply-To: <20240308041518.3047900-1-liuhangbin@gmail.com> (Hangbin Liu's message of "Fri, 8 Mar 2024 12:15:18 +0800")
Hangbin Liu <liuhangbin@gmail.com> writes:
> With command:
> # ./tools/net/ynl/cli.py \
> --spec Documentation/netlink/specs/rt_link.yaml \
> --do getlink --json '{"ifname": "eno1.2"}'
>
> Before:
> Exception: No message format for 'vlan' in sub-message spec 'linkinfo-data-msg'
>
> After:
> 'linkinfo': {'data': {'flag': {'flags': {'bridge-binding',
> 'gvrp',
> 'reorder-hdr'},
> 'mask': 4294967295},
> 'id': 2,
> 'protocol': 129},
> 'kind': 'vlan'},
>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> Not sure if there is a proper way to show the mask and protocol
Using display-hint, e.g. display-hint: hex, is intended to tell the ynl
cli to render output in a human readable way. Unfortunately it currently
only works for binary attributes.
It can be done like this:
-
name: mask
type: binary
len: 4
display-hint: hex
./tools/net/ynl/cli.py \
--spec Documentation/netlink/specs/rt_link.yaml \
--do getlink --json '{"ifname": "wlan0.8"}' --output-json | jq -C '.linkinfo'
{
"kind": "vlan",
"data": {
"protocol": 33024,
"id": 8,
"flag": {
"flags": [
"reorder-hdr"
],
"mask": "ff ff ff ff"
}
}
}
But it seems wrong to change the struct definition for this. We should
patch ynl to support hex rendering of integers.
For the protocol, you'd need to add an enum of ethernet protocol
numbers, from the info in include/uapi/linux/if_ether.h
> + -
> + name: linkinfo-vlan-attrs
> + name-prefix: ifla-vlan-
> + attributes:
> + -
> + name: id
> + type: u16
> + -
> + name: flag
> + type: binary
> + struct: ifla-vlan-flags
> + -
> + name: egress-qos
> + type: nest
> + nested-attributes: ifla-vlan-qos
> + -
> + name: ingress-qos
> + type: nest
> + nested-attributes: ifla-vlan-qos
> + -
> + name: protocol
> + type: u16
The protocol value is in big endian format, so it is actually 33024
(0x8100) not 129. You need to add byte-order: big-endian
> + -
> + name: ifla-vlan-qos
> + name-prefix: ifla-vlan-qos
> + attributes:
> + -
> + name: mapping
> + type: binary
> + struct: ifla-vlan-qos-mapping
> -
> name: linkinfo-vrf-attrs
> name-prefix: ifla-vrf-
> @@ -1666,6 +1732,9 @@ sub-messages:
> -
> value: tun
> attribute-set: linkinfo-tun-attrs
> + -
> + value: vlan
> + attribute-set: linkinfo-vlan-attrs
> -
> value: vrf
> attribute-set: linkinfo-vrf-attrs
next prev parent reply other threads:[~2024-03-08 13:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 4:15 [PATCH net-next] doc/netlink/specs: Add vlan attr in rt_link spec Hangbin Liu
2024-03-08 13:05 ` Donald Hunter [this message]
2024-03-11 10:08 ` Hangbin Liu
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=m2sf10g9g6.fsf@gmail.com \
--to=donald.hunter@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).