Merge tag 'timers-core-2021-02-15' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / net / wireless / util.c
index b4acc80..1bf0200 100644 (file)
@@ -997,7 +997,7 @@ void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev)
 {
        struct wireless_dev *wdev;
 
-       ASSERT_RTNL();
+       lockdep_assert_held(&rdev->wiphy.mtx);
 
        list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list)
                cfg80211_process_wdev_events(wdev);
@@ -1010,7 +1010,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
        int err;
        enum nl80211_iftype otype = dev->ieee80211_ptr->iftype;
 
-       ASSERT_RTNL();
+       lockdep_assert_held(&rdev->wiphy.mtx);
 
        /* don't support changing VLANs, you just re-create them */
        if (otype == NL80211_IFTYPE_AP_VLAN)
@@ -1188,6 +1188,25 @@ static u32 cfg80211_calculate_bitrate_dmg(struct rate_info *rate)
        return __mcs2bitrate[rate->mcs];
 }
 
+static u32 cfg80211_calculate_bitrate_extended_sc_dmg(struct rate_info *rate)
+{
+       static const u32 __mcs2bitrate[] = {
+               [6 - 6] = 26950, /* MCS 9.1 : 2695.0 mbps */
+               [7 - 6] = 50050, /* MCS 12.1 */
+               [8 - 6] = 53900,
+               [9 - 6] = 57750,
+               [10 - 6] = 63900,
+               [11 - 6] = 75075,
+               [12 - 6] = 80850,
+       };
+
+       /* Extended SC MCS not defined for base MCS below 6 or above 12 */
+       if (WARN_ON_ONCE(rate->mcs < 6 || rate->mcs > 12))
+               return 0;
+
+       return __mcs2bitrate[rate->mcs - 6];
+}
+
 static u32 cfg80211_calculate_bitrate_edmg(struct rate_info *rate)
 {
        static const u32 __mcs2bitrate[] = {
@@ -1224,7 +1243,7 @@ static u32 cfg80211_calculate_bitrate_edmg(struct rate_info *rate)
 
 static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
 {
-       static const u32 base[4][10] = {
+       static const u32 base[4][12] = {
                {   6500000,
                   13000000,
                   19500000,
@@ -1235,7 +1254,9 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
                   65000000,
                   78000000,
                /* not in the spec, but some devices use this: */
-                  86500000,
+                  86700000,
+                  97500000,
+                 108300000,
                },
                {  13500000,
                   27000000,
@@ -1247,6 +1268,8 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
                  135000000,
                  162000000,
                  180000000,
+                 202500000,
+                 225000000,
                },
                {  29300000,
                   58500000,
@@ -1258,6 +1281,8 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
                  292500000,
                  351000000,
                  390000000,
+                 438800000,
+                 487500000,
                },
                {  58500000,
                  117000000,
@@ -1269,12 +1294,14 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
                  585000000,
                  702000000,
                  780000000,
+                 877500000,
+                 975000000,
                },
        };
        u32 bitrate;
        int idx;
 
-       if (rate->mcs > 9)
+       if (rate->mcs > 11)
                goto warn;
 
        switch (rate->bw) {
@@ -1398,6 +1425,8 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate)
                return cfg80211_calculate_bitrate_ht(rate);
        if (rate->flags & RATE_INFO_FLAGS_DMG)
                return cfg80211_calculate_bitrate_dmg(rate);
+       if (rate->flags & RATE_INFO_FLAGS_EXTENDED_SC_DMG)
+               return cfg80211_calculate_bitrate_extended_sc_dmg(rate);
        if (rate->flags & RATE_INFO_FLAGS_EDMG)
                return cfg80211_calculate_bitrate_edmg(rate);
        if (rate->flags & RATE_INFO_FLAGS_VHT_MCS)