Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp15343836rwb; Mon, 28 Nov 2022 10:26:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf6u4xetS+Pg2fG70JQGv+p/bnyDlW6ijjP9QjZw+/gENSwRgR65qv4mM4e5bwZOTDesGdhY X-Received: by 2002:a17:907:138d:b0:7bc:2ad:fae with SMTP id vs13-20020a170907138d00b007bc02ad0faemr17786190ejb.724.1669659976739; Mon, 28 Nov 2022 10:26:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669659976; cv=none; d=google.com; s=arc-20160816; b=X0LpOq35aU7Lhyagfc26F2AMEUhdRkOO/uZ15RVYs1VWaKH68ZWSP+ccsK40QP+Qlr qnX9bRpsqoc1bK9w2QT1XipiTl0l93n+FJWJphVyjJs+LFzQ1eUvwgAUlldQZmo/koed ngvxeogiMPRAh+64A+jER/Uigk6ndKHP2Il4CJ+R397hy+tOnQtG3fVyBM+MNrSDYHuO ESM8oZbGUn/Vzq/rI/ZNUoE2q0K8YdDqTmCQMQC/wHQCBTwLUcNvSbKAZIEUaK36iA40 UoBcxiadu3fb5u4FRwiw4sDfjDR9LjFoma3rTWzpqlpclwoF0QsCaD6SshKrWZtPfhQn uUKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:dkim-signature:message-id; bh=iQjgcLkotlPVzWC86ae7Xvzk6Ar+icWSIs/+CyDaggA=; b=kBO+mwRpGHdVQZwj2OZngtqJLLRDWY/Rkfm+Q8eBleZxx7XMhnLPUvMCckC1Pyld/M VTDnh+Wzd12upkZB0oOLegeioWTLzPU9wSh27++34D+vki6z4TWyf6tfUnU7QBp1BGlY gXLMBhbMJ1yYO6A78ybqpnz2gsuEnJ2c97rRGffNv2vaqTvY00Sa5FY74DL7FycaEHEg uzTItG2oX0jSyBGDWUIru1jxb9NoXsfPzlKiW94okyZXMOSxvQgsZvJmhzTx3L8SSvTe 8xac2f01zaKAQ9f28GqHXImKCLNjQ6LiA/F0ICYgHGPlySK5IDxH06PzgBnXprVJ76g7 Hp1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wetzel-home.de header.s=wetzel-home header.b=OvJpIvlR; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wetzel-home.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020a056402079700b0046b62140386si1112307edy.576.2022.11.28.10.25.56; Mon, 28 Nov 2022 10:26:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wetzel-home.de header.s=wetzel-home header.b=OvJpIvlR; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wetzel-home.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234292AbiK1SZf (ORCPT + 67 others); Mon, 28 Nov 2022 13:25:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232802AbiK1SZT (ORCPT ); Mon, 28 Nov 2022 13:25:19 -0500 Received: from ns2.wdyn.eu (ns2.wdyn.eu [5.252.227.236]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FD6B27DCA for ; Mon, 28 Nov 2022 10:17:00 -0800 (PST) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wetzel-home.de; s=wetzel-home; t=1669659417; bh=SRT0r2JOkkslUrmOSM/VMzWr46m5s0bBUXYBodLsGAg=; h=Date:From:Subject:To:Cc:References:In-Reply-To; b=OvJpIvlRp0oBMZDydnZkfd3UrgXCXONvY98FPg3f9qtOIWn9h4hCcKDwZ+LIptyi+ DhloP4fLDelqxBkrdsNiJVZGG7hVXZiMBFFgRspQuUgq7JvkbL23HFJEAjIpgjBNjB v7MP8jSS2AQrUA1g9gvOQM9XJGPiKdTR1r5dTWqw= Date: Mon, 28 Nov 2022 19:16:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 From: Alexander Wetzel Subject: Re: [PATCH v2] wifi: mac80211: integrate PS buffering into iTXQ To: linux-wireless@vger.kernel.org Cc: Johannes Berg References: <20221102184005.10649-1-alexander@wetzel-home.de> Content-Language: en-US In-Reply-To: <20221102184005.10649-1-alexander@wetzel-home.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org > @@ -1579,16 +1561,39 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) > tmp = skb_queue_len(&pending); > filtered += tmp - count; > count = tmp; > - > - spin_lock_irqsave(&sta->ps_tx_buf[ac].lock, flags); > - skb_queue_splice_tail_init(&sta->ps_tx_buf[ac], &pending); > - spin_unlock_irqrestore(&sta->ps_tx_buf[ac].lock, flags); > - tmp = skb_queue_len(&pending); > - buffered += tmp - count; > } > > + skb_queue_head_init(&pending); > ieee80211_add_pending_skbs(local, &pending); > > + for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { > + if (!sta->sta.txq[i]) > + continue; > + > + txqi = to_txq_info(sta->sta.txq[i]); > + clear_bit(IEEE80211_TXQ_STOP_PS, &txqi->flags); > + } > + > + /* Make sure TX path has stopped setting txq_buffered_tids */ > + synchronize_net(); > + We are atomic here and can't sleep. Working on that now, but this gets surprisingly complex fast. Review of the rest is still welcome but this patch must not be merged as it is. It kind of looks like the current (unpatched) code is not only sending out filtered frames after iTXQ but also misses the required rcu_read_lock to be allowed to call schedule_and_wake_txq() in this function when called from drv_deliver_wk()... Alexander