4 * Copyright(c) 2017 Intel Deutschland GmbH
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include "ieee80211_i.h"
14 ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data
*sdata
,
15 struct ieee80211_supported_band
*sband
,
16 const u8
*he_cap_ie
, u8 he_cap_len
,
19 struct ieee80211_sta_he_cap
*he_cap
= &sta
->sta
.he_cap
;
20 struct ieee80211_he_cap_elem
*he_cap_ie_elem
= (void *)he_cap_ie
;
25 memset(he_cap
, 0, sizeof(*he_cap
));
27 if (!he_cap_ie
|| !ieee80211_get_he_sta_cap(sband
))
30 /* Make sure size is OK */
31 mcs_nss_size
= ieee80211_he_mcs_nss_size(he_cap_ie_elem
);
33 ieee80211_he_ppe_size(he_cap_ie
[sizeof(he_cap
->he_cap_elem
) +
35 he_cap_ie_elem
->phy_cap_info
);
36 he_total_size
= sizeof(he_cap
->he_cap_elem
) + mcs_nss_size
+
38 if (he_cap_len
< he_total_size
)
41 memcpy(&he_cap
->he_cap_elem
, he_cap_ie
, sizeof(he_cap
->he_cap_elem
));
43 /* HE Tx/Rx HE MCS NSS Support Field */
44 memcpy(&he_cap
->he_mcs_nss_supp
,
45 &he_cap_ie
[sizeof(he_cap
->he_cap_elem
)], mcs_nss_size
);
47 /* Check if there are (optional) PPE Thresholds */
48 if (he_cap
->he_cap_elem
.phy_cap_info
[6] &
49 IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT
)
50 memcpy(he_cap
->ppe_thres
,
51 &he_cap_ie
[sizeof(he_cap
->he_cap_elem
) + mcs_nss_size
],
54 he_cap
->has_he
= true;