Skip to content

devlink: code split and structured instance walk

Jakub Kicinski netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest15 patches 16 repliesIn review 13 of 15 applied
  2. v114 patches 27 repliesSuperseded

Changes in v2 from the cover letter

- various renames
- split patch 2

Patches in v2 13 of 15 applied

#Subject and filesSizeRepliesApplied
1/15devlink: move code to a dedicated directorynet/Makefile net/core/Makefile net/devlink/Makefile +1 more+4 -11 reply
2/15devlink: rename devlink_netdevice_event -> devlink_port_netdevice_eventnet/devlink/leftover.c+5 -51 replyApplied
3/15devlink: split out core codenet/devlink/Makefile net/devlink/core.c net/devlink/devl_internal.h +1 more+476 -4344 replies
4/15devlink: split out netlink codenet/devlink/Makefile net/devlink/devl_internal.h net/devlink/leftover.c +1 more+235 -2051 replyApplied
5/15netlink: add macro for checking dump ctx sizeinclude/linux/netlink.h net/netfilter/nf_conntrack_netlink.c+5 -12 repliesApplied
6/15devlink: use an explicit structure for dump contextnet/devlink/devl_internal.h net/devlink/leftover.c+81 -401 replyApplied
7/15devlink: remove start variables from dumpsnet/devlink/leftover.c+19 -361 replyApplied
8/15devlink: drop the filter argument from devlinks_xa_find_getnet/devlink/core.c net/devlink/devl_internal.h+10 -170 repliesApplied
9/15devlink: health: combine loops in dumpnet/devlink/leftover.c+0 -30 repliesApplied
10/15devlink: restart dump based on devlink instance ids (simple)net/devlink/core.c net/devlink/devl_internal.h net/devlink/leftover.c+25 -291 replyApplied
11/15devlink: restart dump based on devlink instance ids (nested)net/devlink/devl_internal.h net/devlink/leftover.c+49 -460 repliesApplied
12/15devlink: restart dump based on devlink instance ids (function)net/devlink/leftover.c+21 -200 repliesApplied
13/15devlink: uniformly take the devlink instance lock in the dump loopnet/devlink/leftover.c+6 -70 repliesApplied
14/15devlink: add by-instance dump infranet/devlink/devl_internal.h net/devlink/leftover.c net/devlink/netlink.c+68 -314 repliesApplied
15/15devlink: convert remaining dumps to the by-instance schemenet/devlink/devl_internal.h net/devlink/leftover.c net/devlink/netlink.c+320 -3940 repliesApplied

Reviews trailers per patch

All 15 patches have a Reviewed-by or Acked-by.

PatchJacob KellerJiri Pirko
1/15R-b R-b
2/15R-b
3/15R-b R-b R-b
4/15R-b R-b
5/15R-b R-b
6/15R-b R-b
7/15R-b R-b
8/15R-b R-b
9/15R-b R-b
10/15R-b R-b
11/15R-b R-b
12/15R-b R-b
13/15R-b R-b
14/15R-b
15/15R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH net-next v2 00/15] devlink: code split and structured instance walk

Split devlink.c into a handful of files, trying to keep the "core" code away from all the command-specific implementations. The core code has been quite scattered until now. Going forward we can consider using a source file per-subobject, I think that it's quite beneficial to newcomers (based on relative ease with which folks contribute to ethtool vs devlink). But this series doesn't split everything out, yet - partially due to backporting concerns, but mostly due to lack of time. Bulk of the netlink command handling is left in a leftover.c file.

Introduce a context structure for dumps, and use it to store the devlink instance ID of the last dumped devlink instance. This means we don't have to restart the walk from 0 each time.

Finally - introduce a "structured walk". A centralized dump handler in devlink/netlink.c which walks the devlink instances, deals with refcounting/locking, simplifying the per-object implementations quite a bit. Inspired by the ethtool code.

v2:
- various renames
- split patch 2

v1: https://lore.kernel.org/all/[email protected]/
- re-route the locking fix via net
- rename basic.c -> leftover.c

RFC: https://lore.kernel.org/all/[email protected]/

Jakub Kicinski (15):
devlink: move code to a dedicated directory
devlink: rename devlink_netdevice_event ->
devlink_port_netdevice_event
devlink: split out core code
devlink: split out netlink code
netlink: add macro for checking dump ctx size
devlink: use an explicit structure for dump context
devlink: remove start variables from dumps
devlink: drop the filter argument from devlinks_xa_find_get
devlink: health: combine loops in dump
devlink: restart dump based on devlink instance ids (simple)
devlink: restart dump based on devlink instance ids (nested)
devlink: restart dump based on devlink instance ids (function)
devlink: uniformly take the devlink instance lock in the dump loop
devlink: add by-instance dump infra
devlink: convert remaining dumps to the by-instance scheme

 include/linux/netlink.h                    |    4 +
 net/Makefile                               |    1 +
 net/core/Makefile                          |    1 -
 net/devlink/Makefile                       |    3 +
 net/devlink/core.c                         |  345 +++++
 net/devlink/devl_internal.h                |  207 +++
 net/{core/devlink.c => devlink/leftover.c} | 1460 +++++---------------
 net/devlink/netlink.c                      |  242 ++++
 net/netfilter/nf_conntrack_netlink.c       |    2 +-
 9 files changed, 1160 insertions(+), 1105 deletions(-)
 create mode 100644 net/devlink/Makefile
 create mode 100644 net/devlink/core.c
 create mode 100644 net/devlink/devl_internal.h
 rename net/{core/devlink.c => devlink/leftover.c} (90%)
 create mode 100644 net/devlink/netlink.c
Signature · 1 line
2.38.1