netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/7] netpoll: Factor out functions from netpoll_send_udp() and add ipv6 selftest
@ 2025-07-02 10:06 Breno Leitao
  2025-07-02 10:06 ` [PATCH net-next v2 1/7] netpoll: Improve code clarity with explicit struct size calculations Breno Leitao
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Breno Leitao @ 2025-07-02 10:06 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Andrew Lunn, Shuah Khan
  Cc: netdev, linux-kernel, linux-kselftest, Breno Leitao, kernel-team

Refactors the netpoll UDP transmit path to improve code clarity,
maintainability, and protocol-layer encapsulation.

Function netpoll_send_udp() has more than 100 LoC, which is hard to
understand and review. After this patchset, it has only 32 LoC, which is
more manageable.

The series systematically moves the construction of protocol headers
(UDP, IPv4, IPv6, Ethernet) out of the core `netpoll_send_udp()`
function into dedicated static helpers:

  - `push_udp()` for UDP header setup
  - `push_ipv4()` and `push_ipv6()` for IP header setup
  - `push_eth()` for Ethernet header setup

This results in a clean, layered abstraction that mirrors the protocol
stack, reduces code duplication, and improves readability.

Also, to make sure this is not breaking anything, add IPv6 selftest to
netconsole tests, which will exercise this code. This test would also pick
problems similiar to the one fixed by f599020702698  ("net: netpoll:
Initialize UDP checksum field before checksumming"), which was
embarrassin we didn't have a selftest catch it.

Anyway, there are **no functional changes** intended in this patchset.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Changes in v2:
- Move ethernet data from push_ipv{4,6} into push_eth() function, making
  the slice up even more clearer (Jakub).
- Fixed some long lines to get checkpatch happier.
- Link to v1: https://lore.kernel.org/r/20250627-netpoll_untagle_ip-v1-0-61a21692f84a@debian.org

---
Breno Leitao (7):
      netpoll: Improve code clarity with explicit struct size calculations
      netpoll: factor out UDP checksum calculation into helper
      netpoll: factor out IPv6 header setup into push_ipv6() helper
      netpoll: factor out IPv4 header setup into push_ipv4() helper
      netpoll: factor out UDP header setup into push_udp() helper
      netpoll: move Ethernet setup to push_eth() helper
      selftests: net: Add IPv6 support to netconsole basic tests

 net/core/netpoll.c                                 | 192 +++++++++++++--------
 .../selftests/drivers/net/lib/sh/lib_netcons.sh    |  76 +++++++-
 .../testing/selftests/drivers/net/netcons_basic.sh |  53 +++---
 3 files changed, 215 insertions(+), 106 deletions(-)
---
base-commit: 8efa26fcbf8a7f783fd1ce7dd2a409e9b7758df0
change-id: 20250620-netpoll_untagle_ip-e37c799a6925

Best regards,
--  
Breno Leitao <leitao@debian.org>


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-07-08  2:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02 10:06 [PATCH net-next v2 0/7] netpoll: Factor out functions from netpoll_send_udp() and add ipv6 selftest Breno Leitao
2025-07-02 10:06 ` [PATCH net-next v2 1/7] netpoll: Improve code clarity with explicit struct size calculations Breno Leitao
2025-07-04 13:50   ` Simon Horman
2025-07-02 10:06 ` [PATCH net-next v2 2/7] netpoll: factor out UDP checksum calculation into helper Breno Leitao
2025-07-04 13:50   ` Simon Horman
2025-07-02 10:06 ` [PATCH net-next v2 3/7] netpoll: factor out IPv6 header setup into push_ipv6() helper Breno Leitao
2025-07-04 13:50   ` Simon Horman
2025-07-02 10:06 ` [PATCH net-next v2 4/7] netpoll: factor out IPv4 header setup into push_ipv4() helper Breno Leitao
2025-07-04 13:53   ` Simon Horman
2025-07-02 10:06 ` [PATCH net-next v2 5/7] netpoll: factor out UDP header setup into push_udp() helper Breno Leitao
2025-07-04 13:54   ` Simon Horman
2025-07-02 10:06 ` [PATCH net-next v2 6/7] netpoll: move Ethernet setup to push_eth() helper Breno Leitao
2025-07-04 13:54   ` Simon Horman
2025-07-04 14:11     ` Breno Leitao
2025-07-02 10:06 ` [PATCH net-next v2 7/7] selftests: net: Add IPv6 support to netconsole basic tests Breno Leitao
2025-07-04 13:55   ` Simon Horman
2025-07-08  2:10 ` [PATCH net-next v2 0/7] netpoll: Factor out functions from netpoll_send_udp() and add ipv6 selftest patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).