From patchwork Thu May 9 20:15:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 10937617 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 C8979924 for ; Thu, 9 May 2019 20:16:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B986928A3A for ; Thu, 9 May 2019 20:16:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD9C228A74; Thu, 9 May 2019 20:16: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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0671528A3A for ; Thu, 9 May 2019 20:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=iB8hfcyckV1h1+B9wy4WNghXHdlTvBIljGnFQ2WdTlI=; b=OkZ2ui+DfslJG5STL0d/Bu+5Nl dNaHr5qVIRblYOkTptVkYAZPUC55oD2Xj5IeyGES1MSEFV+jD1rNeDY1EJvdZHWEdl4SNV/U9aEu7 ga3XqVMpRENhP+97YSdR8xRuFnnHmJjvbI2SLTa+I2oKw+BS431X8+4TJx3HtAM798Qw9XSOo1ENk VAVQKGDHtlhiiCyARSmOB5V7lz4fIB+PtOR8Y9UUw3x+Pd4GGU9KJq/0Ja1bVGV0UdJibAFMRT7DD xa5wUdX74cdAu4sqvvhoumehRyrFPoWUr+kSprIWMr6kFdn76KkH0Y3bu1K2JHWWcffipL5KUTcoz 1ciVfWDQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSW-0003Vo-T5; Thu, 09 May 2019 20:16:04 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSU-0003UB-1V for ath11k@lists.infradead.org; Thu, 09 May 2019 20:16:03 +0000 Received: from p548c83e0.dip0.t-ipconnect.de ([84.140.131.224] helo=bertha.fritz.box) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hOpSR-0006sS-GT; Thu, 09 May 2019 22:15:59 +0200 From: John Crispin To: Kalle Valo Subject: [PATCH V4 1/5] ath11k: move phymode selection from function to array lookup Date: Thu, 9 May 2019 22:15:46 +0200 Message-Id: <20190509201550.3977-2-john@phrozen.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190509201550.3977-1-john@phrozen.org> References: <20190509201550.3977-1-john@phrozen.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190509_131602_245482_017000D6 X-CRM114-Status: GOOD ( 12.33 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashidhar Lakkavalli , ath11k@lists.infradead.org, John Crispin MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP With HE support getting added, the approach of using functions will quickly get convoluted. Change the code to use an array lookup function instead. Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/mac.c | 116 +++++++++++++++------------------- include/uapi/linux/nl80211.h | 4 ++ 2 files changed, 56 insertions(+), 64 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 94a87d0fb08e..cd7fb9a13639 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -105,6 +105,51 @@ static struct ieee80211_rate ath11k_legacy_rates[] = { { .bitrate = 540, .hw_value = ATH11K_HW_RATE_OFDM_54M }, }; +static int ath11k_phymodes[NUM_NL80211_BANDS][2][__NL80211_CHAN_WIDTH_NUM] = { + [NL80211_BAND_2GHZ] = { + { + [NL80211_CHAN_WIDTH_5] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_10] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_20_NOHT] = MODE_11G, + [NL80211_CHAN_WIDTH_20] = MODE_11NG_HT20, + [NL80211_CHAN_WIDTH_40] = MODE_11NG_HT40, + [NL80211_CHAN_WIDTH_80] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_80P80] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_160] = MODE_UNKNOWN, + }, { + [NL80211_CHAN_WIDTH_5] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_10] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_20_NOHT] = MODE_11G, + [NL80211_CHAN_WIDTH_20] = MODE_11AX_HE20_2G, + [NL80211_CHAN_WIDTH_40] = MODE_11AX_HE40_2G, + [NL80211_CHAN_WIDTH_80] = MODE_11AX_HE80_2G, + [NL80211_CHAN_WIDTH_80P80] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_160] = MODE_UNKNOWN, + }, + }, + [NL80211_BAND_5GHZ] = { + { + [NL80211_CHAN_WIDTH_5] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_10] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_20_NOHT] = MODE_11A, + [NL80211_CHAN_WIDTH_20] = MODE_11AC_VHT20, + [NL80211_CHAN_WIDTH_40] = MODE_11AC_VHT40, + [NL80211_CHAN_WIDTH_80] = MODE_11AC_VHT80, + [NL80211_CHAN_WIDTH_160] = MODE_11AC_VHT160, + [NL80211_CHAN_WIDTH_80P80] = MODE_11AC_VHT80_80, + }, { + [NL80211_CHAN_WIDTH_5] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_10] = MODE_UNKNOWN, + [NL80211_CHAN_WIDTH_20_NOHT] = MODE_11A, + [NL80211_CHAN_WIDTH_20] = MODE_11AX_HE20, + [NL80211_CHAN_WIDTH_40] = MODE_11AX_HE40, + [NL80211_CHAN_WIDTH_80] = MODE_11AX_HE80, + [NL80211_CHAN_WIDTH_160] = MODE_11AX_HE160, + [NL80211_CHAN_WIDTH_80P80] = MODE_11AX_HE80_80, + }, + }, +}; + #define ATH11K_MAC_FIRST_OFDM_RATE_IDX 4 #define ath11k_g_rates ath11k_legacy_rates #define ath11k_g_rates_size (ARRAY_SIZE(ath11k_legacy_rates)) @@ -151,69 +196,6 @@ static int get_num_chains(u32 mask) return num_chains; } -static inline enum wmi_phy_mode -chan_to_phymode(const struct cfg80211_chan_def *chandef) -{ - enum wmi_phy_mode phymode = MODE_UNKNOWN; - - switch (chandef->chan->band) { - case NL80211_BAND_2GHZ: - switch (chandef->width) { - case NL80211_CHAN_WIDTH_20_NOHT: - if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM) - phymode = MODE_11B; - else - phymode = MODE_11G; - break; - case NL80211_CHAN_WIDTH_20: - phymode = MODE_11NG_HT20; - break; - case NL80211_CHAN_WIDTH_40: - phymode = MODE_11NG_HT40; - break; - case NL80211_CHAN_WIDTH_5: - case NL80211_CHAN_WIDTH_10: - case NL80211_CHAN_WIDTH_80: - case NL80211_CHAN_WIDTH_80P80: - case NL80211_CHAN_WIDTH_160: - phymode = MODE_UNKNOWN; - break; - } - break; - case NL80211_BAND_5GHZ: - switch (chandef->width) { - case NL80211_CHAN_WIDTH_20_NOHT: - phymode = MODE_11A; - break; - case NL80211_CHAN_WIDTH_20: - phymode = MODE_11AC_VHT20; - break; - case NL80211_CHAN_WIDTH_40: - phymode = MODE_11AC_VHT40; - break; - case NL80211_CHAN_WIDTH_80: - phymode = MODE_11AC_VHT80; - break; - case NL80211_CHAN_WIDTH_160: - phymode = MODE_11AC_VHT160; - break; - case NL80211_CHAN_WIDTH_80P80: - phymode = MODE_11AC_VHT80_80; - break; - case NL80211_CHAN_WIDTH_5: - case NL80211_CHAN_WIDTH_10: - phymode = MODE_UNKNOWN; - break; - } - break; - default: - break; - } - - WARN_ON(phymode == MODE_UNKNOWN); - return phymode; -} - u8 ath11k_mac_bitrate_to_idx(const struct ieee80211_supported_band *sband, u32 bitrate) { @@ -3877,6 +3859,7 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, struct ath11k_base *ab = ar->ab; struct wmi_vdev_start_req_arg arg = {}; int ret = 0; + int he_support = arvif->vif->bss_conf.he_support; lockdep_assert_held(&ar->conf_mutex); @@ -3889,7 +3872,12 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, arg.channel.freq = chandef->chan->center_freq; arg.channel.band_center_freq1 = chandef->center_freq1; arg.channel.band_center_freq2 = chandef->center_freq2; - arg.channel.mode = chan_to_phymode(chandef); + arg.channel.mode = + ath11k_phymodes[chandef->chan->band][he_support][chandef->width]; + if (arg.channel.mode == MODE_11G && + chandef->chan->flags & IEEE80211_CHAN_NO_OFDM) + arg.channel.mode = MODE_11B; + WARN_ON(arg.channel.mode == MODE_UNKNOWN); arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 31ae5c7f10e3..64b890b4df33 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4142,6 +4142,10 @@ enum nl80211_chan_width { NL80211_CHAN_WIDTH_160, NL80211_CHAN_WIDTH_5, NL80211_CHAN_WIDTH_10, + + /* keep last */ + __NL80211_CHAN_WIDTH_NUM, + NL80211_CHAN_WIDTH_MAX = __NL80211_CHAN_WIDTH_NUM - 1, }; /** From patchwork Thu May 9 20:15:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 10937615 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 D32C513AD for ; Thu, 9 May 2019 20:16:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C51691FF60 for ; Thu, 9 May 2019 20:16:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B936928A74; Thu, 9 May 2019 20:16:06 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0662B289BC for ; Thu, 9 May 2019 20:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Q9NTT+8S16WOMFoE+XKBnz13dmISqB0JRyj19S/ljQs=; b=GxalzI1zE95I/qpAjuBMmOVmJE Hzma/nnbUbqOycrUHF2JyfjwKXD8PEDiWjkmWy5rgYsaFSlbpvyHvYyq9gu3PT4U2cIMrD9UW7Lbf lsEjcauWNvZoZ+ZzXvFeVag7Z5rwE5jaSPUwidTpV3tAjLBDdBWND1HKatTLdcrqiUzC2R/JWuVBH I4X8Rg9ffZBh6UOLXEcL6LQlJxXvBfP5eYnExs8SJJR/0zydaimKJ+BZTo1W5UsqH96h1xqek1fZv fUKCFZE+3SKjwPiRoXHUqCVvAw+lknQCU9oe8UllBxf3EtClka/BRUoQLfPRPLTaUaKK77cnqZWTv kSJQy4ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSX-0003Vx-3d; Thu, 09 May 2019 20:16:05 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSU-0003UC-67 for ath11k@lists.infradead.org; Thu, 09 May 2019 20:16:03 +0000 Received: from p548c83e0.dip0.t-ipconnect.de ([84.140.131.224] helo=bertha.fritz.box) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hOpSR-0006sS-UM; Thu, 09 May 2019 22:16:00 +0200 From: John Crispin To: Kalle Valo Subject: [PATCH V4 2/5] ath11k: add HE handling to the debug code Date: Thu, 9 May 2019 22:15:47 +0200 Message-Id: <20190509201550.3977-3-john@phrozen.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190509201550.3977-1-john@phrozen.org> References: <20190509201550.3977-1-john@phrozen.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190509_131602_379839_76079F78 X-CRM114-Status: GOOD ( 12.79 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashidhar Lakkavalli , ath11k@lists.infradead.org, John Crispin MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch allows the driver to also show the HE counters and stats. Also extend the appropriate debug prints with HE info. Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/core.h | 2 ++ drivers/net/wireless/ath/ath11k/debugfs_sta.c | 24 ++++++++++++++++++++++-- drivers/net/wireless/ath/ath11k/dp_rx.c | 3 ++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index c8c1cd668c04..d17af2255465 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -253,6 +253,7 @@ struct ath11k_peer { struct dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1]; }; +#define ATH11K_HE_MCS_NUM 12 #define ATH11K_VHT_MCS_NUM 10 #define ATH11K_BW_NUM 4 #define ATH11K_NSS_NUM 4 @@ -306,6 +307,7 @@ struct ath11k_htt_data_stats { u64 legacy[ATH11K_COUNTER_TYPE_MAX][ATH11K_LEGACY_NUM]; u64 ht[ATH11K_COUNTER_TYPE_MAX][ATH11K_HT_MCS_NUM]; u64 vht[ATH11K_COUNTER_TYPE_MAX][ATH11K_VHT_MCS_NUM]; + u64 he[ATH11K_COUNTER_TYPE_MAX][ATH11K_HE_MCS_NUM]; u64 bw[ATH11K_COUNTER_TYPE_MAX][ATH11K_BW_NUM]; u64 nss[ATH11K_COUNTER_TYPE_MAX][ATH11K_NSS_NUM]; u64 gi[ATH11K_COUNTER_TYPE_MAX][ATH11K_GI_NUM]; diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c index c39b6e1d22c3..cff6a3f048ea 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c +++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c @@ -45,7 +45,14 @@ ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta, #define STATS_OP_FMT(name) tx_stats->stats[ATH11K_STATS_TYPE_##name] - if (txrate->flags & RATE_INFO_FLAGS_VHT_MCS) { + if (txrate->flags & RATE_INFO_FLAGS_HE_MCS) { + STATS_OP_FMT(SUCC).he[0][mcs] += peer_stats->succ_bytes; + STATS_OP_FMT(SUCC).he[1][mcs] += peer_stats->succ_pkts; + STATS_OP_FMT(FAIL).he[0][mcs] += peer_stats->failed_bytes; + STATS_OP_FMT(FAIL).he[1][mcs] += peer_stats->failed_pkts; + STATS_OP_FMT(RETRY).he[0][mcs] += peer_stats->retry_bytes; + STATS_OP_FMT(RETRY).he[1][mcs] += peer_stats->retry_pkts; + } else if (txrate->flags & RATE_INFO_FLAGS_VHT_MCS) { STATS_OP_FMT(SUCC).vht[0][mcs] += peer_stats->succ_bytes; STATS_OP_FMT(SUCC).vht[1][mcs] += peer_stats->succ_pkts; STATS_OP_FMT(FAIL).vht[0][mcs] += peer_stats->failed_bytes; @@ -73,7 +80,12 @@ ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta, if (peer_stats->is_ampdu) { tx_stats->ba_fails += peer_stats->ba_fails; - if (txrate->flags & RATE_INFO_FLAGS_MCS) { + if (txrate->flags & RATE_INFO_FLAGS_HE_MCS) { + STATS_OP_FMT(AMPDU).he[0][mcs] += + peer_stats->succ_bytes + peer_stats->retry_bytes; + STATS_OP_FMT(AMPDU).he[1][mcs] += + peer_stats->succ_pkts + peer_stats->retry_pkts; + } else if (txrate->flags & RATE_INFO_FLAGS_MCS) { STATS_OP_FMT(AMPDU).ht[0][mcs] += peer_stats->succ_bytes + peer_stats->retry_bytes; STATS_OP_FMT(AMPDU).ht[1][mcs] += @@ -230,6 +242,14 @@ static ssize_t ath11k_dbg_sta_dump_tx_stats(struct file *file, str_name[k], str[j]); len += scnprintf(buf + len, size - len, + " HE MCS %s\n", + str[j]); + for (i = 0; i < ATH11K_HE_MCS_NUM; i++) + len += scnprintf(buf + len, size - len, + " %llu ", + stats->he[j][i]); + len += scnprintf(buf + len, size - len, "\n"); + len += scnprintf(buf + len, size - len, " VHT MCS %s\n", str[j]); for (i = 0; i < ATH11K_VHT_MCS_NUM; i++) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 0796f3ba8333..c8fa2681ddb0 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1812,7 +1812,7 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *nap status = IEEE80211_SKB_RXCB(msdu); ath11k_dbg(ar->ab, ATH11K_DBG_DATA, - "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n", + "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n", msdu, msdu->len, ieee80211_get_SA(hdr), @@ -1823,6 +1823,7 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *nap (status->encoding == RX_ENC_LEGACY) ? "legacy" : "", (status->encoding == RX_ENC_HT) ? "ht" : "", (status->encoding == RX_ENC_VHT) ? "vht" : "", + (status->encoding == RX_ENC_HE) ? "he" : "", (status->bw == RATE_INFO_BW_40) ? "40" : "", (status->bw == RATE_INFO_BW_80) ? "80" : "", (status->bw == RATE_INFO_BW_160) ? "160" : "", From patchwork Thu May 9 20:15:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 10937625 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 476A5924 for ; Thu, 9 May 2019 20:16:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 373A71FF60 for ; Thu, 9 May 2019 20:16:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B5CC28A3A; Thu, 9 May 2019 20:16:10 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6BB591FF60 for ; Thu, 9 May 2019 20:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qOOKazYNvEfLjbiY1aBirnt9HHR3cdXhO1xuX6G21QY=; b=HIdKBjUnzBXKDDIoWOa9CCvUvR 833C8yEweoq3TBCIw/7bsFDl5oGjKxzIAHQXj1HV85Oyup1SSWbLEXZy3AG86cmrdfQCFe9YvZBXF WvKfvJHir0V/0CyyRHvpgJUsgKKost/rTmj7PFMJ9wSna0wQNN/kPWwH4fUo+Ll2h/2quGmoGR94b jZpFNtyJ6fgyfQmblQXFHtti6hSJU+J0SjtGQ/DW9hQyp8TtM/6WoR1nm740kcpKC6Nk3NlMRDQ2k L53Q5hLfo0RrBbMFHxkasaIKzLk6NDMXbjykZcDOfeWzgDcN05R21i/ucV28L6vrgJmPH2kwE6WvM 8IZRCDfQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSY-0003X7-LS; Thu, 09 May 2019 20:16:06 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSU-0003UG-Ha for ath11k@lists.infradead.org; Thu, 09 May 2019 20:16:05 +0000 Received: from p548c83e0.dip0.t-ipconnect.de ([84.140.131.224] helo=bertha.fritz.box) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hOpSS-0006sS-8u; Thu, 09 May 2019 22:16:00 +0200 From: John Crispin To: Kalle Valo Subject: [PATCH V4 3/5] ath11k: extend reading of FW capabilities Date: Thu, 9 May 2019 22:15:48 +0200 Message-Id: <20190509201550.3977-4-john@phrozen.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190509201550.3977-1-john@phrozen.org> References: <20190509201550.3977-1-john@phrozen.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190509_131602_742821_1EB19FD0 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashidhar Lakkavalli , ath11k@lists.infradead.org, John Crispin MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Read the additional mcs and extended mac capabilities field from the service ready callback and store them inside the ath11k_pdev_cap structure. This allows us to generate the sband_iftype_data dynamically. Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/core.h | 3 ++- drivers/net/wireless/ath/ath11k/wmi.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index d17af2255465..50032e701255 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -521,7 +521,7 @@ struct ath11k { struct ath11k_band_cap { u32 max_bw_supported; u32 ht_cap_info; - u32 he_cap_info; + u32 he_cap_info[2]; u32 he_mcs; u32 he_cap_phy_info[PSOC_HOST_MAX_PHY_SIZE]; struct ath11k_ppe_threshold he_ppet; @@ -532,6 +532,7 @@ struct ath11k_pdev_cap { u32 ampdu_density; u32 vht_cap; u32 vht_mcs; + u32 he_mcs; u32 tx_chain_mask; u32 rx_chain_mask; u32 tx_chain_mask_shift; diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 5712ac030419..1856dbcc1859 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -325,6 +325,7 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext( } else if (mac_phy_caps->supported_bands & WMI_HOST_WLAN_5G_CAP) { pdev_cap->vht_cap = mac_phy_caps->vht_cap_info_5g; pdev_cap->vht_mcs = mac_phy_caps->vht_supp_mcs_5g; + pdev_cap->he_mcs = mac_phy_caps->he_supp_mcs_5g; pdev_cap->tx_chain_mask = mac_phy_caps->tx_chain_mask_5g; pdev_cap->rx_chain_mask = mac_phy_caps->rx_chain_mask_5g; } else { @@ -347,7 +348,8 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext( cap_band = &pdev_cap->band[NL80211_BAND_2GHZ]; cap_band->max_bw_supported = mac_phy_caps->max_bw_supported_2g; cap_band->ht_cap_info = mac_phy_caps->ht_cap_info_2g; - cap_band->he_cap_info = mac_phy_caps->he_cap_info_2g; + cap_band->he_cap_info[0] = mac_phy_caps->he_cap_info_2g; + cap_band->he_cap_info[1] = mac_phy_caps->he_cap_info_2g_ext; cap_band->he_mcs = mac_phy_caps->he_supp_mcs_2g; memcpy(cap_band->he_cap_phy_info, &mac_phy_caps->he_cap_phy_info_2g, sizeof(u32) * PSOC_HOST_MAX_PHY_SIZE); @@ -357,7 +359,8 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext( cap_band = &pdev_cap->band[NL80211_BAND_5GHZ]; cap_band->max_bw_supported = mac_phy_caps->max_bw_supported_5g; cap_band->ht_cap_info = mac_phy_caps->ht_cap_info_5g; - cap_band->he_cap_info = mac_phy_caps->he_cap_info_5g; + cap_band->he_cap_info[0] = mac_phy_caps->he_cap_info_5g; + cap_band->he_cap_info[1] = mac_phy_caps->he_cap_info_5g_ext; cap_band->he_mcs = mac_phy_caps->he_supp_mcs_5g; memcpy(cap_band->he_cap_phy_info, &mac_phy_caps->he_cap_phy_info_5g, sizeof(u32) * PSOC_HOST_MAX_PHY_SIZE); From patchwork Thu May 9 20:15:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 10937619 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 A6CAE924 for ; Thu, 9 May 2019 20:16:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98E08289BC for ; Thu, 9 May 2019 20:16:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D01928A7E; Thu, 9 May 2019 20:16:08 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F114289BC for ; Thu, 9 May 2019 20:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=MbQOmi3vOkPOk3Tf0aE4INtZ+HOPGOMqFZUF0WuuFQc=; b=px4KOiQuZIO01w7cK1aMhOH72Y yT9JewT1lg98ALgQAQ2pZAG6llYtprVKUpEOwxYPClXT0I6ncpdciXzatV+XjAq0xdX02fdXZw7o0 KImYwxfCLdj0kC3X+ev/skpXY9jdpn13BTYm8FvkZC2dY1SMw8ZJtHVz2RvIeUhmiCH0TbaQQ8qMz 34DOFtcOVS23DvoV1D/LNmTTP6aASgYIkwBr9fzWRSmLIwsRhkgl49lA+AgLBveziZ/Gl1kn8/mMr h5L7g+QvOp9EJrvYZk09hP58l2NQUJs+ZzHwkYQvHwobGRxtn5ke/A6klDK81ZYix77G/RgwdfIvh 4nxalCkQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSY-0003Wr-E5; Thu, 09 May 2019 20:16:06 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSU-0003UI-N9 for ath11k@lists.infradead.org; Thu, 09 May 2019 20:16:05 +0000 Received: from p548c83e0.dip0.t-ipconnect.de ([84.140.131.224] helo=bertha.fritz.box) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hOpSS-0006sS-Pq; Thu, 09 May 2019 22:16:00 +0200 From: John Crispin To: Kalle Valo Subject: [PATCH V4 4/5] ath11k: handle rx status for HE frames Date: Thu, 9 May 2019 22:15:49 +0200 Message-Id: <20190509201550.3977-5-john@phrozen.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190509201550.3977-1-john@phrozen.org> References: <20190509201550.3977-1-john@phrozen.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190509_131602_903873_3225F2D9 X-CRM114-Status: GOOD ( 11.30 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashidhar Lakkavalli , ath11k@lists.infradead.org, John Crispin MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The case clause handling HE frames was not handled yet in the code reading the RX status. The new case is identical to VHT with the difference of the higher maximum MCS rate. Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/dp_rx.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index c8fa2681ddb0..82cb3f84df32 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1718,7 +1718,18 @@ static void ath11k_dp_rx_h_rate(struct ath11k *ar, void *rx_desc, rx_status->bw = ath11k_bw_to_mac80211_bw(bw); break; case RX_MSDU_START_PKT_TYPE_11AX: - ath11k_warn(ar->ab, "pkt_type %d not yet supported\n", pkt_type); + rx_status->rate_idx = rate_mcs; + if (rate_mcs > 11) { + ath11k_warn(ar->ab, + "Received with invalid mcs in HE mode %d\n", + rate_mcs); + break; + } + rx_status->encoding = RX_ENC_HE; + rx_status->nss = nss; + if (sgi) + rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI; + rx_status->bw = ath11k_bw_to_mac80211_bw(bw); break; } } From patchwork Thu May 9 20:15:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 10937623 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 7900F924 for ; Thu, 9 May 2019 20:16:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69F4D289BC for ; Thu, 9 May 2019 20:16:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E5FA28A4B; Thu, 9 May 2019 20:16:09 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3885289BC for ; Thu, 9 May 2019 20:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=yLq/7dgCBTuBDNPQVIIAHCwi5Qt5qBOLOCgKhvIP4ts=; b=VbKILVeO0bsacxT6s+6s/nEIZO WyHzfbbS444aEf8JTLwH22+2pGI9ZanCP4uGuimaqJZWHuIZ/NXewAsEzXFvgoykL3tt/qbYVDGdf 4HP63c+PJLBvgxSSWpOhdMALR/yjWWIapuHd2uOL0HlwLJs+I2bkDI0D9GO2ag+xCXNiA3yP1/u5i 74Kj14DUT8Fy/y0F6ojs9cBkRm5cXutDNFZdNNNDMHlB3BrbBr48chCTYe5vzKJxpkPvViVB0qzie t+wpzcraHU/BuvYIw1RUrYKcMhOAqsuQtroXgLKv4QaW2mBx5n4eJhgQgoEr9dMHgvJX5ZFfQz2J/ GoTrUP+w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSZ-0003Y9-TL; Thu, 09 May 2019 20:16:07 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOpSV-0003Uk-G7 for ath11k@lists.infradead.org; Thu, 09 May 2019 20:16:05 +0000 Received: from p548c83e0.dip0.t-ipconnect.de ([84.140.131.224] helo=bertha.fritz.box) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hOpST-0006sS-HK; Thu, 09 May 2019 22:16:01 +0200 From: John Crispin To: Kalle Valo Subject: [PATCH V4 5/5] ath11k: add HE support Date: Thu, 9 May 2019 22:15:50 +0200 Message-Id: <20190509201550.3977-6-john@phrozen.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190509201550.3977-1-john@phrozen.org> References: <20190509201550.3977-1-john@phrozen.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190509_131603_699314_A77D6A3C X-CRM114-Status: GOOD ( 19.66 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashidhar Lakkavalli , ath11k@lists.infradead.org, John Crispin MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add basic HE support to the driver. The sband_iftype data is generated from the capabilities read from the FW. Things that still need to implemented * ppe_threshold support Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/core.h | 2 + drivers/net/wireless/ath/ath11k/mac.c | 173 +++++++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath11k/wmi.h | 5 +- 3 files changed, 171 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 50032e701255..fcb6b1abed09 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -439,6 +439,8 @@ struct ath11k { struct { struct ieee80211_supported_band sbands[NUM_NL80211_BANDS]; + struct ieee80211_sband_iftype_data + iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES]; } mac; unsigned int filter_flags; unsigned long monitor_flags; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index cd7fb9a13639..51003ef3cc37 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -1280,7 +1280,44 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar, struct ieee80211_sta *sta, struct peer_assoc_params *arg) { - /* TODO: Implementation */ + const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; + + if (!he_cap->has_he) + return; + + arg->he_flag = true; + + memcpy(&arg->peer_he_cap_macinfo, he_cap->he_cap_elem.mac_cap_info, + sizeof(arg->peer_he_cap_macinfo)); + memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info, + sizeof(arg->peer_he_cap_phyinfo)); + + if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_RES) + arg->twt_responder = true; + if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ) + arg->twt_requester = true; + + /* TODO - peer_ppet and peer_he_ops need to be set */ + + switch (sta->bandwidth) { + /* TODO - add 80p80 support */ + + case IEEE80211_STA_RX_BW_160: + arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = + he_cap->he_mcs_nss_supp.rx_mcs_160; + arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = + he_cap->he_mcs_nss_supp.tx_mcs_160; + arg->peer_he_mcs_count++; + /* drop through */ + + default: + arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = + he_cap->he_mcs_nss_supp.rx_mcs_80; + arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = + he_cap->he_mcs_nss_supp.tx_mcs_80; + arg->peer_he_mcs_count++; + break; + } } static void ath11k_peer_assoc_h_smps(struct ieee80211_sta *sta, @@ -1447,6 +1484,32 @@ static enum wmi_phy_mode ath11k_mac_get_phymode_vht(struct ath11k *ar, return MODE_UNKNOWN; } +static enum wmi_phy_mode ath11k_mac_get_phymode_he(struct ath11k *ar, + struct ieee80211_sta *sta) +{ + if (sta->bandwidth == IEEE80211_STA_RX_BW_160) { + if (sta->he_cap.he_cap_elem.phy_cap_info[0] & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G) + return MODE_11AX_HE160; + else if (sta->he_cap.he_cap_elem.phy_cap_info[0] & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) + return MODE_11AX_HE80_80; + /* not sure if this is a valid case? */ + return MODE_11AX_HE160; + } + + if (sta->bandwidth == IEEE80211_STA_RX_BW_80) + return MODE_11AX_HE80; + + if (sta->bandwidth == IEEE80211_STA_RX_BW_40) + return MODE_11AX_HE40; + + if (sta->bandwidth == IEEE80211_STA_RX_BW_20) + return MODE_11AX_HE20; + + return MODE_UNKNOWN; +} + static void ath11k_peer_assoc_h_phymode(struct ath11k *ar, struct ieee80211_vif *vif, struct ieee80211_sta *sta, @@ -1468,7 +1531,14 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar, switch (band) { case NL80211_BAND_2GHZ: - if (sta->vht_cap.vht_supported && + if (sta->he_cap.has_he) { + if (sta->bandwidth == IEEE80211_STA_RX_BW_80) + phymode = MODE_11AX_HE80_2G; + else if (sta->bandwidth == IEEE80211_STA_RX_BW_40) + phymode = MODE_11AX_HE40_2G; + else + phymode = MODE_11AX_HE20_2G; + } else if (sta->vht_cap.vht_supported && !ath11k_peer_assoc_h_vht_masked(vht_mcs_mask)) { if (sta->bandwidth == IEEE80211_STA_RX_BW_40) phymode = MODE_11AC_VHT40; @@ -1485,12 +1555,12 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar, } else { phymode = MODE_11B; } - /* TODO: HE */ - break; case NL80211_BAND_5GHZ: - /* Check VHT first */ - if (sta->vht_cap.vht_supported && + /* Check HE first */ + if (sta->he_cap.has_he) { + phymode = ath11k_mac_get_phymode_he(ar, sta); + } else if (sta->vht_cap.vht_supported && !ath11k_peer_assoc_h_vht_masked(vht_mcs_mask)) { phymode = ath11k_mac_get_phymode_vht(ar, sta); } else if (sta->ht_cap.ht_supported && @@ -1502,7 +1572,6 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar, } else { phymode = MODE_11A; } - /* TODO: HE Phymode */ break; default: break; @@ -3076,6 +3145,92 @@ static int ath11k_check_chain_mask(struct ath11k *ar, u32 ant, bool is_tx_ant) return 0; } +static int ath11k_mac_copy_he_cap(struct ath11k_pdev_cap *cap, + struct ieee80211_sband_iftype_data *data, + int band) +{ + int i, idx = 0; + + for (i = 0; i < NUM_NL80211_IFTYPES; i++) { + struct ieee80211_sta_he_cap *he_cap = &data[idx].he_cap; + struct ath11k_band_cap *band_cap = &cap->band[band]; + struct ieee80211_he_cap_elem *he_cap_elem = + &he_cap->he_cap_elem; + + switch (i) { + case NL80211_IFTYPE_STATION: + case NL80211_IFTYPE_AP: + break; + + default: + continue; + } + + data[idx].types_mask = BIT(i); + he_cap->has_he = true; + memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info, + sizeof(he_cap_elem->mac_cap_info)); + memcpy(he_cap_elem->phy_cap_info, band_cap->he_cap_phy_info, + sizeof(he_cap_elem->phy_cap_info)); + + switch (i) { + case NL80211_IFTYPE_STATION: + he_cap_elem->mac_cap_info[0] &= + ~IEEE80211_HE_MAC_CAP0_TWT_RES; + he_cap_elem->mac_cap_info[0] |= + IEEE80211_HE_MAC_CAP0_TWT_REQ; + break; + } + + he_cap->he_mcs_nss_supp.rx_mcs_80 = + cpu_to_le16(band_cap->he_mcs & 0xffff); + he_cap->he_mcs_nss_supp.tx_mcs_80 = + cpu_to_le16(band_cap->he_mcs & 0xffff); + he_cap->he_mcs_nss_supp.rx_mcs_160 = + cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); + he_cap->he_mcs_nss_supp.tx_mcs_160 = + cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); + he_cap->he_mcs_nss_supp.rx_mcs_80p80 = + cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); + he_cap->he_mcs_nss_supp.tx_mcs_80p80 = + cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); + + /* TODO - disable ppe threshold until we can generate the + * field from the fw capabilities + */ + he_cap_elem->phy_cap_info[6] &= + ~IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT; + idx++; + } + + return idx; +} + +static void ath11k_mac_setup_he_cap(struct ath11k *ar, + struct ath11k_pdev_cap *cap) +{ + struct ieee80211_supported_band *band; + int count = 0; + + if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { + count = ath11k_mac_copy_he_cap(cap, + ar->mac.iftype[NL80211_BAND_2GHZ], + NL80211_BAND_2GHZ); + band = &ar->mac.sbands[NL80211_BAND_2GHZ]; + band->iftype_data = ar->mac.iftype[NL80211_BAND_2GHZ]; + } + + if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP) { + count = ath11k_mac_copy_he_cap(cap, + ar->mac.iftype[NL80211_BAND_5GHZ], + NL80211_BAND_5GHZ); + band = &ar->mac.sbands[NL80211_BAND_5GHZ]; + band->iftype_data = ar->mac.iftype[NL80211_BAND_5GHZ]; + } + + band->n_iftype_data = count; +} + static int __ath11k_set_antenna(struct ath11k *ar, u32 tx_ant, u32 rx_ant) { int ret; @@ -3111,8 +3266,9 @@ static int __ath11k_set_antenna(struct ath11k *ar, u32 tx_ant, u32 rx_ant) return ret; } - /* Reload HT/VHT capability */ + /* Reload HT/VHT/HE capability */ ath11k_mac_setup_ht_vht_cap(ar, &ar->pdev->cap, NULL); + ath11k_mac_setup_he_cap(ar, &ar->pdev->cap); return 0; } @@ -4926,6 +5082,7 @@ static int ath11k_mac_register(struct ath11k *ar) goto err_free; ath11k_mac_setup_ht_vht_cap(ar, cap, &ht_cap); + ath11k_mac_setup_he_cap(ar, cap); ar->hw->wiphy->available_antennas_rx = cap->rx_chain_mask; ar->hw->wiphy->available_antennas_tx = cap->tx_chain_mask; diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 5d20f57fbacc..7674fa85301a 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -3842,7 +3842,10 @@ struct wmi_vdev_install_key_arg { #define WMI_MAX_SUPPORTED_RATES 128 #define WMI_HOST_MAX_HECAP_PHY_SIZE 3 -#define WMI_HOST_MAX_HE_RATE_SET 1 +#define WMI_HOST_MAX_HE_RATE_SET 3 +#define WMI_HECAP_TXRX_MCS_NSS_IDX_80 0 +#define WMI_HECAP_TXRX_MCS_NSS_IDX_160 1 +#define WMI_HECAP_TXRX_MCS_NSS_IDX_80_80 2 struct wmi_rate_set_arg { u32 num_rates;