Skip to content

Commit

Permalink
net-tcp_bbr: v2: Use correct 64-bit division
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Demin <rockdrilla@gmail.com>
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
  • Loading branch information
rockdrilla authored and xanmod committed Oct 3, 2022
1 parent 5fdaa51 commit fc0293a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion net/ipv4/tcp_bbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ static u32 bbr_tso_segs_generic(struct sock *sk, unsigned int mss_now,
bytes = sk->sk_pacing_rate >> sk->sk_pacing_shift;

bytes = min_t(u32, bytes, gso_max_size - 1 - MAX_TCP_HEADER);
segs = max_t(u32, bytes / mss_now, bbr_min_tso_segs(sk));
segs = max_t(u32, div_u64(bytes, mss_now), bbr_min_tso_segs(sk));
return segs;
}

Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/tcp_bbr2.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ static void bbr_debug(struct sock *sk, u32 acked,
bbr_rate_kbps(sk, bbr_max_bw(sk)), /* bw: max bw */
0ULL, /* lb: [obsolete] */
0ULL, /* ib: [obsolete] */
(u64)sk->sk_pacing_rate * 8 / 1000,
div_u64((u64)sk->sk_pacing_rate * 8, 1000),
acked,
tcp_packets_in_flight(tp),
rs->is_ack_delayed ? 'd' : '.',
Expand Down Expand Up @@ -698,7 +698,7 @@ static u32 bbr_tso_segs_generic(struct sock *sk, unsigned int mss_now,
}

bytes = min_t(u32, bytes, gso_max_size - 1 - MAX_TCP_HEADER);
segs = max_t(u32, bytes / mss_now, bbr_min_tso_segs(sk));
segs = max_t(u32, div_u64(bytes, mss_now), bbr_min_tso_segs(sk));
return segs;
}

Expand Down

0 comments on commit fc0293a

Please sign in to comment.