All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support
@ 2024-03-27 12:31 Hangbin Liu
  2024-03-27 12:31 ` [PATCHv3 net-next 1/2] ynl: support hex display_hint for integer Hangbin Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hangbin Liu @ 2024-03-27 12:31 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Donald Hunter, Jiri Pirko, Jacob Keller, Stanislav Fomichev,
	Hangbin Liu

Add vlan support in rt_link spec.

Hangbin Liu (2):
  ynl: support hex display_hint for integer
  doc/netlink/specs: Add vlan attr in rt_link spec

 Documentation/netlink/specs/rt_link.yaml | 80 +++++++++++++++++++++++-
 tools/net/ynl/lib/ynl.py                 |  5 +-
 2 files changed, 82 insertions(+), 3 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv3 net-next 1/2] ynl: support hex display_hint for integer
  2024-03-27 12:31 [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support Hangbin Liu
@ 2024-03-27 12:31 ` Hangbin Liu
  2024-03-27 12:31 ` [PATCHv3 net-next 2/2] doc/netlink/specs: Add vlan attr in rt_link spec Hangbin Liu
  2024-03-29  1:11 ` [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2024-03-27 12:31 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Donald Hunter, Jiri Pirko, Jacob Keller, Stanislav Fomichev,
	Hangbin Liu

Some times it would be convenient to read the integer as hex, like
mask values.

Suggested-by: Donald Hunter <donald.hunter@gmail.com>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 tools/net/ynl/lib/ynl.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index 5fa7957f6e0f..e73b027c5624 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -819,7 +819,10 @@ class YnlFamily(SpecFamily):
         if display_hint == 'mac':
             formatted = ':'.join('%02x' % b for b in raw)
         elif display_hint == 'hex':
-            formatted = bytes.hex(raw, ' ')
+            if isinstance(raw, int):
+                formatted = hex(raw)
+            else:
+                formatted = bytes.hex(raw, ' ')
         elif display_hint in [ 'ipv4', 'ipv6' ]:
             formatted = format(ipaddress.ip_address(raw))
         elif display_hint == 'uuid':
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCHv3 net-next 2/2] doc/netlink/specs: Add vlan attr in rt_link spec
  2024-03-27 12:31 [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support Hangbin Liu
  2024-03-27 12:31 ` [PATCHv3 net-next 1/2] ynl: support hex display_hint for integer Hangbin Liu
@ 2024-03-27 12:31 ` Hangbin Liu
  2024-03-28 15:05   ` Donald Hunter
  2024-03-29  1:11 ` [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2024-03-27 12:31 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Donald Hunter, Jiri Pirko, Jacob Keller, Stanislav Fomichev,
	Hangbin Liu

With command:
 # ./tools/net/ynl/cli.py \
 --spec Documentation/netlink/specs/rt_link.yaml \
 --do getlink --json '{"ifname": "eno1.2"}' --output-json | \
 jq -C '.linkinfo'

Before:
Exception: No message format for 'vlan' in sub-message spec 'linkinfo-data-msg'

After:
 {
   "kind": "vlan",
   "data": {
     "protocol": "8021q",
     "id": 2,
     "flag": {
       "flags": [
         "reorder-hdr"
       ],
       "mask": "0xffffffff"
     },
     "egress-qos": {
       "mapping": [
         {
           "from": 1,
           "to": 2
         },
         {
           "from": 4,
           "to": 4
         }
       ]
     }
   }
 }

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
v3:
 - lower case vlan protocols (Donald Hunter)
 - use abbreviated form for vlan flags (Donald Hunter)
 - set ifla-vlan-qos as multi-attr (Donald Hunter)
v2:
 - Add eth-protocols definitions, but only include vlan protocols (Donald Hunter)
 - Set protocol to big-endian (Donald Hunter)
 - Add display-hint for vlan flag mask (Donald Hunter)
---
 Documentation/netlink/specs/rt_link.yaml | 80 +++++++++++++++++++++++-
 1 file changed, 78 insertions(+), 2 deletions(-)

diff --git a/Documentation/netlink/specs/rt_link.yaml b/Documentation/netlink/specs/rt_link.yaml
index 8e4d19adee8c..81a5a3d1b04d 100644
--- a/Documentation/netlink/specs/rt_link.yaml
+++ b/Documentation/netlink/specs/rt_link.yaml
@@ -50,7 +50,16 @@ definitions:
         name: dormant
       -
         name: echo
-
+  -
+    name: vlan-protocols
+    type: enum
+    entries:
+      -
+        name: 8021q
+        value: 33024
+      -
+        name: 8021ad
+        value: 34984
   -
     name: rtgenmsg
     type: struct
@@ -729,7 +738,38 @@ definitions:
       -
         name: filter-mask
         type: u32
-
+  -
+    name: ifla-vlan-flags
+    type: struct
+    members:
+      -
+        name: flags
+        type: u32
+        enum: vlan-flags
+        enum-as-flags: true
+      -
+        name: mask
+        type: u32
+        display-hint: hex
+  -
+    name: vlan-flags
+    type: flags
+    entries:
+      - reorder-hdr
+      - gvrp
+      - loose-binding
+      - mvrp
+      - bridge-binding
+  -
+    name: ifla-vlan-qos-mapping
+    type: struct
+    members:
+      -
+        name: from
+        type: u32
+      -
+        name: to
+        type: u32
 
 attribute-sets:
   -
@@ -1507,6 +1547,39 @@ attribute-sets:
       -
         name: num-disabled-queues
         type: u32
+  -
+    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
+        enum: vlan-protocols
+        byte-order: big-endian
+  -
+    name: ifla-vlan-qos
+    name-prefix: ifla-vlan-qos
+    attributes:
+      -
+        name: mapping
+        type: binary
+        multi-attr: true
+        struct: ifla-vlan-qos-mapping
   -
     name: linkinfo-vrf-attrs
     name-prefix: ifla-vrf-
@@ -1666,6 +1739,9 @@ sub-messages:
       -
         value: tun
         attribute-set: linkinfo-tun-attrs
+      -
+        value: vlan
+        attribute-set: linkinfo-vlan-attrs
       -
         value: vrf
         attribute-set: linkinfo-vrf-attrs
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCHv3 net-next 2/2] doc/netlink/specs: Add vlan attr in rt_link spec
  2024-03-27 12:31 ` [PATCHv3 net-next 2/2] doc/netlink/specs: Add vlan attr in rt_link spec Hangbin Liu
@ 2024-03-28 15:05   ` Donald Hunter
  0 siblings, 0 replies; 5+ messages in thread
From: Donald Hunter @ 2024-03-28 15:05 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Jiri Pirko, Jacob Keller, Stanislav Fomichev

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"}' --output-json | \
>  jq -C '.linkinfo'
>
> Before:
> Exception: No message format for 'vlan' in sub-message spec 'linkinfo-data-msg'
>
> After:
>  {
>    "kind": "vlan",
>    "data": {
>      "protocol": "8021q",
>      "id": 2,
>      "flag": {
>        "flags": [
>          "reorder-hdr"
>        ],
>        "mask": "0xffffffff"
>      },
>      "egress-qos": {
>        "mapping": [
>          {
>            "from": 1,
>            "to": 2
>          },
>          {
>            "from": 4,
>            "to": 4
>          }
>        ]
>      }
>    }
>  }
>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support
  2024-03-27 12:31 [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support Hangbin Liu
  2024-03-27 12:31 ` [PATCHv3 net-next 1/2] ynl: support hex display_hint for integer Hangbin Liu
  2024-03-27 12:31 ` [PATCHv3 net-next 2/2] doc/netlink/specs: Add vlan attr in rt_link spec Hangbin Liu
@ 2024-03-29  1:11 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-29  1:11 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, davem, edumazet, kuba, pabeni, donald.hunter, jiri,
	jacob.e.keller, sdf

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 27 Mar 2024 20:31:27 +0800 you wrote:
> Add vlan support in rt_link spec.
> 
> Hangbin Liu (2):
>   ynl: support hex display_hint for integer
>   doc/netlink/specs: Add vlan attr in rt_link spec
> 
>  Documentation/netlink/specs/rt_link.yaml | 80 +++++++++++++++++++++++-
>  tools/net/ynl/lib/ynl.py                 |  5 +-
>  2 files changed, 82 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [PATCHv3,net-next,1/2] ynl: support hex display_hint for integer
    https://git.kernel.org/netdev/net-next/c/b334f5ed3d91
  - [PATCHv3,net-next,2/2] doc/netlink/specs: Add vlan attr in rt_link spec
    https://git.kernel.org/netdev/net-next/c/782c1084b9fa

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-29  1:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 12:31 [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support Hangbin Liu
2024-03-27 12:31 ` [PATCHv3 net-next 1/2] ynl: support hex display_hint for integer Hangbin Liu
2024-03-27 12:31 ` [PATCHv3 net-next 2/2] doc/netlink/specs: Add vlan attr in rt_link spec Hangbin Liu
2024-03-28 15:05   ` Donald Hunter
2024-03-29  1:11 ` [PATCHv3 net-next 0/2] doc/netlink/specs: Add vlan support patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.