+static int nl80211_eval_modelist(struct nl80211_modes *m)
+{
+ /* Treat any nonzero capability as 11n */
+ if (m->nl_ht > 0)
+ {
+ m->hw |= IWINFO_80211_N;
+ m->ht |= IWINFO_HTMODE_HT20;
+
+ if (m->nl_ht & (1 << 1))
+ m->ht |= IWINFO_HTMODE_HT40;
+ }
+
+ if (m->he_phy_cap[0] != 0) {
+ m->hw |= IWINFO_80211_AX;
+ m->ht |= IWINFO_HTMODE_HE20;
+
+ if (m->he_phy_cap[0] & BIT(9))
+ m->ht |= IWINFO_HTMODE_HE40;
+ if (m->he_phy_cap[0] & BIT(10))
+ m->ht |= IWINFO_HTMODE_HE40 | IWINFO_HTMODE_HE80;
+ if (m->he_phy_cap[0] & BIT(11))
+ m->ht |= IWINFO_HTMODE_HE160;
+ if (m->he_phy_cap[0] & BIT(12))
+ m->ht |= IWINFO_HTMODE_HE160 | IWINFO_HTMODE_HE80_80;
+ }
+
+ if (m->nl_freq < 2485)
+ {
+ m->hw |= IWINFO_80211_B;
+ m->hw |= IWINFO_80211_G;
+ }
+ else if (m->nl_vht)
+ {
+ /* Treat any nonzero capability as 11ac */
+ if (m->nl_vht > 0)
+ {
+ m->hw |= IWINFO_80211_AC;
+ m->ht |= IWINFO_HTMODE_VHT20 | IWINFO_HTMODE_VHT40 | IWINFO_HTMODE_VHT80;
+
+ switch ((m->nl_vht >> 2) & 3)
+ {
+ case 2:
+ m->ht |= IWINFO_HTMODE_VHT80_80;
+ /* fall through */
+
+ case 1:
+ m->ht |= IWINFO_HTMODE_VHT160;
+ }
+ }
+ }
+ else if (m->nl_freq >= 56160)
+ {
+ m->hw |= IWINFO_80211_AD;
+ }
+ else if (!(m->hw & IWINFO_80211_AC))
+ {
+ m->hw |= IWINFO_80211_A;
+ }
+}
+