Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4373887pxb; Tue, 10 Nov 2020 15:04:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrG/Bb2PxrgrqBbqEgMBoiIETxQFUR4r6sRTSoxdROYNbbABn989bSmPcqEN0lAIZoVjsx X-Received: by 2002:a17:906:8398:: with SMTP id p24mr23035836ejx.401.1605049464935; Tue, 10 Nov 2020 15:04:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605049464; cv=none; d=google.com; s=arc-20160816; b=s5JlN3FMMCXWRQ5VEzY12tYPxXEWwbwC4CqMrBdmS2RNmv0LmZt5+Qbyt2mvaXi8GJ iJAZSvgSgiMuNG41pIUyT9TN73odXfDSLb/8QMOqizjpC5wtYkGy21q7Mma5i3xJDVAW tKZfKXtvght8ZM9IjM/ZdaOdNvhKe5FqyA4gxxC8gA1FDD0yUIqcjTZa5B9ObdFwsq3E luKF7kb1Y6yQ0yfNrdvZMo/V47vslBPcl24Ta8trZBAFLL5habIiH7EYPrwQ+oDVNHXL hno76ES7Msq3zIYPHgzC0Mx/htSl8ugBTat3eSwwqlZPNaVsL4pE06jDV+cUJ8lGjhuH 7qGQ== 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=LDJk0EEthpL9GD600iiJSmNcaCtw6OR5YGJqbLrLqps=; b=JeIVp2RUzLtarYWLxsNe2OSEhDJsenXnkPYy9sZWNyRXA09nNzzQUHLDp419GS2XG2 wgMqcc+Mi9iK2uBdUCIbL3DV+ByQ2bTGcxbtpP/cRcECJ/6lo66ekA0C6NKoZpWOpHvQ 1NONKs4P3o9zH6WLSfAeZcf0m0nYEkc/VBDzblYXFAWhSkehQlC/NhKLitERupdnwFnV E+5d48L9308KYvDK2++VCC5lXxJ0YG3UfW03vyXRIwAEfZL+8d4jURaoNkwixfvu1k79 vT/xb0tXcEqCPdN82ZKNOEJGWua2K4+29eVwqourOkCsWrN/idTV48d+UNKdm7whKkZM 33XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XY7GLjYx; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c13si137257edw.271.2020.11.10.15.03.53; Tue, 10 Nov 2020 15:04:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XY7GLjYx; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732235AbgKJXDW (ORCPT + 99 others); Tue, 10 Nov 2020 18:03:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:56434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730254AbgKJXDW (ORCPT ); Tue, 10 Nov 2020 18:03:22 -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 B06F520780; Tue, 10 Nov 2020 23:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605049401; bh=Zs6ZjNtlkCAZXU3uIBW2l450fLnHsXwnfhrWdVcOtbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XY7GLjYxjmEk0erLmxcRMhzFt29R3bCR7kIkKRQ0fhxXrXKGIc+YoOXanpHiyscN1 OteqTWmjRAF2v4haFiaZ8hdMjg9DMlHfVddq8gqksYzperq9bMBJVY4zN46I4EJrCD ZWzEZn+KLcH1ijR8qOhxb+SLVR3bj4s2+PRWzwHA= 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 04/10] mt76: mt7663s: rely on mt76_queue in mt7663s_tx_run_queue signature Date: Wed, 11 Nov 2020 00:02:54 +0100 Message-Id: <474869cc686cf76a927eea3759d089085245bc18.1605048763.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This is a preliminary patch to move data queues in mt76_phy and properly support dbdc for mt7915 Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76.h | 2 +- .../wireless/mediatek/mt76/mt7615/sdio_txrx.c | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 63549a7806cb..fc4f0b3e4873 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -458,7 +458,7 @@ struct mt76_sdio { struct work_struct stat_work; - u8 *xmit_buf[MT_TXQ_MCU_WA]; + u8 *xmit_buf[IEEE80211_NUM_ACS + 2]; struct sdio_func *func; void *intr_data; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c index e46ed4b94bc5..ab883b4bca45 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c @@ -166,14 +166,14 @@ static int mt7663s_rx_handler(struct mt76_dev *dev) return nframes; } -static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid, - int buf_sz, int *pse_size, int *ple_size) +static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, bool mcu, int buf_sz, + int *pse_size, int *ple_size) { int pse_sz; pse_sz = DIV_ROUND_UP(buf_sz + sdio->sched.deficit, MT_PSE_PAGE_SZ); - if (qid == MT_TXQ_MCU) { + if (mcu) { if (sdio->sched.pse_mcu_quota < *pse_size + pse_sz) return -EBUSY; } else { @@ -188,10 +188,10 @@ static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid, return 0; } -static void mt7663s_tx_update_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid, +static void mt7663s_tx_update_quota(struct mt76_sdio *sdio, bool mcu, int pse_size, int ple_size) { - if (qid == MT_TXQ_MCU) { + if (mcu) { sdio->sched.pse_mcu_quota -= pse_size; } else { sdio->sched.pse_data_quota -= pse_size; @@ -214,12 +214,13 @@ static int __mt7663s_xmit_queue(struct mt76_dev *dev, u8 *data, int len) return err; } -static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid) +static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) { - int err, nframes = 0, len = 0, pse_sz = 0, ple_sz = 0; - struct mt76_queue *q = dev->q_tx[qid]; + int qid, err, nframes = 0, len = 0, pse_sz = 0, ple_sz = 0; + bool mcu = q == dev->q_tx[MT_TXQ_MCU]; struct mt76_sdio *sdio = &dev->sdio; + qid = mcu ? ARRAY_SIZE(sdio->xmit_buf) - 1 : q->qid; while (q->first != q->head) { struct mt76_queue_entry *e = &q->entry[q->first]; struct sk_buff *iter; @@ -237,7 +238,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid) if (len + e->skb->len + 4 > MT76S_XMIT_BUF_SZ) break; - if (mt7663s_tx_pick_quota(sdio, qid, e->buf_sz, &pse_sz, + if (mt7663s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz, &ple_sz)) break; @@ -263,7 +264,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, enum mt76_txq_id qid) if (err) return err; } - mt7663s_tx_update_quota(sdio, qid, pse_sz, ple_sz); + mt7663s_tx_update_quota(sdio, mcu, pse_sz, ple_sz); mt76_worker_schedule(&sdio->status_worker); @@ -286,7 +287,7 @@ void mt7663s_txrx_worker(struct mt76_worker *w) /* tx */ for (i = 0; i < MT_TXQ_MCU_WA; i++) { - ret = mt7663s_tx_run_queue(dev, i); + ret = mt7663s_tx_run_queue(dev, dev->q_tx[i]); if (ret > 0) nframes += ret; } -- 2.26.2