add support for S1G association
Subsystems (5)
v4 cover add support for S1G association
These are the remaining (v4) patches in the S1G association series.
Changes in v4:
- stop fudging the channel width in cfg80211_chandef_create() (we don't actually need it).
- use NLA_POLICY_EXACT_LEN() in nl80211 policy
- protect against eg. DS param IE in S1G
- remove bss->s1g tracking
- clean up ugly check for S1G BSS
- fix ieee80211_encode_usf() return type (thanks kbot)
Thomas Pedersen (17):
{cfg,mac}80211: get correct default channel width for S1G
mac80211: s1g: choose scanning width based on frequency
nl80211: support S1G capabilities
mac80211: support S1G STA capabilities
cfg80211: convert S1G beacon to scan results
cfg80211: parse S1G Operation element for BSS channel
mac80211: convert S1G beacon to scan results
cfg80211: handle Association Response from S1G STA
mac80211: encode listen interval for S1G
mac80211: don't calculate duration for S1G
mac80211: handle S1G low rates
mac80211: avoid rate init for S1G band
mac80211: receive and process S1G beacons
mac80211: support S1G association
nl80211: include frequency offset in survey info
mac80211_hwsim: fix TSF timestamp write to S1G beacon
mac80211_hwsim: indicate support for S1G
drivers/net/wireless/mac80211_hwsim.c | 98 +++++++++++-- include/linux/ieee80211.h | 67 +++++++++ include/net/cfg80211.h | 3 + include/net/mac80211.h | 4 + include/uapi/linux/nl80211.h | 11 ++ net/mac80211/cfg.c | 2 + net/mac80211/chan.c | 9 +- net/mac80211/ibss.c | 3 +- net/mac80211/ieee80211_i.h | 16 +++ net/mac80211/iface.c | 5 + net/mac80211/mlme.c | 180 ++++++++++++++++++----- net/mac80211/rate.c | 39 ++++- net/mac80211/rx.c | 87 +++++------- net/mac80211/scan.c | 34 ++++- net/mac80211/tx.c | 4 + net/mac80211/util.c | 196 ++++++++++++++++++++++++++ net/wireless/mlme.c | 14 +- net/wireless/nl80211.c | 22 +++ net/wireless/scan.c | 85 +++++++++-- 19 files changed, 756 insertions(+), 123 deletions(-)
Signature · 1 line
2.20.1
PATCH v4 1/17 {cfg,mac}80211: get correct default channel width for S1G
When deleting a channel context, mac80211 would assing NL80211_CHAN_WIDTH_20_NOHT as the default channel width. This is wrong in S1G however, so instead get the allowed channel width for a given channel.
Fixes eg. configuring strange (20Mhz) width during a scan on the S1G band.
---
v4:
- drop S1G channel width calculation in cfg80211_chandef_create as it is not needed (Johannes)
--- net/mac80211/chan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/mac80211/chan.c +8 -1
@@ -536,7 +536,14 @@ static void ieee80211_del_chanctx(struct ieee80211_local *local,if (!local->use_chanctx) {struct cfg80211_chan_def *chandef = &local->_oper_chandef; - chandef->width =NL80211_CHAN_WIDTH_20_NOHT ; +/* S1G doesn't have 20MHz, so get the correct width for the +* current channel. +*/ +if (chandef->chan->band ==NL80211_BAND_S1GHZ ) + chandef->width = +ieee80211_s1g_channel_width (chandef->chan); +else + chandef->width =NL80211_CHAN_WIDTH_20_NOHT ; chandef->center_freq1 = chandef->chan->center_freq; chandef->freq1_offset = chandef->chan->freq_offset; chandef->center_freq2 =0 ;
Signature · 1 line
2.20.1
PATCH v4 2/17 mac80211: s1g: choose scanning width based on frequency
In reply to Thomas PedersenAn S1G BSS can beacon at either 1 or 2 MHz and the channel width is unique to a given frequency. Ignore scan channel width for now and use the allowed channel width.
---
v4:
- double space after goto (Johannes)
--- net/mac80211/scan.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
net/mac80211/scan.c +17 -0
@@ -905,6 +905,17 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local, local->scan_chandef.center_freq1 = chan->center_freq; local->scan_chandef.freq1_offset = chan->freq_offset; local->scan_chandef.center_freq2 =0 ; + +/* For scanning on the S1G band, ignore scan_width (which is constant +* across all channels) for now since channel width is specific to each +* channel. Detect the required channel width here and likely revisit +* later. Maybe scan_width could be used to build the channel scan list? +*/ +if (chan->band ==NL80211_BAND_S1GHZ ) { + local->scan_chandef.width =ieee80211_s1g_channel_width (chan); + goto set_channel; + } +switch (scan_req->scan_width) {case NL80211_BSS_CHAN_WIDTH_5 : local->scan_chandef.width =NL80211_CHAN_WIDTH_5 ;
@@ -925,8 +936,14 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,else local->scan_chandef.width =NL80211_CHAN_WIDTH_20_NOHT ;break ; +case NL80211_BSS_CHAN_WIDTH_1 : +case NL80211_BSS_CHAN_WIDTH_2 : +/* shouldn't get here, S1G handled above */ +WARN_ON (1 ); +break ; } +set_channel:if (ieee80211_hw_config (local,IEEE80211_CONF_CHANGE_CHANNEL )) skip =1 ;
Signature · 1 line
2.20.1
PATCH v4 3/17 nl80211: support S1G capabilities
In reply to Thomas PedersenDeclare the structures needed to define S1G capabilities.
NL80211_ATTR_S1G_CAPABILITY can be passed along with NL80211_ATTR_S1G_CAPABILITY_MASK to NL80211_CMD_ASSOCIATE to indicate S1G capabilities which should override the hardware capabilities in eg. the association request.
---
v4:
- nit + use NLA_POLICY_EXACT_LEN() (Johannes)
- move NL80211_S1G_CAPABILITY_LEN -> ieee80211.h (Johannes)
--- include/linux/ieee80211.h | 2 ++ include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 9 +++++++++ net/wireless/nl80211.c | 17 +++++++++++++++++ 4 files changed, 31 insertions(+)
include/linux/ieee80211.h +2 -0
@@ -2330,6 +2330,8 @@ ieee80211_he_spr_size(const u8 *he_spr_ie) }/* S1G Capabilities Information field */ +#define IEEE80211_S1G_CAPABILITY_LEN 15 +#define S1G_CAP0_S1G_LONG BIT(0)#define S1G_CAP0_SGI_1MHZ BIT(1)#define S1G_CAP0_SGI_2MHZ BIT(2)
include/net/cfg80211.h +3 -0
@@ -2528,6 +2528,8 @@ enum cfg80211_assoc_req_flags {* @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association * Request/Response frame or %NULL if FILS is not used. This field starts * with 16 octets of STA Nonce followed by 16 octets of AP Nonce. +* @s1g_capa: S1G capability override +* @s1g_capa_mask: S1G capability override mask */ struct cfg80211_assoc_request {struct cfg80211_bss *bss;
@@ -2542,6 +2544,7 @@ struct cfg80211_assoc_request {const u8 *fils_kek;size_t fils_kek_len;const u8 *fils_nonces; +struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask; };/**
include/uapi/linux/nl80211.h +9 -0
@@ -2521,6 +2521,12 @@ enum nl80211_commands {* unsolicited broadcast probe response. It is a nested attribute, see * &enum nl80211_unsol_bcast_probe_resp_attributes. * +* @NL80211_ATTR_S1G_CAPABILITY: S1G Capability information element (from +* association request when used with NL80211_CMD_NEW_STATION) +* @NL80211_ATTR_S1G_CAPABILITY_MASK: S1G Capability Information element +* override mask. Used with NL80211_ATTR_S1G_CAPABILITY in +* NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT. +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3007,6 +3013,9 @@ enum nl80211_attrs {NL80211_ATTR_UNSOL_BCAST_PROBE_RESP , +NL80211_ATTR_S1G_CAPABILITY , +NL80211_ATTR_S1G_CAPABILITY_MASK , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c +17 -0
@@ -704,6 +704,10 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { NLA_POLICY_NESTED(nl80211_fils_discovery_policy), [NL80211_ATTR_UNSOL_BCAST_PROBE_RESP ] = NLA_POLICY_NESTED(nl80211_unsol_bcast_probe_resp_policy), + [NL80211_ATTR_S1G_CAPABILITY ] = + NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), + [NL80211_ATTR_S1G_CAPABILITY_MASK ] = + NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), };/* policy for the key attributes */
@@ -9792,6 +9796,19 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)nla_data (info->attrs[NL80211_ATTR_FILS_NONCES ]); } +if (info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK ]) +memcpy (&req.s1g_capa_mask, +nla_data (info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK ]), +sizeof (req.s1g_capa_mask)); + +if (info->attrs[NL80211_ATTR_S1G_CAPABILITY ]) { +if (!info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK ]) +return -EINVAL ; +memcpy (&req.s1g_capa, +nla_data (info->attrs[NL80211_ATTR_S1G_CAPABILITY ]), +sizeof (req.s1g_capa)); + } + err =nl80211_crypto_settings (rdev, info, &req.crypto,1 );if (!err) {wdev_lock (dev->ieee80211_ptr);
Signature · 1 line
2.20.1
PATCH v4 4/17 mac80211: support S1G STA capabilities
In reply to Thomas PedersenInclude the S1G Capabilities element in an association request, and support the cfg80211 capability overrides.
--- net/mac80211/ieee80211_i.h | 4 ++++ net/mac80211/mlme.c | 8 +++++++ net/mac80211/util.c | 45 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+)
net/mac80211/ieee80211_i.h +4 -0
@@ -544,6 +544,8 @@ struct ieee80211_if_managed {struct ieee80211_ht_cap ht_capa_mask;/* Valid parts of ht_capa */ struct ieee80211_vht_cap vht_capa;/* configured VHT overrides */ struct ieee80211_vht_cap vht_capa_mask;/* Valid parts of vht_capa */ +struct ieee80211_s1g_cap s1g_capa;/* configured S1G overrides */ +struct ieee80211_s1g_cap s1g_capa_mask;/* valid s1g_capa bits */ /* TDLS support */ u8 tdls_peer[ETH_ALEN ]__aligned(2) ;
@@ -2204,6 +2206,8 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, bool need_basic, enum nl80211_band band);u8 *ieee80211_add_wmm_info_ie (u8 *buf,u8 qosinfo); +u8 *ieee80211_add_s1g_capab_ie (struct ieee80211_sub_if_data *sdata, +struct ieee80211_sta_s1g_cap *caps,u8 *buf);/* channel management */ bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
net/mac80211/mlme.c +8 -0
@@ -1018,6 +1018,10 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) pos =ieee80211_add_wmm_info_ie (skb_put (skb,9 ), qos_info); } +if (sband->band ==NL80211_BAND_S1GHZ ) + pos =ieee80211_add_s1g_capab_ie (sdata, &sband->s1g_cap, +skb_put (skb,17 )); +/* add any remaining custom (i.e. vendor specific here) IEs */ if (assoc_data->ie_len) { noffset = assoc_data->ie_len;
@@ -5455,6 +5459,10 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,memcpy (&ifmgd->vht_capa_mask, &req->vht_capa_mask,sizeof (ifmgd->vht_capa_mask)); +memcpy (&ifmgd->s1g_capa, &req->s1g_capa,sizeof (ifmgd->s1g_capa)); +memcpy (&ifmgd->s1g_capa_mask, &req->s1g_capa_mask, +sizeof (ifmgd->s1g_capa_mask)); +if (req->ie && req->ie_len) {memcpy (assoc_data->ie, req->ie, req->ie_len); assoc_data->ie_len = req->ie_len;
net/mac80211/util.c +45 -0
51 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 5/17 cfg80211: convert S1G beacon to scan results
In reply to Thomas PedersenThe S1G beacon is an extension frame as opposed to management frame for the regular beacon. This means we may have to occasionally cast the frame buffer to a different header type. Luckily this isn't too bad as scan results mostly only care about the IEs.
--- include/linux/ieee80211.h | 32 ++++++++++++++++++++++ net/wireless/scan.c | 57 ++++++++++++++++++++++++++++++++------- 2 files changed, 80 insertions(+), 9 deletions(-)
include/linux/ieee80211.h +32 -0
@@ -151,6 +151,9 @@#define IEEE80211_ANO_NETTYPE_WILD 15 +/* bits unique to S1G beacon */ +#define IEEE80211_S1G_BCN_NEXT_TBTT 0x100 +/* control extension - for IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTL_EXT */ #define IEEE80211_CTL_EXT_POLL 0x2000#define IEEE80211_CTL_EXT_SPR 0x3000
@@ -553,6 +556,28 @@ static inline bool ieee80211_is_s1g_beacon(__le16 fc)cpu_to_le16 (IEEE80211_FTYPE_EXT |IEEE80211_STYPE_S1G_BEACON ); } +/** +* ieee80211_next_tbtt_present - check if IEEE80211_FTYPE_EXT && +* IEEE80211_STYPE_S1G_BEACON && IEEE80211_S1G_BCN_NEXT_TBTT +* @fc: frame control bytes in little-endian byteorder +*/ +static inline bool ieee80211_next_tbtt_present (__le16 fc) +{ +return (fc &cpu_to_le16 (IEEE80211_FCTL_FTYPE |IEEE80211_FCTL_STYPE )) == +cpu_to_le16 (IEEE80211_FTYPE_EXT |IEEE80211_STYPE_S1G_BEACON ) && + fc &cpu_to_le16 (IEEE80211_S1G_BCN_NEXT_TBTT ); +} + +/** +* ieee80211_is_s1g_short_beacon - check if next tbtt present bit is set. Only +* true for S1G beacons when they're short. +* @fc: frame control bytes in little-endian byteorder +*/ +static inline bool ieee80211_is_s1g_short_beacon (__le16 fc) +{ +return ieee80211_is_s1g_beacon (fc) &&ieee80211_next_tbtt_present (fc); +} +/** * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM * @fc: frame control bytes in little-endian byteorder
@@ -1034,6 +1059,13 @@ struct ieee80211_ext {u8 change_seq;u8 variable[0 ]; }__packed s1g_beacon; +struct { +u8 sa[ETH_ALEN ]; +__le32 timestamp; +u8 change_seq; +u8 next_tbtt[3 ]; +u8 variable[0 ]; + } __packed s1g_short_beacon; } u; } __packed__aligned(2) ;
net/wireless/scan.c +48 -9
89 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 6/17 cfg80211: parse S1G Operation element for BSS channel
In reply to Thomas PedersenExtract the BSS primary channel from the S1G Operation element.
---
v4:
- add protection against strange IEs in S1G (Johannes)
--- net/wireless/scan.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
net/wireless/scan.c +22 -6
@@ -1315,18 +1315,34 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen,int channel_number =-1 ;struct ieee80211_channel *alt_channel; + +if (channel->band ==NL80211_BAND_S1GHZ ) { + tmp =cfg80211_find_ie (WLAN_EID_S1G_OPERATION , ie, ielen); +if (tmp && tmp[1 ] >=sizeof (struct ieee80211_s1g_oper_ie )) { +struct ieee80211_s1g_oper_ie *s1gop = (void *)(tmp +2 ); + + channel_number = s1gop->primary_ch; + } + +/* even if we didn't try to use the one frame came in on */ + goto found_channel; + } + tmp =cfg80211_find_ie (WLAN_EID_DS_PARAMS , ie, ielen);if (tmp && tmp[1 ] ==1 ) { channel_number = tmp[2 ]; - }else { - tmp =cfg80211_find_ie (WLAN_EID_HT_OPERATION , ie, ielen); -if (tmp && tmp[1 ] >=sizeof (struct ieee80211_ht_operation )) { -struct ieee80211_ht_operation *htop = (void *)(tmp +2 ); + goto found_channel; + } - channel_number = htop->primary_chan; - } + tmp =cfg80211_find_ie (WLAN_EID_HT_OPERATION , ie, ielen); +if (tmp && tmp[1 ] >=sizeof (struct ieee80211_ht_operation )) { +struct ieee80211_ht_operation *htop = (void *)(tmp +2 ); + + channel_number = htop->primary_chan; + goto found_channel; } +found_channel:if (channel_number <0 ) {/* No channel information in frame payload */ return channel;
Signature · 1 line
2.20.1
PATCH v4 7/17 mac80211: convert S1G beacon to scan results
In reply to Thomas PedersenThis commit finds the correct offset for Information Elements in S1G beacon frames so they can be reported in scan results.
---
v4:
- remove bss->s1g (Johannes)
- use sizeof() when checking IE lengths and don't parse short beacon element (yet) (Johannes)
--- net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/rx.c | 3 ++- net/mac80211/scan.c | 17 +++++++++++++---- net/mac80211/util.c | 22 ++++++++++++++++++++++ 4 files changed, 40 insertions(+), 5 deletions(-)
net/mac80211/ieee80211_i.h +3 -0
@@ -1536,6 +1536,9 @@ struct ieee802_11_elems {u8 dtim_count;u8 dtim_period;const struct ieee80211_addba_ext_ie *addba_ext_ie; +const struct ieee80211_s1g_cap *s1g_capab; +const struct ieee80211_s1g_oper_ie *s1g_oper; +const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat;/* length of them, respectively */ u8 ext_capab_len;
net/mac80211/rx.c +2 -1
@@ -4577,7 +4577,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,ieee80211_verify_alignment (&rx);if (unlikely (ieee80211_is_probe_resp (hdr->frame_control) || -ieee80211_is_beacon (hdr->frame_control))) +ieee80211_is_beacon (hdr->frame_control) || +ieee80211_is_s1g_beacon (hdr->frame_control)))ieee80211_scan_rx (local, skb);if (ieee80211_is_data (fc)) {
net/mac80211/scan.c +13 -4
@@ -146,7 +146,8 @@ ieee80211_bss_info_update(struct ieee80211_local *local, struct ieee80211_mgmt *mgmt, size_t len, struct ieee80211_channel *channel) { - bool beacon = ieee80211_is_beacon(mgmt->frame_control); + bool beacon = ieee80211_is_beacon(mgmt->frame_control) || +ieee80211_is_s1g_beacon (mgmt->frame_control);struct cfg80211_bss *cbss, *non_tx_cbss;struct ieee80211_bss *bss, *non_tx_bss; struct cfg80211_inform_bss bss_meta = {
@@ -195,6 +196,11 @@ ieee80211_bss_info_update(struct ieee80211_local *local, elements = mgmt->u.probe_resp.variable; baselen = offsetof(struct ieee80211_mgmt , u.probe_resp.variable); + }else if (ieee80211_is_s1g_beacon (mgmt->frame_control)) { +struct ieee80211_ext *ext = (void *) mgmt; + + baselen = offsetof(struct ieee80211_ext, u.s1g_beacon.variable); + elements = ext->u.s1g_beacon.variable; }else { baselen = offsetof(struct ieee80211_mgmt, u.beacon.variable); elements = mgmt->u.beacon.variable;
@@ -246,9 +252,12 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)struct ieee80211_bss *bss;struct ieee80211_channel *channel; -if (skb->len <24 || - (!ieee80211_is_probe_resp (mgmt->frame_control) && - !ieee80211_is_beacon (mgmt->frame_control))) +if (ieee80211_is_s1g_beacon (mgmt->frame_control)) { +if (skb->len <15 ) +return ; + }else if (skb->len <24 || + (!ieee80211_is_probe_resp (mgmt->frame_control) && + !ieee80211_is_beacon (mgmt->frame_control)))return ; sdata1 =rcu_dereference (local->scan_sdata);
net/mac80211/util.c +22 -0
@@ -1003,6 +1003,10 @@ _ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,case WLAN_EID_LINK_ID :case WLAN_EID_BSS_MAX_IDLE_PERIOD :case WLAN_EID_RSNX : +case WLAN_EID_S1G_BCN_COMPAT : +case WLAN_EID_S1G_CAPABILITIES : +case WLAN_EID_S1G_OPERATION : +case WLAN_EID_S1G_SHORT_BCN_INTERVAL :/* * not listing WLAN_EID_CHANNEL_SWITCH_WRAPPER -- it seems possible * that if the content gets bigger it might be needed more than once
@@ -1288,6 +1292,24 @@ _ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, &crc : NULL, elem, elems);break ; +case WLAN_EID_S1G_CAPABILITIES : +if (elen ==sizeof (*elems->s1g_capab)) + elems->s1g_capab = (void *)pos; +else + elem_parse_failed = true; +break ; +case WLAN_EID_S1G_OPERATION : +if (elen ==sizeof (*elems->s1g_oper)) + elems->s1g_oper = (void *)pos; +else + elem_parse_failed = true; +break ; +case WLAN_EID_S1G_BCN_COMPAT : +if (elen ==sizeof (*elems->s1g_bcn_compat)) + elems->s1g_bcn_compat = (void *)pos; +else + elem_parse_failed = true; +break ;default :break ; }
Signature · 1 line
2.20.1
PATCH v4 8/17 cfg80211: handle Association Response from S1G STA
In reply to Thomas PedersenThe sending STA type is implicit based on beacon or probe response content. If sending STA was an S1G STA, adjust the Information Element location accordingly.
---
v4:
- clean up ugly check for S1G BSS (Johannes)
--- include/linux/ieee80211.h | 5 +++++ net/wireless/mlme.c | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-)
include/linux/ieee80211.h +5 -0
@@ -1100,6 +1100,11 @@ struct ieee80211_mgmt {/* followed by Supported rates */ u8 variable[0 ]; }__packed assoc_resp, reassoc_resp; +struct { +__le16 capab_info; +__le16 status_code; +u8 variable[0 ]; + } __packed s1g_assoc_resp, s1g_reassoc_resp;struct {__le16 capab_info;__le16 listen_interval;
net/wireless/mlme.c +11 -3
@@ -30,6 +30,15 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,struct cfg80211_registered_device *rdev =wiphy_to_rdev (wiphy);struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;struct cfg80211_connect_resp_params cr; +const u8 *resp_ie = mgmt->u.assoc_resp.variable; +size_t resp_ie_len = len - offsetof(struct ieee80211_mgmt , + u.assoc_resp.variable); + +if (bss->channel->band ==NL80211_BAND_S1GHZ ) { + resp_ie = (u8 *)&mgmt->u.s1g_assoc_resp.variable; + resp_ie_len = len - offsetof(struct ieee80211_mgmt , + u.s1g_assoc_resp.variable); + }memset (&cr,0 ,sizeof (cr)); cr.status = (int )le16_to_cpu (mgmt->u.assoc_resp.status_code);
@@ -37,9 +46,8 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss, cr.bss = bss; cr.req_ie = req_ies; cr.req_ie_len = req_ies_len; - cr.resp_ie = mgmt->u.assoc_resp.variable; - cr.resp_ie_len = - len - offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); + cr.resp_ie = resp_ie; + cr.resp_ie_len = resp_ie_len; cr.timeout_reason =NL80211_TIMEOUT_UNSPECIFIED ;trace_cfg80211_send_rx_assoc (dev, bss);
Signature · 1 line
2.20.1
PATCH v4 9/17 mac80211: encode listen interval for S1G
In reply to Thomas PedersenS1G allows listen interval up to 2^14 * 10000 beacon intervals. In order to do this listen interval needs a scaling factor applied to the lower 14 bits. Calculate this and properly encode the listen interval for S1G STAs.
See IEEE802.11ah-2016 Table 9-44a for reference.
---
v4:
- move listen_int_usf[] into util.c (Johannes)
- fix __le16 return type (kernel test robot)
--- include/linux/ieee80211.h | 7 +++++++ net/mac80211/ieee80211_i.h | 1 + net/mac80211/mlme.c | 10 ++++++---- net/mac80211/util.c | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 4 deletions(-)
include/linux/ieee80211.h +7 -0
@@ -2448,6 +2448,13 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)#define S1G_OPER_CH_WIDTH_PRIMARY_1MHZ BIT(0)#define S1G_OPER_CH_WIDTH_OPER GENMASK(4, 1) + +#define LISTEN_INT_USF GENMASK(15, 14) +#define LISTEN_INT_UI GENMASK(13, 0) + +#define IEEE80211_MAX_USF FIELD_MAX(LISTEN_INT_USF) +#define IEEE80211_MAX_UI FIELD_MAX(LISTEN_INT_UI) +/* Authentication algorithms */ #define WLAN_AUTH_OPEN 0#define WLAN_AUTH_SHARED_KEY 1
net/mac80211/ieee80211_i.h +1 -0
@@ -2300,6 +2300,7 @@ void ieee80211_tdls_chsw_work(struct work_struct *wk);void ieee80211_tdls_handle_disconnect (struct ieee80211_sub_if_data *sdata,const u8 *peer,u16 reason);const char *ieee80211_get_reason_code_string (u16 reason_code); +u16 ieee80211_encode_usf (int val);extern const struct ethtool_ops ieee80211_ethtool_ops;
net/mac80211/mlme.c +6 -4
@@ -696,6 +696,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)struct ieee80211_chanctx_conf *chanctx_conf;struct ieee80211_channel *chan;u32 rates =0 ; +__le16 listen_int;struct element *ext_capa =NULL ;/* we know it's writable, cast away the const */
@@ -784,13 +785,15 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)memcpy (mgmt->sa, sdata->vif.addr,ETH_ALEN );memcpy (mgmt->bssid, assoc_data->bss->bssid,ETH_ALEN ); + listen_int =cpu_to_le16 (sband->band ==NL80211_BAND_S1GHZ ? +ieee80211_encode_usf (local->hw.conf.listen_interval) : + local->hw.conf.listen_interval);if (!is_zero_ether_addr (assoc_data->prev_bssid)) {skb_put (skb,10 ); mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_REASSOC_REQ ); mgmt->u.reassoc_req.capab_info =cpu_to_le16 (capab); - mgmt->u.reassoc_req.listen_interval = -cpu_to_le16 (local->hw.conf.listen_interval); + mgmt->u.reassoc_req.listen_interval = listen_int;memcpy (mgmt->u.reassoc_req.current_ap, assoc_data->prev_bssid,ETH_ALEN ); }else {
@@ -798,8 +801,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ASSOC_REQ ); mgmt->u.assoc_req.capab_info =cpu_to_le16 (capab); - mgmt->u.assoc_req.listen_interval = -cpu_to_le16 (local->hw.conf.listen_interval); + mgmt->u.assoc_req.listen_interval = listen_int; }/* SSID */
net/mac80211/util.c +22 -0
@@ -33,6 +33,8 @@#include "led.h" #include "wep.h" +static const int listen_int_usf[] = {1 ,10 ,1000 ,10000 }; +/* privid for wiphys to determine whether they belong to us or not */ const void *const mac80211_wiphy_privid = &mac80211_wiphy_privid;
@@ -4385,3 +4387,23 @@ const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS] = {IEEE80211_WMM_IE_STA_QOSINFO_AC_BE , IEEE80211_WMM_IE_STA_QOSINFO_AC_BK }; + +u16 ieee80211_encode_usf (int listen_interval) +{ +u16 ui, usf =0 ; + +/* find greatest USF */ +while (usf <IEEE80211_MAX_USF ) { +if (listen_interval % listen_int_usf[usf +1 ]) +break ; + usf +=1 ; + } + ui = listen_interval / listen_int_usf[usf]; + +/* error if there is a remainder. Should've been checked by user */ +WARN_ON_ONCE (ui >IEEE80211_MAX_UI ); + listen_interval =FIELD_PREP (LISTEN_INT_USF , usf) | +FIELD_PREP (LISTEN_INT_UI , ui); + +return (u16 ) listen_interval; +}
Signature · 1 line
2.20.1
PATCH v4 10/17 mac80211: don't calculate duration for S1G
In reply to Thomas PedersenFor now just skip the duration calculation for frames transmitted on the S1G band and avoid a warning.
--- net/mac80211/tx.c | 4 ++++ 1 file changed, 4 insertions(+)
net/mac80211/tx.c +4 -0
@@ -82,6 +82,10 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, erp = txrate->flags &IEEE80211_RATE_ERP_G ; +/* device is expected to do this */ +if (sband->band ==NL80211_BAND_S1GHZ ) +return 0 ; +/* * data and mgmt (except PS Poll): * - during CFP: 32768
Signature · 1 line
2.20.1
PATCH v4 11/17 mac80211: handle S1G low rates
In reply to Thomas PedersenS1G doesn't have legacy (sband->bitrates) rates, only MCS. For now, just send a frame at MCS 0 if a low rate is requested. Note we also redefine (since we're out of TX flags) TX_RC_VHT_MCS as TX_RC_S1G_MCS to indicate an S1G MCS. This is probably OK as VHT MCS is not valid on S1G band and vice versa.
--- include/net/mac80211.h | 2 ++ net/mac80211/rate.c | 33 ++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-)
include/net/mac80211.h +2 -0
@@ -833,6 +833,8 @@ enum mac80211_tx_info_flags {#define IEEE80211_TX_CTL_STBC_SHIFT 23 +#define IEEE80211_TX_RC_S1G_MCS IEEE80211_TX_RC_VHT_MCS +/** * enum mac80211_tx_control_flags - flags to describe transmit control *
net/mac80211/rate.c +26 -7
@@ -266,10 +266,15 @@ void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata)if (WARN_ON (!sdata->vif.bss_conf.chandef.chan))return ; + band = sdata->vif.bss_conf.chandef.chan->band; +if (band ==NL80211_BAND_S1GHZ ) { +/* TODO */ +return ; + } +if (WARN_ON_ONCE (!basic_rates))return ; - band = sdata->vif.bss_conf.chandef.chan->band; user_mask = sdata->rc_rateidx_mask[band]; sband = local->hw.wiphy->bands[band];
@@ -296,21 +301,29 @@ static bool rc_no_data_or_no_ack_use_min(struct ieee80211_tx_rate_control *txrc) !ieee80211_is_data (fc); } -static void rc_send_low_basicrate (s8 *idx,u32 basic_rates, +static void rc_send_low_basicrate (struct ieee80211_tx_rate *rate, +u32 basic_rates,struct ieee80211_supported_band *sband) {u8 i; +if (sband->band ==NL80211_BAND_S1GHZ ) { +/* TODO */ + rate->flags |=IEEE80211_TX_RC_S1G_MCS ; + rate->idx =0 ; +return ; + } +if (basic_rates ==0 )return ;/* assume basic rates unknown and accept rate */ -if (*idx <0 ) +if (rate->idx <0 )return ; -if (basic_rates & (1 << *idx)) +if (basic_rates & (1 << rate->idx))return ;/* selected rate is a basic rate */ -for (i = *idx +1 ; i <= sband->n_bitrates; i++) { +for (i = rate->idx +1 ; i <= sband->n_bitrates; i++) {if (basic_rates & (1 << i)) { - *idx = i; + rate->idx = i;return ; } }
@@ -328,6 +341,12 @@ static void __rate_control_send_low(struct ieee80211_hw *hw,u32 rate_flags =ieee80211_chandef_rate_flags (&hw->conf.chandef); +if (sband->band ==NL80211_BAND_S1GHZ ) { + info->control.rates[0 ].flags |=IEEE80211_TX_RC_S1G_MCS ; + info->control.rates[0 ].idx =0 ; +return ; + } +if ((sband->band ==NL80211_BAND_2GHZ ) && (info->flags &IEEE80211_TX_CTL_NO_CCK_RATE )) rate_flags |=IEEE80211_RATE_ERP_G ;
@@ -388,7 +407,7 @@ static bool rate_control_send_low(struct ieee80211_sta *pubsta, }if (use_basicrate) -rc_send_low_basicrate (&info->control.rates[0 ].idx, +rc_send_low_basicrate (&info->control.rates[0 ], txrc->bss_conf->basic_rates, sband);
Signature · 1 line
2.20.1
PATCH v4 12/17 mac80211: avoid rate init for S1G band
In reply to Thomas Pedersenminstrel_ht is confused by the lack of sband->bitrates, and S1G will likely require a unique RC algorithm, so avoid rate init for now if STA is on the S1G band.
--- net/mac80211/rate.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/mac80211/rate.c +6 -0
@@ -51,6 +51,12 @@ void rate_control_rate_init(struct sta_info *sta) sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band]; +/* TODO: check for minstrel_s1g ? */ +if (sband->band ==NL80211_BAND_S1GHZ ) { +rcu_read_unlock (); +return ; + } +spin_lock_bh (&sta->rate_ctrl_lock); ref->ops->rate_init (ref->priv, sband, &chanctx_conf->def, ista, priv_sta);
Signature · 1 line
2.20.1
PATCH v4 13/17 mac80211: receive and process S1G beacons
In reply to Thomas PedersenS1G beacons are 802.11 Extension Frames, so the fixed header part differs from regular beacons.
Add a handler to process S1G beacons and abstract out the fetching of BSSID and element start locations in the beacon body handler.
--- net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/iface.c | 5 +++ net/mac80211/mlme.c | 84 +++++++++++++++++++++++++++++--------- net/mac80211/rx.c | 84 ++++++++++++++++---------------------- net/mac80211/util.c | 52 +++++++++++++++++++++++ 5 files changed, 162 insertions(+), 67 deletions(-)
net/mac80211/ieee80211_i.h +4 -0
@@ -1657,6 +1657,8 @@ int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);void ieee80211_sta_work (struct ieee80211_sub_if_data *sdata);void ieee80211_sta_rx_queued_mgmt (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb); +void ieee80211_sta_rx_queued_ext (struct ieee80211_sub_if_data *sdata, +struct sk_buff *skb);void ieee80211_sta_reset_beacon_monitor (struct ieee80211_sub_if_data *sdata);void ieee80211_sta_reset_conn_monitor (struct ieee80211_sub_if_data *sdata);void ieee80211_mgd_stop (struct ieee80211_sub_if_data *sdata);
@@ -2301,6 +2303,8 @@ void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata, const u8 *peer, u16 reason);const char *ieee80211_get_reason_code_string (u16 reason_code);u16 ieee80211_encode_usf (int val); +u8 *ieee80211_get_bssid (struct ieee80211_hdr *hdr,size_t len, +enum nl80211_iftype type);extern const struct ethtool_ops ieee80211_ethtool_ops;
net/mac80211/iface.c +5 -0
@@ -1433,6 +1433,11 @@ static void ieee80211_iface_work(struct work_struct *work)WARN_ON (1 );break ; } + }else if (ieee80211_is_ext (mgmt->frame_control)) { +if (sdata->vif.type ==NL80211_IFTYPE_STATION ) +ieee80211_sta_rx_queued_ext (sdata, skb); +else +WARN_ON (1 ); }else if (ieee80211_is_data_qos (mgmt->frame_control)) {struct ieee80211_hdr *hdr = (void *)mgmt;/*
net/mac80211/mlme.c +65 -19
165 lines not on this page · raw message
net/mac80211/rx.c +36 -48
138 lines not on this page · raw message
net/mac80211/util.c +52 -0
58 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v4 13/17] mac80211: receive and process S1G beacons
Quoted 16 lines · Thomas Pedersen
S1G beacons are 802.11 Extension Frames, so the fixed header part differs from regular beacons.
Add a handler to process S1G beacons and abstract out the fetching of BSSID and element start locations in the beacon body handler.
Signed-off-by Thomas Pedersen <[email protected]>--- net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/iface.c | 5 +++ net/mac80211/mlme.c | 84 +++++++++++++++++++++++++++++--------- net/mac80211/rx.c | 84 ++++++++++++++++---------------------- net/mac80211/util.c | 52 +++++++++++++++++++++++ 5 files changed, 162 insertions(+), 67 deletions(-)
...
net/mac80211/rx.c ieee80211_rx_h_sta_process(struct · line 1761
Quoted 8 lines
net/mac80211/rx.c +2
-1@@ -1801,7 +1756,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) } }else if (rx->sdata->vif.type ==NL80211_IFTYPE_OCB ) { sta->rx_stats.last_rx = jiffies; - }else if (!is_multicast_ether_addr (hdr->addr1)) { + }else if (!ieee80211_is_s1g_beacon (hdr->frame_control) && +is_multicast_ether_addr (hdr->addr1)) {
is this a typo mistake?
it removed ! for is_multicast_ether_addr(!is_multicast_ether_addr ==> is_multicast_ether_addr)
Quoted 3 lines
net/mac80211/rx.c +0
-0/* * Mesh beacons will update last_rx when if they are found to * match the current local configuration when processed.
...
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Re: [PATCH v4 13/17] mac80211: receive and process S1G beacons
Hi Wen,
Quoted 20 lines · Wen Gong
Quoted 18 lines · Thomas Pedersen
S1G beacons are 802.11 Extension Frames, so the fixed header part differs from regular beacons.
Add a handler to process S1G beacons and abstract out the fetching of BSSID and element start locations in the beacon body handler.
Signed-off-by Thomas Pedersen <[email protected]>--- net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/iface.c | 5 +++ net/mac80211/mlme.c | 84 +++++++++++++++++++++++++++++--------- net/mac80211/rx.c | 84 ++++++++++++++++---------------------- net/mac80211/util.c | 52 +++++++++++++++++++++++ 5 files changed, 162 insertions(+), 67 deletions(-)...
Quoted 11 lines
net/mac80211/rx.c ieee80211_rx_h_sta_process(struct · line 1761
Quoted 8 lines
net/mac80211/rx.c +2
-1@@ -1801,7 +1756,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) } }else if (rx->sdata->vif.type ==NL80211_IFTYPE_OCB ) { sta->rx_stats.last_rx = jiffies; - }else if (!is_multicast_ether_addr (hdr->addr1)) { + }else if (!ieee80211_is_s1g_beacon (hdr->frame_control) && +is_multicast_ether_addr (hdr->addr1)) {is this a typo mistake?
it removed ! foris_multicast_ether_addr(!is_multicast_ether_addr ==> is_multicast_ether_addr)
Yes that does look like a typo, it should be:
} else if (!ieee80211_is_s1g_beacon(hdr->frame_control) &&
!is_multicast_ether_addr(hdr->addr1)) {(because is_multicast_ether_addr() evaluates to true for s1g beacons).
Do you have a patch or would you like me to send a fixup?
Thanks,
Signature · 6 lines
thomas _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Re: [PATCH v4 13/17] mac80211: receive and process S1G beacons
Quoted 35 lines · Thomas Pedersen
Hi Wen,
Quoted 20 lines · Wen Gong
Quoted 18 lines · Thomas Pedersen
S1G beacons are 802.11 Extension Frames, so the fixed header part differs from regular beacons.
Add a handler to process S1G beacons and abstract out the fetching of BSSID and element start locations in the beacon body handler.
Signed-off-by Thomas Pedersen <[email protected]>--- net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/iface.c | 5 +++ net/mac80211/mlme.c | 84 +++++++++++++++++++++++++++++--------- net/mac80211/rx.c | 84 ++++++++++++++++---------------------- net/mac80211/util.c | 52 +++++++++++++++++++++++ 5 files changed, 162 insertions(+), 67 deletions(-)...
Quoted 11 lines
net/mac80211/rx.c ieee80211_rx_h_sta_process(struct · line 1761
Quoted 8 lines
net/mac80211/rx.c +2
-1@@ -1801,7 +1756,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) } }else if (rx->sdata->vif.type ==NL80211_IFTYPE_OCB ) { sta->rx_stats.last_rx = jiffies; - }else if (!is_multicast_ether_addr (hdr->addr1)) { + }else if (!ieee80211_is_s1g_beacon (hdr->frame_control) && +is_multicast_ether_addr (hdr->addr1)) {is this a typo mistake?
it removed ! foris_multicast_ether_addr(!is_multicast_ether_addr ==> is_multicast_ether_addr)
Quoted 8 lines
Yes that does look like a typo, it should be:
} else if (!ieee80211_is_s1g_beacon(hdr->frame_control) && !is_multicast_ether_addr(hdr->addr1)) {(because
is_multicast_ether_addr()evaluates to true for s1g beacons).Do you have a patch or would you like me to send a fixup?
Yes, I have a patch for it.
I will send it.
Quoted 2 lines
Thanks,
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v4 14/17 mac80211: support S1G association
In reply to Thomas PedersenThe changes required for associating in S1G are:
- apply S1G BSS channel info before assoc
- mark all S1G STAs as QoS STAs
- include and parse AID request element
- handle new Association Response format
- don't fail assoc if supported rates element is missing
--- include/linux/ieee80211.h | 21 ++++++++++ include/net/mac80211.h | 2 + net/mac80211/cfg.c | 2 + net/mac80211/ibss.c | 3 +- net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/mlme.c | 80 ++++++++++++++++++++++++++++++++------ net/mac80211/util.c | 55 ++++++++++++++++++++++++++ 7 files changed, 154 insertions(+), 13 deletions(-)
include/linux/ieee80211.h +21 -0
@@ -987,6 +987,25 @@ enum ieee80211_vht_opmode_bits { IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF = 0x80, }; +/** +* enum ieee80211_s1g_chanwidth +* These are defined in IEEE802.11-2016ah Table 10-20 +* as BSS Channel Width +* +* @IEEE80211_S1G_CHANWIDTH_1MHZ: 1MHz operating channel +* @IEEE80211_S1G_CHANWIDTH_2MHZ: 2MHz operating channel +* @IEEE80211_S1G_CHANWIDTH_4MHZ: 4MHz operating channel +* @IEEE80211_S1G_CHANWIDTH_8MHZ: 8MHz operating channel +* @IEEE80211_S1G_CHANWIDTH_16MHZ: 16MHz operating channel +*/ +enum ieee80211_s1g_chanwidth { +IEEE80211_S1G_CHANWIDTH_1MHZ =0 , +IEEE80211_S1G_CHANWIDTH_2MHZ =1 , +IEEE80211_S1G_CHANWIDTH_4MHZ =3 , +IEEE80211_S1G_CHANWIDTH_8MHZ =7 , +IEEE80211_S1G_CHANWIDTH_16MHZ =15 , +}; +#define WLAN_SA_QUERY_TR_ID_LEN 2#define WLAN_MEMBERSHIP_LEN 8#define WLAN_USER_POSITION_LEN 16
@@ -2854,6 +2873,8 @@ enum ieee80211_eid {WLAN_EID_REDUCED_NEIGHBOR_REPORT =201 , +WLAN_EID_AID_REQUEST =210 , +WLAN_EID_AID_RESPONSE =211 ,WLAN_EID_S1G_BCN_COMPAT =213 ,WLAN_EID_S1G_SHORT_BCN_INTERVAL =214 , WLAN_EID_S1G_CAPABILITIES = 217,
include/net/mac80211.h +2 -0
@@ -627,6 +627,7 @@ struct ieee80211_fils_discovery {* @fils_discovery: FILS discovery configuration * @unsol_bcast_probe_resp_interval: Unsolicited broadcast probe response * interval. +* @s1g: BSS is S1G BSS (affects Association Request format). */ struct ieee80211_bss_conf {const u8 *bssid;
@@ -696,6 +697,7 @@ struct ieee80211_bss_conf {struct cfg80211_he_bss_color he_bss_color;struct ieee80211_fils_discovery fils_discovery;u32 unsol_bcast_probe_resp_interval; +bool s1g; };/**
net/mac80211/cfg.c +2 -0
@@ -1124,6 +1124,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, sizeof(struct ieee80211_he_obss_pd));memcpy (&sdata->vif.bss_conf.he_bss_color, ¶ms->he_bss_color,sizeof (struct ieee80211_he_bss_color )); + sdata->vif.bss_conf.s1g = params->chandef.chan->band == +NL80211_BAND_S1GHZ ; sdata->vif.bss_conf.ssid_len = params->ssid_len;if (params->ssid_len)
net/mac80211/ibss.c +2 -1
@@ -1037,7 +1037,8 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata, }if (sta && !sta->sta.wme && - elems->wmm_info && local->hw.queues >=IEEE80211_NUM_ACS ) { + (elems->wmm_info || elems->s1g_capab) && + local->hw.queues >=IEEE80211_NUM_ACS ) { sta->sta.wme = true;ieee80211_check_fast_xmit (sta); }
net/mac80211/ieee80211_i.h +4 -0
@@ -1539,6 +1539,7 @@ struct ieee802_11_elems {const struct ieee80211_s1g_cap *s1g_capab;const struct ieee80211_s1g_oper_ie *s1g_oper;const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat; +const struct ieee80211_aid_response_ie *aid_resp;/* length of them, respectively */ u8 ext_capab_len;
@@ -2213,6 +2214,7 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,u8 *ieee80211_add_wmm_info_ie (u8 *buf,u8 qosinfo);u8 *ieee80211_add_s1g_capab_ie (struct ieee80211_sub_if_data *sdata,struct ieee80211_sta_s1g_cap *caps,u8 *buf); +u8 *ieee80211_add_aid_request_ie (struct ieee80211_sub_if_data *sdata,u8 *buf);/* channel management */ bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
@@ -2224,6 +2226,8 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info,bool ieee80211_chandef_he_6ghz_oper (struct ieee80211_sub_if_data *sdata,const struct ieee80211_he_operation *he_oper,struct cfg80211_chan_def *chandef); +bool ieee80211_chandef_s1g_oper (const struct ieee80211_s1g_oper_ie *oper, +struct cfg80211_chan_def *chandef);u32 ieee80211_chandef_downgrade (struct cfg80211_chan_def *c);int __must_check
net/mac80211/mlme.c +68 -12
232 lines not on this page · raw message
net/mac80211/util.c +55 -0
79 lines not on this page · raw message
Signature · 1 line
2.20.1
Johannes Berg
maintainerRe: [PATCH v4 14/17] mac80211: support S1G association
net/mac80211/mlme.c ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · line 187
Quoted 13 lines
net/mac80211/mlme.c +8
-0@@ -176,6 +177,15 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,memcpy (&sta_ht_cap, &sband->ht_cap,sizeof (sta_ht_cap));ieee80211_apply_htcap_overrides (sdata, &sta_ht_cap); +if (s1g_oper && sband->band ==NL80211_BAND_S1GHZ ) { +ieee80211_chandef_s1g_oper (s1g_oper, chandef); + ret =IEEE80211_STA_DISABLE_HT |IEEE80211_STA_DISABLE_40MHZ | +IEEE80211_STA_DISABLE_VHT | +IEEE80211_STA_DISABLE_80P80MHZ | +IEEE80211_STA_DISABLE_160MHZ ; + goto out; + }
I've applied this now (and made some changes in a few patches, please check), but this particular thing seems a bit odd, in that it looks for HT/VHT elements even on an S1G channel if the s1g oper element isn't present? That seems like it shouldn't be the case, can you take a look?
johannes
Re: [PATCH v4 14/17] mac80211: support S1G association
Quoted 5 lines · Johannes Berg
Quoted 5 lines
net/mac80211/mlme.c +0
-0@@ -176,6 +177,15 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,memcpy (&sta_ht_cap, &sband->ht_cap,sizeof (sta_ht_cap));ieee80211_apply_htcap_overrides (sdata, &sta_ht_cap);
Quoted 13 lines
net/mac80211/mlme.c ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · line 187
Quoted 8 lines
net/mac80211/mlme.c +8
-0+if (s1g_oper && sband->band ==NL80211_BAND_S1GHZ ) { +ieee80211_chandef_s1g_oper (s1g_oper, chandef); + ret =IEEE80211_STA_DISABLE_HT |IEEE80211_STA_DISABLE_40MHZ | +IEEE80211_STA_DISABLE_VHT | +IEEE80211_STA_DISABLE_80P80MHZ | +IEEE80211_STA_DISABLE_160MHZ ; + goto out; + }I've applied this now (and made some changes in a few patches, please check), but this particular thing seems a bit odd, in that it looks for HT/VHT elements even on an S1G channel if the s1g oper element isn't present? That seems like it shouldn't be the case, can you take a look?
Thanks for the (numerous) fixups.
I don't think applying a (NULL) HT cap is a big deal since the same code path is already executed for eg. non HT, but it does look strange and I'll send a fixup.
Signature · 1 line
thomas
Re: [PATCH v4 14/17] mac80211: support S1G association
In reply to Thomas PedersenOn 2020-09-22 10:28, Thomas Pedersen wrote:
...
net/mac80211/util.c bool ieee80211_chandef_he_6ghz_oper(struct · line 3458
Quoted 7 lines
net/mac80211/util.c +2
-0@@ -3446,6 +3453,42 @@ bool ieee80211_chandef_he_6ghz_oper(structieee80211_sub_if_data *sdata, *chandef = he_chandef; +return false; +}
This change the "return true" to "return false" by default of ieee80211_chandef_he_6ghz_oper. It should be typo mistake.
Quoted 38 lines
net/mac80211/util.c +34
-0+ +bool ieee80211_chandef_s1g_oper (const struct ieee80211_s1g_oper_ie *oper, +struct cfg80211_chan_def *chandef) +{ +u32 oper_freq; + +if (!oper) +return false; + +switch (FIELD_GET (S1G_OPER_CH_WIDTH_OPER , oper->ch_width)) { +case IEEE80211_S1G_CHANWIDTH_1MHZ : + chandef->width =NL80211_CHAN_WIDTH_1 ; +break ; +case IEEE80211_S1G_CHANWIDTH_2MHZ : + chandef->width =NL80211_CHAN_WIDTH_2 ; +break ; +case IEEE80211_S1G_CHANWIDTH_4MHZ : + chandef->width =NL80211_CHAN_WIDTH_4 ; +break ; +case IEEE80211_S1G_CHANWIDTH_8MHZ : + chandef->width =NL80211_CHAN_WIDTH_8 ; +break ; +case IEEE80211_S1G_CHANWIDTH_16MHZ : + chandef->width =NL80211_CHAN_WIDTH_16 ; +break ; +default : +return false; + } + + oper_freq =ieee80211_channel_to_freq_khz (oper->oper_ch, +NL80211_BAND_S1GHZ ); + chandef->center_freq1 =KHZ_TO_MHZ (oper_freq); + chandef->freq1_offset = oper_freq %1000 ; +return true;}
....
Re: [PATCH v4 14/17] mac80211: support S1G association
add more to know it.
Quoted 43 lines · Wen Gong
On 2020-09-22 10:28, Thomas Pedersen wrote:
...net/mac80211/util.c bool ieee80211_chandef_he_6ghz_oper(struct · line 3458
Quoted 7 lines
net/mac80211/util.c +2
-0@@ -3446,6 +3453,42 @@ bool ieee80211_chandef_he_6ghz_oper(structieee80211_sub_if_data *sdata, *chandef = he_chandef; +return false; +}This change the "return true" to "return false" by default of
ieee80211_chandef_he_6ghz_oper.
It should be typo mistake.Quoted 31 lines
net/mac80211/util.c +30
-0+ +bool ieee80211_chandef_s1g_oper (const struct ieee80211_s1g_oper_ie *oper, +struct cfg80211_chan_def *chandef) +{ +u32 oper_freq; + +if (!oper) +return false; + +switch (FIELD_GET (S1G_OPER_CH_WIDTH_OPER , oper->ch_width)) { +case IEEE80211_S1G_CHANWIDTH_1MHZ : + chandef->width =NL80211_CHAN_WIDTH_1 ; +break ; +case IEEE80211_S1G_CHANWIDTH_2MHZ : + chandef->width =NL80211_CHAN_WIDTH_2 ; +break ; +case IEEE80211_S1G_CHANWIDTH_4MHZ : + chandef->width =NL80211_CHAN_WIDTH_4 ; +break ; +case IEEE80211_S1G_CHANWIDTH_8MHZ : + chandef->width =NL80211_CHAN_WIDTH_8 ; +break ; +case IEEE80211_S1G_CHANWIDTH_16MHZ : + chandef->width =NL80211_CHAN_WIDTH_16 ; +break ; +default : +return false; + } + + oper_freq = ieee80211_channel_to_freq_khz(oper->oper_ch,
Quoted 8 lines
Quoted 7 lines
net/mac80211/util.c +4
-0+ NL80211_BAND_S1GHZ); + chandef->center_freq1 =KHZ_TO_MHZ (oper_freq); + chandef->freq1_offset = oper_freq %1000 ; +return true;}
....
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Re: [PATCH v4 14/17] mac80211: support S1G association
In reply to Wen GongQuoted 5 lines · Wen Gong
On 2020-09-22 10:28, Thomas Pedersen wrote:
...Quoted 3 lines
(quoted diff) +0
-0@@ -3446,6 +3453,42 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
Quoted 7 lines
net/mac80211/util.c bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata, · line 3457
Quoted 4 lines
net/mac80211/util.c +2
-0*chandef = he_chandef; +return false; +}This change the "return true" to "return false" by default of
ieee80211_chandef_he_6ghz_oper.
It should be typo mistake.
Thanks Wen. This was maybe rebase damage? Will send a fixup.
Signature · 1 line
thomas
Re: [PATCH v4 14/17] mac80211: support S1G association
Quoted 8 lines · Thomas Pedersen
Quoted 7 lines · Wen Gong
On 2020-09-22 10:28, Thomas Pedersen wrote:
...Quoted 5 lines
net/mac80211/util.c +0
-0@@ -3446,6 +3453,42 @@ bool ieee80211_chandef_he_6ghz_oper(structieee80211_sub_if_data *sdata, *chandef = he_chandef;
Quoted 7 lines
Quoted 5 lines
Review bool ieee80211_chandef_he_6ghz_oper(struct · line 3458
Quoted 2 lines
(quoted diff) +2
-0+ return false; +}This change the "return true" to "return false" by default of
ieee80211_chandef_he_6ghz_oper.
It should be typo mistake.Thanks Wen. This was maybe rebase damage? Will send a fixup.
yes, I have sent a patch, 6G connect success with this patch, otherwise fail for 6G connect.
https://lore.kernel.org/linux-wireless/[email protected]/
Re: [PATCH v4 14/17] mac80211: support S1G association
Quoted 15 lines · Wen Gong
Quoted 14 lines · Thomas Pedersen
Quoted 12 lines · Wen Gong
On 2020-09-22 10:28, Thomas Pedersen wrote:
...net/mac80211/util.c bool ieee80211_chandef_he_6ghz_oper(struct · line 3458
Quoted 7 lines
net/mac80211/util.c +2
-0@@ -3446,6 +3453,42 @@ bool ieee80211_chandef_he_6ghz_oper(structieee80211_sub_if_data *sdata, *chandef = he_chandef; +return false; +}This change the "return true" to "return false" by default of
ieee80211_chandef_he_6ghz_oper.
It should be typo mistake.
Quoted 4 lines
Quoted 1 line
Thanks Wen. This was maybe rebase damage? Will send a fixup.
yes, I have sent a patch, 6G connect success with this patch, otherwise fail for 6G connect.
https://lore.kernel.org/linux-wireless/[email protected]/
Excellent, thank you.
Signature · 1 line
thomas
PATCH v4 15/17 nl80211: include frequency offset in survey info
In reply to Thomas PedersenRecently channels gained a potential frequency offset, so include this in the per-channel survey info.
--- include/uapi/linux/nl80211.h | 2 ++ net/wireless/nl80211.c | 5 +++++ 2 files changed, 7 insertions(+)
include/uapi/linux/nl80211.h +2 -0
@@ -4097,6 +4097,7 @@ enum nl80211_user_reg_hint_type {* receiving frames destined to the local BSS * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number * currently defined +* @NL80211_SURVEY_INFO_FREQUENCY_OFFSET: center frequency offset in KHz * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use */ enum nl80211_survey_info {
@@ -4112,6 +4113,7 @@ enum nl80211_survey_info {NL80211_SURVEY_INFO_TIME_SCAN ,NL80211_SURVEY_INFO_PAD ,NL80211_SURVEY_INFO_TIME_BSS_RX , +NL80211_SURVEY_INFO_FREQUENCY_OFFSET ,/* keep last */ __NL80211_SURVEY_INFO_AFTER_LAST,
net/wireless/nl80211.c +5 -0
@@ -9319,6 +9319,11 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq, survey->channel->center_freq)) goto nla_put_failure; +if (survey->channel && +nla_put_u32 (msg,NL80211_SURVEY_INFO_FREQUENCY_OFFSET , + survey->channel->freq_offset)) + goto nla_put_failure; +if ((survey->filled &SURVEY_INFO_NOISE_DBM ) &&nla_put_u8 (msg,NL80211_SURVEY_INFO_NOISE , survey->noise)) goto nla_put_failure;
Signature · 1 line
2.20.1
PATCH v4 16/17 mac80211_hwsim: fix TSF timestamp write to S1G beacon
In reply to Thomas Pedersenmac80211_hwsim was corrupting the S1G beacon because the timestamp location (and size) does not match the management beacon.
---
v3:
- fix this before claiming S1G support
--- drivers/net/wireless/mac80211_hwsim.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +13 -3
@@ -1687,9 +1687,19 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, mgmt = (struct ieee80211_mgmt *) skb->data;/* fake header transmission time */ data->abs_bcn_ts =mac80211_hwsim_get_tsf_raw (); - mgmt->u.beacon.timestamp =cpu_to_le64 (data->abs_bcn_ts + - data->tsf_offset + -24 *8 *10 / txrate->bitrate); +if (ieee80211_is_s1g_beacon (mgmt->frame_control)) { +struct ieee80211_ext *ext = (void *) mgmt; + + ext->u.s1g_beacon.timestamp =cpu_to_le32 (data->abs_bcn_ts + + data->tsf_offset + +10 *8 *10 / + txrate->bitrate); + }else { + mgmt->u.beacon.timestamp =cpu_to_le64 (data->abs_bcn_ts + + data->tsf_offset + +24 *8 *10 / + txrate->bitrate); + }mac80211_hwsim_tx_frame (hw, skb,rcu_dereference (vif->chanctx_conf)->def.chan);
Signature · 1 line
2.20.1
PATCH v4 17/17 mac80211_hwsim: indicate support for S1G
In reply to Thomas PedersenAdvertise S1G Capabilities and channels to mac80211.
Requires a few fixups to account for missing sband->bitrates, and a custom regulatory db to actually enable the S1G channels.
---
v2:
- split out changes to ieee80211.h in a separate commit and use GENMASK + FIELD_GET (Kalle)
v4:
- handle new channel widths in debug statements
--- drivers/net/wireless/mac80211_hwsim.c | 86 ++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 8 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +78 -8
@@ -377,6 +377,49 @@ static const struct ieee80211_channel hwsim_channels_5ghz[] = { CHAN5G(5925), /* Channel 185 */ }; +#define NUM_S1G_CHANS_US 51 +static struct ieee80211_channel hwsim_channels_s1g[NUM_S1G_CHANS_US ]; + +static const struct ieee80211_sta_s1g_cap hwsim_s1g_cap = { + .s1g = true, + .cap = {S1G_CAP0_SGI_1MHZ |S1G_CAP0_SGI_2MHZ , +0 , +0 , +S1G_CAP3_MAX_MPDU_LEN , +0 , +S1G_CAP5_AMPDU , +0 , +S1G_CAP7_DUP_1MHZ , +S1G_CAP8_TWT_RESPOND |S1G_CAP8_TWT_REQUEST , +0 }, + .nss_mcs = {0xfc |1 ,/* MCS 7 for 1 SS */ +/* RX Highest Supported Long GI Data Rate 0:7 */ +0 , +/* RX Highest Supported Long GI Data Rate 0:7 */ +/* TX S1G MCS Map 0:6 */ +0xfa , +/* TX S1G MCS Map :7 */ +/* TX Highest Supported Long GI Data Rate 0:6 */ +0x80 , +/* TX Highest Supported Long GI Data Rate 7:8 */ +/* Rx Single spatial stream and S1G-MCS Map for 1MHz */ +/* Tx Single spatial stream and S1G-MCS Map for 1MHz */ +0 }, +}; + +static void hwsim_init_s1g_channels (struct ieee80211_channel *channels) +{ +int ch, freq; + +for (ch =0 ; ch <NUM_S1G_CHANS_US ; ch++) { + freq =902000 + (ch +1 ) *500 ; + channels[ch].band =NL80211_BAND_S1GHZ ; + channels[ch].center_freq =KHZ_TO_MHZ (freq); + channels[ch].freq_offset = freq %1000 ; + channels[ch].hw_value = ch +1 ; + } +} +static const struct ieee80211_rate hwsim_rates[] = { { .bitrate =10 }, { .bitrate =20 , .flags =IEEE80211_RATE_SHORT_PREAMBLE },
@@ -505,6 +548,7 @@ struct mac80211_hwsim_data {struct ieee80211_supported_band bands[NUM_NL80211_BANDS ];struct ieee80211_channel channels_2ghz[ARRAY_SIZE (hwsim_channels_2ghz)];struct ieee80211_channel channels_5ghz[ARRAY_SIZE (hwsim_channels_5ghz)]; +struct ieee80211_channel channels_s1g[ARRAY_SIZE (hwsim_channels_s1g)];struct ieee80211_rate rates[ARRAY_SIZE (hwsim_rates)];struct ieee80211_iface_combination if_combination;struct ieee80211_iface_limit if_limits[3 ];
@@ -900,12 +944,14 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,struct mac80211_hwsim_data *data = hw->priv;struct sk_buff *skb;struct hwsim_radiotap_hdr *hdr; -u16 flags; +u16 flags, bitrate;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (tx_skb);struct ieee80211_rate *txrate =ieee80211_get_tx_rate (hw, info); -if (WARN_ON (!txrate)) -return ; +if (!txrate) + bitrate =0 ; +else + bitrate = txrate->bitrate;if (!netif_running (hwsim_mon))return ;
@@ -924,10 +970,10 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, (1 << IEEE80211_RADIOTAP_CHANNEL)); hdr->rt_tsft =__mac80211_hwsim_get_tsf (data); hdr->rt_flags =0 ; - hdr->rt_rate = txrate->bitrate /5 ; + hdr->rt_rate = bitrate /5 ; hdr->rt_channel =cpu_to_le16 (chan->center_freq); flags =IEEE80211_CHAN_2GHZ ; -if (txrate->flags &IEEE80211_RATE_ERP_G ) +if (txrate && txrate->flags &IEEE80211_RATE_ERP_G ) flags |=IEEE80211_CHAN_OFDM ;else flags |=IEEE80211_CHAN_CCK ;
@@ -1341,6 +1387,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,memset (&rx_status,0 ,sizeof (rx_status)); rx_status.flag |=RX_FLAG_MACTIME_START ; rx_status.freq = chan->center_freq; + rx_status.freq_offset = chan->freq_offset ?1 :0 ; rx_status.band = chan->band;if (info->control.rates[0 ].flags &IEEE80211_TX_RC_VHT_MCS ) { rx_status.rate_idx =
@@ -1522,14 +1569,18 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,/* fake header transmission time */ struct ieee80211_mgmt *mgmt;struct ieee80211_rate *txrate; +/* TODO: get MCS */ +int bitrate =100 ;u64 ts; mgmt = (struct ieee80211_mgmt *)skb->data; txrate =ieee80211_get_tx_rate (hw, txi); +if (txrate) + bitrate = txrate->bitrate; ts =mac80211_hwsim_get_tsf_raw (); mgmt->u.probe_resp.timestamp =cpu_to_le64 (ts + data->tsf_offset + -24 *8 *10 / txrate->bitrate); +24 *8 *10 / bitrate); }mac80211_hwsim_monitor_rx (hw, skb, channel);
@@ -1664,6 +1715,8 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac,struct ieee80211_rate *txrate;struct ieee80211_mgmt *mgmt;struct sk_buff *skb; +/* TODO: get MCS */ +int bitrate =100 ;hwsim_check_magic (vif);
@@ -1683,6 +1736,8 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, ARRAY_SIZE(info->control.rates)); txrate =ieee80211_get_tx_rate (hw, info); +if (txrate) + bitrate = txrate->bitrate; mgmt = (struct ieee80211_mgmt *) skb->data;/* fake header transmission time */
@@ -1693,12 +1748,12 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, ext->u.s1g_beacon.timestamp =cpu_to_le32 (data->abs_bcn_ts + data->tsf_offset +10 *8 *10 / - txrate->bitrate); + bitrate); }else { mgmt->u.beacon.timestamp =cpu_to_le64 (data->abs_bcn_ts + data->tsf_offset +24 *8 *10 / - txrate->bitrate); + bitrate); } mac80211_hwsim_tx_frame(hw, skb,
@@ -1747,6 +1802,11 @@ static const char * const hwsim_chanwidths[] = { [NL80211_CHAN_WIDTH_80] = "vht80", [NL80211_CHAN_WIDTH_80P80] = "vht80p80", [NL80211_CHAN_WIDTH_160] = "vht160", + [NL80211_CHAN_WIDTH_1] = "1MHz", + [NL80211_CHAN_WIDTH_2] = "2MHz", + [NL80211_CHAN_WIDTH_4] = "4MHz", + [NL80211_CHAN_WIDTH_8] = "8MHz", + [NL80211_CHAN_WIDTH_16] = "16MHz", };static int mac80211_hwsim_config (struct ieee80211_hw *hw,u32 changed)
@@ -3089,6 +3149,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, sizeof(hwsim_channels_2ghz));memcpy (data->channels_5ghz, hwsim_channels_5ghz,sizeof (hwsim_channels_5ghz)); +memcpy (data->channels_s1g, hwsim_channels_s1g, +sizeof (hwsim_channels_s1g));memcpy (data->rates, hwsim_rates,sizeof (hwsim_rates));for (band =NL80211_BAND_2GHZ ; band <NUM_NL80211_BANDS ; band++) {
@@ -3131,6 +3193,12 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, sband->vht_cap.vht_mcs.tx_mcs_map = sband->vht_cap.vht_mcs.rx_mcs_map;break ; +case NL80211_BAND_S1GHZ : +memcpy (&sband->s1g_cap, &hwsim_s1g_cap, +sizeof (sband->s1g_cap)); + sband->channels = data->channels_s1g; + sband->n_channels =ARRAY_SIZE (hwsim_channels_s1g); +break ;default :continue ; }
@@ -4328,6 +4396,8 @@ static int __init init_mac80211_hwsim(void) goto out_exit_virtio; } +hwsim_init_s1g_channels (hwsim_channels_s1g); +for (i =0 ; i < radios; i++) {struct hwsim_new_radio_params param = {0 };
Signature · 1 line
2.20.1