From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH v2 net-next] tcp: allow drivers to tweak TSQ logic Date: Tue, 28 Nov 2017 09:33:49 -0800 Message-ID: <1511890429.16595.20.camel@gmail.com> References: <1510281664.2849.143.camel@edumazet-glaptop3.roam.corp.google.com> <1510444452.2849.149.camel@edumazet-glaptop3.roam.corp.google.com> <5cc376a2-895e-68f6-cddd-1011b0fc26bd@nbd.name> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Cc: netdev , Johannes Berg , Toke =?ISO-8859-1?Q?H=F8iland-J=F8rgensen?= , Kir Kolyshkin To: Felix Fietkau , David Miller Return-path: Received: from mail-io0-f196.google.com ([209.85.223.196]:35152 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753178AbdK1Rdx (ORCPT ); Tue, 28 Nov 2017 12:33:53 -0500 Received: by mail-io0-f196.google.com with SMTP id q15so693124ioh.2 for ; Tue, 28 Nov 2017 09:33:53 -0800 (PST) In-Reply-To: <5cc376a2-895e-68f6-cddd-1011b0fc26bd@nbd.name> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 2017-11-28 at 14:10 +0100, Felix Fietkau wrote: > On 2017-11-12 00:54, Eric Dumazet wrote: > > 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 != MY_PACING_SHIFT) > >      skb->sk->sk_pacing_shift = MY_PACING_SHIFT; > > I did some experiments with this approach (with your patch backported > to > a 4.9 kernel), and I got some crashes. > After looking at the crashes and code some more, it seems that this > would need some extra checks to ensure that skb->sk is a full struct > sock, instead of just a struct request_sock. > Should this be done by checking for skb->sk->sk_state == > TCP_ESTABLISHED? It seems to me that this might introduce some extra > overhead. > Hi Felix. Answer is in the question, the pseudo code in the changelog was not 100% correct. I will add following helper to net-next I guess : void sk_pacing_shift_update(struct sock *sk, int val) { if (!sk || !sk_fullsock(sk) || sk->sk_pacing_shift == val) return; sk->sk_pacing_shift = val; } Then you might use it like that : sk_pacing_shift_update(skb->sk, 7); Thanks.