diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2009-03-26 17:40:23 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:36 -0400 |
commit | 4d2a369ec09167f423c0783b1cf85cee8102544f (patch) | |
tree | 62f54605b38c64aeed577519b3cfbbbaed0d89e7 /drivers/net/wireless | |
parent | 4bd7f03e915b6946307ce57f20718c6547734b5d (diff) |
rndis_wlan: convert get range to cfg80211
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 110 |
1 files changed, 2 insertions, 108 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 9e7956d9c6be..4252903cf89a 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -1176,113 +1176,6 @@ static int rndis_iw_commit(struct net_device *dev, | |||
1176 | } | 1176 | } |
1177 | 1177 | ||
1178 | 1178 | ||
1179 | static int rndis_iw_get_range(struct net_device *dev, | ||
1180 | struct iw_request_info *info, union iwreq_data *wrqu, char *extra) | ||
1181 | { | ||
1182 | struct iw_range *range = (struct iw_range *)extra; | ||
1183 | struct usbnet *usbdev = netdev_priv(dev); | ||
1184 | struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev); | ||
1185 | int len, ret, i, j, num, has_80211g_rates; | ||
1186 | u8 rates[8]; | ||
1187 | __le32 tx_power; | ||
1188 | |||
1189 | devdbg(usbdev, "SIOCGIWRANGE"); | ||
1190 | |||
1191 | /* clear iw_range struct */ | ||
1192 | memset(range, 0, sizeof(*range)); | ||
1193 | wrqu->data.length = sizeof(*range); | ||
1194 | |||
1195 | range->txpower_capa = IW_TXPOW_MWATT; | ||
1196 | range->num_txpower = 1; | ||
1197 | if (priv->caps & CAP_SUPPORT_TXPOWER) { | ||
1198 | len = sizeof(tx_power); | ||
1199 | ret = rndis_query_oid(usbdev, OID_802_11_TX_POWER_LEVEL, | ||
1200 | &tx_power, &len); | ||
1201 | if (ret == 0 && le32_to_cpu(tx_power) != 0xFF) | ||
1202 | range->txpower[0] = le32_to_cpu(tx_power); | ||
1203 | else | ||
1204 | range->txpower[0] = get_bcm4320_power(priv); | ||
1205 | } else | ||
1206 | range->txpower[0] = get_bcm4320_power(priv); | ||
1207 | |||
1208 | len = sizeof(rates); | ||
1209 | ret = rndis_query_oid(usbdev, OID_802_11_SUPPORTED_RATES, &rates, | ||
1210 | &len); | ||
1211 | has_80211g_rates = 0; | ||
1212 | if (ret == 0) { | ||
1213 | j = 0; | ||
1214 | for (i = 0; i < len; i++) { | ||
1215 | if (rates[i] == 0) | ||
1216 | break; | ||
1217 | range->bitrate[j] = (rates[i] & 0x7f) * 500000; | ||
1218 | /* check for non 802.11b rates */ | ||
1219 | if (range->bitrate[j] == 6000000 || | ||
1220 | range->bitrate[j] == 9000000 || | ||
1221 | (range->bitrate[j] >= 12000000 && | ||
1222 | range->bitrate[j] != 22000000)) | ||
1223 | has_80211g_rates = 1; | ||
1224 | j++; | ||
1225 | } | ||
1226 | range->num_bitrates = j; | ||
1227 | } else | ||
1228 | range->num_bitrates = 0; | ||
1229 | |||
1230 | /* fill in 802.11g rates */ | ||
1231 | if (has_80211g_rates) { | ||
1232 | num = range->num_bitrates; | ||
1233 | for (i = 4; i < ARRAY_SIZE(rndis_rates); i++) { | ||
1234 | for (j = 0; j < num; j++) { | ||
1235 | if (range->bitrate[j] == | ||
1236 | rndis_rates[i].bitrate * 100000) | ||
1237 | break; | ||
1238 | } | ||
1239 | if (j == num) | ||
1240 | range->bitrate[range->num_bitrates++] = | ||
1241 | rndis_rates[i].bitrate * 100000; | ||
1242 | if (range->num_bitrates == IW_MAX_BITRATES) | ||
1243 | break; | ||
1244 | } | ||
1245 | |||
1246 | /* estimated max real througput in bps */ | ||
1247 | range->throughput = 54 * 1000 * 1000 / 2; | ||
1248 | |||
1249 | /* ~35% more with afterburner */ | ||
1250 | if (priv->param_afterburner) | ||
1251 | range->throughput = range->throughput / 100 * 135; | ||
1252 | } else { | ||
1253 | /* estimated max real througput in bps */ | ||
1254 | range->throughput = 11 * 1000 * 1000 / 2; | ||
1255 | } | ||
1256 | |||
1257 | range->num_channels = 14; | ||
1258 | |||
1259 | for (i = 0; (i < 14) && (i < IW_MAX_FREQUENCIES); i++) { | ||
1260 | range->freq[i].i = i + 1; | ||
1261 | range->freq[i].m = ieee80211_dsss_chan_to_freq(i + 1) * 100000; | ||
1262 | range->freq[i].e = 1; | ||
1263 | } | ||
1264 | range->num_frequency = i; | ||
1265 | |||
1266 | range->min_rts = 0; | ||
1267 | range->max_rts = 2347; | ||
1268 | range->min_frag = 256; | ||
1269 | range->max_frag = 2346; | ||
1270 | |||
1271 | range->max_qual.qual = 100; | ||
1272 | range->max_qual.level = 100; | ||
1273 | range->max_qual.updated = IW_QUAL_QUAL_UPDATED | ||
1274 | | IW_QUAL_LEVEL_UPDATED | ||
1275 | | IW_QUAL_NOISE_INVALID; | ||
1276 | |||
1277 | range->we_version_compiled = WIRELESS_EXT; | ||
1278 | range->we_version_source = WIRELESS_EXT; | ||
1279 | |||
1280 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | | ||
1281 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; | ||
1282 | return 0; | ||
1283 | } | ||
1284 | |||
1285 | |||
1286 | static int rndis_iw_set_essid(struct net_device *dev, | 1179 | static int rndis_iw_set_essid(struct net_device *dev, |
1287 | struct iw_request_info *info, union iwreq_data *wrqu, char *essid) | 1180 | struct iw_request_info *info, union iwreq_data *wrqu, char *essid) |
1288 | { | 1181 | { |
@@ -2189,7 +2082,7 @@ static const iw_handler rndis_iw_handler[] = | |||
2189 | IW_IOCTL(SIOCGIWFREQ) = rndis_iw_get_freq, | 2082 | IW_IOCTL(SIOCGIWFREQ) = rndis_iw_get_freq, |
2190 | IW_IOCTL(SIOCSIWMODE) = (iw_handler) cfg80211_wext_siwmode, | 2083 | IW_IOCTL(SIOCSIWMODE) = (iw_handler) cfg80211_wext_siwmode, |
2191 | IW_IOCTL(SIOCGIWMODE) = (iw_handler) cfg80211_wext_giwmode, | 2084 | IW_IOCTL(SIOCGIWMODE) = (iw_handler) cfg80211_wext_giwmode, |
2192 | IW_IOCTL(SIOCGIWRANGE) = rndis_iw_get_range, | 2085 | IW_IOCTL(SIOCGIWRANGE) = (iw_handler) cfg80211_wext_giwrange, |
2193 | IW_IOCTL(SIOCSIWAP) = rndis_iw_set_bssid, | 2086 | IW_IOCTL(SIOCSIWAP) = rndis_iw_set_bssid, |
2194 | IW_IOCTL(SIOCGIWAP) = rndis_iw_get_bssid, | 2087 | IW_IOCTL(SIOCGIWAP) = rndis_iw_get_bssid, |
2195 | IW_IOCTL(SIOCSIWSCAN) = rndis_iw_set_scan, | 2088 | IW_IOCTL(SIOCSIWSCAN) = rndis_iw_set_scan, |
@@ -2633,6 +2526,7 @@ static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf) | |||
2633 | priv->band.bitrates = priv->rates; | 2526 | priv->band.bitrates = priv->rates; |
2634 | priv->band.n_bitrates = ARRAY_SIZE(rndis_rates); | 2527 | priv->band.n_bitrates = ARRAY_SIZE(rndis_rates); |
2635 | wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; | 2528 | wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; |
2529 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; | ||
2636 | 2530 | ||
2637 | set_wiphy_dev(wiphy, &usbdev->udev->dev); | 2531 | set_wiphy_dev(wiphy, &usbdev->udev->dev); |
2638 | 2532 | ||