From patchwork Sat Apr 2 15:36:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 556170 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 91C61C433EF for ; Sat, 2 Apr 2022 15:36:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238031AbiDBPi2 (ORCPT ); Sat, 2 Apr 2022 11:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237607AbiDBPiV (ORCPT ); Sat, 2 Apr 2022 11:38:21 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82C06144B45 for ; Sat, 2 Apr 2022 08:36:28 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id bx37so3804334ljb.4 for ; Sat, 02 Apr 2022 08:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GQBGpHLJBuI7vXHCkIC9Pl1G1Y1Yo8MMpmAHSdbTzag=; b=LxjCfQ3A25yPGUozfoldbZqZ6NzGyDPTEt418FEtiO3zSbYSLOxFlke/ZAHSj9XmmY 54JoxWfnzkqyT84xVG/IK8ogKyboykuSSIXvoaHlU5epvLQTZkoevMr+BfOUq0rqlaJQ b1QSSZ8gAoIxO1VIPoaPya5+stOPX1pA+oKIe6DpkdMwPRaFrN9LggwqJa75hcCA0Bsw /TAJW80kyDNhnHJwFfa0rDYMb16y5VS30nObXAwikdmO0nIGZQRFv6LAU6iqBpKOpErW T/GiTXry+JHfXtMHMPwmqNZXWP2j/oZb4XbuoH1EypkU21aYjRzMriGUjIrtoKnwAqVx C/YQ== 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=GQBGpHLJBuI7vXHCkIC9Pl1G1Y1Yo8MMpmAHSdbTzag=; b=tyPdrg37BHSi7wwIlCgUJ50OssQcAGFFxgGnTK94sZYzH8V0R+1MlmoWqK8EumPHR9 5FJDrh1HmzkBsoijNm4zYt3aKrd3+zGpUqRFrCptQw6V40tqZEObBjoAKwHEITpQTvVk O3bmNhKxnOqP+/5vfwvBbSptt8Lv8tam2g3ASB6tieTANxtwpBGnzP5H4+8UdhLt4VXH /oKelUXh3Kv6kkTuclfCkINhFivXAn2/L409kYTH+FhRX3xBpcXV3+CJAt6Axm3KxGWr /hG3yp6FOUntuBaQoxeLqcmhDjJJ0uz/GHze94yhlcU8vv3esIoOs+8tOnfalPgupdNz Rkhw== X-Gm-Message-State: AOAM532YUaMMSQXBxJDf/62TuDL6Mng9V1msfS2bDh8JX3Mn0x1o6k4M 2rnItSuCLePj6oaC6Ffji29ZZXTQrYA= X-Google-Smtp-Source: ABdhPJw6DBWvZkIGMlMq2WlL3Q/AntGiLMZ8CRWAG6jBHhMCJnRHWrmQYBSXb59BcwFkxRJ2THe9fQ== X-Received: by 2002:a2e:a901:0:b0:247:e3e7:7c26 with SMTP id j1-20020a2ea901000000b00247e3e77c26mr16974792ljq.395.1648913785163; Sat, 02 Apr 2022 08:36:25 -0700 (PDT) Received: from rsa-laptop.rossosh.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z18-20020a2e3512000000b0024b12b5044csm52884ljz.89.2022.04.02.08.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Apr 2022 08:36:24 -0700 (PDT) From: Sergey Ryazanov To: Kalle Valo Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH RFC 1/3] ath10k: improve tx status reporting Date: Sat, 2 Apr 2022 18:36:13 +0300 Message-Id: <20220402153615.9593-2-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220402153615.9593-1-ryazanov.s.a@gmail.com> References: <20220402153615.9593-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org We use ieee80211_tx_status() to report each completed tx frame. Internally, this function calls sta_info_get_by_addrs(), what has a couple of drawbacks: 1. additional station lookup causes a performance degradation; 2. mac80211 can not properly account Ethernet encapsulated frames due to the inability to properly determine the destination (station) MAC address since ieee80211_tx_status() assumes the frame has a 802.11 header. The latter is especially destructive if we want to use hardware frames encapsulation. To fix both of these issues, replace ieee80211_tx_status() with ieee80211_tx_status_ext() call and feed it station pointer from the tx queue associated with the transmitted frame. Tested-on: QCA9888 hw 2.0 10.4-3.9.0.2-00131 Signed-off-by: Sergey Ryazanov --- drivers/net/wireless/ath/ath10k/txrx.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index 10123974c3da..72540434c75b 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -43,6 +43,7 @@ static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb) int ath10k_txrx_tx_unref(struct ath10k_htt *htt, const struct htt_tx_done *tx_done) { + struct ieee80211_tx_status status; struct ath10k *ar = htt->ar; struct device *dev = ar->dev; struct ieee80211_tx_info *info; @@ -128,7 +129,16 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID; } - ieee80211_tx_status(htt->ar->hw, msdu); + memset(&status, 0, sizeof(status)); + status.skb = msdu; + status.info = info; + + rcu_read_lock(); + if (txq && txq->sta) + status.sta = txq->sta; + ieee80211_tx_status_ext(htt->ar->hw, &status); + rcu_read_unlock(); + /* we do not own the msdu anymore */ return 0; From patchwork Sat Apr 2 15:36:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 555920 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 3C57AC433F5 for ; Sat, 2 Apr 2022 15:36:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237535AbiDBPi0 (ORCPT ); Sat, 2 Apr 2022 11:38:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357347AbiDBPiU (ORCPT ); Sat, 2 Apr 2022 11:38:20 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A09E143C6F for ; Sat, 2 Apr 2022 08:36:28 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id z12so9842604lfu.10 for ; Sat, 02 Apr 2022 08:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cTmv43jH0Iq3c4QiJ+kkvctk9uHUSzlLivy0WU5Wggg=; b=naqi4WqqB32+j9dHXl18mUWb1WCHP9yd6IQlkvYXDQVCWAtryaj3hASMowXWD8H9di FhyPON5z4qF/7zoB6SQj8zEPkBDVrP2gWKFefheqP05dwZPWR8p/I+7URpOS+JmcvgYl kjs1X7UH9KIzLp8uRF3mKMAxUa2/sFqOujlVDkd3JzYs32wScGNXLPraE4KEALfzgzJ1 qTU+pL4dMwOdp1dANe/k4vbVUYtP9bYPGFUFOBKGkRB1nt73asN3XDbtvJzgm1VQ8X5j 9xwVwMurOTgrkg46WB83hcJe7uaFu0wYP2EFyddVApT85+mZAhguAHUnYwMVNT+GuiwF McWQ== 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=cTmv43jH0Iq3c4QiJ+kkvctk9uHUSzlLivy0WU5Wggg=; b=zt7YQib1QCCLxRbrDe0kfPKHTdFs8k7rFsWnHVqqDug4UEOrIKuWVlbLix44Z6pC7j jOcscvRNuC/4wYpeY05aT0zxVLfj20JMOTOWtwoBQs4u6wvF+whWCMkRZDXmetQMixkk g+ICNWZ5LZhc0L/u0N69pF1B6So7U2JNjRa79SAFkd7pzwUguoJmDKf9sWFKIshQDXa1 li7sAVHJ5PSu2mIayLF6L4Ttofh4IVf6YnOnVhJiO0ssNUtowMyF8TWgYR6qk7z0u8f9 6mgnWz2Y8oVT3QBxXxJea9JVVo6rIishauy8WGKWnlQom5xUzoZoZC4EZkDOtq+nM8Am 1o4g== X-Gm-Message-State: AOAM530eCIimGV7esCoOU6kaxyruXIsAi8MTAtG4rRWL/cesF8jTU/o5 mfSvp5XbIdf3kV4qfygqjTw= X-Google-Smtp-Source: ABdhPJw/N2op2Uxi/kwz4LGjYFJh3Qqomck6LBPlozNwSrrNumk2iSuJopvVid2EZYAmC8bTzD+X1w== X-Received: by 2002:a05:6512:151f:b0:44a:2508:1d01 with SMTP id bq31-20020a056512151f00b0044a25081d01mr17193123lfb.675.1648913786384; Sat, 02 Apr 2022 08:36:26 -0700 (PDT) Received: from rsa-laptop.rossosh.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z18-20020a2e3512000000b0024b12b5044csm52884ljz.89.2022.04.02.08.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Apr 2022 08:36:26 -0700 (PDT) From: Sergey Ryazanov To: Kalle Valo Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH RFC 2/3] ath10k: turn rawmode into frame_mode Date: Sat, 2 Apr 2022 18:36:14 +0300 Message-Id: <20220402153615.9593-3-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220402153615.9593-1-ryazanov.s.a@gmail.com> References: <20220402153615.9593-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Turn boolean rawmode module param into integer frame_mode param that contains value from ath10k_hw_txrx_mode enum. As earlier the default param value is non-RAW (native Wi-Fi) encapsulation. The param name is selected to be consistent with the similar ath11k param. This is a preparation step for upcoming encapsulation offloading support. Signed-off-by: Sergey Ryazanov --- drivers/net/wireless/ath/ath10k/core.c | 11 +++++++---- drivers/net/wireless/ath/ath10k/core.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 2092bfd02cd1..b74b6f5a7178 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -33,9 +33,11 @@ EXPORT_SYMBOL(ath10k_debug_mask); static unsigned int ath10k_cryptmode_param; static bool uart_print; static bool skip_otp; -static bool rawmode; static bool fw_diag_log; +/* frame mode values are mapped as per enum ath10k_hw_txrx_mode */ +unsigned int ath10k_frame_mode = ATH10K_HW_TXRX_NATIVE_WIFI; + unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) | BIT(ATH10K_FW_CRASH_DUMP_CE_DATA); @@ -44,15 +46,16 @@ module_param_named(debug_mask, ath10k_debug_mask, uint, 0644); module_param_named(cryptmode, ath10k_cryptmode_param, uint, 0644); module_param(uart_print, bool, 0644); module_param(skip_otp, bool, 0644); -module_param(rawmode, bool, 0644); module_param(fw_diag_log, bool, 0644); +module_param_named(frame_mode, ath10k_frame_mode, uint, 0644); module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444); MODULE_PARM_DESC(debug_mask, "Debugging mask"); MODULE_PARM_DESC(uart_print, "Uart target debugging"); MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode"); MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software"); -MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath"); +MODULE_PARM_DESC(frame_mode, + "Datapath frame mode (0: raw, 1: native wifi (default))"); MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file"); MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging"); @@ -2588,7 +2591,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) ar->htt.max_num_amsdu = ATH10K_HTT_MAX_NUM_AMSDU_DEFAULT; ar->htt.max_num_ampdu = ATH10K_HTT_MAX_NUM_AMPDU_DEFAULT; - if (rawmode) { + if (ath10k_frame_mode == ATH10K_HW_TXRX_RAW) { if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT, fw_file->fw_features)) { ath10k_err(ar, "rawmode = 1 requires support from firmware"); diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 9f6680b3be0a..a27d450bbeb8 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -1317,6 +1317,7 @@ static inline bool ath10k_peer_stats_enabled(struct ath10k *ar) return false; } +extern unsigned int ath10k_frame_mode; extern unsigned long ath10k_coredump_mask; void ath10k_core_napi_sync_disable(struct ath10k *ar); From patchwork Sat Apr 2 16:01:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 556169 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 E011AC433FE for ; Sat, 2 Apr 2022 16:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357611AbiDBQDj (ORCPT ); Sat, 2 Apr 2022 12:03:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357730AbiDBQDS (ORCPT ); Sat, 2 Apr 2022 12:03:18 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E367B67D2B for ; Sat, 2 Apr 2022 09:01:24 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 5so9977261lfp.1 for ; Sat, 02 Apr 2022 09:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ICNgre31Vkr1jiI14jV6Rv7hm2wKM+f1gjZng17AJZo=; b=hWdHRFRgHDWMQl+QOCEb3CZjOiPpkHEk/X7UMBjdk0gRucuZzJhR0kvnTebuLgKrmH rGZBU6Q6QL7ln5iX9pKVC593KAYi/j3htHYz/zQ+YD4D9dOrWDc+LyFaipd6VqT0BOyz UgN8i/bNxgw85Fb3zx1v4xzlDHEawC8ys9+UVq3Ie5FnP49Sx+jSKaYeaCYtqmvsMqKd 79rwsHsWYzA3fe4M74brUkQj8h7L7FrXlrjgUDklSyvHtldJkMxi65/rja/46dsnK9WJ aL6uPs0Wh7y6LJwQgpJM7p/lRcbPHspUcBfgUxtCryHXh7nqKYmpZjjocyblvNSpaeQR cLMQ== 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=ICNgre31Vkr1jiI14jV6Rv7hm2wKM+f1gjZng17AJZo=; b=736GuWX6i4BDVmmRVHIwohIG+GoeUp8xEfAizQiY5vIKZZ6Jyw5Wq4CVBX8TQJ6JVi eZKRjHzSfGjY0zJOAg38ZM8pGlsbE1/rB1tk3+c97NByPWWTiU9zbdtTIEAwMmDtBUzE f1SAkkvwaylQdx2JDZ38TEl3anXHcf9KBqgkDv/WnjKUX1nygNQKjLsLQRMb9jyMDQ92 pLGL8S7zGYQWYrIfHU+jCG6GjussMzY+l0bpF9YrUKNJh/VWP8zl7X3uCyxsn8oz7VyW ozBrOmuCcdxfYWxYs1HBRFlAmh/s59wCmesnEu+ZkM+080/yRi5TWXz6BQcozaD/hCY3 pR+w== X-Gm-Message-State: AOAM531dNQnvU7KSrRDYujHgNGhifw1i2DNedy2sBDqKW6P3ZNtBq7Pe qP2Xw9CdbcNkInV42YK6CGI= X-Google-Smtp-Source: ABdhPJx+jfO1oobwtGuVgAl+93Oe7StQqmvwAKxRsFrqHCVaMM9OpXcShpEVTTwScI3cjGVzCsyTZw== X-Received: by 2002:ac2:50d1:0:b0:44a:12e5:9d3e with SMTP id h17-20020ac250d1000000b0044a12e59d3emr17878713lfm.25.1648915281518; Sat, 02 Apr 2022 09:01:21 -0700 (PDT) Received: from rsa-laptop.rossosh.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id f25-20020a193819000000b0044a59b380c0sm558775lfa.68.2022.04.02.09.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Apr 2022 09:01:21 -0700 (PDT) From: Sergey Ryazanov To: Kalle Valo Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH RFC 3/3] ath10k: add encapsulation offloading support Date: Sat, 2 Apr 2022 19:01:11 +0300 Message-Id: <20220402160111.12877-1-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220402153615.9593-1-ryazanov.s.a@gmail.com> References: <20220402153615.9593-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Frame encapsulation from Ethernet into the IEEE 802.11 frame format takes a considerable host CPU time on the xmit path. The firmware is able to do this operation for us, so enable encapsulation offloading for AP and Sta interface types to improve overall system performance. The driver is almost ready for encapsulation offloading support. There are only a few places where the driver assumes the frame format is IEEE 802.11 that need to be fixed. Encapsulation offloading is currently disabled by default and the driver utilizes mac80211 encapsulation support. To activate offloading, the frame_mode=2 parameter should be passed during module loading. On a QCA9563+QCA9888-based access point in bridged mode, encapsulation offloading increases TCP 16-streams DL throughput from 365 to 396 mbps (+8%) and UDP DL throughput from 436 to 483 mbps (+11%). Tested-on: QCA9888 hw 2.0 10.4-3.9.0.2-00131 Signed-off-by: Sergey Ryazanov --- drivers/net/wireless/ath/ath10k/core.c | 2 +- drivers/net/wireless/ath/ath10k/mac.c | 67 +++++++++++++++++++++----- 2 files changed, 55 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index b74b6f5a7178..f8f28682c431 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -55,7 +55,7 @@ MODULE_PARM_DESC(uart_print, "Uart target debugging"); MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode"); MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software"); MODULE_PARM_DESC(frame_mode, - "Datapath frame mode (0: raw, 1: native wifi (default))"); + "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)"); MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file"); MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging"); diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index b11aaee8b8c0..0886e141aad4 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3710,6 +3710,9 @@ ath10k_mac_tx_h_get_txmode(struct ath10k *ar, const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); __le16 fc = hdr->frame_control; + if (IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) + return ATH10K_HW_TXRX_ETHERNET; + if (!vif || vif->type == NL80211_IFTYPE_MONITOR) return ATH10K_HW_TXRX_RAW; @@ -3870,6 +3873,12 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar, bool noack = false; cb->flags = 0; + + if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { + cb->flags |= ATH10K_SKB_F_QOS; /* Assume data frames are QoS */ + goto finish_cb_fill; + } + if (!ath10k_tx_h_use_hwcrypto(vif, skb)) cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; @@ -3908,6 +3917,7 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar, cb->flags |= ATH10K_SKB_F_RAW_TX; } +finish_cb_fill: cb->vif = vif; cb->txq = txq; cb->airtime_est = airtime; @@ -4031,7 +4041,11 @@ static int ath10k_mac_tx(struct ath10k *ar, ath10k_tx_h_seq_no(vif, skb); break; case ATH10K_HW_TXRX_ETHERNET: - ath10k_tx_h_8023(skb); + /* Convert 802.11->802.3 header only if the frame was erlier + * encapsulated to 802.11 by mac80211. Otherwise pass it as is. + */ + if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) + ath10k_tx_h_8023(skb); break; case ATH10K_HW_TXRX_RAW: if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && @@ -4643,12 +4657,10 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif = info->control.vif; struct ieee80211_sta *sta = control->sta; struct ieee80211_txq *txq = NULL; - struct ieee80211_hdr *hdr = (void *)skb->data; enum ath10k_hw_txrx_mode txmode; enum ath10k_mac_tx_path txpath; bool is_htt; bool is_mgmt; - bool is_presp; int ret; u16 airtime; @@ -4662,8 +4674,14 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw, is_mgmt = (txpath == ATH10K_MAC_TX_HTT_MGMT); if (is_htt) { + bool is_presp = false; + spin_lock_bh(&ar->htt.tx_lock); - is_presp = ieee80211_is_probe_resp(hdr->frame_control); + if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { + struct ieee80211_hdr *hdr = (void *)skb->data; + + is_presp = ieee80211_is_probe_resp(hdr->frame_control); + } ret = ath10k_htt_tx_inc_pending(htt); if (ret) { @@ -5447,6 +5465,30 @@ static int ath10k_mac_set_txbf_conf(struct ath10k_vif *arvif) ar->wmi.vdev_param->txbf, value); } +static void ath10k_update_vif_offload(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) +{ + struct ath10k_vif *arvif = (void *)vif->drv_priv; + struct ath10k *ar = hw->priv; + u32 vdev_param; + int ret; + + if (ath10k_frame_mode != ATH10K_HW_TXRX_ETHERNET || + ar->wmi.vdev_param->tx_encap_type == WMI_VDEV_PARAM_UNSUPPORTED || + (vif->type != NL80211_IFTYPE_STATION && + vif->type != NL80211_IFTYPE_AP)) + vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; + + vdev_param = ar->wmi.vdev_param->tx_encap_type; + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, + ATH10K_HW_TXRX_NATIVE_WIFI); + /* 10.X firmware does not support this VDEV parameter. Do not warn */ + if (ret && ret != -EOPNOTSUPP) { + ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", + arvif->vdev_id, ret); + } +} + /* * TODO: * Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE, @@ -5656,15 +5698,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, arvif->def_wep_key_idx = -1; - vdev_param = ar->wmi.vdev_param->tx_encap_type; - ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, - ATH10K_HW_TXRX_NATIVE_WIFI); - /* 10.X firmware does not support this VDEV parameter. Do not warn */ - if (ret && ret != -EOPNOTSUPP) { - ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", - arvif->vdev_id, ret); - goto err_vdev_delete; - } + ath10k_update_vif_offload(hw, vif); /* Configuring number of spatial stream for monitor interface is causing * target assert in qca9888 and qca6174. @@ -9353,6 +9387,7 @@ static const struct ieee80211_ops ath10k_ops = { .stop = ath10k_stop, .config = ath10k_config, .add_interface = ath10k_add_interface, + .update_vif_offload = ath10k_update_vif_offload, .remove_interface = ath10k_remove_interface, .configure_filter = ath10k_configure_filter, .bss_info_changed = ath10k_bss_info_changed, @@ -10022,6 +10057,12 @@ int ath10k_mac_register(struct ath10k *ar) if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map)) ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA); + if (ath10k_frame_mode == ATH10K_HW_TXRX_ETHERNET) { + if (ar->wmi.vdev_param->tx_encap_type != + WMI_VDEV_PARAM_UNSUPPORTED) + ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); + } + ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; ar->hw->wiphy->max_remain_on_channel_duration = 5000;