Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2126890pxb; Mon, 12 Apr 2021 15:21:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9f2/7lRQuTeJizl73HrcMMqtmEKORZlhyt+4WbIjrb0Q6VCUSGIQCIoikqey7GzETRvuD X-Received: by 2002:a17:902:7589:b029:e8:c011:1f28 with SMTP id j9-20020a1709027589b02900e8c0111f28mr28063653pll.35.1618266076441; Mon, 12 Apr 2021 15:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618266076; cv=none; d=google.com; s=arc-20160816; b=Lv7CmUQDLyRecfGPO9TAAq4chw2aRZi2W7Am4C4oBWq9GURxFvZ0gyYkJF5qSBFL1q N272o3XqIGW68HPubFsqkuKwSiFig+W5uz87JQR7YuJKusvzRqz7U6VwRSPddZOSO7ln Vm4Ijdn5eXKDsSkhqM666KdcLA3aKhkcWiWZdyCKfhz5EYyDrs3o45H/0f8xbt2ZJvSy +1NT7NpET1YptvRgWzdj2L4ckAeGL07Iiesh6ejoxsZ0c2xk+o23RGSmmEOBUNVByZiG bMcj79MAKKn1h4Wpdl/NTfw/+ZOBnsmzoJWZx0azNxuztD2zy7Qd+HiBl+kBN6nLhNQf Ojag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U1p4c7QdxGdvHJDywj4AlBOmgFvJ1LPtozX5qXg4P+o=; b=O+7Zw7wvGaZWooXcby5IZ7/V8x0QrnRUXchLrrZV4oTLdR2rZalNPnbM7KfgIFj0Hj T4eadMgNWfw98Yd3ExU9G+YDmcNmiVapNuI+RJhcmCa3nvG4p1hIYIllQTjsvEkVPH+G GqJtFcdv4FTKDzYZnejG7f8xAptSEZCtCSXqyojTNtLtBAG7DLzf1LiEGYjbAYyC2se2 BY6cRbPrMIT6PA7iowMELYLI04AALXQL2FFxxBMdRJRsRSfpIEmJEttKXG7o6QhvI/s1 3PejnJPAUhfkUXD758n1IafIOV/tuIh0GSfVMBiQMy0yIQZPux27842H5pOrqCl3mLzv +NtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y8LyWw4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si8533621pfc.16.2021.04.12.15.21.02; Mon, 12 Apr 2021 15:21:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y8LyWw4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242308AbhDLJ2N (ORCPT + 99 others); Mon, 12 Apr 2021 05:28:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:57182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239959AbhDLJEO (ORCPT ); Mon, 12 Apr 2021 05:04:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A6C546125F; Mon, 12 Apr 2021 09:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218109; bh=pvq29ehwiw1el+BH46uOAN2FjF35TIZooBak9YNdEj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y8LyWw4h7Q2rTFZDBydXTBC9Yf2WjNhdQE9n6Hrt8+5H/6GZd3KcM7msZXpRtmVb/ A7NOSbabFRVTJe439Vyx5WY5I5UR2QtfKs2ZPWg4G9s/Vf8WA8DLNkSKZ5583hZzVs ZncngmIoZCzNdQLFIXcGyDn6DvSH9bvFtPpjdr1k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Johannes Berg Subject: [PATCH 5.11 074/210] mac80211: fix TXQ AC confusion Date: Mon, 12 Apr 2021 10:39:39 +0200 Message-Id: <20210412084018.489822201@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg commit 1153a74768a9212daadbb50767aa400bc6a0c9b0 upstream. Normally, TXQs have txq->tid = tid; txq->ac = ieee80211_ac_from_tid(tid); However, the special management TXQ actually has txq->tid = IEEE80211_NUM_TIDS; // 16 txq->ac = IEEE80211_AC_VO; This makes sense, but ieee80211_ac_from_tid(16) is the same as ieee80211_ac_from_tid(0) which is just IEEE80211_AC_BE. Now, normally this is fine. However, if the netdev queues were stopped, then the code in ieee80211_tx_dequeue() will propagate the stop from the interface (vif->txqs_stopped[]) if the AC 2 (ieee80211_ac_from_tid(txq->tid)) is marked as stopped. On wake, however, __ieee80211_wake_txqs() will wake the TXQ if AC 0 (txq->ac) is woken up. If a driver stops all queues with ieee80211_stop_tx_queues() and then wakes them again with ieee80211_wake_tx_queues(), the ieee80211_wake_txqs() tasklet will run to resync queue and TXQ state. If all queues were woken, then what'll happen is that _ieee80211_wake_txqs() will run in order of HW queues 0-3, typically (and certainly for iwlwifi) corresponding to ACs 0-3, so it'll call __ieee80211_wake_txqs() for each AC in order 0-3. When __ieee80211_wake_txqs() is called for AC 0 (VO) that'll wake up the management TXQ (remember its tid is 16), and the driver's wake_tx_queue() will be called. That tries to get a frame, which will immediately *stop* the TXQ again, because now we check against AC 2, and AC 2 hasn't yet been marked as woken up again in sdata->vif.txqs_stopped[] since we're only in the __ieee80211_wake_txqs() call for AC 0. Thus, the management TXQ will never be started again. Fix this by checking txq->ac directly instead of calculating the AC as ieee80211_ac_from_tid(txq->tid). Fixes: adf8ed01e4fd ("mac80211: add an optional TXQ for other PS-buffered frames") Acked-by: Toke Høiland-Jørgensen Link: https://lore.kernel.org/r/20210323210500.bf4d50afea4a.I136ffde910486301f8818f5442e3c9bf8670a9c4@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3578,7 +3578,7 @@ begin: test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) goto out; - if (vif->txqs_stopped[ieee80211_ac_from_tid(txq->tid)]) { + if (vif->txqs_stopped[txq->ac]) { set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); goto out; }