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 0DE733CB35 for ; Fri, 8 Nov 2019 05:55:40 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573210540; 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=bsPfNwlAkGOPfmWxI5u777tBP7n0JZnEAYYAZmhM14E=; b=NHV9K5Ztv0xnFig0glSuA//YhiyYpfDZvtH9EyD+zxcs7KR1Nq69x7AC1XvrhMnj+qA5oo MnfpKVYS8ICyut6WwgZUH+TxOcDMSTu8YANMr0ecwdD7TQkt8pN8H40mFFELoLetzFh/YN urwMGm+eyo7u0zlPQk9WjaRD0Vh7Wzw= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-7fng5L-tM_m0tW0fysDL4A-1; Fri, 08 Nov 2019 05:55:39 -0500 Received: by mail-lf1-f72.google.com with SMTP id v204so1227188lfa.0 for ; Fri, 08 Nov 2019 02:55:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=YJrXGtCnMlroIEY2nnixcaaDlLt4fqJ7BPUU7uurxtY=; b=QDOAJddder/T4Q/hAO5WPz3bVPy9eTWCQjnoknnerSYWnEqMoNKcA+SsilL0SeFp0a hlKCs4cIU0ekCjBhjo97Wl33bPYRZUtGvgqrjeouqJU4jpBfYo0169pB56RHrzFnxmE0 cUHi+rEBQ7cA0IMbhr7ROd3SsYFgK156MLM7UaZDURGMDj727/4kVRKP8iTvJ5OcYPii UOMWtaTXvZLzrtdX1ACTsyXtLwXWZjvwJ65kJYheqIlRRYcRHELg4xd9NztxNciUnHgr WJ5qN/aTV3S/rQSEtkm9bWDccQGJSgPi9i9t62BhiEMJ5CyI3WS1d0+4ucM/gwW/Ftlr zGtg== X-Gm-Message-State: APjAAAUMAnFfZaZtncd8uTYVcJ2xXjqrSQlzqB9RQcXsPjd5sa8ZANWg kouVtoAcSzieqpbB/y66O3t116ZM/+qcKywgzpoN/65UJyJYakdgGpj8r+CJSo96wCsOmUWKj8f RK/QoB1ZM4+waEphCuiGw1LhlxPBgGGoh/gI= X-Received: by 2002:a2e:998a:: with SMTP id w10mr6332842lji.66.1573210537774; Fri, 08 Nov 2019 02:55:37 -0800 (PST) X-Google-Smtp-Source: APXvYqyEGKU7zYVEzHqvutjPdhb0Ch2cJ7Jo3JKjhWNBQYUJrGbfwFRDp8nlKlaaBjRUW80eWrShhw== X-Received: by 2002:a2e:998a:: with SMTP id w10mr6332815lji.66.1573210537418; Fri, 08 Nov 2019 02:55:37 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id v12sm2326039ljg.14.2019.11.08.02.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2019 02:55:36 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id D26D61818B5; Fri, 8 Nov 2019 11:55:35 +0100 (CET) From: Toke =?utf-8?Q?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 In-Reply-To: <42266e95f45d5772e04c9c016bd6179ea14ffefa.camel@sipsolutions.net> References: <157182473951.150713.7978051149956899705.stgit@toke.dk> <157182474174.150713.17459330922820192258.stgit@toke.dk> <42266e95f45d5772e04c9c016bd6179ea14ffefa.camel@sipsolutions.net> X-Clacks-Overhead: GNU Terry Pratchett Date: Fri, 08 Nov 2019 11:55:35 +0100 Message-ID: <87d0e2fxi0.fsf@toke.dk> MIME-Version: 1.0 X-MC-Unique: 7fng5L-tM_m0tW0fysDL4A-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Make-wifi-fast] [PATCH v6 2/4] mac80211: Import airtime calculation code from mt76 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, 08 Nov 2019 10:55:41 -0000 Johannes Berg writes: > On Wed, 2019-10-23 at 11:59 +0200, Toke H=C3=B8iland-J=C3=B8rgensen wrote= : >> From: Toke H=C3=B8iland-J=C3=B8rgensen >>=20 >> Felix recently added code to calculate airtime of packets to the mt76 >> driver. Import this into mac80211 so we can use it for airtime queue lim= it >> calculations later. >>=20 >> The airtime.c file is copied verbatim from the mt76 driver, and adjusted= to >> use mac80211 data structures instead (which is fairly straight forward). >> The per-rate TX rate calculation is split out to its own >> function (ieee80211_calc_tx_airtime_rate()) so it can be used directly f= or >> the AQL calculations added in a subsequent patch. > > Any way it could be exposed by mac80211 back to the drivers, perhaps, to > share it? Didn't I already export some of the functions? My intention was to do that, certainly, and to patch mt76 to switch to using them once the trees have converged... >> The only thing that it was not possible to port directly was the bit tha= t >> read the internal driver flags of struct ieee80211_rate to determine >> whether a rate is using CCK or OFDM encoding. Instead, just look at the >> rate index, since at least mt76 and ath10k both seem to have the same >> number of CCK rates (4) in their tables. > > This is highly questionable ... > >> +=09switch (status->encoding) { >> +=09case RX_ENC_LEGACY: >> +=09=09if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ)) >> +=09=09=09return 0; >> + >> +=09=09sband =3D hw->wiphy->bands[status->band]; >> +=09=09if (!sband || status->rate_idx > sband->n_bitrates) >> +=09=09=09return 0; >> + >> +=09=09rate =3D &sband->bitrates[status->rate_idx]; >> +=09=09cck =3D (status->rate_idx < CCK_NUM_RATES); Heh, yeah this did feel like a hack to me as well ;) > Why not > > =09cck =3D rate->flags & IEEE80211_RATE_MANDATORY_B; > > I mean .. we know that IEEE80211_RATE_MANDATORY_B rates are exactly the > CCK rates, and that's not really going to change? > > Alternatively, we could do > > =09cck =3D sband->band =3D=3D NL80211_BAND_2GHZ && > =09 !(rate->flags & IEEE80211_RATE_ERP_G); > > or even > > =09cck =3D rate->bitrate =3D=3D 10 || rate->bitrate =3D=3D 20 || > =09 rate->bitrate =3D=3D 55 || rate->bitrate =3D=3D 110; I am fine with either of those; I just wasn't sure what assumptions I could actually make here. I guess I'll just pick one :) >> +=09default: >> +=09=09WARN_ON_ONCE(1); > > You can't do that in mac80211 either. That might be fine for mt76, but > mac80211 already supports HE. Good point, will fix. -Toke