From patchwork Mon Jan 27 18:17:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 216578 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E117C33CB7 for ; Mon, 27 Jan 2020 18:18:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 482D022527 for ; Mon, 27 Jan 2020 18:18:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="BSxxQ24E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727107AbgA0SR7 (ORCPT ); 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 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; From patchwork Mon Jan 27 18:17:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 216576 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.4 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FUZZY_XPILL, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29897C35249 for ; Mon, 27 Jan 2020 18:18:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED8F7214AF for ; Mon, 27 Jan 2020 18:18:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="iwT7BlFo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727177AbgA0SSB (ORCPT ); Mon, 27 Jan 2020 13:18:01 -0500 Received: from nbd.name ([46.4.11.11]:48210 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727046AbgA0SR5 (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:References:In-Reply-To: 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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JbYyoO3rivGUAtL9BlROcTesawaWNKeIr03/mn5nGnI=; b=iwT7BlFojv5pJkV66zhNM+ExDJ TuZIkNAi5Z3M4QjsT3WWTzdWrL6lvc53VB3H/EEMHwI9jyogZ/6HWfoDU3L5/Vtz/XsmxGKB+wxHZ JVoY/bWEFXTV8+9Ie8IJyZmgA1Kg4WOGapsXaGWyGlAK/Sa5HofSLgOUHFs5wC5XteCY=; 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-0007dd-KD for linux-wireless@vger.kernel.org; Mon, 27 Jan 2020 19:17:55 +0100 Received: by maeck.local (Postfix, from userid 501) id 20C017A566E5; Mon, 27 Jan 2020 19:17:54 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 3/5] mt76: dma: do not write cpu_idx on rx queue reset until after refill Date: Mon, 27 Jan 2020 19:17:52 +0100 Message-Id: <20200127181754.2810-3-nbd@nbd.name> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200127181754.2810-1-nbd@nbd.name> References: <20200127181754.2810-1-nbd@nbd.name> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The hardware should only start processing the ring after at least one buffer has been added Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/dma.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index bcb11bb9aeeb..e5dd7080e88e 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -132,6 +132,11 @@ mt76_dma_sync_idx(struct mt76_dev *dev, struct mt76_queue *q) writel(q->ndesc, &q->regs->ring_size); q->head = readl(&q->regs->dma_idx); q->tail = q->head; +} + +static void +mt76_dma_kick_queue(struct mt76_dev *dev, struct mt76_queue *q) +{ writel(q->head, &q->regs->cpu_idx); } @@ -193,8 +198,10 @@ mt76_dma_tx_cleanup(struct mt76_dev *dev, enum mt76_txq_id qid, bool flush) dev->q_tx[__MT_TXQ_MAX + i].swq_queued -= n_swq_queued[4 + i]; } - if (flush) + if (flush) { mt76_dma_sync_idx(dev, q); + mt76_dma_kick_queue(dev, q); + } wake = wake && q->stopped && qid < IEEE80211_NUM_ACS && q->queued < q->ndesc - 8; @@ -257,12 +264,6 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush, return mt76_dma_get_buf(dev, q, idx, len, info, more); } -static void -mt76_dma_kick_queue(struct mt76_dev *dev, struct mt76_queue *q) -{ - writel(q->head, &q->regs->cpu_idx); -} - static int mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, enum mt76_txq_id qid, struct sk_buff *skb, u32 tx_info) From patchwork Mon Jan 27 18:17:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 216577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2AE7C33CB1 for ; Mon, 27 Jan 2020 18:18:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73196214AF for ; Mon, 27 Jan 2020 18:18:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="W97+DLU4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727093AbgA0SR6 (ORCPT ); Mon, 27 Jan 2020 13:17:58 -0500 Received: from nbd.name ([46.4.11.11]:48206 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726922AbgA0SR5 (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:References:In-Reply-To: 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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3zhUoqc2bbhf/giTsJ3p839W3UHaOtAacnpPL3Avbbw=; b=W97+DLU4GheBgiJw/QBdCUMviP iF6p73cwlxBO+NiEz+1AAoPIdiFq3vV/XX7ToHtLQHxCHMFDotaxqkB2CaZWFehYQ+Ln3CATQGmEh qHLcyZY8APs2NUnDThoEIPBw0r7G3hbbTywzecfegR3GbBj1rnV95B0PeA62fU2CR2wk=; 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-0007da-Ju for linux-wireless@vger.kernel.org; Mon, 27 Jan 2020 19:17:55 +0100 Received: by maeck.local (Postfix, from userid 501) id 1A70F7A566E2; Mon, 27 Jan 2020 19:17:54 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 5/5] mt76: enable Airtime Queue Limit support Date: Mon, 27 Jan 2020 19:17:54 +0100 Message-Id: <20200127181754.2810-5-nbd@nbd.name> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200127181754.2810-1-nbd@nbd.name> References: <20200127181754.2810-1-nbd@nbd.name> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org It is supported by all drivers Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 9947e627318b..2a85e0cb5793 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -283,6 +283,7 @@ mt76_phy_init(struct mt76_dev *dev, struct ieee80211_hw *hw) wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS); + wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_AQL); wiphy->available_antennas_tx = dev->phy.antenna_mask; wiphy->available_antennas_rx = dev->phy.antenna_mask;