tools: ynl: stop using libmnl
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
- v3 Latest15 patches 1 replyApplied 15/15
- v215 patches 5 repliesSuperseded
- v115 patches 27 repliesSuperseded
Changes in v3 from the cover letter
patch 2:
- assume 4B alignment for {s,u}{16,32} getters
Patches in v3 All 15 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/15 | tools: ynl: give up on libmnl for auto-intstools/ | +36 | 0 replies | Applied |
| 2/15 | tools: ynl: create local attribute helperstools/ tools/ tools/ | +227 | 1 reply | Applied |
| 3/15 | tools: ynl: create local for_each helperstools/ tools/ tools/ | +57 | 0 replies | Applied |
| 4/15 | tools: ynl: create local nlmsg access helperstools/ tools/ tools/ | +52 | 0 replies | Applied |
| 5/15 | tools: ynl: create local ARRAY_SIZE() helpertools/ tools/ | +5 | 0 replies | Applied |
| 6/15 | tools: ynl: make yarg the first member of struct ynl_dump_statetools/ tools/ tools/ | +6 | 0 replies | Applied |
| 7/15 | tools: ynl-gen: remove unused parse codetools/ tools/ tools/ | +1 | 0 replies | Applied |
| 8/15 | tools: ynl: wrap recv() + mnl_cb_run2() into a single helpertools/ | +18 | 0 replies | Applied |
| 9/15 | tools: ynl: use ynl_sock_read_msgs() for ACK handlingtools/ tools/ | +14 | 0 replies | Applied |
| 10/15 | tools: ynl: stop using mnl_cb_run2()tools/ tools/ | +45 | 0 replies | Applied |
| 11/15 | tools: ynl: switch away from mnl_cb_ttools/ tools/ tools/ | +21 | 0 replies | Applied |
| 12/15 | tools: ynl: switch away from MNL_CB_*tools/ tools/ tools/ | +40 | 0 replies | Applied |
| 13/15 | tools: ynl: stop using mnl socket helperstools/ tools/ tools/ | +42 | 0 replies | Applied |
| 14/15 | tools: ynl: remove the libmnl dependencytools/ tools/ tools/ +1 more | +2 | 0 replies | Applied |
| 15/15 | tools: ynl: use MSG_DONTWAIT for getting notificationstools/ | +14 | 0 replies | Applied |
Reviews trailers per patch
All 15 patches have a Reviewed-by or Acked-by.
| Patch | Nicolas Dichtel | Donald Hunter |
|---|---|---|
| 1/15 | A-b | R-b |
| 2/15 | A-b | |
| 3/15 | A-b | |
| 4/15 | A-b | |
| 5/15 | A-b | |
| 6/15 | A-b | |
| 7/15 | A-b | |
| 8/15 | A-b | |
| 9/15 | A-b | |
| 10/15 | A-b | |
| 11/15 | A-b | |
| 12/15 | A-b | |
| 13/15 | A-b | |
| 14/15 | A-b | |
| 15/15 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH net-next v3 00/15] tools: ynl: stop using libmnl
There is no strong reason to stop using libmnl in ynl but there are a few small ones which add up.
First (as I remembered immediately after hitting send on v1), C++ compilers do not like the libmnl for_each macros. I haven't tried it myself, but having all the code directly in YNL makes it easier for folks porting to C++ to modify them and/or make YNL more C++ friendly.
Second, we do much more advanced netlink level parsing in ynl than libmnl so it's hard to say that libmnl abstracts much from us. The fact that this series, removing the libmnl dependency, only adds <300 LoC shows that code savings aren't huge.
OTOH when new types are added (e.g. auto-int) we need to add compatibility to deal with older version of libmnl (in fact, even tho patches have been sent months ago, auto-ints are still not supported in libmnl.git).
Thrid, the dependency makes ynl less self contained, and harder to vendor in. Whether vendoring libraries into projects is a good idea is a separate discussion, nonetheless, people want to do it.
Fourth, there are small annoyances with the libmnl APIs which are hard to fix in backward-compatible ways. See the last patch for example.
All in all, libmnl is a great library, but with all the code generation and structured parsing, ynl is better served by going its own way.
v3:
patch 2:
- assume 4B alignment for {s,u}{16,32} getters
v2:
patch 2:
- NLA_ALIGN(sizeof(struct nlattr)) -> NLA_HDRLEN;
- ...put_strz() -> ...put_str()
- use ynl_attr_data() in ynl_attr_get_{str,s8,u8}()
- use signed helpers in signed auto-ints
- use ynl_attr_get_str() instead of ynl_attr_data() in ynl.c
patch 8:
- extend commit message
patch 10:
- fold NLMSG_NEXT(nlh, rem) into the for () statement
v1: https://lore.kernel.org/all/[email protected]/
Jakub Kicinski (15):
tools: ynl: give up on libmnl for auto-ints
tools: ynl: create local attribute helpers
tools: ynl: create local for_each helpers
tools: ynl: create local nlmsg access helpers
tools: ynl: create local ARRAY_SIZE() helper
tools: ynl: make yarg the first member of struct ynl_dump_state
tools: ynl-gen: remove unused parse code
tools: ynl: wrap recv() + mnl_cb_run2() into a single helper
tools: ynl: use ynl_sock_read_msgs() for ACK handling
tools: ynl: stop using mnl_cb_run2()
tools: ynl: switch away from mnl_cb_t
tools: ynl: switch away from MNL_CB_*
tools: ynl: stop using mnl socket helpers
tools: ynl: remove the libmnl dependency
tools: ynl: use MSG_DONTWAIT for getting notifications
tools/net/ynl/lib/ynl-priv.h | 333 +++++++++++++++++++++++++++--- tools/net/ynl/lib/ynl.c | 365 +++++++++++++++++---------------- tools/net/ynl/lib/ynl.h | 3 +- tools/net/ynl/samples/Makefile | 2 +- tools/net/ynl/ynl-gen-c.py | 110 ++++------ 5 files changed, 544 insertions(+), 269 deletions(-)
Signature · 1 line
2.43.2