mbox series

[net-next,00/15] mptcp: pm: code reorganisation

Message ID 20250307-net-next-mptcp-pm-reorg-v1-0-abef20ada03b@kernel.org (mailing list archive)
Headers show
Series mptcp: pm: code reorganisation | expand

Message

Matthieu Baerts (NGI0) March 7, 2025, 11:21 a.m. UTC
Before this series, the PM code was dispersed in different places:

- pm.c had common code for all PMs.

- pm_netlink.c was initially only about the in-kernel PM, but ended up
  also getting exported common helpers, callbacks used by the different
  PMs, NL events for PM userspace daemon, etc. quite confusing.

- pm_userspace.c had userspace PM only code, but it was using "specific"
  in-kernel PM helpers according to their names.

To clarify the code, a reorganisation is suggested here, only by moving
code around, and small helper renaming to avoid confusions:

- pm_netlink.c now only contains common PM generic Netlink code:
  - PM events: this code was already there
  - shared helpers around Netlink code that were already there as well
  - shared Netlink commands code from pm.c

- pm_kernel.c now contains only code that is specific to the in-kernel
  PM. Now all functions are either called from:
  - pm.c: events coming from the core, when this PM is being used
  - pm_netlink.c: for shared Netlink commands
  - mptcp_pm_gen.c: for Netlink commands specific to the in-kernel PM
  - sockopt.c: for the exported counters per netns

- pm.c got many code from pm_netlink.c:
  - helpers used from both PMs and not linked to Netlink
  - callbacks used by different PMs, e.g. ADD_ADDR management
  - some helpers have been renamed to remove the '_nl' prefix, and some
    have been marked as 'static'.

- protocol.h has been updated accordingly:
  - some helpers no longer need to be exported
  - new ones needed to be exported: they have been prefixed if needed.

The code around the PM is now less confusing, which should help for the
maintenance in the long term, and the introduction of a PM Ops.

This will certainly impact future backports, but because other cleanups
have already done recently, and more are coming to ease the addition of
a new path-manager controlled with BPF (struct_ops), doing that now
seems to be a good time. Also, many issues around the PM have been fixed
a few months ago while increasing the code coverage in the selftests, so
such big reorganisation can be done with more confidence now.

Note that checkpatch, when used with --max-line-length=80, will complain
 about lines being over the 80 limits, but these warnings were already
there before moving the code around.

Also, patch 1 is not directly related to the code reorganisation, but it
was a remaining cleanup that we didn't upstream before, because it was
conflicting with another patch that has been sent for inclusion to the
net tree.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Geliang Tang (1):
      mptcp: pm: use addr entry for get_local_id

Matthieu Baerts (NGI0) (14):
      mptcp: pm: remove '_nl' from mptcp_pm_nl_addr_send_ack
      mptcp: pm: remove '_nl' from mptcp_pm_nl_mp_prio_send_ack
      mptcp: pm: remove '_nl' from mptcp_pm_nl_work
      mptcp: pm: remove '_nl' from mptcp_pm_nl_rm_addr_received
      mptcp: pm: remove '_nl' from mptcp_pm_nl_subflow_chk_stale()
      mptcp: pm: remove '_nl' from mptcp_pm_nl_is_init_remote_addr
      mptcp: pm: kernel: add '_pm' to mptcp_nl_set_flags
      mptcp: pm: avoid calling PM specific code from core
      mptcp: pm: worker: split in-kernel and common tasks
      mptcp: pm: export mptcp_remote_address
      mptcp: pm: move generic helper at the top
      mptcp: pm: move generic PM helpers to pm.c
      mptcp: pm: split in-kernel PM specific code
      mptcp: pm: move Netlink PM helpers to pm_netlink.c

 net/mptcp/Makefile       |    2 +-
 net/mptcp/pm.c           |  653 ++++++++++++----
 net/mptcp/pm_kernel.c    | 1410 +++++++++++++++++++++++++++++++++
 net/mptcp/pm_netlink.c   | 1937 ++--------------------------------------------
 net/mptcp/pm_userspace.c |   28 +-
 net/mptcp/protocol.c     |    5 +-
 net/mptcp/protocol.h     |   42 +-
 7 files changed, 2045 insertions(+), 2032 deletions(-)
---
base-commit: 865eddcf0afbcd54f79b81e6327ea40c997714c7
change-id: 20250307-net-next-mptcp-pm-reorg-b789f3d9a3ad

Best regards,

Comments

patchwork-bot+netdevbpf@kernel.org March 10, 2025, 8:50 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 07 Mar 2025 12:21:44 +0100 you wrote:
> Before this series, the PM code was dispersed in different places:
> 
> - pm.c had common code for all PMs.
> 
> - pm_netlink.c was initially only about the in-kernel PM, but ended up
>   also getting exported common helpers, callbacks used by the different
>   PMs, NL events for PM userspace daemon, etc. quite confusing.
> 
> [...]

Here is the summary with links:
  - [net-next,01/15] mptcp: pm: use addr entry for get_local_id
    https://git.kernel.org/netdev/net-next/c/7462fe22cc74
  - [net-next,02/15] mptcp: pm: remove '_nl' from mptcp_pm_nl_addr_send_ack
    https://git.kernel.org/netdev/net-next/c/fac7a6ddc757
  - [net-next,03/15] mptcp: pm: remove '_nl' from mptcp_pm_nl_mp_prio_send_ack
    https://git.kernel.org/netdev/net-next/c/d1734987992c
  - [net-next,04/15] mptcp: pm: remove '_nl' from mptcp_pm_nl_work
    https://git.kernel.org/netdev/net-next/c/551a9ad7879d
  - [net-next,05/15] mptcp: pm: remove '_nl' from mptcp_pm_nl_rm_addr_received
    https://git.kernel.org/netdev/net-next/c/636113918508
  - [net-next,06/15] mptcp: pm: remove '_nl' from mptcp_pm_nl_subflow_chk_stale()
    https://git.kernel.org/netdev/net-next/c/550c50bbc2b7
  - [net-next,07/15] mptcp: pm: remove '_nl' from mptcp_pm_nl_is_init_remote_addr
    https://git.kernel.org/netdev/net-next/c/498d7d8b75f1
  - [net-next,08/15] mptcp: pm: kernel: add '_pm' to mptcp_nl_set_flags
    https://git.kernel.org/netdev/net-next/c/40aa7409d30d
  - [net-next,09/15] mptcp: pm: avoid calling PM specific code from core
    https://git.kernel.org/netdev/net-next/c/a17336b2b2e0
  - [net-next,10/15] mptcp: pm: worker: split in-kernel and common tasks
    https://git.kernel.org/netdev/net-next/c/a49eb8ae95b8
  - [net-next,11/15] mptcp: pm: export mptcp_remote_address
    https://git.kernel.org/netdev/net-next/c/a14673127236
  - [net-next,12/15] mptcp: pm: move generic helper at the top
    https://git.kernel.org/netdev/net-next/c/bcc32640ada0
  - [net-next,13/15] mptcp: pm: move generic PM helpers to pm.c
    https://git.kernel.org/netdev/net-next/c/e4c28e3d5c09
  - [net-next,14/15] mptcp: pm: split in-kernel PM specific code
    https://git.kernel.org/netdev/net-next/c/8617e85e04bd
  - [net-next,15/15] mptcp: pm: move Netlink PM helpers to pm_netlink.c
    https://git.kernel.org/netdev/net-next/c/2e7e6e9cda1e

You are awesome, thank you!