From patchwork Fri Jan 14 23:48:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 12714230 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4915DC433EF for ; Fri, 14 Jan 2022 23:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbiANXtA (ORCPT ); Fri, 14 Jan 2022 18:49:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230334AbiANXsz (ORCPT ); Fri, 14 Jan 2022 18:48:55 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBAEBC061574; Fri, 14 Jan 2022 15:48:54 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id p1-20020a1c7401000000b00345c2d068bdso9879351wmc.3; Fri, 14 Jan 2022 15:48:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uIChTMrcpS/kkRKECZG0ehIyzqFS6xzet6sL4NEDXxE=; b=QLyYWW22YcFEzS+cr0DBjjT9/xbhNFfFyS8WWGJeTzoUOVDMVSN3M+/RJRXcfMZ1Du 4Cr3Bh3xSZhXArrksIkAQJje6da3w6TRdQWtIWltD5wb67GcTuvqmDX4cAwqkl7wNy6N xDmhyk3lylAuLjWsj/xq42tlb4DVNIiSI2scoo/MxE55aJCU2K257CE1Nn2gd0vA2yWd x/B85/Jq92DV4WobbBYgJbTxbVGsHr+AwW3SkeS9hoeXRupAHASnPMknMqX0j3R8T7hf FFTTARlPULqoj0Jv2L7ALbrq8Bt0MhSuW00uh5Y+EtJxPdQmJ4/DLiaYKDA9TevtThJp oZrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uIChTMrcpS/kkRKECZG0ehIyzqFS6xzet6sL4NEDXxE=; b=c8DnxIEuzyW3mEhhV0AJ42f9CwTZKkHoMlbj7VnDFnt/fjzqaTJzfKvzz+DVMv7aGj uKIOs7Vd6DpdjXAnlrqygX7/LAd/b9Y/mPC6GKWv3piEXyfrC0/YYuZ74VXh8jkjRpFb aOzyg2SYsYBc5u13xVPGDNYnYJg+2RX/V+SWx5ga1aX+c9bzsT+Do+dnF97cfXWOK1Vn jJOhgDwHqjPC+C8wsqqkO6H45jqTt47CaNsQsvJ7BBx5vgYmFXp9I2w5X+TBqEtqzOny 1NTtyyVTF3zcSQvsx6LjD6yYNsvUtVf650pMIK2SuJcWYTNg0CiWnpsdXHf2Vb3wBuMy ac3w== X-Gm-Message-State: AOAM5309zJaHgOrP9hsHT6ObbOd+D6nthVQn7u2lo1YsK1ZP6TIsv7BL x/dUsdrCFjMjcG4U9hCQWCnhofMey24= X-Google-Smtp-Source: ABdhPJym9iys6gxC30Btb8GDrmAnFVKrA7I1y2VDy7wlDyvHvXVM71/hxP9QyA7hXKPQAZRejdvIhQ== X-Received: by 2002:a05:600c:4e88:: with SMTP id f8mr10269102wmq.45.1642204132991; Fri, 14 Jan 2022 15:48:52 -0800 (PST) Received: from localhost.localdomain (dynamic-2a01-0c22-7684-7400-f22f-74ff-fe21-0725.c22.pool.telefonica.de. [2a01:c22:7684:7400:f22f:74ff:fe21:725]) by smtp.googlemail.com with ESMTPSA id i3sm5788533wmq.21.2022.01.14.15.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 15:48:52 -0800 (PST) From: Martin Blumenstingl To: linux-wireless@vger.kernel.org Cc: tony0620emma@gmail.com, kvalo@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Neo Jou , Jernej Skrabec , Pkshih , Martin Blumenstingl Subject: [PATCH 1/4] rtw88: pci: Change type of rtw_hw_queue_mapping() and ac_to_hwq to enum Date: Sat, 15 Jan 2022 00:48:22 +0100 Message-Id: <20220114234825.110502-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114234825.110502-1-martin.blumenstingl@googlemail.com> References: <20220114234825.110502-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org rtw_hw_queue_mapping() and ac_to_hwq[] hold values of type enum rtw_tx_queue_type. Change their types to reflect this to make it easier to understand this part of the code. Signed-off-by: Martin Blumenstingl --- drivers/net/wireless/realtek/rtw88/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index a0991d3f15c0..13f1f50b2867 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -669,7 +669,7 @@ static void rtw_pci_deep_ps(struct rtw_dev *rtwdev, bool enter) spin_unlock_bh(&rtwpci->irq_lock); } -static u8 ac_to_hwq[] = { +static enum rtw_tx_queue_type ac_to_hwq[] = { [IEEE80211_AC_VO] = RTW_TX_QUEUE_VO, [IEEE80211_AC_VI] = RTW_TX_QUEUE_VI, [IEEE80211_AC_BE] = RTW_TX_QUEUE_BE, @@ -678,12 +678,12 @@ static u8 ac_to_hwq[] = { static_assert(ARRAY_SIZE(ac_to_hwq) == IEEE80211_NUM_ACS); -static u8 rtw_hw_queue_mapping(struct sk_buff *skb) +static enum rtw_tx_queue_type rtw_hw_queue_mapping(struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; __le16 fc = hdr->frame_control; u8 q_mapping = skb_get_queue_mapping(skb); - u8 queue; + enum rtw_tx_queue_type queue; if (unlikely(ieee80211_is_beacon(fc))) queue = RTW_TX_QUEUE_BCN; From patchwork Fri Jan 14 23:48:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 12714229 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8FB2C43217 for ; Fri, 14 Jan 2022 23:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231226AbiANXs6 (ORCPT ); Fri, 14 Jan 2022 18:48:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbiANXsz (ORCPT ); Fri, 14 Jan 2022 18:48:55 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57F08C061574; Fri, 14 Jan 2022 15:48:55 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id d18-20020a05600c251200b0034974323cfaso9884358wma.4; Fri, 14 Jan 2022 15:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q1vawQ0DtsMy/giBeIttsSJVFFvGpTMkVdU2i1xq8oM=; b=FqcYiryfiaD/4yTSgUtZjZ0/2/oPwHS9TO7gI20z9wvkwy6EuykQqTatHvOCG9ABbb 2cxYvUgYAhg9fc0q56nQAFC2MKlV8l4XqoWh2cLq/+oZUkSGPxe8W8orWKCKSbGbW/Lm 0VQFEL4hKLUz8aKS3FNAqf4oqTwevj0DhFJFdMocQ6eMX7QECnync6zAbFKB9eWa6RgS Dqy3k8K/VAEUfxe2PwiHTP5CDhV1Ef2lcancJaB9wM60wMgRIGza9OM+nhnQbZv5rFE0 UZg87uvM4r+kFW6+tcE6XIoypo8hill3ShEQ1P6R6Nw2Xlr8gZf0JGYEufaJH6YNVV/g Hwig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q1vawQ0DtsMy/giBeIttsSJVFFvGpTMkVdU2i1xq8oM=; b=ljewJepNnsTlbG9kSwjo/poDUr/0cPWLOCwhodM1+5/H+YnEi3MDVZfIWSSkLBFmvQ sVssaGeY/aPxo8KCBJ5nnZsVG8ExyKTmKzHP+2FRmBzQSwI+m0yPqM/MyKuBViol0419 HmRru4G01Rs3qUFRJIrzpROys7EH5uimQFVTjRUR+/nROyGrxtnYOx8QDilJ3Of5f3aH wAv/GoFdzHRZ8PJrRg6wvCK8URCMmv2juYY+EkiVNj0cokhtekDksEhwbSoPVI5Hu9Ia kRMF0tKDMzlX/JRYSeZCHxIzNh9z5gVeT7meFTsz2K1qbE1wSbCauzramkc8sxf9nDrD 8dJg== X-Gm-Message-State: AOAM530K/Dh+9kWuIVUGcYK4V6+eSjfihaUAAdeOqIq/FdBEMcjceWS8 buOZbxOe+87kAJD5n/YMj1chfqOo1Kc= X-Google-Smtp-Source: ABdhPJyhRxTCK3V867hG941Q2EW2kxf/2uXkZLqFrRjKMHdc/mDEFXuWpL5V96H4zqB2L7mkdUURNQ== X-Received: by 2002:a05:600c:1d9a:: with SMTP id p26mr17854109wms.38.1642204133778; Fri, 14 Jan 2022 15:48:53 -0800 (PST) Received: from localhost.localdomain (dynamic-2a01-0c22-7684-7400-f22f-74ff-fe21-0725.c22.pool.telefonica.de. [2a01:c22:7684:7400:f22f:74ff:fe21:725]) by smtp.googlemail.com with ESMTPSA id i3sm5788533wmq.21.2022.01.14.15.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 15:48:53 -0800 (PST) From: Martin Blumenstingl To: linux-wireless@vger.kernel.org Cc: tony0620emma@gmail.com, kvalo@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Neo Jou , Jernej Skrabec , Pkshih , Martin Blumenstingl Subject: [PATCH 2/4] rtw88: pci: Change queue datatype from u8 to enum rtw_tx_queue_type Date: Sat, 15 Jan 2022 00:48:23 +0100 Message-Id: <20220114234825.110502-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114234825.110502-1-martin.blumenstingl@googlemail.com> References: <20220114234825.110502-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This makes it easier to understand which values are allowed for the "queue" variable. Signed-off-by: Martin Blumenstingl Acked-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw88/pci.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index 13f1f50b2867..2da057d18188 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -30,7 +30,8 @@ static u32 rtw_pci_tx_queue_idx_addr[] = { [RTW_TX_QUEUE_H2C] = RTK_PCI_TXBD_IDX_H2CQ, }; -static u8 rtw_pci_get_tx_qsel(struct sk_buff *skb, u8 queue) +static u8 rtw_pci_get_tx_qsel(struct sk_buff *skb, + enum rtw_tx_queue_type queue) { switch (queue) { case RTW_TX_QUEUE_BCN: @@ -542,7 +543,7 @@ static int rtw_pci_setup(struct rtw_dev *rtwdev) static void rtw_pci_dma_release(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci) { struct rtw_pci_tx_ring *tx_ring; - u8 queue; + enum rtw_tx_queue_type queue; rtw_pci_reset_trx_ring(rtwdev); for (queue = 0; queue < RTK_MAX_TX_QUEUE_NUM; queue++) { @@ -608,8 +609,8 @@ static void rtw_pci_deep_ps_enter(struct rtw_dev *rtwdev) { struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; struct rtw_pci_tx_ring *tx_ring; + enum rtw_tx_queue_type queue; bool tx_empty = true; - u8 queue; if (rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_TX_WAKE)) goto enter_deep_ps; @@ -800,7 +801,8 @@ static void rtw_pci_flush_queues(struct rtw_dev *rtwdev, u32 queues, bool drop) __rtw_pci_flush_queues(rtwdev, pci_queues, drop); } -static void rtw_pci_tx_kick_off_queue(struct rtw_dev *rtwdev, u8 queue) +static void rtw_pci_tx_kick_off_queue(struct rtw_dev *rtwdev, + enum rtw_tx_queue_type queue) { struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; struct rtw_pci_tx_ring *ring; @@ -819,7 +821,7 @@ static void rtw_pci_tx_kick_off_queue(struct rtw_dev *rtwdev, u8 queue) static void rtw_pci_tx_kick_off(struct rtw_dev *rtwdev) { struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; - u8 queue; + enum rtw_tx_queue_type queue; for (queue = 0; queue < RTK_MAX_TX_QUEUE_NUM; queue++) if (test_and_clear_bit(queue, rtwpci->tx_queued)) @@ -828,7 +830,8 @@ static void rtw_pci_tx_kick_off(struct rtw_dev *rtwdev) static int rtw_pci_tx_write_data(struct rtw_dev *rtwdev, struct rtw_tx_pkt_info *pkt_info, - struct sk_buff *skb, u8 queue) + struct sk_buff *skb, + enum rtw_tx_queue_type queue) { struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; struct rtw_chip_info *chip = rtwdev->chip; @@ -946,9 +949,9 @@ static int rtw_pci_tx_write(struct rtw_dev *rtwdev, struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb) { + enum rtw_tx_queue_type queue = rtw_hw_queue_mapping(skb); struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; struct rtw_pci_tx_ring *ring; - u8 queue = rtw_hw_queue_mapping(skb); int ret; ret = rtw_pci_tx_write_data(rtwdev, pkt_info, skb, queue); From patchwork Fri Jan 14 23:48:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 12714231 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84B19C43217 for ; Fri, 14 Jan 2022 23:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231342AbiANXtD (ORCPT ); Fri, 14 Jan 2022 18:49:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231185AbiANXs4 (ORCPT ); Fri, 14 Jan 2022 18:48:56 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58C8AC061574; Fri, 14 Jan 2022 15:48:56 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id ay4-20020a05600c1e0400b0034a81a94607so7518745wmb.1; Fri, 14 Jan 2022 15:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZYFhsrkPrDaI7lwyyln6Ae8gj83V6alxweKHKFm4f+A=; b=JSL8FM+GsgePxacg49pCRuZ/CUkofU0ywNyKPNV0APiLos8dVF9EL5rgBUIBq5GTQb W20OSwpmMxTSEpVm0ZXi87xFd/kWNRZJNAKgikQMhW8/p2K542KZUzahLhR2fkhVCf9k w5dtXdgNK7stGolRhEHVnKMVwrRsriDmy/Rh1hji9ZWTK6vGg6pQ1Ng7m8zfI/WAKL7e z+7OkzwRMP6f5iNMmgdB2M0Y36Iq3wKes765u1X3l43+j3LimV0+Y6tFAVyTRq01L6z9 KvHrOJr618f0WwU3ISgmgRM//rneqrZaxVA+zI4ng8nX9M3KQhrgsD7YvbISv4X2CXVl jNSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZYFhsrkPrDaI7lwyyln6Ae8gj83V6alxweKHKFm4f+A=; b=BOF53khrmsPACtjffJjQolqqDUCFXDo8zTAauhC4OJFkkMJw1DO3AdeqxRvw7X7ZR2 52TkMaAcHEHzP7ARKsdXwhibFhNGwmdA0C527pVLl5l6fVNwg6Z0V40mdoUSRiuU0rgl vylCjc0ozvcLmkjn0vwqohK8MN+YZLEI0yfFEq+EmWTRZSTQ5QJEWVCG4JH8bnP2FBs7 YGh857G95Mk/c1KdbB2KfMcogaeHlMhIgrq8KwCeKVENO0B/+PmVYYZFCjGmFelDvdoG WHNUsLLKrSSQBCEuiJimmEvHbPfd6iwLPa/ngIfYBUfpWfYCtRtdMdr/tdUjoxQLW+gP ZSBQ== X-Gm-Message-State: AOAM532/zLVVd1X8q+DiUO1GgIDCgfYRb/e9oK6JTLwIS0RsXknOcRq0 9w5IbSR76+Bf6hjoKFhrHQvy6ZF3duc= X-Google-Smtp-Source: ABdhPJwVNkrZbm6qLx8MbY43Zmb6jXlKsBObROSx5JUTnx2Fylr/k27C6KCf3FC8xYnJjipiLMAM0g== X-Received: by 2002:adf:ebd2:: with SMTP id v18mr8698232wrn.502.1642204134687; Fri, 14 Jan 2022 15:48:54 -0800 (PST) Received: from localhost.localdomain (dynamic-2a01-0c22-7684-7400-f22f-74ff-fe21-0725.c22.pool.telefonica.de. [2a01:c22:7684:7400:f22f:74ff:fe21:725]) by smtp.googlemail.com with ESMTPSA id i3sm5788533wmq.21.2022.01.14.15.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 15:48:54 -0800 (PST) From: Martin Blumenstingl To: linux-wireless@vger.kernel.org Cc: tony0620emma@gmail.com, kvalo@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Neo Jou , Jernej Skrabec , Pkshih , Martin Blumenstingl Subject: [PATCH 3/4] rtw88: Move enum rtw_tx_queue_type mapping code to tx.{c,h} Date: Sat, 15 Jan 2022 00:48:24 +0100 Message-Id: <20220114234825.110502-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114234825.110502-1-martin.blumenstingl@googlemail.com> References: <20220114234825.110502-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This code is not specific to the PCIe bus type but can be re-used by USB and SDIO bus types. Move it to tx.{c,h} to avoid code-duplication in the future. Signed-off-by: Martin Blumenstingl --- drivers/net/wireless/realtek/rtw88/pci.c | 32 ++-------------------- drivers/net/wireless/realtek/rtw88/tx.c | 35 ++++++++++++++++++++++++ drivers/net/wireless/realtek/rtw88/tx.h | 3 ++ 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index 2da057d18188..945411a5947b 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -670,34 +670,6 @@ static void rtw_pci_deep_ps(struct rtw_dev *rtwdev, bool enter) spin_unlock_bh(&rtwpci->irq_lock); } -static enum rtw_tx_queue_type ac_to_hwq[] = { - [IEEE80211_AC_VO] = RTW_TX_QUEUE_VO, - [IEEE80211_AC_VI] = RTW_TX_QUEUE_VI, - [IEEE80211_AC_BE] = RTW_TX_QUEUE_BE, - [IEEE80211_AC_BK] = RTW_TX_QUEUE_BK, -}; - -static_assert(ARRAY_SIZE(ac_to_hwq) == IEEE80211_NUM_ACS); - -static enum rtw_tx_queue_type rtw_hw_queue_mapping(struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - u8 q_mapping = skb_get_queue_mapping(skb); - enum rtw_tx_queue_type queue; - - if (unlikely(ieee80211_is_beacon(fc))) - queue = RTW_TX_QUEUE_BCN; - else if (unlikely(ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc))) - queue = RTW_TX_QUEUE_MGMT; - else if (WARN_ON_ONCE(q_mapping >= ARRAY_SIZE(ac_to_hwq))) - queue = ac_to_hwq[IEEE80211_AC_BE]; - else - queue = ac_to_hwq[q_mapping]; - - return queue; -} - static void rtw_pci_release_rsvd_page(struct rtw_pci *rtwpci, struct rtw_pci_tx_ring *ring) { @@ -795,7 +767,7 @@ static void rtw_pci_flush_queues(struct rtw_dev *rtwdev, u32 queues, bool drop) } else { for (i = 0; i < rtwdev->hw->queues; i++) if (queues & BIT(i)) - pci_queues |= BIT(ac_to_hwq[i]); + pci_queues |= BIT(rtw_tx_ac_to_hwq(i)); } __rtw_pci_flush_queues(rtwdev, pci_queues, drop); @@ -949,7 +921,7 @@ static int rtw_pci_tx_write(struct rtw_dev *rtwdev, struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb) { - enum rtw_tx_queue_type queue = rtw_hw_queue_mapping(skb); + enum rtw_tx_queue_type queue = rtw_tx_queue_mapping(skb); struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; struct rtw_pci_tx_ring *ring; int ret; diff --git a/drivers/net/wireless/realtek/rtw88/tx.c b/drivers/net/wireless/realtek/rtw88/tx.c index efcc1b0371a8..ec6a3683c3f8 100644 --- a/drivers/net/wireless/realtek/rtw88/tx.c +++ b/drivers/net/wireless/realtek/rtw88/tx.c @@ -665,3 +665,38 @@ void rtw_txq_cleanup(struct rtw_dev *rtwdev, struct ieee80211_txq *txq) list_del_init(&rtwtxq->list); spin_unlock_bh(&rtwdev->txq_lock); } + +static enum rtw_tx_queue_type ac_to_hwq[] = { + [IEEE80211_AC_VO] = RTW_TX_QUEUE_VO, + [IEEE80211_AC_VI] = RTW_TX_QUEUE_VI, + [IEEE80211_AC_BE] = RTW_TX_QUEUE_BE, + [IEEE80211_AC_BK] = RTW_TX_QUEUE_BK, +}; + +static_assert(ARRAY_SIZE(ac_to_hwq) == IEEE80211_NUM_ACS); + +enum rtw_tx_queue_type rtw_tx_ac_to_hwq(enum ieee80211_ac_numbers ac) +{ + return ac_to_hwq[ac]; +} +EXPORT_SYMBOL(rtw_tx_ac_to_hwq); + +enum rtw_tx_queue_type rtw_tx_queue_mapping(struct sk_buff *skb) +{ + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + __le16 fc = hdr->frame_control; + u8 q_mapping = skb_get_queue_mapping(skb); + enum rtw_tx_queue_type queue; + + if (unlikely(ieee80211_is_beacon(fc))) + queue = RTW_TX_QUEUE_BCN; + else if (unlikely(ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc))) + queue = RTW_TX_QUEUE_MGMT; + else if (WARN_ON_ONCE(q_mapping >= ARRAY_SIZE(ac_to_hwq))) + queue = ac_to_hwq[IEEE80211_AC_BE]; + else + queue = ac_to_hwq[q_mapping]; + + return queue; +} +EXPORT_SYMBOL(rtw_tx_queue_mapping); diff --git a/drivers/net/wireless/realtek/rtw88/tx.h b/drivers/net/wireless/realtek/rtw88/tx.h index 56371eff9f7f..940f944fd39c 100644 --- a/drivers/net/wireless/realtek/rtw88/tx.h +++ b/drivers/net/wireless/realtek/rtw88/tx.h @@ -119,4 +119,7 @@ rtw_tx_write_data_h2c_get(struct rtw_dev *rtwdev, struct rtw_tx_pkt_info *pkt_info, u8 *buf, u32 size); +enum rtw_tx_queue_type rtw_tx_ac_to_hwq(enum ieee80211_ac_numbers ac); +enum rtw_tx_queue_type rtw_tx_queue_mapping(struct sk_buff *skb); + #endif From patchwork Fri Jan 14 23:48:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 12714232 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E100BC41535 for ; Fri, 14 Jan 2022 23:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbiANXtC (ORCPT ); Fri, 14 Jan 2022 18:49:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231172AbiANXs5 (ORCPT ); Fri, 14 Jan 2022 18:48:57 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AE13C061574; Fri, 14 Jan 2022 15:48:57 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id p18so8990257wmg.4; Fri, 14 Jan 2022 15:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=La6vxx89LoJkplOXTrCEQipBpHlGptWD3ksMauPkOfU=; b=BogPgfoe6NchlV2k3yFPNQaiVUpwxBWO4bk/TWwvQRtnYx0ZYqHPh6f4sixPj7fyDI Epk5z3YY9YuOiTKgF7wSBuylZEmJP04VIUrfRkvV/NEKq/LZQYw80dYfIeHv8qVA6psm FGlC6SIaN1EYxwef4kFaPVvy4rCx5i1gdot/ZPTVTmmAJDxNQbkjfvhJ6d4MP/M2ThKJ gDQVOn8mUbtXq6ORXyFtEJwnku8x53z/vhzWjOsGnZXG1YTyPOJ6GoP+oa4X5kv9/3nT z257rz8N1G4PYaf3e8kecTDJRWsEqG0sEvknJUByTmUh1ZN55GhBv76BKrdkP2aSXUVX TKnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=La6vxx89LoJkplOXTrCEQipBpHlGptWD3ksMauPkOfU=; b=j5DvXgBTe8zEg7hv9evzKt6z8zYQLJ4tOGxFI7Wxcb+VKu4RyDAKKgAR9c4P3VJvQd cZNldm2UOhvLz5SQs5OQQ1TcD8sXEXXLUTzT89OANkCgwQyjdj/3E1hlvjaq70ZDXIeG mXUqs/R/pPBVsHhhD8CfK6oG9766r0bNTacfDwnyl2gMghzMyiNfCzlkCrRudfTHzFCp 4r9OcdVGUpFWYjjZ8gJ44Hd9VA9VZ0Dwsfx/5CeqqNtf/g6zXnJaxvBI03p5D7K6z7eP S+O0zbyCApJ2Kjq2ByUcb+kOJ4RXIFuYpi2DtX2eAUT49TND6qomgEJ83IgEdwDjkFpO xDSw== X-Gm-Message-State: AOAM531UjESgtCy2VG0RKI2Bw9NxKKEpJclbmEa8uZsyCZjb9J/wz2d+ 2JjBiaMa4cvv5+c6CdHgBEI9a1PAbg8= X-Google-Smtp-Source: ABdhPJystG3jsSgdQtccETHSCVGHfilGgZfMIXRY2Kc7mkF7F3bhjNzpIyDdwTr+W7+k9nYviAlZNQ== X-Received: by 2002:a05:600c:3643:: with SMTP id y3mr17836122wmq.54.1642204135556; Fri, 14 Jan 2022 15:48:55 -0800 (PST) Received: from localhost.localdomain (dynamic-2a01-0c22-7684-7400-f22f-74ff-fe21-0725.c22.pool.telefonica.de. [2a01:c22:7684:7400:f22f:74ff:fe21:725]) by smtp.googlemail.com with ESMTPSA id i3sm5788533wmq.21.2022.01.14.15.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 15:48:55 -0800 (PST) From: Martin Blumenstingl To: linux-wireless@vger.kernel.org Cc: tony0620emma@gmail.com, kvalo@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Neo Jou , Jernej Skrabec , Pkshih , Martin Blumenstingl Subject: [PATCH 4/4] rtw88: mac: Use existing interface mask macros in rtw_pwr_seq_parser() Date: Sat, 15 Jan 2022 00:48:25 +0100 Message-Id: <20220114234825.110502-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114234825.110502-1-martin.blumenstingl@googlemail.com> References: <20220114234825.110502-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Replace the magic numbers for the intf_mask with their existing RTW_PWR_INTF_PCI_MSK and RTW_PWR_INTF_USB_MSK macros to make the code easier to understand. Signed-off-by: Martin Blumenstingl Acked-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw88/mac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c index d1678aed9d9c..aa6b3d2eaa38 100644 --- a/drivers/net/wireless/realtek/rtw88/mac.c +++ b/drivers/net/wireless/realtek/rtw88/mac.c @@ -217,10 +217,10 @@ static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, cut_mask = cut_version_to_mask(cut); switch (rtw_hci_type(rtwdev)) { case RTW_HCI_TYPE_PCIE: - intf_mask = BIT(2); + intf_mask = RTW_PWR_INTF_PCI_MSK; break; case RTW_HCI_TYPE_USB: - intf_mask = BIT(1); + intf_mask = RTW_PWR_INTF_USB_MSK; break; default: return -EINVAL;