Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp81424lqp; Tue, 21 May 2024 19:39:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLAHA+jiF3xaFt69bSjsERgkx3bStRuXQC7qfJeVjKGXuHHpKe0U9CUtzwlpfGSMP70BThbUV9Ike2Oz5M7RqJa0stQX6CJY6AZ9fMEw== X-Google-Smtp-Source: AGHT+IEHZ5pHYP5l1/eRGKHF3+D59DwSX13ijI3igfu867CGfJdGOetRejs5Qnu3E+wgPG9HAN1B X-Received: by 2002:ac2:5484:0:b0:51c:a0e1:2a44 with SMTP id 2adb3069b0e04-526bd693d11mr299967e87.26.1716345550800; Tue, 21 May 2024 19:39:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716345550; cv=pass; d=google.com; s=arc-20160816; b=sKMJqIOj2wT/PnRK8QVFwEJ0oCxHVcoYV/HpoE4mKwvyT0RwX8jpermwfLiyXnyMKK gFD/6BSg3CPnEQe1Tt5DkQuYFJESrmKASSgYIsgprfBOZuUcapVM4SkbGST8XZVWNNrl HvA7fje+dkiZGHIV8EOLQ9Hc1mxTDqEk3lEYlm1MXflLFWhPIGXdFOJ2lo1JetSVZRSI 5G4PyshEo3D02mxV1PFproH4fbLJVuEzDa3QFB6V4EZ53W370jwYz8BH8zAPMqJIC2f2 ySwrRIDyKxj0ThOfw8MSrDF6OaLPZ1hGmyWwwTzVjU6QInLS73Cv79ZUljFN1zExM0Hn XsMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from; bh=/r1j2GUmRQ3fcb6T+JFbGOOpMy7HBfDB5SvGtQ2xaq8=; fh=i+pR0Y9t94OKZsARqUkLMEmtPQHvmw7bpTYa9QkhXpo=; b=PB6bhtK7ZfHmVc2tgWIOfksNyxhiWZ1AE5rjo/3rZiajzrCcJKoanolBmyX1/rsmOg YVDPyuHJqUWEoVtz8cScRPpoffp5lOYOyuV2Dw/Bv1+Eh+CiUNO0Yp2wnhzoxU0zv+Vu 5k1ZWSodgKH6QfhH51vvGl6DzrUz3RW5rhRVJCFucz1fhlTgD1vo8ICELtbfJMfAfY65 CUcyWzq6pfILujtJ6qoNdku2jGt9KQOwXbGmP4OfbxFo8xWaoKb3aCMzPO200eG3AC55 bbzZRkw++98b65lGPn88g/CsnVahsY0auAgTz68gnaU6W4DiXaWWw2mUt6YQX/vRLLtA phSw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-7927-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7927-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57833b26535si187404a12.24.2024.05.21.19.39.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 19:39:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7927-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-7927-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7927-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4B4F11F22EE6 for ; Wed, 22 May 2024 02:39:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB0042EB07; Wed, 22 May 2024 02:39:03 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16D62322A for ; Wed, 22 May 2024 02:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716345543; cv=none; b=YEgXubYZSwvBjbZV+bEXatfLOBYVObjUoOIrk2r/L6fWjnL21/p4MFUjI2YiO79oI1KxGwRCw8tSCkb9q2LMrOcMTAzdhz5KaY0kCSXRwAnGNyh9ecenVAIf8MT/nLkD1Be/ehJKw4RUer4k55AHjZV+z2WbtfbtfYK9ieyafJM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716345543; c=relaxed/simple; bh=WYaSShRMlPmkbEmNsymT+Fg/3CJya8nIlxPb/GNA+SI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VTggvnBwTgk2HSdDu4tnjvD1IguXnLXry5qCm6Z1Gtp/pawG/ZSEg5UwOv2RhgZqtSF2k/6yPJzLr+UzH2XehTPduwnSKrMa2g3NF8OCuaWmVCj0qMgKppzAthDzVT+AQ8IyLFAmEiMKUSezInymSX/bqgs/8QMDHzaF1OKojJk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 44M2cwx573357146, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 44M2cwx573357146 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 22 May 2024 10:38:58 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 22 May 2024 10:38:58 +0800 Received: from [127.0.1.1] (172.21.69.94) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 22 May 2024 10:38:58 +0800 From: Ping-Ke Shih To: Subject: [PATCH 2/2] wifi: rtw89: add LDPC and STBC to rx_status and radiotap known fields for monitor mode Date: Wed, 22 May 2024 10:38:30 +0800 Message-ID: <20240522023830.9798-2-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240522023830.9798-1-pkshih@realtek.com> References: <20240522023830.9798-1-pkshih@realtek.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) Add LDPC and STBC to rx_status by hardware PPDU status, and set them as known fields of radiotap, so we can check these capabilities in monitor mode. Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/core.c | 36 ++++++++++++++++++++++- drivers/net/wireless/realtek/rtw89/core.h | 2 ++ drivers/net/wireless/realtek/rtw89/txrx.h | 2 ++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index 36d31608157f..3e99b63a7995 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -1557,6 +1557,12 @@ static void rtw89_core_parse_phy_status_ie01(struct rtw89_dev *rtwdev, u32 t; phy_ppdu->chan_idx = le32_get_bits(ie->w0, RTW89_PHY_STS_IE01_W0_CH_IDX); + + if (rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR) { + phy_ppdu->ldpc = le32_get_bits(ie->w2, RTW89_PHY_STS_IE01_W2_LDPC); + phy_ppdu->stbc = le32_get_bits(ie->w2, RTW89_PHY_STS_IE01_W2_STBC); + } + if (phy_ppdu->rate < RTW89_HW_RATE_OFDM6) return; @@ -1982,6 +1988,23 @@ static void rtw89_core_hw_to_sband_rate(struct ieee80211_rx_status *rx_status) rx_status->rate_idx -= 4; } +static +void rtw89_core_update_rx_status_by_ppdu(struct rtw89_dev *rtwdev, + struct ieee80211_rx_status *rx_status, + struct rtw89_rx_phy_ppdu *phy_ppdu) +{ + if (!(rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR)) + return; + + if (!phy_ppdu) + return; + + if (phy_ppdu->ldpc) + rx_status->enc_flags |= RX_ENC_FLAG_LDPC; + if (phy_ppdu->stbc) + rx_status->enc_flags |= u8_encode_bits(1, RX_ENC_FLAG_STBC_MASK); +} + static const u8 rx_status_bw_to_radiotap_eht_usig[] = { [RATE_INFO_BW_20] = IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_20MHZ, [RATE_INFO_BW_5] = U8_MAX, @@ -2025,10 +2048,14 @@ static void rtw89_core_update_radiotap_eht(struct rtw89_dev *rtwdev, eht->user_info[0] = cpu_to_le32(IEEE80211_RADIOTAP_EHT_USER_INFO_MCS_KNOWN | - IEEE80211_RADIOTAP_EHT_USER_INFO_NSS_KNOWN_O); + IEEE80211_RADIOTAP_EHT_USER_INFO_NSS_KNOWN_O | + IEEE80211_RADIOTAP_EHT_USER_INFO_CODING_KNOWN); eht->user_info[0] |= le32_encode_bits(rx_status->rate_idx, IEEE80211_RADIOTAP_EHT_USER_INFO_MCS) | le32_encode_bits(rx_status->nss, IEEE80211_RADIOTAP_EHT_USER_INFO_NSS_O); + if (rx_status->enc_flags & RX_ENC_FLAG_LDPC) + eht->user_info[0] |= + cpu_to_le32(IEEE80211_RADIOTAP_EHT_USER_INFO_CODING); /* U-SIG */ tlv = (void *)tlv + sizeof(*tlv) + ALIGN(eht_len, 4); @@ -2054,6 +2081,8 @@ static void rtw89_core_update_radiotap(struct rtw89_dev *rtwdev, { static const struct ieee80211_radiotap_he known_he = { .data1 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN | + IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN | + IEEE80211_RADIOTAP_HE_DATA1_STBC_KNOWN | IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN), .data2 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN), }; @@ -2085,6 +2114,7 @@ static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev, rtw89_core_hw_to_sband_rate(rx_status); rtw89_core_rx_stats(rtwdev, phy_ppdu, desc_info, skb_ppdu); + rtw89_core_update_rx_status_by_ppdu(rtwdev, rx_status, phy_ppdu); rtw89_core_update_radiotap(rtwdev, skb_ppdu, rx_status); /* In low power mode, it does RX in thread context. */ local_bh_disable(); @@ -4496,6 +4526,10 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev) hw->max_tx_aggregation_subframes = RTW89_MAX_TX_AGG_NUM; hw->uapsd_max_sp_len = IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL; + hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FEC | + IEEE80211_RADIOTAP_MCS_HAVE_STBC; + hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC; + ieee80211_hw_set(hw, SIGNAL_DBM); ieee80211_hw_set(hw, HAS_RATE_CONTROL); ieee80211_hw_set(hw, MFP_CAPABLE); diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h index 351296aba534..35f0cdfb8ddc 100644 --- a/drivers/net/wireless/realtek/rtw89/core.h +++ b/drivers/net/wireless/realtek/rtw89/core.h @@ -793,6 +793,8 @@ struct rtw89_rx_phy_ppdu { u8 evm_max; u8 evm_min; } ofdm; + bool ldpc; + bool stbc; bool to_self; bool valid; }; diff --git a/drivers/net/wireless/realtek/rtw89/txrx.h b/drivers/net/wireless/realtek/rtw89/txrx.h index 11049a50de2c..3882938c0893 100644 --- a/drivers/net/wireless/realtek/rtw89/txrx.h +++ b/drivers/net/wireless/realtek/rtw89/txrx.h @@ -558,6 +558,8 @@ struct rtw89_phy_sts_ie0 { #define RTW89_PHY_STS_IE01_W2_AVG_SNR GENMASK(5, 0) #define RTW89_PHY_STS_IE01_W2_EVM_MAX GENMASK(15, 8) #define RTW89_PHY_STS_IE01_W2_EVM_MIN GENMASK(23, 16) +#define RTW89_PHY_STS_IE01_W2_LDPC BIT(28) +#define RTW89_PHY_STS_IE01_W2_STBC BIT(30) enum rtw89_tx_channel { RTW89_TXCH_ACH0 = 0, -- 2.25.1