cfg80211/mac80211 patches from our internal tree 2023-02-21
Subsystems (5)
v2 cover cfg80211/mac80211 patches from our internal tree 2023-02-21
From: Gregory Greenman <[email protected]>
Hi,
In this v2 patch series I've combined two patch series I sent before and fixed all the comments.
The changes are:
* HW timestamping updates
* A few MLO adjustments
* Bug fixes and cleanups
* Prepartions for adding EHT and new radiotap format
Thanks,
Gregory
Avraham Stern (2):
wifi: nl80211/cfg80211: add command to enable/disable HW timestamping
wifi: mac80211: add support for set_hw_timestamp command
Benjamin Berg (3):
wifi: mac80211: add pointer from bss_conf to vif
wifi: mac80211: remove SMPS from AP debugfs
wifi: mac80211: add netdev per-link debugfs data and driver hook
Ilan Peer (2):
wifi: nl80211: Update the documentation of
NL80211_SCAN_FLAG_COLOCATED_6GHZ
wifi: mac80211_hwsim: Indicate support for
NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENTJohannes Berg (10):
wifi: mac80211: adjust scan cancel comment/check
wifi: mac80211: check key taint for beacon protection
wifi: mac80211: allow beacon protection HW offload
wifi: cfg80211/mac80211: report link ID on control port RX
wifi: mac80211: warn only once on AP probe
wifi: nl80211: fix NULL-ptr deref in offchan check
wifi: mac80211: mlme: remove pointless sta check
wifi: mac80211: simplify reasoning about EHT capa handling
wifi: mac80211: fix ieee80211_link_set_associated() type
wifi: cfg80211: fix MLO connection ownership
Mordechay Goodstein (6):
wifi: mac80211: clear all bits that relate rtap fields on skb
wifi: wireless: return primary channel regardless of DUP
wifi: wireless: correct validation 6G Band for primary channel
wifi: wireless: cleanup unused function parameters
wifi: ieee80211_radiotap: Add EHT radiotap definitions
wifi: mac80211: add support for driver adding radiotap TLVs
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 27 ++- drivers/net/wireless/mac80211_hwsim.c | 48 ++-- include/net/cfg80211.h | 36 ++- include/net/ieee80211_radiotap.h | 207 +++++++++++++++- include/net/mac80211.h | 63 ++--- include/uapi/linux/nl80211.h | 31 ++- net/mac80211/cfg.c | 19 +- net/mac80211/debugfs_netdev.c | 223 +++++++++++++----- net/mac80211/debugfs_netdev.h | 16 ++ net/mac80211/driver-ops.c | 25 +- net/mac80211/driver-ops.h | 16 ++ net/mac80211/ieee80211_i.h | 4 + net/mac80211/link.c | 5 + net/mac80211/mlme.c | 6 +- net/mac80211/rx.c | 93 +++----- net/mac80211/scan.c | 8 +- net/mac80211/tx.c | 10 + net/wireless/nl80211.c | 71 ++++-- net/wireless/rdev-ops.h | 17 ++ net/wireless/scan.c | 39 +-- net/wireless/trace.h | 36 ++- 21 files changed, 752 insertions(+), 248 deletions(-)
Signature · 1 line
2.38.1
PATCH v2 1/23 wifi: nl80211: Update the documentation of NL80211_SCAN_FLAG_COLOCATED_6GHZ
From: Ilan Peer <[email protected]>
Add a detailed description of NL80211_SCAN_FLAG_COLOCATED_6GHZ flag.
--- include/uapi/linux/nl80211.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
include/uapi/linux/nl80211.h +8 -2
@@ -6510,8 +6510,14 @@ enum nl80211_timeout_reason {* @NL80211_SCAN_FLAG_FREQ_KHZ: report scan results with * %NL80211_ATTR_SCAN_FREQ_KHZ. This also means * %NL80211_ATTR_SCAN_FREQUENCIES will not be included. -* @NL80211_SCAN_FLAG_COLOCATED_6GHZ: scan for colocated APs reported by -* 2.4/5 GHz APs +* @NL80211_SCAN_FLAG_COLOCATED_6GHZ: scan for collocated APs reported by +* 2.4/5 GHz APs. When the flag is set, the scan logic will use the +* information from the RNR element found in beacons/probe responses +* received on the 2.4/5 GHz channels to actively scan only the 6GHz +* channels on which APs are expected to be found. Note that when not set, +* the scan logic would scan all 6GHz channels, but since transmission of +* probe requests on non PSC channels is limited, it is highly likely that +* these channels would passively be scanned. */ enum nl80211_scan_flags {NL80211_SCAN_FLAG_LOW_PRIORITY =1 <<0 ,
Signature · 1 line
2.38.1
PATCH v2 2/23 wifi: mac80211: adjust scan cancel comment/check
In reply to [email protected]From: Johannes Berg <[email protected]>
Instead of the comment about holding RTNL, which is now wrong, add a proper lockdep assertion for the wiphy mutex.
--- net/mac80211/scan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/mac80211/scan.c +4 -4
@@ -9,7 +9,7 @@* Copyright 2007, Michael Wu <[email protected]> * Copyright 2013-2015 Intel Mobile Communications GmbH * Copyright 2016-2017 Intel Deutschland GmbH -* Copyright (C) 2018-2021 Intel Corporation +* Copyright (C) 2018-2022 Intel Corporation */ #include <linux/if_arp.h>
@@ -1246,11 +1246,11 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,return ret; } -/* -* Only call this function when a scan can't be queued -- under RTNL. -*/ void ieee80211_scan_cancel (struct ieee80211_local *local) { +/* ensure a new scan cannot be queued */ +lockdep_assert_wiphy (local->hw.wiphy); +/* * We are canceling software scan, or deferred scan that was not * yet really started (see __ieee80211_start_scan ).
Signature · 1 line
2.38.1
PATCH v2 3/23 wifi: mac80211: clear all bits that relate rtap fields on skb
In reply to [email protected]From: Mordechay Goodstein <[email protected]>
Since we remove radiotap from skb data, clear all RX_FLAG_X related info that indicate info on the skb data.
Also we need to do it only once so remove the clear from cooked_monitor.
--- net/mac80211/rx.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/mac80211/rx.c +9 -2
@@ -43,6 +43,7 @@ static struct sk_buff *ieee80211_clean_skb(struct sk_buff *skb,unsigned int present_fcs_len, unsigned int rtap_space) { + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);struct ieee80211_hdr *hdr;unsigned int hdrlen;__le16 fc;
@@ -51,6 +52,14 @@ static struct sk_buff *ieee80211_clean_skb(struct sk_buff *skb,__pskb_trim (skb, skb->len - present_fcs_len);pskb_pull (skb, rtap_space); +/* After pulling radiotap header, clear all flags that indicate +* info on skb->data. +*/ + status->flag &= ~(RX_FLAG_RADIOTAP_VENDOR_DATA | +RX_FLAG_RADIOTAP_LSIG | +RX_FLAG_RADIOTAP_HE_MU | +RX_FLAG_RADIOTAP_HE ); + hdr = (void *)skb->data; fc = hdr->frame_control;
@@ -3916,8 +3925,6 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,if (!local->cooked_mntrs) goto out_free_skb; -/* vendor data is long removed here */ - status->flag &= ~RX_FLAG_RADIOTAP_VENDOR_DATA ;/* room for the radiotap header based on driver features */ needed_headroom =ieee80211_rx_radiotap_hdrlen (local, status, skb);
Signature · 1 line
2.38.1
PATCH v2 4/23 wifi: mac80211: check key taint for beacon protection
In reply to [email protected]From: Johannes Berg <[email protected]>
This will likely never happen, but for completeness check the key taint flag before using a key for beacon protection.
--- net/mac80211/tx.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/mac80211/tx.c +6 -0
@@ -5115,6 +5115,12 @@ static int ieee80211_beacon_protect(struct sk_buff *skb, tx.key =rcu_dereference (link->default_beacon_key);if (!tx.key)return 0 ; + +if (unlikely (tx.key->flags &KEY_FLAG_TAINTED )) { + tx.key =NULL ; +return -EINVAL ; + } + tx.local = local; tx.sdata = sdata;__skb_queue_head_init (&tx.skbs);
Signature · 1 line
2.38.1
PATCH v2 5/23 wifi: mac80211: allow beacon protection HW offload
In reply to [email protected]From: Johannes Berg <[email protected]>
In case of beacon protection, check if the key was offloaded to the hardware and in that case set control.hw_key so that the encryption function will see it and only do the needed steps that aren't done in hardware.
--- net/mac80211/tx.c | 4 ++++ 1 file changed, 4 insertions(+)
net/mac80211/tx.c +4 -0
@@ -5121,6 +5121,10 @@ static int ieee80211_beacon_protect(struct sk_buff *skb,return -EINVAL ; } +if (!(tx.key->conf.flags &IEEE80211_KEY_FLAG_SW_MGMT_TX ) && + tx.key->flags &KEY_FLAG_UPLOADED_TO_HARDWARE ) +IEEE80211_SKB_CB (skb)->control.hw_key = &tx.key->conf; + tx.local = local; tx.sdata = sdata;__skb_queue_head_init (&tx.skbs);
Signature · 1 line
2.38.1
PATCH v2 6/23 wifi: wireless: return primary channel regardless of DUP
In reply to [email protected]From: Mordechay Goodstein <[email protected]>
Currently in case DUP bit is not set we don't return the primary channel for 6Ghz Band (UHB), but from spec seems that DUP has no affect on primary channel for UHB,
9.4.2.249 HE Operation element:
The Duplicate Beacon subfield is set to 1 if the AP transmits Beacon frames in non-HT duplicate PPDU with a TXVECTOR parameter CH_BANDWIDTH value that is up to the BSS bandwidth and is set to 0 otherwise.
So remove the condition for returning primary channel based on DUP.
About RSSI for DUP beacon no need to mark it as invalid, due to the code calling the function check marks signal invalid in case beacon freq is not the freq we received it on, which is the case for DUP beacon on non primary channels.
--- net/wireless/scan.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/wireless/scan.c +1 -3
@@ -1830,9 +1830,7 @@ int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,if (!he_6ghz_oper)return -1 ; -if (ftype !=CFG80211_BSS_FTYPE_BEACON || - he_6ghz_oper->control &IEEE80211_HE_6GHZ_OPER_CTRL_DUP_BEACON ) -return he_6ghz_oper->primary; +return he_6ghz_oper->primary; } }else if (band ==NL80211_BAND_S1GHZ ) { tmp =cfg80211_find_elem (WLAN_EID_S1G_OPERATION , ie, ielen);
Signature · 1 line
2.38.1
PATCH v2 7/23 wifi: wireless: correct validation 6G Band for primary channel
In reply to [email protected]From: Mordechay Goodstein <[email protected]>
Current check that beacon primary channel is in the range of 80Mhz (abs < 80) is invalid for EHT 320Mhz due to 6G DUP beacon means that AP transmits on all the sub 20Mhz channels the beacon.
9.4.2.249 HE Operation element - ... AP transmits Beacon frames in non-HT duplicate PPDU with a TXVECTOR parameter CH_BANDWIDTH value that is up to the BSS bandwidth.
So in case of 320Mhz the DUP beacon can be in upper 160 for primary channel in the lower 160 giving possibly a absolute range of over 80Mhz.
Also this check is redundant all together, if AP has a wrong primary channel in the beacon it's a fluty AP, and we would fail in next steps to connect.
--- net/wireless/scan.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/wireless/scan.c +6 -8
@@ -1885,23 +1885,21 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, freq =ieee80211_channel_to_freq_khz (channel_number, channel->band); -/* -* In 6GHz, duplicated beacon indication is relevant for -* beacons only. +/* Frame info (beacon/prob res) is the same as resieved channel, no need +* for forther process. */ -if (channel->band ==NL80211_BAND_6GHZ && - (freq == channel->center_freq || -abs (freq - channel->center_freq) >80 )) +if (freq == channel->center_freq)return channel; alt_channel =ieee80211_get_channel_khz (wiphy, freq);if (!alt_channel) { -if (channel->band ==NL80211_BAND_2GHZ ) { +if (channel->band ==NL80211_BAND_2GHZ || + channel->band ==NL80211_BAND_60GHZ ) {/* * Better not allow unexpected channels when that could * be going beyond the 1-11 range (e.g., discovering * BSS on channel 12 when radio is configured for -* channel 11. +* channel 11) or beyond the 6G channel range. */ return NULL ; }
Signature · 1 line
2.38.1
Re: [PATCH v2 07/23] wifi: wireless: correct validation 6G Band for primary channel
On 3/1/2023 6:09 PM, [email protected] wrote:
...
net/wireless/scan.c cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, · line 1892
Quoted 7 lines
*/
net/wireless/scan.c +1
-3-if (channel->band ==NL80211_BAND_6GHZ && - (freq == channel->center_freq || -abs (freq - channel->center_freq) >80 )) +if (freq == channel->center_freq)return channel;
freq is KHz, channel->center_freq is MHz, so should change to if (freq / 1000 == channel->center_freq)?
net/wireless/scan.c cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, · line 1897
Quoted 5 lines
alt_channel = ieee80211_get_channel_khz(wiphy, freq); if (!alt_channel) {net/wireless/scan.c +2
-1-if (channel->band ==NL80211_BAND_2GHZ ) { +if (channel->band ==NL80211_BAND_2GHZ || + channel->band ==NL80211_BAND_60GHZ ) {
it should be NL80211_BAND_6GHZ, NOT 60GHZ?
...
Signature · 3 lines
ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Re: [PATCH v2 07/23] wifi: wireless: correct validation 6G Band for primary channel
In reply to [email protected]Quoted 4 lines · On 3/1/2023 2:09 AM, [email protected] wrote:
From: Mordechay Goodstein <[email protected]>
Current check that beacon primary channel is in the range of 80Mhz (abs < 80) is invalid for EHT 320Mhz due to 6G DUP beacon means that
s/Mhz/MHz/g
also suggest separating the magnitude from the units to align with SI nomenclature.
Quoted 8 lines
AP transmits on all the sub 20Mhz channels the beacon.
9.4.2.249 HE Operation element - ... AP transmits Beacon frames in non-HT duplicate PPDU with a TXVECTOR parameter
CH_BANDWIDTHvalue that is up to the BSS bandwidth.So in case of 320Mhz the DUP beacon can be in upper 160 for primary channel in the lower 160 giving possibly a absolute range of over
s/a absolute/an absolute/
Quoted 17 lines
80Mhz.
Also this check is redundant all together, if AP has a wrong primary channel in the beacon it's a fluty AP, and we would fail in next steps to connect.
Signed-off-by Mordechay Goodstein <[email protected]>Signed-off-by Gregory Greenman <[email protected]>--- net/wireless/scan.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)net/wireless/scan.c +0
-0
net/wireless/scan.c cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, · line 1888
Quoted 7 lines
net/wireless/scan.c +1
-3@@ -1885,23 +1885,21 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, freq =ieee80211_channel_to_freq_khz (channel_number, channel->band); -/* -* In 6GHz, duplicated beacon indication is relevant for -* beacons only. +/* Frame info (beacon/prob res) is the same as resieved channel, no need
s/resieved/received/
net/wireless/scan.c cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, · line 1889
Quoted 1 line
net/wireless/scan.c +1
-0+* for forther process.
s/forther/further/
Quoted 8 lines
net/wireless/scan.c +1
-3*/ -if (channel->band ==NL80211_BAND_6GHZ && - (freq == channel->center_freq || -abs (freq - channel->center_freq) >80 )) +if (freq == channel->center_freq)return channel; alt_channel =ieee80211_get_channel_khz (wiphy, freq);
net/wireless/scan.c cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, · line 1902
Quoted 10 lines
net/wireless/scan.c +3
-2if (!alt_channel) { -if (channel->band ==NL80211_BAND_2GHZ ) { +if (channel->band ==NL80211_BAND_2GHZ || + channel->band ==NL80211_BAND_60GHZ ) {/* * Better not allow unexpected channels when that could * be going beyond the 1-11 range (e.g., discovering * BSS on channel 12 when radio is configured for -* channel 11. +* channel 11) or beyond the 6G channel range.
both in subject and here can we change 6G to 6 GHz to avoid confusion with cellular use of "6G" and potentially WFA use of "Wi-Fi 6" where 6 is a generation and not a frequency?
Quoted 3 lines
net/wireless/scan.c +0
-0*/ return NULL ; }
PATCH v2 8/23 wifi: wireless: cleanup unused function parameters
In reply to [email protected]From: Mordechay Goodstein <[email protected]>
In the past ftype was used for deciding about 6G DUP beacon, but the logic was removed and ftype is not needed anymore.
--- include/net/cfg80211.h | 4 +--- net/wireless/scan.c | 21 +++++---------------- 2 files changed, 6 insertions(+), 19 deletions(-)
include/net/cfg80211.h +1 -3
@@ -6814,13 +6814,11 @@ enum cfg80211_bss_frame_type {* @ie: IEs * @ielen: length of IEs * @band: enum nl80211_band of the channel -* @ftype: frame type * * Returns the channel number, or -1 if none could be determined. */ int cfg80211_get_ies_channel_number (const u8 *ie,size_t ielen, -enum nl80211_band band, -enum cfg80211_bss_frame_type ftype); +enum nl80211_band band);/** * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
net/wireless/scan.c +5 -16
@@ -1810,8 +1810,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, }int cfg80211_get_ies_channel_number (const u8 *ie,size_t ielen, -enum nl80211_band band, -enum cfg80211_bss_frame_type ftype) +enum nl80211_band band) {const struct element *tmp;
@@ -1868,15 +1867,14 @@ EXPORT_SYMBOL(cfg80211_get_ies_channel_number);static struct ieee80211_channel *cfg80211_get_bss_channel (struct wiphy *wiphy,const u8 *ie,size_t ielen,struct ieee80211_channel *channel, -enum nl80211_bss_scan_width scan_width, -enum cfg80211_bss_frame_type ftype) +enum nl80211_bss_scan_width scan_width) {u32 freq;int channel_number;struct ieee80211_channel *alt_channel; channel_number =cfg80211_get_ies_channel_number (ie, ielen, - channel->band, ftype); + channel->band);if (channel_number <0 ) {/* No channel information in frame payload */
@@ -1953,7 +1951,7 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,return NULL ; channel =cfg80211_get_bss_channel (wiphy, ie, ielen, data->chan, - data->scan_width, ftype); + data->scan_width);if (!channel)return NULL ;
@@ -2387,7 +2385,6 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy,size_t ielen, min_hdr_len = offsetof(struct ieee80211_mgmt , u.probe_resp.variable);int bss_type; -enum cfg80211_bss_frame_type ftype; BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) != offsetof(struct ieee80211_mgmt, u.beacon.variable));
@@ -2424,16 +2421,8 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy, variable = ext->u.s1g_beacon.variable; } -if (ieee80211_is_beacon (mgmt->frame_control)) - ftype =CFG80211_BSS_FTYPE_BEACON ; -else if (ieee80211_is_probe_resp (mgmt->frame_control)) - ftype =CFG80211_BSS_FTYPE_PRESP ; -else - ftype =CFG80211_BSS_FTYPE_UNKNOWN ; - channel =cfg80211_get_bss_channel (wiphy, variable, - ielen, data->chan, data->scan_width, - ftype); + ielen, data->chan, data->scan_width);if (!channel)return NULL ;
Signature · 1 line
2.38.1
PATCH v2 9/23 wifi: nl80211/cfg80211: add command to enable/disable HW timestamping
In reply to [email protected]From: Avraham Stern <[email protected]>
Add a command to enable and disable HW timestamping of TM and FTM frames. HW timestamping can be enabled for a specific mac address or for all addresses.
The low level driver will indicate for how many peers HW timestamping can be enabled concurrently, and this information will be passed to userspace.
--- include/net/cfg80211.h | 27 +++++++++++++++++++++++++ include/uapi/linux/nl80211.h | 21 ++++++++++++++++++++ net/wireless/nl80211.c | 38 ++++++++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 17 ++++++++++++++++ net/wireless/trace.h | 25 ++++++++++++++++++++++++ 5 files changed, 128 insertions(+)
include/net/cfg80211.h +27 -0
@@ -827,6 +827,18 @@ struct cfg80211_fils_aad {const u8 *anonce; }; +/** +* struct cfg80211_set_hw_timestamp - enable/disable HW timestamping +* @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all +* addresses. +* @enable: if set, enable HW timestamping for the specified MAC address. +* Otherwise disable HW timestamping for the specified MAC address. +*/ +struct cfg80211_set_hw_timestamp { +const u8 *macaddr; +bool enable; +}; +/** * cfg80211_get_chandef_type - return old channel type from chandef * @chandef: the channel definition
@@ -4330,6 +4342,8 @@ struct mgmt_frame_regs {* @add_link_station: Add a link to a station. * @mod_link_station: Modify a link of a station. * @del_link_station: Remove a link of a station. +* +* @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -4683,6 +4697,8 @@ struct cfg80211_ops { struct link_station_parameters *params);int (*del_link_station)(struct wiphy *wiphy,struct net_device *dev,struct link_station_del_parameters *params); +int (*set_hw_timestamp)(struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_set_hw_timestamp *hwts); };/*
@@ -5139,6 +5155,8 @@ struct wiphy_iftype_akm_suites {int n_akm_suites; }; +#define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff +/** * struct wiphy - wireless hardware description * @mtx: mutex for the data (structures) of this device
@@ -5348,6 +5366,13 @@ struct wiphy_iftype_akm_suites {* NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with * legacy userspace and maximum allowed value is * CFG80211_MAX_NUM_AKM_SUITES. +* +* @hw_timestamp_max_peers: maximum number of peers that the driver supports +* enabling HW timestamping for concurrently. Setting this field to a +* non-zero value indicates that the driver supports HW timestamping. +* A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver +* supports enabling HW timestamping for all peers (i.e. no need to +* specify a mac address). */ struct wiphy {struct mutex mtx;
@@ -5496,6 +5521,8 @@ struct wiphy {u8 ema_max_profile_periodicity;u16 max_num_akm_suites; +u16 hw_timestamp_max_peers; +char priv[]__aligned(NETDEV_ALIGN) ; };
include/uapi/linux/nl80211.h +21 -0
@@ -1299,6 +1299,16 @@* @NL80211_CMD_MODIFY_LINK_STA: Modify a link of an MLD station * @NL80211_CMD_REMOVE_LINK_STA: Remove a link of an MLD station * +* @NL80211_CMD_SET_HW_TIMESTAMP: Enable/disable HW timestamping of Timing +* measurement and Fine timing measurement frames. If %NL80211_ATTR_MAC +* is included, enable/disable HW timestamping only for frames to/from the +* specified MAC address. Otherwise enable/disable HW timestamping for +* all TM/FTM frames (including ones that were enabled with specific MAC +* address). If %NL80211_ATTR_HW_TIMESTAMP_ENABLED is not included, disable +* HW timestamping. +* The number of peers that HW timestamping can be enabled for concurrently +* is indicated by %NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS. +* * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -1550,6 +1560,8 @@ enum nl80211_commands {NL80211_CMD_MODIFY_LINK_STA ,NL80211_CMD_REMOVE_LINK_STA , + NL80211_CMD_SET_HW_TIMESTAMP, +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -2775,6 +2787,12 @@ enum nl80211_commands {* indicates that the sub-channel is punctured. Higher 16 bits are * reserved. * +* @NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS: Maximum number of peers that HW +* timestamping can be enabled for concurrently (u16), a wiphy attribute. +* A value of 0xffff indicates setting for all peers (i.e. not specifying +* an address with %NL80211_CMD_SET_HW_TIMESTAMP) is supported. +* @NL80211_ATTR_HW_TIMESTAMP_ENABLED: Indicates whether HW timestamping should +* be enabled or not (flag attribute). * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3306,6 +3324,9 @@ enum nl80211_attrs {NL80211_ATTR_PUNCT_BITMAP , +NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS , +NL80211_ATTR_HW_TIMESTAMP_ENABLED , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c +38 -0
@@ -806,6 +806,9 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG }, [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT }, [NL80211_ATTR_PUNCT_BITMAP] = NLA_POLICY_RANGE(NLA_U8, 0, 0xffff), + + [NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS] = { .type = NLA_U16 }, + [NL80211_ATTR_HW_TIMESTAMP_ENABLED] = { .type = NLA_FLAG }, };/* policy for the key attributes */
@@ -2964,6 +2967,11 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,if (rdev->wiphy.flags &WIPHY_FLAG_SUPPORTS_MLO )nla_put_flag (msg,NL80211_ATTR_MLO_SUPPORT ); +if (rdev->wiphy.hw_timestamp_max_peers && +nla_put_u16 (msg,NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS , + rdev->wiphy.hw_timestamp_max_peers)) + goto nla_put_failure; +/* done */ state->split_start =0 ;break ;
@@ -16162,6 +16170,30 @@ nl80211_remove_link_station(struct sk_buff *skb, struct genl_info *info)return ret; } +static int nl80211_set_hw_timestamp (struct sk_buff *skb, +struct genl_info *info) +{ +struct cfg80211_registered_device *rdev = info->user_ptr[0 ]; +struct net_device *dev = info->user_ptr[1 ]; +struct cfg80211_set_hw_timestamp hwts = {}; + +if (!rdev->wiphy.hw_timestamp_max_peers) +return -EOPNOTSUPP ; + +if (rdev->wiphy.hw_timestamp_max_peers != +CFG80211_HW_TIMESTAMP_ALL_PEERS && + !info->attrs[NL80211_ATTR_MAC ]) +return -EOPNOTSUPP ; + +if (info->attrs[NL80211_ATTR_MAC ]) + hwts.macaddr =nla_data (info->attrs[NL80211_ATTR_MAC ]); + + hwts.enable = +nla_get_flag (info->attrs[NL80211_ATTR_HW_TIMESTAMP_ENABLED ]); + +return rdev_set_hw_timestamp (rdev, dev, &hwts); +} +#define NL80211_FLAG_NEED_WIPHY 0x01#define NL80211_FLAG_NEED_NETDEV 0x02#define NL80211_FLAG_NEED_RTNL 0x04
@@ -17336,6 +17368,12 @@ static const struct genl_small_ops nl80211_small_ops[] = { .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP | NL80211_FLAG_MLO_VALID_LINK_ID), }, + { + .cmd = NL80211_CMD_SET_HW_TIMESTAMP, + .doit = nl80211_set_hw_timestamp, + .flags = GENL_UNS_ADMIN_PERM, + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV), + }, };static struct genl_family nl80211_fam__ro_after_init = {
net/wireless/rdev-ops.h +17 -0
@@ -1494,4 +1494,21 @@ rdev_del_link_station(struct cfg80211_registered_device *rdev, return ret; } +static inline int +rdev_set_hw_timestamp (struct cfg80211_registered_device *rdev, +struct net_device *dev, +struct cfg80211_set_hw_timestamp *hwts) +{ +struct wiphy *wiphy = &rdev->wiphy; +int ret; + +if (!rdev->ops->set_hw_timestamp) +return -EOPNOTSUPP ; + +trace_rdev_set_hw_timestamp (wiphy, dev, hwts); + ret = rdev->ops->set_hw_timestamp (wiphy, dev, hwts); +trace_rdev_return_int (wiphy, ret); + +return ret; +}#endif /* __CFG80211_RDEV_OPS */
net/wireless/trace.h +25 -0
@@ -3918,6 +3918,31 @@ TRACE_EVENT(rdev_del_link_station, __entry->link_id) ); +TRACE_EVENT (rdev_set_hw_timestamp, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + struct cfg80211_set_hw_timestamp *hwts), + +TP_ARGS (wiphy, netdev, hwts), + +TP_STRUCT__entry ( + WIPHY_ENTRY + NETDEV_ENTRY + MAC_ENTRY(macaddr) +__field (bool, enable) + ), + +TP_fast_assign ( + WIPHY_ASSIGN; + NETDEV_ASSIGN; + MAC_ASSIGN(macaddr, hwts->macaddr); + __entry->enable = hwts->enable; + ), + +TP_printk (WIPHY_PR_FMT ", " NETDEV_PR_FMT ", mac %pM, enable: %u" , +WIPHY_PR_ARG ,NETDEV_PR_ARG , __entry->macaddr, + __entry->enable) +); +#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.38.1
PATCH v2 10/23 wifi: mac80211: add support for set_hw_timestamp command
In reply to [email protected]From: Avraham Stern <[email protected]>
Support the set_hw_timestamp callback for enabling and disabling HW timestamping if the low level driver supports it.
--- include/net/mac80211.h | 6 ++++++ net/mac80211/cfg.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+)
include/net/mac80211.h +6 -0
@@ -4230,6 +4230,9 @@ struct ieee80211_prep_tx_info {* Note that a sta can also be inserted or removed with valid links, * i.e. passed to @sta_add/@sta_state with sta->valid_links not zero. * In fact, cannot change from having valid_links and not having them. +* @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. This is +* not restored at HW reset by mac80211 so drivers need to take care of +* that. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw,
@@ -4589,6 +4592,9 @@ struct ieee80211_ops {struct ieee80211_vif *vif, struct ieee80211_sta *sta, u16 old_links, u16 new_links); +int (*set_hw_timestamp)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct cfg80211_set_hw_timestamp *hwts); };/**
net/mac80211/cfg.c +17 -0
@@ -4904,6 +4904,22 @@ ieee80211_del_link_station(struct wiphy *wiphy, struct net_device *dev,return ret; } +static int ieee80211_set_hw_timestamp (struct wiphy *wiphy, +struct net_device *dev, +struct cfg80211_set_hw_timestamp *hwts) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; + +if (!local->ops->set_hw_timestamp) +return -EOPNOTSUPP ; + +if (!check_sdata_in_driver (sdata)) +return -EIO ; + +return local->ops->set_hw_timestamp (&local->hw, &sdata->vif, hwts); +} +const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface,
@@ -5014,4 +5030,5 @@ const struct cfg80211_ops mac80211_config_ops = { .add_link_station = ieee80211_add_link_station, .mod_link_station = ieee80211_mod_link_station, .del_link_station = ieee80211_del_link_station, + .set_hw_timestamp = ieee80211_set_hw_timestamp, };
Signature · 1 line
2.38.1
PATCH v2 11/23 wifi: cfg80211/mac80211: report link ID on control port RX
In reply to [email protected]From: Johannes Berg <[email protected]>
For control port RX, report the link ID for MLO.
--- include/net/cfg80211.h | 5 +++-- net/mac80211/rx.c | 2 +- net/wireless/nl80211.c | 15 ++++++++++----- net/wireless/trace.h | 11 +++++++---- 4 files changed, 21 insertions(+), 12 deletions(-)
include/net/cfg80211.h +3 -2
@@ -8126,6 +8126,7 @@ void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,* responsible for any cleanup. The caller must also ensure that * skb->protocol is set appropriately. * @unencrypted: Whether the frame was received unencrypted +* @link_id: the link the frame was received on, -1 if not applicable or unknown * * This function is used to inform userspace about a received control port * frame. It should only be used if userspace indicated it wants to receive
@@ -8136,8 +8137,8 @@ void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,* * Return: %true if the frame was passed to userspace */ -bool cfg80211_rx_control_port (struct net_device *dev, -struct sk_buff *skb,bool unencrypted); +bool cfg80211_rx_control_port (struct net_device *dev,struct sk_buff *skb, +bool unencrypted,int link_id);/** * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
net/mac80211/rx.c +1 -1
@@ -2591,7 +2591,7 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb,struct ieee80211_rx_status *status =IEEE80211_SKB_RXCB (skb);bool noencrypt = !(status->flag &RX_FLAG_DECRYPTED ); -cfg80211_rx_control_port (dev, skb, noencrypt); +cfg80211_rx_control_port (dev, skb, noencrypt, rx->link_id);dev_kfree_skb (skb); }else {struct ethhdr *ehdr = (void *)skb_mac_header (skb);
net/wireless/nl80211.c +10 -5
@@ -18755,7 +18755,9 @@ EXPORT_SYMBOL(cfg80211_mgmt_tx_status_ext);static int __nl80211_rx_control_port (struct net_device *dev,struct sk_buff *skb, -bool unencrypted,gfp_t gfp) +bool unencrypted, +int link_id, +gfp_t gfp) {struct wireless_dev *wdev = dev->ieee80211_ptr;struct cfg80211_registered_device *rdev =wiphy_to_rdev (wdev->wiphy);
@@ -18787,6 +18789,8 @@ static int __nl80211_rx_control_port(struct net_device *dev, NL80211_ATTR_PAD) ||nla_put (msg,NL80211_ATTR_MAC ,ETH_ALEN , addr) ||nla_put_u16 (msg,NL80211_ATTR_CONTROL_PORT_ETHERTYPE , proto) || + (link_id >=0 && +nla_put_u8 (msg,NL80211_ATTR_MLO_LINK_ID , link_id)) || (unencrypted &&nla_put_flag (msg, NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT))) goto nla_put_failure;
@@ -18805,13 +18809,14 @@ static int __nl80211_rx_control_port(struct net_device *dev,return -ENOBUFS ; } -bool cfg80211_rx_control_port (struct net_device *dev, -struct sk_buff *skb,bool unencrypted) +bool cfg80211_rx_control_port (struct net_device *dev,struct sk_buff *skb, +bool unencrypted,int link_id) {int ret; -trace_cfg80211_rx_control_port (dev, skb, unencrypted); - ret =__nl80211_rx_control_port (dev, skb, unencrypted,GFP_ATOMIC ); +trace_cfg80211_rx_control_port (dev, skb, unencrypted, link_id); + ret =__nl80211_rx_control_port (dev, skb, unencrypted, link_id, +GFP_ATOMIC );trace_cfg80211_return_bool (ret ==0 );return ret ==0 ; }
net/wireless/trace.h +7 -4
@@ -3165,14 +3165,15 @@ TRACE_EVENT(cfg80211_control_port_tx_status, TRACE_EVENT(cfg80211_rx_control_port, TP_PROTO(struct net_device *netdev, struct sk_buff *skb, - bool unencrypted), - TP_ARGS(netdev, skb, unencrypted), + bool unencrypted, int link_id), + TP_ARGS(netdev, skb, unencrypted, link_id), TP_STRUCT__entry( NETDEV_ENTRY __field(int, len) MAC_ENTRY(from) __field(u16, proto) __field(bool, unencrypted) + __field(int, link_id) ), TP_fast_assign( NETDEV_ASSIGN;
@@ -3180,10 +3181,12 @@ TRACE_EVENT(cfg80211_rx_control_port,MAC_ASSIGN (from,eth_hdr (skb)->h_source); __entry->proto =be16_to_cpu (skb->protocol); __entry->unencrypted = unencrypted; + __entry->link_id = link_id; ), -TP_printk (NETDEV_PR_FMT ", len=%d, %pM, proto: 0x%x, unencrypted: %s" , +TP_printk (NETDEV_PR_FMT ", len=%d, %pM, proto: 0x%x, unencrypted: %s, link: %d" ,NETDEV_PR_ARG , __entry->len, __entry->from, - __entry->proto,BOOL_TO_STR (__entry->unencrypted)) + __entry->proto,BOOL_TO_STR (__entry->unencrypted), + __entry->link_id) ); TRACE_EVENT(cfg80211_cqm_rssi_notify,
Signature · 1 line
2.38.1
PATCH v2 12/23 wifi: mac80211: warn only once on AP probe
In reply to [email protected]From: Johannes Berg <[email protected]>
We should perhaps support this API for MLO, but it's not clear that it makes sense, in any case then we'd have to update it to probe the correct BSS.
For now, if it happens, warn only once so that we don't get flooded with messages if the driver misbehaves and calls this.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -3227,7 +3227,7 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;bool already = false; -if (WARN_ON (sdata->vif.valid_links)) +if (WARN_ON_ONCE (sdata->vif.valid_links))return ;if (!ieee80211_sdata_running (sdata))
Signature · 1 line
2.38.1
PATCH v2 13/23 wifi: mac80211: add pointer from bss_conf to vif
In reply to [email protected]From: Benjamin Berg <[email protected]>
While often not needed, this considerably simplifies going from a link specific bss_config to the vif. This helps with e.g. creating link specific debugfs entries inside drivers.
--- include/net/mac80211.h | 3 +++ net/mac80211/link.c | 1 + 2 files changed, 4 insertions(+)
include/net/mac80211.h +3 -0
@@ -534,6 +534,7 @@ struct ieee80211_fils_discovery {* This structure keeps information about a BSS (and an association * to that BSS) that can change during the lifetime of the BSS. * +* @vif: reference to owning VIF * @addr: (link) address used locally * @link_id: link ID, or 0 for non-MLO * @htc_trig_based_pkt_ext: default PE in 4us units, if BSS supports HE
@@ -675,6 +676,8 @@ struct ieee80211_fils_discovery {* bandwidth */ struct ieee80211_bss_conf { +struct ieee80211_vif *vif; +const u8 *bssid;unsigned int link_id;u8 addr[ETH_ALEN ]__aligned(2) ;
net/mac80211/link.c +1 -0
@@ -34,6 +34,7 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata, link->link_id = link_id; link->conf = link_conf; link_conf->link_id = link_id; + link_conf->vif = &sdata->vif;INIT_WORK (&link->csa_finalize_work, ieee80211_csa_finalize_work);
Signature · 1 line
2.38.1
PATCH v2 14/23 wifi: mac80211: remove SMPS from AP debugfs
In reply to [email protected]From: Benjamin Berg <[email protected]>
The spatial multiplexing power save feature does not apply to AP mode. Remove it from debugfs in this case.
--- net/mac80211/debugfs_netdev.c | 1 - 1 file changed, 1 deletion(-)
net/mac80211/debugfs_netdev.c +0 -1
@@ -698,7 +698,6 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)static void add_ap_files (struct ieee80211_sub_if_data *sdata) {DEBUGFS_ADD (num_mcast_sta); -DEBUGFS_ADD_MODE (smps,0600 );DEBUGFS_ADD (num_sta_ps);DEBUGFS_ADD (dtim_count);DEBUGFS_ADD (num_buffered_multicast);
Signature · 1 line
2.38.1
PATCH v2 15/23 wifi: mac80211: add netdev per-link debugfs data and driver hook
In reply to [email protected]From: Benjamin Berg <[email protected]>
This adds the infrastructure to have netdev specific per-link data both for mac80211 and the driver in debugfs. For the driver, a new callback is added which is only used if MLO is supported.
--- include/net/mac80211.h | 10 ++ net/mac80211/debugfs_netdev.c | 222 +++++++++++++++++++++++++--------- net/mac80211/debugfs_netdev.h | 16 +++ net/mac80211/driver-ops.c | 25 +++- net/mac80211/driver-ops.h | 16 +++ net/mac80211/ieee80211_i.h | 4 + net/mac80211/link.c | 4 + 7 files changed, 242 insertions(+), 55 deletions(-)
include/net/mac80211.h +10 -0
@@ -3844,6 +3844,12 @@ struct ieee80211_prep_tx_info {* the station. See @sta_pre_rcu_remove if needed. * This callback can sleep. * +* @link_add_debugfs: Drivers can use this callback to add debugfs files +* when a link is added to a mac80211 vif. This callback should be within +* a CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep. +* For non-MLO the callback will be called once for the default bss_conf +* with the vif's directory rather than a separate subdirectory. +* * @sta_add_debugfs: Drivers can use this callback to add debugfs files * when a station is added to mac80211's station list. This callback * should be within a CONFIG_MAC80211_DEBUGFS conditional. This
@@ -4325,6 +4331,10 @@ struct ieee80211_ops {int (*sta_remove)(struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta);#ifdef CONFIG_MAC80211_DEBUGFS +void (*link_add_debugfs)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_bss_conf *link_conf, +struct dentry *dir); void (*sta_add_debugfs)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
net/mac80211/debugfs_netdev.c +168 -54
394 lines not on this page · raw message
net/mac80211/debugfs_netdev.h +16 -0
@@ -10,6 +10,12 @@void ieee80211_debugfs_add_netdev (struct ieee80211_sub_if_data *sdata);void ieee80211_debugfs_remove_netdev (struct ieee80211_sub_if_data *sdata);void ieee80211_debugfs_rename_netdev (struct ieee80211_sub_if_data *sdata); + +void ieee80211_link_debugfs_add (struct ieee80211_link_data *link); +void ieee80211_link_debugfs_remove (struct ieee80211_link_data *link); + +void ieee80211_link_debugfs_drv_add (struct ieee80211_link_data *link); +void ieee80211_link_debugfs_drv_remove (struct ieee80211_link_data *link);#else static inline void ieee80211_debugfs_add_netdev (struct ieee80211_sub_if_data *sdata)
@@ -20,6 +26,16 @@ static inline void ieee80211_debugfs_remove_netdev(static inline void ieee80211_debugfs_rename_netdev (struct ieee80211_sub_if_data *sdata) {} + +static inline void ieee80211_link_debugfs_add (struct ieee80211_link_data *link) +{} +static inline void ieee80211_link_debugfs_remove (struct ieee80211_link_data *link) +{} + +static inline void ieee80211_link_debugfs_drv_add (struct ieee80211_link_data *link) +{} +static inline void ieee80211_link_debugfs_drv_remove (struct ieee80211_link_data *link) +{}#endif #endif /* __IEEE80211_DEBUGFS_NETDEV_H */
net/mac80211/driver-ops.c +24 -1
@@ -8,6 +8,7 @@#include "trace.h" #include "driver-ops.h" #include "debugfs_sta.h" +#include "debugfs_netdev.h" int drv_start (struct ieee80211_local *local) {
@@ -477,6 +478,10 @@ int drv_change_vif_links(struct ieee80211_local *local, u16 old_links, u16 new_links, struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]) { + struct ieee80211_link_data *link; +unsigned long links_to_add; +unsigned long links_to_rem; +unsigned int link_id;int ret = -EOPNOTSUPP ;might_sleep ();
@@ -487,13 +492,31 @@ int drv_change_vif_links(struct ieee80211_local *local,if (old_links == new_links)return 0 ; + links_to_add = ~old_links & new_links; + links_to_rem = old_links & ~new_links; + +for_each_set_bit (link_id, &links_to_rem,IEEE80211_MLD_MAX_NUM_LINKS ) { + link =rcu_access_pointer (sdata->link[link_id]); + +ieee80211_link_debugfs_drv_remove (link); + } +trace_drv_change_vif_links (local, sdata, old_links, new_links);if (local->ops->change_vif_links) ret = local->ops->change_vif_links (&local->hw, &sdata->vif, old_links, new_links, old);trace_drv_return_int (local, ret); -return ret; +if (ret) +return ret; + +for_each_set_bit (link_id, &links_to_add,IEEE80211_MLD_MAX_NUM_LINKS ) { + link =rcu_access_pointer (sdata->link[link_id]); + +ieee80211_link_debugfs_drv_add (link); + } + +return 0 ; } int drv_change_sta_links(struct ieee80211_local *local,
net/mac80211/driver-ops.h +16 -0
@@ -465,6 +465,22 @@ static inline void drv_sta_remove(struct ieee80211_local *local, }#ifdef CONFIG_MAC80211_DEBUGFS +static inline void drv_link_add_debugfs (struct ieee80211_local *local, +struct ieee80211_sub_if_data *sdata, +struct ieee80211_bss_conf *link_conf, +struct dentry *dir) +{ +might_sleep (); + + sdata =get_bss_sdata (sdata); +if (!check_sdata_in_driver (sdata)) +return ; + +if (local->ops->link_add_debugfs) + local->ops->link_add_debugfs (&local->hw, &sdata->vif, + link_conf, dir); +} + static inline void drv_sta_add_debugfs(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, struct ieee80211_sta *sta,
net/mac80211/ieee80211_i.h +4 -0
@@ -999,6 +999,10 @@ struct ieee80211_link_data {struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS ];struct ieee80211_bss_conf *conf; + +#ifdef CONFIG_MAC80211_DEBUGFS +struct dentry *debugfs_dir; +#endif };struct ieee80211_sub_if_data {
net/mac80211/link.c +4 -0
@@ -10,6 +10,7 @@#include "ieee80211_i.h" #include "driver-ops.h" #include "key.h" +#include "debugfs_netdev.h" void ieee80211_link_setup (struct ieee80211_link_data *link) {
@@ -61,6 +62,8 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,default :WARN_ON (1 ); } + +ieee80211_link_debugfs_add (link); } }
@@ -94,6 +97,7 @@ static void ieee80211_tear_down_links(struct ieee80211_sub_if_data *sdata,if (WARN_ON (!link))continue ;ieee80211_remove_link_keys (link, &keys); +ieee80211_link_debugfs_remove (link);ieee80211_link_stop (link); }
Signature · 1 line
2.38.1
PATCH v2 16/23 wifi: mac80211_hwsim: Indicate support for NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT
In reply to [email protected]From: Ilan Peer <[email protected]>
mac80211_hwsim always uses the probe request coming from mac80211, which has support for minimal probe request content.
--- drivers/net/wireless/mac80211_hwsim.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +3 -0
@@ -4446,6 +4446,9 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,wiphy_ext_feature_set (hw->wiphy,NL80211_EXT_FEATURE_BEACON_RATE_LEGACY ); +wiphy_ext_feature_set (hw->wiphy, +NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT ); + hw->wiphy->interface_modes = param->iftypes;/* ask mac80211 to reserve space for magic */
Signature · 1 line
2.38.1
PATCH v2 17/23 wifi: nl80211: fix NULL-ptr deref in offchan check
In reply to [email protected]From: Johannes Berg <[email protected]>
If, e.g. in AP mode, the link was already created by userspace but not activated yet, it has a chandef but the chandef isn't valid and has no channel. Check for this and ignore this link.
--- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/nl80211.c +1 -1
@@ -8909,7 +8909,7 @@ static bool cfg80211_off_channel_oper_allowed(struct wireless_dev *wdev,struct cfg80211_chan_def *chandef; chandef =wdev_chandef (wdev, link_id); -if (!chandef) +if (!chandef || !chandef->chan)continue ;/*
Signature · 1 line
2.38.1
PATCH v2 18/23 wifi: mac80211: mlme: remove pointless sta check
In reply to [email protected]From: Johannes Berg <[email protected]>
We already exited the function if sta ended up NULL, so just remove the extra check.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -5893,7 +5893,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, goto free; } -if (sta && elems->opmode_notif) +if (elems->opmode_notif)ieee80211_vht_handle_opmode (sdata, link_sta, *elems->opmode_notif, rx_status->band);
Signature · 1 line
2.38.1
PATCH v2 19/23 wifi: mac80211: simplify reasoning about EHT capa handling
In reply to [email protected]From: Johannes Berg <[email protected]>
Given the code in cfg80211, EHT capa cannot be non-NULL when HE capa is NULL, but it's easier to reason about it if both are checked and the compiler will likely integrate the check with the previous one for HE capa anyway.
--- net/mac80211/cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/cfg.c +1 -1
@@ -1788,7 +1788,7 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, (void *)params->he_6ghz_capa, link_sta); -if (params->eht_capa) +if (params->he_capa && params->eht_capa) ieee80211_eht_cap_ie_to_sta_eht_cap(sdata, sband, (u8 *)params->he_capa, params->he_capa_len,
Signature · 1 line
2.38.1
PATCH v2 20/23 wifi: mac80211: fix ieee80211_link_set_associated() type
In reply to [email protected]From: Johannes Berg <[email protected]>
The return type here should be u64 for the flags, even if it doesn't matter right now because it doesn't return any flags that don't fit into u32.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -2744,7 +2744,7 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_link_data *link,return changed; } -static u32 ieee80211_link_set_associated (struct ieee80211_link_data *link, +static u64 ieee80211_link_set_associated (struct ieee80211_link_data *link,struct cfg80211_bss *cbss) {struct ieee80211_sub_if_data *sdata = link->sdata;
Signature · 1 line
2.38.1
PATCH v2 21/23 wifi: cfg80211: fix MLO connection ownership
In reply to [email protected]From: Johannes Berg <[email protected]>
When disconnecting from an MLO connection we need the AP MLD address, not an arbitrary BSSID. Fix the code to do that.
--- net/wireless/nl80211.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
net/wireless/nl80211.c +7 -9
@@ -10801,8 +10801,7 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,static struct cfg80211_bss *nl80211_assoc_bss (struct cfg80211_registered_device *rdev,const u8 *ssid,int ssid_len, -struct nlattr **attrs, -const u8 **bssid_out) +struct nlattr **attrs) {struct ieee80211_channel *chan;struct cfg80211_bss *bss;
@@ -10829,7 +10828,6 @@ static struct cfg80211_bss *nl80211_assoc_bss(struct cfg80211_registered_deviceif (!bss)return ERR_PTR (-ENOENT ); - *bssid_out = bssid;return bss; }
@@ -10839,7 +10837,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)struct net_device *dev = info->user_ptr[1 ];struct cfg80211_assoc_request req = {};struct nlattr **attrs =NULL ; -const u8 *bssid, *ssid; +const u8 *ap_addr, *ssid;unsigned int link_id;int err, ssid_len;
@@ -10976,6 +10974,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)return -EINVAL ; req.ap_mld_addr =nla_data (info->attrs[NL80211_ATTR_MLD_ADDR ]); + ap_addr = req.ap_mld_addr; attrs =kzalloc (attrsize,GFP_KERNEL );if (!attrs)
@@ -11001,8 +11000,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) goto free; } req.links[link_id].bss = -nl80211_assoc_bss (rdev, ssid, ssid_len, attrs, - &bssid); +nl80211_assoc_bss (rdev, ssid, ssid_len, attrs);if (IS_ERR (req.links[link_id].bss)) { err =PTR_ERR (req.links[link_id].bss); req.links[link_id].bss =NULL ;
@@ -11053,10 +11051,10 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)if (req.link_id >=0 )return -EINVAL ; - req.bss =nl80211_assoc_bss (rdev, ssid, ssid_len, info->attrs, - &bssid); + req.bss =nl80211_assoc_bss (rdev, ssid, ssid_len, info->attrs);if (IS_ERR (req.bss))return PTR_ERR (req.bss); + ap_addr = req.bss->bssid; } err =nl80211_crypto_settings (rdev, info, &req.crypto,1 );
@@ -11069,7 +11067,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) dev->ieee80211_ptr->conn_owner_nlportid = info->snd_portid;memcpy (dev->ieee80211_ptr->disconnect_bssid, - bssid,ETH_ALEN ); + ap_addr,ETH_ALEN ); }wdev_unlock (dev->ieee80211_ptr);
Signature · 1 line
2.38.1
PATCH v2 22/23 wifi: ieee80211_radiotap: Add EHT radiotap definitions
In reply to [email protected]From: Mordechay Goodstein <[email protected]>
This is based on https://www.radiotap.org/fields/EHT.html and
https://www.radiotap.org/fields/U-SIG.html new EHT TLV definition for 11be standard.
--- include/net/ieee80211_radiotap.h | 187 ++++++++++++++++++++++++++++++- 1 file changed, 185 insertions(+), 2 deletions(-)
include/net/ieee80211_radiotap.h +185 -2
@@ -1,6 +1,6 @@/* * Copyright (c) 2017 Intel Deutschland GmbH -* Copyright (c) 2018-2019, 2021 Intel Corporation +* Copyright (c) 2018-2019, 2021-2022 Intel Corporation * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -82,11 +82,14 @@ enum ieee80211_radiotap_presence {IEEE80211_RADIOTAP_HE_MU =24 ,IEEE80211_RADIOTAP_ZERO_LEN_PSDU =26 ,IEEE80211_RADIOTAP_LSIG =27 , +IEEE80211_RADIOTAP_TLV =28 ,/* valid in every it_present bitmap, even vendor namespaces */ IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE =29 ,IEEE80211_RADIOTAP_VENDOR_NAMESPACE =30 , - IEEE80211_RADIOTAP_EXT = 31 +IEEE80211_RADIOTAP_EXT =31 , +IEEE80211_RADIOTAP_EHT_USIG =33 , + IEEE80211_RADIOTAP_EHT = 34, };/* for IEEE80211_RADIOTAP_FLAGS */
@@ -360,6 +363,186 @@ enum ieee80211_radiotap_zero_len_psdu_type { IEEE80211_RADIOTAP_ZERO_LEN_PSDU_VENDOR = 0xff, }; +struct ieee80211_radiotap_tlv { +__le16 type; +__le16 len; +u8 data[]; +} __packed; + +/* ieee80211_radiotap_eht_usig - content of U-SIG tlv (type 33) +* see www.radiotap.org/fields/U-SIG.html for details +*/ +struct ieee80211_radiotap_eht_usig { +__le32 common; +__le32 value; +__le32 mask; +} __packed; + +/* ieee80211_radiotap_eht - content of EHT tlv (type 34) +* see www.radiotap.org/fields/EHT.html for details +*/ +struct ieee80211_radiotap_eht { +__le32 known; +__le32 data[9 ]; +__le32 user_info[]; +} __packed; + +/* Known field for EHT TLV +* The ending defines for what the field applies as following +* O - OFDMA (including TB), M - MU-MIMO, S - EHT sounding. +*/ +enum ieee80211_radiotap_eht_known { +IEEE80211_RADIOTAP_EHT_KNOWN_SPATIAL_REUSE =0x00000002 , +IEEE80211_RADIOTAP_EHT_KNOWN_GI =0x00000004 , +IEEE80211_RADIOTAP_EHT_KNOWN_EHT_LTF =0x00000010 , +IEEE80211_RADIOTAP_EHT_KNOWN_LDPC_EXTRA_SYM_OM =0x00000020 , +IEEE80211_RADIOTAP_EHT_KNOWN_PRE_PADD_FACOR_OM =0x00000040 , +IEEE80211_RADIOTAP_EHT_KNOWN_PE_DISAMBIGUITY_OM =0x00000080 , +IEEE80211_RADIOTAP_EHT_KNOWN_DISREGARD_O =0x00000100 , +IEEE80211_RADIOTAP_EHT_KNOWN_DISREGARD_S =0x00000200 , +IEEE80211_RADIOTAP_EHT_KNOWN_CRC1 =0x00002000 , +IEEE80211_RADIOTAP_EHT_KNOWN_TAIL1 =0x00004000 , +IEEE80211_RADIOTAP_EHT_KNOWN_CRC2_O =0x00008000 , +IEEE80211_RADIOTAP_EHT_KNOWN_TAIL2_O =0x00010000 , +IEEE80211_RADIOTAP_EHT_KNOWN_NSS_S =0x00020000 , +IEEE80211_RADIOTAP_EHT_KNOWN_BEAMFORMED_S =0x00040000 , +IEEE80211_RADIOTAP_EHT_KNOWN_NR_NON_OFDMA_USERS_M =0x00080000 , +IEEE80211_RADIOTAP_EHT_KNOWN_ENCODING_BLOCK_CRC_M =0x00100000 , +IEEE80211_RADIOTAP_EHT_KNOWN_ENCODING_BLOCK_TAIL_M =0x00200000 , +IEEE80211_RADIOTAP_EHT_KNOWN_RU_MRU_SIZE_OM =0x00400000 , +IEEE80211_RADIOTAP_EHT_KNOWN_RU_MRU_INDEX_OM =0x00800000 , +IEEE80211_RADIOTAP_EHT_KNOWN_RU_ALLOC_TB_FMT =0x01000000 , +IEEE80211_RADIOTAP_EHT_KNOWN_PRIMARY_80 =0x02000000 , +}; + +enum ieee80211_radiotap_eht_data { +/* Data 0 */ +IEEE80211_RADIOTAP_EHT_DATA0_SPATIAL_REUSE =0x00000078 , +IEEE80211_RADIOTAP_EHT_DATA0_GI =0x00000180 , +IEEE80211_RADIOTAP_EHT_DATA0_LTF =0x00000600 , +IEEE80211_RADIOTAP_EHT_DATA0_EHT_LTF =0x00003800 , +IEEE80211_RADIOTAP_EHT_DATA0_LDPC_EXTRA_SYM_OM =0x00004000 , +IEEE80211_RADIOTAP_EHT_DATA0_PRE_PADD_FACOR_OM =0x00018000 , +IEEE80211_RADIOTAP_EHT_DATA0_PE_DISAMBIGUITY_OM =0x00020000 , +IEEE80211_RADIOTAP_EHT_DATA0_DISREGARD_S =0x000c0000 , +IEEE80211_RADIOTAP_EHT_DATA0_DISREGARD_O =0x003c0000 , +IEEE80211_RADIOTAP_EHT_DATA0_CRC1_O =0x03c00000 , +IEEE80211_RADIOTAP_EHT_DATA0_TAIL1_O =0xfc000000 , +/* Data 1 */ +IEEE80211_RADIOTAP_EHT_DATA1_RU_SIZE =0x0000001f , +IEEE80211_RADIOTAP_EHT_DATA1_RU_INDEX =0x00001fe0 , +IEEE80211_RADIOTAP_EHT_DATA1_RU_ALLOC_CC_1_1_1 =0x003fe000 , +IEEE80211_RADIOTAP_EHT_DATA1_RU_ALLOC_CC_1_1_1_KNOWN =0x00400000 , +IEEE80211_RADIOTAP_EHT_DATA1_PRIMARY_80 =0xc0000000 , +/* Data 2 */ +IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_2_1_1 =0x000001ff , +IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_2_1_1_KNOWN =0x00000200 , +IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_1_1_2 =0x0007fc00 , +IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_1_1_2_KNOWN =0x00080000 , +IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_2_1_2 =0x1ff00000 , +IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_2_1_2_KNOWN =0x20000000 , +/* Data 3 */ +IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_1_2_1 =0x000001ff , +IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_1_2_1_KNOWN =0x00000200 , +IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_2_2_1 =0x0007fc00 , +IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_2_2_1_KNOWN =0x00080000 , +IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_1_2_2 =0x1ff00000 , +IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_1_2_2_KNOWN =0x20000000 , +/* Data 4 */ +IEEE80211_RADIOTAP_EHT_DATA4_RU_ALLOC_CC_2_2_2 =0x000001ff , +IEEE80211_RADIOTAP_EHT_DATA4_RU_ALLOC_CC_2_2_2_KNOWN =0x00000200 , +IEEE80211_RADIOTAP_EHT_DATA4_RU_ALLOC_CC_1_2_3 =0x0007fc00 , +IEEE80211_RADIOTAP_EHT_DATA4_RU_ALLOC_CC_1_2_3_KNOWN =0x00080000 , +IEEE80211_RADIOTAP_EHT_DATA4_RU_ALLOC_CC_2_2_3 =0x1ff00000 , +IEEE80211_RADIOTAP_EHT_DATA4_RU_ALLOC_CC_2_2_3_KNOWN =0x20000000 , +/* Data 5 */ +IEEE80211_RADIOTAP_EHT_DATA5_RU_ALLOC_CC_1_2_4 =0x000001ff , +IEEE80211_RADIOTAP_EHT_DATA5_RU_ALLOC_CC_1_2_4_KNOWN =0x00000200 , +IEEE80211_RADIOTAP_EHT_DATA5_RU_ALLOC_CC_2_2_4 =0x0007fc00 , +IEEE80211_RADIOTAP_EHT_DATA5_RU_ALLOC_CC_2_2_4_KNOWN =0x00080000 , +IEEE80211_RADIOTAP_EHT_DATA5_RU_ALLOC_CC_1_2_5 =0x1ff00000 , +IEEE80211_RADIOTAP_EHT_DATA5_RU_ALLOC_CC_1_2_5_KNOWN =0x20000000 , +/* Data 6 */ +IEEE80211_RADIOTAP_EHT_DATA6_RU_ALLOC_CC_2_2_5 =0x000001ff , +IEEE80211_RADIOTAP_EHT_DATA6_RU_ALLOC_CC_2_2_5_KNOWN =0x00000200 , +IEEE80211_RADIOTAP_EHT_DATA6_RU_ALLOC_CC_1_2_6 =0x0007fc00 , +IEEE80211_RADIOTAP_EHT_DATA6_RU_ALLOC_CC_1_2_6_KNOWN =0x00080000 , +IEEE80211_RADIOTAP_EHT_DATA6_RU_ALLOC_CC_2_2_6 =0x1ff00000 , +IEEE80211_RADIOTAP_EHT_DATA6_RU_ALLOC_CC_2_2_6_KNOWN =0x20000000 , +/* Data 7 */ +IEEE80211_RADIOTAP_EHT_DATA7_CRC2_O =0x0000000f , +IEEE80211_RADIOTAP_EHT_DATA7_TAIL_2_O =0x000003f0 , +IEEE80211_RADIOTAP_EHT_DATA7_NSS_S =0x0000f000 , +IEEE80211_RADIOTAP_EHT_DATA7_BEAMFORMED_S =0x00010000 , +IEEE80211_RADIOTAP_EHT_DATA7_NUM_OF_NON_OFDMA_USERS =0x000e0000 , +IEEE80211_RADIOTAP_EHT_DATA7_USER_ENCODING_BLOCK_CRC =0x00f00000 , +IEEE80211_RADIOTAP_EHT_DATA7_USER_ENCODING_BLOCK_TAIL =0x3f000000 , +/* Data 8 */ +IEEE80211_RADIOTAP_EHT_DATA8_RU_ALLOC_TB_FMT_PS_160 =0x00000001 , +IEEE80211_RADIOTAP_EHT_DATA8_RU_ALLOC_TB_FMT_B0 =0x00000002 , +IEEE80211_RADIOTAP_EHT_DATA8_RU_ALLOC_TB_FMT_B7_B1 =0x000001fc , +}; + +enum ieee80211_radiotap_eht_user_info { +IEEE80211_RADIOTAP_EHT_USER_INFO_STA_ID_KNOWN =0x00000001 , +IEEE80211_RADIOTAP_EHT_USER_INFO_MCS_KNOWN =0x00000002 , +IEEE80211_RADIOTAP_EHT_USER_INFO_CODING_KNOWN =0x00000004 , +IEEE80211_RADIOTAP_EHT_USER_INFO_NSS_KNOWN_O =0x00000010 , +IEEE80211_RADIOTAP_EHT_USER_INFO_BEAMFORMING_KNOWN_O =0x00000020 , +IEEE80211_RADIOTAP_EHT_USER_INFO_SPATIAL_CONFIG_KNOWN_M =0x00000040 , +IEEE80211_RADIOTAP_EHT_USER_INFO_DATA_FOR_USER =0x00000080 , +IEEE80211_RADIOTAP_EHT_USER_INFO_STA_ID =0x0007ff00 , +IEEE80211_RADIOTAP_EHT_USER_INFO_CODING =0x00080000 , +IEEE80211_RADIOTAP_EHT_USER_INFO_MCS =0x00f00000 , +IEEE80211_RADIOTAP_EHT_USER_INFO_NSS_O =0x0f000000 , +IEEE80211_RADIOTAP_EHT_USER_INFO_BEAMFORMING_O =0x20000000 , +IEEE80211_RADIOTAP_EHT_USER_INFO_SPATIAL_CONFIG_M =0x3f000000 , + IEEE80211_RADIOTAP_EHT_USER_INFO_RESEVED_c0000000 =0xc0000000 , +}; + +enum ieee80211_radiotap_eht_usig_common { +IEEE80211_RADIOTAP_EHT_USIG_COMMON_PHY_VER_KNOWN =0x00000001 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_KNOWN =0x00000002 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_UL_DL_KNOWN =0x00000004 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_BSS_COLOR_KNOWN =0x00000008 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_TXOP_KNOWN =0x00000010 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_BAD_USIG_CRC =0x00000020 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_PHY_VER =0x00007000 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW =0x00038000 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_UL_DL =0x00040000 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_BSS_COLOR =0x01f80000 , +IEEE80211_RADIOTAP_EHT_USIG_COMMON_TXOP =0xfe000000 , +}; + +enum ieee80211_radiotap_eht_usig_mu { +/* MU-USIG-1 */ +IEEE80211_RADIOTAP_EHT_USIG1_MU_B20_B24_DISREGARD =0x0000001f , +IEEE80211_RADIOTAP_EHT_USIG1_MU_B25_VALIDATE =0x00000020 , +/* MU-USIG-2 */ +IEEE80211_RADIOTAP_EHT_USIG2_MU_B0_B1_PPDU_TYPE =0x000000c0 , +IEEE80211_RADIOTAP_EHT_USIG2_MU_B2_VALIDATE =0x00000100 , +IEEE80211_RADIOTAP_EHT_USIG2_MU_B3_B7_PUNCTURED_INFO =0x00003e00 , +IEEE80211_RADIOTAP_EHT_USIG2_MU_B8_VALIDATE =0x00004000 , +IEEE80211_RADIOTAP_EHT_USIG2_MU_B9_B10_SIG_MCS =0x00018000 , +IEEE80211_RADIOTAP_EHT_USIG2_MU_B11_B15_EHT_SIG_SYMBOLS =0x003e0000 , +IEEE80211_RADIOTAP_EHT_USIG2_MU_B16_B19_CRC =0x03c00000 , +IEEE80211_RADIOTAP_EHT_USIG2_MU_B20_B25_TAIL =0xfc000000 , +}; + +enum ieee80211_radiotap_eht_usig_tb { +/* TB-USIG-1 */ +IEEE80211_RADIOTAP_EHT_USIG1_TB_B20_B25_DISREGARD =0x0000001f , + +/* TB-USIG-2 */ +IEEE80211_RADIOTAP_EHT_USIG2_TB_B0_B1_PPDU_TYPE =0x000000c0 , +IEEE80211_RADIOTAP_EHT_USIG2_TB_B2_VALIDATE =0x00000100 , +IEEE80211_RADIOTAP_EHT_USIG2_TB_B3_B6_SPATIAL_REUSE_1 =0x00001e00 , +IEEE80211_RADIOTAP_EHT_USIG2_TB_B7_B10_SPATIAL_REUSE_2 =0x0001e000 , +IEEE80211_RADIOTAP_EHT_USIG2_TB_B11_B15_DISREGARD =0x003e0000 , +IEEE80211_RADIOTAP_EHT_USIG2_TB_B16_B19_CRC =0x03c00000 , +IEEE80211_RADIOTAP_EHT_USIG2_TB_B20_B25_TAIL =0xfc000000 , +}; +/** * ieee80211_get_radiotap_len - get radiotap header length */
Signature · 1 line
2.38.1
PATCH v2 23/23 wifi: mac80211: add support for driver adding radiotap TLVs
In reply to [email protected]From: Mordechay Goodstein <[email protected]>
The new TLV format enables adding TLVs after the fixed fields in radiotap, as part of the radiotap header. Support this and move vendor data to the TLV format, allowing a reuse of the RX_FLAG_RADIOTAP_VENDOR_DATA as the new RX_FLAG_RADIOTAP_TLV_AT_END flag.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 27 +++--- drivers/net/wireless/mac80211_hwsim.c | 45 +++++----- include/net/ieee80211_radiotap.h | 20 +++++ include/net/mac80211.h | 44 ++-------- net/mac80211/rx.c | 82 ++++++------------- 5 files changed, 91 insertions(+), 127 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +14 -13
@@ -209,33 +209,34 @@ static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm, struct sk_buff *skb) {struct ieee80211_rx_status *rx_status =IEEE80211_SKB_RXCB (skb); -struct ieee80211_vendor_radiotap *radiotap; -const int size =sizeof (*radiotap) +sizeof (__le16); +struct ieee80211_radiotap_vendor_tlv *radiotap; +const u16 vendor_data_len =sizeof (mvm->cur_aid); +const u16 padding =ALIGN (vendor_data_len,4 ) - vendor_data_len;if (!mvm->cur_aid)return ; -/* ensure alignment */ -BUILD_BUG_ON ((size +2 ) %4 ); + radiotap =skb_put (skb,sizeof (*radiotap) + vendor_data_len + padding); + radiotap->type =cpu_to_le16 (IEEE80211_RADIOTAP_VENDOR_NAMESPACE ); + radiotap->len =cpu_to_le16 (sizeof (*radiotap) - +sizeof (struct ieee80211_radiotap_tlv ) + + vendor_data_len); - radiotap =skb_put (skb, size +2 ); - radiotap->align =1 ;/* Intel OUI */ radiotap->oui[0 ] =0xf6 ; radiotap->oui[1 ] =0x54 ; radiotap->oui[2 ] =0x25 ;/* radiotap sniffer config sub-namespace */ - radiotap->subns =1 ; - radiotap->present =0x1 ; - radiotap->len = size -sizeof (*radiotap); - radiotap->pad =2 ; - + radiotap->oui_subtype =1 ; + radiotap->vendor_type =0 ; +/* clear reserved field */ + radiotap->reserved =0 ;/* fill the data now */ memcpy (radiotap->data, &mvm->cur_aid,sizeof (mvm->cur_aid));/* and clear the padding */ -memset (radiotap->data +sizeof (__le16),0 , radiotap->pad); +memset (radiotap->data + vendor_data_len,0 , padding); - rx_status->flag |=RX_FLAG_RADIOTAP_VENDOR_DATA ; + rx_status->flag |=RX_FLAG_RADIOTAP_TLV_AT_END ; }/* iwl_mvm_pass_packet_to_mac80211 - passes the packet for mac80211 */
drivers/net/wireless/mac80211_hwsim.c +23 -22
60 lines not on this page · raw message
include/net/ieee80211_radiotap.h +20 -0
@@ -369,6 +369,26 @@ struct ieee80211_radiotap_tlv {u8 data[]; } __packed; +/** +* struct ieee80211_radiotap_vendor_tlv - vendor radiotap data information +* @type: should always be set to IEEE80211_RADIOTAP_VENDOR_NAMESPACE +* @len: length of data +* @oui: radiotap vendor namespace OUI +* @oui_subtype: radiotap vendor sub namespace +* @vendor_type: radiotap vendor type +* @reserved: should always be set to zero (to avoid leaking memory) +* @data: the actual vendor namespace data +*/ +struct ieee80211_radiotap_vendor_tlv { +__le16 type;/* IEEE80211_RADIOTAP_VENDOR_NAMESPACE */ +__le16 len; +u8 oui[3 ]; +u8 oui_subtype; +__le16 vendor_type; +__le16 reserved; +u8 data[]; +} __packed; +/* ieee80211_radiotap_eht_usig - content of U-SIG tlv (type 33) * see www.radiotap.org/fields/U-SIG.html for details */
include/net/mac80211.h +7 -37
62 lines not on this page · raw message
net/mac80211/rx.c +27 -55
157 lines not on this page · raw message
Signature · 1 line
2.38.1