• N
    tcp: Only init congestion control if not initialized already · 8919a9b3
    Neal Cardwell 提交于
    Change tcp_init_transfer() to only initialize congestion control if it
    has not been initialized already.
    
    With this new approach, we can arrange things so that if the EBPF code
    sets the congestion control by calling setsockopt(TCP_CONGESTION) then
    tcp_init_transfer() will not re-initialize the CC module.
    
    This is an approach that has the following beneficial properties:
    
    (1) This allows CC module customizations made by the EBPF called in
        tcp_init_transfer() to persist, and not be wiped out by a later
        call to tcp_init_congestion_control() in tcp_init_transfer().
    
    (2) Does not flip the order of EBPF and CC init, to avoid causing bugs
        for existing code upstream that depends on the current order.
    
    (3) Does not cause 2 initializations for for CC in the case where the
        EBPF called in tcp_init_transfer() wants to set the CC to a new CC
        algorithm.
    
    (4) Allows follow-on simplifications to the code in net/core/filter.c
        and net/ipv4/tcp_cong.c, which currently both have some complexity
        to special-case CC initialization to avoid double CC
        initialization if EBPF sets the CC.
    Signed-off-by: NNeal Cardwell <ncardwell@google.com>
    Signed-off-by: NEric Dumazet <edumazet@google.com>
    Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
    Acked-by: NYuchung Cheng <ycheng@google.com>
    Acked-by: NKevin Yang <yyd@google.com>
    Cc: Lawrence Brakmo <brakmo@fb.com>
    8919a9b3
tcp.c 109.3 KB