From patchwork Sun Dec 31 05:03:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 184089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp3370164dyb; Sat, 30 Dec 2023 21:05:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmcVFXSQMzL8JeSFYZ17QF791hrMtPiuVj8B0s+EmYDqXTcwcOkG+Z8XZb7BpdeVfHX4Gt X-Received: by 2002:a05:6808:448e:b0:3bb:c657:f5a4 with SMTP id eq14-20020a056808448e00b003bbc657f5a4mr10462237oib.114.1703999105908; Sat, 30 Dec 2023 21:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703999105; cv=none; d=google.com; s=arc-20160816; b=UY/HzUwoXIbxPGlP7ZYLa1+E0FSprkGxWM3rx3ttnH12b2YThtDGt9lay1m39z3b00 RjDJXoAIHEfHikWLu1sPEW+CB4H+hVpQXDIz8fRcPCDynIBvNZl9QmaRisQ4pwfcfc1P L6tWpGJWu+658aTdoeaUO0ibknBtgoE4RHgU6bE/NbLaqkJlOxa4+EQp4U68WbXaw+v9 KF85BCG7O/l67YmLiZ0DK7UsiN2uPN7rUXGmWDEfd5E6jWC767ChyxZYbvcyDX8XMcqG ev+jebJm6EH9g/C8x86Vjkzfu5TZNdqoidypBzl5b2fMmF5M3q2rVcMmMfMEKIRQ1fCM FJ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=NmMPrf58wJ+F6E+Z9exyRV+1aoIrZhkWoXl0KSFnTL8=; fh=PsnbK8gZ4eZSiF/O9d5dpgr6CuL/1pz8cu0fjhqYkzQ=; b=uL18jAm+kl8aslaDY4Vs1EfQB2BNoGSIOYsczqQp+XIvKYP+2fj/j4uofgJUaK4Ac1 c4dJjVd/j03G8jx+gyzjQzlpBrxsebsiwgdJs1BozXb0ShCibzebHuZuVv6b17IWbqdQ VQ3MK3ByiXFNv+U9FByjyCbQNBDY8H0joaV3ODO1mmKVG++2ZggVodqLbDNb/YjKU+uj RSPubFfQU6NYIvBo9/afFkfpU+RJnrO1d2Ivm6iLaba+PhlrlN5pMSp60y1oJDyEhPF/ EKEzVKCMM/H+pExUPIGebsGLoebVZc60/1w8ezmNdPHJ6Wo2km47GZuFIPNsEnbaVoJ5 aVVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=d53RqzNm; spf=pass (google.com: domain of linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e1-20020a17090301c100b001d0cc15ffddsi17254871plh.154.2023.12.30.21.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 21:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=d53RqzNm; spf=pass (google.com: domain of linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C9810283168 for ; Sun, 31 Dec 2023 05:04:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6281A930; Sun, 31 Dec 2023 05:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="d53RqzNm" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C30BB8C19 for ; Sun, 31 Dec 2023 05:04:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=protonmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1703999044; x=1704258244; bh=NmMPrf58wJ+F6E+Z9exyRV+1aoIrZhkWoXl0KSFnTL8=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=d53RqzNmwVXdT0sdMUyczQg3vCLBYpudkcdSeDv2z9O8kr5RRNoxoeSN0wIM4Wu55 s0Mjy/VXwTgV9ZdLes4EFNC5/6uoqz4A3RX20LoSHmj7TkfWfJa1WJPjA1guCSQQzR Tr+4bt6qNyftRGhw+9+ZKoi9/N2UilHADgG+vRVTovZpIe8PvQYTlTWK+atiMf8LFb 5NIJbjbGjhJ0J4D1uDbMFw2Vuov+d081qOkg8FaZIj4lUpQY604ePhQqG6em1T1+yz 26U/ebp18KHovz6W0yN8gSiq3t6P2ZfabKCChawC5WOC3qmhaofHeQG6X2tUEZpJfS R4LwqPKYCoi/w== Date: Sun, 31 Dec 2023 05:03:51 +0000 To: Kalle Valo , Larry Finger , =?utf-8?q?Michael_B=C3=BCsch?= , Julian Calaby From: Rahul Rameshbabu Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, linux-kernel@vger.kernel.org, Rahul Rameshbabu Subject: [PATCH wireless v2 3/4] wifi: b43: Stop correct queue in DMA worker when QoS is disabled Message-ID: <20231231050300.122806-4-sergeantsagara@protonmail.com> In-Reply-To: <20231231050300.122806-1-sergeantsagara@protonmail.com> References: <20231231050300.122806-1-sergeantsagara@protonmail.com> Feedback-ID: 26003777:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786772566583442857 X-GMAIL-MSGID: 1786772566583442857 When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop queue 0 when QoS is disabled to prevent trying to stop a non-existent queue and failing to stop the actual queue instantiated. Fixes: bad691946966 ("b43: avoid packet losses in the dma worker code.") Signed-off-by: Rahul Rameshbabu Reviewed-by: Julian Calaby --- Notes: Changes: v1->v2: - Refactored logic with helpers (suggested by Larry Finger ) Issue Details: When QoS was first introduced to the b43 driver in commit e6f5b934fba8 ("b43: Add QOS support"), four rings were allocated for different QoS priorities for video, voice, best effort, and background. The core networking stack maps these priorities in the skb, and these mappings are noted in the ring's queue_prio member. When disabling QoS in the driver, the skb will still contain the mapping for the core stack while only one queue is actually considered active (the best effort queue). In the situation that QoS is disabled, b43 needs to pass 0 to ieee80211 queue functions since the number of queues is set to 1 in the struct ieee80211_hw queues member. This issue was then extended to the changes in commit bad691946966 ("b43: avoid packet losses in the dma worker code."). drivers/net/wireless/broadcom/b43/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c index 92ca0b2ca286..97d8bdeaa06c 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c @@ -3603,7 +3603,7 @@ static void b43_tx_work(struct work_struct *work) err = b43_dma_tx(dev, skb); if (err == -ENOSPC) { wl->tx_queue_stopped[queue_num] = true; - ieee80211_stop_queue(wl->hw, queue_num); + b43_stop_queue(dev, queue_num); skb_queue_head(&wl->tx_queue[queue_num], skb); break; } @@ -3627,6 +3627,7 @@ static void b43_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { struct b43_wl *wl = hw_to_b43_wl(hw); + u16 skb_queue_mapping; if (unlikely(skb->len < 2 + 2 + 6)) { /* Too short, this can't be a valid frame. */ @@ -3635,12 +3636,12 @@ static void b43_op_tx(struct ieee80211_hw *hw, } B43_WARN_ON(skb_shinfo(skb)->nr_frags); - skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb); - if (!wl->tx_queue_stopped[skb->queue_mapping]) { + skb_queue_mapping = skb_get_queue_mapping(skb); + skb_queue_tail(&wl->tx_queue[skb_queue_mapping], skb); + if (!wl->tx_queue_stopped[skb_queue_mapping]) ieee80211_queue_work(wl->hw, &wl->tx_work); - } else { - ieee80211_stop_queue(wl->hw, skb->queue_mapping); - } + else + b43_stop_queue(wl->current_dev, skb_queue_mapping); } static void b43_qos_params_upload(struct b43_wldev *dev,