From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 42B4B3CB37 for ; Thu, 26 Sep 2019 22:43:02 -0400 (EDT) Received: by mail-lj1-x241.google.com with SMTP id j19so966454lja.1 for ; Thu, 26 Sep 2019 19:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PrHwv1QQUeiC42oVHpqwP74xGjPRmObHx4uIOne6Cu4=; b=tdvS3NVNNn3tMYy4CaM7RI74yRDg4dwzCMH69CXrwt8fQQNu830e08t/MiZjw/bj+b nZoXBQPZ2h/UKSfzqVDearlUdq0xabSEQYnbZAX4CV/kMXPsoe2+VTGhcdOWF3meOIoD cuUkWORZIpU80mDBWnpoccc7mlBAIQCpMDa0/fSIUHv8/9gZ/cS1ZjMA2giMk+M/SbkU KZ5o8427sv8NloNratir+PfNWKZ33rbR4nikJ6vEaaogeP9MoO8ppPotYYKHlUxI8nnN Ji8+hspACWSseycOEK0BIc3C4x+9SPyGHsnrLlp1lIW1YHeSTDdbUy2XSv7RKTq9NFJV lFww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PrHwv1QQUeiC42oVHpqwP74xGjPRmObHx4uIOne6Cu4=; b=FAcKXatpA5I07vMtpqzk0mZPvFi6KoiJszMXR5t0o0eH1kPSi58boSIl5yQXiD7AsJ IJoZxwg+2IR93Kk4yu3hm4Gym0oDjbHuw4AH5zSency9I5s4dxc2/vMmZO6jyM62ePQk DctRFFUE1HEPpdg/u/PD30rrHlN2VAidRWWSVvkAfuQL1XsW0PLoiNrofOsKgaYz8IUb +qrdC7xp+i+VfQAouZDKSOE39LEJts5ta/PlaZHKVDqLFLRy6y4VU4PmxPdut2uNh08p /os3oWjJ5Ap8o2m6aXDsdo2oYj0F8QVo565Zc+N9qgPP++rbRqw2Zk+KdDp5xJ7LJNex RYNw== X-Gm-Message-State: APjAAAVup55Y2qvsRU7a1r2shKplNxA05ZRoiH6HHlVqUlBRrFB0Jyfh YvGa+LF+Q3TOAHwN9/FTQ6oW2xSCzt+bxqqcOmPY5Q== X-Google-Smtp-Source: APXvYqzzUvriMKt4p3ObGA7gNvvSxyVvkv0hSZR+Zse97m02ivgxNRgQp8H7aqVDK47SlnUAFqocVbHaB6Ze5zWd1LI= X-Received: by 2002:a2e:808c:: with SMTP id i12mr1083535ljg.78.1569552180749; Thu, 26 Sep 2019 19:43:00 -0700 (PDT) MIME-Version: 1.0 References: <156889576422.191202.5906619710809654631.stgit@alrua-x1> <156889576869.191202.510507546538322707.stgit@alrua-x1> <08f0ed6e-b746-9689-6dc8-7c0ea705666d@nbd.name> <87wodv19jl.fsf@toke.dk> <87tv8z13wv.fsf@toke.dk> In-Reply-To: <87tv8z13wv.fsf@toke.dk> From: Kan Yan Date: Thu, 26 Sep 2019 19:42:49 -0700 Message-ID: To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Cc: Felix Fietkau , Johannes Berg , linux-wireless@vger.kernel.org, make-wifi-fast@lists.bufferbloat.net, John Crispin , Lorenzo Bianconi Content-Type: text/plain; charset="UTF-8" Subject: Re: [Make-wifi-fast] [PATCH RFC/RFT 4/4] mac80211: Apply Airtime-based Queue Limit (AQL) on packet dequeue 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, 27 Sep 2019 02:43:02 -0000 > No, but on tx_completion we could do something like this: > airtime = CB(skb)->tx_time ?: CB(skb)->tx_time_est; > ieee80211_report_airtime(sta, airtime); > That way, if the driver sets the tx_time field to something the firmware > reports, we'll use that, and otherwise we'd fall back to the estimate. > Of course, there would need to be a way for the driver to opt out of > this, for drivers that report out of band airtime like ath10k does :) I doubt that will work, unless firmware can do per frame airtime update in the skb. It is more likely that firmware provides out of band airtime update for a period of time, like an aggregation. That's the case for ath10k: https://patchwork.kernel.org/patch/10684689 Regarding handling frame for station enters power saving mode: > > >> Oh, right. Didn't know that could happen (I assumed those would be > >> flushed out or something). But if we're going to go with Kan's > >> suggestion of having per-station accounting as well as a global > >> accounting for the device, we could just subtract the station's > >> outstanding balance from the device total when it goes into powersave > >> mode, and add it back once it wakes up again. At least I think that > >> would work, no? > >Yes, I think that would work. > Great! Will incorporate that, then. I think that could work but things could be a bit more complicated. Not sure I fully understand the usage of airtime_weight_sum in [PATCH V3 1/4] mac80211: Switch to a virtual time-based airtime scheduler: in ieee80211_schedule_txq(): local->airtime_weight_sum[ac] += sta->airtime_weight; in ieee80211_sta_register_airtime(): weight_sum = local->airtime_weight_sum[ac] ?: sta->airtime_weight; local->airtime_v_t[ac] += airtime / weight_sum; sta->airtime[ac].v_t += airtime / sta->airtime_weight; in __ieee80211_unschedule_txq local->airtime_weight_sum[ac] -= sta->airtime_weight; I assume the purpose of airtime_weight_sum is to count station's virtual airtime proportional to the number of active stations for fairness. My concern is the per interface local->airtime_weight_sum[ac] get updated when packets are released from a txq to lower layer, but it doesn't mean the airtime will be consumed (packets get transmitted) shortly, due to events like station enter power save mode, so the weight_sum used in ieee80211_sta_register_airtime() maybe inaccurate. For architects using firmware/hardware offloading, firmware ultimately controls packet scheduling and has quite a lot of autonomy. The host driver's airtime_weight_sum may get out of sync with the number of active stations actually scheduled by firmware even without power saving events. Is this a correct understanding? I kind of think the original method of airtime accounting using deficit maybe more robust in this regard.