Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp927040ybs; Mon, 25 May 2020 02:47:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfeNQ8aQifuLPqbgo0FdTDxWepOofDZiSQcMqeeFU2wYFK239fZ2AsA13Oj9KVy0CofWXb X-Received: by 2002:a17:906:4d45:: with SMTP id b5mr17486252ejv.146.1590400071352; Mon, 25 May 2020 02:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590400071; cv=none; d=google.com; s=arc-20160816; b=LUP0mBUoh75QGh8sM0LFLEaTwe6aTDeluuKiv0mYJXVN2Bmf9CIuLBg46RDm7a9FWe bWe05iCGsBY///T3/6qenLGPggB0vqwbccz/LbTovm9rSf2qDg9X+FZwm36SBeI3gsF9 E7i4kOp0SKUTefqCl5fRiWgqb5RFALMl34usXA8PMuBQJBNzr9vEv5yehkIuqaVmq+XI xPkfImCcvQubg6KL3JUezKTBlRLMPRhzlY7+HmN8ynLY8r6hwBJMKtpcb5HAJ+HL3qDp zzdrXXO+zSc4adwOUfqyaF+S3E1nu0sOLcYjSWCrx44ywOcug7ShsRlP5qisKNQZwYeb GJ+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=Ov5WsEmMj5Pyk9Nl6NENDz1IXt6yPtaCxoaDkO7bjV4=; b=oHmXLg0J66w/7IHnZs9Q/pZx/n97yELl0GO1XFEf/uJiT/lZj8CByjWT3YbYNgTdph fhj2vbEjm0My2iVe6r4ObSbUlTMQX21Jt04QJvbNy9M5+cX/RUqoh1Rgx1atIkrMioDK T4YwzRgHUB/S9Q18msk+g7/BeWU9InnedIDlCkr5d4lr68ah7r1D79aetTiYjBZoLc4U 9m/86HGOTN5fh+V5fGEdIS/dMQmjXH0XgzAoQfTm0h3EcW8mq+UhIA15CpHNvPd74wG0 UCSxemRSvYnRNElYWZn7QNnh02Z76FjVuwsrUHCEy12p1ARx9jQXQc1sF7Lh6L0L0bJI EYqg== 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 m25si9897043edj.212.2020.05.25.02.47.28; Mon, 25 May 2020 02:47:51 -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 S2389613AbgEYJrF (ORCPT + 99 others); Mon, 25 May 2020 05:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389590AbgEYJrF (ORCPT ); Mon, 25 May 2020 05:47:05 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E07C061A0E for ; Mon, 25 May 2020 02:47:04 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1jd9hG-002cLh-JB; Mon, 25 May 2020 11:47:02 +0200 Message-ID: Subject: Re: Regarding .wake_tx_queue() model From: Johannes Berg To: Maxime Bizon , Toke =?ISO-8859-1?Q?H=F8iland-J=F8rgensen?= Cc: linux-wireless@vger.kernel.org Date: Mon, 25 May 2020 11:47:01 +0200 In-Reply-To: <20200505152010.GA33304@sakura> (sfid-20200505_172027_527369_0A123F8C) References: <20200504193959.GC26805@sakura> <878si6oabp.fsf@toke.dk> <20200505131531.GA32619@sakura> <87368eo5dn.fsf@toke.dk> <20200505152010.GA33304@sakura> (sfid-20200505_172027_527369_0A123F8C) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.2 (3.36.2-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, 2020-05-05 at 17:20 +0200, Maxime Bizon wrote: > > > 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: This stuff is a mess. I had a plan once to just rip it all out and combine it all with the TXQs, but not only is it hard to test, we've also offloaded this stuff to the firmware for our devices, so motivation is pretty low. > 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 ? I really don't know, off the top of my head, sorry. johannes