lkml.org 
[lkml]   [2011]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] tcp_cubic: limit delayed_ack ratio to prevent divide error
    TCP Cubic keeps a metric that estimates the amount of delayed
    acknowledgements to use in adjusting the window. If an abnormally
    large number of packets are acknowledged at once, then the update
    could wrap and reach zero. This kind of ACK could only
    happen when there was a large window and huge number of
    ACK's were lost.

    This patch limits the value of delayed ack ratio. The choice of 32
    is just a conservative value since normally it should be range of
    1 to 4 packets.

    Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

    ---
    Patch against 2.6.39-rc5+


    --- a/net/ipv4/tcp_cubic.c 2011-05-04 11:58:49.666027155 -0700
    +++ b/net/ipv4/tcp_cubic.c 2011-05-04 12:52:34.716767304 -0700
    @@ -93,6 +93,7 @@ struct bictcp {
    u32 ack_cnt; /* number of acks */
    u32 tcp_cwnd; /* estimated tcp cwnd */
    #define ACK_RATIO_SHIFT 4
    +#define ACK_RATIO_LIMIT (32u << ACK_RATIO_SHIFT)
    u16 delayed_ack; /* estimate the ratio of Packets/ACKs << 4 */
    u8 sample_cnt; /* number of samples to decide curr_rtt */
    u8 found; /* the exit point is found? */
    @@ -398,8 +399,12 @@ static void bictcp_acked(struct sock *sk
    u32 delay;

    if (icsk->icsk_ca_state == TCP_CA_Open) {
    - cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT;
    - ca->delayed_ack += cnt;
    + u32 ratio = ca->delayed_ack;
    +
    + ratio -= ca->delayed_ack >> ACK_RATIO_SHIFT;
    + ratio += cnt;
    +
    + ca->delayed_ack = min(ratio, ACK_RATIO_LIMIT);
    }

    /* Some calls are for duplicates without timetamps */

    \
     
     \ /
      Last update: 2011-05-04 22:07    [W:0.029 / U:0.308 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site