Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63389
b: refs/heads/master
c: e7d0c88
h: refs/heads/master
i:
  63387: 990f3bb
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jul 31, 2007
1 parent b6111d5 commit 58ce7e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30cfd0baf0a0c4329fff1ef4b622919297969ec8
refs/heads/master: e7d0c88586a66cf03e70750a8119d984fdedf2aa
46 changes: 18 additions & 28 deletions trunk/net/ipv4/tcp_cubic.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,38 +246,12 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
ca->cnt = 1;
}


/* Keep track of minimum rtt */
static inline void measure_delay(struct sock *sk)
{
const struct tcp_sock *tp = tcp_sk(sk);
struct bictcp *ca = inet_csk_ca(sk);
u32 delay;

/* No time stamp */
if (!(tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) ||
/* Discard delay samples right after fast recovery */
(s32)(tcp_time_stamp - ca->epoch_start) < HZ)
return;

delay = (tcp_time_stamp - tp->rx_opt.rcv_tsecr)<<3;
if (delay == 0)
delay = 1;

/* first time call or link delay decreases */
if (ca->delay_min == 0 || ca->delay_min > delay)
ca->delay_min = delay;
}

static void bictcp_cong_avoid(struct sock *sk, u32 ack,
u32 in_flight, int data_acked)
{
struct tcp_sock *tp = tcp_sk(sk);
struct bictcp *ca = inet_csk_ca(sk);

if (data_acked)
measure_delay(sk);

if (!tcp_is_cwnd_limited(sk, in_flight))
return;

Expand Down Expand Up @@ -337,14 +311,30 @@ static void bictcp_state(struct sock *sk, u8 new_state)
static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us)
{
const struct inet_connection_sock *icsk = inet_csk(sk);
struct bictcp *ca = inet_csk_ca(sk);
u32 delay;

if (cnt > 0 && icsk->icsk_ca_state == TCP_CA_Open) {
struct bictcp *ca = inet_csk_ca(sk);
cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT;
ca->delayed_ack += cnt;
}
}

/* Some calls are for duplicates without timetamps */
if (rtt_us < 0)
return;

/* Discard delay samples right after fast recovery */
if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ)
return;

delay = usecs_to_jiffies(rtt_us) << 3;
if (delay == 0)
delay = 1;

/* first time call or link delay decreases */
if (ca->delay_min == 0 || ca->delay_min > delay)
ca->delay_min = delay;
}

static struct tcp_congestion_ops cubictcp = {
.init = bictcp_init,
Expand Down

0 comments on commit 58ce7e7

Please sign in to comment.