diff options
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r-- | net/wireless/wext-compat.c | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 4e054ea9c0a0..3279e7f038dc 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -314,3 +314,154 @@ struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, | |||
314 | 314 | ||
315 | } | 315 | } |
316 | EXPORT_SYMBOL(cfg80211_wext_freq); | 316 | EXPORT_SYMBOL(cfg80211_wext_freq); |
317 | |||
318 | int cfg80211_wext_siwrts(struct net_device *dev, | ||
319 | struct iw_request_info *info, | ||
320 | struct iw_param *rts, char *extra) | ||
321 | { | ||
322 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
323 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | ||
324 | u32 orts = wdev->wiphy->rts_threshold; | ||
325 | int err; | ||
326 | |||
327 | if (rts->disabled || !rts->fixed) | ||
328 | wdev->wiphy->rts_threshold = (u32) -1; | ||
329 | else if (rts->value < 0) | ||
330 | return -EINVAL; | ||
331 | else | ||
332 | wdev->wiphy->rts_threshold = rts->value; | ||
333 | |||
334 | err = rdev->ops->set_wiphy_params(wdev->wiphy, | ||
335 | WIPHY_PARAM_RTS_THRESHOLD); | ||
336 | if (err) | ||
337 | wdev->wiphy->rts_threshold = orts; | ||
338 | |||
339 | return err; | ||
340 | } | ||
341 | EXPORT_SYMBOL(cfg80211_wext_siwrts); | ||
342 | |||
343 | int cfg80211_wext_giwrts(struct net_device *dev, | ||
344 | struct iw_request_info *info, | ||
345 | struct iw_param *rts, char *extra) | ||
346 | { | ||
347 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
348 | |||
349 | rts->value = wdev->wiphy->rts_threshold; | ||
350 | rts->disabled = rts->value == (u32) -1; | ||
351 | rts->fixed = 1; | ||
352 | |||
353 | return 0; | ||
354 | } | ||
355 | EXPORT_SYMBOL(cfg80211_wext_giwrts); | ||
356 | |||
357 | int cfg80211_wext_siwfrag(struct net_device *dev, | ||
358 | struct iw_request_info *info, | ||
359 | struct iw_param *frag, char *extra) | ||
360 | { | ||
361 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
362 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | ||
363 | u32 ofrag = wdev->wiphy->frag_threshold; | ||
364 | int err; | ||
365 | |||
366 | if (frag->disabled || !frag->fixed) | ||
367 | wdev->wiphy->frag_threshold = (u32) -1; | ||
368 | else if (frag->value < 256) | ||
369 | return -EINVAL; | ||
370 | else { | ||
371 | /* Fragment length must be even, so strip LSB. */ | ||
372 | wdev->wiphy->frag_threshold = frag->value & ~0x1; | ||
373 | } | ||
374 | |||
375 | err = rdev->ops->set_wiphy_params(wdev->wiphy, | ||
376 | WIPHY_PARAM_FRAG_THRESHOLD); | ||
377 | if (err) | ||
378 | wdev->wiphy->frag_threshold = ofrag; | ||
379 | |||
380 | return err; | ||
381 | } | ||
382 | EXPORT_SYMBOL(cfg80211_wext_siwfrag); | ||
383 | |||
384 | int cfg80211_wext_giwfrag(struct net_device *dev, | ||
385 | struct iw_request_info *info, | ||
386 | struct iw_param *frag, char *extra) | ||
387 | { | ||
388 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
389 | |||
390 | frag->value = wdev->wiphy->frag_threshold; | ||
391 | frag->disabled = frag->value == (u32) -1; | ||
392 | frag->fixed = 1; | ||
393 | |||
394 | return 0; | ||
395 | } | ||
396 | EXPORT_SYMBOL(cfg80211_wext_giwfrag); | ||
397 | |||
398 | int cfg80211_wext_siwretry(struct net_device *dev, | ||
399 | struct iw_request_info *info, | ||
400 | struct iw_param *retry, char *extra) | ||
401 | { | ||
402 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
403 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | ||
404 | u32 changed = 0; | ||
405 | u8 olong = wdev->wiphy->retry_long; | ||
406 | u8 oshort = wdev->wiphy->retry_short; | ||
407 | int err; | ||
408 | |||
409 | if (retry->disabled || | ||
410 | (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) | ||
411 | return -EINVAL; | ||
412 | |||
413 | if (retry->flags & IW_RETRY_LONG) { | ||
414 | wdev->wiphy->retry_long = retry->value; | ||
415 | changed |= WIPHY_PARAM_RETRY_LONG; | ||
416 | } else if (retry->flags & IW_RETRY_SHORT) { | ||
417 | wdev->wiphy->retry_short = retry->value; | ||
418 | changed |= WIPHY_PARAM_RETRY_SHORT; | ||
419 | } else { | ||
420 | wdev->wiphy->retry_short = retry->value; | ||
421 | wdev->wiphy->retry_long = retry->value; | ||
422 | changed |= WIPHY_PARAM_RETRY_LONG; | ||
423 | changed |= WIPHY_PARAM_RETRY_SHORT; | ||
424 | } | ||
425 | |||
426 | if (!changed) | ||
427 | return 0; | ||
428 | |||
429 | err = rdev->ops->set_wiphy_params(wdev->wiphy, changed); | ||
430 | if (err) { | ||
431 | wdev->wiphy->retry_short = oshort; | ||
432 | wdev->wiphy->retry_long = olong; | ||
433 | } | ||
434 | |||
435 | return err; | ||
436 | } | ||
437 | EXPORT_SYMBOL(cfg80211_wext_siwretry); | ||
438 | |||
439 | int cfg80211_wext_giwretry(struct net_device *dev, | ||
440 | struct iw_request_info *info, | ||
441 | struct iw_param *retry, char *extra) | ||
442 | { | ||
443 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
444 | |||
445 | retry->disabled = 0; | ||
446 | |||
447 | if (retry->flags == 0 || (retry->flags & IW_RETRY_SHORT)) { | ||
448 | /* | ||
449 | * First return short value, iwconfig will ask long value | ||
450 | * later if needed | ||
451 | */ | ||
452 | retry->flags |= IW_RETRY_LIMIT; | ||
453 | retry->value = wdev->wiphy->retry_short; | ||
454 | if (wdev->wiphy->retry_long != wdev->wiphy->retry_short) | ||
455 | retry->flags |= IW_RETRY_LONG; | ||
456 | |||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | if (retry->flags & IW_RETRY_LONG) { | ||
461 | retry->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; | ||
462 | retry->value = wdev->wiphy->retry_long; | ||
463 | } | ||
464 | |||
465 | return 0; | ||
466 | } | ||
467 | EXPORT_SYMBOL(cfg80211_wext_giwretry); | ||