From patchwork Fri Oct 15 13:17:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 515853 Delivered-To: patch@linaro.org Received: by 2002:adf:a11e:0:0:0:0:0 with SMTP id o30csp544100wro; Fri, 15 Oct 2021 06:15:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxG1vrQJhk3L6fKibe58HYe+I1oyFxKU/66HQ+NU+r3SqPmWy0YDtDoC/bULB9JgVY+Dgnu X-Received: by 2002:a4a:9682:: with SMTP id s2mr8952542ooi.29.1634303754583; Fri, 15 Oct 2021 06:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634303754; cv=none; d=google.com; s=arc-20160816; b=tP+5Fj4RThoT4czAtqNpsGCXPWJtz8eNgKytDpVgQda8HZna+Qm1XB0W2XxMOZUYHB l9EOYg0AQYocNXBoWKU8+SCQhlB4Ya+vYdCik9ZUwk8QqM/LU4E3OoOSBugzlkpC5ZBO R3ehkq6cdBK7U5J5ZUzAuU8ByXNeReZ0Yo0dpnXmIiBtACcDoBkUtXDrY6dFkoFMcoJE Nbx21R9Q6imIoLfB2LR9hxDH3Qe2ZxMROpmjoanBRyxn1MgahuaRqJpOvC5buqJKMZMG +Noa74x52CiKUb/E10rJN/sfQx0eyTyTCuRsL3ckTdTbeKYbfVkPDQeXToi8sQMEXrAP xeXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=bl6TqWcH92/JzmAF51qY364rFbxmLerpRDRLzaddYTI=; b=ig2LyqFHdjUx/9TNr493R7wPl8xg92cltjT1S1cNWXs7PSQrMDoQ2ulcxTABOWDHqt puK4J9pNCQPs7okNJT1RnrV51hq8EN4wTc91EXj1GVwBVlraEugwjE92S8sAOBB9vIDg 2qF/N87RziOlo5LRunlIh9fjF79n36K/hTzW3fEvq5BhOrdrVZdSkJEisaSUTLtSIT4g aODeAViuUpPha4w4sj5PXYt4qydUBk/DXkRbdQjnCqn0o79dOBp5DyEfY981onpHMTVS jUNJe5uF3195lASWmbdEMp/zY4IhqzSvmKz2vK2r8A3ka9HrvEyFiHJvfIIrzJC9L2DQ 7nmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=SVkOXgCW; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="jqaE/kml"; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="wcn36xx-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id e18si7525345oii.311.2021.10.15.06.15.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 06:15:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=SVkOXgCW; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="jqaE/kml"; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="wcn36xx-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bl6TqWcH92/JzmAF51qY364rFbxmLerpRDRLzaddYTI=; b=SVkOXgCW42jUED /fv6lMF3LOAH7jq0NjcNpbffUzPrZNYhm8wWXQmZMXVM7Ys2eeHeDKqHF0Vv8y+tBDJlmoWKwxkqs LZ3SxxZk4h3JUPS9+1ljbHqOMheeiKgRbjD4u64EGaVmTChxURvgD5hlBFj+IKH6t68j6PoEtOCGW T0+oBTdLLdffBb5lgW+RgSTIYWh7JTbFSFarC5dfu7Ac+bC8Zj/GlmABd5xuEB/3Oa3pgJ3mB9Qh9 YFqr7y4YZQM977XdYdWxMjIja5jamyAAPACosFuRbPGzGF3B1su5Ptv9FGrAILPH6bz8taeKW7/Nm et9KHAZpSd2XlNno+1jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbN3w-007AUQ-Ok; Fri, 15 Oct 2021 13:15:52 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbN3s-007AQv-5p for wcn36xx@lists.infradead.org; Fri, 15 Oct 2021 13:15:51 +0000 Received: by mail-wm1-x332.google.com with SMTP id s198-20020a1ca9cf000000b0030d6986ea9fso2375840wme.1 for ; Fri, 15 Oct 2021 06:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fIgJBzQ+9WDIc4/3t3RLCBc0AqZncO8wqablVL8xJh8=; b=jqaE/kmlauY05WL5q3IpL/c2KwbmXazywzlqydwpMDBsjy0yfw6yWV8uBaFUOKBkLg JtWfMSAgj71dyn2IlLekP4Pgls6z3wWwFNonJ83ZdeNVvxOBoe2zo82MLPxdVGY8U7Ac D4DH92Y4O/PRraOX7Fmibkq6rC6jY3Qi8dbGNVAIx5ns+TRUuk8Iv2Ife3x7KVswvlow Le+j3IGbl6QYpzEmUWwpiQRMFkpnyTTlqdblbjfQGhZVyR0geebtovGoyoeLjVZ0+0pe REykH8HxD2JCYhGDkazOcbG32AVxchDNw2XprlOE1gjelORJ1C1DCsOTWOtnRk4id+vj vA5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fIgJBzQ+9WDIc4/3t3RLCBc0AqZncO8wqablVL8xJh8=; b=akxkmxXzeiQl5KlqEfaiyemZo3pRW9qFJNw8lgKB61BzO8y4tPkOjrPj1O6j7TPr1O d6qi3bx3eC6K/bX9nEix5sKumnEILVOiXIrDS8VsFI+0X+vptYEKdSWWVb7rKaJvy6Qn yk7SpLUZBYj555MDYZw+PZH538burYAQEZGXtfothC2RF7ooWGJvNTpcpObT5Uh+tMH0 lHNp9VQj4IJ3g7UK6eAXjCnMedaOl+49JAe7dm1MZu3sriPYMgv8/GkLOZUrWZoQf+p7 R56//OXd5fOLGtFNKhCN5tKQFdPlhao8DPPe/QjarZHdFbDm4bjKXkpsM0bz4s3RHzcM BPgA== X-Gm-Message-State: AOAM532NO+NG55Q7Nbp61+yxvInPq8CjEa2UuRwHkBXviIoOG3W14KZL 7l2cm30+50e/Xsl7IRGeTS9XOw== X-Received: by 2002:a7b:c1cb:: with SMTP id a11mr25657150wmj.39.1634303745310; Fri, 15 Oct 2021 06:15:45 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id e8sm7091716wrg.48.2021.10.15.06.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 06:15:44 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, linux-wireless@vger.kernel.org, wcn36xx@lists.infradead.org Cc: loic.poulain@linaro.org, benl@squareup.com, daniel.thompson@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH 2/4] wcn36xx: Fix DXE/DMA channel enable/disable cycle Date: Fri, 15 Oct 2021 14:17:39 +0100 Message-Id: <20211015131741.2455824-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211015131741.2455824-1-bryan.odonoghue@linaro.org> References: <20211015131741.2455824-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211015_061548_267957_5C0A09CA X-CRM114-Status: GOOD ( 13.73 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Right now we have a broken sequence where we enable DMA channel interrupts which can be left enabled and never disabled if we hit an error path. Worse still when we stop WCNSS, the DMA channel interrupt bits are left intact. About the only saving grace here is that we do remember to disable the WCNSS interrupt when doing the stop. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:332 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: wcn36xx@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "wcn36xx" Errors-To: wcn36xx-bounces+patch=linaro.org@lists.infradead.org Right now we have a broken sequence where we enable DMA channel interrupts which can be left enabled and never disabled if we hit an error path. Worse still when we stop WCNSS, the DMA channel interrupt bits are left intact. About the only saving grace here is that we do remember to disable the WCNSS interrupt when doing the stop. Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware") Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/dxe.c | 38 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-) -- 2.33.0 _______________________________________________ wcn36xx mailing list wcn36xx@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wcn36xx diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c index 4e898bde1bb8c..13e9a274fa26a 100644 --- a/drivers/net/wireless/ath/wcn36xx/dxe.c +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -272,6 +272,21 @@ static int wcn36xx_dxe_enable_ch_int(struct wcn36xx *wcn, u16 wcn_ch) return 0; } +static void wcn36xx_dxe_disable_ch_int(struct wcn36xx *wcn, u16 wcn_ch) +{ + int reg_data = 0; + + wcn36xx_dxe_read_register(wcn, + WCN36XX_DXE_INT_MASK_REG, + ®_data); + + reg_data &= ~wcn_ch; + + wcn36xx_dxe_write_register(wcn, + WCN36XX_DXE_INT_MASK_REG, + (int)reg_data); +} + static int wcn36xx_dxe_fill_skb(struct device *dev, struct wcn36xx_dxe_ctl *ctl, gfp_t gfp) @@ -892,7 +907,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_WQ_TX_L); wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data); - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); /***************************************/ /* Init descriptors for TX HIGH channel */ @@ -916,9 +930,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data); - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); - /***************************************/ /* Init descriptors for RX LOW channel */ /***************************************/ @@ -928,7 +939,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) goto out_err_rxl_ch; } - /* For RX we need to preallocated buffers */ wcn36xx_dxe_ch_alloc_skb(wcn, &wcn->dxe_rx_l_ch); @@ -951,9 +961,6 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_REG_CTL_RX_L, WCN36XX_DXE_CH_DEFAULT_CTL_RX_L); - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); - /***************************************/ /* Init descriptors for RX HIGH channel */ /***************************************/ @@ -985,15 +992,18 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) WCN36XX_DXE_REG_CTL_RX_H, WCN36XX_DXE_CH_DEFAULT_CTL_RX_H); - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); - ret = wcn36xx_dxe_request_irqs(wcn); if (ret < 0) goto out_err_irq; timer_setup(&wcn->tx_ack_timer, wcn36xx_dxe_tx_timer, 0); + /* Enable channel interrupts */ + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); + return 0; out_err_irq: @@ -1010,6 +1020,12 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn) void wcn36xx_dxe_deinit(struct wcn36xx *wcn) { + /* Disable channel interrupts */ + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); + wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); + free_irq(wcn->tx_irq, wcn); free_irq(wcn->rx_irq, wcn); del_timer(&wcn->tx_ack_timer);