1. 05 Dec, 2023 10 commits
  2. 04 Dec, 2023 24 commits
  3. 02 Dec, 2023 6 commits
    • David S. Miller's avatar
      Merge branch 'net-cacheline-optimizations' · 8470e436
      David S. Miller authored
      Coco Li says:
      
      ====================
      Analyze and Reorganize core Networking Structs to optimize cacheline consumption
      
      Currently, variable-heavy structs in the networking stack is organized
      chronologically, logically and sometimes by cacheline access.
      
      This patch series attempts to reorganize the core networking stack
      variables to minimize cacheline consumption during the phase of data
      transfer. Specifically, we looked at the TCP/IP stack and the fast
      path definition in TCP.
      
      For documentation purposes, we also added new files for each core data
      structure we considered, although not all ended up being modified due
      to the amount of existing cacheline they span in the fast path. In
      the documentation, we recorded all variables we identified on the
      fast path and the reasons. We also hope that in the future when
      variables are added/modified, the document can be referred to and
      updated accordingly to reflect the latest variable organization.
      
      Tested:
      Our tests were run with neper tcp_rr using tcp traffic. The tests have $cpu
      number of threads and variable number of flows (see below).
      
      Tests were run on 6.5-rc1
      
      Efficiency is computed as cpu seconds / throughput (one tcp_rr round trip).
      The following result shows efficiency delta before and after the patch
      series is applied.
      
      On AMD platforms with 100Gb/s NIC and 256Mb L3 cache:
      IPv4
      Flows   with patches    clean kernel      Percent reduction
      30k     0.0001736538065 0.0002741191042 -36.65%
      20k     0.0001583661752 0.0002712559158 -41.62%
      10k     0.0001639148817 0.0002951800751 -44.47%
      5k      0.0001859683866 0.0003320642536 -44.00%
      1k      0.0002035190546 0.0003152056382 -35.43%
      
      IPv6
      Flows   with patches  clean kernel    Percent reduction
      30k     0.000202535503  0.0003275329163 -38.16%
      20k     0.0002020654777 0.0003411304786 -40.77%
      10k     0.0002122427035 0.0003803674705 -44.20%
      5k      0.0002348776729 0.0004030403953 -41.72%
      1k      0.0002237384583 0.0002813646157 -20.48%
      
      On Intel platforms with 200Gb/s NIC and 105Mb L3 cache:
      IPv6
      Flows   with patches    clean kernel    Percent reduction
      30k     0.0006296537873 0.0006370427753 -1.16%
      20k     0.0003451029365 0.0003628016076 -4.88%
      10k     0.0003187646958 0.0003346835645 -4.76%
      5k      0.0002954676348 0.000311807592  -5.24%
      1k      0.0001909169342 0.0001848069709 3.31%
      
      v8 changes:
      1. Update net_device_read_txrx cache group maximum
      2. Update MAINTAINERS for documentations
      3. Skip __cache_group variables in scripts/kernel-doc
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8470e436
    • Coco Li's avatar
      netns-ipv4: reorganize netns_ipv4 fast path variables · 18fd64d2
      Coco Li authored
      Reorganize fast path variables on tx-txrx-rx order.
      Fastpath cacheline ends after sysctl_tcp_rmem.
      There are only read-only variables here. (write is on the control path
      and not considered in this case)
      
      Below data generated with pahole on x86 architecture.
      Fast path variables span cache lines before change: 4
      Fast path variables span cache lines after change: 2
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarWei Wang <weiwan@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarCoco Li <lixiaoyan@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18fd64d2
    • Coco Li's avatar
      cache: enforce cache groups · aeb9ce05
      Coco Li authored
      Set up build time warnings to safeguard against future header changes of
      organized structs.
      
      Warning includes:
      
      1) whether all variables are still in the same cache group
      2) whether all the cache groups have the sum of the members size (in the
         maximum condition, including all members defined in configs)
      
      The __cache_group* variables are ignored in kernel-doc check in the
      various header files they appear in to enforce the cache groups.
      Suggested-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarCoco Li <lixiaoyan@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aeb9ce05
    • Coco Li's avatar
      Documentations: Analyze heavily used Networking related structs · 14006f1d
      Coco Li authored
      Analyzed a few structs in the networking stack by looking at variables
      within them that are used in the TCP/IP fast path.
      
      Fast path is defined as TCP path where data is transferred from sender to
      receiver unidirectionally. It doesn't include phases other than
      TCP_ESTABLISHED, nor does it look at error paths.
      
      We hope to re-organizing variables that span many cachelines whose fast
      path variables are also spread out, and this document can help future
      developers keep networking fast path cachelines small.
      
      Optimized_cacheline field is computed as
      (Fastpath_Bytes/L3_cacheline_size_x86), and not the actual organized
      results (see patches to come for these).
      
      Investigation is done on 6.5
      
      Name	                Struct_Cachelines  Cur_fastpath_cache Fastpath_Bytes Optimized_cacheline
      tcp_sock	        42 (2664 Bytes)	   12   		396		8
      net_device	        39 (2240 bytes)	   12			234		4
      inet_sock	        15 (960 bytes)	   14			922		14
      Inet_connection_sock	22 (1368 bytes)	   18			1166		18
      Netns_ipv4 (sysctls)	12 (768 bytes)     4			77		2
      linux_mib	        16 (1060)	   6			104		2
      
      Note how there isn't much improvement space for inet_sock and
      Inet_connection_sock because sk and icsk_inet respectively takes up so
      much of the struct that rest of the variables become a small portion of
      the struct size.
      
      So, we decided to reorganize tcp_sock, net_device, netns_ipv4
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarCoco Li <lixiaoyan@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      14006f1d
    • Yinjun Zhang's avatar
      nfp: ethtool: expose transmit SO_TIMESTAMPING capability · 7453d7a6
      Yinjun Zhang authored
      NFP always supports software time stamping of tx, now expose
      the capability through ethtool ops.
      Signed-off-by: default avatarYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Link: https://lore.kernel.org/r/20231129080413.83789-1-louis.peens@corigine.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7453d7a6
    • Niklas Söderlund's avatar
      net: ethernet: renesas: rcar_gen4_ptp: Depend on PTP_1588_CLOCK · 078e0757
      Niklas Söderlund authored
      When breaking out the Gen4 gPTP support to its own module the dependency
      on the PTP_1588_CLOCK framework was left as optional and only stated for
      the driver using the module. This leads to issues when doing
      COMPILE_TEST of RENESAS_GEN4_PTP separately and PTP_1588_CLOCK is built
      as a module and the other as a built-in. Add an explicit depend on
      PTP_1588_CLOCK.
      
      While at it remove the optional support for PTP_1588_CLOCK from
      RENESAS_ETHER_SWITCH as the driver unconditionally calls the Gen4 gPTP
      module and thus also requires the PTP_1588_CLOCK framework.
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: 8c1c6623 ("net: ethernet: renesas: rcar_gen4_ptp: Break out to module")
      Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20231129111142.3322667-1-niklas.soderlund+renesas@ragnatech.seSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      078e0757