Lines Matching +full:kernel +full:- +full:family
1 .. SPDX-License-Identifier: BSD-3-Clause
13 Kernel comes with a simple CLI tool which should be useful when
16 to the kernel. Only Generic Netlink is supported.
21 - ``--spec`` - point to the spec file
22 - ``--do $name`` / ``--dump $name`` - issue request ``$name``
23 - ``--json $attrs`` - provide attributes for the request
24 - ``--subscribe $group`` - receive notifications from ``$group``
30 $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/ethtool.yaml \
31 --do rings-get \
32 --json '{"header":{"dev-index": 18}}'
33 {'header': {'dev-index': 18, 'dev-name': 'eni1np1'},
35 'rx-jumbo': 0,
36 'rx-jumbo-max': 4096,
37 'rx-max': 4096,
38 'rx-mini': 0,
39 'rx-mini-max': 4096,
41 'tx-max': 4096,
42 'tx-push': 0}
45 Python-pretty-printed. This is because some Netlink types can't
50 library - it should be easy to write Python tools / tests reusing
53 Generating kernel code
56 ``tools/net/ynl/ynl-regen.sh`` scans the kernel tree in search of
57 auto-generated files which need to be updated. Using this tool is the easiest
58 way to generate / update auto-generated code.
60 By default code is re-generated only if spec is newer than the source,
61 to force regeneration use ``-f``.
63 ``ynl-regen.sh`` searches for ``YNL-GEN`` in the contents of files
65 tracked by git!) For instance the ``fou_nl.c`` kernel source contains::
68 /* YNL-GEN kernel source */
70 ``ynl-regen.sh`` will find this marker and replace the file with
71 kernel source based on fou.yaml.
75 and run the regeneration tool. Grep the tree for ``YNL-GEN``
78 The code generation itself is performed by ``tools/net/ynl/ynl-gen-c.py``
87 ``tools/net/ynl/ynl-gen-c.py`` to create easy to use netlink wrappers.
90 ----------
92 The YNL library consists of two parts - the generic code (functions
93 prefix by ``ynl_``) and per-family auto-generated code (prefixed
94 with the name of the family).
96 To create a YNL socket call ynl_sock_create() passing the family
97 struct (family structs are exported by the auto-generated code).
101 ------------
104 All the functions and types in this example come from the auto-generated
105 code (for the netdev family in this case):
107 .. code-block:: c
124 // 6. Print the YNL-generated error
125 fprintf(stderr, "YNL: %s\n", ys->err.msg);
126 return -1;
135 ---------
143 -----------------