Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp677954rdg; Wed, 11 Oct 2023 02:19:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyU6x7qgS2FVZJmMZZHHOAwvN9etqunWSzM7UcGroG860cZPpkPLVlNeI/WJD/zMAwuaQX X-Received: by 2002:a81:5cc2:0:b0:58a:f135:a4d8 with SMTP id q185-20020a815cc2000000b0058af135a4d8mr24067873ywb.38.1697015993555; Wed, 11 Oct 2023 02:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697015993; cv=none; d=google.com; s=arc-20160816; b=sSS3TXkQg5aDMfKx4Naxgv0N0myXJsbhqqmEYjbtnQNqBW0WSTMsDtAqV+6BlqW9t2 t3ho/8SRL4cvzPqy3AwMaI6Cc8gPrVOpEM4O203SZmTe07ygHCmwAFnkHfNqROBeHaBS 7fObhgOZBjlP7q5ABaUDjDd6RKaz4Q6nglDjY/zN+NcnKRvftdtznH0xc5BeD5NbLCxR S8sbnZ00km4QZFSpZ0hT2Zo1HNnywtk824GRcLwrmYFIn/9JutXsY8CWNl0a7rZlr+5Z LSqu4jGLTBEKoBB5tUXOYxT5HrQxNEi98F/i1LAmmLeDJRiQGWKCdqSILGR/enLQa+4d YseA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=zQ/jh9lQ321t7YeGeoHLoGD6kEn0ICcX7oAdRrq0uVE=; fh=wvuhdzhjcwSfhWzNnciUnVYP0/qkiEHOv2on3WN6sPc=; b=SpL/VlzpsTXHU7ezslQ3m854K+vjpKULMVRkg1K5O8vyqnqA0MVw3ThZqO9yPd4+E9 HNqSOiyN++kDR4NJnzto3yMGaYaBM92e/KC2S9WkEp5Z3PmIqGKxqmIlo3vS+pOq6T3D z8mWRKFdAThSAk5B94H1E/us02Eg8+Xebb+Sfn25dUHcpFbCSm8fWzFptBIe50ZMncmT sKYUSNOG24QesAzDSWjRDLnRW4NffMj0oSXaMiy9W3FTBSZWDLcKCLAfX2hhKWE/EsTj 9zEFqmzwrRAsHyXsH0An64f6+IpwOATKXOXnsfagXASki2TT9kCJNUV//sHB7XO5OPsX 5lAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id o20-20020a056a0015d400b0069eacad28acsi10038771pfu.178.2023.10.11.02.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 02:19:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4AEB58136BFC; Wed, 11 Oct 2023 02:19:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbjJKJTr convert rfc822-to-8bit (ORCPT + 52 others); Wed, 11 Oct 2023 05:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230454AbjJKJTq (ORCPT ); Wed, 11 Oct 2023 05:19:46 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35B0191 for ; Wed, 11 Oct 2023 02:19:43 -0700 (PDT) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 39B9JPxeC3857870, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.92/5.92) with ESMTPS id 39B9JPxeC3857870 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Oct 2023 17:19:25 +0800 Received: from RTEXMBS05.realtek.com.tw (172.21.6.98) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Wed, 11 Oct 2023 17:19:26 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS05.realtek.com.tw (172.21.6.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 11 Oct 2023 17:19:24 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7]) by RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7%5]) with mapi id 15.01.2375.007; Wed, 11 Oct 2023 17:19:24 +0800 From: Ping-Ke Shih To: Kalle Valo CC: "johannes@sipsolutions.net" , "linux-wireless@vger.kernel.org" Subject: RE: [PATCH v2 6/6] wifi: rtw89: add EHT radiotap in monitor mode Thread-Topic: [PATCH v2 6/6] wifi: rtw89: add EHT radiotap in monitor mode Thread-Index: AQHZ+x8C65IQAoUJ7kiM6zWajLzKz7BEUELtgAAAk+A= Date: Wed, 11 Oct 2023 09:19:24 +0000 Message-ID: <167371414b9a42dbbfbdf3268fcc7991@realtek.com> References: <20231010021006.6061-1-pkshih@realtek.com> <20231010021006.6061-7-pkshih@realtek.com> <87il7d4j3u.fsf@kernel.org> In-Reply-To: <87il7d4j3u.fsf@kernel.org> Accept-Language: en-US, zh-TW Content-Language: zh-TW x-originating-ip: [172.21.69.25] x-kse-serverinfo: RTEXMBS05.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 11 Oct 2023 02:19:49 -0700 (PDT) X-Spam-Level: ** > -----Original Message----- > From: Kalle Valo > Sent: Wednesday, October 11, 2023 5:14 PM > To: Ping-Ke Shih > Cc: johannes@sipsolutions.net; linux-wireless@vger.kernel.org > Subject: Re: [PATCH v2 6/6] wifi: rtw89: add EHT radiotap in monitor mode > > Ping-Ke Shih writes: > > > Add IEEE80211_RADIOTAP_EHT and IEEE80211_RADIOTAP_EHT_USIG radiotap to > > fill basic EHT NSS, MCS, GI and bandwidth. > > > > Signed-off-by: Ping-Ke Shih > > --- > > drivers/net/wireless/realtek/rtw89/core.c | 66 +++++++++++++++++++++++ > > drivers/net/wireless/realtek/rtw89/core.h | 9 +++- > > 2 files changed, 74 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c > > index 2742e6646cf1..8cb1715d049a 100644 > > --- a/drivers/net/wireless/realtek/rtw89/core.c > > +++ b/drivers/net/wireless/realtek/rtw89/core.c > > @@ -1907,6 +1907,70 @@ static void rtw89_core_hw_to_sband_rate(struct ieee80211_rx_status *rx_status) > > rx_status->rate_idx -= 4; > > } > > > > +static 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, > > + [RATE_INFO_BW_10] = U8_MAX, > > + [RATE_INFO_BW_40] = IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_40MHZ, > > + [RATE_INFO_BW_80] = IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_80MHZ, > > + [RATE_INFO_BW_160] = IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_160MHZ, > > + [RATE_INFO_BW_HE_RU] = U8_MAX, > > + [RATE_INFO_BW_320] = IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_320MHZ_1, > > + [RATE_INFO_BW_EHT_RU] = U8_MAX, > > +}; > > Sorry, I noticed this only when I was abot to commit this. Should this > be static const? Yes, I miss it. > > > +static void rtw89_core_update_radiotap_eht(struct rtw89_dev *rtwdev, > > + struct sk_buff *skb, > > + struct ieee80211_rx_status *rx_status) > > +{ > > + struct ieee80211_radiotap_eht_usig *usig; > > + struct ieee80211_radiotap_eht *eht; > > + struct ieee80211_radiotap_tlv *tlv; > > + int eht_len = struct_size(eht, user_info, 1); > > + int usig_len = sizeof(*usig); > > + int len; > > + u8 bw; > > + > > + len = sizeof(*tlv) + ALIGN(eht_len, 4) + > > + sizeof(*tlv) + ALIGN(usig_len, 4); > > + > > + rx_status->flag |= RX_FLAG_RADIOTAP_TLV_AT_END; > > + skb_reset_mac_header(skb); > > + > > + /* EHT */ > > + tlv = skb_push(skb, len); > > + memset(tlv, 0, len); > > + tlv->type = cpu_to_le16(IEEE80211_RADIOTAP_EHT); > > + tlv->len = cpu_to_le16(eht_len); > > + > > + eht = (struct ieee80211_radiotap_eht *)tlv->data; > > + eht->known = cpu_to_le32(IEEE80211_RADIOTAP_EHT_KNOWN_GI); > > + eht->data[0] = > > + le32_encode_bits(rx_status->eht.gi, IEEE80211_RADIOTAP_EHT_DATA0_GI); > > + > > + eht->user_info[0] = > > + cpu_to_le32(IEEE80211_RADIOTAP_EHT_USER_INFO_MCS_KNOWN | > > + IEEE80211_RADIOTAP_EHT_USER_INFO_NSS_KNOWN_O); > > + 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); > > + > > + /* U-SIG */ > > + tlv = (void *)tlv + sizeof(*tlv) + ALIGN(eht_len, 4); > > + tlv->type = cpu_to_le16(IEEE80211_RADIOTAP_EHT_USIG); > > + tlv->len = cpu_to_le16(usig_len); > > + > > + bw = rx_status->bw < ARRAY_SIZE(rx_status_bw_to_radiotap_eht_usig) ? > > + rx_status_bw_to_radiotap_eht_usig[rx_status->bw] : U8_MAX; > > + if (bw == U8_MAX) > > + return; > > This is cosmetics but I feel that 'if' statement is more readable than > ':' operator: > > if (rx_status->bw >= ARRAY_SIZE(rx_status_bw_to_radiotap_eht_usig) > return; > > bw = rx_status_bw_to_radiotap_eht_usig[rx_status->bw]; > Got it. I will prepare v3 for them. Thank you.