inetpeer: get rid of ip_id_count
Ideally, we would need to generate IP ID using a per destination IP generator. linux kernels used inet_peer cache for this purpose, but this had a huge cost on servers disabling MTU discovery. 1) each inet_peer struct consumes 192 bytes 2) inetpeer cache uses a binary tree of inet_peer structs, with a nominal size of ~66000 elements under load. 3) lookups in this tree are hitting a lot of cache lines, as tree depth is about 20. 4) If server deals with many tcp flows, we have a high probability of not finding the inet_peer, allocating a fresh one, inserting it in the tree with same initial ip_id_count, (cf secure_ip_id()) 5) We garbage collect inet_peer aggressively. IP ID generation do not have to be 'perfect' Goal is trying to avoid duplicates in a short period of time, so that reassembly units have a chance to complete reassembly of fragments belonging to one message before receiving other fragments with a recycled ID. We simply use an array of generators, and a Jenkin hash using the dst IP as a key. ipv6_select_ident() is put back into net/ipv6/ip6_output.c where it belongs (it is only used from this file) secure_ip_id() and secure_ipv6_id() no longer are needed. Rename ip_select_ident_more() to ip_select_ident_segs() to avoid unnecessary decrement/increment of the number of segments. Signed-off-by:Eric Dumazet <edumazet@google.com> Signed-off-by:
David S. Miller <davem@davemloft.net>
Showing
- drivers/net/ppp/pptp.c 1 addition, 1 deletiondrivers/net/ppp/pptp.c
- include/net/inetpeer.h 3 additions, 20 deletionsinclude/net/inetpeer.h
- include/net/ip.h 23 additions, 17 deletionsinclude/net/ip.h
- include/net/ipv6.h 0 additions, 2 deletionsinclude/net/ipv6.h
- include/net/secure_seq.h 0 additions, 2 deletionsinclude/net/secure_seq.h
- net/core/secure_seq.c 0 additions, 25 deletionsnet/core/secure_seq.c
- net/ipv4/igmp.c 2 additions, 2 deletionsnet/ipv4/igmp.c
- net/ipv4/inetpeer.c 0 additions, 18 deletionsnet/ipv4/inetpeer.c
- net/ipv4/ip_output.c 3 additions, 4 deletionsnet/ipv4/ip_output.c
- net/ipv4/ip_tunnel_core.c 1 addition, 1 deletionnet/ipv4/ip_tunnel_core.c
- net/ipv4/ipmr.c 1 addition, 1 deletionnet/ipv4/ipmr.c
- net/ipv4/raw.c 1 addition, 1 deletionnet/ipv4/raw.c
- net/ipv4/route.c 16 additions, 29 deletionsnet/ipv4/route.c
- net/ipv4/xfrm4_mode_tunnel.c 1 addition, 1 deletionnet/ipv4/xfrm4_mode_tunnel.c
- net/ipv6/ip6_output.c 12 additions, 0 deletionsnet/ipv6/ip6_output.c
- net/ipv6/output_core.c 0 additions, 30 deletionsnet/ipv6/output_core.c
- net/netfilter/ipvs/ip_vs_xmit.c 1 addition, 1 deletionnet/netfilter/ipvs/ip_vs_xmit.c
Loading
Please register or sign in to comment