OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From: Eric Dumazet <edumazet@google.com> |
2 | Date: Sat, 11 Nov 2017 15:54:12 -0800 |
||
3 | Subject: [PATCH] tcp: allow drivers to tweak TSQ logic |
||
4 | MIME-Version: 1.0 |
||
5 | Content-Type: text/plain; charset=UTF-8 |
||
6 | Content-Transfer-Encoding: 8bit |
||
7 | |||
8 | I had many reports that TSQ logic breaks wifi aggregation. |
||
9 | |||
10 | Current logic is to allow up to 1 ms of bytes to be queued into qdisc |
||
11 | and drivers queues. |
||
12 | |||
13 | But Wifi aggregation needs a bigger budget to allow bigger rates to |
||
14 | be discovered by various TCP Congestion Controls algorithms. |
||
15 | |||
16 | This patch adds an extra socket field, allowing wifi drivers to select |
||
17 | another log scale to derive TCP Small Queue credit from current pacing |
||
18 | rate. |
||
19 | |||
20 | Initial value is 10, meaning that this patch does not change current |
||
21 | behavior. |
||
22 | |||
23 | We expect wifi drivers to set this field to smaller values (tests have |
||
24 | been done with values from 6 to 9) |
||
25 | |||
26 | They would have to use following template : |
||
27 | |||
28 | if (skb->sk && skb->sk->sk_pacing_shift != MY_PACING_SHIFT) |
||
29 | skb->sk->sk_pacing_shift = MY_PACING_SHIFT; |
||
30 | |||
31 | Ref: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1670041 |
||
32 | Signed-off-by: Eric Dumazet <edumazet@google.com> |
||
33 | Cc: Johannes Berg <johannes.berg@intel.com> |
||
34 | Cc: Toke Høiland-Jørgensen <toke@toke.dk> |
||
35 | Cc: Kir Kolyshkin <kir@openvz.org> |
||
36 | --- |
||
37 | --- a/include/net/sock.h |
||
38 | +++ b/include/net/sock.h |
||
39 | @@ -267,6 +267,7 @@ struct sock_common { |
||
40 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) |
||
41 | * @sk_gso_max_size: Maximum GSO segment size to build |
||
42 | * @sk_gso_max_segs: Maximum number of GSO segments |
||
43 | + * @sk_pacing_shift: scaling factor for TCP Small Queues |
||
44 | * @sk_lingertime: %SO_LINGER l_linger setting |
||
45 | * @sk_backlog: always used with the per-socket spinlock held |
||
46 | * @sk_callback_lock: used with the callbacks in the end of this struct |
||
3 | office | 47 | @@ -445,6 +446,8 @@ struct sock { |
1 | office | 48 | sk_type : 16; |
49 | #define SK_PROTOCOL_MAX U8_MAX |
||
50 | u16 sk_gso_max_segs; |
||
51 | +#define sk_pacing_shift sk_pacing_shift /* for backport checks */ |
||
52 | + u8 sk_pacing_shift; |
||
53 | unsigned long sk_lingertime; |
||
54 | struct proto *sk_prot_creator; |
||
55 | rwlock_t sk_callback_lock; |
||
56 | --- a/net/core/sock.c |
||
57 | +++ b/net/core/sock.c |
||
3 | office | 58 | @@ -2739,6 +2739,7 @@ void sock_init_data(struct socket *sock, |
1 | office | 59 | |
60 | sk->sk_max_pacing_rate = ~0U; |
||
61 | sk->sk_pacing_rate = ~0U; |
||
62 | + sk->sk_pacing_shift = 10; |
||
63 | sk->sk_incoming_cpu = -1; |
||
64 | /* |
||
65 | * Before updating sk_refcnt, we must commit prior changes to memory |
||
66 | --- a/net/ipv4/tcp_output.c |
||
67 | +++ b/net/ipv4/tcp_output.c |
||
68 | @@ -1683,7 +1683,7 @@ u32 tcp_tso_autosize(const struct sock * |
||
69 | { |
||
70 | u32 bytes, segs; |
||
71 | |||
72 | - bytes = min(sk->sk_pacing_rate >> 10, |
||
73 | + bytes = min(sk->sk_pacing_rate >> sk->sk_pacing_shift, |
||
74 | sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); |
||
75 | |||
76 | /* Goal is to send at least one packet per ms, |
||
3 | office | 77 | @@ -2184,7 +2184,7 @@ static bool tcp_small_queue_check(struct |
1 | office | 78 | { |
79 | unsigned int limit; |
||
80 | |||
81 | - limit = max(2 * skb->truesize, sk->sk_pacing_rate >> 10); |
||
82 | + limit = max(2 * skb->truesize, sk->sk_pacing_rate >> sk->sk_pacing_shift); |
||
83 | limit = min_t(u32, limit, sysctl_tcp_limit_output_bytes); |
||
84 | limit <<= factor; |
||
85 |