initial S1G defines
Subsystems (2)
v4 cover initial S1G defines
This patchset finishes the work to make channels work on a KHz offset, and includes the initial definitions for S1G (802.11ah).
These patches on top of wt-2020-04-29 with hostap c54a5e96b505 gives the following hwsim test results:
Failed even on retry:fst_dynamic_iface_attach wpas_config_file proxyarp_open_ebtables TOTAL=3532 PASS=3265 FAIL=13 SKIP=251
Which is what we currently expect of HEAD.
Changes from v4:
- don't use float to print khz frequency
- zero out center_freq1_offset if not supplied with center_freq1
Thomas Pedersen (5):
cfg80211: add KHz variants of frame RX API
nl80211: add KHz frequency offset for most wifi commands
nl80211: support scan frequencies in KHz
ieee80211: S1G defines
nl80211: S1G band and channel definitions
include/linux/ieee80211.h | 223 +++++++++++++++++++++++++++++++++++ include/net/cfg80211.h | 71 ++++++++++- include/uapi/linux/nl80211.h | 77 +++++++++--- net/mac80211/chan.c | 7 +- net/mac80211/main.c | 2 + net/mac80211/rx.c | 8 +- net/mac80211/scan.c | 1 + net/mac80211/tx.c | 5 + net/mac80211/util.c | 5 + net/wireless/chan.c | 29 +++++ net/wireless/core.c | 5 +- net/wireless/mlme.c | 8 +- net/wireless/nl80211.c | 140 ++++++++++++++++------ net/wireless/trace.h | 12 +- net/wireless/util.c | 8 ++ 15 files changed, 526 insertions(+), 75 deletions(-)
Signature · 1 line
2.20.1
PATCH v4 1/5 cfg80211: add KHz variants of frame RX API
Drivers may wish to report the RX frequency in units of KHz. Provide cfg80211_rx_mgmt_khz() and wrap it with cfg80211_rx_mgmt() so exisiting drivers which can't report KHz anyway don't need to change. Add a similar wrapper for cfg80211_report_obss_beacon() so the frequency units stay somewhat consistent.
This doesn't actually change the nl80211 API yet.
---
v3:
wrap functions with _khz() (Johannes)
update trace entries with PR_KHZ()
v4:
drop float from PR_KHZ (Johannes)
--- include/linux/ieee80211.h | 2 ++ include/net/cfg80211.h | 54 +++++++++++++++++++++++++++++++++++---- net/mac80211/rx.c | 8 +++--- net/wireless/mlme.c | 8 +++--- net/wireless/nl80211.c | 14 +++++----- net/wireless/trace.h | 12 ++++----- 6 files changed, 73 insertions(+), 25 deletions(-)
include/linux/ieee80211.h +2 -0
@@ -3333,6 +3333,8 @@ static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size)/* convert frequencies */ #define MHZ_TO_KHZ (freq) ((freq) * 1000)#define KHZ_TO_MHZ (freq) ((freq) / 1000) +#define PR_KHZ (f) KHZ_TO_MHZ(f), f % 1000 +#define KHZ_F "%d.%03d"/* convert powers */ #define DBI_TO_MBI (gain) ((gain) * 100)
include/net/cfg80211.h +49 -5
78 lines not on this page · raw message
net/mac80211/rx.c +5 -3
@@ -3097,7 +3097,8 @@ ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx)cfg80211_report_obss_beacon (rx->local->hw.wiphy, rx->skb->data, rx->skb->len, - status->freq, sig); +ieee80211_rx_status_to_khz (status), + sig); rx->flags |=IEEE80211_RX_BEACON_REPORTED ; }
@@ -3443,8 +3444,9 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx) !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) sig = status->signal; -if (cfg80211_rx_mgmt (&rx->sdata->wdev, status->freq, sig, - rx->skb->data, rx->skb->len,0 )) { +if (cfg80211_rx_mgmt_khz (&rx->sdata->wdev, +ieee80211_rx_status_to_khz (status), sig, + rx->skb->data, rx->skb->len,0 )) {if (rx->sta) rx->sta->rx_stats.packets++;dev_kfree_skb (rx->skb);
net/wireless/mlme.c +4 -4
@@ -729,8 +729,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,return rdev_mgmt_tx (rdev, wdev, params, cookie); } -bool cfg80211_rx_mgmt (struct wireless_dev *wdev,int freq,int sig_dbm, -const u8 *buf,size_t len,u32 flags) +bool cfg80211_rx_mgmt_khz (struct wireless_dev *wdev,int freq,int sig_dbm, +const u8 *buf,size_t len,u32 flags) {struct wiphy *wiphy = wdev->wiphy;struct cfg80211_registered_device *rdev =wiphy_to_rdev (wiphy);
@@ -745,7 +745,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,cpu_to_le16 (IEEE80211_FCTL_FTYPE |IEEE80211_FCTL_STYPE );u16 stype; -trace_cfg80211_rx_mgmt (wdev, freq, sig_dbm); +trace_cfg80211_rx_mgmt_khz (wdev, freq, sig_dbm); stype = (le16_to_cpu (mgmt->frame_control) &IEEE80211_FCTL_STYPE ) >>4 ;if (!(stypes->rx &BIT (stype))) {
@@ -785,7 +785,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,trace_cfg80211_return_bool (result);return result; } -EXPORT_SYMBOL (cfg80211_rx_mgmt); +EXPORT_SYMBOL (cfg80211_rx_mgmt_khz);void cfg80211_sched_dfs_chan_update (struct cfg80211_registered_device *rdev) {
net/wireless/nl80211.c +7 -7
@@ -16256,7 +16256,7 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, netdev->ifindex)) ||nla_put_u64_64bit (msg,NL80211_ATTR_WDEV ,wdev_id (wdev),NL80211_ATTR_PAD ) || -nla_put_u32 (msg,NL80211_ATTR_WIPHY_FREQ , freq) || +nla_put_u32 (msg,NL80211_ATTR_WIPHY_FREQ ,KHZ_TO_MHZ (freq)) || (sig_dbm &&nla_put_u32 (msg,NL80211_ATTR_RX_SIGNAL_DBM , sig_dbm)) || nla_put(msg, NL80211_ATTR_FRAME, len, buf) ||
@@ -16882,16 +16882,15 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, }EXPORT_SYMBOL (cfg80211_probe_status); -void cfg80211_report_obss_beacon (struct wiphy *wiphy, -const u8 *frame,size_t len, -int freq,int sig_dbm) +void cfg80211_report_obss_beacon_khz (struct wiphy *wiphy,const u8 *frame, +size_t len,int freq,int sig_dbm) {struct cfg80211_registered_device *rdev =wiphy_to_rdev (wiphy);struct sk_buff *msg;void *hdr;struct cfg80211_beacon_registration *reg; -trace_cfg80211_report_obss_beacon (wiphy, frame, len, freq, sig_dbm); +trace_cfg80211_report_obss_beacon_khz (wiphy, frame, len, freq, sig_dbm);spin_lock_bh (&rdev->beacon_registrations_lock);list_for_each_entry (reg, &rdev->beacon_registrations, list) {
@@ -16907,7 +16906,8 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,if (nla_put_u32 (msg,NL80211_ATTR_WIPHY , rdev->wiphy_idx) || (freq && -nla_put_u32 (msg,NL80211_ATTR_WIPHY_FREQ , freq)) || +nla_put_u32 (msg,NL80211_ATTR_WIPHY_FREQ , +KHZ_TO_MHZ (freq))) || (sig_dbm &&nla_put_u32 (msg,NL80211_ATTR_RX_SIGNAL_DBM , sig_dbm)) ||nla_put (msg,NL80211_ATTR_FRAME , len, frame))
@@ -16924,7 +16924,7 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,spin_unlock_bh (&rdev->beacon_registrations_lock);nlmsg_free (msg); } -EXPORT_SYMBOL (cfg80211_report_obss_beacon); +EXPORT_SYMBOL (cfg80211_report_obss_beacon_khz);#ifdef CONFIG_PM static int cfg80211_net_detect_results(struct sk_buff *msg,
net/wireless/trace.h +6 -6
@@ -2827,7 +2827,7 @@ DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_del_sta,TP_ARGS (netdev, macaddr) ); -TRACE_EVENT(cfg80211_rx_mgmt, +TRACE_EVENT(cfg80211_rx_mgmt_khz, TP_PROTO(struct wireless_dev *wdev, int freq, int sig_dbm), TP_ARGS(wdev, freq, sig_dbm), TP_STRUCT__entry(
@@ -2840,8 +2840,8 @@ TRACE_EVENT(cfg80211_rx_mgmt, __entry->freq = freq; __entry->sig_dbm = sig_dbm; ), -TP_printk (WDEV_PR_FMT ", freq: %d, sig dbm: %d" , -WDEV_PR_ARG , __entry->freq, __entry->sig_dbm) +TP_printk (WDEV_PR_FMT ", freq: " KHZ_F ", sig dbm: %d" , +WDEV_PR_ARG ,PR_KHZ (__entry->freq), __entry->sig_dbm) ); TRACE_EVENT(cfg80211_mgmt_tx_status,
@@ -3107,7 +3107,7 @@ TRACE_EVENT(cfg80211_pmksa_candidate_notify, BOOL_TO_STR(__entry->preauth)) ); -TRACE_EVENT(cfg80211_report_obss_beacon, +TRACE_EVENT(cfg80211_report_obss_beacon_khz, TP_PROTO(struct wiphy *wiphy, const u8 *frame, size_t len, int freq, int sig_dbm), TP_ARGS(wiphy, frame, len, freq, sig_dbm),
@@ -3121,8 +3121,8 @@ TRACE_EVENT(cfg80211_report_obss_beacon, __entry->freq = freq; __entry->sig_dbm = sig_dbm; ), -TP_printk (WIPHY_PR_FMT ", freq: %d, sig_dbm: %d" , -WIPHY_PR_ARG , __entry->freq, __entry->sig_dbm) +TP_printk (WIPHY_PR_FMT ", freq: " KHZ_F ", sig_dbm: %d" , +WIPHY_PR_ARG ,PR_KHZ (__entry->freq), __entry->sig_dbm) ); TRACE_EVENT(cfg80211_tdls_oper_request,
Signature · 1 line
2.20.1
PATCH v4 2/5 nl80211: add KHz frequency offset for most wifi commands
In reply to Thomas Pedersencfg80211 recently gained the ability to understand a frequency offset component in KHz. Expose this in nl80211 through the new attributes NL80211_ATTR_WIPHY_FREQ_OFFSET, NL80211_FREQUENCY_ATTR_OFFSET, NL80211_ATTR_CENTER_FREQ1_OFFSET, and NL80211_BSS_FREQUENCY_OFFSET.
These add support to send and receive a KHz offset component with the following NL80211 commands:
- NL80211_CMD_FRAME
- NL80211_CMD_GET_SCAN
- NL80211_CMD_AUTHENTICATE
- NL80211_CMD_ASSOCIATE
- NL80211_CMD_CONNECT
Along with any other command which takes a chandef, ie:
- NL80211_CMD_SET_CHANNEL
- NL80211_CMD_SET_WIPHY
- NL80211_CMD_START_AP
- NL80211_CMD_RADAR_DETECT
- NL80211_CMD_NOTIFY_RADAR
- NL80211_CMD_CHANNEL_SWITCH
- NL80211_JOIN_IBSS
- NL80211_CMD_REMAIN_ON_CHANNEL
- NL80211_CMD_JOIN_OCB
- NL80211_CMD_JOIN_MESH
- NL80211_CMD_TDLS_CHANNEL_SWITCH
If the driver advertises a band containing channels with frequency offset, it must also verify support for frequency offset channels in its cfg80211 ops, or return an error.
---
v2:
use NLA_POLICY_RANGE for the freq offsets (Johannes)
v4:
handle case when center_freq1 is not supplied with an offset, but primary frequency had one.
--- include/uapi/linux/nl80211.h | 50 +++++++++++++++-------- net/wireless/nl80211.c | 78 +++++++++++++++++++++++++++--------- 2 files changed, 91 insertions(+), 37 deletions(-)
include/uapi/linux/nl80211.h +33 -17
@@ -296,13 +296,14 @@* to get a list of all present wiphys. * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, -* %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ (and the -* attributes determining the channel width; this is used for setting -* monitor mode channel), %NL80211_ATTR_WIPHY_RETRY_SHORT, -* %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, -* and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. -* However, for setting the channel, see %NL80211_CMD_SET_CHANNEL -* instead, the support here is for backward compatibility only. +* %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, +* %NL80211_ATTR_WIPHY_FREQ_OFFSET (and the attributes determining the +* channel width; this is used for setting monitor mode channel), +* %NL80211_ATTR_WIPHY_RETRY_SHORT, %NL80211_ATTR_WIPHY_RETRY_LONG, +* %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, and/or +* %NL80211_ATTR_WIPHY_RTS_THRESHOLD. However, for setting the channel, +* see %NL80211_CMD_SET_CHANNEL instead, the support here is for backward +* compatibility only. * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request * or rename notification. Has attributes %NL80211_ATTR_WIPHY and * %NL80211_ATTR_WIPHY_NAME.
@@ -351,7 +352,8 @@* %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT, * %NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS. * The channel to use can be set on the interface or be given using the -* %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width. +* %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_FREQ_OFFSET, and the +* attributes determining channel width. * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
@@ -536,11 +538,12 @@* interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify * the SSID (mainly for association, but is included in authentication -* request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used -* to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE -* is used to specify the authentication type. %NL80211_ATTR_IE is used to -* define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs) -* to be added to the frame. +* request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ + +* %NL80211_ATTR_WIPHY_FREQ_OFFSET is used to specify the frequence of the +* channel in MHz. %NL80211_ATTR_AUTH_TYPE is used to specify the +* authentication type. %NL80211_ATTR_IE is used to define IEs +* (VendorSpecificInfo, but also including RSN IE and FT IEs) to be added +* to the frame. * When used as an event, this reports reception of an Authentication * frame in station and IBSS modes when the local MLME processed the * frame, i.e., it was for the local STA and was received in correct
@@ -595,8 +598,9 @@* requests to connect to a specified network but without separating * auth and assoc steps. For this, you need to specify the SSID in a * %NL80211_ATTR_SSID attribute, and can optionally specify the association -* IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP, -* %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, +* IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, +* %NL80211_ATTR_USE_MFP, %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, +* %NL80211_ATTR_WIPHY_FREQ_OFFSET, %NL80211_ATTR_CONTROL_PORT, * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, * %NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and
@@ -1433,7 +1437,8 @@ enum nl80211_commands {* of &enum nl80211_chan_width, describing the channel width. See the * documentation of the enum for more information. * @NL80211_ATTR_CENTER_FREQ1: Center frequency of the first part of the -* channel, used for anything but 20 MHz bandwidth +* channel, used for anything but 20 MHz bandwidth. In S1G this is the +* operating channel center frequency. * @NL80211_ATTR_CENTER_FREQ2: Center frequency of the second part of the * channel, used only for 80+80 MHz bandwidth * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
@@ -2480,9 +2485,14 @@ enum nl80211_commands {* entry without having to force a disconnection after the PMK timeout. If * no roaming occurs between the reauth threshold and PMK expiration, * disassociation is still forced. -* * @NL80211_ATTR_RECEIVE_MULTICAST: multicast flag for the * %NL80211_CMD_REGISTER_FRAME command, see the description there. +* @NL80211_ATTR_WIPHY_FREQ_OFFSET: offset of the associated +* %NL80211_ATTR_WIPHY_FREQ in positive KHz. Only valid when supplied with +* an %NL80211_ATTR_WIPHY_FREQ_OFFSET. +* @NL80211_ATTR_CENTER_FREQ1_OFFSET: Center frequency offset in KHz for the +* first channel segment specified in %NL80211_ATTR_CENTER_FREQ1. +* * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2960,6 +2970,8 @@ enum nl80211_attrs {NL80211_ATTR_PMK_REAUTH_THRESHOLD ,NL80211_ATTR_RECEIVE_MULTICAST , +NL80211_ATTR_WIPHY_FREQ_OFFSET , + NL80211_ATTR_CENTER_FREQ1_OFFSET,/* add attributes here, update the policy in nl80211.c */
@@ -3682,6 +3694,7 @@ enum nl80211_wmm_rule {* (see &enum nl80211_wmm_rule) * @NL80211_FREQUENCY_ATTR_NO_HE: HE operation is not allowed on this channel * in current regulatory domain. +* @NL80211_FREQUENCY_ATTR_OFFSET: frequency offset in KHz * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number * currently defined * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -3712,6 +3725,7 @@ enum nl80211_frequency_attr {NL80211_FREQUENCY_ATTR_NO_10MHZ ,NL80211_FREQUENCY_ATTR_WMM ,NL80211_FREQUENCY_ATTR_NO_HE , +NL80211_FREQUENCY_ATTR_OFFSET ,/* keep last */ __NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -4482,6 +4496,7 @@ enum nl80211_bss_scan_width {* @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update. * Contains a nested array of signal strength attributes (u8, dBm), * using the nesting index as the antenna number. +* @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */
@@ -4506,6 +4521,7 @@ enum nl80211_bss {NL80211_BSS_PARENT_TSF ,NL80211_BSS_PARENT_BSSID ,NL80211_BSS_CHAIN_SIGNAL , +NL80211_BSS_FREQUENCY_OFFSET ,/* keep last */ __NL80211_BSS_AFTER_LAST,
net/wireless/nl80211.c +58 -20
185 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 3/5 nl80211: support scan frequencies in KHz
In reply to Thomas PedersenIf the driver advertises NL80211_EXT_FEATURE_SCAN_FREQ_KHZ userspace can omit NL80211_ATTR_SCAN_FREQUENCIES in favor of an NL80211_ATTR_SCAN_FREQ_KHZ. To get scan results in KHz userspace must also set the NL80211_SCAN_FLAG_FREQ_KHZ.
This lets nl80211 remain compatible with older userspaces while not requring and sending redundant (and potentially incorrect) scan frequency sets.
---
v3:
- report SCAN_FREQ_KHZ in scan results
- advertise SCAN_FREQ_KHZ support in feature flag
- add SCAN_FLAG_FREQ_KHZ so user can select scan result frequency units
--- include/uapi/linux/nl80211.h | 13 ++++++++- net/mac80211/main.c | 2 ++ net/wireless/nl80211.c | 52 +++++++++++++++++++++++++++--------- 3 files changed, 54 insertions(+), 13 deletions(-)
include/uapi/linux/nl80211.h +12 -1
@@ -2492,7 +2492,7 @@ enum nl80211_commands {* an %NL80211_ATTR_WIPHY_FREQ_OFFSET. * @NL80211_ATTR_CENTER_FREQ1_OFFSET: Center frequency offset in KHz for the * first channel segment specified in %NL80211_ATTR_CENTER_FREQ1. -* +* @NL80211_ATTR_SCAN_FREQ_KHZ: nested attribute with KHz frequencies * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2972,6 +2972,7 @@ enum nl80211_attrs {NL80211_ATTR_RECEIVE_MULTICAST ,NL80211_ATTR_WIPHY_FREQ_OFFSET ,NL80211_ATTR_CENTER_FREQ1_OFFSET , + NL80211_ATTR_SCAN_FREQ_KHZ,/* add attributes here, update the policy in nl80211.c */
@@ -5721,6 +5722,11 @@ enum nl80211_feature_flags {* @NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS: management frame registrations * are possible for multicast frames and those will be reported properly. * +* @NL80211_EXT_FEATURE_SCAN_FREQ_KHZ: This driver supports receiving and +* reporting scan request with %NL80211_ATTR_SCAN_FREQ_KHZ. In order to +* report %NL80211_ATTR_SCAN_FREQ_KHZ, %NL80211_SCAN_FLAG_FREQ_KHZ must be +* included in the scan request. +* * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */
@@ -5774,6 +5780,7 @@ enum nl80211_ext_feature_index {NL80211_EXT_FEATURE_DEL_IBSS_STA ,NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS ,NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT , +NL80211_EXT_FEATURE_SCAN_FREQ_KHZ ,/* add new features before the definition below */ NUM_NL80211_EXT_FEATURES,
@@ -5885,6 +5892,9 @@ enum nl80211_timeout_reason {* @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to * only have supported rates and no additional capabilities (unless * added by userspace explicitly.) +* @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. */ enum nl80211_scan_flags {NL80211_SCAN_FLAG_LOW_PRIORITY =1 <<0 ,
@@ -5900,6 +5910,7 @@ enum nl80211_scan_flags {NL80211_SCAN_FLAG_HIGH_ACCURACY =1 <<10 ,NL80211_SCAN_FLAG_RANDOM_SN =1 <<11 ,NL80211_SCAN_FLAG_MIN_PREQ_CONTENT =1 <<12 , + NL80211_SCAN_FLAG_FREQ_KHZ = 1<<13, };/**
net/mac80211/main.c +2 -0
@@ -596,6 +596,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH ); +wiphy_ext_feature_set (wiphy, +NL80211_EXT_FEATURE_SCAN_FREQ_KHZ );if (!ops->hw_scan) { wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
net/wireless/nl80211.c +40 -12
88 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 4/5 ieee80211: S1G defines
In reply to Thomas PedersenThese are found in IEEE-802.11ah-2016.
--- include/linux/ieee80211.h | 221 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+)
include/linux/ieee80211.h +221 -0
@@ -105,6 +105,51 @@/* extension, added by 802.11ad */ #define IEEE80211_STYPE_DMG_BEACON 0x0000 +#define IEEE80211_STYPE_S1G_BEACON 0x0010 + +/* bits unique to S1G beacon */ +#define IEEE80211_S1G_BCN_NEXT_TBTT 0x100 + +/* see 802.11ah-2016 9.9 NDP CMAC frames */ +#define IEEE80211_S1G_1MHZ_NDP_BITS 25 +#define IEEE80211_S1G_1MHZ_NDP_BYTES 4 +#define IEEE80211_S1G_2MHZ_NDP_BITS 37 +#define IEEE80211_S1G_2MHZ_NDP_BYTES 5 + +#define IEEE80211_NDP_FTYPE_CTS 0 +#define IEEE80211_NDP_FTYPE_CF_END 0 +#define IEEE80211_NDP_FTYPE_PS_POLL 1 +#define IEEE80211_NDP_FTYPE_ACK 2 +#define IEEE80211_NDP_FTYPE_PS_POLL_ACK 3 +#define IEEE80211_NDP_FTYPE_BA 4 +#define IEEE80211_NDP_FTYPE_BF_REPORT_POLL 5 +#define IEEE80211_NDP_FTYPE_PAGING 6 +#define IEEE80211_NDP_FTYPE_PREQ 7 + +#define SM64 (f, v) ((((u64)v) << f##_S) & f) + +/* NDP CMAC frame fields */ +#define IEEE80211_NDP_FTYPE 0x0000000000000007 +#define IEEE80211_NDP_FTYPE_S 0x0000000000000000 + +/* 1M Probe Request 11ah 9.9.3.1.1 */ +#define IEEE80211_NDP_1M_PREQ_ANO 0x0000000000000008 +#define IEEE80211_NDP_1M_PREQ_ANO_S 3 +#define IEEE80211_NDP_1M_PREQ_CSSID 0x00000000000FFFF0 +#define IEEE80211_NDP_1M_PREQ_CSSID_S 4 +#define IEEE80211_NDP_1M_PREQ_RTYPE 0x0000000000100000 +#define IEEE80211_NDP_1M_PREQ_RTYPE_S 20 +#define IEEE80211_NDP_1M_PREQ_RSV 0x0000000001E00000 +#define IEEE80211_NDP_1M_PREQ_RSV 0x0000000001E00000 +/* 2M Probe Request 11ah 9.9.3.1.2 */ +#define IEEE80211_NDP_2M_PREQ_ANO 0x0000000000000008 +#define IEEE80211_NDP_2M_PREQ_ANO_S 3 +#define IEEE80211_NDP_2M_PREQ_CSSID 0x0000000FFFFFFFF0 +#define IEEE80211_NDP_2M_PREQ_CSSID_S 4 +#define IEEE80211_NDP_2M_PREQ_RTYPE 0x0000001000000000 +#define IEEE80211_NDP_2M_PREQ_RTYPE_S 36 + +#define IEEE80211_ANO_NETTYPE_WILD 15/* control extension - for IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTL_EXT */ #define IEEE80211_CTL_EXT_POLL 0x2000
@@ -121,6 +166,21 @@#define IEEE80211_MAX_SN IEEE80211_SN_MASK#define IEEE80211_SN_MODULO (IEEE80211_MAX_SN + 1) + +/* PV1 Layout 11ah 9.8.3.1 */ +#define IEEE80211_PV1_FCTL_VERS 0x0003 +#define IEEE80211_PV1_FCTL_FTYPE 0x001c +#define IEEE80211_PV1_FCTL_STYPE 0x00e0 +#define IEEE80211_PV1_FCTL_TODS 0x0100 +#define IEEE80211_PV1_FCTL_MOREFRAGS 0x0200 +#define IEEE80211_PV1_FCTL_PM 0x0400 +#define IEEE80211_PV1_FCTL_MOREDATA 0x0800 +#define IEEE80211_PV1_FCTL_PROTECTED 0x1000 +#define IEEE80211_PV1_FCTL_END_SP 0x2000 +#define IEEE80211_PV1_FCTL_RELAYED 0x4000 +#define IEEE80211_PV1_FCTL_ACK_POLICY 0x8000 +#define IEEE80211_PV1_FCTL_CTL_EXT 0x0f00 +static inline bool ieee80211_sn_less (u16 sn1,u16 sn2) {return ((sn1 - sn2) &IEEE80211_SN_MASK ) > (IEEE80211_SN_MODULO >>1 );
@@ -148,6 +208,7 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)#define IEEE80211_MAX_FRAG_THRESHOLD 2352#define IEEE80211_MAX_RTS_THRESHOLD 2353#define IEEE80211_MAX_AID 2007 +#define IEEE80211_MAX_AID_S1G 8191#define IEEE80211_MAX_TIM_LEN 251#define IEEE80211_MAX_MESH_PEERINGS 63/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -371,6 +432,17 @@ static inline bool ieee80211_is_data(__le16 fc)cpu_to_le16 (IEEE80211_FTYPE_DATA ); } +/** +* ieee80211_is_ext - check if type is IEEE80211_FTYPE_EXT +* @fc: frame control bytes in little-endian byteorder +*/ +static inline bool ieee80211_is_ext (__le16 fc) +{ +return (fc &cpu_to_le16 (IEEE80211_FCTL_FTYPE )) == +cpu_to_le16 (IEEE80211_FTYPE_EXT ); +} + +/** * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set * @fc: frame control bytes in little-endian byteorder
@@ -469,6 +541,18 @@ static inline bool ieee80211_is_beacon(__le16 fc)cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_BEACON ); } +/** +* ieee80211_is_s1g_beacon - check if IEEE80211_FTYPE_EXT && +* IEEE80211_STYPE_S1G_BEACON +* @fc: frame control bytes in little-endian byteorder +*/ +static inline bool ieee80211_is_s1g_beacon (__le16 fc) +{ +return (fc &cpu_to_le16 (IEEE80211_FCTL_FTYPE | +IEEE80211_FCTL_STYPE )) == +cpu_to_le16 (IEEE80211_FTYPE_EXT |IEEE80211_STYPE_S1G_BEACON ); +} +/** * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM * @fc: frame control bytes in little-endian byteorder
@@ -900,6 +984,59 @@ struct ieee80211_addba_ext_ie {u8 data; } __packed; +/** +* struct ieee80211_s1g_bcn_compat_ie +* +* S1G Beacon Compatibility element +*/ +struct ieee80211_s1g_bcn_compat_ie { +__le16 compat_info; +__le16 beacon_int; +__le32 tsf_completion; +} __packed; + +/** +* struct ieee80211_s1g_oper_ie +* +* S1G Operation element +*/ +struct ieee80211_s1g_oper_ie { +u8 ch_width; +u8 oper_class; +u8 primary_ch; +u8 oper_ch; +__le16 basic_mcs_nss; +} __packed; + +/** +* struct ieee80211_aid_response_ie +* +* AID Response element +*/ +struct ieee80211_aid_response_ie { +__le16 aid; +u8 switch_count; +__le16 response_int; +} __packed; + +struct ieee80211_s1g_cap { +u8 capab_info[10 ]; +u8 supp_mcs_nss[5 ]; +} __packed; + +struct ieee80211_ext { +__le16 frame_control; +__le16 duration; +union { +struct { +u8 sa[ETH_ALEN ]; +__le32 timestamp; +u8 change_seq; +u8 variable[0 ]; + } __packed s1g_beacon; + } u; +} __packed__aligned(2) ; +struct ieee80211_mgmt {__le16 frame_control;__le16 duration;
@@ -2137,6 +2274,86 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)return spr_len; } +/* S1G Capabilities Information field */ +#define S1G_CAPAB_B0_S1G_LONG BIT(0) +#define S1G_CAPAB_B0_SGI_1MHZ BIT(1) +#define S1G_CAPAB_B0_SGI_2MHZ BIT(2) +#define S1G_CAPAB_B0_SGI_4MHZ BIT(3) +#define S1G_CAPAB_B0_SGI_8MHZ BIT(4) +#define S1G_CAPAB_B0_SGI_16MHZ BIT(5) +#define S1G_CAPAB_B0_SUPP_CH_WIDTH_MASK (BIT(6) | BIT(7)) +#define S1G_CAPAB_B0_SUPP_CH_WIDTH_SHIFT 6 + +#define S1G_CAPAB_B1_RX_LDPC BIT(0) +#define S1G_CAPAB_B1_TX_STBC BIT(1) +#define S1G_CAPAB_B1_RX_STBC BIT(2) +#define S1G_CAPAB_B1_SU_BFER BIT(3) +#define S1G_CAPAB_B1_SU_BFEE BIT(4) +#define S1G_CAPAB_B1_BFEE_STS_MASK (BIT(5) | BIT(6) | BIT(7)) +#define S1G_CAPAB_B1_BFEE_STS_SHIFT 5 + +#define S1G_CAPAB_B2_SOUNDING_DIMENSIONS_MASK (BIT(0) | BIT(1) | BIT(2)) +#define S1G_CAPAB_B2_SOUNDING_DIMENSIONS_SHIFT 0 +#define S1G_CAPAB_B2_MU_BFER BIT(3) +#define S1G_CAPAB_B2_MU_BFEE BIT(4) +#define S1G_CAPAB_B2_PLUS_HTC_VHT BIT(5) +#define S1G_CAPAB_B2_TRAVELING_PILOT_MASK (BIT(6) | BIT(7)) +#define S1G_CAPAB_B2_TRAVELING_PILOT_SHIFT 6 + +#define S1G_CAPAB_B3_RD_RESPONDER BIT(0) +#define S1G_CAPAB_B3_HT_DELAYED_BA BIT(1) +#define S1G_CAPAB_B3_MAX_MPDU_LEN BIT(2) +#define S1G_CAPAB_B3_MAX_AMPDU_LEN_EXP_MASK (BIT(3) | BIT(4)) +#define S1G_CAPAB_B3_MAX_AMPDU_LEN_EXP_SHIFT 3 +#define S1G_CAPAB_B3_MIN_MPDU_START_MASK (BIT(5) | BIT(6) | BIT(7)) +#define S1G_CAPAB_B3_MIN_MPDU_START_SHIFT 5 + +#define S1G_CAPAB_B4_UPLINK_SYNC BIT(0) +#define S1G_CAPAB_B4_DYNAMIC_AID BIT(1) +#define S1G_CAPAB_B4_BAT BIT(2) +#define S1G_CAPAB_B4_TIME_ADE BIT(3) +#define S1G_CAPAB_B4_NON_TIM BIT(4) +#define S1G_CAPAB_B4_GROUP_AID BIT(5) +#define S1G_CAPAB_B4_STA_TYPE_MASK (BIT(6) | BIT(7)) +#define S1G_CAPAB_B4_STA_TYPE_SHIFT 6 + +#define S1G_CAPAB_B5_CENT_AUTH_CONTROL BIT(0) +#define S1G_CAPAB_B5_DIST_AUTH_CONTROL BIT(1) +#define S1G_CAPAB_B5_AMSDU BIT(2) +#define S1G_CAPAB_B5_AMPDU BIT(3) +#define S1G_CAPAB_B5_ASYMMETRIC_BA BIT(4) +#define S1G_CAPAB_B5_FLOW_CONTROL BIT(5) +#define S1G_CAPAB_B5_SECTORIZED_BEAM_MASK (BIT(6) | BIT(7)) +#define S1G_CAPAB_B5_SECTORIZED_BEAM_SHIFT 6 + +#define S1G_CAPAB_B6_OBSS_MITIGATION BIT(0) +#define S1G_CAPAB_B6_FRAGMENT_BA BIT(1) +#define S1G_CAPAB_B6_NDP_PS_POLL BIT(2) +#define S1G_CAPAB_B6_RAW_OPERATION BIT(3) +#define S1G_CAPAB_B6_PAGE_SLICING BIT(4) +#define S1G_CAPAB_B6_TXOP_SHARING_IMP_ACK BIT(5) +#define S1G_CAPAB_B6_VHT_LINK_ADAPT_MASK (BIT(6) | BIT(7)) +#define S1G_CAPAB_B6_VHT_LINK_ADAPT_SHIFT 6 + +#define S1G_CAPAB_B7_TACK_AS_PS_POLL BIT(0) +#define S1G_CAPAB_B7_DUP_1MHZ BIT(1) +#define S1G_CAPAB_B7_MCS_NEGOTIATION BIT(2) +#define S1G_CAPAB_B7_1MHZ_CTL_RESPONSE_PREAMBLE BIT(3) +#define S1G_CAPAB_B7_NDP_BFING_REPORT_POLL BIT(4) +#define S1G_CAPAB_B7_UNSOLICITED_DYN_AID BIT(5) +#define S1G_CAPAB_B7_SECTOR_TRAINING_OPERATION BIT(6) +#define S1G_CAPAB_B7_TEMP_PS_MODE_SWITCH BIT(7) + +#define S1G_CAPAB_B8_TWT_GROUPING BIT(0) +#define S1G_CAPAB_B8_BDT BIT(1) +#define S1G_CAPAB_B8_COLOR_MASK (BIT(2) | BIT(3) | BIT(4)) +#define S1G_CAPAB_B8_COLOR_SHIFT 2 +#define S1G_CAPAB_B8_TWT_REQUEST BIT(5) +#define S1G_CAPAB_B8_TWT_RESPOND BIT(6) +#define S1G_CAPAB_B8_PV1_FRAME BIT(7) + +#define S1G_CAPAB_B9_LINK_ADAPT_PER_CONTROL_RESPONSE BIT(0) +/* Authentication algorithms */ #define WLAN_AUTH_OPEN 0#define WLAN_AUTH_SHARED_KEY 1
@@ -2532,8 +2749,12 @@ enum ieee80211_eid {WLAN_EID_QUIET_CHANNEL =198 ,WLAN_EID_OPMODE_NOTIF =199 , +WLAN_EID_S1G_BCN_COMPAT =213 , +WLAN_EID_S1G_SHORT_BCN_INTERVAL =214 , +WLAN_EID_S1G_CAPABILITIES =217 ,WLAN_EID_VENDOR_SPECIFIC =221 ,WLAN_EID_QOS_PARAMETER =222 , +WLAN_EID_S1G_OPERATION =232 ,WLAN_EID_CAG_NUMBER =237 ,WLAN_EID_AP_CSN =239 , WLAN_EID_FILS_INDICATION = 240,
Signature · 1 line
2.20.1
PATCH v4 5/5 nl80211: S1G band and channel definitions
In reply to Thomas PedersenGives drivers the definitions needed to advertise support for S1G bands.
--- include/net/cfg80211.h | 17 +++++++++++++++++ include/uapi/linux/nl80211.h | 16 ++++++++++++++++ net/mac80211/chan.c | 7 ++++++- net/mac80211/scan.c | 1 + net/mac80211/tx.c | 5 +++++ net/mac80211/util.c | 5 +++++ net/wireless/chan.c | 29 +++++++++++++++++++++++++++++ net/wireless/core.c | 5 +++-- net/wireless/util.c | 8 ++++++++ 9 files changed, 90 insertions(+), 3 deletions(-)
include/net/cfg80211.h +17 -0
@@ -414,6 +414,22 @@ struct ieee80211_edmg {enum ieee80211_edmg_bw_config bw_config; }; +/** +* struct ieee80211_sta_s1g_cap - STA's S1G capabilities +* +* This structure describes most essential parameters needed +* to describe 802.11ah S1G capabilities for a STA. +* +* @s1g_supported: is STA an S1G STA +* @cap: S1G capabilities information +* @nss_mcs: Supported NSS MCS set +*/ +struct ieee80211_sta_s1g_cap { +bool s1g; +u8 cap[10 ];/* use S1G_CAPAB_ */ +u8 nss_mcs[5 ]; +}; +/** * struct ieee80211_supported_band - frequency band definition *
@@ -445,6 +461,7 @@ struct ieee80211_supported_band {int n_bitrates;struct ieee80211_sta_ht_cap ht_cap;struct ieee80211_sta_vht_cap vht_cap; +struct ieee80211_sta_s1g_cap s1g_cap;struct ieee80211_edmg edmg_cap;u16 n_iftype_data;const struct ieee80211_sband_iftype_data *iftype_data;
include/uapi/linux/nl80211.h +16 -0
@@ -4421,6 +4421,11 @@ enum nl80211_key_mode {* attribute must be provided as well * @NL80211_CHAN_WIDTH_5: 5 MHz OFDM channel * @NL80211_CHAN_WIDTH_10: 10 MHz OFDM channel +* @NL80211_CHAN_WIDTH_1: 1 MHz OFDM channel +* @NL80211_CHAN_WIDTH_2: 2 MHz OFDM channel +* @NL80211_CHAN_WIDTH_4: 4 MHz OFDM channel +* @NL80211_CHAN_WIDTH_8: 8 MHz OFDM channel +* @NL80211_CHAN_WIDTH_16: 16 MHz OFDM channel */ enum nl80211_chan_width {NL80211_CHAN_WIDTH_20_NOHT ,
@@ -4431,6 +4436,11 @@ enum nl80211_chan_width {NL80211_CHAN_WIDTH_160 ,NL80211_CHAN_WIDTH_5 ,NL80211_CHAN_WIDTH_10 , +NL80211_CHAN_WIDTH_1 , +NL80211_CHAN_WIDTH_2 , +NL80211_CHAN_WIDTH_4 , +NL80211_CHAN_WIDTH_8 , + NL80211_CHAN_WIDTH_16, };/**
@@ -4441,11 +4451,15 @@ enum nl80211_chan_width {* @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide +* @NL80211_BSS_CHAN_WIDTH_1: control channel is 1 MHz wide +* @NL80211_BSS_CHAN_WIDTH_2: control channel is 2 MHz wide */ enum nl80211_bss_scan_width {NL80211_BSS_CHAN_WIDTH_20 ,NL80211_BSS_CHAN_WIDTH_10 ,NL80211_BSS_CHAN_WIDTH_5 , +NL80211_BSS_CHAN_WIDTH_1 , +NL80211_BSS_CHAN_WIDTH_2 , };/**
@@ -4724,6 +4738,7 @@ enum nl80211_txrate_gi {* @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz) * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 69.12 GHz) * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.2 GHz) +* @NL80211_BAND_S1GHZ: around 900MHz, supported by S1G PHYs * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace * since newer kernel versions may support more bands */
@@ -4732,6 +4747,7 @@ enum nl80211_band {NL80211_BAND_5GHZ ,NL80211_BAND_60GHZ ,NL80211_BAND_6GHZ , +NL80211_BAND_S1GHZ , NUM_NL80211_BANDS, };
net/mac80211/chan.c +6 -1
@@ -313,9 +313,14 @@ void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,lockdep_assert_held (&local->chanctx_mtx); -/* don't optimize 5MHz, 10MHz, and radar_enabled confs */ +/* don't optimize non-20MHz based and radar_enabled confs */ if (ctx->conf.def.width ==NL80211_CHAN_WIDTH_5 || ctx->conf.def.width ==NL80211_CHAN_WIDTH_10 || + ctx->conf.def.width ==NL80211_CHAN_WIDTH_1 || + ctx->conf.def.width ==NL80211_CHAN_WIDTH_2 || + ctx->conf.def.width ==NL80211_CHAN_WIDTH_4 || + ctx->conf.def.width ==NL80211_CHAN_WIDTH_8 || + ctx->conf.def.width ==NL80211_CHAN_WIDTH_16 || ctx->conf.radar_enabled) { ctx->conf.min_def = ctx->conf.def;return ;
net/mac80211/scan.c +1 -0
@@ -906,6 +906,7 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,case NL80211_BSS_CHAN_WIDTH_10 : local->scan_chandef.width =NL80211_CHAN_WIDTH_10 ;break ; +default :case NL80211_BSS_CHAN_WIDTH_20 :/* If scanning on oper channel, use whatever channel-type * is currently in use.
net/mac80211/tx.c +5 -0
@@ -80,6 +80,10 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, sband = local->hw.wiphy->bands[info->band]; txrate = &sband->bitrates[tx->rate.idx]; +if (sband->band ==NL80211_BAND_S1GHZ ) +/* TODO */ +return 0 ; + erp = txrate->flags &IEEE80211_RATE_ERP_G ;/*
@@ -166,6 +170,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,if (r->flags &IEEE80211_RATE_MANDATORY_A ) mrate = r->bitrate;break ; +case NL80211_BAND_S1GHZ :case NL80211_BAND_60GHZ :/* TODO, for now fall through */ case NUM_NL80211_BANDS :
net/mac80211/util.c +5 -0
@@ -3456,6 +3456,11 @@ u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c) c->width =NL80211_CHAN_WIDTH_20_NOHT ; ret =IEEE80211_STA_DISABLE_HT |IEEE80211_STA_DISABLE_VHT ;break ; +case NL80211_CHAN_WIDTH_1 : +case NL80211_CHAN_WIDTH_2 : +case NL80211_CHAN_WIDTH_4 : +case NL80211_CHAN_WIDTH_8 : +case NL80211_CHAN_WIDTH_16 :case NL80211_CHAN_WIDTH_5 :case NL80211_CHAN_WIDTH_10 :WARN_ON_ONCE (1 );
net/wireless/chan.c +29 -0
@@ -153,6 +153,11 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) control_freq = chandef->chan->center_freq;switch (chandef->width) { +case NL80211_CHAN_WIDTH_1 : +case NL80211_CHAN_WIDTH_2 : +case NL80211_CHAN_WIDTH_4 : +case NL80211_CHAN_WIDTH_8 : +case NL80211_CHAN_WIDTH_16 :case NL80211_CHAN_WIDTH_5 :case NL80211_CHAN_WIDTH_10 :case NL80211_CHAN_WIDTH_20 :
@@ -263,6 +268,21 @@ static int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)int width;switch (c->width) { +case NL80211_CHAN_WIDTH_1 : + width =1 ; +break ; +case NL80211_CHAN_WIDTH_2 : + width =2 ; +break ; +case NL80211_CHAN_WIDTH_4 : + width =4 ; +break ; +case NL80211_CHAN_WIDTH_8 : + width =8 ; +break ; +case NL80211_CHAN_WIDTH_16 : + width =16 ; +break ;case NL80211_CHAN_WIDTH_5 : width =5 ;break ;
@@ -911,6 +931,15 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, control_freq = chandef->chan->center_freq;switch (chandef->width) { +case NL80211_CHAN_WIDTH_1 : + width =1 ; +break ; +case NL80211_CHAN_WIDTH_2 : + width =2 ; +break ; +case NL80211_CHAN_WIDTH_4 : + width =4 ; +break ;case NL80211_CHAN_WIDTH_5 : width =5 ;break ;
net/wireless/core.c +3 -2
@@ -800,10 +800,11 @@ int wiphy_register(struct wiphy *wiphy)if (WARN_ON (!sband->n_channels))return -EINVAL ;/* -* on 60GHz band, there are no legacy rates, so +* on 60GHz or sub-1Ghz band, there are no legacy rates, so * n_bitrates is 0 */ -if (WARN_ON (band !=NL80211_BAND_60GHZ && +if (WARN_ON ((band !=NL80211_BAND_60GHZ && + band !=NL80211_BAND_S1GHZ ) && !sband->n_bitrates))return -EINVAL ;
net/wireless/util.c +8 -0
@@ -100,6 +100,8 @@ u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band)if (chan <7 )return MHZ_TO_KHZ (56160 + chan *2160 );break ; +case NL80211_BAND_S1GHZ : +return 902000 + chan *500 ;default : ; }
@@ -208,6 +210,12 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband)WARN_ON (!sband->ht_cap.ht_supported);WARN_ON ((sband->ht_cap.mcs.rx_mask[0 ] &0x1e ) !=0x1e );break ; +case NL80211_BAND_S1GHZ : +/* Figure 9-589bd: 3 means unsupported, so != 3 means at least +* mandatory is ok. +*/ +WARN_ON ((sband->s1g_cap.nss_mcs[0 ] &0x3 ) ==0x3 ); +break ;case NUM_NL80211_BANDS :default :WARN_ON (1 );
Signature · 1 line
2.20.1
Johannes Berg
maintainerRe: [PATCH v4 5/5] nl80211: S1G band and channel definitions
Hi Thomas,
This looks mostly good (and I've applied the other 4 patches with some fixups), but ...
Quoted 4 lines
net/wireless/chan.c +0
-0@@ -911,6 +931,15 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, control_freq = chandef->chan->center_freq;switch (chandef->width) {
net/wireless/chan.c bool cfg80211_chandef_usable(struct wiphy *wiphy, · line 943
Quoted 10 lines
net/wireless/chan.c +9
-0+case NL80211_CHAN_WIDTH_1 : + width =1 ; +break ; +case NL80211_CHAN_WIDTH_2 : + width =2 ; +break ; +case NL80211_CHAN_WIDTH_4 : + width =4 ; +break ;case NL80211_CHAN_WIDTH_5 :
aren't you missing some bandwidths here? You'd fall through to a WARN_ON(), which doesn't seem good?
johannes
Re: [PATCH v4 5/5] nl80211: S1G band and channel definitions
Quoted 8 lines · Johannes Berg
Hi Thomas,
This looks mostly good (and I've applied the other 4 patches with some fixups), but ...
Quoted 3 lines
(quoted diff) +0
-0@@ -911,6 +931,15 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, control_freq = chandef->chan->center_freq;
Quoted 14 lines
net/wireless/chan.c bool cfg80211_chandef_usable(struct wiphy *wiphy, · line 943
Quoted 11 lines
net/wireless/chan.c +9
-0switch (chandef->width) { +case NL80211_CHAN_WIDTH_1 : + width =1 ; +break ; +case NL80211_CHAN_WIDTH_2 : + width =2 ; +break ; +case NL80211_CHAN_WIDTH_4 : + width =4 ; +break ;case NL80211_CHAN_WIDTH_5 :aren't you missing some bandwidths here? You'd fall through to a
WARN_ON(), which doesn't seem good?
Yep. Looks like hwsim tests needs a test for larger bandwidths.
Signature · 1 line
thomas