From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.toke.dk (mail.toke.dk [52.28.52.200]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 81DA63B2A4 for ; Thu, 9 Nov 2017 22:24:25 -0500 (EST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1510284261; bh=k9vLFPR3c6pdynGpbbgMUlia7c2EEU+22DwwnNCc7yE=; h=From:To:Subject:Date:From; b=lu1mlkk6Yqq67eAGP1fnM/IOj6mFqx7CC2TX0oVjgXir31wsiEXUa+KgIv6YilGhU BVVGoh/LfGSzhr0ZXR9fxp3DkghVqOk9qhqI9+e3b/Uqooc4ooUDPL74+yz+hI3NPy Ywf3BJvrd+EHLKLx7lpFoeV+qdfkFFf2D0yZoJQa8TQAl5E84q+sFet6F+78ZhFvEf kmIkEf+fv/MVw4rTXQmM9uyo3Jh6Hl3bL4yQLe8iOGQXOTWbzFTjDH/TJSG1lUKb3B EX4VQ/2knxZir/uNldTCrUN4a2KNAXTHaiDfJCdP+xBEXKGdG9T7RQ/H+zYejYaHKq iJNS2EiFCXLZA== To: make-wifi-fast@lists.bufferbloat.net Date: Fri, 10 Nov 2017 12:24:16 +0900 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87efp6rf33.fsf@toke.dk> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Subject: [Make-wifi-fast] Fwd: [PATCH net-next] tcp: allow drivers to tweak TSQ logic X-BeenThere: make-wifi-fast@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 03:24:25 -0000 --=-=-= Content-Type: text/plain This should allow us to fix any TCP throughput regressions on WiFi links where the TCP sender is on the same box as the WiFi device. -Toke --=-=-= Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail.toke.dk X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.1 Delivered-To: toke@toke.dk Received: from mail.toke.dk by mail.toke.dk with LMTP id oB1LAcsRBVokPAAAOr1fkg for ; Fri, 10 Nov 2017 03:41:15 +0100 Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) by mail.toke.dk (Postfix) with ESMTPS id 95FD82225E0 for ; Fri, 10 Nov 2017 03:41:13 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YGrS6L3q Received: by mail-pf0-x244.google.com with SMTP id a84so810281pfl.0 for ; Thu, 09 Nov 2017 18:41:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=kBnmLoOBD0cSSyePSOJVoa0daBrldj0WB0iSD4QV2VM=; b=YGrS6L3qdBJzAWA4GN4z0cIuSBuW12GL+u/JRWJJSYgBR7MVwmESlR7AVr/cMUO1i8 Usqkvvj7ql0jyW79YvNn6Vc/zWVPGsQ7pQNyjJgQHLda+xPxVXEOnAsXDypKhOu2UUjS uHVNEwjl8nSg+skjYyLuVikV1YPNLvuPBQvhV12gqG1wzqUCtDmFJ/tYaHjNfvjGWmCH ahSulW8wJwxTiQfHZ0p4oa/7jEF3hmdQ7IFgOpyxdRRGE7fvszhHTLNdh2BUYng7BtF/ fsapQtBE6mYVlofqkCIWyWjB9/alebYdxswPDZUI94EUIRAeP1wQvtX8JbpmFrlceB+p /gzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=kBnmLoOBD0cSSyePSOJVoa0daBrldj0WB0iSD4QV2VM=; b=k8ts43B+Yp5mogJ7kNO/2zXg3RMmreKOl/jRLpSdURSmy0oezdf4YsRhQlAsb+mflT jkkCyTlK5CCBvvxdG2+HWhbu6mFOMiQUGZVRDHUpZldK7wvYd+5rKh6rf21vpLNDeyYG 7KqHXn0wyukb1AKK6hm2NxVi2VyzrUYnf8qwN8609t9nuH/OQFiAhxeQLTNi7qACFG2j naOKMWZwywKhm9BFlfNTa9Ml4KgxYokixMZGMOxudZnYnrLGy6jfj84OiTJcwO57WE6D fJ/e2tliluuKzO7uWTk9yWH5r9y9eHxrGAeobsppmPO8S++tFqy2TdDOFsBiuyyt7t4X CT9g== X-Gm-Message-State: AJaThX5jWsFcCu41u5IQhWGIJgwMbwCIEB5D9MYaVW8L+L5MxFwDoILE vUGB8CH/YdASav7gtKhaJZI= X-Google-Smtp-Source: ABhQp+Q9R10/1YjSxi0vc/OI0GaDBS2cjqBWgQ2q/KGW7YYPTKR1VJ/XXfpZe8jhgNqaNhqecXbB+Q== X-Received: by 10.159.198.140 with SMTP id g12mr2511649plo.34.1510281670553; Thu, 09 Nov 2017 18:41:10 -0800 (PST) X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <1510281664.2849.143.camel@edumazet-glaptop3.roam.corp.google.com> Subject: [PATCH net-next] tcp: allow drivers to tweak TSQ logic From: Eric Dumazet To: David Miller Cc: netdev , Johannes Berg , Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , Kir Kolyshkin Date: Thu, 09 Nov 2017 18:41:04 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Eric Dumazet I had many reports that TSQ logic breaks wifi aggregation. Current logic is to allow up to 1 ms of bytes to be queued into qdisc and drivers queues. But Wifi aggregation needs a bigger budget to allow bigger rates to be discovered by various TCP Congestion Controls algorithms. This patch adds an extra socket field, allowing wifi drivers to select another log scale to derive TCP Small Queue credit from current pacing rate. Initial value is 10, meaning that this patch does not change current behavior. We expect wifi drivers to set this field to smaller values (tests have been done with values from 6 to 9) They would have to use following template : if (skb->sk && skb->sk->sk_pacing_shift !=3D MY_PACING_SHIFT) skb->sk->sk_pacing_shift =3D MY_PACING_SHIFT; Ref: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1670041 Signed-off-by: Eric Dumazet Cc: Johannes Berg Cc: Toke H=C3=B8iland-J=C3=B8rgensen Cc: Kir Kolyshkin --- include/net/sock.h | 1 + net/core/sock.c | 1 + net/ipv4/tcp_output.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 688a823dccc306bd21f47da167c6922161af5a6a..fb0e5194a3bce61fac00fc234d2= a5d1bb3c60f35 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -451,6 +451,7 @@ struct sock { kmemcheck_bitfield_end(flags); =20 u16 sk_gso_max_segs; + u8 sk_pacing_shift; unsigned long sk_lingertime; struct proto *sk_prot_creator; rwlock_t sk_callback_lock; diff --git a/net/core/sock.c b/net/core/sock.c index c59bcf90d90536fedc7809e397f6bd414781b529..2811ff8322d4a5f68e3e745cf58= 5564e1ec5d809 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2746,6 +2746,7 @@ void sock_init_data(struct socket *sock, struct sock = *sk) =20 sk->sk_max_pacing_rate =3D ~0U; sk->sk_pacing_rate =3D ~0U; + sk->sk_pacing_shift =3D 10; sk->sk_incoming_cpu =3D -1; /* * Before updating sk_refcnt, we must commit prior changes to memory diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 9b98d35aa0d8d0a829e4a41985d805d4e2895a8e..fa5e7b81b5ec12039b1347474f5= 183b1d9c87887 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1737,7 +1737,7 @@ u32 tcp_tso_autosize(const struct sock *sk, unsigned = int mss_now, { u32 bytes, segs; =20 - bytes =3D min(sk->sk_pacing_rate >> 10, + bytes =3D min(sk->sk_pacing_rate >> sk->sk_pacing_shift, sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); =20 /* Goal is to send at least one packet per ms, @@ -2215,7 +2215,7 @@ static bool tcp_small_queue_check(struct sock *sk, co= nst struct sk_buff *skb, { unsigned int limit; =20 - limit =3D max(2 * skb->truesize, sk->sk_pacing_rate >> 10); + limit =3D max(2 * skb->truesize, sk->sk_pacing_rate >> sk->sk_pacing_shif= t); limit =3D min_t(u32, limit, sock_net(sk)->ipv4.sysctl_tcp_limit_output_bytes); limit <<=3D factor; --=-=-=--