Skip to content

Commit 7957c6c

Browse files
twpedersenjmberg-intel
authored andcommitted
mac80211: support S1G STA capabilities
Include the S1G Capabilities element in an association request, and support the cfg80211 capability overrides. Signed-off-by: Thomas Pedersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] [pass skb to ieee80211_add_s1g_capab_ie(), small code style edits] Signed-off-by: Johannes Berg <[email protected]>
1 parent d2b7588 commit 7957c6c

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

net/mac80211/ieee80211_i.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ struct ieee80211_if_managed {
544544
struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
545545
struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */
546546
struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */
547+
struct ieee80211_s1g_cap s1g_capa; /* configured S1G overrides */
548+
struct ieee80211_s1g_cap s1g_capa_mask; /* valid s1g_capa bits */
547549

548550
/* TDLS support */
549551
u8 tdls_peer[ETH_ALEN] __aligned(2);
@@ -2203,6 +2205,9 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
22032205
struct sk_buff *skb, bool need_basic,
22042206
enum nl80211_band band);
22052207
u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
2208+
void ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata,
2209+
struct ieee80211_sta_s1g_cap *caps,
2210+
struct sk_buff *skb);
22062211

22072212
/* channel management */
22082213
bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,

net/mac80211/mlme.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,9 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
10181018
pos = ieee80211_add_wmm_info_ie(skb_put(skb, 9), qos_info);
10191019
}
10201020

1021+
if (sband->band == NL80211_BAND_S1GHZ)
1022+
ieee80211_add_s1g_capab_ie(sdata, &sband->s1g_cap, skb);
1023+
10211024
/* add any remaining custom (i.e. vendor specific here) IEs */
10221025
if (assoc_data->ie_len) {
10231026
noffset = assoc_data->ie_len;
@@ -5456,6 +5459,10 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
54565459
memcpy(&ifmgd->vht_capa_mask, &req->vht_capa_mask,
54575460
sizeof(ifmgd->vht_capa_mask));
54585461

5462+
memcpy(&ifmgd->s1g_capa, &req->s1g_capa, sizeof(ifmgd->s1g_capa));
5463+
memcpy(&ifmgd->s1g_capa_mask, &req->s1g_capa_mask,
5464+
sizeof(ifmgd->s1g_capa_mask));
5465+
54595466
if (req->ie && req->ie_len) {
54605467
memcpy(assoc_data->ie, req->ie, req->ie_len);
54615468
assoc_data->ie_len = req->ie_len;

net/mac80211/util.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4277,6 +4277,48 @@ int ieee80211_max_num_channels(struct ieee80211_local *local)
42774277
return max_num_different_channels;
42784278
}
42794279

4280+
void ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata,
4281+
struct ieee80211_sta_s1g_cap *caps,
4282+
struct sk_buff *skb)
4283+
{
4284+
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
4285+
struct ieee80211_s1g_cap s1g_capab;
4286+
u8 *pos;
4287+
int i;
4288+
4289+
if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
4290+
return;
4291+
4292+
if (!caps->s1g)
4293+
return;
4294+
4295+
memcpy(s1g_capab.capab_info, caps->cap, sizeof(caps->cap));
4296+
memcpy(s1g_capab.supp_mcs_nss, caps->nss_mcs, sizeof(caps->nss_mcs));
4297+
4298+
/* override the capability info */
4299+
for (i = 0; i < sizeof(ifmgd->s1g_capa.capab_info); i++) {
4300+
u8 mask = ifmgd->s1g_capa_mask.capab_info[i];
4301+
4302+
s1g_capab.capab_info[i] &= ~mask;
4303+
s1g_capab.capab_info[i] |= ifmgd->s1g_capa.capab_info[i] & mask;
4304+
}
4305+
4306+
/* then MCS and NSS set */
4307+
for (i = 0; i < sizeof(ifmgd->s1g_capa.supp_mcs_nss); i++) {
4308+
u8 mask = ifmgd->s1g_capa_mask.supp_mcs_nss[i];
4309+
4310+
s1g_capab.supp_mcs_nss[i] &= ~mask;
4311+
s1g_capab.supp_mcs_nss[i] |=
4312+
ifmgd->s1g_capa.supp_mcs_nss[i] & mask;
4313+
}
4314+
4315+
pos = skb_put(skb, 2 + sizeof(s1g_capab));
4316+
*pos++ = WLAN_EID_S1G_CAPABILITIES;
4317+
*pos++ = sizeof(s1g_capab);
4318+
4319+
memcpy(pos, &s1g_capab, sizeof(s1g_capab));
4320+
}
4321+
42804322
u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo)
42814323
{
42824324
*buf++ = WLAN_EID_VENDOR_SPECIFIC;

0 commit comments

Comments
 (0)