Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30cfd0ba authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller
Browse files

[TCP]: congestion control API pass RTT in microseconds



This patch changes the API for the callback that is done after an ACK is
received. It solves a couple of issues:

  * Some congestion controls want higher resolution value of RTT
    (controlled by TCP_CONG_RTT_SAMPLE flag). These don't really want a ktime, but
    all compute a RTT in microseconds.

  * Other congestion control could use RTT at jiffies resolution.

To keep API consistent the units should be the same for both cases, just the
resolution should change.

Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6a302358
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -660,7 +660,7 @@ struct tcp_congestion_ops {
	/* 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, ktime_t last);
	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);

+1 −1
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ static void bictcp_state(struct sock *sk, u8 new_state)
/* Track delayed acknowledgment ratio using sliding window
 * ratio = (15*ratio + sample) / 16
 */
static void bictcp_acked(struct sock *sk, u32 cnt, ktime_t last)
static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt)
{
	const struct inet_connection_sock *icsk = inet_csk(sk);

+1 −1
Original line number Diff line number Diff line
@@ -334,7 +334,7 @@ static void bictcp_state(struct sock *sk, u8 new_state)
/* Track delayed acknowledgment ratio using sliding window
 * ratio = (15*ratio + sample) / 16
 */
static void bictcp_acked(struct sock *sk, u32 cnt, ktime_t last)
static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us)
{
	const struct inet_connection_sock *icsk = inet_csk(sk);

+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ static inline void measure_rtt(struct sock *sk)
	}
}

static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, ktime_t last)
static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, s32 rtt)
{
	const struct inet_connection_sock *icsk = inet_csk(sk);
	const struct tcp_sock *tp = tcp_sk(sk);
+3 −5
Original line number Diff line number Diff line
@@ -83,18 +83,16 @@ static void tcp_illinois_init(struct sock *sk)
}

/* Measure RTT for each ack. */
static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, s32 rtt)
{
	struct illinois *ca = inet_csk_ca(sk);
	u32 rtt;

	ca->acked = pkts_acked;

	if (ktime_equal(last, net_invalid_timestamp()))
	/* dup ack, no rtt sample */
	if (rtt < 0)
		return;

	rtt = ktime_to_us(net_timedelta(last));

	/* ignore bogus values, this prevents wraparound in alpha math */
	if (rtt > RTT_MAX)
		rtt = RTT_MAX;
Loading