[PATCH 0/3] netpoll: Code organization improvements

Breno Leitao posted 3 patches 3 months, 3 weeks ago
net/core/netpoll.c | 152 ++++++++++++++++++++++++++++++++---------------------
1 file changed, 91 insertions(+), 61 deletions(-)
[PATCH 0/3] netpoll: Code organization improvements
Posted by Breno Leitao 3 months, 3 weeks ago
The netpoll_setup() function has grown complex over time, mixing
different error handling and concerns like carrier waiting, IPv4 address
retrieval, and IPv6 address retrieval all within a single function,
which is huge (127 LoC).

This patch series refactors the netpoll_setup() function to improve code
organization and readability by extracting logical blocks into dedicated
helper functions. netpoll_setup() length is reduced to 72 LoC.

This series breaks down these responsibilities into focused helper
functions.

The changes are purely structural with no functional modifications.

This changes were tested with the netconsole tests and the netpoll
selftest (WIP)[1]

Link: https://lore.kernel.org/all/20250612-netpoll_test-v1-1-4774fd95933f@debian.org/ [1]

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (3):
      netpoll: Extract carrier wait function
      netpoll: extract IPv4 address retrieval into helper function
      netpoll: Extract IPv6 address retrieval function

 net/core/netpoll.c | 152 ++++++++++++++++++++++++++++++++---------------------
 1 file changed, 91 insertions(+), 61 deletions(-)
---
base-commit: ec315832f6f98f0fa5719b8b5dd2214ca44ef3f1
change-id: 20250617-netpoll_ip_ref-dca7934ea548

Best regards,
-- 
Breno Leitao <leitao@debian.org>
Re: [PATCH 0/3] netpoll: Code organization improvements
Posted by Breno Leitao 3 months, 3 weeks ago
On Wed, Jun 18, 2025 at 02:32:44AM -0700, Breno Leitao wrote:
> The netpoll_setup() function has grown complex over time, mixing
> different error handling and concerns like carrier waiting, IPv4 address
> retrieval, and IPv6 address retrieval all within a single function,
> which is huge (127 LoC).
> 
> This patch series refactors the netpoll_setup() function to improve code
> organization and readability by extracting logical blocks into dedicated
> helper functions. netpoll_setup() length is reduced to 72 LoC.
> 
> This series breaks down these responsibilities into focused helper
> functions.
> 
> The changes are purely structural with no functional modifications.
> 
> This changes were tested with the netconsole tests and the netpoll
> selftest (WIP)[1]
> 
> Link: https://lore.kernel.org/all/20250612-netpoll_test-v1-1-4774fd95933f@debian.org/ [1]
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

I forgot to tag this in the header, but this is against 'net-next'.

I will send a v2 tomorrow with the proper "net-next" tag.
Re: [PATCH 0/3] netpoll: Code organization improvements
Posted by Jakub Kicinski 3 months, 3 weeks ago
On Wed, 18 Jun 2025 08:25:49 -0700 Breno Leitao wrote:
> I will send a v2 tomorrow with the proper "net-next" tag.

No need, it's not worth resending for.