aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wext.c
diff options
context:
space:
mode:
authorJasper Bryant-Greene <jasper@amiton.co.nz>2008-08-02 20:04:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-22 16:29:58 -0400
commitf698d856f65c3fea091cc303a135967965c5b880 (patch)
tree94c7c2d561e5191646dc5798683c0aca97973773 /net/mac80211/wext.c
parentfef1643bf0cdd092a52dc3378479e4811fd65152 (diff)
replace net_device arguments with ieee80211_{local,sub_if_data} as appropriate
This patch replaces net_device arguments to mac80211 internal functions with ieee80211_{local,sub_if_data} as appropriate. It also does the same for many 802.11s mesh functions, and changes the mesh path table to be indexed on sub_if_data rather than net_device. If the mesh part needs to be a separate patch let me know, but since mesh uses a lot of mac80211 functions which were being converted anyway, the changes go hand-in-hand somewhat. This patch probably does not convert all the functions which could be converted, but it is a large chunk and followup patches will be provided. Signed-off-by: Jasper Bryant-Greene <jasper@amiton.co.nz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r--net/mac80211/wext.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 34fa8ed1e784..735daa355c37 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -27,22 +27,19 @@
27#include "aes_ccm.h" 27#include "aes_ccm.h"
28 28
29 29
30static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, 30static int ieee80211_set_encryption(struct ieee80211_sub_if_data *sdata, u8 *sta_addr,
31 int idx, int alg, int remove, 31 int idx, int alg, int remove,
32 int set_tx_key, const u8 *_key, 32 int set_tx_key, const u8 *_key,
33 size_t key_len) 33 size_t key_len)
34{ 34{
35 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 35 struct ieee80211_local *local = sdata->local;
36 struct sta_info *sta; 36 struct sta_info *sta;
37 struct ieee80211_key *key; 37 struct ieee80211_key *key;
38 struct ieee80211_sub_if_data *sdata;
39 int err; 38 int err;
40 39
41 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
42
43 if (idx < 0 || idx >= NUM_DEFAULT_KEYS) { 40 if (idx < 0 || idx >= NUM_DEFAULT_KEYS) {
44 printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n", 41 printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
45 dev->name, idx); 42 sdata->dev->name, idx);
46 return -EINVAL; 43 return -EINVAL;
47 } 44 }
48 45
@@ -127,11 +124,11 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
127 124
128 if (sdata->vif.type == IEEE80211_IF_TYPE_STA || 125 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
129 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 126 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
130 int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length); 127 int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length);
131 if (ret) 128 if (ret)
132 return ret; 129 return ret;
133 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; 130 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
134 ieee80211_sta_req_auth(dev, &sdata->u.sta); 131 ieee80211_sta_req_auth(sdata, &sdata->u.sta);
135 return 0; 132 return 0;
136 } 133 }
137 134
@@ -333,12 +330,11 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
333 return 0; 330 return 0;
334} 331}
335 332
336int ieee80211_set_freq(struct net_device *dev, int freqMHz) 333int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
337{ 334{
338 int ret = -EINVAL; 335 int ret = -EINVAL;
339 struct ieee80211_channel *chan; 336 struct ieee80211_channel *chan;
340 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 337 struct ieee80211_local *local = sdata->local;
341 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
342 338
343 chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); 339 chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
344 340
@@ -346,7 +342,7 @@ int ieee80211_set_freq(struct net_device *dev, int freqMHz)
346 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && 342 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
347 chan->flags & IEEE80211_CHAN_NO_IBSS) { 343 chan->flags & IEEE80211_CHAN_NO_IBSS) {
348 printk(KERN_DEBUG "%s: IBSS not allowed on frequency " 344 printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
349 "%d MHz\n", dev->name, chan->center_freq); 345 "%d MHz\n", sdata->dev->name, chan->center_freq);
350 return ret; 346 return ret;
351 } 347 }
352 local->oper_channel = chan; 348 local->oper_channel = chan;
@@ -379,14 +375,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
379 IEEE80211_STA_AUTO_CHANNEL_SEL; 375 IEEE80211_STA_AUTO_CHANNEL_SEL;
380 return 0; 376 return 0;
381 } else 377 } else
382 return ieee80211_set_freq(dev, 378 return ieee80211_set_freq(sdata,
383 ieee80211_channel_to_frequency(freq->m)); 379 ieee80211_channel_to_frequency(freq->m));
384 } else { 380 } else {
385 int i, div = 1000000; 381 int i, div = 1000000;
386 for (i = 0; i < freq->e; i++) 382 for (i = 0; i < freq->e; i++)
387 div /= 10; 383 div /= 10;
388 if (div > 0) 384 if (div > 0)
389 return ieee80211_set_freq(dev, freq->m / div); 385 return ieee80211_set_freq(sdata, freq->m / div);
390 else 386 else
391 return -EINVAL; 387 return -EINVAL;
392 } 388 }
@@ -432,10 +428,10 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
432 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; 428 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
433 else 429 else
434 sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL; 430 sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL;
435 ret = ieee80211_sta_set_ssid(dev, ssid, len); 431 ret = ieee80211_sta_set_ssid(sdata, ssid, len);
436 if (ret) 432 if (ret)
437 return ret; 433 return ret;
438 ieee80211_sta_req_auth(dev, &sdata->u.sta); 434 ieee80211_sta_req_auth(sdata, &sdata->u.sta);
439 return 0; 435 return 0;
440 } 436 }
441 437
@@ -460,7 +456,7 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
460 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 456 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
461 if (sdata->vif.type == IEEE80211_IF_TYPE_STA || 457 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
462 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 458 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
463 int res = ieee80211_sta_get_ssid(dev, ssid, &len); 459 int res = ieee80211_sta_get_ssid(sdata, ssid, &len);
464 if (res == 0) { 460 if (res == 0) {
465 data->length = len; 461 data->length = len;
466 data->flags = 1; 462 data->flags = 1;
@@ -504,10 +500,10 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
504 sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL; 500 sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL;
505 else 501 else
506 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; 502 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
507 ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data); 503 ret = ieee80211_sta_set_bssid(sdata, (u8 *) &ap_addr->sa_data);
508 if (ret) 504 if (ret)
509 return ret; 505 return ret;
510 ieee80211_sta_req_auth(dev, &sdata->u.sta); 506 ieee80211_sta_req_auth(sdata, &sdata->u.sta);
511 return 0; 507 return 0;
512 } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { 508 } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
513 /* 509 /*
@@ -584,7 +580,7 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
584 ssid_len = req->essid_len; 580 ssid_len = req->essid_len;
585 } 581 }
586 582
587 return ieee80211_sta_req_scan(dev, ssid, ssid_len); 583 return ieee80211_sta_req_scan(sdata, ssid, ssid_len);
588} 584}
589 585
590 586
@@ -594,11 +590,14 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev,
594{ 590{
595 int res; 591 int res;
596 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 592 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
593 struct ieee80211_sub_if_data *sdata;
594
595 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
597 596
598 if (local->sta_sw_scanning || local->sta_hw_scanning) 597 if (local->sta_sw_scanning || local->sta_hw_scanning)
599 return -EAGAIN; 598 return -EAGAIN;
600 599
601 res = ieee80211_sta_scan_results(dev, info, extra, data->length); 600 res = ieee80211_sta_scan_results(local, info, extra, data->length);
602 if (res >= 0) { 601 if (res >= 0) {
603 data->length = res; 602 data->length = res;
604 return 0; 603 return 0;
@@ -894,10 +893,10 @@ static int ieee80211_ioctl_siwmlme(struct net_device *dev,
894 switch (mlme->cmd) { 893 switch (mlme->cmd) {
895 case IW_MLME_DEAUTH: 894 case IW_MLME_DEAUTH:
896 /* TODO: mlme->addr.sa_data */ 895 /* TODO: mlme->addr.sa_data */
897 return ieee80211_sta_deauthenticate(dev, mlme->reason_code); 896 return ieee80211_sta_deauthenticate(sdata, mlme->reason_code);
898 case IW_MLME_DISASSOC: 897 case IW_MLME_DISASSOC:
899 /* TODO: mlme->addr.sa_data */ 898 /* TODO: mlme->addr.sa_data */
900 return ieee80211_sta_disassociate(dev, mlme->reason_code); 899 return ieee80211_sta_disassociate(sdata, mlme->reason_code);
901 default: 900 default:
902 return -EOPNOTSUPP; 901 return -EOPNOTSUPP;
903 } 902 }
@@ -938,7 +937,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
938 } 937 }
939 938
940 return ieee80211_set_encryption( 939 return ieee80211_set_encryption(
941 dev, bcaddr, 940 sdata, bcaddr,
942 idx, alg, remove, 941 idx, alg, remove,
943 !sdata->default_key, 942 !sdata->default_key,
944 keybuf, erq->length); 943 keybuf, erq->length);
@@ -1184,7 +1183,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1184 } else 1183 } else
1185 idx--; 1184 idx--;
1186 1185
1187 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg, 1186 return ieee80211_set_encryption(sdata, ext->addr.sa_data, idx, alg,
1188 remove, 1187 remove,
1189 ext->ext_flags & 1188 ext->ext_flags &
1190 IW_ENCODE_EXT_SET_TX_KEY, 1189 IW_ENCODE_EXT_SET_TX_KEY,