Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2371264rdg; Mon, 16 Oct 2023 02:11:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBLVH7sKOoae5bPBEvzYzKi3jBP9Gn23NVRyHrMGBR59RIMGwvaVwqg3yOef9KS+FownIg X-Received: by 2002:a17:90a:1997:b0:27d:22d7:9787 with SMTP id 23-20020a17090a199700b0027d22d79787mr8486865pji.36.1697447481204; Mon, 16 Oct 2023 02:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697447481; cv=none; d=google.com; s=arc-20160816; b=mOgrpZULPKpYDtHbDvWC6nCeQKpOoX+bE/GU15L1msiHa6OT8MkWdoe04VYl+ZdeeA DmBaEMQ64fdXF/eN9H6zuJHENlwAeQIgxyRMZzBJLYXjB+1igZvnOscD4haad2RFc7sz pNVy0rB2ra+b56OragYSL8g0K6W/+baKivNbrQMAbK0u/9vXmyAPNinSdpz1h8YMwy4R b9P8JlO1TjeikVK1y89IdAq6lLE7BwKqgPpXeA9drQURJxzR1TYcUB7XQAguvLdgybnZ KzYoR5wTS+Hl9kUfc4kprf3uLZnkw13+gozYsKqL63ZOXWx61XEGMTU0JayriRbKlHjK 2f8A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xyc9d4bXHixU6darx/12EVMAT6WiG8Gh2ML+BHGOGBw=; fh=Ku4rpZluzJB+G9vQVPu7qAagHLleNx84zz+BPW6AE7g=; b=ZULs+XmwhOqC5zEkTfbyz03IGDK8Z06CXEpJcL2EZAuI0I+i4TS18cl/mGiQaA174Y +Ld3Il9thPCVis0aolic+xkFd8mCto1gVxRdpwwuHb5eAD7H9iC/yeWn0J8J4XRDGO/S j9Yb5G2rW+5k3wNxfndFwrgAElWZRexymXaqxRdBmtN4KxqM9rJDl2In3GxWrevrR9J2 4O+CZ/xX35EOdcJzH9qs3KTOF17acx2D9kf/T1UAcKtJctwvmP95dTZBcKitJ9FzbT+R 2O/SBc8bxm5f3m8GCTjqqFv9JZ6gGTkgoA4RXL6VYE/yeHA/rkmTxOkd2FXCDeybBLMB oiDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lCnEmTrG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id p18-20020a637412000000b005702257f332si6493613pgc.21.2023.10.16.02.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 02:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lCnEmTrG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2481C802C019; Mon, 16 Oct 2023 02:10:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231995AbjJPJKD (ORCPT + 52 others); Mon, 16 Oct 2023 05:10:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232016AbjJPJKC (ORCPT ); Mon, 16 Oct 2023 05:10:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC989AD for ; Mon, 16 Oct 2023 02:09:59 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E4A0C433C9; Mon, 16 Oct 2023 09:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697447399; bh=5DSCe8D4qsVY/zWY9E6Zp8QX+LyLbr3uDvpEyNMTcvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lCnEmTrGNaYitjjncd9lrybbv2m5e/AK4LJkOGeoKQtBP9wdkJ9w4NXG6qu9Q4w3/ MkuQWARk7RhEECGXxFYn+F8XmlSubXohEgmSFGudKpWz0i4VA0pbFMe7vyTwBtX3IX yP284NNjhwmP/jXNDz9RCbVO4T5f9CERW5J0NBSxOOtWLSDEeLydS47nsqXVGxm9du L1yk89hxz+b6NgNmN2n91qRV+gBh8ts5CQdRqy/qLQHGQj5T8DF32fdOeztsleFhVK DmeK0XME0NtEExM/VevNpayBaaZTcs5OfYvlqwvL5JRFzDc6BeNnfU6cCF9Y4InC4p XwtNy+GeSoNOg== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com, evelyn.tsai@mediatek.com, shayne.chen@mediatek.com, Bo.Jiao@mediatek.com, sujuan.chen@mediatek.com, linux-mediatek@lists.infradead.org Subject: [PATCH v2 04/12] wifi: mt76: introduce mt76_queue_is_wed_tx_free utility routine Date: Mon, 16 Oct 2023 11:03:37 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 02:10:26 -0700 (PDT) This is a preliminary patch to introduce WED support for mt7996 Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/dma.c | 6 +++--- drivers/net/wireless/mediatek/mt76/mt76.h | 6 ++++++ drivers/net/wireless/mediatek/mt76/mt7915/dma.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index 5f31d4d6a640..f1cb78450d99 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -724,7 +724,7 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q, if (ret) return ret; - if (q->flags != MT_WED_Q_TXFREE) + if (!mt76_queue_is_wed_tx_free(q)) mt76_dma_queue_reset(dev, q); return 0; @@ -775,7 +775,7 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid) /* reset WED rx queues */ mt76_dma_wed_setup(dev, q, true); - if (q->flags != MT_WED_Q_TXFREE) { + if (!mt76_queue_is_wed_tx_free(q)) { mt76_dma_sync_idx(dev, q); mt76_dma_rx_fill(dev, q, false); } @@ -818,7 +818,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget) bool more; if (IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED) && - q->flags == MT_WED_Q_TXFREE) { + mt76_queue_is_wed_tx_free(q)) { dma_idx = Q_READ(dev, q, dma_idx); check_ddone = true; } diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 141f2e80c165..16982fd53716 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -1560,6 +1560,12 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy, struct mt76_power_limits *dest, s8 target_power); +static inline bool mt76_queue_is_wed_tx_free(struct mt76_queue *q) +{ + return (q->flags & MT_QFLAG_WED) && + FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_TXFREE; +} + static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q) { return (q->flags & MT_QFLAG_WED) && diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/dma.c b/drivers/net/wireless/mediatek/mt76/mt7915/dma.c index 59a44d79aaed..96b2c3802ac1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/dma.c @@ -643,7 +643,7 @@ int mt7915_dma_reset(struct mt7915_dev *dev, bool force) mt76_queue_reset(dev, dev->mt76.q_mcu[i]); mt76_for_each_q_rx(&dev->mt76, i) { - if (dev->mt76.q_rx[i].flags == MT_WED_Q_TXFREE) + if (mt76_queue_is_wed_tx_free(&dev->mt76.q_rx[i])) continue; mt76_queue_reset(dev, &dev->mt76.q_rx[i]); -- 2.41.0