Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3782568ybl; Mon, 27 Jan 2020 10:18:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxkXgGfYaxPytpuZVJqkPGtSRFdho2XG8TAS5yoNkBi0UpurH88xfAtBxcwoQGBhgfv/gwX X-Received: by 2002:a05:6830:1bda:: with SMTP id v26mr13042425ota.314.1580149112117; Mon, 27 Jan 2020 10:18:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580149112; cv=none; d=google.com; s=arc-20160816; b=vT3zhuJ1YeBCUmpXmTWx1oGAl+l07gLKDHt89354IzzSNZcmlBMykn5S2KHIGAdaly M6+gLsPvsgejrZ/Zl/K7E/vIPatSdcZWMYN9HZckNzSI8lGLhlbDIGVofZ2VdUKgCbYY LsPoTowtAL+7Oj7rG1xh3SckUWKcsq/WY1zn/I22r6KRWBeI2KiNg2mZOFWU7361OHc8 VD3rIzD4ezhPdUN62kGFvUwckWbSRCE6Vp2i8cRJ574bh/ayBMFLpxS5gGMpm6MRwhZv TvuLHpvo9z2PJ5KXNNZkHcJE+QeuQJhcs7ZJs0CEjlff8zh3ICu1A0EPVkydISMW93Ls o4MA== 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 :message-id:date:subject:to:from:dkim-signature; bh=eLDODatZtz3DibR6RyYo6On5K5gCqCGQNsdvzDgNKv8=; b=jbIfnzh042Zxx46Fk2da2+egQlsFGEL0J+z33TaxIFrgJTvrJeAGi0Zt3Tx7OfpKaD e0Qa+lQRyuyK9EvV3F5ijl2mTaIrgejMxv1ke4QoTEF6mLhupUsKdL3psn5odHpNOtzN UTtRYxxLgC5gwigEoeGOQ/Y6/JMo+/mfNrlljbKXSclFWobhRfWBZG92WjlQ4tzissku Rn35q351tT7nizwdT8PGLTn4Om7OAaJh5A5atFqllDWw0qKsq8M6g1ena+1UDfpDCS0n UnxnxW++Kyga1jZl+kHBsgvTObTfcz7Z6rDj1lLthNkVca3zvYsyqXrfR/GUzS3440Dx BPRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=BSxxQ24E; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si4002520oih.217.2020.01.27.10.18.18; Mon, 27 Jan 2020 10:18:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=BSxxQ24E; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726921AbgA0SR7 (ORCPT + 99 others); Mon, 27 Jan 2020 13:17:59 -0500 Received: from nbd.name ([46.4.11.11]:48202 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbgA0SR5 (ORCPT ); Mon, 27 Jan 2020 13:17:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject :To:From:Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eLDODatZtz3DibR6RyYo6On5K5gCqCGQNsdvzDgNKv8=; b=BSxxQ24Ec7YP5qyraSgIZ/2gMC ZW8Fq4L4b3CKIVgNgkk+QSUCF2jXSQFOpKHANmlLux8xtv2BoG4MSs8CpDBG0Xk9gmQ8IOW7AY3gV eSkfmUjboEGU9+9OCztxZPA7H9ViQgrbJZPjEORbUXbjZY7fW0AJ3kmh+8PEeFQ0nlxc=; Received: from [178.162.209.132] (helo=maeck.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iw8xP-0007db-Ju for linux-wireless@vger.kernel.org; Mon, 27 Jan 2020 19:17:55 +0100 Received: by maeck.local (Postfix, from userid 501) id 2003D7A566E3; Mon, 27 Jan 2020 19:17:54 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 1/5] mt76: set dma-done flag for flushed descriptors Date: Mon, 27 Jan 2020 19:17:50 +0100 Message-Id: <20200127181754.2810-1-nbd@nbd.name> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Avoids a theoretical corner case where the hardware could try to process a stale descriptor after a watchdog reset Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index 9e03a7871ff4..e69329feed78 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -246,7 +246,9 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush, if (!q->queued) return NULL; - if (!flush && !(q->desc[idx].ctrl & cpu_to_le32(MT_DMA_CTL_DMA_DONE))) + if (flush) + q->desc[idx].ctrl |= cpu_to_le32(MT_DMA_CTL_DMA_DONE); + else if (!(q->desc[idx].ctrl & cpu_to_le32(MT_DMA_CTL_DMA_DONE))) return NULL; q->tail = (q->tail + 1) % q->ndesc; -- 2.24.0