TCP congestion control

選擇congestion control的方法s!

congesiton control 的方法預設是用kernel initialization或者使用者透過sysctl的API來控制

tcp_congestion_ops sturcture

pluggable algorithms 被存在 tcp_congestion_ops結構裡!

(include/net/tcp.h)
struct tcp_congestion_ops {
    struct list_head list;
    unsigned long flags;
    /* initialize private data (optional) */
    void (*init)(struct sock *sk);
    /* cleanup private data (optional) */
    void (*release)(struct sock *sk);
    /* return slow start threshold (required) */
    u32 (*ssthresh)(struct sock *sk);
    /* lower bound for congestion window (optional) */
    u32 (*min_cwnd)(const struct sock *sk);
    /* do new cwnd calculation (required) */
    void (*cong_avoid)(struct sock *sk, u32 ACK, u32 in_flight);
    /* call before changing ca_state (optional) */
    void (*set_state)(struct sock *sk, u8 new_state);
    /* call when cwnd event occurs (optional) */
    void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev);
    /* new value of cwnd after loss (optional) */
    u32 (*undo_cwnd)(struct sock *sk);
    /* hook for packet ACK accounting (optional) */
    void (*pkts_acked)(struct sock *sk, u32 num_acked, s32 rtt_us);
    /* get info for inet_diag (optional) */
    void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
    char name[TCP_CA_NAME_MAX];
    struct module *owner;
};

init(): 收到第一個ack之後,並且在congestion control algo.之前執行的初始化

tcp_cubic example

static struct tcp_congestion_ops cubictcp __read_mostly = {
        .init           = bictcp_init,
        .ssthresh       = bictcp_recalc_ssthresh,
        .cong_avoid     = bictcp_cong_avoid,
        .set_state      = bictcp_state,
        .undo_cwnd      = bictcp_undo_cwnd,
        .cwnd_event     = bictcp_cwnd_event,
        .pkts_acked     = bictcp_acked,
        .owner          = THIS_MODULE,
        .name           = "cubic",
};

register by tcp_register_congestion_control() :

static int __init cubictcp_register(void)
{
    ...
    ...
    return tcp_register_congestion_control(&cubictcp);
}

results matching ""

    No results matching ""