9p: Make sure we are able to clunk the cached fid on umount
[safe/jmp/linux-2.6] / net / wireless / wext-compat.c
index 584eb48..9ab5183 100644 (file)
@@ -479,6 +479,7 @@ static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
                        }
                        err = rdev->ops->del_key(&rdev->wiphy, dev, idx, addr);
                }
+               wdev->wext.connect.privacy = false;
                /*
                 * Applications using wireless extensions expect to be
                 * able to delete keys that don't exist, so allow that.
@@ -1098,8 +1099,8 @@ int cfg80211_wext_siwpower(struct net_device *dev,
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
        struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
-       bool ps = wdev->wext.ps;
-       int timeout = wdev->wext.ps_timeout;
+       bool ps = wdev->ps;
+       int timeout = wdev->ps_timeout;
        int err;
 
        if (wdev->iftype != NL80211_IFTYPE_STATION)
@@ -1132,8 +1133,8 @@ int cfg80211_wext_siwpower(struct net_device *dev,
        if (err)
                return err;
 
-       wdev->wext.ps = ps;
-       wdev->wext.ps_timeout = timeout;
+       wdev->ps = ps;
+       wdev->ps_timeout = timeout;
 
        return 0;
 
@@ -1146,7 +1147,7 @@ int cfg80211_wext_giwpower(struct net_device *dev,
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
 
-       wrq->disabled = !wdev->wext.ps;
+       wrq->disabled = !wdev->ps;
 
        return 0;
 }
@@ -1203,21 +1204,47 @@ int cfg80211_wext_siwrate(struct net_device *dev,
        struct wireless_dev *wdev = dev->ieee80211_ptr;
        struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
        struct cfg80211_bitrate_mask mask;
+       u32 fixed, maxrate;
+       struct ieee80211_supported_band *sband;
+       int band, ridx;
+       bool match = false;
 
        if (!rdev->ops->set_bitrate_mask)
                return -EOPNOTSUPP;
 
-       mask.fixed = 0;
-       mask.maxrate = 0;
+       memset(&mask, 0, sizeof(mask));
+       fixed = 0;
+       maxrate = (u32)-1;
 
        if (rate->value < 0) {
                /* nothing */
        } else if (rate->fixed) {
-               mask.fixed = rate->value / 1000; /* kbps */
+               fixed = rate->value / 100000;
        } else {
-               mask.maxrate = rate->value / 1000; /* kbps */
+               maxrate = rate->value / 100000;
        }
 
+       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               sband = wdev->wiphy->bands[band];
+               if (sband == NULL)
+                       continue;
+               for (ridx = 0; ridx < sband->n_bitrates; ridx++) {
+                       struct ieee80211_rate *srate = &sband->bitrates[ridx];
+                       if (fixed == srate->bitrate) {
+                               mask.control[band].legacy = 1 << ridx;
+                               match = true;
+                               break;
+                       }
+                       if (srate->bitrate <= maxrate) {
+                               mask.control[band].legacy |= 1 << ridx;
+                               match = true;
+                       }
+               }
+       }
+
+       if (!match)
+               return -EINVAL;
+
        return rdev->ops->set_bitrate_mask(wdev->wiphy, dev, NULL, &mask);
 }
 EXPORT_SYMBOL_GPL(cfg80211_wext_siwrate);
@@ -1256,10 +1283,7 @@ int cfg80211_wext_giwrate(struct net_device *dev,
        if (!(sinfo.filled & STATION_INFO_TX_BITRATE))
                return -EOPNOTSUPP;
 
-       rate->value = 0;
-
-       if (!(sinfo.txrate.flags & RATE_INFO_FLAGS_MCS))
-               rate->value = 100000 * sinfo.txrate.legacy;
+       rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);
 
        return 0;
 }