aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2009-08-28 06:28:35 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-28 14:41:01 -0400
commit04a6445f6f5e439ef775bd18cf3f485f84bbfb1b (patch)
treed698e5e1545d19b4bcd2af062e1cadfbd2af152d /drivers/net
parent21ec2d8d0fee4f3bf0d2e25e5b63bf2637233b43 (diff)
rndis_wlan: use cfg80211_wext_handler
Now that cfg80211 functions are added and wext converted to use wext-compat functions, remove wext structures and disabled code. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/rndis_wlan.c421
1 files changed, 0 insertions, 421 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 9d9750dbec84..402d36757765 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2175,426 +2175,6 @@ static int rndis_dump_station(struct wiphy *wiphy, struct net_device *dev,
2175 return 0; 2175 return 0;
2176} 2176}
2177 2177
2178/*
2179 * wireless extension handlers
2180 */
2181
2182#if 0
2183/* Commented code out instead of removing to have more sane patch for review.
2184 * Will be removed later in the set.
2185 */
2186static int rndis_iw_set_essid(struct net_device *dev,
2187 struct iw_request_info *info, union iwreq_data *wrqu, char *essid)
2188{
2189 struct ndis_80211_ssid ssid;
2190 int length = wrqu->essid.length;
2191 struct usbnet *usbdev = netdev_priv(dev);
2192
2193 devdbg(usbdev, "SIOCSIWESSID: [flags:%d,len:%d] '%.32s'",
2194 wrqu->essid.flags, wrqu->essid.length, essid);
2195
2196 if (length > NDIS_802_11_LENGTH_SSID)
2197 length = NDIS_802_11_LENGTH_SSID;
2198
2199 ssid.length = cpu_to_le32(length);
2200 if (length > 0)
2201 memcpy(ssid.essid, essid, length);
2202 else
2203 memset(ssid.essid, 0, NDIS_802_11_LENGTH_SSID);
2204
2205 set_assoc_params(usbdev);
2206
2207 if (!wrqu->essid.flags || length == 0)
2208 return disassociate(usbdev, 1);
2209 else {
2210 /* Pause and purge rx queue, so we don't pass packets before
2211 * 'media connect'-indication.
2212 */
2213 usbnet_pause_rx(usbdev);
2214 usbnet_purge_paused_rxq(usbdev);
2215
2216 return set_essid(usbdev, &ssid);
2217 }
2218}
2219
2220
2221static int rndis_iw_get_essid(struct net_device *dev,
2222 struct iw_request_info *info, union iwreq_data *wrqu, char *essid)
2223{
2224 struct ndis_80211_ssid ssid;
2225 struct usbnet *usbdev = netdev_priv(dev);
2226 int ret;
2227
2228 ret = get_essid(usbdev, &ssid);
2229
2230 if (ret == 0 && le32_to_cpu(ssid.length) > 0) {
2231 wrqu->essid.flags = 1;
2232 wrqu->essid.length = le32_to_cpu(ssid.length);
2233 memcpy(essid, ssid.essid, wrqu->essid.length);
2234 essid[wrqu->essid.length] = 0;
2235 } else {
2236 memset(essid, 0, sizeof(NDIS_802_11_LENGTH_SSID));
2237 wrqu->essid.flags = 0;
2238 wrqu->essid.length = 0;
2239 }
2240 devdbg(usbdev, "SIOCGIWESSID: %s", essid);
2241 return ret;
2242}
2243
2244
2245static int rndis_iw_get_bssid(struct net_device *dev,
2246 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2247{
2248 struct usbnet *usbdev = netdev_priv(dev);
2249 unsigned char bssid[ETH_ALEN];
2250 int ret;
2251
2252 ret = get_bssid(usbdev, bssid);
2253
2254 if (ret == 0)
2255 devdbg(usbdev, "SIOCGIWAP: %pM", bssid);
2256 else
2257 devdbg(usbdev, "SIOCGIWAP: <not associated>");
2258
2259 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
2260 memcpy(wrqu->ap_addr.sa_data, bssid, ETH_ALEN);
2261
2262 return ret;
2263}
2264
2265
2266static int rndis_iw_set_bssid(struct net_device *dev,
2267 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2268{
2269 struct usbnet *usbdev = netdev_priv(dev);
2270 u8 *bssid = (u8 *)wrqu->ap_addr.sa_data;
2271 int ret;
2272
2273 devdbg(usbdev, "SIOCSIWAP: %pM", bssid);
2274
2275 ret = rndis_set_oid(usbdev, OID_802_11_BSSID, bssid, ETH_ALEN);
2276
2277 /* user apps may set ap's mac address, which is not required;
2278 * they may fail to work if this function fails, so return
2279 * success */
2280 if (ret)
2281 devwarn(usbdev, "setting AP mac address failed (%08X)", ret);
2282
2283 return 0;
2284}
2285
2286
2287static int rndis_iw_set_auth(struct net_device *dev,
2288 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2289{
2290 struct iw_param *p = &wrqu->param;
2291 struct usbnet *usbdev = netdev_priv(dev);
2292 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
2293 int ret = -ENOTSUPP;
2294
2295 switch (p->flags & IW_AUTH_INDEX) {
2296 case IW_AUTH_WPA_VERSION:
2297 devdbg(usbdev, "SIOCSIWAUTH: WPA_VERSION, %08x", p->value);
2298 priv->wpa_version = p->value;
2299 ret = 0;
2300 break;
2301
2302 case IW_AUTH_CIPHER_PAIRWISE:
2303 devdbg(usbdev, "SIOCSIWAUTH: CIPHER_PAIRWISE, %08x", p->value);
2304 priv->wpa_cipher_pair = p->value;
2305 ret = 0;
2306 break;
2307
2308 case IW_AUTH_CIPHER_GROUP:
2309 devdbg(usbdev, "SIOCSIWAUTH: CIPHER_GROUP, %08x", p->value);
2310 priv->wpa_cipher_group = p->value;
2311 ret = 0;
2312 break;
2313
2314 case IW_AUTH_KEY_MGMT:
2315 devdbg(usbdev, "SIOCSIWAUTH: KEY_MGMT, %08x", p->value);
2316 priv->wpa_keymgmt = p->value;
2317 ret = 0;
2318 break;
2319
2320 case IW_AUTH_TKIP_COUNTERMEASURES:
2321 devdbg(usbdev, "SIOCSIWAUTH: TKIP_COUNTERMEASURES, %08x",
2322 p->value);
2323 ret = 0;
2324 break;
2325
2326 case IW_AUTH_DROP_UNENCRYPTED:
2327 devdbg(usbdev, "SIOCSIWAUTH: DROP_UNENCRYPTED, %08x", p->value);
2328 ret = 0;
2329 break;
2330
2331 case IW_AUTH_80211_AUTH_ALG:
2332 devdbg(usbdev, "SIOCSIWAUTH: 80211_AUTH_ALG, %08x", p->value);
2333 priv->wpa_authalg = p->value;
2334 ret = 0;
2335 break;
2336
2337 case IW_AUTH_WPA_ENABLED:
2338 devdbg(usbdev, "SIOCSIWAUTH: WPA_ENABLED, %08x", p->value);
2339 if (wrqu->param.value)
2340 deauthenticate(usbdev);
2341 ret = 0;
2342 break;
2343
2344 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
2345 devdbg(usbdev, "SIOCSIWAUTH: RX_UNENCRYPTED_EAPOL, %08x",
2346 p->value);
2347 ret = 0;
2348 break;
2349
2350 case IW_AUTH_ROAMING_CONTROL:
2351 devdbg(usbdev, "SIOCSIWAUTH: ROAMING_CONTROL, %08x", p->value);
2352 ret = 0;
2353 break;
2354
2355 case IW_AUTH_PRIVACY_INVOKED:
2356 devdbg(usbdev, "SIOCSIWAUTH: invalid cmd %d",
2357 wrqu->param.flags & IW_AUTH_INDEX);
2358 return -EOPNOTSUPP;
2359
2360 default:
2361 devdbg(usbdev, "SIOCSIWAUTH: UNKNOWN %08x, %08x",
2362 p->flags & IW_AUTH_INDEX, p->value);
2363 }
2364 return ret;
2365}
2366
2367
2368static int rndis_iw_get_auth(struct net_device *dev,
2369 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2370{
2371 struct iw_param *p = &wrqu->param;
2372 struct usbnet *usbdev = netdev_priv(dev);
2373 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
2374
2375 switch (p->flags & IW_AUTH_INDEX) {
2376 case IW_AUTH_WPA_VERSION:
2377 p->value = priv->wpa_version;
2378 break;
2379 case IW_AUTH_CIPHER_PAIRWISE:
2380 p->value = priv->wpa_cipher_pair;
2381 break;
2382 case IW_AUTH_CIPHER_GROUP:
2383 p->value = priv->wpa_cipher_group;
2384 break;
2385 case IW_AUTH_KEY_MGMT:
2386 p->value = priv->wpa_keymgmt;
2387 break;
2388 case IW_AUTH_80211_AUTH_ALG:
2389 p->value = priv->wpa_authalg;
2390 break;
2391 default:
2392 devdbg(usbdev, "SIOCGIWAUTH: invalid cmd %d",
2393 wrqu->param.flags & IW_AUTH_INDEX);
2394 return -EOPNOTSUPP;
2395 }
2396 return 0;
2397}
2398
2399
2400static int rndis_iw_set_encode(struct net_device *dev,
2401 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2402{
2403 struct usbnet *usbdev = netdev_priv(dev);
2404 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
2405 struct rndis_wlan_encr_key key;
2406 int ret, index, key_len;
2407 u8 *keybuf;
2408
2409 index = (wrqu->encoding.flags & IW_ENCODE_INDEX);
2410
2411 /* iwconfig gives index as 1 - N */
2412 if (index > 0)
2413 index--;
2414 else
2415 index = priv->encr_tx_key_index;
2416
2417 if (index < 0 || index >= 4) {
2418 devwarn(usbdev, "encryption index out of range (%u)", index);
2419 return -EINVAL;
2420 }
2421
2422 /* remove key if disabled */
2423 if (wrqu->data.flags & IW_ENCODE_DISABLED) {
2424 if (remove_key(usbdev, index, NULL))
2425 return -EINVAL;
2426 else
2427 return 0;
2428 }
2429
2430 /* global encryption state (for all keys) */
2431 if (wrqu->data.flags & IW_ENCODE_OPEN)
2432 ret = set_auth_mode(usbdev, 0, NL80211_AUTHTYPE_OPEN_SYSTEM,
2433 RNDIS_WLAN_KEY_MGMT_NONE);
2434 else /*if (wrqu->data.flags & IW_ENCODE_RESTRICTED)*/
2435 ret = set_auth_mode(usbdev, 0, NL80211_AUTHTYPE_SHARED_KEY,
2436 RNDIS_WLAN_KEY_MGMT_NONE);
2437 if (ret != 0)
2438 return ret;
2439
2440 if (wrqu->data.length > 0) {
2441 key_len = wrqu->data.length;
2442 keybuf = extra;
2443 } else {
2444 /* must be set as tx key */
2445 if (priv->encr_keys[index].len == 0)
2446 return -EINVAL;
2447 key = priv->encr_keys[index];
2448 key_len = key.len;
2449 keybuf = key.material;
2450 priv->encr_tx_key_index = index;
2451 }
2452
2453 if (add_wep_key(usbdev, keybuf, key_len, index) != 0)
2454 return -EINVAL;
2455
2456 if (index == priv->encr_tx_key_index)
2457 /* ndis drivers want essid to be set after setting encr */
2458 set_essid(usbdev, &priv->essid);
2459
2460 return 0;
2461}
2462
2463
2464static int rndis_iw_set_encode_ext(struct net_device *dev,
2465 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2466{
2467 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
2468 struct usbnet *usbdev = netdev_priv(dev);
2469 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
2470 int keyidx, flags, cipher;
2471
2472 keyidx = wrqu->encoding.flags & IW_ENCODE_INDEX;
2473
2474 /* iwconfig gives index as 1 - N */
2475 if (keyidx)
2476 keyidx--;
2477 else
2478 keyidx = priv->encr_tx_key_index;
2479
2480 if (keyidx < 0 || keyidx >= 4) {
2481 devwarn(usbdev, "encryption index out of range (%u)", keyidx);
2482 return -EINVAL;
2483 }
2484
2485 if (ext->alg == IW_ENCODE_ALG_WEP) {
2486 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
2487 priv->encr_tx_key_index = keyidx;
2488 return add_wep_key(usbdev, ext->key, ext->key_len, keyidx);
2489 }
2490
2491 cipher = -1;
2492 if (ext->alg == IW_ENCODE_ALG_TKIP)
2493 cipher = WLAN_CIPHER_SUITE_TKIP;
2494 else if (ext->alg == IW_ENCODE_ALG_CCMP)
2495 cipher = WLAN_CIPHER_SUITE_CCMP;
2496
2497 if ((wrqu->encoding.flags & IW_ENCODE_DISABLED) ||
2498 ext->alg == IW_ENCODE_ALG_NONE || ext->key_len == 0)
2499 return remove_key(usbdev, keyidx, NULL);
2500
2501 if (cipher == -1)
2502 return -EOPNOTSUPP;
2503
2504 flags = 0;
2505 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID)
2506 flags |= NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ;
2507 if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY))
2508 flags |= NDIS_80211_ADDKEY_PAIRWISE_KEY;
2509 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
2510 flags |= NDIS_80211_ADDKEY_TRANSMIT_KEY;
2511
2512 return add_wpa_key(usbdev, ext->key, ext->key_len, keyidx,
2513 (u8 *)&ext->addr.sa_data, ext->rx_seq, cipher,
2514 flags);
2515}
2516
2517
2518static int rndis_iw_get_rate(struct net_device *dev,
2519 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2520{
2521 struct usbnet *usbdev = netdev_priv(dev);
2522 __le32 tmp;
2523 int ret, len;
2524
2525 len = sizeof(tmp);
2526 ret = rndis_query_oid(usbdev, OID_GEN_LINK_SPEED, &tmp, &len);
2527 if (ret == 0) {
2528 wrqu->bitrate.value = le32_to_cpu(tmp) * 100;
2529 wrqu->bitrate.disabled = 0;
2530 wrqu->bitrate.flags = 1;
2531 }
2532 return ret;
2533}
2534
2535
2536static struct iw_statistics *rndis_get_wireless_stats(struct net_device *dev)
2537{
2538 struct usbnet *usbdev = netdev_priv(dev);
2539 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
2540 unsigned long flags;
2541
2542 spin_lock_irqsave(&priv->stats_lock, flags);
2543 memcpy(&priv->iwstats, &priv->privstats, sizeof(priv->iwstats));
2544 spin_unlock_irqrestore(&priv->stats_lock, flags);
2545
2546 return &priv->iwstats;
2547}
2548#endif
2549
2550
2551#define IW_IOCTL(x) [(x) - SIOCSIWCOMMIT]
2552static const iw_handler rndis_iw_handler[] =
2553{
2554 IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname,
2555 IW_IOCTL(SIOCSIWFREQ) = (iw_handler) cfg80211_wext_siwfreq,
2556 IW_IOCTL(SIOCGIWFREQ) = (iw_handler) cfg80211_wext_giwfreq,
2557 IW_IOCTL(SIOCSIWMODE) = (iw_handler) cfg80211_wext_siwmode,
2558 IW_IOCTL(SIOCGIWMODE) = (iw_handler) cfg80211_wext_giwmode,
2559 IW_IOCTL(SIOCGIWRANGE) = (iw_handler) cfg80211_wext_giwrange,
2560 IW_IOCTL(SIOCSIWAP) = (iw_handler) cfg80211_wext_siwap,
2561 IW_IOCTL(SIOCGIWAP) = (iw_handler) cfg80211_wext_giwap,
2562 IW_IOCTL(SIOCSIWSCAN) = (iw_handler) cfg80211_wext_siwscan,
2563 IW_IOCTL(SIOCGIWSCAN) = (iw_handler) cfg80211_wext_giwscan,
2564 IW_IOCTL(SIOCSIWESSID) = (iw_handler) cfg80211_wext_siwessid,
2565 IW_IOCTL(SIOCGIWESSID) = (iw_handler) cfg80211_wext_giwessid,
2566 IW_IOCTL(SIOCGIWRATE) = (iw_handler) cfg80211_wext_giwrate,
2567 IW_IOCTL(SIOCSIWRTS) = (iw_handler) cfg80211_wext_siwrts,
2568 IW_IOCTL(SIOCGIWRTS) = (iw_handler) cfg80211_wext_giwrts,
2569 IW_IOCTL(SIOCSIWFRAG) = (iw_handler) cfg80211_wext_siwfrag,
2570 IW_IOCTL(SIOCGIWFRAG) = (iw_handler) cfg80211_wext_giwfrag,
2571 IW_IOCTL(SIOCSIWTXPOW) = (iw_handler) cfg80211_wext_siwtxpower,
2572 IW_IOCTL(SIOCGIWTXPOW) = (iw_handler) cfg80211_wext_giwtxpower,
2573 IW_IOCTL(SIOCSIWENCODE) = (iw_handler) cfg80211_wext_siwencode,
2574 IW_IOCTL(SIOCSIWENCODEEXT) = (iw_handler) cfg80211_wext_siwencodeext,
2575 IW_IOCTL(SIOCSIWAUTH) = (iw_handler) cfg80211_wext_siwauth,
2576 IW_IOCTL(SIOCGIWAUTH) = (iw_handler) cfg80211_wext_giwauth,
2577 IW_IOCTL(SIOCSIWGENIE) = (iw_handler) cfg80211_wext_siwgenie,
2578 IW_IOCTL(SIOCSIWMLME) = (iw_handler) cfg80211_wext_siwmlme,
2579};
2580
2581static const iw_handler rndis_wlan_private_handler[] = {
2582};
2583
2584static const struct iw_priv_args rndis_wlan_private_args[] = {
2585};
2586
2587
2588static const struct iw_handler_def rndis_iw_handlers = {
2589 .num_standard = ARRAY_SIZE(rndis_iw_handler),
2590 .num_private = ARRAY_SIZE(rndis_wlan_private_handler),
2591 .num_private_args = ARRAY_SIZE(rndis_wlan_private_args),
2592 .standard = (iw_handler *)rndis_iw_handler,
2593 .private = (iw_handler *)rndis_wlan_private_handler,
2594 .private_args = (struct iw_priv_args *)rndis_wlan_private_args,
2595 .get_wireless_stats = cfg80211_wireless_stats,
2596};
2597
2598 2178
2599static void rndis_wlan_do_link_up_work(struct usbnet *usbdev) 2179static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
2600{ 2180{
@@ -3166,7 +2746,6 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
3166 * Otherwise we'll be in big trouble in rndis_wlan_early_init(). 2746 * Otherwise we'll be in big trouble in rndis_wlan_early_init().
3167 */ 2747 */
3168 usbdev->driver_priv = priv; 2748 usbdev->driver_priv = priv;
3169 usbdev->net->wireless_handlers = &rndis_iw_handlers;
3170 priv->usbdev = usbdev; 2749 priv->usbdev = usbdev;
3171 2750
3172 mutex_init(&priv->command_lock); 2751 mutex_init(&priv->command_lock);