From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 743AC3B29E for ; Wed, 23 Oct 2019 05:59:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571824747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eg6GWygKeYzqmkq+LDj844ZOc9L0SpguuNdAt7HOGwI=; b=hnAYnwKq8yHUjt29aL459f+r60fZZHmFl25N5/QL5wtMQCnwzdpsBoNcwSzq78Q9ym0R2H K3b6CSHRm9fmoJiqVj7oyAsdt/s4KtvIa6IoxzGogdE6umO3dt5K0n6M6Y3DQGqcptlGsz LoJPMqAwWZOLb5g1fJfIDRBzin6gJB0= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-240-f8NEDT3BN52vI3FfE6rk5Q-1; Wed, 23 Oct 2019 05:59:04 -0400 Received: by mail-lf1-f70.google.com with SMTP id v204so2213945lfa.0 for ; Wed, 23 Oct 2019 02:59:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=gQX28cV4kR5e8hFv0Sv15bTp7rYQDznh9B4z2Gx6gas=; b=Xa41kBhZzHL/IgOf9ozra1oNeD4LC8jcUyDN3dLrsUQLduAmPchkr4WPBMvT1Ah8+t 1TdvAmVZHuTXY0vcfvJbtLKeHaW+NsWNUVthFB37eBBpem2r88uAhtpnawt7tzSIrts5 eWEN/wrMKgcHa0S5ThtPbxZKet307f+gK8MelMTCsMJ5spw4AbVDM3uaPE1yWdILJ67d p1obM2Bm8JDRAc40svYalhUvbl2p5C20UtTNFAM0aiZjXRlc+nKi2/5HP/LneDsa9a5G kx+1BvyhhVlMpI2McJ9Vr21q7jaq9eXO9j1ig/Cj5l7Te10tNl3iTg/OlD21nWtwpQmN kYrg== X-Gm-Message-State: APjAAAWiYe9Ldn2XXlVKt6Lj7prD2hP5BTZ9MXfW5qE7JMib6H7gA9hn 14zJC98HphG2BLY4B7t+OCOErkr/eJSJ6KNf5VI7aeVCrF7bJOOZNt7LQDJCoFlx5opLI8yWjMc jEpHwgZMtLdsP0Sxq1fQZyhImeN30KDqy7qc= X-Received: by 2002:a2e:3a09:: with SMTP id h9mr2116468lja.33.1571824743120; Wed, 23 Oct 2019 02:59:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9yBpqfp8P3zrpHjmRUQNtL4OGfEs/C9BXAlCLtv6QPTbNsh+wv1XbAGYjDidVbFVFmiv5kg== X-Received: by 2002:a2e:3a09:: with SMTP id h9mr2116446lja.33.1571824742909; Wed, 23 Oct 2019 02:59:02 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id w16sm8636867lji.42.2019.10.23.02.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 02:59:02 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id B569E1804B6; Wed, 23 Oct 2019 11:59:00 +0200 (CEST) From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Johannes Berg Cc: linux-wireless@vger.kernel.org, make-wifi-fast@lists.bufferbloat.net, ath10k@lists.infradead.org, John Crispin , Lorenzo Bianconi , Felix Fietkau , Kan Yan , Rajkumar Manoharan , Kevin Hayes Date: Wed, 23 Oct 2019 11:59:00 +0200 Message-ID: <157182474063.150713.16132669599100802716.stgit@toke.dk> In-Reply-To: <157182473951.150713.7978051149956899705.stgit@toke.dk> References: <157182473951.150713.7978051149956899705.stgit@toke.dk> User-Agent: StGit/0.20 MIME-Version: 1.0 X-MC-Unique: f8NEDT3BN52vI3FfE6rk5Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Make-wifi-fast] [PATCH v6 1/4] mac80211: Shrink the size of ack_frame_id to make room for tx_time_est 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: Wed, 23 Oct 2019 09:59:08 -0000 From: Toke H=C3=B8iland-J=C3=B8rgensen To implement airtime queue limiting, we need to keep a running account of the estimated airtime of all skbs queued into the device. Do to this correctly, we need to store the airtime estimate into the skb so we can decrease the outstanding balance when the skb is freed. This means that the time estimate must be stored somewhere that will survive for the lifetime of the skb. To get this, decrease the size of the ack_frame_id field to 6 bits, and lower the size of the ID space accordingly. This leaves 10 bits for use for tx_time_est, which is enough to store a maximum of 4096 us, if we shift the values so they become units of 4us. Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen --- include/net/mac80211.h | 4 +++- net/mac80211/cfg.c | 2 +- net/mac80211/tx.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d69081c38788..4288ace72c2b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -967,6 +967,7 @@ ieee80211_rate_get_vht_nss(const struct ieee80211_tx_ra= te *rate) * @band: the band to transmit on (use for checking for races) * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives = the AC * @ack_frame_id: internal frame ID for TX status, used internally + * @tx_time_est: TX time estimate in units of 4us, used internally * @control: union part for control data * @control.rates: TX rates array to try * @control.rts_cts_rate_idx: rate for RTS or CTS @@ -1007,7 +1008,8 @@ struct ieee80211_tx_info { =20 =09u8 hw_queue; =20 -=09u16 ack_frame_id; +=09u16 ack_frame_id:6; +=09u16 tx_time_est:10; =20 =09union { =09=09struct { diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 70739e746c13..4fb7f1f12109 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3428,7 +3428,7 @@ int ieee80211_attach_ack_skb(struct ieee80211_local *= local, struct sk_buff *skb, =20 =09spin_lock_irqsave(&local->ack_status_lock, spin_flags); =09id =3D idr_alloc(&local->ack_status_frames, ack_skb, -=09=09 1, 0x10000, GFP_ATOMIC); +=09=09 1, 0x40, GFP_ATOMIC); =09spin_unlock_irqrestore(&local->ack_status_lock, spin_flags); =20 =09if (id < 0) { diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 938c10f7955b..a16c2f863702 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2719,7 +2719,7 @@ static struct sk_buff *ieee80211_build_hdr(struct iee= e80211_sub_if_data *sdata, =20 =09=09=09spin_lock_irqsave(&local->ack_status_lock, flags); =09=09=09id =3D idr_alloc(&local->ack_status_frames, ack_skb, -=09=09=09=09 1, 0x10000, GFP_ATOMIC); +=09=09=09=09 1, 0x40, GFP_ATOMIC); =09=09=09spin_unlock_irqrestore(&local->ack_status_lock, flags); =20 =09=09=09if (id >=3D 0) {