From patchwork Tue Sep 4 14:41:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 10587429 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 857F5174C for ; Tue, 4 Sep 2018 14:42:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7408729A07 for ; Tue, 4 Sep 2018 14:42:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 684C629A0C; Tue, 4 Sep 2018 14:42:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E54AF29A0A for ; Tue, 4 Sep 2018 14:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727568AbeIDTH2 (ORCPT ); Tue, 4 Sep 2018 15:07:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48812 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725995AbeIDTH2 (ORCPT ); Tue, 4 Sep 2018 15:07:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3974D40241C4; Tue, 4 Sep 2018 14:42:04 +0000 (UTC) Received: from localhost (ovpn-204-92.brq.redhat.com [10.40.204.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B87CA9EAF; Tue, 4 Sep 2018 14:42:01 +0000 (UTC) From: Stanislaw Gruszka To: linux-wireless@vger.kernel.org Cc: Lorenzo Bianconi , Felix Fietkau , linux-mediatek@lists.infradead.org Subject: [PATCH 09/22] mt76: remove q->hw_idx Date: Tue, 4 Sep 2018 16:41:02 +0200 Message-Id: <1536072075-6990-10-git-send-email-sgruszka@redhat.com> In-Reply-To: <1536072075-6990-1-git-send-email-sgruszka@redhat.com> References: <1536072075-6990-1-git-send-email-sgruszka@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 04 Sep 2018 14:42:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 04 Sep 2018 14:42:04 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'sgruszka@redhat.com' RCPT:'' Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We use q->hw_idx in very few places, remove it and provide hwq index by diffrent way. This will allow ot unify conf_tx mac80211 callback. Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 - drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 1 - drivers/net/wireless/mediatek/mt76/mt76x2u_core.c | 3 ++- drivers/net/wireless/mediatek/mt76/usb.c | 6 +++--- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 7a7d13b16508..cef3e513b8f0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -113,7 +113,6 @@ struct mt76_queue { int buf_size; u8 buf_offset; - u8 hw_idx; dma_addr_t desc_dma; struct sk_buff *rx_head; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_common.c b/drivers/net/wireless/mediatek/mt76/mt76x2_common.c index 7f05aebf67ec..ead53faa1fb3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_common.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_common.c @@ -34,7 +34,7 @@ int mt76x2_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u8 cw_min = 5, cw_max = 10, qid; u32 val; - qid = dev->mt76.q_tx[queue].hw_idx; + qid = mt76_ac_to_hwq(queue); if (params->cw_min) cw_min = fls(params->cw_min); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c b/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c index 1c8e5d7be425..919dc3f36255 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c @@ -55,7 +55,6 @@ mt76x2_init_tx_queue(struct mt76x2_dev *dev, struct mt76_queue *q, q->regs = dev->mt76.regs + MT_TX_RING_BASE + idx * MT_RING_SIZE; q->ndesc = n_desc; - q->hw_idx = idx; ret = mt76_queue_alloc(dev, q); if (ret) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2u_core.c b/drivers/net/wireless/mediatek/mt76/mt76x2u_core.c index 500d7db338aa..d5dc4eb15818 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2u_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2u_core.c @@ -84,6 +84,7 @@ int mt76x2u_tx_prepare_skb(struct mt76_dev *mdev, void *data, struct mt76x2_dev *dev = container_of(mdev, struct mt76x2_dev, mt76); struct mt76x2_txwi *txwi; int err, len = skb->len; + int *hwq_ptr = (int *) data; err = mt76x2u_check_skb_rooms(skb); if (err < 0) @@ -94,7 +95,7 @@ int mt76x2u_tx_prepare_skb(struct mt76_dev *mdev, void *data, txwi = skb_push(skb, sizeof(struct mt76x2_txwi)); mt76x2_mac_write_txwi(dev, txwi, skb, wcid, sta, len); - return mt76x2u_set_txinfo(skb, wcid, q2ep(q->hw_idx)); + return mt76x2u_set_txinfo(skb, wcid, q2ep(*hwq_ptr)); } void mt76x2u_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q, diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index 333b2c8ca7a4..5785e54c32d0 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -652,7 +652,8 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, { struct usb_interface *intf = to_usb_interface(dev->dev); struct usb_device *udev = interface_to_usbdev(intf); - u8 ep = q2ep(q->hw_idx); + int hwq = mt76_ac_to_hwq(skb_get_queue_mapping(skb)); + u8 ep = q2ep(hwq); struct mt76u_buf *buf; u16 idx = q->tail; unsigned int pipe; @@ -661,7 +662,7 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, if (q->queued == q->ndesc) return -ENOSPC; - err = dev->drv->tx_prepare_skb(dev, NULL, skb, q, wcid, sta, NULL); + err = dev->drv->tx_prepare_skb(dev, &hwq, skb, q, wcid, sta, NULL); if (err < 0) return err; @@ -715,7 +716,6 @@ static int mt76u_alloc_tx(struct mt76_dev *dev) q = &dev->q_tx[i]; spin_lock_init(&q->lock); INIT_LIST_HEAD(&q->swq); - q->hw_idx = mt76_ac_to_hwq(i); q->entry = devm_kzalloc(dev->dev, MT_NUM_TX_ENTRIES * sizeof(*q->entry),