mbox series

[net-next,v2,0/7] net: deduplicate cookie logic

Message ID 20250212021142.1497449-1-willemdebruijn.kernel@gmail.com (mailing list archive)
Headers show
Series net: deduplicate cookie logic | expand

Message

Willem de Bruijn Feb. 12, 2025, 2:09 a.m. UTC
From: Willem de Bruijn <willemb@google.com>

Reuse standard sk, ip and ipv6 cookie init handlers where possible.

Avoid repeated open coding of the same logic.
Harmonize feature sets across protocols.
Make IPv4 and IPv6 logic more alike.
Simplify adding future new fields with a single init point.

v1->v2:
  - limit INET_DSCP_MASK to routing
  - remove no longer used local variable (fix build warning)

Willem de Bruijn (7):
  tcp: only initialize sockcm tsflags field
  net: initialize mark in sockcm_init
  ipv4: initialize inet socket cookies with sockcm_init
  ipv4: remove get_rttos
  icmp: reflect tos through ip cookie rather than updating inet_sk
  ipv6: replace ipcm6_init calls with ipcm6_init_sk
  ipv6: initialize inet socket cookies with sockcm_init

 include/net/ip.h       | 16 +++++-----------
 include/net/ipv6.h     | 11 ++---------
 include/net/sock.h     |  1 +
 net/can/raw.c          |  2 +-
 net/ipv4/icmp.c        |  6 ++----
 net/ipv4/ping.c        |  6 +++---
 net/ipv4/raw.c         |  6 +++---
 net/ipv4/tcp.c         |  2 +-
 net/ipv4/udp.c         |  6 +++---
 net/ipv6/ping.c        |  3 ---
 net/ipv6/raw.c         | 15 +++------------
 net/ipv6/udp.c         | 10 +---------
 net/l2tp/l2tp_ip6.c    |  8 +-------
 net/packet/af_packet.c |  9 ++++-----
 14 files changed, 30 insertions(+), 71 deletions(-)

Comments

David Ahern Feb. 12, 2025, 8:11 p.m. UTC | #1
On 2/11/25 7:09 PM, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
> 
> Reuse standard sk, ip and ipv6 cookie init handlers where possible.
> 
> Avoid repeated open coding of the same logic.
> Harmonize feature sets across protocols.
> Make IPv4 and IPv6 logic more alike.
> Simplify adding future new fields with a single init point.
> 
> v1->v2:
>   - limit INET_DSCP_MASK to routing
>   - remove no longer used local variable (fix build warning)
> 
> Willem de Bruijn (7):
>   tcp: only initialize sockcm tsflags field
>   net: initialize mark in sockcm_init
>   ipv4: initialize inet socket cookies with sockcm_init
>   ipv4: remove get_rttos
>   icmp: reflect tos through ip cookie rather than updating inet_sk
>   ipv6: replace ipcm6_init calls with ipcm6_init_sk
>   ipv6: initialize inet socket cookies with sockcm_init
> 
>  include/net/ip.h       | 16 +++++-----------
>  include/net/ipv6.h     | 11 ++---------
>  include/net/sock.h     |  1 +
>  net/can/raw.c          |  2 +-
>  net/ipv4/icmp.c        |  6 ++----
>  net/ipv4/ping.c        |  6 +++---
>  net/ipv4/raw.c         |  6 +++---
>  net/ipv4/tcp.c         |  2 +-
>  net/ipv4/udp.c         |  6 +++---
>  net/ipv6/ping.c        |  3 ---
>  net/ipv6/raw.c         | 15 +++------------
>  net/ipv6/udp.c         | 10 +---------
>  net/l2tp/l2tp_ip6.c    |  8 +-------
>  net/packet/af_packet.c |  9 ++++-----
>  14 files changed, 30 insertions(+), 71 deletions(-)
> 

LGTM. For the set

Reviewed-by: David Ahern <dsahern@kernel.org>
Jakub Kicinski Feb. 14, 2025, 9:06 p.m. UTC | #2
On Tue, 11 Feb 2025 21:09:46 -0500 Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
> 
> Reuse standard sk, ip and ipv6 cookie init handlers where possible.
> 
> Avoid repeated open coding of the same logic.
> Harmonize feature sets across protocols.
> Make IPv4 and IPv6 logic more alike.
> Simplify adding future new fields with a single init point.

Sorry for noticing late, looks like this doesn't apply cleanly:

Applying: tcp: only initialize sockcm tsflags field
Applying: net: initialize mark in sockcm_init
Applying: ipv4: initialize inet socket cookies with sockcm_init
Applying: ipv4: remove get_rttos
Applying: icmp: reflect tos through ip cookie rather than updating inet_sk
Using index info to reconstruct a base tree...
M	net/ipv4/icmp.c
Falling back to patching base and 3-way merge...
Auto-merging net/ipv4/icmp.c
Applying: ipv6: replace ipcm6_init calls with ipcm6_init_sk
Applying: ipv6: initialize inet socket cookies with sockcm_init

So CI didn't consume it..

Could you rebase & repost?
Willem de Bruijn Feb. 14, 2025, 10:34 p.m. UTC | #3
Jakub Kicinski wrote:
> On Tue, 11 Feb 2025 21:09:46 -0500 Willem de Bruijn wrote:
> > From: Willem de Bruijn <willemb@google.com>
> > 
> > Reuse standard sk, ip and ipv6 cookie init handlers where possible.
> > 
> > Avoid repeated open coding of the same logic.
> > Harmonize feature sets across protocols.
> > Make IPv4 and IPv6 logic more alike.
> > Simplify adding future new fields with a single init point.
> 
> Sorry for noticing late, looks like this doesn't apply cleanly:
> 
> Applying: tcp: only initialize sockcm tsflags field
> Applying: net: initialize mark in sockcm_init
> Applying: ipv4: initialize inet socket cookies with sockcm_init
> Applying: ipv4: remove get_rttos
> Applying: icmp: reflect tos through ip cookie rather than updating inet_sk
> Using index info to reconstruct a base tree...
> M	net/ipv4/icmp.c
> Falling back to patching base and 3-way merge...
> Auto-merging net/ipv4/icmp.c
> Applying: ipv6: replace ipcm6_init calls with ipcm6_init_sk
> Applying: ipv6: initialize inet socket cookies with sockcm_init
> 
> So CI didn't consume it..
> 
> Could you rebase & repost?

Done. Sorry about that. Not sure what went wrong. I had v2 on top of
netdev-nn/main as of Feb 11, commit ae9b3c0e79bc ("Merge branch
'tcp-allow-to-reduce-max-rto'").

Now rebased on top of current head at commit 412723d54a8b ("Merge
branch 'net-phylink-xpcs-stmmac-support-pcs-eee-configuration'").

Good point that I could have noticed that something was up by looking
at the CI. Will keep that in mind.