[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240219172525.71406-1-jiri@resnulli.us>
Date: Mon, 19 Feb 2024 18:25:16 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: kuba@...nel.org,
pabeni@...hat.com,
davem@...emloft.net,
edumazet@...gle.com,
jacob.e.keller@...el.com,
swarupkotikalapudi@...il.com,
donald.hunter@...il.com,
sdf@...gle.com,
lorenzo@...nel.org,
alessandromarcolini99@...il.com
Subject: [patch net-next 00/13] netlink: specs: devlink: add the rest of missing attribute definitions
From: Jiri Pirko <jiri@...dia.com>
This patchset is adding the missing definitions of devlink attributes.
It got a bit tricky, as the param and fmsg value attributes have
different type according to a value of another attribute. Thankfully,
the selector infrastructure was recently introduced to ynl. This
patchset extends it a bit and uses it.
Another tricky bit was the fact that fmsg contains a list of attributes
that go as a stream and can be present multiple times. Also, it is
important to maintain the attribute position. For that, list output
needed to be added.
Also, nested devlink attributes definitions was added.
Examples:
$ sudo ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
--dump param-get
[{'bus-name': 'netdevsim',
'dev-name': 'netdevsim1',
'param': {'param-generic': True,
'param-name': 'max_macs',
'param-type': 'u32',
'param-values-list': {'param-value': [{'param-value-cmode': 'driverinit',
'param-value-data': 32}]}}},
{'bus-name': 'netdevsim',
'dev-name': 'netdevsim1',
'param': {'param-name': 'test1',
'param-type': 'flag',
'param-values-list': {'param-value': [{'param-value-cmode': 'driverinit',
'param-value-data': True}]}}}]
$ sudo ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
--do param-set \
--json '{"bus-name": "netdevsim", "dev-name": "netdevsim1", "param-name": "max_macs", "param-type": "u32", "param-value-data": 21, "param-value-cmode": "driverinit"}'
$ sudo ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
--do param-set \
--json '{"bus-name": "netdevsim", "dev-name": "netdevsim1", "param-name": "test1", "param-type": "flag", "param-value-data": false, "param-value-cmode": "driverinit"}'
$ sudo ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
--dump health-reporter-dump-get --json '{"bus-name": "netdevsim", "dev-name": "netdevsim1", "health-reporter-name": "dummy"}'
[{'fmsg': [{'fmsg-obj-nest-start': True},
{'fmsg-pair-nest-start': True},
{'fmsg-obj-name': 'test_bool'},
{'fmsg-obj-value-type': 'flag'},
{'fmsg-obj-value-data': True},
{'fmsg-nest-end': True},
{'fmsg-pair-nest-start': True},
{'fmsg-obj-name': 'test_u8'},
{'fmsg-obj-value-type': 'u8'},
{'fmsg-obj-value-data': 1},
{'fmsg-nest-end': True},
{'fmsg-pair-nest-start': True},
{'fmsg-obj-name': 'test_u32'},
{'fmsg-obj-value-type': 'u32'},
{'fmsg-obj-value-data': 3},
.....
{'fmsg-nest-end': True}]}]
$ sudo ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
--do port-get \
--json '{"bus-name": "pci", "dev-name": "0000:08:00.1", "port-index": 98304}'
{'bus-name': 'pci',
'dev-name': '0000:08:00.1',
'port-controller-number': 0,
'port-flavour': 'pci_sf',
'port-function': {'caps': {'selector': {'roce-bit'}, 'value': {'roce-bit'}},
'devlink': {'bus-name': 'auxiliary',
'dev-name': 'mlx5_core.sf.2'},
'hw-addr': b'\x00\x00\x00\x00\x00\x00',
'opstate': 'attached',
'state': 'active'},
'port-index': 98304,
'port-netdev-ifindex': 7,
'port-netdev-name': 'eth4',
'port-pci-pf-number': 1,
'port-pci-sf-number': 109,
'port-splittable': 0,
'port-type': 'eth'}
Jiri Pirko (13):
tools: ynl: allow user to specify flag attr with bool values
tools: ynl: process all scalar types encoding in single elif statement
tools: ynl: allow user to pass enum string instead of scalar value
netlink: specs: allow sub-messages in genetlink-legacy
tools: ynl: allow attr in a subset to be of a different type
tools: ynl: introduce attribute-replace for sub-message
tools: ynl: add support for list in nested attribute
netlink: specs: devlink: add enum for param-type attribute values
netlink: specs: devlink: add missing param attribute definitions
netlink: specs: devlink: treat dl-fmsg attribute as list
netlink: specs: devlink: add enum for fmsg-obj-value-type attribute
values
netlink: specs: devlink: add missing fmsg-obj-value-data attribute
definitions
netlink: specs: devlink: add missing nested devlink definitions
Documentation/netlink/genetlink-legacy.yaml | 54 +++-
Documentation/netlink/netlink-raw.yaml | 10 +-
Documentation/netlink/specs/devlink.yaml | 260 +++++++++++++++++-
.../netlink/genetlink-legacy.rst | 126 +++++++++
.../userspace-api/netlink/netlink-raw.rst | 101 -------
tools/net/ynl/lib/nlspec.py | 8 +
tools/net/ynl/lib/ynl.py | 81 ++++--
7 files changed, 500 insertions(+), 140 deletions(-)
--
2.43.2
Powered by blists - more mailing lists