tools: ynl: add --dbg-small-recv for easier kernel testing
Status from this message: This series was applied to netdev/net-next.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest4 patches 2 repliesApplied 4/4
- v14 patches 9 repliesSuperseded
Changes in v2 from the cover letter
- patch 2:
- move the recv_size setting up
- change the default to 0 so that cli.py doesn't have to worry what the "unset" value is
v1: https://lore.kernel.org/all/[email protected]/
Patches in v2 All 4 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | tools: ynl: move the new line in NlMsg __repr__tools/ | +3 | 0 replies | Applied |
| 2/4 | tools: ynl: allow setting recv() sizetools/ | +18 | 1 reply | Applied |
| 3/4 | tools: ynl: support debug printing messagestools/ | +15 | 0 replies | Applied |
| 4/4 | tools: ynl: add --dbg-small-recv for easier kernel testingtools/ | +6 | 1 reply | Applied |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Donald Hunter |
|---|---|
| 1/4 | R-b |
| 2/4 | R-b |
| 3/4 | R-b |
| 4/4 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH net-next v2 0/4] tools: ynl: add --dbg-small-recv for easier kernel testing
When testing netlink dumps I usually hack some user space up to constrain its user space buffer size (iproute2, ethtool or ynl). Netlink will try to fill the messages up, so since these apps use large buffers by default, the dumps are rarely fragmented.
I was hoping to figure out a way to create a selftest for dump testing, but so far I have no idea how to do that in a useful and generic way.
Until someone does that, make manual dump testing easier with YNL. Create a special option for limiting the buffer size, so I don't have to make the same edits each time, and maybe others will benefit, too :)
Example:
$ ./cli.py [...] --dbg-small-recv >/dev/null
Recv: read 3712 bytes, 29 messages
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
[...]
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
Recv: read 3968 bytes, 31 messages
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
[...]
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
Recv: read 532 bytes, 5 messages
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
[...]
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
nl_len = 20 (4) nl_flags = 0x2 nl_type = 3Now let's make the DONE not fit in the last message:
$ ./cli.py [...] --dbg-small-recv 4499 >/dev/null
Recv: read 3712 bytes, 29 messages
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
[...]
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
Recv: read 4480 bytes, 35 messages
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
[...]
nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
Recv: read 20 bytes, 1 messages
nl_len = 20 (4) nl_flags = 0x2 nl_type = 3A real test would also have to check the messages are complete and not duplicated. That part has to be done manually right now.
Note that the first message is always conservatively sized by the kernel. Still, I think this is good enough to be useful.
v2:
- patch 2:
- move the recv_size setting up
- change the default to 0 so that cli.py doesn't have to worry what the "unset" value is
v1: https://lore.kernel.org/all/[email protected]/
Jakub Kicinski (4):
tools: ynl: move the new line in NlMsg __repr__
tools: ynl: allow setting recv() size
tools: ynl: support debug printing messages
tools: ynl: add --dbg-small-recv for easier kernel testing
tools/net/ynl/cli.py | 7 ++++++- tools/net/ynl/lib/ynl.py | 42 ++++++++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 7 deletions(-)
Signature · 1 line
2.44.0