Skip to content

Commit 35fae44

Browse files
committed
Merge branch 'ynl-add-support-for-user-headers-and-struct-attrs'
Donald Hunter says: ==================== ynl: add support for user headers and struct attrs Add support for user headers and struct attrs to YNL. This patchset adds features to ynl and add a partial spec for openvswitch that demonstrates use of the features. Patch 1-4 add features to ynl Patch 5 adds partial openvswitch specs that demonstrate the new features Patch 6-7 add documentation for legacy structs and for sub-type ==================== Link: https://lore.kernel.org/r/20230327083138.96044-1-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents de74945 + 04eac39 commit 35fae44

File tree

7 files changed

+516
-18
lines changed

7 files changed

+516
-18
lines changed

Documentation/netlink/genetlink-legacy.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ properties:
218218
description: Max length for a string or a binary attribute.
219219
$ref: '#/$defs/len-or-define'
220220
sub-type: *attr-type
221+
# Start genetlink-legacy
222+
struct:
223+
description: Name of the struct type used for the attribute.
224+
type: string
225+
# End genetlink-legacy
221226

222227
# Make sure name-prefix does not appear in subsets (subsets inherit naming)
223228
dependencies:
@@ -256,6 +261,14 @@ properties:
256261
async-enum:
257262
description: Name for the enum type with notifications/events.
258263
type: string
264+
# Start genetlink-legacy
265+
fixed-header: &fixed-header
266+
description: |
267+
Name of the structure defining the optional fixed-length protocol
268+
header. This header is placed in a message after the netlink and
269+
genetlink headers and before any attributes.
270+
type: string
271+
# End genetlink-legacy
259272
list:
260273
description: List of commands
261274
type: array
@@ -288,6 +301,9 @@ properties:
288301
type: array
289302
items:
290303
enum: [ strict, dump ]
304+
# Start genetlink-legacy
305+
fixed-header: *fixed-header
306+
# End genetlink-legacy
291307
do: &subop-type
292308
description: Main command handler.
293309
type: object
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2+
3+
name: ovs_datapath
4+
version: 2
5+
protocol: genetlink-legacy
6+
7+
doc:
8+
OVS datapath configuration over generic netlink.
9+
10+
definitions:
11+
-
12+
name: ovs-header
13+
type: struct
14+
members:
15+
-
16+
name: dp-ifindex
17+
type: u32
18+
-
19+
name: user-features
20+
type: flags
21+
entries:
22+
-
23+
name: unaligned
24+
doc: Allow last Netlink attribute to be unaligned
25+
-
26+
name: vport-pids
27+
doc: Allow datapath to associate multiple Netlink PIDs to each vport
28+
-
29+
name: tc-recirc-sharing
30+
doc: Allow tc offload recirc sharing
31+
-
32+
name: dispatch-upcall-per-cpu
33+
doc: Allow per-cpu dispatch of upcalls
34+
-
35+
name: datapath-stats
36+
type: struct
37+
members:
38+
-
39+
name: hit
40+
type: u64
41+
-
42+
name: missed
43+
type: u64
44+
-
45+
name: lost
46+
type: u64
47+
-
48+
name: flows
49+
type: u64
50+
-
51+
name: megaflow-stats
52+
type: struct
53+
members:
54+
-
55+
name: mask-hit
56+
type: u64
57+
-
58+
name: masks
59+
type: u32
60+
-
61+
name: padding
62+
type: u32
63+
-
64+
name: cache-hits
65+
type: u64
66+
-
67+
name: pad1
68+
type: u64
69+
70+
attribute-sets:
71+
-
72+
name: datapath
73+
attributes:
74+
-
75+
name: name
76+
type: string
77+
-
78+
name: upcall-pid
79+
doc: upcall pid
80+
type: u32
81+
-
82+
name: stats
83+
type: binary
84+
struct: datapath-stats
85+
-
86+
name: megaflow-stats
87+
type: binary
88+
struct: megaflow-stats
89+
-
90+
name: user-features
91+
type: u32
92+
enum: user-features
93+
enum-as-flags: true
94+
-
95+
name: pad
96+
type: unused
97+
-
98+
name: masks-cache-size
99+
type: u32
100+
-
101+
name: per-cpu-pids
102+
type: binary
103+
sub-type: u32
104+
105+
operations:
106+
fixed-header: ovs-header
107+
list:
108+
-
109+
name: dp-get
110+
doc: Get / dump OVS data path configuration and state
111+
value: 3
112+
attribute-set: datapath
113+
do: &dp-get-op
114+
request:
115+
attributes:
116+
- name
117+
reply:
118+
attributes:
119+
- name
120+
- upcall-pid
121+
- stats
122+
- megaflow-stats
123+
- user-features
124+
- masks-cache-size
125+
- per-cpu-pids
126+
dump: *dp-get-op
127+
-
128+
name: dp-new
129+
doc: Create new OVS data path
130+
value: 1
131+
attribute-set: datapath
132+
do:
133+
request:
134+
attributes:
135+
- dp-ifindex
136+
- name
137+
- upcall-pid
138+
- user-features
139+
-
140+
name: dp-del
141+
doc: Delete existing OVS data path
142+
value: 2
143+
attribute-set: datapath
144+
do:
145+
request:
146+
attributes:
147+
- dp-ifindex
148+
- name
149+
150+
mcast-groups:
151+
list:
152+
-
153+
name: ovs_datapath
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2+
3+
name: ovs_vport
4+
version: 2
5+
protocol: genetlink-legacy
6+
7+
doc:
8+
OVS vport configuration over generic netlink.
9+
10+
definitions:
11+
-
12+
name: ovs-header
13+
type: struct
14+
members:
15+
-
16+
name: dp-ifindex
17+
type: u32
18+
-
19+
name: vport-type
20+
type: enum
21+
entries: [ unspec, netdev, internal, gre, vxlan, geneve ]
22+
-
23+
name: vport-stats
24+
type: struct
25+
members:
26+
-
27+
name: rx-packets
28+
type: u64
29+
-
30+
name: tx-packets
31+
type: u64
32+
-
33+
name: rx-bytes
34+
type: u64
35+
-
36+
name: tx-bytes
37+
type: u64
38+
-
39+
name: rx-errors
40+
type: u64
41+
-
42+
name: tx-errors
43+
type: u64
44+
-
45+
name: rx-dropped
46+
type: u64
47+
-
48+
name: tx-dropped
49+
type: u64
50+
51+
attribute-sets:
52+
-
53+
name: vport-options
54+
attributes:
55+
-
56+
name: dst-port
57+
type: u32
58+
-
59+
name: extension
60+
type: u32
61+
-
62+
name: upcall-stats
63+
attributes:
64+
-
65+
name: success
66+
type: u64
67+
value: 0
68+
-
69+
name: fail
70+
type: u64
71+
-
72+
name: vport
73+
attributes:
74+
-
75+
name: port-no
76+
type: u32
77+
-
78+
name: type
79+
type: u32
80+
enum: vport-type
81+
-
82+
name: name
83+
type: string
84+
-
85+
name: options
86+
type: nest
87+
nested-attributes: vport-options
88+
-
89+
name: upcall-pid
90+
type: binary
91+
sub-type: u32
92+
-
93+
name: stats
94+
type: binary
95+
struct: vport-stats
96+
-
97+
name: pad
98+
type: unused
99+
-
100+
name: ifindex
101+
type: u32
102+
-
103+
name: netnsid
104+
type: u32
105+
-
106+
name: upcall-stats
107+
type: nest
108+
nested-attributes: upcall-stats
109+
110+
operations:
111+
list:
112+
-
113+
name: vport-get
114+
doc: Get / dump OVS vport configuration and state
115+
value: 3
116+
attribute-set: vport
117+
fixed-header: ovs-header
118+
do: &vport-get-op
119+
request:
120+
attributes:
121+
- dp-ifindex
122+
- name
123+
reply: &dev-all
124+
attributes:
125+
- dp-ifindex
126+
- port-no
127+
- type
128+
- name
129+
- upcall-pid
130+
- stats
131+
- ifindex
132+
- netnsid
133+
- upcall-stats
134+
dump: *vport-get-op
135+
136+
mcast-groups:
137+
list:
138+
-
139+
name: ovs_vport

0 commit comments

Comments
 (0)