Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp840492ybj; Tue, 5 May 2020 08:21:04 -0700 (PDT) X-Google-Smtp-Source: APiQypLkxc/7ECne3e3z1Dmg7wV+CDwcn8HtdCqrCLJRTLkjsfM6vCMoP/Su28etgXy/5ug3GBTY X-Received: by 2002:a17:906:7f0d:: with SMTP id d13mr3280621ejr.312.1588692063892; Tue, 05 May 2020 08:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588692063; cv=none; d=google.com; s=arc-20160816; b=piFI+GSB5zFlJgBRTLfSmz/k4GX30pPkY7bpLHFwnjVM9dEx1+NtEwv1MbV2MMvH2e Xv/aLh5Ac/MELLX6scrl7Kk47pejtWSWNpng6u8FnNEERzPjY56GYtvccU8qM7EB6A4h 7Olv2khSK7IY0NHBhgg0uTbYNX+dll+5VBszhh2vIYLFsEzSghzmS4anGfE0gI1pfZtE HfN/PLcupUVlTWojOVEYqc9TnjqIfLA9mYaGjdxHn/alsrw4Nqn94WgCuZNgPf+9CV6d e+8sf0sWBTG8CDuRuZ4kn1U9bf+eQYkMP5q6g0hCCPoXz/vgQ9oVcFZz9Pa98yGwb550 p5ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Rdpygo+KVU9zRk5QFsYZwAwCXhoTJtqblNwJHkxgrH0=; b=0ZWrgDIba+XviQf/NrP+H6Fq2a0Ny0QJ62ZkR+/8y5hCXdQIFirCm0r+zLgIC/v5C3 ZHsKLm22LmH87aZLmK9WznSyfdEPYFOZwGyRt3+z3eKoGi6hmpfmLFV/LLRKqH+0lhe5 iKX7LtZrcrLbNiRLFm94q25a7keT73mzVJR3GFObHmGbyaEhTdiwIh7r8CAdyvz/dwlT YxYCl+Vy2NVda7VxItZSdh4RN+73nsnTR1uL4hAgh4AIKkJEhhKTh5a2O5l8/oA7Fq4K gcde8pMh3iaGOFNs2nxd461LaZfKaTQy/dfDim9bvkKi560yxMgiulnyCqP578X4Hd95 j+OQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb14si1285932ejb.80.2020.05.05.08.20.28; Tue, 05 May 2020 08:21:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729946AbgEEPUO (ORCPT + 99 others); Tue, 5 May 2020 11:20:14 -0400 Received: from ns.iliad.fr ([212.27.33.1]:53388 "EHLO ns.iliad.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729301AbgEEPUO (ORCPT ); Tue, 5 May 2020 11:20:14 -0400 Received: from ns.iliad.fr (localhost [127.0.0.1]) by ns.iliad.fr (Postfix) with ESMTP id 5348420404; Tue, 5 May 2020 17:20:11 +0200 (CEST) Received: from sakura (freebox.vlq16.iliad.fr [213.36.7.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ns.iliad.fr (Postfix) with ESMTPS id 474FF20326; Tue, 5 May 2020 17:20:11 +0200 (CEST) Date: Tue, 5 May 2020 17:20:10 +0200 From: Maxime Bizon To: Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= Cc: linux-wireless@vger.kernel.org Subject: Re: Regarding .wake_tx_queue() model Message-ID: <20200505152010.GA33304@sakura> References: <20200504193959.GC26805@sakura> <878si6oabp.fsf@toke.dk> <20200505131531.GA32619@sakura> <87368eo5dn.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87368eo5dn.fsf@toke.dk> User-Agent: Mutt/1.9.4 (2018-02-28) X-Virus-Scanned: ClamAV using ClamSMTP ; ns.iliad.fr ; Tue May 5 17:20:11 2020 +0200 (CEST) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tuesday 05 May 2020 ? 15:53:08 (+0200), Toke H?iland-J?rgensen wrote: > Well, I think that should be fine? Having a longer HW queue is fine, as > long as you have some other logic to not fill it all the time (like the > "max two aggregates" logic I mentioned before). I think this is what > ath9k does too. At least it looks like both drv_tx() and > release_buffered_frames() will just abort (and drop in the former case) > if there is no HW buffer space left. Ok BTW, the "max two aggregates" rule, why is it based on number of frames and not duration ? if you are queing 1500 bytes @1Mbit/s, even one frame is enough, but not so for faster rates. It would be even better if minstrel could limit the total duration when computing number of hardware retries, and then mac80211 could handle software retries for those really slow packets, no hardware FIFO "pollution" > > Also .release_buffered_frames() codepath is difficult to test, how do > > you trigger that reliably ? assuming VIF is an AP, then you need the > > remote STA to go to sleep even though you have traffic waiting for it > > in the txqi. For now I patch the stack to introduce artificial delay. > > > > Since my hardware has a sticky per-STA PS filter with good status > > reporting, I'm considering using ieee80211_sta_block_awake() and only > > unblock STA when all its txqi are empty to get rid of > > .release_buffered_frames() complexity. > > I'm probably not the right person to answer that; never did have a good > grip on the details of PS support. Hopefully Felix or Johannes will see this. Just wondering if there is anything I'm missing, this alternative way of doing looks easier to me because it removes "knowledge" of frame delivery under service period from the driver: 1) first get rid of buffered txq traffic when entering PS: --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -1593,6 +1593,15 @@ static void sta_ps_start(struct sta_info *sta) list_del_init(&txqi->schedule_order); spin_unlock(&local->active_txq_lock[txq->ac]); - if (txq_has_queue(txq)) - set_bit(tid, &sta->txq_buffered_tids); - else - clear_bit(tid, &sta->txq_buffered_tids); + /* transfer txq into tx_filtered frames */ + spin_lock(&fq->lock); + while ((skb = skb_dequeue(&txq->frags))) + skb_queue_tail(&sta->tx_filtered[txq->ac], skb); + /* use something more efficient like fq_tin_reset */ + while ((skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func))) + skb_queue_tail(&sta->tx_filtered[txq->ac], skb); + spin_unlock_bh(&fq->lock); + 2) driver register for STA_NOTIFY_SLEEP 3) driver count tx frames pending in the hardware per STA and sets ieee80211_sta_block_awake(sta, 1) when > 0 4) on tx completion, if STA is sleeping and number of pending tx frames in hardware for a given STA reaches 0: - if driver buffers other frames for this STA, release them with TX_FILTERED in reverse order - calls ieee80211_sta_block_awake(false) what do you think ? > What hardware is it you're writing a driver for, BTW, and are you > planning to upstream it? :) that's a rewrite of the mwl8k driver targeting the same hardware, but with a different firmware interface. if I can bring it on par with the existing set of supported hardware and features, I could try to upstream it yes. -- Maxime