wifi: cfg80211: Add long_beacon_interval and short_beacon_tail
Subsystems (2)
PATCH v2 1/4 wifi: cfg80211: Add long_beacon_interval and short_beacon_tail
From: Kieran Frewen <[email protected]>
Support variables to handle short beacon period and adding a separate tail for them.
--- include/net/cfg80211.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
include/net/cfg80211.h +6 -3
@@ -1179,8 +1179,11 @@ struct cfg80211_mbssid_elems {* or %NULL if not changed * @tail: tail portion of beacon (after TIM IE) * or %NULL if not changed +* @short_tail: short tail portion of beacon (after TIM IE) +or %NULL if not changed * @head_len: length of @head * @tail_len: length of @tail +* @short_tail_len: length of @short_tail * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL * @beacon_ies_len: length of beacon_ies in octets * @proberesp_ies: extra information element(s) to add into Probe Response
@@ -1207,7 +1210,7 @@ struct cfg80211_mbssid_elems {struct cfg80211_beacon_data {unsigned int link_id; -const u8 *head, *tail; +const u8 *head, *tail, *short_tail;const u8 *beacon_ies;const u8 *proberesp_ies;const u8 *assocresp_ies;
@@ -1217,7 +1220,7 @@ struct cfg80211_beacon_data {struct cfg80211_mbssid_elems *mbssid_ies;s8 ftm_responder; -size_t head_len, tail_len; +size_t head_len, tail_len, short_tail_len;size_t beacon_ies_len;size_t proberesp_ies_len;size_t assocresp_ies_len;
@@ -1328,7 +1331,7 @@ struct cfg80211_ap_settings {struct cfg80211_beacon_data beacon; -int beacon_interval, dtim_period; +int beacon_interval, dtim_period, short_beacon_period;const u8 *ssid;size_t ssid_len;enum nl80211_hidden_ssid hidden_ssid;
base-commit: 5c111ec204d15d1c7d00428b0afdda62ff118565
Signature · 1 line
2.34.1
PATCH v2 2/4 wifi: mac80211: S1G beacon/short beacon support
From: Kieran Frewen <[email protected]>
If configured, use the S1G short beacon format. The S1G short beacon format includes a limited set of information elements.
--- include/net/mac80211.h | 1 + net/mac80211/cfg.c | 1 + net/mac80211/ieee80211_i.h | 1 + net/mac80211/tx.c | 14 +++++++++++++- 4 files changed, 16 insertions(+), 1 deletion(-)
include/net/mac80211.h +1 -0
@@ -674,6 +674,7 @@ struct ieee80211_bss_conf {bool enable_beacon;u8 dtim_period;u16 beacon_int; +u8 short_beacon_period;u16 assoc_capability;u64 sync_tsf;u32 sync_device_ts;
net/mac80211/cfg.c +1 -0
@@ -1308,6 +1308,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, } link_conf->dtim_period = params->dtim_period; + link_conf->short_beacon_period = params->short_beacon_period; link_conf->enable_beacon = true; link_conf->allow_p2p_go_ps = sdata->vif.p2p; link_conf->twt_responder = params->twt_responder;
net/mac80211/ieee80211_i.h +1 -0
@@ -268,6 +268,7 @@ struct beacon_data {struct ieee80211_meshconf_ie *meshconf;u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM ];u8 cntdwn_current_counter; +u8 long_beacon_count;struct cfg80211_mbssid_elems *mbssid_ies;struct rcu_head rcu_head; };
net/mac80211/tx.c +13 -1
@@ -5116,6 +5116,18 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw,struct sk_buff *skb =NULL ;u16 csa_off_base =0 ;int mbssid_len; +bool is_short = false; + +if (vif->cfg.s1g) { +if (beacon->long_beacon_count ==0 ) { + is_short = false; + beacon->long_beacon_count = + vif->bss_conf.short_beacon_period -1 ; + }else { + is_short = true; + beacon->long_beacon_count--; + } + }if (beacon->cntdwn_counter_offsets[0 ]) {if (!is_template)
@@ -5153,7 +5165,7 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw, csa_off_base = skb->len; } -if (beacon->tail) +if (beacon->tail && !is_short)skb_put_data (skb, beacon->tail, beacon->tail_len);if (ieee80211_beacon_protect (skb, local, sdata, link) <0 )
Signature · 1 line
2.34.1
PATCH v2 3/4 wifi: nl80211: update attributes netlink for S1G short beacon
In reply to Gilad ItzkovitchFrom: Kieran Frewen <[email protected]>
Add short beacon period and tail attributes for user configuration
--- include/uapi/linux/nl80211.h | 9 +++++++++ net/wireless/nl80211.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+)
include/uapi/linux/nl80211.h +9 -0
@@ -2751,6 +2751,10 @@ enum nl80211_commands {* the incoming frame RX timestamp. * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent * (re)associations. +* +* @NL80211_ATTR_SHORT_BEACON_PERIOD: S1G short beacon period in TUs. +* @NL80211_ATTR_SHORT_BEACON_TAIL: portion of the short beacon after the TIM. +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3280,6 +3284,9 @@ enum nl80211_attrs {NL80211_ATTR_RX_HW_TIMESTAMP ,NL80211_ATTR_TD_BITMAP , +NL80211_ATTR_SHORT_BEACON_PERIOD , +NL80211_ATTR_SHORT_BEACON_TAIL , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -4963,6 +4970,7 @@ enum nl80211_bss_scan_width {* @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz * @NL80211_BSS_MLO_LINK_ID: MLO link ID of the BSS (u8). * @NL80211_BSS_MLD_ADDR: MLD address of this BSS if connected to it. +* @NL80211_BSS_SHORT_BEACON_PERIOD: S1G short beacon period in TUs * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */
@@ -4990,6 +4998,7 @@ enum nl80211_bss {NL80211_BSS_FREQUENCY_OFFSET ,NL80211_BSS_MLO_LINK_ID ,NL80211_BSS_MLD_ADDR , +NL80211_BSS_SHORT_BEACON_PERIOD ,/* keep last */ __NL80211_BSS_AFTER_LAST,
net/wireless/nl80211.c +15 -0
@@ -805,6 +805,11 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN), [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG }, [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT }, + [NL80211_ATTR_SHORT_BEACON_PERIOD] = { .type = NLA_U16 }, + [NL80211_ATTR_SHORT_BEACON_TAIL ] = +NLA_POLICY_VALIDATE_FN (NLA_BINARY , validate_ie_attr, + IEEE80211_MAX_DATA_LEN), + };/* policy for the key attributes */
@@ -5440,6 +5445,12 @@ static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev, haveinfo = true; } +if (attrs[NL80211_ATTR_SHORT_BEACON_TAIL ]) { + bcn->short_tail =nla_data (attrs[NL80211_ATTR_SHORT_BEACON_TAIL ]); + bcn->short_tail_len =nla_len (attrs[NL80211_ATTR_SHORT_BEACON_TAIL ]); + haveinfo = true; + } +if (!haveinfo)return -EINVAL ;
@@ -5804,6 +5815,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)nla_get_u32 (info->attrs[NL80211_ATTR_BEACON_INTERVAL ]); params->dtim_period =nla_get_u32 (info->attrs[NL80211_ATTR_DTIM_PERIOD ]); +if (info->attrs[NL80211_ATTR_SHORT_BEACON_PERIOD ]) + params->short_beacon_period = +nla_get_u32 (info->attrs[NL80211_ATTR_SHORT_BEACON_PERIOD ]) ==0 ? +1 :nla_get_u32 (info->attrs[NL80211_ATTR_SHORT_BEACON_PERIOD ]); err =cfg80211_validate_beacon_int (rdev, dev->ieee80211_ptr->iftype, params->beacon_interval);
Signature · 1 line
2.34.1
PATCH v2 4/4 wifi: mac80211: support setting S1G short beacon period and tail
In reply to Gilad ItzkovitchFrom: Kieran Frewen <[email protected]>
With the kernel able to send both short and long S1G beacons, include the ability for setting the short beacon period.
It also adds the support for distinguish short beacon tail.
--- net/mac80211/cfg.c | 22 +++++++++++++++++++--- net/mac80211/ieee80211_i.h | 4 ++-- net/mac80211/tx.c | 4 +++- 3 files changed, 24 insertions(+), 6 deletions(-)
net/mac80211/cfg.c +19 -3
@@ -1091,7 +1091,7 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, {struct cfg80211_mbssid_elems *mbssid =NULL ;struct beacon_data *new, *old; -int new_head_len, new_tail_len; +int new_head_len, new_tail_len, new_short_tail_len;int size, err;u32 changed =BSS_CHANGED_BEACON ;struct ieee80211_bss_conf *link_conf = link->conf;
@@ -1115,7 +1115,13 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,else new_tail_len = old->tail_len; - size =sizeof (*new) + new_head_len + new_tail_len; +if (params->short_tail || !old) +/* params->tail_len will be zero for !params->tail */ + new_short_tail_len = params->short_tail_len; +else + new_short_tail_len = old->short_tail_len; + + size =sizeof (*new) + new_head_len + new_tail_len + new_short_tail_len;/* new or old multiple BSSID elements? */ if (params->mbssid_ies) {
@@ -1142,9 +1148,12 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, new->tail = new->head + new_head_len; new->head_len = new_head_len; new->tail_len = new_tail_len; + new->short_tail = new->tail + new->tail_len; + new->short_tail_len = new_short_tail_len; +/* copy in optional mbssid_ies */ if (mbssid) { -u8 *pos = new->tail + new->tail_len; +u8 *pos = new->short_tail + new->short_tail_len; new->mbssid_ies = (void *)pos; pos +=struct_size (new->mbssid_ies, elem, mbssid->cnt);
@@ -1177,6 +1186,13 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,if (old)memcpy (new->tail, old->tail, new_tail_len); +/* copy in optional short tail */ +if (params->short_tail) +memcpy (new->short_tail, params->short_tail, new_short_tail_len); +else +if (old) +memcpy (new->short_tail, old->short_tail, new_short_tail_len); + err =ieee80211_set_probe_resp (sdata, params->probe_resp, params->probe_resp_len, csa, cca, link);if (err <0 ) {
net/mac80211/ieee80211_i.h +2 -2
@@ -263,8 +263,8 @@ struct ieee80211_color_change_settings { };struct beacon_data { -u8 *head, *tail; -int head_len, tail_len; +u8 *head, *tail, *short_tail; +int head_len, tail_len, short_tail_len;struct ieee80211_meshconf_ie *meshconf;u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM ];u8 cntdwn_current_counter;
net/mac80211/tx.c +3 -1
@@ -5165,7 +5165,9 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw, csa_off_base = skb->len; } -if (beacon->tail && !is_short) +if (beacon->short_tail && is_short) +skb_put_data (skb, beacon->short_tail, beacon->short_tail_len); +else if (beacon->tail && !is_short)skb_put_data (skb, beacon->tail, beacon->tail_len);if (ieee80211_beacon_protect (skb, local, sdata, link) <0 )
Signature · 1 line
2.34.1