Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4690118yba; Tue, 30 Apr 2019 02:45:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/JDDLfxVGtvxMRN6sg1bkxIj5D33eYy2q4CF4wirE+jDDRMz6X9u7c2SN5PmP1npapYco X-Received: by 2002:a63:4144:: with SMTP id o65mr64836838pga.241.1556617550381; Tue, 30 Apr 2019 02:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556617550; cv=none; d=google.com; s=arc-20160816; b=Hb8zNFBTYXLvH0w9UkxdCUTBTYD5/Bf3wytEAt78l1xFnVWwUbUpjJ6jQgzP8n79/W jDlA4TnWBQ29JR0KBdz1H4XY9BB9hCj/Ybz69WblqOD0HMujWPPUID2Azlql/Gl9F3n9 2rtv8hbaO99Ns6XXjfT48XvM0C5IkvgYQ76xXpsQhSTcacTvwezSwxvfDXkCOiKPD30j j4Jd5qHFKTgBou11NYI7uHrPN2zA3pHKeKvI/y1HN+E4ulcMWUT97Wj42XP87aB0rshy D7HCh3i0tJwNxwO83/18BLgweUQbKl4JtX9lRgoeDngtvFgtP0fiORyIiqnlbiT9tnGZ lOkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=9uqNHwfCrVArPZzqPy3/a41fA73h8jOy1yd+SZMXF/0=; b=zdkgpV0sWc5g5AaATzqsuQkmBeVDWHVM0fbQAtp8t4o8fk+ECiC9HX/kBM8PYSgS30 ZajvT9lAl5+7e9LOSRkjK5Q8xrzwgCUhzazTKVFrF9WjKiNEsxdPq024sc00lLiy8ivp +tqyGY65ZGZuFUbK5fnVV9ZJzV3BmxCf4Kw/kF59PN+EVq7rScd7EPbn7vykzaxhj5fN x96wiEnYm8WCDpjEIJO6YydQF9mIB8e/CC87sQFEfnQrFYDfPdB2GyXP7w6j/x7mYe0n K67j2dCnG39tSCtRtz/88PB2AQWgVsHrNPojWF7bO8ao0p8envjyCNHhSd9X8BINk/YL zgsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hMaRHXnw; dkim=pass header.i=@codeaurora.org header.s=default header.b=ThPbZKF5; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si33619261pgv.474.2019.04.30.02.45.34; Tue, 30 Apr 2019 02:45:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hMaRHXnw; dkim=pass header.i=@codeaurora.org header.s=default header.b=ThPbZKF5; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726937AbfD3JpF (ORCPT + 99 others); Tue, 30 Apr 2019 05:45:05 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56546 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbfD3JpE (ORCPT ); Tue, 30 Apr 2019 05:45:04 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3BD5460FED; Tue, 30 Apr 2019 09:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1556617503; bh=9mrdmhCcV3kVI5UiSBT/pSyeccGh9Vq4DmmXYx4oRdc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hMaRHXnwoU+JDls3mBmCxpds18W4BUo6kTScgitletvP1Qq8WP5mLt6C5h5PQlQUs dlZH3mjWAqklWoDiomK4HpDvM1YvdNUrIDWc8umehUAw8SzQdh7U8UQ4Y+K2UQW58x JhTtT3rtYBMvcvFql5/dnJ0aaBTAw30GcPrUD/4A= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 89E2060E41; Tue, 30 Apr 2019 09:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1556617500; bh=9mrdmhCcV3kVI5UiSBT/pSyeccGh9Vq4DmmXYx4oRdc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ThPbZKF5KMREHF7avscudEfHp2AnQeHIgtDSNr8aRqZGurQ38nXSInmjCkt89B/D+ 57U5V0rVewA/90aZ3/YsgonSzA0RbWplIO3KMK46MDSA3v3tP91TCEwmAbkFWB2wvk a8qTIUUMxiB0XlGip6ceFwoFQIOUqXWEbs/scbzw= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 30 Apr 2019 17:45:00 +0800 From: Yibo Zhao To: =?UTF-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= Cc: make-wifi-fast@lists.bufferbloat.net, linux-wireless@vger.kernel.org, Felix Fietkau , Rajkumar Manoharan , Kan Yan , linux-wireless-owner@vger.kernel.org Subject: Re: [RFC/RFT] mac80211: Switch to a virtual time-based airtime scheduler In-Reply-To: <87bm10ped0.fsf@toke.dk> References: <20190215170512.31512-1-toke@redhat.com> <753b328855b85f960ceaf974194a7506@codeaurora.org> <87ftqy41ea.fsf@toke.dk> <877ec2ykrh.fsf@toke.dk> <89d32174b282006c8d4e7614657171be@codeaurora.org> <87a7gyw3cu.fsf@toke.dk> <73077ba7cda566d5eeb2395978b3524c@codeaurora.org> <877ec0u6mu.fsf@toke.dk> <76591d2924d7b6fec06d0df07247166a@codeaurora.org> <87bm10ped0.fsf@toke.dk> Message-ID: X-Sender: yiboz@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2019-04-21 05:15, Toke Høiland-Jørgensen wrote: > Yibo Zhao writes: > >> On 2019-04-11 19:24, Toke Høiland-Jørgensen wrote: >>> Yibo Zhao writes: >>> >>>> On 2019-04-10 18:40, Toke Høiland-Jørgensen wrote: >>>>> Yibo Zhao writes: >>>>> >>>>>> On 2019-04-10 04:41, Toke Høiland-Jørgensen wrote: >>>>>>> Yibo Zhao writes: >>>>>>> >>>>>>>> On 2019-04-04 16:31, Toke Høiland-Jørgensen wrote: >>>>>>>>> Yibo Zhao writes: >>>>>>>>> >>>>>>>>>> On 2019-02-16 01:05, Toke Høiland-Jørgensen wrote: >>>>>>>>>>> This switches the airtime scheduler in mac80211 to use a >>>>>>>>>>> virtual >>>>>>>>>>> time-based >>>>>>>>>>> scheduler instead of the round-robin scheduler used before. >>>>>>>>>>> This >>>>>>>>>>> has >>>>>>>>>>> a >>>>>>>>>>> couple of advantages: >>>>>>>>>>> >>>>>>>>>>> - No need to sync up the round-robin scheduler in >>>>>>>>>>> firmware/hardware >>>>>>>>>>> with >>>>>>>>>>> the round-robin airtime scheduler. >>>>>>>>>>> >>>>>>>>>>> - If several stations are eligible for transmission we can >>>>>>>>>>> schedule >>>>>>>>>>> both of >>>>>>>>>>> them; no need to hard-block the scheduling rotation until >>>>>>>>>>> the >>>>>>>>>>> head >>>>>>>>>>> of >>>>>>>>>>> the >>>>>>>>>>> queue has used up its quantum. >>>>>>>>>>> >>>>>>>>>>> - The check of whether a station is eligible for transmission >>>>>>>>>>> becomes >>>>>>>>>>> simpler (in ieee80211_txq_may_transmit()). >>>>>>>>>>> >>>>>>>>>>> The drawback is that scheduling becomes slightly more >>>>>>>>>>> expensive, >>>>>>>>>>> as >>>>>>>>>>> we >>>>>>>>>>> need >>>>>>>>>>> to maintain an rbtree of TXQs sorted by virtual time. This >>>>>>>>>>> means >>>>>>>>>>> that >>>>>>>>>>> ieee80211_register_airtime() becomes O(logN) in the number of >>>>>>>>>>> currently >>>>>>>>>>> scheduled TXQs. However, hopefully this number rarely grows >>>>>>>>>>> too >>>>>>>>>>> big >>>>>>>>>>> (it's >>>>>>>>>>> only TXQs currently backlogged, not all associated stations), >>>>>>>>>>> so >>>>>>>>>>> it >>>>>>>>>>> shouldn't be too big of an issue. >>>>>>>>>>> >>>>>>>>>>> @@ -1831,18 +1830,32 @@ void >>>>>>>>>>> ieee80211_sta_register_airtime(struct >>>>>>>>>>> ieee80211_sta *pubsta, u8 tid, >>>>>>>>>>> { >>>>>>>>>>> struct sta_info *sta = container_of(pubsta, struct >>>>>>>>>>> sta_info, >>>>>>>>>>> sta); >>>>>>>>>>> struct ieee80211_local *local = sta->sdata->local; >>>>>>>>>>> + struct ieee80211_txq *txq = sta->sta.txq[tid]; >>>>>>>>>>> u8 ac = ieee80211_ac_from_tid(tid); >>>>>>>>>>> - u32 airtime = 0; >>>>>>>>>>> + u64 airtime = 0, weight_sum; >>>>>>>>>>> + >>>>>>>>>>> + if (!txq) >>>>>>>>>>> + return; >>>>>>>>>>> >>>>>>>>>>> if (sta->local->airtime_flags & AIRTIME_USE_TX) >>>>>>>>>>> airtime += tx_airtime; >>>>>>>>>>> if (sta->local->airtime_flags & AIRTIME_USE_RX) >>>>>>>>>>> airtime += rx_airtime; >>>>>>>>>>> >>>>>>>>>>> + /* Weights scale so the unit weight is 256 */ >>>>>>>>>>> + airtime <<= 8; >>>>>>>>>>> + >>>>>>>>>>> spin_lock_bh(&local->active_txq_lock[ac]); >>>>>>>>>>> + >>>>>>>>>>> sta->airtime[ac].tx_airtime += tx_airtime; >>>>>>>>>>> sta->airtime[ac].rx_airtime += rx_airtime; >>>>>>>>>>> - sta->airtime[ac].deficit -= airtime; >>>>>>>>>>> + >>>>>>>>>>> + weight_sum = local->airtime_weight_sum[ac] ?: >>>>>>>>>>> sta->airtime_weight; >>>>>>>>>>> + >>>>>>>>>>> + local->airtime_v_t[ac] += airtime / weight_sum; >> Hi Toke, >> >> I was porting this version of ATF design to my ath10k platform and >> found >> my old kernel version not supporting 64bit division. I'm wondering if >> it >> is necessary to use u64 for airtime and weight_sum here though I can >> find a solution for it. I think u32 might be enough. For airtime, >> u32_max / 256 = 7182219 us(718 ms). As for weight_sum, u32_max / 8092 >> us >> = 130490, meaning we can support more than 130000 nodes with airtime >> weight 8092 us. > > As Felix said, we don't really want divides in the fast path at all. > And > since the divisors are constant, we should be able to just pre-compute > reciprocals and turn the whole thing into multiplications... > >> Another finding was when I configured two 11ac STAs with different >> airtime weight, such as 256 and 1024 meaning ratio is 1:4, the >> throughput ratio was not roughly matching the ratio. Could you please >> share your results? I am not sure if it is due to platform difference. > > Hmm, I tested them with ath9k where things seemed to work equivalently > to the DRR. Are you testing the same hardware with that? Would be a > good > baseline. > > I am on vacation until the end of the month, but can share my actual > test results once I get back... Hi Toke, I saw your commit in hostapd in http://patchwork.ozlabs.org/patch/1059334/ For dynamic and limit mode described in above hostapd patch, do I need to change any code in this kernel patch or any other patches am I missing? After a quick look at the hostapd patch, I guess all the efforts for both modes are done in hostapd. Correct me if I am wrong. :) > > -Toke -- Yibo