From patchwork Wed Nov 11 13:47:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 323528 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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 209E6C388F9 for ; Wed, 11 Nov 2020 13:49:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AECA82072C for ; Wed, 11 Nov 2020 13:49:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="fnnhagH8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbgKKNtF (ORCPT ); Wed, 11 Nov 2020 08:49:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:36040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727078AbgKKNrq (ORCPT ); Wed, 11 Nov 2020 08:47:46 -0500 Received: from lore-desk.redhat.com (unknown [151.66.8.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B6EC20756; Wed, 11 Nov 2020 13:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605102465; bh=pcgvpl/fYziMjSJsSzAEy+KqImxcD5yVRG1orWVhrXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fnnhagH8t/0auNkblIY6zFuABOnQ5FMVTMFKwNlCzrjzSbJA54jMiTm+KCTPOUxoh QECCg2JlUJcJvI8ESOfpqfiqaGWyfgrz7YWJZKCDSSk4rpgPzh5PpuV9wWTsIxLO/4 Zv9Ta1tcvS+Ei9ZEEyktZ1uMyO7hNzT9FNyQ8S/8= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com, sean.wang@mediatek.com Subject: [PATCH v2 02/10] mt76: sdio: introduce mt76s_alloc_tx_queue Date: Wed, 11 Nov 2020 14:47:24 +0100 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This is a preliminary patch to move hw data queues in mt76_phy for mt7915 dbdc support Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/sdio.c | 44 ++++++++++++++++------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index b4def262e1a0..4c6a65cec318 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -36,28 +36,46 @@ mt76s_alloc_rx_queue(struct mt76_dev *dev, enum mt76_rxq_id qid) return 0; } +static struct mt76_queue *mt76s_alloc_tx_queue(struct mt76_dev *dev) +{ + struct mt76_queue *q; + + q = devm_kzalloc(dev->dev, sizeof(*q), GFP_KERNEL); + if (!q) + return ERR_PTR(-ENOMEM); + + spin_lock_init(&q->lock); + q->entry = devm_kcalloc(dev->dev, + MT_NUM_TX_ENTRIES, sizeof(*q->entry), + GFP_KERNEL); + if (!q->entry) + return ERR_PTR(-ENOMEM); + + q->ndesc = MT_NUM_TX_ENTRIES; + + return q; +} + static int mt76s_alloc_tx(struct mt76_dev *dev) { struct mt76_queue *q; int i; - for (i = 0; i < MT_TXQ_MCU_WA; i++) { - q = devm_kzalloc(dev->dev, sizeof(*q), GFP_KERNEL); - if (!q) - return -ENOMEM; + for (i = 0; i <= MT_TXQ_PSD; i++) { + q = mt76s_alloc_tx_queue(dev); + if (IS_ERR(q)) + return PTR_ERR(q); - spin_lock_init(&q->lock); - q->hw_idx = i; + q->qid = i; dev->q_tx[i] = q; + } - q->entry = devm_kcalloc(dev->dev, - MT_NUM_TX_ENTRIES, sizeof(*q->entry), - GFP_KERNEL); - if (!q->entry) - return -ENOMEM; + q = mt76s_alloc_tx_queue(dev); + if (IS_ERR(q)) + return PTR_ERR(q); - q->ndesc = MT_NUM_TX_ENTRIES; - } + q->qid = MT_TXQ_MCU; + dev->q_tx[MT_TXQ_MCU] = q; return 0; }