• Gerd Bayer's avatar
    net/smc: Use correct buffer sizes when switching between TCP and SMC · 30c3c4a4
    Gerd Bayer authored
    Tuning of the effective buffer size through setsockopts was working for
    SMC traffic only but not for TCP fall-back connections even before
    commit 0227f058 ("net/smc: Unbind r/w buffer size from clcsock and
    make them tunable"). That change made it apparent that TCP fall-back
    connections would use net.smc.[rw]mem as buffer size instead of
    net.ipv4_tcp_[rw]mem.
    
    Amend the code that copies attributes between the (TCP) clcsock and the
    SMC socket and adjust buffer sizes appropriately:
    - Copy over sk_userlocks so that both sockets agree on whether tuning
      via setsockopt is active.
    - When falling back to TCP use sk_sndbuf or sk_rcvbuf as specified with
      setsockopt. Otherwise, use the sysctl value for TCP/IPv4.
    - Likewise, use either values from setsockopt or from sysctl for SMC
      (duplicated) on successful SMC connect.
    
    In smc_tcp_listen_work() drop the explicit copy of buffer sizes as that
    is taken care of by the attribute copy.
    
    Fixes: 0227f058 ("net/smc: Unbind r/w buffer size from clcsock and make them tunable")
    Reviewed-by: default avatarWenjia Zhang <wenjia@linux.ibm.com>
    Reviewed-by: default avatarTony Lu <tonylu@linux.alibaba.com>
    Signed-off-by: default avatarGerd Bayer <gbayer@linux.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    30c3c4a4
af_smc.c 89.8 KB