Skip to content

Commit 509afc7

Browse files
committed
Merge branch 'tools-net-ynl-add-sub-message-support-to-ynl'
Donald Hunter says: ==================== tools/net/ynl: Add 'sub-message' support to ynl This patchset adds a 'sub-message' attribute type to the netlink-raw schema and implements it in ynl. This provides support for kind-specific options attributes as used in rt_link and tc raw netlink families. A description of the new 'sub-message' attribute type and the corresponding sub-message definitions is provided in patch 3. The patchset includes updates to the rt_link spec and a new tc spec that make use of the new 'sub-message' attribute type. As mentioned in patch 4, encode support is not yet implemented in ynl and support for sub-message selectors at a different nest level from the key attribute is not yet supported. I plan to work on these in follow-up patches. Patches 1 is code cleanup in ynl Patches 2-4 add sub-message support to the schema and ynl with documentation updates. Patch 5 adds binary and pad support to structs in netlink-raw. Patches 6-8 contain specs that use the sub-message attribute type. Patches 9-13 update ynl-gen-rst and its make target ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 610a689 + 9b0aa22 commit 509afc7

File tree

8 files changed

+2782
-45
lines changed

8 files changed

+2782
-45
lines changed

Documentation/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ YNL_RST_FILES_TMP := $(patsubst %.yaml,%.rst,$(wildcard $(YNL_YAML_DIR)/*.yaml))
106106
YNL_RST_FILES := $(patsubst $(YNL_YAML_DIR)%,$(YNL_RST_DIR)%, $(YNL_RST_FILES_TMP))
107107

108108
$(YNL_INDEX): $(YNL_RST_FILES)
109-
@$(YNL_TOOL) -o $@ -x
109+
$(Q)$(YNL_TOOL) -o $@ -x
110110

111-
$(YNL_RST_DIR)/%.rst: $(YNL_YAML_DIR)/%.yaml
112-
@$(YNL_TOOL) -i $< -o $@
111+
$(YNL_RST_DIR)/%.rst: $(YNL_YAML_DIR)/%.yaml $(YNL_TOOL)
112+
$(Q)$(YNL_TOOL) -i $< -o $@
113113

114114
htmldocs: $(YNL_INDEX)
115115
@$(srctree)/scripts/sphinx-pre-install --version-check

Documentation/netlink/netlink-raw.yaml

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ properties:
126126
name:
127127
type: string
128128
type:
129-
description: The netlink attribute type
130-
enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string, binary ]
129+
description: |
130+
The netlink attribute type. Members of type 'binary' or 'pad'
131+
must also have the 'len' property set.
132+
enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string, binary, pad ]
131133
len:
132134
$ref: '#/$defs/len-or-define'
133135
byte-order:
@@ -150,6 +152,14 @@ properties:
150152
the right formatting mechanism when displaying values of this
151153
type.
152154
enum: [ hex, mac, fddi, ipv4, ipv6, uuid ]
155+
if:
156+
properties:
157+
type:
158+
oneOf:
159+
- const: binary
160+
- const: pad
161+
then:
162+
required: [ len ]
153163
# End genetlink-legacy
154164

155165
attribute-sets:
@@ -202,7 +212,8 @@ properties:
202212
description: The netlink attribute type
203213
enum: [ unused, pad, flag, binary, bitfield32,
204214
u8, u16, u32, u64, s8, s16, s32, s64,
205-
string, nest, array-nest, nest-type-value ]
215+
string, nest, array-nest, nest-type-value,
216+
sub-message ]
206217
doc:
207218
description: Documentation of the attribute.
208219
type: string
@@ -261,6 +272,17 @@ properties:
261272
description: Name of the struct type used for the attribute.
262273
type: string
263274
# End genetlink-legacy
275+
# Start netlink-raw
276+
sub-message:
277+
description: |
278+
Name of the sub-message definition to use for the attribute.
279+
type: string
280+
selector:
281+
description: |
282+
Name of the attribute to use for dynamic selection of sub-message
283+
format specifier.
284+
type: string
285+
# End netlink-raw
264286

265287
# Make sure name-prefix does not appear in subsets (subsets inherit naming)
266288
dependencies:
@@ -283,6 +305,43 @@ properties:
283305
items:
284306
required: [ type ]
285307

308+
# Start netlink-raw
309+
sub-messages:
310+
description: Definition of sub message attributes
311+
type: array
312+
items:
313+
type: object
314+
additionalProperties: False
315+
required: [ name, formats ]
316+
properties:
317+
name:
318+
description: Name of the sub-message definition
319+
type: string
320+
formats:
321+
description: Dynamically selected format specifiers
322+
type: array
323+
items:
324+
type: object
325+
additionalProperties: False
326+
required: [ value ]
327+
properties:
328+
value:
329+
description: |
330+
Value to match for dynamic selection of sub-message format
331+
specifier.
332+
type: string
333+
fixed-header:
334+
description: |
335+
Name of the struct definition to use as the fixed header
336+
for the sub message.
337+
type: string
338+
attribute-set:
339+
description: |
340+
Name of the attribute space from which to resolve attributes
341+
in the sub message.
342+
type: string
343+
# End netlink-raw
344+
286345
operations:
287346
description: Operations supported by the protocol.
288347
type: object

0 commit comments

Comments
 (0)