diff options
108 files changed, 5312 insertions, 3467 deletions
diff --git a/Documentation/DocBook/mac80211.tmpl b/Documentation/DocBook/mac80211.tmpl index b651e0a4b1c0..77c3c202991b 100644 --- a/Documentation/DocBook/mac80211.tmpl +++ b/Documentation/DocBook/mac80211.tmpl | |||
@@ -145,7 +145,6 @@ usage should require reading the full document. | |||
145 | this though and the recommendation to allow only a single | 145 | this though and the recommendation to allow only a single |
146 | interface in STA mode at first! | 146 | interface in STA mode at first! |
147 | </para> | 147 | </para> |
148 | !Finclude/net/mac80211.h ieee80211_if_types | ||
149 | !Finclude/net/mac80211.h ieee80211_if_init_conf | 148 | !Finclude/net/mac80211.h ieee80211_if_init_conf |
150 | !Finclude/net/mac80211.h ieee80211_if_conf | 149 | !Finclude/net/mac80211.h ieee80211_if_conf |
151 | </chapter> | 150 | </chapter> |
@@ -177,8 +176,7 @@ usage should require reading the full document. | |||
177 | <title>functions/definitions</title> | 176 | <title>functions/definitions</title> |
178 | !Finclude/net/mac80211.h ieee80211_rx_status | 177 | !Finclude/net/mac80211.h ieee80211_rx_status |
179 | !Finclude/net/mac80211.h mac80211_rx_flags | 178 | !Finclude/net/mac80211.h mac80211_rx_flags |
180 | !Finclude/net/mac80211.h ieee80211_tx_control | 179 | !Finclude/net/mac80211.h ieee80211_tx_info |
181 | !Finclude/net/mac80211.h ieee80211_tx_status_flags | ||
182 | !Finclude/net/mac80211.h ieee80211_rx | 180 | !Finclude/net/mac80211.h ieee80211_rx |
183 | !Finclude/net/mac80211.h ieee80211_rx_irqsafe | 181 | !Finclude/net/mac80211.h ieee80211_rx_irqsafe |
184 | !Finclude/net/mac80211.h ieee80211_tx_status | 182 | !Finclude/net/mac80211.h ieee80211_tx_status |
@@ -189,12 +187,11 @@ usage should require reading the full document. | |||
189 | !Finclude/net/mac80211.h ieee80211_ctstoself_duration | 187 | !Finclude/net/mac80211.h ieee80211_ctstoself_duration |
190 | !Finclude/net/mac80211.h ieee80211_generic_frame_duration | 188 | !Finclude/net/mac80211.h ieee80211_generic_frame_duration |
191 | !Finclude/net/mac80211.h ieee80211_get_hdrlen_from_skb | 189 | !Finclude/net/mac80211.h ieee80211_get_hdrlen_from_skb |
192 | !Finclude/net/mac80211.h ieee80211_get_hdrlen | 190 | !Finclude/net/mac80211.h ieee80211_hdrlen |
193 | !Finclude/net/mac80211.h ieee80211_wake_queue | 191 | !Finclude/net/mac80211.h ieee80211_wake_queue |
194 | !Finclude/net/mac80211.h ieee80211_stop_queue | 192 | !Finclude/net/mac80211.h ieee80211_stop_queue |
195 | !Finclude/net/mac80211.h ieee80211_start_queues | ||
196 | !Finclude/net/mac80211.h ieee80211_stop_queues | ||
197 | !Finclude/net/mac80211.h ieee80211_wake_queues | 193 | !Finclude/net/mac80211.h ieee80211_wake_queues |
194 | !Finclude/net/mac80211.h ieee80211_stop_queues | ||
198 | </sect1> | 195 | </sect1> |
199 | </chapter> | 196 | </chapter> |
200 | 197 | ||
@@ -230,8 +227,7 @@ usage should require reading the full document. | |||
230 | <title>Multiple queues and QoS support</title> | 227 | <title>Multiple queues and QoS support</title> |
231 | <para>TBD</para> | 228 | <para>TBD</para> |
232 | !Finclude/net/mac80211.h ieee80211_tx_queue_params | 229 | !Finclude/net/mac80211.h ieee80211_tx_queue_params |
233 | !Finclude/net/mac80211.h ieee80211_tx_queue_stats_data | 230 | !Finclude/net/mac80211.h ieee80211_tx_queue_stats |
234 | !Finclude/net/mac80211.h ieee80211_tx_queue | ||
235 | </chapter> | 231 | </chapter> |
236 | 232 | ||
237 | <chapter id="AP"> | 233 | <chapter id="AP"> |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index eb1a47b97427..c93fcdec246d 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -6,6 +6,24 @@ be removed from this file. | |||
6 | 6 | ||
7 | --------------------------- | 7 | --------------------------- |
8 | 8 | ||
9 | What: old static regulatory information and ieee80211_regdom module parameter | ||
10 | When: 2.6.29 | ||
11 | Why: The old regulatory infrastructure has been replaced with a new one | ||
12 | which does not require statically defined regulatory domains. We do | ||
13 | not want to keep static regulatory domains in the kernel due to the | ||
14 | the dynamic nature of regulatory law and localization. We kept around | ||
15 | the old static definitions for the regulatory domains of: | ||
16 | * US | ||
17 | * JP | ||
18 | * EU | ||
19 | and used by default the US when CONFIG_WIRELESS_OLD_REGULATORY was | ||
20 | set. We also kept around the ieee80211_regdom module parameter in case | ||
21 | some applications were relying on it. Changing regulatory domains | ||
22 | can now be done instead by using nl80211, as is done with iw. | ||
23 | Who: Luis R. Rodriguez <lrodriguez@atheros.com> | ||
24 | |||
25 | --------------------------- | ||
26 | |||
9 | What: dev->power.power_state | 27 | What: dev->power.power_state |
10 | When: July 2007 | 28 | When: July 2007 |
11 | Why: Broken design for runtime control over driver power states, confusing | 29 | Why: Broken design for runtime control over driver power states, confusing |
diff --git a/Documentation/networking/regulatory.txt b/Documentation/networking/regulatory.txt new file mode 100644 index 000000000000..a96989a8ff35 --- /dev/null +++ b/Documentation/networking/regulatory.txt | |||
@@ -0,0 +1,194 @@ | |||
1 | Linux wireless regulatory documentation | ||
2 | --------------------------------------- | ||
3 | |||
4 | This document gives a brief review over how the Linux wireless | ||
5 | regulatory infrastructure works. | ||
6 | |||
7 | More up to date information can be obtained at the project's web page: | ||
8 | |||
9 | http://wireless.kernel.org/en/developers/Regulatory | ||
10 | |||
11 | Keeping regulatory domains in userspace | ||
12 | --------------------------------------- | ||
13 | |||
14 | Due to the dynamic nature of regulatory domains we keep them | ||
15 | in userspace and provide a framework for userspace to upload | ||
16 | to the kernel one regulatory domain to be used as the central | ||
17 | core regulatory domain all wireless devices should adhere to. | ||
18 | |||
19 | How to get regulatory domains to the kernel | ||
20 | ------------------------------------------- | ||
21 | |||
22 | Userspace gets a regulatory domain in the kernel by having | ||
23 | a userspace agent build it and send it via nl80211. Only | ||
24 | expected regulatory domains will be respected by the kernel. | ||
25 | |||
26 | A currently available userspace agent which can accomplish this | ||
27 | is CRDA - central regulatory domain agent. Its documented here: | ||
28 | |||
29 | http://wireless.kernel.org/en/developers/Regulatory/CRDA | ||
30 | |||
31 | Essentially the kernel will send a udev event when it knows | ||
32 | it needs a new regulatory domain. A udev rule can be put in place | ||
33 | to trigger crda to send the respective regulatory domain for a | ||
34 | specific ISO/IEC 3166 alpha2. | ||
35 | |||
36 | Below is an example udev rule which can be used: | ||
37 | |||
38 | # Example file, should be put in /etc/udev/rules.d/regulatory.rules | ||
39 | KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/sbin/crda" | ||
40 | |||
41 | The alpha2 is passed as an environment variable under the variable COUNTRY. | ||
42 | |||
43 | Who asks for regulatory domains? | ||
44 | -------------------------------- | ||
45 | |||
46 | * Users | ||
47 | |||
48 | Users can use iw: | ||
49 | |||
50 | http://wireless.kernel.org/en/users/Documentation/iw | ||
51 | |||
52 | An example: | ||
53 | |||
54 | # set regulatory domain to "Costa Rica" | ||
55 | iw reg set CR | ||
56 | |||
57 | This will request the kernel to set the regulatory domain to | ||
58 | the specificied alpha2. The kernel in turn will then ask userspace | ||
59 | to provide a regulatory domain for the alpha2 specified by the user | ||
60 | by sending a uevent. | ||
61 | |||
62 | * Wireless subsystems for Country Information elements | ||
63 | |||
64 | The kernel will send a uevent to inform userspace a new | ||
65 | regulatory domain is required. More on this to be added | ||
66 | as its integration is added. | ||
67 | |||
68 | * Drivers | ||
69 | |||
70 | If drivers determine they need a specific regulatory domain | ||
71 | set they can inform the wireless core using regulatory_hint(). | ||
72 | They have two options -- they either provide an alpha2 so that | ||
73 | crda can provide back a regulatory domain for that country or | ||
74 | they can build their own regulatory domain based on internal | ||
75 | custom knowledge so the wireless core can respect it. | ||
76 | |||
77 | *Most* drivers will rely on the first mechanism of providing a | ||
78 | regulatory hint with an alpha2. For these drivers there is an additional | ||
79 | check that can be used to ensure compliance based on custom EEPROM | ||
80 | regulatory data. This additional check can be used by drivers by | ||
81 | registering on its struct wiphy a reg_notifier() callback. This notifier | ||
82 | is called when the core's regulatory domain has been changed. The driver | ||
83 | can use this to review the changes made and also review who made them | ||
84 | (driver, user, country IE) and determine what to allow based on its | ||
85 | internal EEPROM data. Devices drivers wishing to be capable of world | ||
86 | roaming should use this callback. More on world roaming will be | ||
87 | added to this document when its support is enabled. | ||
88 | |||
89 | Device drivers who provide their own built regulatory domain | ||
90 | do not need a callback as the channels registered by them are | ||
91 | the only ones that will be allowed and therefore *additional* | ||
92 | cannels cannot be enabled. | ||
93 | |||
94 | Example code - drivers hinting an alpha2: | ||
95 | ------------------------------------------ | ||
96 | |||
97 | This example comes from the zd1211rw device driver. You can start | ||
98 | by having a mapping of your device's EEPROM country/regulatory | ||
99 | domain value to to a specific alpha2 as follows: | ||
100 | |||
101 | static struct zd_reg_alpha2_map reg_alpha2_map[] = { | ||
102 | { ZD_REGDOMAIN_FCC, "US" }, | ||
103 | { ZD_REGDOMAIN_IC, "CA" }, | ||
104 | { ZD_REGDOMAIN_ETSI, "DE" }, /* Generic ETSI, use most restrictive */ | ||
105 | { ZD_REGDOMAIN_JAPAN, "JP" }, | ||
106 | { ZD_REGDOMAIN_JAPAN_ADD, "JP" }, | ||
107 | { ZD_REGDOMAIN_SPAIN, "ES" }, | ||
108 | { ZD_REGDOMAIN_FRANCE, "FR" }, | ||
109 | |||
110 | Then you can define a routine to map your read EEPROM value to an alpha2, | ||
111 | as follows: | ||
112 | |||
113 | static int zd_reg2alpha2(u8 regdomain, char *alpha2) | ||
114 | { | ||
115 | unsigned int i; | ||
116 | struct zd_reg_alpha2_map *reg_map; | ||
117 | for (i = 0; i < ARRAY_SIZE(reg_alpha2_map); i++) { | ||
118 | reg_map = ®_alpha2_map[i]; | ||
119 | if (regdomain == reg_map->reg) { | ||
120 | alpha2[0] = reg_map->alpha2[0]; | ||
121 | alpha2[1] = reg_map->alpha2[1]; | ||
122 | return 0; | ||
123 | } | ||
124 | } | ||
125 | return 1; | ||
126 | } | ||
127 | |||
128 | Lastly, you can then hint to the core of your discovered alpha2, if a match | ||
129 | was found. You need to do this after you have registered your wiphy. You | ||
130 | are expected to do this during initialization. | ||
131 | |||
132 | r = zd_reg2alpha2(mac->regdomain, alpha2); | ||
133 | if (!r) | ||
134 | regulatory_hint(hw->wiphy, alpha2, NULL); | ||
135 | |||
136 | Example code - drivers providing a built in regulatory domain: | ||
137 | -------------------------------------------------------------- | ||
138 | |||
139 | If you have regulatory information you can obtain from your | ||
140 | driver and you *need* to use this we let you build a regulatory domain | ||
141 | structure and pass it to the wireless core. To do this you should | ||
142 | kmalloc() a structure big enough to hold your regulatory domain | ||
143 | structure and you should then fill it with your data. Finally you simply | ||
144 | call regulatory_hint() with the regulatory domain structure in it. | ||
145 | |||
146 | Bellow is a simple example, with a regulatory domain cached using the stack. | ||
147 | Your implementation may vary (read EEPROM cache instead, for example). | ||
148 | |||
149 | Example cache of some regulatory domain | ||
150 | |||
151 | struct ieee80211_regdomain mydriver_jp_regdom = { | ||
152 | .n_reg_rules = 3, | ||
153 | .alpha2 = "JP", | ||
154 | //.alpha2 = "99", /* If I have no alpha2 to map it to */ | ||
155 | .reg_rules = { | ||
156 | /* IEEE 802.11b/g, channels 1..14 */ | ||
157 | REG_RULE(2412-20, 2484+20, 40, 6, 20, 0), | ||
158 | /* IEEE 802.11a, channels 34..48 */ | ||
159 | REG_RULE(5170-20, 5240+20, 40, 6, 20, | ||
160 | NL80211_RRF_PASSIVE_SCAN), | ||
161 | /* IEEE 802.11a, channels 52..64 */ | ||
162 | REG_RULE(5260-20, 5320+20, 40, 6, 20, | ||
163 | NL80211_RRF_NO_IBSS | | ||
164 | NL80211_RRF_DFS), | ||
165 | } | ||
166 | }; | ||
167 | |||
168 | Then in some part of your code after your wiphy has been registered: | ||
169 | |||
170 | int r; | ||
171 | struct ieee80211_regdomain *rd; | ||
172 | int size_of_regd; | ||
173 | int num_rules = mydriver_jp_regdom.n_reg_rules; | ||
174 | unsigned int i; | ||
175 | |||
176 | size_of_regd = sizeof(struct ieee80211_regdomain) + | ||
177 | (num_rules * sizeof(struct ieee80211_reg_rule)); | ||
178 | |||
179 | rd = kzalloc(size_of_regd, GFP_KERNEL); | ||
180 | if (!rd) | ||
181 | return -ENOMEM; | ||
182 | |||
183 | memcpy(rd, &mydriver_jp_regdom, sizeof(struct ieee80211_regdomain)); | ||
184 | |||
185 | for (i=0; i < num_rules; i++) { | ||
186 | memcpy(&rd->reg_rules[i], &mydriver_jp_regdom.reg_rules[i], | ||
187 | sizeof(struct ieee80211_reg_rule)); | ||
188 | } | ||
189 | r = regulatory_hint(hw->wiphy, NULL, rd); | ||
190 | if (r) { | ||
191 | kfree(rd); | ||
192 | return r; | ||
193 | } | ||
194 | |||
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt index 6fcb3060dec5..b65f0799df48 100644 --- a/Documentation/rfkill.txt +++ b/Documentation/rfkill.txt | |||
@@ -341,6 +341,8 @@ key that does nothing by itself, as well as any hot key that is type-specific | |||
341 | 3.1 Guidelines for wireless device drivers | 341 | 3.1 Guidelines for wireless device drivers |
342 | ------------------------------------------ | 342 | ------------------------------------------ |
343 | 343 | ||
344 | (in this text, rfkill->foo means the foo field of struct rfkill). | ||
345 | |||
344 | 1. Each independent transmitter in a wireless device (usually there is only one | 346 | 1. Each independent transmitter in a wireless device (usually there is only one |
345 | transmitter per device) should have a SINGLE rfkill class attached to it. | 347 | transmitter per device) should have a SINGLE rfkill class attached to it. |
346 | 348 | ||
@@ -363,10 +365,32 @@ This rule exists because users of the rfkill subsystem expect to get (and set, | |||
363 | when possible) the overall transmitter rfkill state, not of a particular rfkill | 365 | when possible) the overall transmitter rfkill state, not of a particular rfkill |
364 | line. | 366 | line. |
365 | 367 | ||
366 | 5. During suspend, the rfkill class will attempt to soft-block the radio | 368 | 5. The wireless device driver MUST NOT leave the transmitter enabled during |
367 | through a call to rfkill->toggle_radio, and will try to restore its previous | 369 | suspend and hibernation unless: |
368 | state during resume. After a rfkill class is suspended, it will *not* call | 370 | |
369 | rfkill->toggle_radio until it is resumed. | 371 | 5.1. The transmitter has to be enabled for some sort of functionality |
372 | like wake-on-wireless-packet or autonomous packed forwarding in a mesh | ||
373 | network, and that functionality is enabled for this suspend/hibernation | ||
374 | cycle. | ||
375 | |||
376 | AND | ||
377 | |||
378 | 5.2. The device was not on a user-requested BLOCKED state before | ||
379 | the suspend (i.e. the driver must NOT unblock a device, not even | ||
380 | to support wake-on-wireless-packet or remain in the mesh). | ||
381 | |||
382 | In other words, there is absolutely no allowed scenario where a driver can | ||
383 | automatically take action to unblock a rfkill controller (obviously, this deals | ||
384 | with scenarios where soft-blocking or both soft and hard blocking is happening. | ||
385 | Scenarios where hardware rfkill lines are the only ones blocking the | ||
386 | transmitter are outside of this rule, since the wireless device driver does not | ||
387 | control its input hardware rfkill lines in the first place). | ||
388 | |||
389 | 6. During resume, rfkill will try to restore its previous state. | ||
390 | |||
391 | 7. After a rfkill class is suspended, it will *not* call rfkill->toggle_radio | ||
392 | until it is resumed. | ||
393 | |||
370 | 394 | ||
371 | Example of a WLAN wireless driver connected to the rfkill subsystem: | 395 | Example of a WLAN wireless driver connected to the rfkill subsystem: |
372 | -------------------------------------------------------------------- | 396 | -------------------------------------------------------------------- |
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index c6a55cd12db9..b2c050b68890 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c | |||
@@ -765,11 +765,11 @@ static void adm8211_update_mode(struct ieee80211_hw *dev) | |||
765 | 765 | ||
766 | priv->soft_rx_crc = 0; | 766 | priv->soft_rx_crc = 0; |
767 | switch (priv->mode) { | 767 | switch (priv->mode) { |
768 | case IEEE80211_IF_TYPE_STA: | 768 | case NL80211_IFTYPE_STATION: |
769 | priv->nar &= ~(ADM8211_NAR_PR | ADM8211_NAR_EA); | 769 | priv->nar &= ~(ADM8211_NAR_PR | ADM8211_NAR_EA); |
770 | priv->nar |= ADM8211_NAR_ST | ADM8211_NAR_SR; | 770 | priv->nar |= ADM8211_NAR_ST | ADM8211_NAR_SR; |
771 | break; | 771 | break; |
772 | case IEEE80211_IF_TYPE_IBSS: | 772 | case NL80211_IFTYPE_ADHOC: |
773 | priv->nar &= ~ADM8211_NAR_PR; | 773 | priv->nar &= ~ADM8211_NAR_PR; |
774 | priv->nar |= ADM8211_NAR_EA | ADM8211_NAR_ST | ADM8211_NAR_SR; | 774 | priv->nar |= ADM8211_NAR_EA | ADM8211_NAR_ST | ADM8211_NAR_SR; |
775 | 775 | ||
@@ -777,7 +777,7 @@ static void adm8211_update_mode(struct ieee80211_hw *dev) | |||
777 | if (priv->pdev->revision >= ADM8211_REV_BA) | 777 | if (priv->pdev->revision >= ADM8211_REV_BA) |
778 | priv->soft_rx_crc = 1; | 778 | priv->soft_rx_crc = 1; |
779 | break; | 779 | break; |
780 | case IEEE80211_IF_TYPE_MNTR: | 780 | case NL80211_IFTYPE_MONITOR: |
781 | priv->nar &= ~(ADM8211_NAR_EA | ADM8211_NAR_ST); | 781 | priv->nar &= ~(ADM8211_NAR_EA | ADM8211_NAR_ST); |
782 | priv->nar |= ADM8211_NAR_PR | ADM8211_NAR_SR; | 782 | priv->nar |= ADM8211_NAR_PR | ADM8211_NAR_SR; |
783 | break; | 783 | break; |
@@ -1410,11 +1410,11 @@ static int adm8211_add_interface(struct ieee80211_hw *dev, | |||
1410 | struct ieee80211_if_init_conf *conf) | 1410 | struct ieee80211_if_init_conf *conf) |
1411 | { | 1411 | { |
1412 | struct adm8211_priv *priv = dev->priv; | 1412 | struct adm8211_priv *priv = dev->priv; |
1413 | if (priv->mode != IEEE80211_IF_TYPE_MNTR) | 1413 | if (priv->mode != NL80211_IFTYPE_MONITOR) |
1414 | return -EOPNOTSUPP; | 1414 | return -EOPNOTSUPP; |
1415 | 1415 | ||
1416 | switch (conf->type) { | 1416 | switch (conf->type) { |
1417 | case IEEE80211_IF_TYPE_STA: | 1417 | case NL80211_IFTYPE_STATION: |
1418 | priv->mode = conf->type; | 1418 | priv->mode = conf->type; |
1419 | break; | 1419 | break; |
1420 | default: | 1420 | default: |
@@ -1437,7 +1437,7 @@ static void adm8211_remove_interface(struct ieee80211_hw *dev, | |||
1437 | struct ieee80211_if_init_conf *conf) | 1437 | struct ieee80211_if_init_conf *conf) |
1438 | { | 1438 | { |
1439 | struct adm8211_priv *priv = dev->priv; | 1439 | struct adm8211_priv *priv = dev->priv; |
1440 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 1440 | priv->mode = NL80211_IFTYPE_MONITOR; |
1441 | } | 1441 | } |
1442 | 1442 | ||
1443 | static int adm8211_init_rings(struct ieee80211_hw *dev) | 1443 | static int adm8211_init_rings(struct ieee80211_hw *dev) |
@@ -1556,7 +1556,7 @@ static int adm8211_start(struct ieee80211_hw *dev) | |||
1556 | ADM8211_CSR_WRITE(IER, ADM8211_IER_NIE | ADM8211_IER_AIE | | 1556 | ADM8211_CSR_WRITE(IER, ADM8211_IER_NIE | ADM8211_IER_AIE | |
1557 | ADM8211_IER_RCIE | ADM8211_IER_TCIE | | 1557 | ADM8211_IER_RCIE | ADM8211_IER_TCIE | |
1558 | ADM8211_IER_TDUIE | ADM8211_IER_GPTIE); | 1558 | ADM8211_IER_TDUIE | ADM8211_IER_GPTIE); |
1559 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 1559 | priv->mode = NL80211_IFTYPE_MONITOR; |
1560 | adm8211_update_mode(dev); | 1560 | adm8211_update_mode(dev); |
1561 | ADM8211_CSR_WRITE(RDR, 0); | 1561 | ADM8211_CSR_WRITE(RDR, 0); |
1562 | 1562 | ||
@@ -1571,7 +1571,7 @@ static void adm8211_stop(struct ieee80211_hw *dev) | |||
1571 | { | 1571 | { |
1572 | struct adm8211_priv *priv = dev->priv; | 1572 | struct adm8211_priv *priv = dev->priv; |
1573 | 1573 | ||
1574 | priv->mode = IEEE80211_IF_TYPE_INVALID; | 1574 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; |
1575 | priv->nar = 0; | 1575 | priv->nar = 0; |
1576 | ADM8211_CSR_WRITE(NAR, 0); | 1576 | ADM8211_CSR_WRITE(NAR, 0); |
1577 | ADM8211_CSR_WRITE(IER, 0); | 1577 | ADM8211_CSR_WRITE(IER, 0); |
@@ -1896,7 +1896,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, | |||
1896 | priv->tx_power = 0x40; | 1896 | priv->tx_power = 0x40; |
1897 | priv->lpf_cutoff = 0xFF; | 1897 | priv->lpf_cutoff = 0xFF; |
1898 | priv->lnags_threshold = 0xFF; | 1898 | priv->lnags_threshold = 0xFF; |
1899 | priv->mode = IEEE80211_IF_TYPE_INVALID; | 1899 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; |
1900 | 1900 | ||
1901 | /* Power-on issue. EEPROM won't read correctly without */ | 1901 | /* Power-on issue. EEPROM won't read correctly without */ |
1902 | if (pdev->revision >= ADM8211_REV_BA) { | 1902 | if (pdev->revision >= ADM8211_REV_BA) { |
@@ -1986,7 +1986,7 @@ static int adm8211_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1986 | struct ieee80211_hw *dev = pci_get_drvdata(pdev); | 1986 | struct ieee80211_hw *dev = pci_get_drvdata(pdev); |
1987 | struct adm8211_priv *priv = dev->priv; | 1987 | struct adm8211_priv *priv = dev->priv; |
1988 | 1988 | ||
1989 | if (priv->mode != IEEE80211_IF_TYPE_INVALID) { | 1989 | if (priv->mode != NL80211_IFTYPE_UNSPECIFIED) { |
1990 | ieee80211_stop_queues(dev); | 1990 | ieee80211_stop_queues(dev); |
1991 | adm8211_stop(dev); | 1991 | adm8211_stop(dev); |
1992 | } | 1992 | } |
@@ -2004,7 +2004,7 @@ static int adm8211_resume(struct pci_dev *pdev) | |||
2004 | pci_set_power_state(pdev, PCI_D0); | 2004 | pci_set_power_state(pdev, PCI_D0); |
2005 | pci_restore_state(pdev); | 2005 | pci_restore_state(pdev); |
2006 | 2006 | ||
2007 | if (priv->mode != IEEE80211_IF_TYPE_INVALID) { | 2007 | if (priv->mode != NL80211_IFTYPE_UNSPECIFIED) { |
2008 | adm8211_start(dev); | 2008 | adm8211_start(dev); |
2009 | ieee80211_wake_queues(dev); | 2009 | ieee80211_wake_queues(dev); |
2010 | } | 2010 | } |
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h index 4c0211798a7a..20018869051d 100644 --- a/drivers/net/wireless/ath5k/ath5k.h +++ b/drivers/net/wireless/ath5k/ath5k.h | |||
@@ -1008,7 +1008,7 @@ struct ath5k_hw { | |||
1008 | 1008 | ||
1009 | enum ath5k_int ah_imr; | 1009 | enum ath5k_int ah_imr; |
1010 | 1010 | ||
1011 | enum ieee80211_if_types ah_op_mode; | 1011 | enum nl80211_iftype ah_op_mode; |
1012 | enum ath5k_power_mode ah_power_mode; | 1012 | enum ath5k_power_mode ah_power_mode; |
1013 | struct ieee80211_channel ah_current_channel; | 1013 | struct ieee80211_channel ah_current_channel; |
1014 | bool ah_turbo; | 1014 | bool ah_turbo; |
@@ -1117,7 +1117,7 @@ extern void ath5k_hw_detach(struct ath5k_hw *ah); | |||
1117 | 1117 | ||
1118 | /* Reset Functions */ | 1118 | /* Reset Functions */ |
1119 | extern int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial); | 1119 | extern int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial); |
1120 | extern int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode, struct ieee80211_channel *channel, bool change_channel); | 1120 | extern int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, struct ieee80211_channel *channel, bool change_channel); |
1121 | /* Power management functions */ | 1121 | /* Power management functions */ |
1122 | extern int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode, bool set_chip, u16 sleep_duration); | 1122 | extern int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode, bool set_chip, u16 sleep_duration); |
1123 | 1123 | ||
diff --git a/drivers/net/wireless/ath5k/attach.c b/drivers/net/wireless/ath5k/attach.c index 0eb2511fe147..153c4111fabe 100644 --- a/drivers/net/wireless/ath5k/attach.c +++ b/drivers/net/wireless/ath5k/attach.c | |||
@@ -124,7 +124,7 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) | |||
124 | /* | 124 | /* |
125 | * HW information | 125 | * HW information |
126 | */ | 126 | */ |
127 | ah->ah_op_mode = IEEE80211_IF_TYPE_STA; | 127 | ah->ah_op_mode = NL80211_IFTYPE_STATION; |
128 | ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT; | 128 | ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT; |
129 | ah->ah_turbo = false; | 129 | ah->ah_turbo = false; |
130 | ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; | 130 | ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; |
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index 85260c39aa2b..e09ed2ce6753 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c | |||
@@ -507,7 +507,7 @@ ath5k_pci_probe(struct pci_dev *pdev, | |||
507 | 507 | ||
508 | sc->iobase = mem; /* So we can unmap it on detach */ | 508 | sc->iobase = mem; /* So we can unmap it on detach */ |
509 | sc->cachelsz = csz * sizeof(u32); /* convert to bytes */ | 509 | sc->cachelsz = csz * sizeof(u32); /* convert to bytes */ |
510 | sc->opmode = IEEE80211_IF_TYPE_STA; | 510 | sc->opmode = NL80211_IFTYPE_STATION; |
511 | mutex_init(&sc->lock); | 511 | mutex_init(&sc->lock); |
512 | spin_lock_init(&sc->rxbuflock); | 512 | spin_lock_init(&sc->rxbuflock); |
513 | spin_lock_init(&sc->txbuflock); | 513 | spin_lock_init(&sc->txbuflock); |
@@ -1377,8 +1377,8 @@ ath5k_beaconq_config(struct ath5k_softc *sc) | |||
1377 | ret = ath5k_hw_get_tx_queueprops(ah, sc->bhalq, &qi); | 1377 | ret = ath5k_hw_get_tx_queueprops(ah, sc->bhalq, &qi); |
1378 | if (ret) | 1378 | if (ret) |
1379 | return ret; | 1379 | return ret; |
1380 | if (sc->opmode == IEEE80211_IF_TYPE_AP || | 1380 | if (sc->opmode == NL80211_IFTYPE_AP || |
1381 | sc->opmode == IEEE80211_IF_TYPE_MESH_POINT) { | 1381 | sc->opmode == NL80211_IFTYPE_MESH_POINT) { |
1382 | /* | 1382 | /* |
1383 | * Always burst out beacon and CAB traffic | 1383 | * Always burst out beacon and CAB traffic |
1384 | * (aifs = cwmin = cwmax = 0) | 1384 | * (aifs = cwmin = cwmax = 0) |
@@ -1386,7 +1386,7 @@ ath5k_beaconq_config(struct ath5k_softc *sc) | |||
1386 | qi.tqi_aifs = 0; | 1386 | qi.tqi_aifs = 0; |
1387 | qi.tqi_cw_min = 0; | 1387 | qi.tqi_cw_min = 0; |
1388 | qi.tqi_cw_max = 0; | 1388 | qi.tqi_cw_max = 0; |
1389 | } else if (sc->opmode == IEEE80211_IF_TYPE_IBSS) { | 1389 | } else if (sc->opmode == NL80211_IFTYPE_ADHOC) { |
1390 | /* | 1390 | /* |
1391 | * Adhoc mode; backoff between 0 and (2 * cw_min). | 1391 | * Adhoc mode; backoff between 0 and (2 * cw_min). |
1392 | */ | 1392 | */ |
@@ -1714,7 +1714,7 @@ ath5k_tasklet_rx(unsigned long data) | |||
1714 | /* let crypto-error packets fall through in MNTR */ | 1714 | /* let crypto-error packets fall through in MNTR */ |
1715 | if ((rs.rs_status & | 1715 | if ((rs.rs_status & |
1716 | ~(AR5K_RXERR_DECRYPT|AR5K_RXERR_MIC)) || | 1716 | ~(AR5K_RXERR_DECRYPT|AR5K_RXERR_MIC)) || |
1717 | sc->opmode != IEEE80211_IF_TYPE_MNTR) | 1717 | sc->opmode != NL80211_IFTYPE_MONITOR) |
1718 | goto next; | 1718 | goto next; |
1719 | } | 1719 | } |
1720 | accept: | 1720 | accept: |
@@ -1777,7 +1777,7 @@ accept: | |||
1777 | ath5k_debug_dump_skb(sc, skb, "RX ", 0); | 1777 | ath5k_debug_dump_skb(sc, skb, "RX ", 0); |
1778 | 1778 | ||
1779 | /* check beacons in IBSS mode */ | 1779 | /* check beacons in IBSS mode */ |
1780 | if (sc->opmode == IEEE80211_IF_TYPE_IBSS) | 1780 | if (sc->opmode == NL80211_IFTYPE_ADHOC) |
1781 | ath5k_check_ibss_tsf(sc, skb, &rxs); | 1781 | ath5k_check_ibss_tsf(sc, skb, &rxs); |
1782 | 1782 | ||
1783 | __ieee80211_rx(sc->hw, skb, &rxs); | 1783 | __ieee80211_rx(sc->hw, skb, &rxs); |
@@ -1892,7 +1892,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf) | |||
1892 | ds = bf->desc; | 1892 | ds = bf->desc; |
1893 | 1893 | ||
1894 | flags = AR5K_TXDESC_NOACK; | 1894 | flags = AR5K_TXDESC_NOACK; |
1895 | if (sc->opmode == IEEE80211_IF_TYPE_IBSS && ath5k_hw_hasveol(ah)) { | 1895 | if (sc->opmode == NL80211_IFTYPE_ADHOC && ath5k_hw_hasveol(ah)) { |
1896 | ds->ds_link = bf->daddr; /* self-linked */ | 1896 | ds->ds_link = bf->daddr; /* self-linked */ |
1897 | flags |= AR5K_TXDESC_VEOL; | 1897 | flags |= AR5K_TXDESC_VEOL; |
1898 | /* | 1898 | /* |
@@ -1941,8 +1941,8 @@ ath5k_beacon_send(struct ath5k_softc *sc) | |||
1941 | 1941 | ||
1942 | ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "in beacon_send\n"); | 1942 | ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "in beacon_send\n"); |
1943 | 1943 | ||
1944 | if (unlikely(bf->skb == NULL || sc->opmode == IEEE80211_IF_TYPE_STA || | 1944 | if (unlikely(bf->skb == NULL || sc->opmode == NL80211_IFTYPE_STATION || |
1945 | sc->opmode == IEEE80211_IF_TYPE_MNTR)) { | 1945 | sc->opmode == NL80211_IFTYPE_MONITOR)) { |
1946 | ATH5K_WARN(sc, "bf=%p bf_skb=%p\n", bf, bf ? bf->skb : NULL); | 1946 | ATH5K_WARN(sc, "bf=%p bf_skb=%p\n", bf, bf ? bf->skb : NULL); |
1947 | return; | 1947 | return; |
1948 | } | 1948 | } |
@@ -2116,9 +2116,9 @@ ath5k_beacon_config(struct ath5k_softc *sc) | |||
2116 | sc->bmisscount = 0; | 2116 | sc->bmisscount = 0; |
2117 | sc->imask &= ~(AR5K_INT_BMISS | AR5K_INT_SWBA); | 2117 | sc->imask &= ~(AR5K_INT_BMISS | AR5K_INT_SWBA); |
2118 | 2118 | ||
2119 | if (sc->opmode == IEEE80211_IF_TYPE_STA) { | 2119 | if (sc->opmode == NL80211_IFTYPE_STATION) { |
2120 | sc->imask |= AR5K_INT_BMISS; | 2120 | sc->imask |= AR5K_INT_BMISS; |
2121 | } else if (sc->opmode == IEEE80211_IF_TYPE_IBSS) { | 2121 | } else if (sc->opmode == NL80211_IFTYPE_ADHOC) { |
2122 | /* | 2122 | /* |
2123 | * In IBSS mode we use a self-linked tx descriptor and let the | 2123 | * In IBSS mode we use a self-linked tx descriptor and let the |
2124 | * hardware send the beacons automatically. We have to load it | 2124 | * hardware send the beacons automatically. We have to load it |
@@ -2323,7 +2323,7 @@ ath5k_intr(int irq, void *dev_id) | |||
2323 | * transmission time) in order to detect wether | 2323 | * transmission time) in order to detect wether |
2324 | * automatic TSF updates happened. | 2324 | * automatic TSF updates happened. |
2325 | */ | 2325 | */ |
2326 | if (sc->opmode == IEEE80211_IF_TYPE_IBSS) { | 2326 | if (sc->opmode == NL80211_IFTYPE_ADHOC) { |
2327 | /* XXX: only if VEOL suppported */ | 2327 | /* XXX: only if VEOL suppported */ |
2328 | u64 tsf = ath5k_hw_get_tsf64(ah); | 2328 | u64 tsf = ath5k_hw_get_tsf64(ah); |
2329 | sc->nexttbtt += sc->bintval; | 2329 | sc->nexttbtt += sc->bintval; |
@@ -2553,7 +2553,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2553 | 2553 | ||
2554 | ath5k_debug_dump_skb(sc, skb, "TX ", 1); | 2554 | ath5k_debug_dump_skb(sc, skb, "TX ", 1); |
2555 | 2555 | ||
2556 | if (sc->opmode == IEEE80211_IF_TYPE_MNTR) | 2556 | if (sc->opmode == NL80211_IFTYPE_MONITOR) |
2557 | ATH5K_DBG(sc, ATH5K_DEBUG_XMIT, "tx in monitor (scan?)\n"); | 2557 | ATH5K_DBG(sc, ATH5K_DEBUG_XMIT, "tx in monitor (scan?)\n"); |
2558 | 2558 | ||
2559 | /* | 2559 | /* |
@@ -2688,9 +2688,9 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, | |||
2688 | sc->vif = conf->vif; | 2688 | sc->vif = conf->vif; |
2689 | 2689 | ||
2690 | switch (conf->type) { | 2690 | switch (conf->type) { |
2691 | case IEEE80211_IF_TYPE_STA: | 2691 | case NL80211_IFTYPE_STATION: |
2692 | case IEEE80211_IF_TYPE_IBSS: | 2692 | case NL80211_IFTYPE_ADHOC: |
2693 | case IEEE80211_IF_TYPE_MNTR: | 2693 | case NL80211_IFTYPE_MONITOR: |
2694 | sc->opmode = conf->type; | 2694 | sc->opmode = conf->type; |
2695 | break; | 2695 | break; |
2696 | default: | 2696 | default: |
@@ -2761,7 +2761,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
2761 | } | 2761 | } |
2762 | 2762 | ||
2763 | if (conf->changed & IEEE80211_IFCC_BEACON && | 2763 | if (conf->changed & IEEE80211_IFCC_BEACON && |
2764 | vif->type == IEEE80211_IF_TYPE_IBSS) { | 2764 | vif->type == NL80211_IFTYPE_ADHOC) { |
2765 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 2765 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
2766 | if (!beacon) { | 2766 | if (!beacon) { |
2767 | ret = -ENOMEM; | 2767 | ret = -ENOMEM; |
@@ -2880,17 +2880,17 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw, | |||
2880 | 2880 | ||
2881 | /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */ | 2881 | /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */ |
2882 | 2882 | ||
2883 | if (sc->opmode == IEEE80211_IF_TYPE_MNTR) | 2883 | if (sc->opmode == NL80211_IFTYPE_MONITOR) |
2884 | rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON | | 2884 | rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON | |
2885 | AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM; | 2885 | AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM; |
2886 | if (sc->opmode != IEEE80211_IF_TYPE_STA) | 2886 | if (sc->opmode != NL80211_IFTYPE_STATION) |
2887 | rfilt |= AR5K_RX_FILTER_PROBEREQ; | 2887 | rfilt |= AR5K_RX_FILTER_PROBEREQ; |
2888 | if (sc->opmode != IEEE80211_IF_TYPE_AP && | 2888 | if (sc->opmode != NL80211_IFTYPE_AP && |
2889 | sc->opmode != IEEE80211_IF_TYPE_MESH_POINT && | 2889 | sc->opmode != NL80211_IFTYPE_MESH_POINT && |
2890 | test_bit(ATH_STAT_PROMISC, sc->status)) | 2890 | test_bit(ATH_STAT_PROMISC, sc->status)) |
2891 | rfilt |= AR5K_RX_FILTER_PROM; | 2891 | rfilt |= AR5K_RX_FILTER_PROM; |
2892 | if (sc->opmode == IEEE80211_IF_TYPE_STA || | 2892 | if (sc->opmode == NL80211_IFTYPE_STATION || |
2893 | sc->opmode == IEEE80211_IF_TYPE_IBSS) { | 2893 | sc->opmode == NL80211_IFTYPE_ADHOC) { |
2894 | rfilt |= AR5K_RX_FILTER_BEACON; | 2894 | rfilt |= AR5K_RX_FILTER_BEACON; |
2895 | } | 2895 | } |
2896 | 2896 | ||
@@ -2995,7 +2995,7 @@ ath5k_reset_tsf(struct ieee80211_hw *hw) | |||
2995 | * in IBSS mode we need to update the beacon timers too. | 2995 | * in IBSS mode we need to update the beacon timers too. |
2996 | * this will also reset the TSF if we call it with 0 | 2996 | * this will also reset the TSF if we call it with 0 |
2997 | */ | 2997 | */ |
2998 | if (sc->opmode == IEEE80211_IF_TYPE_IBSS) | 2998 | if (sc->opmode == NL80211_IFTYPE_ADHOC) |
2999 | ath5k_beacon_update_timers(sc, 0); | 2999 | ath5k_beacon_update_timers(sc, 0); |
3000 | else | 3000 | else |
3001 | ath5k_hw_reset_tsf(sc->ah); | 3001 | ath5k_hw_reset_tsf(sc->ah); |
@@ -3010,7 +3010,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
3010 | 3010 | ||
3011 | ath5k_debug_dump_skb(sc, skb, "BC ", 1); | 3011 | ath5k_debug_dump_skb(sc, skb, "BC ", 1); |
3012 | 3012 | ||
3013 | if (sc->opmode != IEEE80211_IF_TYPE_IBSS) { | 3013 | if (sc->opmode != NL80211_IFTYPE_ADHOC) { |
3014 | ret = -EIO; | 3014 | ret = -EIO; |
3015 | goto end; | 3015 | goto end; |
3016 | } | 3016 | } |
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h index 1549b63d6138..9d0b728928e3 100644 --- a/drivers/net/wireless/ath5k/base.h +++ b/drivers/net/wireless/ath5k/base.h | |||
@@ -113,7 +113,7 @@ struct ath5k_softc { | |||
113 | struct ieee80211_channel channels[ATH_CHAN_MAX]; | 113 | struct ieee80211_channel channels[ATH_CHAN_MAX]; |
114 | struct ieee80211_rate rates[IEEE80211_NUM_BANDS][AR5K_MAX_RATES]; | 114 | struct ieee80211_rate rates[IEEE80211_NUM_BANDS][AR5K_MAX_RATES]; |
115 | u8 rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_RATES]; | 115 | u8 rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_RATES]; |
116 | enum ieee80211_if_types opmode; | 116 | enum nl80211_iftype opmode; |
117 | struct ath5k_hw *ah; /* Atheros HW */ | 117 | struct ath5k_hw *ah; /* Atheros HW */ |
118 | 118 | ||
119 | struct ieee80211_supported_band *curband; | 119 | struct ieee80211_supported_band *curband; |
diff --git a/drivers/net/wireless/ath5k/pcu.c b/drivers/net/wireless/ath5k/pcu.c index 5a896d1e2a2b..c77cee2a5582 100644 --- a/drivers/net/wireless/ath5k/pcu.c +++ b/drivers/net/wireless/ath5k/pcu.c | |||
@@ -52,26 +52,26 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah) | |||
52 | ATH5K_TRACE(ah->ah_sc); | 52 | ATH5K_TRACE(ah->ah_sc); |
53 | 53 | ||
54 | switch (ah->ah_op_mode) { | 54 | switch (ah->ah_op_mode) { |
55 | case IEEE80211_IF_TYPE_IBSS: | 55 | case NL80211_IFTYPE_ADHOC: |
56 | pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_DESC_ANTENNA | | 56 | pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_DESC_ANTENNA | |
57 | (ah->ah_version == AR5K_AR5210 ? | 57 | (ah->ah_version == AR5K_AR5210 ? |
58 | AR5K_STA_ID1_NO_PSPOLL : 0); | 58 | AR5K_STA_ID1_NO_PSPOLL : 0); |
59 | beacon_reg |= AR5K_BCR_ADHOC; | 59 | beacon_reg |= AR5K_BCR_ADHOC; |
60 | break; | 60 | break; |
61 | 61 | ||
62 | case IEEE80211_IF_TYPE_AP: | 62 | case NL80211_IFTYPE_AP: |
63 | case IEEE80211_IF_TYPE_MESH_POINT: | 63 | case NL80211_IFTYPE_MESH_POINT: |
64 | pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_RTS_DEF_ANTENNA | | 64 | pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_RTS_DEF_ANTENNA | |
65 | (ah->ah_version == AR5K_AR5210 ? | 65 | (ah->ah_version == AR5K_AR5210 ? |
66 | AR5K_STA_ID1_NO_PSPOLL : 0); | 66 | AR5K_STA_ID1_NO_PSPOLL : 0); |
67 | beacon_reg |= AR5K_BCR_AP; | 67 | beacon_reg |= AR5K_BCR_AP; |
68 | break; | 68 | break; |
69 | 69 | ||
70 | case IEEE80211_IF_TYPE_STA: | 70 | case NL80211_IFTYPE_STATION: |
71 | pcu_reg |= AR5K_STA_ID1_DEFAULT_ANTENNA | | 71 | pcu_reg |= AR5K_STA_ID1_DEFAULT_ANTENNA | |
72 | (ah->ah_version == AR5K_AR5210 ? | 72 | (ah->ah_version == AR5K_AR5210 ? |
73 | AR5K_STA_ID1_PWR_SV : 0); | 73 | AR5K_STA_ID1_PWR_SV : 0); |
74 | case IEEE80211_IF_TYPE_MNTR: | 74 | case NL80211_IFTYPE_MONITOR: |
75 | pcu_reg |= AR5K_STA_ID1_DEFAULT_ANTENNA | | 75 | pcu_reg |= AR5K_STA_ID1_DEFAULT_ANTENNA | |
76 | (ah->ah_version == AR5K_AR5210 ? | 76 | (ah->ah_version == AR5K_AR5210 ? |
77 | AR5K_STA_ID1_NO_PSPOLL : 0); | 77 | AR5K_STA_ID1_NO_PSPOLL : 0); |
@@ -649,7 +649,7 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval) | |||
649 | * Set the additional timers by mode | 649 | * Set the additional timers by mode |
650 | */ | 650 | */ |
651 | switch (ah->ah_op_mode) { | 651 | switch (ah->ah_op_mode) { |
652 | case IEEE80211_IF_TYPE_STA: | 652 | case NL80211_IFTYPE_STATION: |
653 | if (ah->ah_version == AR5K_AR5210) { | 653 | if (ah->ah_version == AR5K_AR5210) { |
654 | timer1 = 0xffffffff; | 654 | timer1 = 0xffffffff; |
655 | timer2 = 0xffffffff; | 655 | timer2 = 0xffffffff; |
diff --git a/drivers/net/wireless/ath5k/reset.c b/drivers/net/wireless/ath5k/reset.c index d260fba0180f..f5c3de890cdb 100644 --- a/drivers/net/wireless/ath5k/reset.c +++ b/drivers/net/wireless/ath5k/reset.c | |||
@@ -399,7 +399,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
399 | /* | 399 | /* |
400 | * Main reset function | 400 | * Main reset function |
401 | */ | 401 | */ |
402 | int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode, | 402 | int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, |
403 | struct ieee80211_channel *channel, bool change_channel) | 403 | struct ieee80211_channel *channel, bool change_channel) |
404 | { | 404 | { |
405 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; | 405 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; |
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h index 28b8d84f49b4..0e897c276858 100644 --- a/drivers/net/wireless/ath9k/ath9k.h +++ b/drivers/net/wireless/ath9k/ath9k.h | |||
@@ -798,10 +798,11 @@ struct ath_hal { | |||
798 | struct ath9k_channel *ah_curchan; | 798 | struct ath9k_channel *ah_curchan; |
799 | u32 ah_nchan; | 799 | u32 ah_nchan; |
800 | 800 | ||
801 | u16 ah_rfsilent; | ||
802 | bool ah_rfkillEnabled; | ||
803 | bool ah_isPciExpress; | 801 | bool ah_isPciExpress; |
804 | u16 ah_txTrigLevel; | 802 | u16 ah_txTrigLevel; |
803 | u16 ah_rfsilent; | ||
804 | u32 ah_rfkill_gpio; | ||
805 | u32 ah_rfkill_polarity; | ||
805 | 806 | ||
806 | #ifndef ATH_NF_PER_CHAN | 807 | #ifndef ATH_NF_PER_CHAN |
807 | struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; | 808 | struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; |
@@ -1003,4 +1004,6 @@ bool ath9k_get_channel_edges(struct ath_hal *ah, | |||
1003 | void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio, | 1004 | void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio, |
1004 | u32 ah_signal_type); | 1005 | u32 ah_signal_type); |
1005 | void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 value); | 1006 | void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 value); |
1007 | u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio); | ||
1008 | void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio); | ||
1006 | #endif | 1009 | #endif |
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index 1faa1effa02c..b66de29cf662 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <asm/page.h> | 40 | #include <asm/page.h> |
41 | #include <net/mac80211.h> | 41 | #include <net/mac80211.h> |
42 | #include <linux/leds.h> | 42 | #include <linux/leds.h> |
43 | #include <linux/rfkill.h> | ||
43 | 44 | ||
44 | #include "ath9k.h" | 45 | #include "ath9k.h" |
45 | #include "rc.h" | 46 | #include "rc.h" |
@@ -823,6 +824,15 @@ struct ath_led { | |||
823 | bool registered; | 824 | bool registered; |
824 | }; | 825 | }; |
825 | 826 | ||
827 | /* Rfkill */ | ||
828 | #define ATH_RFKILL_POLL_INTERVAL 2000 /* msecs */ | ||
829 | |||
830 | struct ath_rfkill { | ||
831 | struct rfkill *rfkill; | ||
832 | struct delayed_work rfkill_poll; | ||
833 | char rfkill_name[32]; | ||
834 | }; | ||
835 | |||
826 | /********************/ | 836 | /********************/ |
827 | /* Main driver core */ | 837 | /* Main driver core */ |
828 | /********************/ | 838 | /********************/ |
@@ -906,6 +916,9 @@ struct ath_ht_info { | |||
906 | #define SC_OP_PROTECT_ENABLE BIT(8) | 916 | #define SC_OP_PROTECT_ENABLE BIT(8) |
907 | #define SC_OP_RXFLUSH BIT(9) | 917 | #define SC_OP_RXFLUSH BIT(9) |
908 | #define SC_OP_LED_ASSOCIATED BIT(10) | 918 | #define SC_OP_LED_ASSOCIATED BIT(10) |
919 | #define SC_OP_RFKILL_REGISTERED BIT(11) | ||
920 | #define SC_OP_RFKILL_SW_BLOCKED BIT(12) | ||
921 | #define SC_OP_RFKILL_HW_BLOCKED BIT(13) | ||
909 | 922 | ||
910 | struct ath_softc { | 923 | struct ath_softc { |
911 | struct ieee80211_hw *hw; | 924 | struct ieee80211_hw *hw; |
@@ -1015,6 +1028,9 @@ struct ath_softc { | |||
1015 | struct ath_led assoc_led; | 1028 | struct ath_led assoc_led; |
1016 | struct ath_led tx_led; | 1029 | struct ath_led tx_led; |
1017 | struct ath_led rx_led; | 1030 | struct ath_led rx_led; |
1031 | |||
1032 | /* Rfkill */ | ||
1033 | struct ath_rfkill rf_kill; | ||
1018 | }; | 1034 | }; |
1019 | 1035 | ||
1020 | int ath_init(u16 devid, struct ath_softc *sc); | 1036 | int ath_init(u16 devid, struct ath_softc *sc); |
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 4ccbbc07cf1e..0251e59f2f84 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -2821,7 +2821,38 @@ void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 val) | |||
2821 | AR_GPIO_BIT(gpio)); | 2821 | AR_GPIO_BIT(gpio)); |
2822 | } | 2822 | } |
2823 | 2823 | ||
2824 | static u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio) | 2824 | /* |
2825 | * Configure GPIO Input lines | ||
2826 | */ | ||
2827 | void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio) | ||
2828 | { | ||
2829 | u32 gpio_shift; | ||
2830 | |||
2831 | ASSERT(gpio < ah->ah_caps.num_gpio_pins); | ||
2832 | |||
2833 | gpio_shift = gpio << 1; | ||
2834 | |||
2835 | REG_RMW(ah, | ||
2836 | AR_GPIO_OE_OUT, | ||
2837 | (AR_GPIO_OE_OUT_DRV_NO << gpio_shift), | ||
2838 | (AR_GPIO_OE_OUT_DRV << gpio_shift)); | ||
2839 | } | ||
2840 | |||
2841 | #ifdef CONFIG_RFKILL | ||
2842 | static void ath9k_enable_rfkill(struct ath_hal *ah) | ||
2843 | { | ||
2844 | REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, | ||
2845 | AR_GPIO_INPUT_EN_VAL_RFSILENT_BB); | ||
2846 | |||
2847 | REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2, | ||
2848 | AR_GPIO_INPUT_MUX2_RFSILENT); | ||
2849 | |||
2850 | ath9k_hw_cfg_gpio_input(ah, ah->ah_rfkill_gpio); | ||
2851 | REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB); | ||
2852 | } | ||
2853 | #endif | ||
2854 | |||
2855 | u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio) | ||
2825 | { | 2856 | { |
2826 | if (gpio >= ah->ah_caps.num_gpio_pins) | 2857 | if (gpio >= ah->ah_caps.num_gpio_pins) |
2827 | return 0xffffffff; | 2858 | return 0xffffffff; |
@@ -3034,17 +3065,17 @@ static bool ath9k_hw_fill_cap_info(struct ath_hal *ah) | |||
3034 | 3065 | ||
3035 | pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM; | 3066 | pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM; |
3036 | 3067 | ||
3068 | #ifdef CONFIG_RFKILL | ||
3037 | ah->ah_rfsilent = ath9k_hw_get_eeprom(ahp, EEP_RF_SILENT); | 3069 | ah->ah_rfsilent = ath9k_hw_get_eeprom(ahp, EEP_RF_SILENT); |
3038 | if (ah->ah_rfsilent & EEP_RFSILENT_ENABLED) { | 3070 | if (ah->ah_rfsilent & EEP_RFSILENT_ENABLED) { |
3039 | ahp->ah_gpioSelect = | 3071 | ah->ah_rfkill_gpio = |
3040 | MS(ah->ah_rfsilent, EEP_RFSILENT_GPIO_SEL); | 3072 | MS(ah->ah_rfsilent, EEP_RFSILENT_GPIO_SEL); |
3041 | ahp->ah_polarity = | 3073 | ah->ah_rfkill_polarity = |
3042 | MS(ah->ah_rfsilent, EEP_RFSILENT_POLARITY); | 3074 | MS(ah->ah_rfsilent, EEP_RFSILENT_POLARITY); |
3043 | 3075 | ||
3044 | ath9k_hw_setcapability(ah, ATH9K_CAP_RFSILENT, 1, true, | ||
3045 | NULL); | ||
3046 | pCap->hw_caps |= ATH9K_HW_CAP_RFSILENT; | 3076 | pCap->hw_caps |= ATH9K_HW_CAP_RFSILENT; |
3047 | } | 3077 | } |
3078 | #endif | ||
3048 | 3079 | ||
3049 | if ((ah->ah_macVersion == AR_SREV_VERSION_5416_PCI) || | 3080 | if ((ah->ah_macVersion == AR_SREV_VERSION_5416_PCI) || |
3050 | (ah->ah_macVersion == AR_SREV_VERSION_5416_PCIE) || | 3081 | (ah->ah_macVersion == AR_SREV_VERSION_5416_PCIE) || |
@@ -5961,6 +5992,10 @@ bool ath9k_hw_reset(struct ath_hal *ah, | |||
5961 | ath9k_hw_init_interrupt_masks(ah, ah->ah_opmode); | 5992 | ath9k_hw_init_interrupt_masks(ah, ah->ah_opmode); |
5962 | ath9k_hw_init_qos(ah); | 5993 | ath9k_hw_init_qos(ah); |
5963 | 5994 | ||
5995 | #ifdef CONFIG_RFKILL | ||
5996 | if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT) | ||
5997 | ath9k_enable_rfkill(ah); | ||
5998 | #endif | ||
5964 | ath9k_hw_init_user_settings(ah); | 5999 | ath9k_hw_init_user_settings(ah); |
5965 | 6000 | ||
5966 | REG_WRITE(ah, AR_STA_ID1, | 6001 | REG_WRITE(ah, AR_STA_ID1, |
@@ -6490,31 +6525,6 @@ ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask) | |||
6490 | return true; | 6525 | return true; |
6491 | } | 6526 | } |
6492 | 6527 | ||
6493 | #ifdef CONFIG_ATH9K_RFKILL | ||
6494 | static void ath9k_enable_rfkill(struct ath_hal *ah) | ||
6495 | { | ||
6496 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
6497 | |||
6498 | REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, | ||
6499 | AR_GPIO_INPUT_EN_VAL_RFSILENT_BB); | ||
6500 | |||
6501 | REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2, | ||
6502 | AR_GPIO_INPUT_MUX2_RFSILENT); | ||
6503 | |||
6504 | ath9k_hw_cfg_gpio_input(ah, ahp->ah_gpioSelect); | ||
6505 | REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB); | ||
6506 | |||
6507 | if (ahp->ah_gpioBit == ath9k_hw_gpio_get(ah, ahp->ah_gpioSelect)) { | ||
6508 | |||
6509 | ath9k_hw_set_gpio_intr(ah, ahp->ah_gpioSelect, | ||
6510 | !ahp->ah_gpioBit); | ||
6511 | } else { | ||
6512 | ath9k_hw_set_gpio_intr(ah, ahp->ah_gpioSelect, | ||
6513 | ahp->ah_gpioBit); | ||
6514 | } | ||
6515 | } | ||
6516 | #endif | ||
6517 | |||
6518 | void | 6528 | void |
6519 | ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, | 6529 | ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, |
6520 | u16 assocId) | 6530 | u16 assocId) |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 57d7cc87cb0f..1ba18006f475 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -140,7 +140,7 @@ static int ath_key_config(struct ath_softc *sc, | |||
140 | struct ath9k_keyval hk; | 140 | struct ath9k_keyval hk; |
141 | const u8 *mac = NULL; | 141 | const u8 *mac = NULL; |
142 | int ret = 0; | 142 | int ret = 0; |
143 | enum ieee80211_if_types opmode; | 143 | enum nl80211_iftype opmode; |
144 | 144 | ||
145 | memset(&hk, 0, sizeof(hk)); | 145 | memset(&hk, 0, sizeof(hk)); |
146 | 146 | ||
@@ -179,14 +179,14 @@ static int ath_key_config(struct ath_softc *sc, | |||
179 | */ | 179 | */ |
180 | if (is_broadcast_ether_addr(addr)) { | 180 | if (is_broadcast_ether_addr(addr)) { |
181 | switch (opmode) { | 181 | switch (opmode) { |
182 | case IEEE80211_IF_TYPE_STA: | 182 | case NL80211_IFTYPE_STATION: |
183 | /* default key: could be group WPA key | 183 | /* default key: could be group WPA key |
184 | * or could be static WEP key */ | 184 | * or could be static WEP key */ |
185 | mac = NULL; | 185 | mac = NULL; |
186 | break; | 186 | break; |
187 | case IEEE80211_IF_TYPE_IBSS: | 187 | case NL80211_IFTYPE_ADHOC: |
188 | break; | 188 | break; |
189 | case IEEE80211_IF_TYPE_AP: | 189 | case NL80211_IFTYPE_AP: |
190 | break; | 190 | break; |
191 | default: | 191 | default: |
192 | ASSERT(0); | 192 | ASSERT(0); |
@@ -325,6 +325,693 @@ static u8 parse_mpdudensity(u8 mpdudensity) | |||
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | static void ath9k_ht_conf(struct ath_softc *sc, | ||
329 | struct ieee80211_bss_conf *bss_conf) | ||
330 | { | ||
331 | #define IEEE80211_HT_CAP_40MHZ_INTOLERANT BIT(14) | ||
332 | struct ath_ht_info *ht_info = &sc->sc_ht_info; | ||
333 | |||
334 | if (bss_conf->assoc_ht) { | ||
335 | ht_info->ext_chan_offset = | ||
336 | bss_conf->ht_bss_conf->bss_cap & | ||
337 | IEEE80211_HT_IE_CHA_SEC_OFFSET; | ||
338 | |||
339 | if (!(bss_conf->ht_conf->cap & | ||
340 | IEEE80211_HT_CAP_40MHZ_INTOLERANT) && | ||
341 | (bss_conf->ht_bss_conf->bss_cap & | ||
342 | IEEE80211_HT_IE_CHA_WIDTH)) | ||
343 | ht_info->tx_chan_width = ATH9K_HT_MACMODE_2040; | ||
344 | else | ||
345 | ht_info->tx_chan_width = ATH9K_HT_MACMODE_20; | ||
346 | |||
347 | ath9k_hw_set11nmac2040(sc->sc_ah, ht_info->tx_chan_width); | ||
348 | ht_info->maxampdu = 1 << (IEEE80211_HTCAP_MAXRXAMPDU_FACTOR + | ||
349 | bss_conf->ht_conf->ampdu_factor); | ||
350 | ht_info->mpdudensity = | ||
351 | parse_mpdudensity(bss_conf->ht_conf->ampdu_density); | ||
352 | |||
353 | } | ||
354 | |||
355 | #undef IEEE80211_HT_CAP_40MHZ_INTOLERANT | ||
356 | } | ||
357 | |||
358 | static void ath9k_bss_assoc_info(struct ath_softc *sc, | ||
359 | struct ieee80211_bss_conf *bss_conf) | ||
360 | { | ||
361 | struct ieee80211_hw *hw = sc->hw; | ||
362 | struct ieee80211_channel *curchan = hw->conf.channel; | ||
363 | struct ath_vap *avp; | ||
364 | int pos; | ||
365 | DECLARE_MAC_BUF(mac); | ||
366 | |||
367 | if (bss_conf->assoc) { | ||
368 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Bss Info ASSOC %d\n", | ||
369 | __func__, | ||
370 | bss_conf->aid); | ||
371 | |||
372 | avp = sc->sc_vaps[0]; | ||
373 | if (avp == NULL) { | ||
374 | DPRINTF(sc, ATH_DBG_FATAL, "%s: Invalid interface\n", | ||
375 | __func__); | ||
376 | return; | ||
377 | } | ||
378 | |||
379 | /* New association, store aid */ | ||
380 | if (avp->av_opmode == ATH9K_M_STA) { | ||
381 | sc->sc_curaid = bss_conf->aid; | ||
382 | ath9k_hw_write_associd(sc->sc_ah, sc->sc_curbssid, | ||
383 | sc->sc_curaid); | ||
384 | } | ||
385 | |||
386 | /* Configure the beacon */ | ||
387 | ath_beacon_config(sc, 0); | ||
388 | sc->sc_flags |= SC_OP_BEACONS; | ||
389 | |||
390 | /* Reset rssi stats */ | ||
391 | sc->sc_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER; | ||
392 | sc->sc_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER; | ||
393 | sc->sc_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER; | ||
394 | sc->sc_halstats.ns_avgtxrate = ATH_RATE_DUMMY_MARKER; | ||
395 | |||
396 | /* Update chainmask */ | ||
397 | ath_update_chainmask(sc, bss_conf->assoc_ht); | ||
398 | |||
399 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
400 | "%s: bssid %s aid 0x%x\n", | ||
401 | __func__, | ||
402 | print_mac(mac, sc->sc_curbssid), sc->sc_curaid); | ||
403 | |||
404 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Set channel: %d MHz\n", | ||
405 | __func__, | ||
406 | curchan->center_freq); | ||
407 | |||
408 | pos = ath_get_channel(sc, curchan); | ||
409 | if (pos == -1) { | ||
410 | DPRINTF(sc, ATH_DBG_FATAL, | ||
411 | "%s: Invalid channel\n", __func__); | ||
412 | return; | ||
413 | } | ||
414 | |||
415 | if (hw->conf.ht_conf.ht_supported) | ||
416 | sc->sc_ah->ah_channels[pos].chanmode = | ||
417 | ath_get_extchanmode(sc, curchan); | ||
418 | else | ||
419 | sc->sc_ah->ah_channels[pos].chanmode = | ||
420 | (curchan->band == IEEE80211_BAND_2GHZ) ? | ||
421 | CHANNEL_G : CHANNEL_A; | ||
422 | |||
423 | /* set h/w channel */ | ||
424 | if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) | ||
425 | DPRINTF(sc, ATH_DBG_FATAL, | ||
426 | "%s: Unable to set channel\n", | ||
427 | __func__); | ||
428 | |||
429 | ath_rate_newstate(sc, avp); | ||
430 | /* Update ratectrl about the new state */ | ||
431 | ath_rc_node_update(hw, avp->rc_node); | ||
432 | } else { | ||
433 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
434 | "%s: Bss Info DISSOC\n", __func__); | ||
435 | sc->sc_curaid = 0; | ||
436 | } | ||
437 | } | ||
438 | |||
439 | void ath_get_beaconconfig(struct ath_softc *sc, | ||
440 | int if_id, | ||
441 | struct ath_beacon_config *conf) | ||
442 | { | ||
443 | struct ieee80211_hw *hw = sc->hw; | ||
444 | |||
445 | /* fill in beacon config data */ | ||
446 | |||
447 | conf->beacon_interval = hw->conf.beacon_int; | ||
448 | conf->listen_interval = 100; | ||
449 | conf->dtim_count = 1; | ||
450 | conf->bmiss_timeout = ATH_DEFAULT_BMISS_LIMIT * conf->listen_interval; | ||
451 | } | ||
452 | |||
453 | void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | ||
454 | struct ath_xmit_status *tx_status, struct ath_node *an) | ||
455 | { | ||
456 | struct ieee80211_hw *hw = sc->hw; | ||
457 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
458 | |||
459 | DPRINTF(sc, ATH_DBG_XMIT, | ||
460 | "%s: TX complete: skb: %p\n", __func__, skb); | ||
461 | |||
462 | if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK || | ||
463 | tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) { | ||
464 | /* free driver's private data area of tx_info */ | ||
465 | if (tx_info->driver_data[0] != NULL) | ||
466 | kfree(tx_info->driver_data[0]); | ||
467 | tx_info->driver_data[0] = NULL; | ||
468 | } | ||
469 | |||
470 | if (tx_status->flags & ATH_TX_BAR) { | ||
471 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; | ||
472 | tx_status->flags &= ~ATH_TX_BAR; | ||
473 | } | ||
474 | |||
475 | if (tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY)) { | ||
476 | if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { | ||
477 | /* Frame was not ACKed, but an ACK was expected */ | ||
478 | tx_info->status.excessive_retries = 1; | ||
479 | } | ||
480 | } else { | ||
481 | /* Frame was ACKed */ | ||
482 | tx_info->flags |= IEEE80211_TX_STAT_ACK; | ||
483 | } | ||
484 | |||
485 | tx_info->status.retry_count = tx_status->retries; | ||
486 | |||
487 | ieee80211_tx_status(hw, skb); | ||
488 | if (an) | ||
489 | ath_node_put(sc, an, ATH9K_BH_STATUS_CHANGE); | ||
490 | } | ||
491 | |||
492 | int _ath_rx_indicate(struct ath_softc *sc, | ||
493 | struct sk_buff *skb, | ||
494 | struct ath_recv_status *status, | ||
495 | u16 keyix) | ||
496 | { | ||
497 | struct ieee80211_hw *hw = sc->hw; | ||
498 | struct ath_node *an = NULL; | ||
499 | struct ieee80211_rx_status rx_status; | ||
500 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
501 | int hdrlen = ieee80211_get_hdrlen_from_skb(skb); | ||
502 | int padsize; | ||
503 | enum ATH_RX_TYPE st; | ||
504 | |||
505 | /* see if any padding is done by the hw and remove it */ | ||
506 | if (hdrlen & 3) { | ||
507 | padsize = hdrlen % 4; | ||
508 | memmove(skb->data + padsize, skb->data, hdrlen); | ||
509 | skb_pull(skb, padsize); | ||
510 | } | ||
511 | |||
512 | /* Prepare rx status */ | ||
513 | ath9k_rx_prepare(sc, skb, status, &rx_status); | ||
514 | |||
515 | if (!(keyix == ATH9K_RXKEYIX_INVALID) && | ||
516 | !(status->flags & ATH_RX_DECRYPT_ERROR)) { | ||
517 | rx_status.flag |= RX_FLAG_DECRYPTED; | ||
518 | } else if ((le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_PROTECTED) | ||
519 | && !(status->flags & ATH_RX_DECRYPT_ERROR) | ||
520 | && skb->len >= hdrlen + 4) { | ||
521 | keyix = skb->data[hdrlen + 3] >> 6; | ||
522 | |||
523 | if (test_bit(keyix, sc->sc_keymap)) | ||
524 | rx_status.flag |= RX_FLAG_DECRYPTED; | ||
525 | } | ||
526 | |||
527 | spin_lock_bh(&sc->node_lock); | ||
528 | an = ath_node_find(sc, hdr->addr2); | ||
529 | spin_unlock_bh(&sc->node_lock); | ||
530 | |||
531 | if (an) { | ||
532 | ath_rx_input(sc, an, | ||
533 | hw->conf.ht_conf.ht_supported, | ||
534 | skb, status, &st); | ||
535 | } | ||
536 | if (!an || (st != ATH_RX_CONSUMED)) | ||
537 | __ieee80211_rx(hw, skb, &rx_status); | ||
538 | |||
539 | return 0; | ||
540 | } | ||
541 | |||
542 | int ath_rx_subframe(struct ath_node *an, | ||
543 | struct sk_buff *skb, | ||
544 | struct ath_recv_status *status) | ||
545 | { | ||
546 | struct ath_softc *sc = an->an_sc; | ||
547 | struct ieee80211_hw *hw = sc->hw; | ||
548 | struct ieee80211_rx_status rx_status; | ||
549 | |||
550 | /* Prepare rx status */ | ||
551 | ath9k_rx_prepare(sc, skb, status, &rx_status); | ||
552 | if (!(status->flags & ATH_RX_DECRYPT_ERROR)) | ||
553 | rx_status.flag |= RX_FLAG_DECRYPTED; | ||
554 | |||
555 | __ieee80211_rx(hw, skb, &rx_status); | ||
556 | |||
557 | return 0; | ||
558 | } | ||
559 | |||
560 | /********************************/ | ||
561 | /* LED functions */ | ||
562 | /********************************/ | ||
563 | |||
564 | static void ath_led_brightness(struct led_classdev *led_cdev, | ||
565 | enum led_brightness brightness) | ||
566 | { | ||
567 | struct ath_led *led = container_of(led_cdev, struct ath_led, led_cdev); | ||
568 | struct ath_softc *sc = led->sc; | ||
569 | |||
570 | switch (brightness) { | ||
571 | case LED_OFF: | ||
572 | if (led->led_type == ATH_LED_ASSOC || | ||
573 | led->led_type == ATH_LED_RADIO) | ||
574 | sc->sc_flags &= ~SC_OP_LED_ASSOCIATED; | ||
575 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, | ||
576 | (led->led_type == ATH_LED_RADIO) ? 1 : | ||
577 | !!(sc->sc_flags & SC_OP_LED_ASSOCIATED)); | ||
578 | break; | ||
579 | case LED_FULL: | ||
580 | if (led->led_type == ATH_LED_ASSOC) | ||
581 | sc->sc_flags |= SC_OP_LED_ASSOCIATED; | ||
582 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0); | ||
583 | break; | ||
584 | default: | ||
585 | break; | ||
586 | } | ||
587 | } | ||
588 | |||
589 | static int ath_register_led(struct ath_softc *sc, struct ath_led *led, | ||
590 | char *trigger) | ||
591 | { | ||
592 | int ret; | ||
593 | |||
594 | led->sc = sc; | ||
595 | led->led_cdev.name = led->name; | ||
596 | led->led_cdev.default_trigger = trigger; | ||
597 | led->led_cdev.brightness_set = ath_led_brightness; | ||
598 | |||
599 | ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &led->led_cdev); | ||
600 | if (ret) | ||
601 | DPRINTF(sc, ATH_DBG_FATAL, | ||
602 | "Failed to register led:%s", led->name); | ||
603 | else | ||
604 | led->registered = 1; | ||
605 | return ret; | ||
606 | } | ||
607 | |||
608 | static void ath_unregister_led(struct ath_led *led) | ||
609 | { | ||
610 | if (led->registered) { | ||
611 | led_classdev_unregister(&led->led_cdev); | ||
612 | led->registered = 0; | ||
613 | } | ||
614 | } | ||
615 | |||
616 | static void ath_deinit_leds(struct ath_softc *sc) | ||
617 | { | ||
618 | ath_unregister_led(&sc->assoc_led); | ||
619 | sc->sc_flags &= ~SC_OP_LED_ASSOCIATED; | ||
620 | ath_unregister_led(&sc->tx_led); | ||
621 | ath_unregister_led(&sc->rx_led); | ||
622 | ath_unregister_led(&sc->radio_led); | ||
623 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); | ||
624 | } | ||
625 | |||
626 | static void ath_init_leds(struct ath_softc *sc) | ||
627 | { | ||
628 | char *trigger; | ||
629 | int ret; | ||
630 | |||
631 | /* Configure gpio 1 for output */ | ||
632 | ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN, | ||
633 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||
634 | /* LED off, active low */ | ||
635 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); | ||
636 | |||
637 | trigger = ieee80211_get_radio_led_name(sc->hw); | ||
638 | snprintf(sc->radio_led.name, sizeof(sc->radio_led.name), | ||
639 | "ath9k-%s:radio", wiphy_name(sc->hw->wiphy)); | ||
640 | ret = ath_register_led(sc, &sc->radio_led, trigger); | ||
641 | sc->radio_led.led_type = ATH_LED_RADIO; | ||
642 | if (ret) | ||
643 | goto fail; | ||
644 | |||
645 | trigger = ieee80211_get_assoc_led_name(sc->hw); | ||
646 | snprintf(sc->assoc_led.name, sizeof(sc->assoc_led.name), | ||
647 | "ath9k-%s:assoc", wiphy_name(sc->hw->wiphy)); | ||
648 | ret = ath_register_led(sc, &sc->assoc_led, trigger); | ||
649 | sc->assoc_led.led_type = ATH_LED_ASSOC; | ||
650 | if (ret) | ||
651 | goto fail; | ||
652 | |||
653 | trigger = ieee80211_get_tx_led_name(sc->hw); | ||
654 | snprintf(sc->tx_led.name, sizeof(sc->tx_led.name), | ||
655 | "ath9k-%s:tx", wiphy_name(sc->hw->wiphy)); | ||
656 | ret = ath_register_led(sc, &sc->tx_led, trigger); | ||
657 | sc->tx_led.led_type = ATH_LED_TX; | ||
658 | if (ret) | ||
659 | goto fail; | ||
660 | |||
661 | trigger = ieee80211_get_rx_led_name(sc->hw); | ||
662 | snprintf(sc->rx_led.name, sizeof(sc->rx_led.name), | ||
663 | "ath9k-%s:rx", wiphy_name(sc->hw->wiphy)); | ||
664 | ret = ath_register_led(sc, &sc->rx_led, trigger); | ||
665 | sc->rx_led.led_type = ATH_LED_RX; | ||
666 | if (ret) | ||
667 | goto fail; | ||
668 | |||
669 | return; | ||
670 | |||
671 | fail: | ||
672 | ath_deinit_leds(sc); | ||
673 | } | ||
674 | |||
675 | #ifdef CONFIG_RFKILL | ||
676 | /*******************/ | ||
677 | /* Rfkill */ | ||
678 | /*******************/ | ||
679 | |||
680 | static void ath_radio_enable(struct ath_softc *sc) | ||
681 | { | ||
682 | struct ath_hal *ah = sc->sc_ah; | ||
683 | int status; | ||
684 | |||
685 | spin_lock_bh(&sc->sc_resetlock); | ||
686 | if (!ath9k_hw_reset(ah, ah->ah_curchan, | ||
687 | sc->sc_ht_info.tx_chan_width, | ||
688 | sc->sc_tx_chainmask, | ||
689 | sc->sc_rx_chainmask, | ||
690 | sc->sc_ht_extprotspacing, | ||
691 | false, &status)) { | ||
692 | DPRINTF(sc, ATH_DBG_FATAL, | ||
693 | "%s: unable to reset channel %u (%uMhz) " | ||
694 | "flags 0x%x hal status %u\n", __func__, | ||
695 | ath9k_hw_mhz2ieee(ah, | ||
696 | ah->ah_curchan->channel, | ||
697 | ah->ah_curchan->channelFlags), | ||
698 | ah->ah_curchan->channel, | ||
699 | ah->ah_curchan->channelFlags, status); | ||
700 | } | ||
701 | spin_unlock_bh(&sc->sc_resetlock); | ||
702 | |||
703 | ath_update_txpow(sc); | ||
704 | if (ath_startrecv(sc) != 0) { | ||
705 | DPRINTF(sc, ATH_DBG_FATAL, | ||
706 | "%s: unable to restart recv logic\n", __func__); | ||
707 | return; | ||
708 | } | ||
709 | |||
710 | if (sc->sc_flags & SC_OP_BEACONS) | ||
711 | ath_beacon_config(sc, ATH_IF_ID_ANY); /* restart beacons */ | ||
712 | |||
713 | /* Re-Enable interrupts */ | ||
714 | ath9k_hw_set_interrupts(ah, sc->sc_imask); | ||
715 | |||
716 | /* Enable LED */ | ||
717 | ath9k_hw_cfg_output(ah, ATH_LED_PIN, | ||
718 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||
719 | ath9k_hw_set_gpio(ah, ATH_LED_PIN, 0); | ||
720 | |||
721 | ieee80211_wake_queues(sc->hw); | ||
722 | } | ||
723 | |||
724 | static void ath_radio_disable(struct ath_softc *sc) | ||
725 | { | ||
726 | struct ath_hal *ah = sc->sc_ah; | ||
727 | int status; | ||
728 | |||
729 | |||
730 | ieee80211_stop_queues(sc->hw); | ||
731 | |||
732 | /* Disable LED */ | ||
733 | ath9k_hw_set_gpio(ah, ATH_LED_PIN, 1); | ||
734 | ath9k_hw_cfg_gpio_input(ah, ATH_LED_PIN); | ||
735 | |||
736 | /* Disable interrupts */ | ||
737 | ath9k_hw_set_interrupts(ah, 0); | ||
738 | |||
739 | ath_draintxq(sc, false); /* clear pending tx frames */ | ||
740 | ath_stoprecv(sc); /* turn off frame recv */ | ||
741 | ath_flushrecv(sc); /* flush recv queue */ | ||
742 | |||
743 | spin_lock_bh(&sc->sc_resetlock); | ||
744 | if (!ath9k_hw_reset(ah, ah->ah_curchan, | ||
745 | sc->sc_ht_info.tx_chan_width, | ||
746 | sc->sc_tx_chainmask, | ||
747 | sc->sc_rx_chainmask, | ||
748 | sc->sc_ht_extprotspacing, | ||
749 | false, &status)) { | ||
750 | DPRINTF(sc, ATH_DBG_FATAL, | ||
751 | "%s: unable to reset channel %u (%uMhz) " | ||
752 | "flags 0x%x hal status %u\n", __func__, | ||
753 | ath9k_hw_mhz2ieee(ah, | ||
754 | ah->ah_curchan->channel, | ||
755 | ah->ah_curchan->channelFlags), | ||
756 | ah->ah_curchan->channel, | ||
757 | ah->ah_curchan->channelFlags, status); | ||
758 | } | ||
759 | spin_unlock_bh(&sc->sc_resetlock); | ||
760 | |||
761 | ath9k_hw_phy_disable(ah); | ||
762 | ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP); | ||
763 | } | ||
764 | |||
765 | static bool ath_is_rfkill_set(struct ath_softc *sc) | ||
766 | { | ||
767 | struct ath_hal *ah = sc->sc_ah; | ||
768 | |||
769 | return ath9k_hw_gpio_get(ah, ah->ah_rfkill_gpio) == | ||
770 | ah->ah_rfkill_polarity; | ||
771 | } | ||
772 | |||
773 | /* h/w rfkill poll function */ | ||
774 | static void ath_rfkill_poll(struct work_struct *work) | ||
775 | { | ||
776 | struct ath_softc *sc = container_of(work, struct ath_softc, | ||
777 | rf_kill.rfkill_poll.work); | ||
778 | bool radio_on; | ||
779 | |||
780 | if (sc->sc_flags & SC_OP_INVALID) | ||
781 | return; | ||
782 | |||
783 | radio_on = !ath_is_rfkill_set(sc); | ||
784 | |||
785 | /* | ||
786 | * enable/disable radio only when there is a | ||
787 | * state change in RF switch | ||
788 | */ | ||
789 | if (radio_on == !!(sc->sc_flags & SC_OP_RFKILL_HW_BLOCKED)) { | ||
790 | enum rfkill_state state; | ||
791 | |||
792 | if (sc->sc_flags & SC_OP_RFKILL_SW_BLOCKED) { | ||
793 | state = radio_on ? RFKILL_STATE_SOFT_BLOCKED | ||
794 | : RFKILL_STATE_HARD_BLOCKED; | ||
795 | } else if (radio_on) { | ||
796 | ath_radio_enable(sc); | ||
797 | state = RFKILL_STATE_UNBLOCKED; | ||
798 | } else { | ||
799 | ath_radio_disable(sc); | ||
800 | state = RFKILL_STATE_HARD_BLOCKED; | ||
801 | } | ||
802 | |||
803 | if (state == RFKILL_STATE_HARD_BLOCKED) | ||
804 | sc->sc_flags |= SC_OP_RFKILL_HW_BLOCKED; | ||
805 | else | ||
806 | sc->sc_flags &= ~SC_OP_RFKILL_HW_BLOCKED; | ||
807 | |||
808 | rfkill_force_state(sc->rf_kill.rfkill, state); | ||
809 | } | ||
810 | |||
811 | queue_delayed_work(sc->hw->workqueue, &sc->rf_kill.rfkill_poll, | ||
812 | msecs_to_jiffies(ATH_RFKILL_POLL_INTERVAL)); | ||
813 | } | ||
814 | |||
815 | /* s/w rfkill handler */ | ||
816 | static int ath_sw_toggle_radio(void *data, enum rfkill_state state) | ||
817 | { | ||
818 | struct ath_softc *sc = data; | ||
819 | |||
820 | switch (state) { | ||
821 | case RFKILL_STATE_SOFT_BLOCKED: | ||
822 | if (!(sc->sc_flags & (SC_OP_RFKILL_HW_BLOCKED | | ||
823 | SC_OP_RFKILL_SW_BLOCKED))) | ||
824 | ath_radio_disable(sc); | ||
825 | sc->sc_flags |= SC_OP_RFKILL_SW_BLOCKED; | ||
826 | return 0; | ||
827 | case RFKILL_STATE_UNBLOCKED: | ||
828 | if ((sc->sc_flags & SC_OP_RFKILL_SW_BLOCKED)) { | ||
829 | sc->sc_flags &= ~SC_OP_RFKILL_SW_BLOCKED; | ||
830 | if (sc->sc_flags & SC_OP_RFKILL_HW_BLOCKED) { | ||
831 | DPRINTF(sc, ATH_DBG_FATAL, "Can't turn on the" | ||
832 | "radio as it is disabled by h/w \n"); | ||
833 | return -EPERM; | ||
834 | } | ||
835 | ath_radio_enable(sc); | ||
836 | } | ||
837 | return 0; | ||
838 | default: | ||
839 | return -EINVAL; | ||
840 | } | ||
841 | } | ||
842 | |||
843 | /* Init s/w rfkill */ | ||
844 | static int ath_init_sw_rfkill(struct ath_softc *sc) | ||
845 | { | ||
846 | sc->rf_kill.rfkill = rfkill_allocate(wiphy_dev(sc->hw->wiphy), | ||
847 | RFKILL_TYPE_WLAN); | ||
848 | if (!sc->rf_kill.rfkill) { | ||
849 | DPRINTF(sc, ATH_DBG_FATAL, "Failed to allocate rfkill\n"); | ||
850 | return -ENOMEM; | ||
851 | } | ||
852 | |||
853 | snprintf(sc->rf_kill.rfkill_name, sizeof(sc->rf_kill.rfkill_name), | ||
854 | "ath9k-%s:rfkill", wiphy_name(sc->hw->wiphy)); | ||
855 | sc->rf_kill.rfkill->name = sc->rf_kill.rfkill_name; | ||
856 | sc->rf_kill.rfkill->data = sc; | ||
857 | sc->rf_kill.rfkill->toggle_radio = ath_sw_toggle_radio; | ||
858 | sc->rf_kill.rfkill->state = RFKILL_STATE_UNBLOCKED; | ||
859 | sc->rf_kill.rfkill->user_claim_unsupported = 1; | ||
860 | |||
861 | return 0; | ||
862 | } | ||
863 | |||
864 | /* Deinitialize rfkill */ | ||
865 | static void ath_deinit_rfkill(struct ath_softc *sc) | ||
866 | { | ||
867 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT) | ||
868 | cancel_delayed_work_sync(&sc->rf_kill.rfkill_poll); | ||
869 | |||
870 | if (sc->sc_flags & SC_OP_RFKILL_REGISTERED) { | ||
871 | rfkill_unregister(sc->rf_kill.rfkill); | ||
872 | sc->sc_flags &= ~SC_OP_RFKILL_REGISTERED; | ||
873 | sc->rf_kill.rfkill = NULL; | ||
874 | } | ||
875 | } | ||
876 | #endif /* CONFIG_RFKILL */ | ||
877 | |||
878 | static int ath_detach(struct ath_softc *sc) | ||
879 | { | ||
880 | struct ieee80211_hw *hw = sc->hw; | ||
881 | |||
882 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Detach ATH hw\n", __func__); | ||
883 | |||
884 | /* Deinit LED control */ | ||
885 | ath_deinit_leds(sc); | ||
886 | |||
887 | #ifdef CONFIG_RFKILL | ||
888 | /* deinit rfkill */ | ||
889 | ath_deinit_rfkill(sc); | ||
890 | #endif | ||
891 | |||
892 | /* Unregister hw */ | ||
893 | |||
894 | ieee80211_unregister_hw(hw); | ||
895 | |||
896 | /* unregister Rate control */ | ||
897 | ath_rate_control_unregister(); | ||
898 | |||
899 | /* tx/rx cleanup */ | ||
900 | |||
901 | ath_rx_cleanup(sc); | ||
902 | ath_tx_cleanup(sc); | ||
903 | |||
904 | /* Deinit */ | ||
905 | |||
906 | ath_deinit(sc); | ||
907 | |||
908 | return 0; | ||
909 | } | ||
910 | |||
911 | static int ath_attach(u16 devid, | ||
912 | struct ath_softc *sc) | ||
913 | { | ||
914 | struct ieee80211_hw *hw = sc->hw; | ||
915 | int error = 0; | ||
916 | |||
917 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Attach ATH hw\n", __func__); | ||
918 | |||
919 | error = ath_init(devid, sc); | ||
920 | if (error != 0) | ||
921 | return error; | ||
922 | |||
923 | /* Init nodes */ | ||
924 | |||
925 | INIT_LIST_HEAD(&sc->node_list); | ||
926 | spin_lock_init(&sc->node_lock); | ||
927 | |||
928 | /* get mac address from hardware and set in mac80211 */ | ||
929 | |||
930 | SET_IEEE80211_PERM_ADDR(hw, sc->sc_myaddr); | ||
931 | |||
932 | /* setup channels and rates */ | ||
933 | |||
934 | sc->sbands[IEEE80211_BAND_2GHZ].channels = | ||
935 | sc->channels[IEEE80211_BAND_2GHZ]; | ||
936 | sc->sbands[IEEE80211_BAND_2GHZ].bitrates = | ||
937 | sc->rates[IEEE80211_BAND_2GHZ]; | ||
938 | sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; | ||
939 | |||
940 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) | ||
941 | /* Setup HT capabilities for 2.4Ghz*/ | ||
942 | setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_info); | ||
943 | |||
944 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | ||
945 | &sc->sbands[IEEE80211_BAND_2GHZ]; | ||
946 | |||
947 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->ah_caps.wireless_modes)) { | ||
948 | sc->sbands[IEEE80211_BAND_5GHZ].channels = | ||
949 | sc->channels[IEEE80211_BAND_5GHZ]; | ||
950 | sc->sbands[IEEE80211_BAND_5GHZ].bitrates = | ||
951 | sc->rates[IEEE80211_BAND_5GHZ]; | ||
952 | sc->sbands[IEEE80211_BAND_5GHZ].band = | ||
953 | IEEE80211_BAND_5GHZ; | ||
954 | |||
955 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) | ||
956 | /* Setup HT capabilities for 5Ghz*/ | ||
957 | setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_info); | ||
958 | |||
959 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | ||
960 | &sc->sbands[IEEE80211_BAND_5GHZ]; | ||
961 | } | ||
962 | |||
963 | /* FIXME: Have to figure out proper hw init values later */ | ||
964 | |||
965 | hw->queues = 4; | ||
966 | hw->ampdu_queues = 1; | ||
967 | |||
968 | /* Register rate control */ | ||
969 | hw->rate_control_algorithm = "ath9k_rate_control"; | ||
970 | error = ath_rate_control_register(); | ||
971 | if (error != 0) { | ||
972 | DPRINTF(sc, ATH_DBG_FATAL, | ||
973 | "%s: Unable to register rate control " | ||
974 | "algorithm:%d\n", __func__, error); | ||
975 | ath_rate_control_unregister(); | ||
976 | goto bad; | ||
977 | } | ||
978 | |||
979 | error = ieee80211_register_hw(hw); | ||
980 | if (error != 0) { | ||
981 | ath_rate_control_unregister(); | ||
982 | goto bad; | ||
983 | } | ||
984 | |||
985 | /* Initialize LED control */ | ||
986 | ath_init_leds(sc); | ||
987 | |||
988 | #ifdef CONFIG_RFKILL | ||
989 | /* Initialze h/w Rfkill */ | ||
990 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT) | ||
991 | INIT_DELAYED_WORK(&sc->rf_kill.rfkill_poll, ath_rfkill_poll); | ||
992 | |||
993 | /* Initialize s/w rfkill */ | ||
994 | if (ath_init_sw_rfkill(sc)) | ||
995 | goto detach; | ||
996 | #endif | ||
997 | |||
998 | /* initialize tx/rx engine */ | ||
999 | |||
1000 | error = ath_tx_init(sc, ATH_TXBUF); | ||
1001 | if (error != 0) | ||
1002 | goto detach; | ||
1003 | |||
1004 | error = ath_rx_init(sc, ATH_RXBUF); | ||
1005 | if (error != 0) | ||
1006 | goto detach; | ||
1007 | |||
1008 | return 0; | ||
1009 | detach: | ||
1010 | ath_detach(sc); | ||
1011 | bad: | ||
1012 | return error; | ||
1013 | } | ||
1014 | |||
328 | static int ath9k_start(struct ieee80211_hw *hw) | 1015 | static int ath9k_start(struct ieee80211_hw *hw) |
329 | { | 1016 | { |
330 | struct ath_softc *sc = hw->priv; | 1017 | struct ath_softc *sc = hw->priv; |
@@ -353,6 +1040,33 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
353 | return error; | 1040 | return error; |
354 | } | 1041 | } |
355 | 1042 | ||
1043 | #ifdef CONFIG_RFKILL | ||
1044 | /* Start rfkill polling */ | ||
1045 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT) | ||
1046 | queue_delayed_work(sc->hw->workqueue, | ||
1047 | &sc->rf_kill.rfkill_poll, 0); | ||
1048 | |||
1049 | if (!(sc->sc_flags & SC_OP_RFKILL_REGISTERED)) { | ||
1050 | if (rfkill_register(sc->rf_kill.rfkill)) { | ||
1051 | DPRINTF(sc, ATH_DBG_FATAL, | ||
1052 | "Unable to register rfkill\n"); | ||
1053 | rfkill_free(sc->rf_kill.rfkill); | ||
1054 | |||
1055 | /* Deinitialize the device */ | ||
1056 | if (sc->pdev->irq) | ||
1057 | free_irq(sc->pdev->irq, sc); | ||
1058 | ath_detach(sc); | ||
1059 | pci_iounmap(sc->pdev, sc->mem); | ||
1060 | pci_release_region(sc->pdev, 0); | ||
1061 | pci_disable_device(sc->pdev); | ||
1062 | ieee80211_free_hw(hw); | ||
1063 | return -EIO; | ||
1064 | } else { | ||
1065 | sc->sc_flags |= SC_OP_RFKILL_REGISTERED; | ||
1066 | } | ||
1067 | } | ||
1068 | #endif | ||
1069 | |||
356 | ieee80211_wake_queues(hw); | 1070 | ieee80211_wake_queues(hw); |
357 | return 0; | 1071 | return 0; |
358 | } | 1072 | } |
@@ -414,6 +1128,11 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
414 | "%s: Device is no longer present\n", __func__); | 1128 | "%s: Device is no longer present\n", __func__); |
415 | 1129 | ||
416 | ieee80211_stop_queues(hw); | 1130 | ieee80211_stop_queues(hw); |
1131 | |||
1132 | #ifdef CONFIG_RFKILL | ||
1133 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT) | ||
1134 | cancel_delayed_work_sync(&sc->rf_kill.rfkill_poll); | ||
1135 | #endif | ||
417 | } | 1136 | } |
418 | 1137 | ||
419 | static int ath9k_add_interface(struct ieee80211_hw *hw, | 1138 | static int ath9k_add_interface(struct ieee80211_hw *hw, |
@@ -428,13 +1147,13 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
428 | return -ENOBUFS; | 1147 | return -ENOBUFS; |
429 | 1148 | ||
430 | switch (conf->type) { | 1149 | switch (conf->type) { |
431 | case IEEE80211_IF_TYPE_STA: | 1150 | case NL80211_IFTYPE_STATION: |
432 | ic_opmode = ATH9K_M_STA; | 1151 | ic_opmode = ATH9K_M_STA; |
433 | break; | 1152 | break; |
434 | case IEEE80211_IF_TYPE_IBSS: | 1153 | case NL80211_IFTYPE_ADHOC: |
435 | ic_opmode = ATH9K_M_IBSS; | 1154 | ic_opmode = ATH9K_M_IBSS; |
436 | break; | 1155 | break; |
437 | case IEEE80211_IF_TYPE_AP: | 1156 | case NL80211_IFTYPE_AP: |
438 | ic_opmode = ATH9K_M_HOSTAP; | 1157 | ic_opmode = ATH9K_M_HOSTAP; |
439 | break; | 1158 | break; |
440 | default: | 1159 | default: |
@@ -556,7 +1275,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, | |||
556 | 1275 | ||
557 | /* TODO: Need to decide which hw opmode to use for multi-interface | 1276 | /* TODO: Need to decide which hw opmode to use for multi-interface |
558 | * cases */ | 1277 | * cases */ |
559 | if (vif->type == IEEE80211_IF_TYPE_AP && | 1278 | if (vif->type == NL80211_IFTYPE_AP && |
560 | ah->ah_opmode != ATH9K_M_HOSTAP) { | 1279 | ah->ah_opmode != ATH9K_M_HOSTAP) { |
561 | ah->ah_opmode = ATH9K_M_HOSTAP; | 1280 | ah->ah_opmode = ATH9K_M_HOSTAP; |
562 | ath9k_hw_setopmode(ah); | 1281 | ath9k_hw_setopmode(ah); |
@@ -568,8 +1287,8 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, | |||
568 | if ((conf->changed & IEEE80211_IFCC_BSSID) && | 1287 | if ((conf->changed & IEEE80211_IFCC_BSSID) && |
569 | !is_zero_ether_addr(conf->bssid)) { | 1288 | !is_zero_ether_addr(conf->bssid)) { |
570 | switch (vif->type) { | 1289 | switch (vif->type) { |
571 | case IEEE80211_IF_TYPE_STA: | 1290 | case NL80211_IFTYPE_STATION: |
572 | case IEEE80211_IF_TYPE_IBSS: | 1291 | case NL80211_IFTYPE_ADHOC: |
573 | /* Update ratectrl about the new state */ | 1292 | /* Update ratectrl about the new state */ |
574 | ath_rate_newstate(sc, avp); | 1293 | ath_rate_newstate(sc, avp); |
575 | 1294 | ||
@@ -614,8 +1333,8 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, | |||
614 | } | 1333 | } |
615 | 1334 | ||
616 | if ((conf->changed & IEEE80211_IFCC_BEACON) && | 1335 | if ((conf->changed & IEEE80211_IFCC_BEACON) && |
617 | ((vif->type == IEEE80211_IF_TYPE_IBSS) || | 1336 | ((vif->type == NL80211_IFTYPE_ADHOC) || |
618 | (vif->type == IEEE80211_IF_TYPE_AP))) { | 1337 | (vif->type == NL80211_IFTYPE_AP))) { |
619 | /* | 1338 | /* |
620 | * Allocate and setup the beacon frame. | 1339 | * Allocate and setup the beacon frame. |
621 | * | 1340 | * |
@@ -634,7 +1353,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, | |||
634 | } | 1353 | } |
635 | 1354 | ||
636 | /* Check for WLAN_CAPABILITY_PRIVACY ? */ | 1355 | /* Check for WLAN_CAPABILITY_PRIVACY ? */ |
637 | if ((avp->av_opmode != IEEE80211_IF_TYPE_STA)) { | 1356 | if ((avp->av_opmode != NL80211_IFTYPE_STATION)) { |
638 | for (i = 0; i < IEEE80211_WEP_NKID; i++) | 1357 | for (i = 0; i < IEEE80211_WEP_NKID; i++) |
639 | if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i)) | 1358 | if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i)) |
640 | ath9k_hw_keysetmac(sc->sc_ah, | 1359 | ath9k_hw_keysetmac(sc->sc_ah, |
@@ -643,7 +1362,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, | |||
643 | } | 1362 | } |
644 | 1363 | ||
645 | /* Only legacy IBSS for now */ | 1364 | /* Only legacy IBSS for now */ |
646 | if (vif->type == IEEE80211_IF_TYPE_IBSS) | 1365 | if (vif->type == NL80211_IFTYPE_ADHOC) |
647 | ath_update_chainmask(sc, 0); | 1366 | ath_update_chainmask(sc, 0); |
648 | 1367 | ||
649 | return 0; | 1368 | return 0; |
@@ -686,7 +1405,7 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw, | |||
686 | static void ath9k_sta_notify(struct ieee80211_hw *hw, | 1405 | static void ath9k_sta_notify(struct ieee80211_hw *hw, |
687 | struct ieee80211_vif *vif, | 1406 | struct ieee80211_vif *vif, |
688 | enum sta_notify_cmd cmd, | 1407 | enum sta_notify_cmd cmd, |
689 | const u8 *addr) | 1408 | struct ieee80211_sta *sta) |
690 | { | 1409 | { |
691 | struct ath_softc *sc = hw->priv; | 1410 | struct ath_softc *sc = hw->priv; |
692 | struct ath_node *an; | 1411 | struct ath_node *an; |
@@ -694,19 +1413,18 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw, | |||
694 | DECLARE_MAC_BUF(mac); | 1413 | DECLARE_MAC_BUF(mac); |
695 | 1414 | ||
696 | spin_lock_irqsave(&sc->node_lock, flags); | 1415 | spin_lock_irqsave(&sc->node_lock, flags); |
697 | an = ath_node_find(sc, (u8 *) addr); | 1416 | an = ath_node_find(sc, sta->addr); |
698 | spin_unlock_irqrestore(&sc->node_lock, flags); | 1417 | spin_unlock_irqrestore(&sc->node_lock, flags); |
699 | 1418 | ||
700 | switch (cmd) { | 1419 | switch (cmd) { |
701 | case STA_NOTIFY_ADD: | 1420 | case STA_NOTIFY_ADD: |
702 | spin_lock_irqsave(&sc->node_lock, flags); | 1421 | spin_lock_irqsave(&sc->node_lock, flags); |
703 | if (!an) { | 1422 | if (!an) { |
704 | ath_node_attach(sc, (u8 *)addr, 0); | 1423 | ath_node_attach(sc, sta->addr, 0); |
705 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Attach a node: %s\n", | 1424 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Attach a node: %s\n", |
706 | __func__, | 1425 | __func__, print_mac(mac, sta->addr)); |
707 | print_mac(mac, addr)); | ||
708 | } else { | 1426 | } else { |
709 | ath_node_get(sc, (u8 *)addr); | 1427 | ath_node_get(sc, sta->addr); |
710 | } | 1428 | } |
711 | spin_unlock_irqrestore(&sc->node_lock, flags); | 1429 | spin_unlock_irqrestore(&sc->node_lock, flags); |
712 | break; | 1430 | break; |
@@ -719,7 +1437,7 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw, | |||
719 | ath_node_put(sc, an, ATH9K_BH_STATUS_INTACT); | 1437 | ath_node_put(sc, an, ATH9K_BH_STATUS_INTACT); |
720 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Put a node: %s\n", | 1438 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Put a node: %s\n", |
721 | __func__, | 1439 | __func__, |
722 | print_mac(mac, addr)); | 1440 | print_mac(mac, sta->addr)); |
723 | } | 1441 | } |
724 | break; | 1442 | break; |
725 | default: | 1443 | default: |
@@ -798,117 +1516,6 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
798 | return ret; | 1516 | return ret; |
799 | } | 1517 | } |
800 | 1518 | ||
801 | static void ath9k_ht_conf(struct ath_softc *sc, | ||
802 | struct ieee80211_bss_conf *bss_conf) | ||
803 | { | ||
804 | #define IEEE80211_HT_CAP_40MHZ_INTOLERANT BIT(14) | ||
805 | struct ath_ht_info *ht_info = &sc->sc_ht_info; | ||
806 | |||
807 | if (bss_conf->assoc_ht) { | ||
808 | ht_info->ext_chan_offset = | ||
809 | bss_conf->ht_bss_conf->bss_cap & | ||
810 | IEEE80211_HT_IE_CHA_SEC_OFFSET; | ||
811 | |||
812 | if (!(bss_conf->ht_conf->cap & | ||
813 | IEEE80211_HT_CAP_40MHZ_INTOLERANT) && | ||
814 | (bss_conf->ht_bss_conf->bss_cap & | ||
815 | IEEE80211_HT_IE_CHA_WIDTH)) | ||
816 | ht_info->tx_chan_width = ATH9K_HT_MACMODE_2040; | ||
817 | else | ||
818 | ht_info->tx_chan_width = ATH9K_HT_MACMODE_20; | ||
819 | |||
820 | ath9k_hw_set11nmac2040(sc->sc_ah, ht_info->tx_chan_width); | ||
821 | ht_info->maxampdu = 1 << (IEEE80211_HTCAP_MAXRXAMPDU_FACTOR + | ||
822 | bss_conf->ht_conf->ampdu_factor); | ||
823 | ht_info->mpdudensity = | ||
824 | parse_mpdudensity(bss_conf->ht_conf->ampdu_density); | ||
825 | |||
826 | } | ||
827 | |||
828 | #undef IEEE80211_HT_CAP_40MHZ_INTOLERANT | ||
829 | } | ||
830 | |||
831 | static void ath9k_bss_assoc_info(struct ath_softc *sc, | ||
832 | struct ieee80211_bss_conf *bss_conf) | ||
833 | { | ||
834 | struct ieee80211_hw *hw = sc->hw; | ||
835 | struct ieee80211_channel *curchan = hw->conf.channel; | ||
836 | struct ath_vap *avp; | ||
837 | int pos; | ||
838 | DECLARE_MAC_BUF(mac); | ||
839 | |||
840 | if (bss_conf->assoc) { | ||
841 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Bss Info ASSOC %d\n", | ||
842 | __func__, | ||
843 | bss_conf->aid); | ||
844 | |||
845 | avp = sc->sc_vaps[0]; | ||
846 | if (avp == NULL) { | ||
847 | DPRINTF(sc, ATH_DBG_FATAL, "%s: Invalid interface\n", | ||
848 | __func__); | ||
849 | return; | ||
850 | } | ||
851 | |||
852 | /* New association, store aid */ | ||
853 | if (avp->av_opmode == ATH9K_M_STA) { | ||
854 | sc->sc_curaid = bss_conf->aid; | ||
855 | ath9k_hw_write_associd(sc->sc_ah, sc->sc_curbssid, | ||
856 | sc->sc_curaid); | ||
857 | } | ||
858 | |||
859 | /* Configure the beacon */ | ||
860 | ath_beacon_config(sc, 0); | ||
861 | sc->sc_flags |= SC_OP_BEACONS; | ||
862 | |||
863 | /* Reset rssi stats */ | ||
864 | sc->sc_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER; | ||
865 | sc->sc_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER; | ||
866 | sc->sc_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER; | ||
867 | sc->sc_halstats.ns_avgtxrate = ATH_RATE_DUMMY_MARKER; | ||
868 | |||
869 | /* Update chainmask */ | ||
870 | ath_update_chainmask(sc, bss_conf->assoc_ht); | ||
871 | |||
872 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
873 | "%s: bssid %s aid 0x%x\n", | ||
874 | __func__, | ||
875 | print_mac(mac, sc->sc_curbssid), sc->sc_curaid); | ||
876 | |||
877 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Set channel: %d MHz\n", | ||
878 | __func__, | ||
879 | curchan->center_freq); | ||
880 | |||
881 | pos = ath_get_channel(sc, curchan); | ||
882 | if (pos == -1) { | ||
883 | DPRINTF(sc, ATH_DBG_FATAL, | ||
884 | "%s: Invalid channel\n", __func__); | ||
885 | return; | ||
886 | } | ||
887 | |||
888 | if (hw->conf.ht_conf.ht_supported) | ||
889 | sc->sc_ah->ah_channels[pos].chanmode = | ||
890 | ath_get_extchanmode(sc, curchan); | ||
891 | else | ||
892 | sc->sc_ah->ah_channels[pos].chanmode = | ||
893 | (curchan->band == IEEE80211_BAND_2GHZ) ? | ||
894 | CHANNEL_G : CHANNEL_A; | ||
895 | |||
896 | /* set h/w channel */ | ||
897 | if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) | ||
898 | DPRINTF(sc, ATH_DBG_FATAL, | ||
899 | "%s: Unable to set channel\n", | ||
900 | __func__); | ||
901 | |||
902 | ath_rate_newstate(sc, avp); | ||
903 | /* Update ratectrl about the new state */ | ||
904 | ath_rc_node_update(hw, avp->rc_node); | ||
905 | } else { | ||
906 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
907 | "%s: Bss Info DISSOC\n", __func__); | ||
908 | sc->sc_curaid = 0; | ||
909 | } | ||
910 | } | ||
911 | |||
912 | static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | 1519 | static void ath9k_bss_info_changed(struct ieee80211_hw *hw, |
913 | struct ieee80211_vif *vif, | 1520 | struct ieee80211_vif *vif, |
914 | struct ieee80211_bss_conf *bss_conf, | 1521 | struct ieee80211_bss_conf *bss_conf, |
@@ -973,45 +1580,44 @@ static void ath9k_reset_tsf(struct ieee80211_hw *hw) | |||
973 | 1580 | ||
974 | static int ath9k_ampdu_action(struct ieee80211_hw *hw, | 1581 | static int ath9k_ampdu_action(struct ieee80211_hw *hw, |
975 | enum ieee80211_ampdu_mlme_action action, | 1582 | enum ieee80211_ampdu_mlme_action action, |
976 | const u8 *addr, | 1583 | struct ieee80211_sta *sta, |
977 | u16 tid, | 1584 | u16 tid, u16 *ssn) |
978 | u16 *ssn) | ||
979 | { | 1585 | { |
980 | struct ath_softc *sc = hw->priv; | 1586 | struct ath_softc *sc = hw->priv; |
981 | int ret = 0; | 1587 | int ret = 0; |
982 | 1588 | ||
983 | switch (action) { | 1589 | switch (action) { |
984 | case IEEE80211_AMPDU_RX_START: | 1590 | case IEEE80211_AMPDU_RX_START: |
985 | ret = ath_rx_aggr_start(sc, addr, tid, ssn); | 1591 | ret = ath_rx_aggr_start(sc, sta->addr, tid, ssn); |
986 | if (ret < 0) | 1592 | if (ret < 0) |
987 | DPRINTF(sc, ATH_DBG_FATAL, | 1593 | DPRINTF(sc, ATH_DBG_FATAL, |
988 | "%s: Unable to start RX aggregation\n", | 1594 | "%s: Unable to start RX aggregation\n", |
989 | __func__); | 1595 | __func__); |
990 | break; | 1596 | break; |
991 | case IEEE80211_AMPDU_RX_STOP: | 1597 | case IEEE80211_AMPDU_RX_STOP: |
992 | ret = ath_rx_aggr_stop(sc, addr, tid); | 1598 | ret = ath_rx_aggr_stop(sc, sta->addr, tid); |
993 | if (ret < 0) | 1599 | if (ret < 0) |
994 | DPRINTF(sc, ATH_DBG_FATAL, | 1600 | DPRINTF(sc, ATH_DBG_FATAL, |
995 | "%s: Unable to stop RX aggregation\n", | 1601 | "%s: Unable to stop RX aggregation\n", |
996 | __func__); | 1602 | __func__); |
997 | break; | 1603 | break; |
998 | case IEEE80211_AMPDU_TX_START: | 1604 | case IEEE80211_AMPDU_TX_START: |
999 | ret = ath_tx_aggr_start(sc, addr, tid, ssn); | 1605 | ret = ath_tx_aggr_start(sc, sta->addr, tid, ssn); |
1000 | if (ret < 0) | 1606 | if (ret < 0) |
1001 | DPRINTF(sc, ATH_DBG_FATAL, | 1607 | DPRINTF(sc, ATH_DBG_FATAL, |
1002 | "%s: Unable to start TX aggregation\n", | 1608 | "%s: Unable to start TX aggregation\n", |
1003 | __func__); | 1609 | __func__); |
1004 | else | 1610 | else |
1005 | ieee80211_start_tx_ba_cb_irqsafe(hw, (u8 *)addr, tid); | 1611 | ieee80211_start_tx_ba_cb_irqsafe(hw, sta->addr, tid); |
1006 | break; | 1612 | break; |
1007 | case IEEE80211_AMPDU_TX_STOP: | 1613 | case IEEE80211_AMPDU_TX_STOP: |
1008 | ret = ath_tx_aggr_stop(sc, addr, tid); | 1614 | ret = ath_tx_aggr_stop(sc, sta->addr, tid); |
1009 | if (ret < 0) | 1615 | if (ret < 0) |
1010 | DPRINTF(sc, ATH_DBG_FATAL, | 1616 | DPRINTF(sc, ATH_DBG_FATAL, |
1011 | "%s: Unable to stop TX aggregation\n", | 1617 | "%s: Unable to stop TX aggregation\n", |
1012 | __func__); | 1618 | __func__); |
1013 | 1619 | ||
1014 | ieee80211_stop_tx_ba_cb_irqsafe(hw, (u8 *)addr, tid); | 1620 | ieee80211_stop_tx_ba_cb_irqsafe(hw, sta->addr, tid); |
1015 | break; | 1621 | break; |
1016 | default: | 1622 | default: |
1017 | DPRINTF(sc, ATH_DBG_FATAL, | 1623 | DPRINTF(sc, ATH_DBG_FATAL, |
@@ -1048,364 +1654,6 @@ static struct ieee80211_ops ath9k_ops = { | |||
1048 | .ampdu_action = ath9k_ampdu_action | 1654 | .ampdu_action = ath9k_ampdu_action |
1049 | }; | 1655 | }; |
1050 | 1656 | ||
1051 | void ath_get_beaconconfig(struct ath_softc *sc, | ||
1052 | int if_id, | ||
1053 | struct ath_beacon_config *conf) | ||
1054 | { | ||
1055 | struct ieee80211_hw *hw = sc->hw; | ||
1056 | |||
1057 | /* fill in beacon config data */ | ||
1058 | |||
1059 | conf->beacon_interval = hw->conf.beacon_int; | ||
1060 | conf->listen_interval = 100; | ||
1061 | conf->dtim_count = 1; | ||
1062 | conf->bmiss_timeout = ATH_DEFAULT_BMISS_LIMIT * conf->listen_interval; | ||
1063 | } | ||
1064 | |||
1065 | void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | ||
1066 | struct ath_xmit_status *tx_status, struct ath_node *an) | ||
1067 | { | ||
1068 | struct ieee80211_hw *hw = sc->hw; | ||
1069 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
1070 | |||
1071 | DPRINTF(sc, ATH_DBG_XMIT, | ||
1072 | "%s: TX complete: skb: %p\n", __func__, skb); | ||
1073 | |||
1074 | if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK || | ||
1075 | tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) { | ||
1076 | /* free driver's private data area of tx_info */ | ||
1077 | if (tx_info->driver_data[0] != NULL) | ||
1078 | kfree(tx_info->driver_data[0]); | ||
1079 | tx_info->driver_data[0] = NULL; | ||
1080 | } | ||
1081 | |||
1082 | if (tx_status->flags & ATH_TX_BAR) { | ||
1083 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; | ||
1084 | tx_status->flags &= ~ATH_TX_BAR; | ||
1085 | } | ||
1086 | |||
1087 | if (tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY)) { | ||
1088 | if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { | ||
1089 | /* Frame was not ACKed, but an ACK was expected */ | ||
1090 | tx_info->status.excessive_retries = 1; | ||
1091 | } | ||
1092 | } else { | ||
1093 | /* Frame was ACKed */ | ||
1094 | tx_info->flags |= IEEE80211_TX_STAT_ACK; | ||
1095 | } | ||
1096 | |||
1097 | tx_info->status.retry_count = tx_status->retries; | ||
1098 | |||
1099 | ieee80211_tx_status(hw, skb); | ||
1100 | if (an) | ||
1101 | ath_node_put(sc, an, ATH9K_BH_STATUS_CHANGE); | ||
1102 | } | ||
1103 | |||
1104 | int _ath_rx_indicate(struct ath_softc *sc, | ||
1105 | struct sk_buff *skb, | ||
1106 | struct ath_recv_status *status, | ||
1107 | u16 keyix) | ||
1108 | { | ||
1109 | struct ieee80211_hw *hw = sc->hw; | ||
1110 | struct ath_node *an = NULL; | ||
1111 | struct ieee80211_rx_status rx_status; | ||
1112 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
1113 | int hdrlen = ieee80211_get_hdrlen_from_skb(skb); | ||
1114 | int padsize; | ||
1115 | enum ATH_RX_TYPE st; | ||
1116 | |||
1117 | /* see if any padding is done by the hw and remove it */ | ||
1118 | if (hdrlen & 3) { | ||
1119 | padsize = hdrlen % 4; | ||
1120 | memmove(skb->data + padsize, skb->data, hdrlen); | ||
1121 | skb_pull(skb, padsize); | ||
1122 | } | ||
1123 | |||
1124 | /* Prepare rx status */ | ||
1125 | ath9k_rx_prepare(sc, skb, status, &rx_status); | ||
1126 | |||
1127 | if (!(keyix == ATH9K_RXKEYIX_INVALID) && | ||
1128 | !(status->flags & ATH_RX_DECRYPT_ERROR)) { | ||
1129 | rx_status.flag |= RX_FLAG_DECRYPTED; | ||
1130 | } else if ((le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_PROTECTED) | ||
1131 | && !(status->flags & ATH_RX_DECRYPT_ERROR) | ||
1132 | && skb->len >= hdrlen + 4) { | ||
1133 | keyix = skb->data[hdrlen + 3] >> 6; | ||
1134 | |||
1135 | if (test_bit(keyix, sc->sc_keymap)) | ||
1136 | rx_status.flag |= RX_FLAG_DECRYPTED; | ||
1137 | } | ||
1138 | |||
1139 | spin_lock_bh(&sc->node_lock); | ||
1140 | an = ath_node_find(sc, hdr->addr2); | ||
1141 | spin_unlock_bh(&sc->node_lock); | ||
1142 | |||
1143 | if (an) { | ||
1144 | ath_rx_input(sc, an, | ||
1145 | hw->conf.ht_conf.ht_supported, | ||
1146 | skb, status, &st); | ||
1147 | } | ||
1148 | if (!an || (st != ATH_RX_CONSUMED)) | ||
1149 | __ieee80211_rx(hw, skb, &rx_status); | ||
1150 | |||
1151 | return 0; | ||
1152 | } | ||
1153 | |||
1154 | int ath_rx_subframe(struct ath_node *an, | ||
1155 | struct sk_buff *skb, | ||
1156 | struct ath_recv_status *status) | ||
1157 | { | ||
1158 | struct ath_softc *sc = an->an_sc; | ||
1159 | struct ieee80211_hw *hw = sc->hw; | ||
1160 | struct ieee80211_rx_status rx_status; | ||
1161 | |||
1162 | /* Prepare rx status */ | ||
1163 | ath9k_rx_prepare(sc, skb, status, &rx_status); | ||
1164 | if (!(status->flags & ATH_RX_DECRYPT_ERROR)) | ||
1165 | rx_status.flag |= RX_FLAG_DECRYPTED; | ||
1166 | |||
1167 | __ieee80211_rx(hw, skb, &rx_status); | ||
1168 | |||
1169 | return 0; | ||
1170 | } | ||
1171 | |||
1172 | /********************************/ | ||
1173 | /* LED functions */ | ||
1174 | /********************************/ | ||
1175 | |||
1176 | static void ath_led_brightness(struct led_classdev *led_cdev, | ||
1177 | enum led_brightness brightness) | ||
1178 | { | ||
1179 | struct ath_led *led = container_of(led_cdev, struct ath_led, led_cdev); | ||
1180 | struct ath_softc *sc = led->sc; | ||
1181 | |||
1182 | switch (brightness) { | ||
1183 | case LED_OFF: | ||
1184 | if (led->led_type == ATH_LED_ASSOC || | ||
1185 | led->led_type == ATH_LED_RADIO) | ||
1186 | sc->sc_flags &= ~SC_OP_LED_ASSOCIATED; | ||
1187 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, | ||
1188 | (led->led_type == ATH_LED_RADIO) ? 1 : | ||
1189 | !!(sc->sc_flags & SC_OP_LED_ASSOCIATED)); | ||
1190 | break; | ||
1191 | case LED_FULL: | ||
1192 | if (led->led_type == ATH_LED_ASSOC) | ||
1193 | sc->sc_flags |= SC_OP_LED_ASSOCIATED; | ||
1194 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0); | ||
1195 | break; | ||
1196 | default: | ||
1197 | break; | ||
1198 | } | ||
1199 | } | ||
1200 | |||
1201 | static int ath_register_led(struct ath_softc *sc, struct ath_led *led, | ||
1202 | char *trigger) | ||
1203 | { | ||
1204 | int ret; | ||
1205 | |||
1206 | led->sc = sc; | ||
1207 | led->led_cdev.name = led->name; | ||
1208 | led->led_cdev.default_trigger = trigger; | ||
1209 | led->led_cdev.brightness_set = ath_led_brightness; | ||
1210 | |||
1211 | ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &led->led_cdev); | ||
1212 | if (ret) | ||
1213 | DPRINTF(sc, ATH_DBG_FATAL, | ||
1214 | "Failed to register led:%s", led->name); | ||
1215 | else | ||
1216 | led->registered = 1; | ||
1217 | return ret; | ||
1218 | } | ||
1219 | |||
1220 | static void ath_unregister_led(struct ath_led *led) | ||
1221 | { | ||
1222 | if (led->registered) { | ||
1223 | led_classdev_unregister(&led->led_cdev); | ||
1224 | led->registered = 0; | ||
1225 | } | ||
1226 | } | ||
1227 | |||
1228 | static void ath_deinit_leds(struct ath_softc *sc) | ||
1229 | { | ||
1230 | ath_unregister_led(&sc->assoc_led); | ||
1231 | sc->sc_flags &= ~SC_OP_LED_ASSOCIATED; | ||
1232 | ath_unregister_led(&sc->tx_led); | ||
1233 | ath_unregister_led(&sc->rx_led); | ||
1234 | ath_unregister_led(&sc->radio_led); | ||
1235 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); | ||
1236 | } | ||
1237 | |||
1238 | static void ath_init_leds(struct ath_softc *sc) | ||
1239 | { | ||
1240 | char *trigger; | ||
1241 | int ret; | ||
1242 | |||
1243 | /* Configure gpio 1 for output */ | ||
1244 | ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN, | ||
1245 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||
1246 | /* LED off, active low */ | ||
1247 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); | ||
1248 | |||
1249 | trigger = ieee80211_get_radio_led_name(sc->hw); | ||
1250 | snprintf(sc->radio_led.name, sizeof(sc->radio_led.name), | ||
1251 | "ath9k-%s:radio", wiphy_name(sc->hw->wiphy)); | ||
1252 | ret = ath_register_led(sc, &sc->radio_led, trigger); | ||
1253 | sc->radio_led.led_type = ATH_LED_RADIO; | ||
1254 | if (ret) | ||
1255 | goto fail; | ||
1256 | |||
1257 | trigger = ieee80211_get_assoc_led_name(sc->hw); | ||
1258 | snprintf(sc->assoc_led.name, sizeof(sc->assoc_led.name), | ||
1259 | "ath9k-%s:assoc", wiphy_name(sc->hw->wiphy)); | ||
1260 | ret = ath_register_led(sc, &sc->assoc_led, trigger); | ||
1261 | sc->assoc_led.led_type = ATH_LED_ASSOC; | ||
1262 | if (ret) | ||
1263 | goto fail; | ||
1264 | |||
1265 | trigger = ieee80211_get_tx_led_name(sc->hw); | ||
1266 | snprintf(sc->tx_led.name, sizeof(sc->tx_led.name), | ||
1267 | "ath9k-%s:tx", wiphy_name(sc->hw->wiphy)); | ||
1268 | ret = ath_register_led(sc, &sc->tx_led, trigger); | ||
1269 | sc->tx_led.led_type = ATH_LED_TX; | ||
1270 | if (ret) | ||
1271 | goto fail; | ||
1272 | |||
1273 | trigger = ieee80211_get_rx_led_name(sc->hw); | ||
1274 | snprintf(sc->rx_led.name, sizeof(sc->rx_led.name), | ||
1275 | "ath9k-%s:rx", wiphy_name(sc->hw->wiphy)); | ||
1276 | ret = ath_register_led(sc, &sc->rx_led, trigger); | ||
1277 | sc->rx_led.led_type = ATH_LED_RX; | ||
1278 | if (ret) | ||
1279 | goto fail; | ||
1280 | |||
1281 | return; | ||
1282 | |||
1283 | fail: | ||
1284 | ath_deinit_leds(sc); | ||
1285 | } | ||
1286 | |||
1287 | static int ath_detach(struct ath_softc *sc) | ||
1288 | { | ||
1289 | struct ieee80211_hw *hw = sc->hw; | ||
1290 | |||
1291 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Detach ATH hw\n", __func__); | ||
1292 | |||
1293 | /* Deinit LED control */ | ||
1294 | ath_deinit_leds(sc); | ||
1295 | |||
1296 | /* Unregister hw */ | ||
1297 | |||
1298 | ieee80211_unregister_hw(hw); | ||
1299 | |||
1300 | /* unregister Rate control */ | ||
1301 | ath_rate_control_unregister(); | ||
1302 | |||
1303 | /* tx/rx cleanup */ | ||
1304 | |||
1305 | ath_rx_cleanup(sc); | ||
1306 | ath_tx_cleanup(sc); | ||
1307 | |||
1308 | /* Deinit */ | ||
1309 | |||
1310 | ath_deinit(sc); | ||
1311 | |||
1312 | return 0; | ||
1313 | } | ||
1314 | |||
1315 | static int ath_attach(u16 devid, | ||
1316 | struct ath_softc *sc) | ||
1317 | { | ||
1318 | struct ieee80211_hw *hw = sc->hw; | ||
1319 | int error = 0; | ||
1320 | |||
1321 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Attach ATH hw\n", __func__); | ||
1322 | |||
1323 | error = ath_init(devid, sc); | ||
1324 | if (error != 0) | ||
1325 | return error; | ||
1326 | |||
1327 | /* Init nodes */ | ||
1328 | |||
1329 | INIT_LIST_HEAD(&sc->node_list); | ||
1330 | spin_lock_init(&sc->node_lock); | ||
1331 | |||
1332 | /* get mac address from hardware and set in mac80211 */ | ||
1333 | |||
1334 | SET_IEEE80211_PERM_ADDR(hw, sc->sc_myaddr); | ||
1335 | |||
1336 | /* setup channels and rates */ | ||
1337 | |||
1338 | sc->sbands[IEEE80211_BAND_2GHZ].channels = | ||
1339 | sc->channels[IEEE80211_BAND_2GHZ]; | ||
1340 | sc->sbands[IEEE80211_BAND_2GHZ].bitrates = | ||
1341 | sc->rates[IEEE80211_BAND_2GHZ]; | ||
1342 | sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; | ||
1343 | |||
1344 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) | ||
1345 | /* Setup HT capabilities for 2.4Ghz*/ | ||
1346 | setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_info); | ||
1347 | |||
1348 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | ||
1349 | &sc->sbands[IEEE80211_BAND_2GHZ]; | ||
1350 | |||
1351 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->ah_caps.wireless_modes)) { | ||
1352 | sc->sbands[IEEE80211_BAND_5GHZ].channels = | ||
1353 | sc->channels[IEEE80211_BAND_5GHZ]; | ||
1354 | sc->sbands[IEEE80211_BAND_5GHZ].bitrates = | ||
1355 | sc->rates[IEEE80211_BAND_5GHZ]; | ||
1356 | sc->sbands[IEEE80211_BAND_5GHZ].band = | ||
1357 | IEEE80211_BAND_5GHZ; | ||
1358 | |||
1359 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) | ||
1360 | /* Setup HT capabilities for 5Ghz*/ | ||
1361 | setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_info); | ||
1362 | |||
1363 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | ||
1364 | &sc->sbands[IEEE80211_BAND_5GHZ]; | ||
1365 | } | ||
1366 | |||
1367 | /* FIXME: Have to figure out proper hw init values later */ | ||
1368 | |||
1369 | hw->queues = 4; | ||
1370 | hw->ampdu_queues = 1; | ||
1371 | |||
1372 | /* Register rate control */ | ||
1373 | hw->rate_control_algorithm = "ath9k_rate_control"; | ||
1374 | error = ath_rate_control_register(); | ||
1375 | if (error != 0) { | ||
1376 | DPRINTF(sc, ATH_DBG_FATAL, | ||
1377 | "%s: Unable to register rate control " | ||
1378 | "algorithm:%d\n", __func__, error); | ||
1379 | ath_rate_control_unregister(); | ||
1380 | goto bad; | ||
1381 | } | ||
1382 | |||
1383 | error = ieee80211_register_hw(hw); | ||
1384 | if (error != 0) { | ||
1385 | ath_rate_control_unregister(); | ||
1386 | goto bad; | ||
1387 | } | ||
1388 | |||
1389 | /* Initialize LED control */ | ||
1390 | ath_init_leds(sc); | ||
1391 | |||
1392 | /* initialize tx/rx engine */ | ||
1393 | |||
1394 | error = ath_tx_init(sc, ATH_TXBUF); | ||
1395 | if (error != 0) | ||
1396 | goto detach; | ||
1397 | |||
1398 | error = ath_rx_init(sc, ATH_RXBUF); | ||
1399 | if (error != 0) | ||
1400 | goto detach; | ||
1401 | |||
1402 | return 0; | ||
1403 | detach: | ||
1404 | ath_detach(sc); | ||
1405 | bad: | ||
1406 | return error; | ||
1407 | } | ||
1408 | |||
1409 | static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 1657 | static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
1410 | { | 1658 | { |
1411 | void __iomem *mem; | 1659 | void __iomem *mem; |
@@ -1554,6 +1802,12 @@ static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1554 | struct ath_softc *sc = hw->priv; | 1802 | struct ath_softc *sc = hw->priv; |
1555 | 1803 | ||
1556 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); | 1804 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); |
1805 | |||
1806 | #ifdef CONFIG_RFKILL | ||
1807 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT) | ||
1808 | cancel_delayed_work_sync(&sc->rf_kill.rfkill_poll); | ||
1809 | #endif | ||
1810 | |||
1557 | pci_save_state(pdev); | 1811 | pci_save_state(pdev); |
1558 | pci_disable_device(pdev); | 1812 | pci_disable_device(pdev); |
1559 | pci_set_power_state(pdev, 3); | 1813 | pci_set_power_state(pdev, 3); |
@@ -1586,6 +1840,16 @@ static int ath_pci_resume(struct pci_dev *pdev) | |||
1586 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | 1840 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); |
1587 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); | 1841 | ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1); |
1588 | 1842 | ||
1843 | #ifdef CONFIG_RFKILL | ||
1844 | /* | ||
1845 | * check the h/w rfkill state on resume | ||
1846 | * and start the rfkill poll timer | ||
1847 | */ | ||
1848 | if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT) | ||
1849 | queue_delayed_work(sc->hw->workqueue, | ||
1850 | &sc->rf_kill.rfkill_poll, 0); | ||
1851 | #endif | ||
1852 | |||
1589 | return 0; | 1853 | return 0; |
1590 | } | 1854 | } |
1591 | 1855 | ||
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c index 390019ed398e..1cc9daf44550 100644 --- a/drivers/net/wireless/ath9k/rc.c +++ b/drivers/net/wireless/ath9k/rc.c | |||
@@ -1825,7 +1825,7 @@ static void ath_setup_rates(struct ieee80211_local *local, struct sta_info *sta) | |||
1825 | 1825 | ||
1826 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1826 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
1827 | for (i = 0; i < sband->n_bitrates; i++) { | 1827 | for (i = 0; i < sband->n_bitrates; i++) { |
1828 | if (sta->supp_rates[local->hw.conf.channel->band] & BIT(i)) { | 1828 | if (sta->sta.supp_rates[local->hw.conf.channel->band] & BIT(i)) { |
1829 | rc_priv->neg_rates.rs_rates[j] | 1829 | rc_priv->neg_rates.rs_rates[j] |
1830 | = (sband->bitrates[i].bitrate * 2) / 10; | 1830 | = (sband->bitrates[i].bitrate * 2) / 10; |
1831 | j++; | 1831 | j++; |
@@ -2039,7 +2039,6 @@ static void ath_rate_init(void *priv, void *priv_sta, | |||
2039 | DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); | 2039 | DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); |
2040 | 2040 | ||
2041 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2041 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
2042 | sta->txrate_idx = rate_lowest_index(local, sband, sta); | ||
2043 | 2042 | ||
2044 | ath_setup_rates(local, sta); | 2043 | ath_setup_rates(local, sta); |
2045 | if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { | 2044 | if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 07d2825458ab..427b8203e3f9 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -569,7 +569,7 @@ struct b43_key { | |||
569 | #define B43_QOS_VOICE B43_QOS_PARAMS(3) | 569 | #define B43_QOS_VOICE B43_QOS_PARAMS(3) |
570 | 570 | ||
571 | /* QOS parameter hardware data structure offsets. */ | 571 | /* QOS parameter hardware data structure offsets. */ |
572 | #define B43_NR_QOSPARAMS 22 | 572 | #define B43_NR_QOSPARAMS 16 |
573 | enum { | 573 | enum { |
574 | B43_QOSPARAM_TXOP = 0, | 574 | B43_QOSPARAM_TXOP = 0, |
575 | B43_QOSPARAM_CWMIN, | 575 | B43_QOSPARAM_CWMIN, |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index d4a356b11636..0f628a29d833 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1244,13 +1244,13 @@ generate_new: | |||
1244 | 1244 | ||
1245 | static void handle_irq_tbtt_indication(struct b43_wldev *dev) | 1245 | static void handle_irq_tbtt_indication(struct b43_wldev *dev) |
1246 | { | 1246 | { |
1247 | if (b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) { | 1247 | if (b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) { |
1248 | ///TODO: PS TBTT | 1248 | ///TODO: PS TBTT |
1249 | } else { | 1249 | } else { |
1250 | if (1 /*FIXME: the last PSpoll frame was sent successfully */ ) | 1250 | if (1 /*FIXME: the last PSpoll frame was sent successfully */ ) |
1251 | b43_power_saving_ctl_bits(dev, 0); | 1251 | b43_power_saving_ctl_bits(dev, 0); |
1252 | } | 1252 | } |
1253 | if (b43_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS)) | 1253 | if (b43_is_mode(dev->wl, NL80211_IFTYPE_ADHOC)) |
1254 | dev->dfq_valid = 1; | 1254 | dev->dfq_valid = 1; |
1255 | } | 1255 | } |
1256 | 1256 | ||
@@ -1599,8 +1599,8 @@ static void handle_irq_beacon(struct b43_wldev *dev) | |||
1599 | struct b43_wl *wl = dev->wl; | 1599 | struct b43_wl *wl = dev->wl; |
1600 | u32 cmd, beacon0_valid, beacon1_valid; | 1600 | u32 cmd, beacon0_valid, beacon1_valid; |
1601 | 1601 | ||
1602 | if (!b43_is_mode(wl, IEEE80211_IF_TYPE_AP) && | 1602 | if (!b43_is_mode(wl, NL80211_IFTYPE_AP) && |
1603 | !b43_is_mode(wl, IEEE80211_IF_TYPE_MESH_POINT)) | 1603 | !b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT)) |
1604 | return; | 1604 | return; |
1605 | 1605 | ||
1606 | /* This is the bottom half of the asynchronous beacon update. */ | 1606 | /* This is the bottom half of the asynchronous beacon update. */ |
@@ -2568,10 +2568,10 @@ static void b43_adjust_opmode(struct b43_wldev *dev) | |||
2568 | ctl &= ~B43_MACCTL_BEACPROMISC; | 2568 | ctl &= ~B43_MACCTL_BEACPROMISC; |
2569 | ctl |= B43_MACCTL_INFRA; | 2569 | ctl |= B43_MACCTL_INFRA; |
2570 | 2570 | ||
2571 | if (b43_is_mode(wl, IEEE80211_IF_TYPE_AP) || | 2571 | if (b43_is_mode(wl, NL80211_IFTYPE_AP) || |
2572 | b43_is_mode(wl, IEEE80211_IF_TYPE_MESH_POINT)) | 2572 | b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT)) |
2573 | ctl |= B43_MACCTL_AP; | 2573 | ctl |= B43_MACCTL_AP; |
2574 | else if (b43_is_mode(wl, IEEE80211_IF_TYPE_IBSS)) | 2574 | else if (b43_is_mode(wl, NL80211_IFTYPE_ADHOC)) |
2575 | ctl &= ~B43_MACCTL_INFRA; | 2575 | ctl &= ~B43_MACCTL_INFRA; |
2576 | 2576 | ||
2577 | if (wl->filter_flags & FIF_CONTROL) | 2577 | if (wl->filter_flags & FIF_CONTROL) |
@@ -3406,8 +3406,8 @@ static int b43_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | |||
3406 | phy->ops->set_rx_antenna(dev, antenna); | 3406 | phy->ops->set_rx_antenna(dev, antenna); |
3407 | 3407 | ||
3408 | /* Update templates for AP/mesh mode. */ | 3408 | /* Update templates for AP/mesh mode. */ |
3409 | if (b43_is_mode(wl, IEEE80211_IF_TYPE_AP) || | 3409 | if (b43_is_mode(wl, NL80211_IFTYPE_AP) || |
3410 | b43_is_mode(wl, IEEE80211_IF_TYPE_MESH_POINT)) | 3410 | b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT)) |
3411 | b43_set_beacon_int(dev, conf->beacon_int); | 3411 | b43_set_beacon_int(dev, conf->beacon_int); |
3412 | 3412 | ||
3413 | if (!!conf->radio_enabled != phy->radio_on) { | 3413 | if (!!conf->radio_enabled != phy->radio_on) { |
@@ -3595,14 +3595,14 @@ static int b43_op_config_interface(struct ieee80211_hw *hw, | |||
3595 | else | 3595 | else |
3596 | memset(wl->bssid, 0, ETH_ALEN); | 3596 | memset(wl->bssid, 0, ETH_ALEN); |
3597 | if (b43_status(dev) >= B43_STAT_INITIALIZED) { | 3597 | if (b43_status(dev) >= B43_STAT_INITIALIZED) { |
3598 | if (b43_is_mode(wl, IEEE80211_IF_TYPE_AP) || | 3598 | if (b43_is_mode(wl, NL80211_IFTYPE_AP) || |
3599 | b43_is_mode(wl, IEEE80211_IF_TYPE_MESH_POINT)) { | 3599 | b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT)) { |
3600 | B43_WARN_ON(vif->type != wl->if_type); | 3600 | B43_WARN_ON(vif->type != wl->if_type); |
3601 | if (conf->changed & IEEE80211_IFCC_SSID) | 3601 | if (conf->changed & IEEE80211_IFCC_SSID) |
3602 | b43_set_ssid(dev, conf->ssid, conf->ssid_len); | 3602 | b43_set_ssid(dev, conf->ssid, conf->ssid_len); |
3603 | if (conf->changed & IEEE80211_IFCC_BEACON) | 3603 | if (conf->changed & IEEE80211_IFCC_BEACON) |
3604 | b43_update_templates(wl); | 3604 | b43_update_templates(wl); |
3605 | } else if (b43_is_mode(wl, IEEE80211_IF_TYPE_IBSS)) { | 3605 | } else if (b43_is_mode(wl, NL80211_IFTYPE_ADHOC)) { |
3606 | if (conf->changed & IEEE80211_IFCC_BEACON) | 3606 | if (conf->changed & IEEE80211_IFCC_BEACON) |
3607 | b43_update_templates(wl); | 3607 | b43_update_templates(wl); |
3608 | } | 3608 | } |
@@ -3903,7 +3903,7 @@ static void b43_set_synth_pu_delay(struct b43_wldev *dev, bool idle) | |||
3903 | pu_delay = 3700; | 3903 | pu_delay = 3700; |
3904 | else | 3904 | else |
3905 | pu_delay = 1050; | 3905 | pu_delay = 1050; |
3906 | if (b43_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS) || idle) | 3906 | if (b43_is_mode(dev->wl, NL80211_IFTYPE_ADHOC) || idle) |
3907 | pu_delay = 500; | 3907 | pu_delay = 500; |
3908 | if ((dev->phy.radio_ver == 0x2050) && (dev->phy.radio_rev == 8)) | 3908 | if ((dev->phy.radio_ver == 0x2050) && (dev->phy.radio_rev == 8)) |
3909 | pu_delay = max(pu_delay, (u16)2400); | 3909 | pu_delay = max(pu_delay, (u16)2400); |
@@ -3917,7 +3917,7 @@ static void b43_set_pretbtt(struct b43_wldev *dev) | |||
3917 | u16 pretbtt; | 3917 | u16 pretbtt; |
3918 | 3918 | ||
3919 | /* The time value is in microseconds. */ | 3919 | /* The time value is in microseconds. */ |
3920 | if (b43_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS)) { | 3920 | if (b43_is_mode(dev->wl, NL80211_IFTYPE_ADHOC)) { |
3921 | pretbtt = 2; | 3921 | pretbtt = 2; |
3922 | } else { | 3922 | } else { |
3923 | if (dev->phy.type == B43_PHYTYPE_A) | 3923 | if (dev->phy.type == B43_PHYTYPE_A) |
@@ -4084,11 +4084,11 @@ static int b43_op_add_interface(struct ieee80211_hw *hw, | |||
4084 | 4084 | ||
4085 | /* TODO: allow WDS/AP devices to coexist */ | 4085 | /* TODO: allow WDS/AP devices to coexist */ |
4086 | 4086 | ||
4087 | if (conf->type != IEEE80211_IF_TYPE_AP && | 4087 | if (conf->type != NL80211_IFTYPE_AP && |
4088 | conf->type != IEEE80211_IF_TYPE_MESH_POINT && | 4088 | conf->type != NL80211_IFTYPE_MESH_POINT && |
4089 | conf->type != IEEE80211_IF_TYPE_STA && | 4089 | conf->type != NL80211_IFTYPE_STATION && |
4090 | conf->type != IEEE80211_IF_TYPE_WDS && | 4090 | conf->type != NL80211_IFTYPE_WDS && |
4091 | conf->type != IEEE80211_IF_TYPE_IBSS) | 4091 | conf->type != NL80211_IFTYPE_ADHOC) |
4092 | return -EOPNOTSUPP; | 4092 | return -EOPNOTSUPP; |
4093 | 4093 | ||
4094 | mutex_lock(&wl->mutex); | 4094 | mutex_lock(&wl->mutex); |
@@ -4234,7 +4234,8 @@ out_unlock: | |||
4234 | return err; | 4234 | return err; |
4235 | } | 4235 | } |
4236 | 4236 | ||
4237 | static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, int aid, int set) | 4237 | static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, |
4238 | struct ieee80211_sta *sta, bool set) | ||
4238 | { | 4239 | { |
4239 | struct b43_wl *wl = hw_to_b43_wl(hw); | 4240 | struct b43_wl *wl = hw_to_b43_wl(hw); |
4240 | unsigned long flags; | 4241 | unsigned long flags; |
@@ -4249,7 +4250,7 @@ static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, int aid, int set) | |||
4249 | static void b43_op_sta_notify(struct ieee80211_hw *hw, | 4250 | static void b43_op_sta_notify(struct ieee80211_hw *hw, |
4250 | struct ieee80211_vif *vif, | 4251 | struct ieee80211_vif *vif, |
4251 | enum sta_notify_cmd notify_cmd, | 4252 | enum sta_notify_cmd notify_cmd, |
4252 | const u8 *addr) | 4253 | struct ieee80211_sta *sta) |
4253 | { | 4254 | { |
4254 | struct b43_wl *wl = hw_to_b43_wl(hw); | 4255 | struct b43_wl *wl = hw_to_b43_wl(hw); |
4255 | 4256 | ||
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index 4d4345d76abf..af37abccccb3 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
@@ -162,7 +162,7 @@ void b43_phy_lock(struct b43_wldev *dev) | |||
162 | #endif | 162 | #endif |
163 | B43_WARN_ON(dev->dev->id.revision < 3); | 163 | B43_WARN_ON(dev->dev->id.revision < 3); |
164 | 164 | ||
165 | if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) | 165 | if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) |
166 | b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); | 166 | b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); |
167 | } | 167 | } |
168 | 168 | ||
@@ -174,7 +174,7 @@ void b43_phy_unlock(struct b43_wldev *dev) | |||
174 | #endif | 174 | #endif |
175 | B43_WARN_ON(dev->dev->id.revision < 3); | 175 | B43_WARN_ON(dev->dev->id.revision < 3); |
176 | 176 | ||
177 | if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) | 177 | if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) |
178 | b43_power_saving_ctl_bits(dev, 0); | 178 | b43_power_saving_ctl_bits(dev, 0); |
179 | } | 179 | } |
180 | 180 | ||
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 68f63f5093af..9fb1421cbec2 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -888,13 +888,13 @@ generate_new: | |||
888 | 888 | ||
889 | static void handle_irq_tbtt_indication(struct b43legacy_wldev *dev) | 889 | static void handle_irq_tbtt_indication(struct b43legacy_wldev *dev) |
890 | { | 890 | { |
891 | if (b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) { | 891 | if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_AP)) { |
892 | /* TODO: PS TBTT */ | 892 | /* TODO: PS TBTT */ |
893 | } else { | 893 | } else { |
894 | if (1/*FIXME: the last PSpoll frame was sent successfully */) | 894 | if (1/*FIXME: the last PSpoll frame was sent successfully */) |
895 | b43legacy_power_saving_ctl_bits(dev, -1, -1); | 895 | b43legacy_power_saving_ctl_bits(dev, -1, -1); |
896 | } | 896 | } |
897 | if (b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS)) | 897 | if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC)) |
898 | dev->dfq_valid = 1; | 898 | dev->dfq_valid = 1; |
899 | } | 899 | } |
900 | 900 | ||
@@ -1201,7 +1201,7 @@ static void handle_irq_beacon(struct b43legacy_wldev *dev) | |||
1201 | struct b43legacy_wl *wl = dev->wl; | 1201 | struct b43legacy_wl *wl = dev->wl; |
1202 | u32 cmd; | 1202 | u32 cmd; |
1203 | 1203 | ||
1204 | if (!b43legacy_is_mode(wl, IEEE80211_IF_TYPE_AP)) | 1204 | if (!b43legacy_is_mode(wl, NL80211_IFTYPE_AP)) |
1205 | return; | 1205 | return; |
1206 | 1206 | ||
1207 | /* This is the bottom half of the asynchronous beacon update. */ | 1207 | /* This is the bottom half of the asynchronous beacon update. */ |
@@ -1936,9 +1936,9 @@ static void b43legacy_adjust_opmode(struct b43legacy_wldev *dev) | |||
1936 | ctl &= ~B43legacy_MACCTL_BEACPROMISC; | 1936 | ctl &= ~B43legacy_MACCTL_BEACPROMISC; |
1937 | ctl |= B43legacy_MACCTL_INFRA; | 1937 | ctl |= B43legacy_MACCTL_INFRA; |
1938 | 1938 | ||
1939 | if (b43legacy_is_mode(wl, IEEE80211_IF_TYPE_AP)) | 1939 | if (b43legacy_is_mode(wl, NL80211_IFTYPE_AP)) |
1940 | ctl |= B43legacy_MACCTL_AP; | 1940 | ctl |= B43legacy_MACCTL_AP; |
1941 | else if (b43legacy_is_mode(wl, IEEE80211_IF_TYPE_IBSS)) | 1941 | else if (b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC)) |
1942 | ctl &= ~B43legacy_MACCTL_INFRA; | 1942 | ctl &= ~B43legacy_MACCTL_INFRA; |
1943 | 1943 | ||
1944 | if (wl->filter_flags & FIF_CONTROL) | 1944 | if (wl->filter_flags & FIF_CONTROL) |
@@ -2646,7 +2646,7 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw, | |||
2646 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); | 2646 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); |
2647 | 2647 | ||
2648 | /* Update templates for AP mode. */ | 2648 | /* Update templates for AP mode. */ |
2649 | if (b43legacy_is_mode(wl, IEEE80211_IF_TYPE_AP)) | 2649 | if (b43legacy_is_mode(wl, NL80211_IFTYPE_AP)) |
2650 | b43legacy_set_beacon_int(dev, conf->beacon_int); | 2650 | b43legacy_set_beacon_int(dev, conf->beacon_int); |
2651 | 2651 | ||
2652 | 2652 | ||
@@ -2733,12 +2733,12 @@ static int b43legacy_op_config_interface(struct ieee80211_hw *hw, | |||
2733 | else | 2733 | else |
2734 | memset(wl->bssid, 0, ETH_ALEN); | 2734 | memset(wl->bssid, 0, ETH_ALEN); |
2735 | if (b43legacy_status(dev) >= B43legacy_STAT_INITIALIZED) { | 2735 | if (b43legacy_status(dev) >= B43legacy_STAT_INITIALIZED) { |
2736 | if (b43legacy_is_mode(wl, IEEE80211_IF_TYPE_AP)) { | 2736 | if (b43legacy_is_mode(wl, NL80211_IFTYPE_AP)) { |
2737 | B43legacy_WARN_ON(vif->type != IEEE80211_IF_TYPE_AP); | 2737 | B43legacy_WARN_ON(vif->type != NL80211_IFTYPE_AP); |
2738 | b43legacy_set_ssid(dev, conf->ssid, conf->ssid_len); | 2738 | b43legacy_set_ssid(dev, conf->ssid, conf->ssid_len); |
2739 | if (conf->changed & IEEE80211_IFCC_BEACON) | 2739 | if (conf->changed & IEEE80211_IFCC_BEACON) |
2740 | b43legacy_update_templates(wl); | 2740 | b43legacy_update_templates(wl); |
2741 | } else if (b43legacy_is_mode(wl, IEEE80211_IF_TYPE_IBSS)) { | 2741 | } else if (b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC)) { |
2742 | if (conf->changed & IEEE80211_IFCC_BEACON) | 2742 | if (conf->changed & IEEE80211_IFCC_BEACON) |
2743 | b43legacy_update_templates(wl); | 2743 | b43legacy_update_templates(wl); |
2744 | } | 2744 | } |
@@ -3020,7 +3020,7 @@ static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev, | |||
3020 | bool idle) { | 3020 | bool idle) { |
3021 | u16 pu_delay = 1050; | 3021 | u16 pu_delay = 1050; |
3022 | 3022 | ||
3023 | if (b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS) || idle) | 3023 | if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC) || idle) |
3024 | pu_delay = 500; | 3024 | pu_delay = 500; |
3025 | if ((dev->phy.radio_ver == 0x2050) && (dev->phy.radio_rev == 8)) | 3025 | if ((dev->phy.radio_ver == 0x2050) && (dev->phy.radio_rev == 8)) |
3026 | pu_delay = max(pu_delay, (u16)2400); | 3026 | pu_delay = max(pu_delay, (u16)2400); |
@@ -3035,7 +3035,7 @@ static void b43legacy_set_pretbtt(struct b43legacy_wldev *dev) | |||
3035 | u16 pretbtt; | 3035 | u16 pretbtt; |
3036 | 3036 | ||
3037 | /* The time value is in microseconds. */ | 3037 | /* The time value is in microseconds. */ |
3038 | if (b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS)) | 3038 | if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC)) |
3039 | pretbtt = 2; | 3039 | pretbtt = 2; |
3040 | else | 3040 | else |
3041 | pretbtt = 250; | 3041 | pretbtt = 250; |
@@ -3259,10 +3259,10 @@ static int b43legacy_op_add_interface(struct ieee80211_hw *hw, | |||
3259 | 3259 | ||
3260 | /* TODO: allow WDS/AP devices to coexist */ | 3260 | /* TODO: allow WDS/AP devices to coexist */ |
3261 | 3261 | ||
3262 | if (conf->type != IEEE80211_IF_TYPE_AP && | 3262 | if (conf->type != NL80211_IFTYPE_AP && |
3263 | conf->type != IEEE80211_IF_TYPE_STA && | 3263 | conf->type != NL80211_IFTYPE_STATION && |
3264 | conf->type != IEEE80211_IF_TYPE_WDS && | 3264 | conf->type != NL80211_IFTYPE_WDS && |
3265 | conf->type != IEEE80211_IF_TYPE_IBSS) | 3265 | conf->type != NL80211_IFTYPE_ADHOC) |
3266 | return -EOPNOTSUPP; | 3266 | return -EOPNOTSUPP; |
3267 | 3267 | ||
3268 | mutex_lock(&wl->mutex); | 3268 | mutex_lock(&wl->mutex); |
@@ -3403,7 +3403,7 @@ out_unlock: | |||
3403 | } | 3403 | } |
3404 | 3404 | ||
3405 | static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw, | 3405 | static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw, |
3406 | int aid, int set) | 3406 | struct ieee80211_sta *sta, bool set) |
3407 | { | 3407 | { |
3408 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); | 3408 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); |
3409 | unsigned long flags; | 3409 | unsigned long flags; |
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c index bed67a54250c..4c9442b16f3f 100644 --- a/drivers/net/wireless/b43legacy/phy.c +++ b/drivers/net/wireless/b43legacy/phy.c | |||
@@ -103,7 +103,7 @@ void b43legacy_phy_lock(struct b43legacy_wldev *dev) | |||
103 | if (dev->dev->id.revision < 3) { | 103 | if (dev->dev->id.revision < 3) { |
104 | b43legacy_mac_suspend(dev); | 104 | b43legacy_mac_suspend(dev); |
105 | } else { | 105 | } else { |
106 | if (!b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) | 106 | if (!b43legacy_is_mode(dev->wl, NL80211_IFTYPE_AP)) |
107 | b43legacy_power_saving_ctl_bits(dev, -1, 1); | 107 | b43legacy_power_saving_ctl_bits(dev, -1, 1); |
108 | } | 108 | } |
109 | } | 109 | } |
@@ -118,7 +118,7 @@ void b43legacy_phy_unlock(struct b43legacy_wldev *dev) | |||
118 | if (dev->dev->id.revision < 3) { | 118 | if (dev->dev->id.revision < 3) { |
119 | b43legacy_mac_enable(dev); | 119 | b43legacy_mac_enable(dev); |
120 | } else { | 120 | } else { |
121 | if (!b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) | 121 | if (!b43legacy_is_mode(dev->wl, NL80211_IFTYPE_AP)) |
122 | b43legacy_power_saving_ctl_bits(dev, -1, -1); | 122 | b43legacy_power_saving_ctl_bits(dev, -1, -1); |
123 | } | 123 | } |
124 | } | 124 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 10c64bdb314c..a279bf1dc9b0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -65,6 +65,9 @@ struct iwl3945_rs_sta { | |||
65 | u8 ibss_sta_added; | 65 | u8 ibss_sta_added; |
66 | struct timer_list rate_scale_flush; | 66 | struct timer_list rate_scale_flush; |
67 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; | 67 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; |
68 | |||
69 | /* used to be in sta_info */ | ||
70 | int last_txrate_idx; | ||
68 | }; | 71 | }; |
69 | 72 | ||
70 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { | 73 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { |
@@ -319,6 +322,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, | |||
319 | static void rs_rate_init(void *priv_rate, void *priv_sta, | 322 | static void rs_rate_init(void *priv_rate, void *priv_sta, |
320 | struct ieee80211_local *local, struct sta_info *sta) | 323 | struct ieee80211_local *local, struct sta_info *sta) |
321 | { | 324 | { |
325 | struct iwl3945_rs_sta *rs_sta = (void *)sta->rate_ctrl_priv; | ||
322 | int i; | 326 | int i; |
323 | 327 | ||
324 | IWL_DEBUG_RATE("enter\n"); | 328 | IWL_DEBUG_RATE("enter\n"); |
@@ -329,17 +333,15 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
329 | * after assoc.. */ | 333 | * after assoc.. */ |
330 | 334 | ||
331 | for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { | 335 | for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { |
332 | if (sta->supp_rates[local->hw.conf.channel->band] & (1 << i)) { | 336 | if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) { |
333 | sta->txrate_idx = i; | 337 | rs_sta->last_txrate_idx = i; |
334 | break; | 338 | break; |
335 | } | 339 | } |
336 | } | 340 | } |
337 | 341 | ||
338 | sta->last_txrate_idx = sta->txrate_idx; | ||
339 | |||
340 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ | 342 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ |
341 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) | 343 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) |
342 | sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | 344 | rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
343 | 345 | ||
344 | IWL_DEBUG_RATE("leave\n"); | 346 | IWL_DEBUG_RATE("leave\n"); |
345 | } | 347 | } |
@@ -674,15 +676,15 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
674 | return; | 676 | return; |
675 | } | 677 | } |
676 | 678 | ||
677 | rate_mask = sta->supp_rates[sband->band]; | 679 | rs_sta = (void *)sta->rate_ctrl_priv; |
678 | index = min(sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); | 680 | |
681 | rate_mask = sta->sta.supp_rates[sband->band]; | ||
682 | index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); | ||
679 | 683 | ||
680 | if (sband->band == IEEE80211_BAND_5GHZ) | 684 | if (sband->band == IEEE80211_BAND_5GHZ) |
681 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; | 685 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; |
682 | 686 | ||
683 | rs_sta = (void *)sta->rate_ctrl_priv; | 687 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
684 | |||
685 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | ||
686 | !rs_sta->ibss_sta_added) { | 688 | !rs_sta->ibss_sta_added) { |
687 | u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); | 689 | u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); |
688 | 690 | ||
@@ -803,17 +805,15 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
803 | 805 | ||
804 | out: | 806 | out: |
805 | 807 | ||
806 | sta->last_txrate_idx = index; | 808 | rs_sta->last_txrate_idx = index; |
807 | if (sband->band == IEEE80211_BAND_5GHZ) | 809 | if (sband->band == IEEE80211_BAND_5GHZ) |
808 | sta->txrate_idx = sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; | 810 | sel->rate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; |
809 | else | 811 | else |
810 | sta->txrate_idx = sta->last_txrate_idx; | 812 | sel->rate_idx = rs_sta->last_txrate_idx; |
811 | 813 | ||
812 | rcu_read_unlock(); | 814 | rcu_read_unlock(); |
813 | 815 | ||
814 | IWL_DEBUG_RATE("leave: %d\n", index); | 816 | IWL_DEBUG_RATE("leave: %d\n", index); |
815 | |||
816 | sel->rate_idx = sta->txrate_idx; | ||
817 | } | 817 | } |
818 | 818 | ||
819 | static struct rate_control_ops rs_ops = { | 819 | static struct rate_control_ops rs_ops = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 3d100e898249..7ca5627cc078 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -520,10 +520,10 @@ static int iwl3945_is_network_packet(struct iwl3945_priv *priv, | |||
520 | /* Filter incoming packets to determine if they are targeted toward | 520 | /* Filter incoming packets to determine if they are targeted toward |
521 | * this network, discarding packets coming from ourselves */ | 521 | * this network, discarding packets coming from ourselves */ |
522 | switch (priv->iw_mode) { | 522 | switch (priv->iw_mode) { |
523 | case IEEE80211_IF_TYPE_IBSS: /* Header: Dest. | Source | BSSID */ | 523 | case NL80211_IFTYPE_ADHOC: /* Header: Dest. | Source | BSSID */ |
524 | /* packets to our IBSS update information */ | 524 | /* packets to our IBSS update information */ |
525 | return !compare_ether_addr(header->addr3, priv->bssid); | 525 | return !compare_ether_addr(header->addr3, priv->bssid); |
526 | case IEEE80211_IF_TYPE_STA: /* Header: Dest. | AP{BSSID} | Source */ | 526 | case NL80211_IFTYPE_STATION: /* Header: Dest. | AP{BSSID} | Source */ |
527 | /* packets to our IBSS update information */ | 527 | /* packets to our IBSS update information */ |
528 | return !compare_ether_addr(header->addr2, priv->bssid); | 528 | return !compare_ether_addr(header->addr2, priv->bssid); |
529 | default: | 529 | default: |
@@ -807,7 +807,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, | |||
807 | 807 | ||
808 | priv->stations[sta_id].current_rate.rate_n_flags = rate; | 808 | priv->stations[sta_id].current_rate.rate_n_flags = rate; |
809 | 809 | ||
810 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 810 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
811 | (sta_id != priv->hw_setting.bcast_sta_id) && | 811 | (sta_id != priv->hw_setting.bcast_sta_id) && |
812 | (sta_id != IWL_MULTICAST_ID)) | 812 | (sta_id != IWL_MULTICAST_ID)) |
813 | priv->stations[IWL_STA_ID].current_rate.rate_n_flags = rate; | 813 | priv->stations[IWL_STA_ID].current_rate.rate_n_flags = rate; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 9bbbc9d7c0e8..2a4933b5fb64 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -851,7 +851,7 @@ struct iwl3945_priv { | |||
851 | /* eeprom */ | 851 | /* eeprom */ |
852 | struct iwl3945_eeprom eeprom; | 852 | struct iwl3945_eeprom eeprom; |
853 | 853 | ||
854 | enum ieee80211_if_types iw_mode; | 854 | enum nl80211_iftype iw_mode; |
855 | 855 | ||
856 | struct sk_buff *ibss_beacon; | 856 | struct sk_buff *ibss_beacon; |
857 | 857 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index cccd84c2f8ea..f6003e7996af 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -1569,6 +1569,8 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
1569 | .mod_params = &iwl50_mod_params, | 1569 | .mod_params = &iwl50_mod_params, |
1570 | }; | 1570 | }; |
1571 | 1571 | ||
1572 | MODULE_FIRMWARE("iwlwifi-5000" IWL5000_UCODE_API ".ucode"); | ||
1573 | |||
1572 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); | 1574 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); |
1573 | MODULE_PARM_DESC(disable50, | 1575 | MODULE_PARM_DESC(disable50, |
1574 | "manually disable the 50XX radio (default 0 [radio on])"); | 1576 | "manually disable the 50XX radio (default 0 [radio on])"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index c293e5b6cbb5..8b57b390c8ba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -163,6 +163,9 @@ struct iwl_lq_sta { | |||
163 | u32 dbg_fixed_rate; | 163 | u32 dbg_fixed_rate; |
164 | #endif | 164 | #endif |
165 | struct iwl_priv *drv; | 165 | struct iwl_priv *drv; |
166 | |||
167 | /* used to be in sta_info */ | ||
168 | int last_txrate_idx; | ||
166 | }; | 169 | }; |
167 | 170 | ||
168 | static void rs_rate_scale_perform(struct iwl_priv *priv, | 171 | static void rs_rate_scale_perform(struct iwl_priv *priv, |
@@ -356,18 +359,12 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | |||
356 | struct iwl_lq_sta *lq_data, u8 tid, | 359 | struct iwl_lq_sta *lq_data, u8 tid, |
357 | struct sta_info *sta) | 360 | struct sta_info *sta) |
358 | { | 361 | { |
359 | unsigned long state; | ||
360 | DECLARE_MAC_BUF(mac); | 362 | DECLARE_MAC_BUF(mac); |
361 | 363 | ||
362 | spin_lock_bh(&sta->lock); | 364 | if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { |
363 | state = sta->ampdu_mlme.tid_state_tx[tid]; | ||
364 | spin_unlock_bh(&sta->lock); | ||
365 | |||
366 | if (state == HT_AGG_STATE_IDLE && | ||
367 | rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { | ||
368 | IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", | 365 | IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", |
369 | print_mac(mac, sta->addr), tid); | 366 | print_mac(mac, sta->sta.addr), tid); |
370 | ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid); | 367 | ieee80211_start_tx_ba_session(priv->hw, sta->sta.addr, tid); |
371 | } | 368 | } |
372 | } | 369 | } |
373 | 370 | ||
@@ -821,7 +818,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
821 | 818 | ||
822 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 819 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; |
823 | 820 | ||
824 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 821 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
825 | !lq_sta->ibss_sta_added) | 822 | !lq_sta->ibss_sta_added) |
826 | goto out; | 823 | goto out; |
827 | 824 | ||
@@ -1151,10 +1148,10 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
1151 | s8 is_green = lq_sta->is_green; | 1148 | s8 is_green = lq_sta->is_green; |
1152 | 1149 | ||
1153 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || | 1150 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || |
1154 | !sta->ht_info.ht_supported) | 1151 | !sta->sta.ht_info.ht_supported) |
1155 | return -1; | 1152 | return -1; |
1156 | 1153 | ||
1157 | if (((sta->ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) | 1154 | if (((sta->sta.ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) |
1158 | == WLAN_HT_CAP_SM_PS_STATIC) | 1155 | == WLAN_HT_CAP_SM_PS_STATIC) |
1159 | return -1; | 1156 | return -1; |
1160 | 1157 | ||
@@ -1219,7 +1216,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv, | |||
1219 | s32 rate; | 1216 | s32 rate; |
1220 | 1217 | ||
1221 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || | 1218 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || |
1222 | !sta->ht_info.ht_supported) | 1219 | !sta->sta.ht_info.ht_supported) |
1223 | return -1; | 1220 | return -1; |
1224 | 1221 | ||
1225 | IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); | 1222 | IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); |
@@ -1728,7 +1725,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1728 | return; | 1725 | return; |
1729 | 1726 | ||
1730 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 1727 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; |
1731 | lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; | 1728 | lq_sta->supp_rates = sta->sta.supp_rates[lq_sta->band]; |
1732 | 1729 | ||
1733 | tid = rs_tl_add_packet(lq_sta, hdr); | 1730 | tid = rs_tl_add_packet(lq_sta, hdr); |
1734 | 1731 | ||
@@ -1746,7 +1743,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1746 | is_green = lq_sta->is_green; | 1743 | is_green = lq_sta->is_green; |
1747 | 1744 | ||
1748 | /* current tx rate */ | 1745 | /* current tx rate */ |
1749 | index = sta->last_txrate_idx; | 1746 | index = lq_sta->last_txrate_idx; |
1750 | 1747 | ||
1751 | IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, | 1748 | IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, |
1752 | tbl->lq_type); | 1749 | tbl->lq_type); |
@@ -2059,15 +2056,7 @@ lq_update: | |||
2059 | out: | 2056 | out: |
2060 | tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green); | 2057 | tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green); |
2061 | i = index; | 2058 | i = index; |
2062 | sta->last_txrate_idx = i; | 2059 | lq_sta->last_txrate_idx = i; |
2063 | |||
2064 | /* sta->txrate_idx is an index to A mode rates which start | ||
2065 | * at IWL_FIRST_OFDM_RATE | ||
2066 | */ | ||
2067 | if (lq_sta->band == IEEE80211_BAND_5GHZ) | ||
2068 | sta->txrate_idx = i - IWL_FIRST_OFDM_RATE; | ||
2069 | else | ||
2070 | sta->txrate_idx = i; | ||
2071 | 2060 | ||
2072 | return; | 2061 | return; |
2073 | } | 2062 | } |
@@ -2090,10 +2079,10 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2090 | goto out; | 2079 | goto out; |
2091 | 2080 | ||
2092 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 2081 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; |
2093 | i = sta->last_txrate_idx; | 2082 | i = lq_sta->last_txrate_idx; |
2094 | 2083 | ||
2095 | if ((lq_sta->lq.sta_id == 0xff) && | 2084 | if ((lq_sta->lq.sta_id == 0xff) && |
2096 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) | 2085 | (priv->iw_mode == NL80211_IFTYPE_ADHOC)) |
2097 | goto out; | 2086 | goto out; |
2098 | 2087 | ||
2099 | valid_tx_ant = priv->hw_params.valid_tx_ant; | 2088 | valid_tx_ant = priv->hw_params.valid_tx_ant; |
@@ -2161,9 +2150,9 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2161 | } | 2150 | } |
2162 | 2151 | ||
2163 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 2152 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; |
2164 | i = sta->last_txrate_idx; | 2153 | i = lq_sta->last_txrate_idx; |
2165 | 2154 | ||
2166 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 2155 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
2167 | !lq_sta->ibss_sta_added) { | 2156 | !lq_sta->ibss_sta_added) { |
2168 | u8 sta_id = iwl_find_station(priv, hdr->addr1); | 2157 | u8 sta_id = iwl_find_station(priv, hdr->addr1); |
2169 | DECLARE_MAC_BUF(mac); | 2158 | DECLARE_MAC_BUF(mac); |
@@ -2230,8 +2219,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2230 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2219 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
2231 | 2220 | ||
2232 | lq_sta->flush_timer = 0; | 2221 | lq_sta->flush_timer = 0; |
2233 | lq_sta->supp_rates = sta->supp_rates[sband->band]; | 2222 | lq_sta->supp_rates = sta->sta.supp_rates[sband->band]; |
2234 | sta->txrate_idx = 3; | ||
2235 | for (j = 0; j < LQ_SIZE; j++) | 2223 | for (j = 0; j < LQ_SIZE; j++) |
2236 | for (i = 0; i < IWL_RATE_COUNT; i++) | 2224 | for (i = 0; i < IWL_RATE_COUNT; i++) |
2237 | rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); | 2225 | rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); |
@@ -2243,18 +2231,18 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2243 | * after assoc.. */ | 2231 | * after assoc.. */ |
2244 | 2232 | ||
2245 | lq_sta->ibss_sta_added = 0; | 2233 | lq_sta->ibss_sta_added = 0; |
2246 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2234 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2247 | u8 sta_id = iwl_find_station(priv, sta->addr); | 2235 | u8 sta_id = iwl_find_station(priv, sta->sta.addr); |
2248 | DECLARE_MAC_BUF(mac); | 2236 | DECLARE_MAC_BUF(mac); |
2249 | 2237 | ||
2250 | /* for IBSS the call are from tasklet */ | 2238 | /* for IBSS the call are from tasklet */ |
2251 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2239 | IWL_DEBUG_RATE("LQ: ADD station %s\n", |
2252 | print_mac(mac, sta->addr)); | 2240 | print_mac(mac, sta->sta.addr)); |
2253 | 2241 | ||
2254 | if (sta_id == IWL_INVALID_STATION) { | 2242 | if (sta_id == IWL_INVALID_STATION) { |
2255 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2243 | IWL_DEBUG_RATE("LQ: ADD station %s\n", |
2256 | print_mac(mac, sta->addr)); | 2244 | print_mac(mac, sta->sta.addr)); |
2257 | sta_id = iwl_add_station_flags(priv, sta->addr, | 2245 | sta_id = iwl_add_station_flags(priv, sta->sta.addr, |
2258 | 0, CMD_ASYNC, NULL); | 2246 | 0, CMD_ASYNC, NULL); |
2259 | } | 2247 | } |
2260 | if ((sta_id != IWL_INVALID_STATION)) { | 2248 | if ((sta_id != IWL_INVALID_STATION)) { |
@@ -2266,14 +2254,14 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2266 | } | 2254 | } |
2267 | 2255 | ||
2268 | /* Find highest tx rate supported by hardware and destination station */ | 2256 | /* Find highest tx rate supported by hardware and destination station */ |
2257 | lq_sta->last_txrate_idx = 3; | ||
2269 | for (i = 0; i < sband->n_bitrates; i++) | 2258 | for (i = 0; i < sband->n_bitrates; i++) |
2270 | if (sta->supp_rates[sband->band] & BIT(i)) | 2259 | if (sta->sta.supp_rates[sband->band] & BIT(i)) |
2271 | sta->txrate_idx = i; | 2260 | lq_sta->last_txrate_idx = i; |
2272 | 2261 | ||
2273 | sta->last_txrate_idx = sta->txrate_idx; | ||
2274 | /* For MODE_IEEE80211A, skip over cck rates in global rate table */ | 2262 | /* For MODE_IEEE80211A, skip over cck rates in global rate table */ |
2275 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) | 2263 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) |
2276 | sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | 2264 | lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
2277 | 2265 | ||
2278 | lq_sta->is_dup = 0; | 2266 | lq_sta->is_dup = 0; |
2279 | lq_sta->is_green = rs_use_green(priv, conf); | 2267 | lq_sta->is_green = rs_use_green(priv, conf); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 31ea28858896..273762769767 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -337,7 +337,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
337 | /* If we have set the ASSOC_MSK and we are in BSS mode then | 337 | /* If we have set the ASSOC_MSK and we are in BSS mode then |
338 | * add the IWL_AP_ID to the station rate table */ | 338 | * add the IWL_AP_ID to the station rate table */ |
339 | if (new_assoc) { | 339 | if (new_assoc) { |
340 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | 340 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
341 | ret = iwl_rxon_add_station(priv, | 341 | ret = iwl_rxon_add_station(priv, |
342 | priv->active_rxon.bssid_addr, 1); | 342 | priv->active_rxon.bssid_addr, 1); |
343 | if (ret == IWL_INVALID_STATION) { | 343 | if (ret == IWL_INVALID_STATION) { |
@@ -448,8 +448,8 @@ static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, | |||
448 | const u8 *dest, int left) | 448 | const u8 *dest, int left) |
449 | { | 449 | { |
450 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || | 450 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || |
451 | ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && | 451 | ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && |
452 | (priv->iw_mode != IEEE80211_IF_TYPE_AP))) | 452 | (priv->iw_mode != NL80211_IFTYPE_AP))) |
453 | return 0; | 453 | return 0; |
454 | 454 | ||
455 | if (priv->ibss_beacon->len > left) | 455 | if (priv->ibss_beacon->len > left) |
@@ -672,7 +672,7 @@ static void iwl4965_setup_rxon_timing(struct iwl_priv *priv) | |||
672 | beacon_int = priv->beacon_int; | 672 | beacon_int = priv->beacon_int; |
673 | spin_unlock_irqrestore(&priv->lock, flags); | 673 | spin_unlock_irqrestore(&priv->lock, flags); |
674 | 674 | ||
675 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | 675 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
676 | if (beacon_int == 0) { | 676 | if (beacon_int == 0) { |
677 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); | 677 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); |
678 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); | 678 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); |
@@ -721,7 +721,7 @@ static void iwl_set_flags_for_band(struct iwl_priv *priv, | |||
721 | else | 721 | else |
722 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 722 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
723 | 723 | ||
724 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 724 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
725 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 725 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
726 | 726 | ||
727 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 727 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; |
@@ -740,23 +740,23 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) | |||
740 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 740 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
741 | 741 | ||
742 | switch (priv->iw_mode) { | 742 | switch (priv->iw_mode) { |
743 | case IEEE80211_IF_TYPE_AP: | 743 | case NL80211_IFTYPE_AP: |
744 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 744 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; |
745 | break; | 745 | break; |
746 | 746 | ||
747 | case IEEE80211_IF_TYPE_STA: | 747 | case NL80211_IFTYPE_STATION: |
748 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; | 748 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; |
749 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; | 749 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; |
750 | break; | 750 | break; |
751 | 751 | ||
752 | case IEEE80211_IF_TYPE_IBSS: | 752 | case NL80211_IFTYPE_ADHOC: |
753 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; | 753 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; |
754 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; | 754 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; |
755 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | | 755 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | |
756 | RXON_FILTER_ACCEPT_GRP_MSK; | 756 | RXON_FILTER_ACCEPT_GRP_MSK; |
757 | break; | 757 | break; |
758 | 758 | ||
759 | case IEEE80211_IF_TYPE_MNTR: | 759 | case NL80211_IFTYPE_MONITOR: |
760 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; | 760 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; |
761 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | | 761 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | |
762 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; | 762 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; |
@@ -785,7 +785,7 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) | |||
785 | * in some case A channels are all non IBSS | 785 | * in some case A channels are all non IBSS |
786 | * in this case force B/G channel | 786 | * in this case force B/G channel |
787 | */ | 787 | */ |
788 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 788 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
789 | !(is_channel_ibss(ch_info))) | 789 | !(is_channel_ibss(ch_info))) |
790 | ch_info = &priv->channel_info[0]; | 790 | ch_info = &priv->channel_info[0]; |
791 | 791 | ||
@@ -1182,7 +1182,7 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, | |||
1182 | le32_to_cpu(beacon->low_tsf), rate); | 1182 | le32_to_cpu(beacon->low_tsf), rate); |
1183 | #endif | 1183 | #endif |
1184 | 1184 | ||
1185 | if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && | 1185 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && |
1186 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) | 1186 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) |
1187 | queue_work(priv->workqueue, &priv->beacon_update); | 1187 | queue_work(priv->workqueue, &priv->beacon_update); |
1188 | } | 1188 | } |
@@ -2388,7 +2388,7 @@ static void iwl4965_bg_set_monitor(struct work_struct *work) | |||
2388 | 2388 | ||
2389 | mutex_lock(&priv->mutex); | 2389 | mutex_lock(&priv->mutex); |
2390 | 2390 | ||
2391 | ret = iwl4965_set_mode(priv, IEEE80211_IF_TYPE_MNTR); | 2391 | ret = iwl4965_set_mode(priv, NL80211_IFTYPE_MONITOR); |
2392 | 2392 | ||
2393 | if (ret) { | 2393 | if (ret) { |
2394 | if (ret == -EAGAIN) | 2394 | if (ret == -EAGAIN) |
@@ -2469,7 +2469,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2469 | DECLARE_MAC_BUF(mac); | 2469 | DECLARE_MAC_BUF(mac); |
2470 | unsigned long flags; | 2470 | unsigned long flags; |
2471 | 2471 | ||
2472 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2472 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2473 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); | 2473 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); |
2474 | return; | 2474 | return; |
2475 | } | 2475 | } |
@@ -2524,7 +2524,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2524 | else | 2524 | else |
2525 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2525 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2526 | 2526 | ||
2527 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 2527 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
2528 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2528 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2529 | 2529 | ||
2530 | } | 2530 | } |
@@ -2532,10 +2532,10 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2532 | iwl4965_commit_rxon(priv); | 2532 | iwl4965_commit_rxon(priv); |
2533 | 2533 | ||
2534 | switch (priv->iw_mode) { | 2534 | switch (priv->iw_mode) { |
2535 | case IEEE80211_IF_TYPE_STA: | 2535 | case NL80211_IFTYPE_STATION: |
2536 | break; | 2536 | break; |
2537 | 2537 | ||
2538 | case IEEE80211_IF_TYPE_IBSS: | 2538 | case NL80211_IFTYPE_ADHOC: |
2539 | 2539 | ||
2540 | /* assume default assoc id */ | 2540 | /* assume default assoc id */ |
2541 | priv->assoc_id = 1; | 2541 | priv->assoc_id = 1; |
@@ -2551,7 +2551,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
2551 | break; | 2551 | break; |
2552 | } | 2552 | } |
2553 | 2553 | ||
2554 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 2554 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
2555 | priv->assoc_station_added = 1; | 2555 | priv->assoc_station_added = 1; |
2556 | 2556 | ||
2557 | spin_lock_irqsave(&priv->lock, flags); | 2557 | spin_lock_irqsave(&priv->lock, flags); |
@@ -2828,7 +2828,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2828 | goto out; | 2828 | goto out; |
2829 | } | 2829 | } |
2830 | 2830 | ||
2831 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS && | 2831 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && |
2832 | !is_channel_ibss(ch_info)) { | 2832 | !is_channel_ibss(ch_info)) { |
2833 | IWL_ERROR("channel %d in band %d not IBSS channel\n", | 2833 | IWL_ERROR("channel %d in band %d not IBSS channel\n", |
2834 | conf->channel->hw_value, conf->channel->band); | 2834 | conf->channel->hw_value, conf->channel->band); |
@@ -2943,7 +2943,7 @@ static void iwl4965_config_ap(struct iwl_priv *priv) | |||
2943 | priv->staging_rxon.flags &= | 2943 | priv->staging_rxon.flags &= |
2944 | ~RXON_FLG_SHORT_SLOT_MSK; | 2944 | ~RXON_FLG_SHORT_SLOT_MSK; |
2945 | 2945 | ||
2946 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 2946 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
2947 | priv->staging_rxon.flags &= | 2947 | priv->staging_rxon.flags &= |
2948 | ~RXON_FLG_SHORT_SLOT_MSK; | 2948 | ~RXON_FLG_SHORT_SLOT_MSK; |
2949 | } | 2949 | } |
@@ -2982,7 +2982,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
2982 | return 0; | 2982 | return 0; |
2983 | } | 2983 | } |
2984 | 2984 | ||
2985 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS && | 2985 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && |
2986 | conf->changed & IEEE80211_IFCC_BEACON) { | 2986 | conf->changed & IEEE80211_IFCC_BEACON) { |
2987 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 2987 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
2988 | if (!beacon) | 2988 | if (!beacon) |
@@ -2992,7 +2992,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
2992 | return rc; | 2992 | return rc; |
2993 | } | 2993 | } |
2994 | 2994 | ||
2995 | if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && | 2995 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && |
2996 | (!conf->ssid_len)) { | 2996 | (!conf->ssid_len)) { |
2997 | IWL_DEBUG_MAC80211 | 2997 | IWL_DEBUG_MAC80211 |
2998 | ("Leaving in AP mode because HostAPD is not ready.\n"); | 2998 | ("Leaving in AP mode because HostAPD is not ready.\n"); |
@@ -3015,7 +3015,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
3015 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | 3015 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { |
3016 | */ | 3016 | */ |
3017 | 3017 | ||
3018 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 3018 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
3019 | if (!conf->bssid) { | 3019 | if (!conf->bssid) { |
3020 | conf->bssid = priv->mac_addr; | 3020 | conf->bssid = priv->mac_addr; |
3021 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | 3021 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); |
@@ -3050,11 +3050,11 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
3050 | * to verify) - jpk */ | 3050 | * to verify) - jpk */ |
3051 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | 3051 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); |
3052 | 3052 | ||
3053 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 3053 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
3054 | iwl4965_config_ap(priv); | 3054 | iwl4965_config_ap(priv); |
3055 | else { | 3055 | else { |
3056 | rc = iwl4965_commit_rxon(priv); | 3056 | rc = iwl4965_commit_rxon(priv); |
3057 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) | 3057 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) |
3058 | iwl_rxon_add_station( | 3058 | iwl_rxon_add_station( |
3059 | priv, priv->active_rxon.bssid_addr, 1); | 3059 | priv, priv->active_rxon.bssid_addr, 1); |
3060 | } | 3060 | } |
@@ -3090,7 +3090,7 @@ static void iwl4965_configure_filter(struct ieee80211_hw *hw, | |||
3090 | 3090 | ||
3091 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { | 3091 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { |
3092 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", | 3092 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", |
3093 | IEEE80211_IF_TYPE_MNTR, | 3093 | NL80211_IFTYPE_MONITOR, |
3094 | changed_flags, *total_flags); | 3094 | changed_flags, *total_flags); |
3095 | /* queue work 'cuz mac80211 is holding a lock which | 3095 | /* queue work 'cuz mac80211 is holding a lock which |
3096 | * prevents us from issuing (synchronous) f/w cmds */ | 3096 | * prevents us from issuing (synchronous) f/w cmds */ |
@@ -3204,7 +3204,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len) | |||
3204 | goto out_unlock; | 3204 | goto out_unlock; |
3205 | } | 3205 | } |
3206 | 3206 | ||
3207 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { /* APs don't scan */ | 3207 | if (priv->iw_mode == NL80211_IFTYPE_AP) { /* APs don't scan */ |
3208 | ret = -EIO; | 3208 | ret = -EIO; |
3209 | IWL_ERROR("ERROR: APs don't scan\n"); | 3209 | IWL_ERROR("ERROR: APs don't scan\n"); |
3210 | goto out_unlock; | 3210 | goto out_unlock; |
@@ -3329,7 +3329,7 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3329 | * in 1X mode. | 3329 | * in 1X mode. |
3330 | * In legacy wep mode, we use another host command to the uCode */ | 3330 | * In legacy wep mode, we use another host command to the uCode */ |
3331 | if (key->alg == ALG_WEP && sta_id == priv->hw_params.bcast_sta_id && | 3331 | if (key->alg == ALG_WEP && sta_id == priv->hw_params.bcast_sta_id && |
3332 | priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 3332 | priv->iw_mode != NL80211_IFTYPE_AP) { |
3333 | if (cmd == SET_KEY) | 3333 | if (cmd == SET_KEY) |
3334 | is_default_wep_key = !priv->key_mapping_key; | 3334 | is_default_wep_key = !priv->key_mapping_key; |
3335 | else | 3335 | else |
@@ -3400,7 +3400,7 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3400 | priv->qos_data.def_qos_parm.ac[q].reserved1 = 0; | 3400 | priv->qos_data.def_qos_parm.ac[q].reserved1 = 0; |
3401 | priv->qos_data.qos_active = 1; | 3401 | priv->qos_data.qos_active = 1; |
3402 | 3402 | ||
3403 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 3403 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
3404 | iwl_activate_qos(priv, 1); | 3404 | iwl_activate_qos(priv, 1); |
3405 | else if (priv->assoc_id && iwl_is_associated(priv)) | 3405 | else if (priv->assoc_id && iwl_is_associated(priv)) |
3406 | iwl_activate_qos(priv, 0); | 3406 | iwl_activate_qos(priv, 0); |
@@ -3413,13 +3413,13 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3413 | 3413 | ||
3414 | static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | 3414 | static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, |
3415 | enum ieee80211_ampdu_mlme_action action, | 3415 | enum ieee80211_ampdu_mlme_action action, |
3416 | const u8 *addr, u16 tid, u16 *ssn) | 3416 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
3417 | { | 3417 | { |
3418 | struct iwl_priv *priv = hw->priv; | 3418 | struct iwl_priv *priv = hw->priv; |
3419 | DECLARE_MAC_BUF(mac); | 3419 | DECLARE_MAC_BUF(mac); |
3420 | 3420 | ||
3421 | IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", | 3421 | IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n", |
3422 | print_mac(mac, addr), tid); | 3422 | print_mac(mac, sta->addr), tid); |
3423 | 3423 | ||
3424 | if (!(priv->cfg->sku & IWL_SKU_N)) | 3424 | if (!(priv->cfg->sku & IWL_SKU_N)) |
3425 | return -EACCES; | 3425 | return -EACCES; |
@@ -3427,16 +3427,16 @@ static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
3427 | switch (action) { | 3427 | switch (action) { |
3428 | case IEEE80211_AMPDU_RX_START: | 3428 | case IEEE80211_AMPDU_RX_START: |
3429 | IWL_DEBUG_HT("start Rx\n"); | 3429 | IWL_DEBUG_HT("start Rx\n"); |
3430 | return iwl_rx_agg_start(priv, addr, tid, *ssn); | 3430 | return iwl_rx_agg_start(priv, sta->addr, tid, *ssn); |
3431 | case IEEE80211_AMPDU_RX_STOP: | 3431 | case IEEE80211_AMPDU_RX_STOP: |
3432 | IWL_DEBUG_HT("stop Rx\n"); | 3432 | IWL_DEBUG_HT("stop Rx\n"); |
3433 | return iwl_rx_agg_stop(priv, addr, tid); | 3433 | return iwl_rx_agg_stop(priv, sta->addr, tid); |
3434 | case IEEE80211_AMPDU_TX_START: | 3434 | case IEEE80211_AMPDU_TX_START: |
3435 | IWL_DEBUG_HT("start Tx\n"); | 3435 | IWL_DEBUG_HT("start Tx\n"); |
3436 | return iwl_tx_agg_start(priv, addr, tid, ssn); | 3436 | return iwl_tx_agg_start(priv, sta->addr, tid, ssn); |
3437 | case IEEE80211_AMPDU_TX_STOP: | 3437 | case IEEE80211_AMPDU_TX_STOP: |
3438 | IWL_DEBUG_HT("stop Tx\n"); | 3438 | IWL_DEBUG_HT("stop Tx\n"); |
3439 | return iwl_tx_agg_stop(priv, addr, tid); | 3439 | return iwl_tx_agg_stop(priv, sta->addr, tid); |
3440 | default: | 3440 | default: |
3441 | IWL_DEBUG_HT("unknown\n"); | 3441 | IWL_DEBUG_HT("unknown\n"); |
3442 | return -EINVAL; | 3442 | return -EINVAL; |
@@ -3518,7 +3518,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
3518 | 3518 | ||
3519 | priv->beacon_int = priv->hw->conf.beacon_int; | 3519 | priv->beacon_int = priv->hw->conf.beacon_int; |
3520 | priv->timestamp = 0; | 3520 | priv->timestamp = 0; |
3521 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA)) | 3521 | if ((priv->iw_mode == NL80211_IFTYPE_STATION)) |
3522 | priv->beacon_int = 0; | 3522 | priv->beacon_int = 0; |
3523 | 3523 | ||
3524 | spin_unlock_irqrestore(&priv->lock, flags); | 3524 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -3532,7 +3532,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
3532 | /* we are restarting association process | 3532 | /* we are restarting association process |
3533 | * clear RXON_FILTER_ASSOC_MSK bit | 3533 | * clear RXON_FILTER_ASSOC_MSK bit |
3534 | */ | 3534 | */ |
3535 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 3535 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
3536 | iwl_scan_cancel_timeout(priv, 100); | 3536 | iwl_scan_cancel_timeout(priv, 100); |
3537 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3537 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3538 | iwl4965_commit_rxon(priv); | 3538 | iwl4965_commit_rxon(priv); |
@@ -3541,7 +3541,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
3541 | iwl_power_update_mode(priv, 0); | 3541 | iwl_power_update_mode(priv, 0); |
3542 | 3542 | ||
3543 | /* Per mac80211.h: This is only used in IBSS mode... */ | 3543 | /* Per mac80211.h: This is only used in IBSS mode... */ |
3544 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 3544 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
3545 | 3545 | ||
3546 | /* switch to CAM during association period. | 3546 | /* switch to CAM during association period. |
3547 | * the ucode will block any association/authentication | 3547 | * the ucode will block any association/authentication |
@@ -3580,7 +3580,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
3580 | return -EIO; | 3580 | return -EIO; |
3581 | } | 3581 | } |
3582 | 3582 | ||
3583 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 3583 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
3584 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); | 3584 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); |
3585 | mutex_unlock(&priv->mutex); | 3585 | mutex_unlock(&priv->mutex); |
3586 | return -EIO; | 3586 | return -EIO; |
@@ -4506,7 +4506,10 @@ static struct pci_device_id iwl_hw_card_ids[] = { | |||
4506 | {IWL_PCI_DEVICE(0x4235, PCI_ANY_ID, iwl5300_agn_cfg)}, | 4506 | {IWL_PCI_DEVICE(0x4235, PCI_ANY_ID, iwl5300_agn_cfg)}, |
4507 | {IWL_PCI_DEVICE(0x4236, PCI_ANY_ID, iwl5300_agn_cfg)}, | 4507 | {IWL_PCI_DEVICE(0x4236, PCI_ANY_ID, iwl5300_agn_cfg)}, |
4508 | {IWL_PCI_DEVICE(0x4237, PCI_ANY_ID, iwl5100_agn_cfg)}, | 4508 | {IWL_PCI_DEVICE(0x4237, PCI_ANY_ID, iwl5100_agn_cfg)}, |
4509 | {IWL_PCI_DEVICE(0x423A, PCI_ANY_ID, iwl5350_agn_cfg)}, | 4509 | /* 5350 WiFi/WiMax */ |
4510 | {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, | ||
4511 | {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, | ||
4512 | {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, | ||
4510 | #endif /* CONFIG_IWL5000 */ | 4513 | #endif /* CONFIG_IWL5000 */ |
4511 | {0} | 4514 | {0} |
4512 | }; | 4515 | }; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 36d08b0eec43..d80184ee911c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -306,14 +306,14 @@ void iwl_reset_qos(struct iwl_priv *priv) | |||
306 | spin_lock_irqsave(&priv->lock, flags); | 306 | spin_lock_irqsave(&priv->lock, flags); |
307 | priv->qos_data.qos_active = 0; | 307 | priv->qos_data.qos_active = 0; |
308 | 308 | ||
309 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) { | 309 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) { |
310 | if (priv->qos_data.qos_enable) | 310 | if (priv->qos_data.qos_enable) |
311 | priv->qos_data.qos_active = 1; | 311 | priv->qos_data.qos_active = 1; |
312 | if (!(priv->active_rate & 0xfff0)) { | 312 | if (!(priv->active_rate & 0xfff0)) { |
313 | cw_min = 31; | 313 | cw_min = 31; |
314 | is_legacy = 1; | 314 | is_legacy = 1; |
315 | } | 315 | } |
316 | } else if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 316 | } else if (priv->iw_mode == NL80211_IFTYPE_AP) { |
317 | if (priv->qos_data.qos_enable) | 317 | if (priv->qos_data.qos_enable) |
318 | priv->qos_data.qos_active = 1; | 318 | priv->qos_data.qos_active = 1; |
319 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { | 319 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { |
@@ -932,7 +932,7 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
932 | priv->ieee_rates = NULL; | 932 | priv->ieee_rates = NULL; |
933 | priv->band = IEEE80211_BAND_2GHZ; | 933 | priv->band = IEEE80211_BAND_2GHZ; |
934 | 934 | ||
935 | priv->iw_mode = IEEE80211_IF_TYPE_STA; | 935 | priv->iw_mode = NL80211_IFTYPE_STATION; |
936 | 936 | ||
937 | priv->use_ant_b_for_management_frame = 1; /* start with ant B */ | 937 | priv->use_ant_b_for_management_frame = 1; /* start with ant B */ |
938 | priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED; | 938 | priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED; |
@@ -1396,7 +1396,7 @@ void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv) | |||
1396 | 1396 | ||
1397 | iwl_scan_cancel(priv); | 1397 | iwl_scan_cancel(priv); |
1398 | /* FIXME: This is a workaround for AP */ | 1398 | /* FIXME: This is a workaround for AP */ |
1399 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 1399 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
1400 | spin_lock_irqsave(&priv->lock, flags); | 1400 | spin_lock_irqsave(&priv->lock, flags); |
1401 | iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, | 1401 | iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, |
1402 | CSR_UCODE_SW_BIT_RFKILL); | 1402 | CSR_UCODE_SW_BIT_RFKILL); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 1823687e5820..c018121085e9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -954,7 +954,7 @@ struct iwl_priv { | |||
954 | u8 *eeprom; | 954 | u8 *eeprom; |
955 | struct iwl_eeprom_calib_info *calib_info; | 955 | struct iwl_eeprom_calib_info *calib_info; |
956 | 956 | ||
957 | enum ieee80211_if_types iw_mode; | 957 | enum nl80211_iftype iw_mode; |
958 | 958 | ||
959 | struct sk_buff *ibss_beacon; | 959 | struct sk_buff *ibss_beacon; |
960 | 960 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 55ec31ec9e15..60a03d2d2d0e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -290,7 +290,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
290 | final_mode = setting->critical_power_setting; | 290 | final_mode = setting->critical_power_setting; |
291 | 291 | ||
292 | /* driver only support CAM for non STA network */ | 292 | /* driver only support CAM for non STA network */ |
293 | if (priv->iw_mode != IEEE80211_IF_TYPE_STA) | 293 | if (priv->iw_mode != NL80211_IFTYPE_STATION) |
294 | final_mode = IWL_POWER_MODE_CAM; | 294 | final_mode = IWL_POWER_MODE_CAM; |
295 | 295 | ||
296 | if (!iwl_is_rfkill(priv) && !setting->power_disabled && | 296 | if (!iwl_is_rfkill(priv) && !setting->power_disabled && |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index faad4d3f56e1..38b2946b1d81 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -1026,10 +1026,10 @@ static int iwl_is_network_packet(struct iwl_priv *priv, | |||
1026 | /* Filter incoming packets to determine if they are targeted toward | 1026 | /* Filter incoming packets to determine if they are targeted toward |
1027 | * this network, discarding packets coming from ourselves */ | 1027 | * this network, discarding packets coming from ourselves */ |
1028 | switch (priv->iw_mode) { | 1028 | switch (priv->iw_mode) { |
1029 | case IEEE80211_IF_TYPE_IBSS: /* Header: Dest. | Source | BSSID */ | 1029 | case NL80211_IFTYPE_ADHOC: /* Header: Dest. | Source | BSSID */ |
1030 | /* packets to our IBSS update information */ | 1030 | /* packets to our IBSS update information */ |
1031 | return !compare_ether_addr(header->addr3, priv->bssid); | 1031 | return !compare_ether_addr(header->addr3, priv->bssid); |
1032 | case IEEE80211_IF_TYPE_STA: /* Header: Dest. | AP{BSSID} | Source */ | 1032 | case NL80211_IFTYPE_STATION: /* Header: Dest. | AP{BSSID} | Source */ |
1033 | /* packets to our IBSS update information */ | 1033 | /* packets to our IBSS update information */ |
1034 | return !compare_ether_addr(header->addr2, priv->bssid); | 1034 | return !compare_ether_addr(header->addr2, priv->bssid); |
1035 | default: | 1035 | default: |
@@ -1169,7 +1169,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1169 | rx_status.flag |= RX_FLAG_SHORTPRE; | 1169 | rx_status.flag |= RX_FLAG_SHORTPRE; |
1170 | 1170 | ||
1171 | /* Take shortcut when only in monitor mode */ | 1171 | /* Take shortcut when only in monitor mode */ |
1172 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { | 1172 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { |
1173 | iwl_pass_packet_to_mac80211(priv, include_phy, | 1173 | iwl_pass_packet_to_mac80211(priv, include_phy, |
1174 | rxb, &rx_status); | 1174 | rxb, &rx_status); |
1175 | return; | 1175 | return; |
@@ -1186,7 +1186,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1186 | switch (fc & IEEE80211_FCTL_FTYPE) { | 1186 | switch (fc & IEEE80211_FCTL_FTYPE) { |
1187 | case IEEE80211_FTYPE_MGMT: | 1187 | case IEEE80211_FTYPE_MGMT: |
1188 | case IEEE80211_FTYPE_DATA: | 1188 | case IEEE80211_FTYPE_DATA: |
1189 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 1189 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
1190 | iwl_update_ps_mode(priv, fc & IEEE80211_FCTL_PM, | 1190 | iwl_update_ps_mode(priv, fc & IEEE80211_FCTL_PM, |
1191 | header->addr2); | 1191 | header->addr2); |
1192 | /* fall through */ | 1192 | /* fall through */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index d026aaf62335..09c264be0496 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -463,7 +463,7 @@ void iwl_init_scan_params(struct iwl_priv *priv) | |||
463 | 463 | ||
464 | int iwl_scan_initiate(struct iwl_priv *priv) | 464 | int iwl_scan_initiate(struct iwl_priv *priv) |
465 | { | 465 | { |
466 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 466 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
467 | IWL_ERROR("APs don't scan.\n"); | 467 | IWL_ERROR("APs don't scan.\n"); |
468 | return 0; | 468 | return 0; |
469 | } | 469 | } |
@@ -868,7 +868,7 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
868 | 868 | ||
869 | scan->tx_cmd.len = cpu_to_le16(cmd_len); | 869 | scan->tx_cmd.len = cpu_to_le16(cmd_len); |
870 | 870 | ||
871 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) | 871 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) |
872 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | 872 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; |
873 | 873 | ||
874 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | | 874 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index a72569f1acb5..61797f3f8d5c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -47,8 +47,8 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | |||
47 | unsigned long flags; | 47 | unsigned long flags; |
48 | DECLARE_MAC_BUF(mac); | 48 | DECLARE_MAC_BUF(mac); |
49 | 49 | ||
50 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) || | 50 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || |
51 | (priv->iw_mode == IEEE80211_IF_TYPE_AP)) | 51 | (priv->iw_mode == NL80211_IFTYPE_AP)) |
52 | start = IWL_STA_ID; | 52 | start = IWL_STA_ID; |
53 | 53 | ||
54 | if (is_broadcast_ether_addr(addr)) | 54 | if (is_broadcast_ether_addr(addr)) |
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(iwl_find_station); | |||
74 | 74 | ||
75 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | 75 | int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) |
76 | { | 76 | { |
77 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | 77 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
78 | return IWL_AP_ID; | 78 | return IWL_AP_ID; |
79 | } else { | 79 | } else { |
80 | u8 *da = ieee80211_get_DA(hdr); | 80 | u8 *da = ieee80211_get_DA(hdr); |
@@ -286,7 +286,7 @@ u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, | |||
286 | 286 | ||
287 | /* BCAST station and IBSS stations do not work in HT mode */ | 287 | /* BCAST station and IBSS stations do not work in HT mode */ |
288 | if (sta_id != priv->hw_params.bcast_sta_id && | 288 | if (sta_id != priv->hw_params.bcast_sta_id && |
289 | priv->iw_mode != IEEE80211_IF_TYPE_IBSS) | 289 | priv->iw_mode != NL80211_IFTYPE_ADHOC) |
290 | iwl_set_ht_add_station(priv, sta_id, ht_info); | 290 | iwl_set_ht_add_station(priv, sta_id, ht_info); |
291 | 291 | ||
292 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 292 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); |
@@ -817,7 +817,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
817 | }; | 817 | }; |
818 | 818 | ||
819 | if ((lq->sta_id == 0xFF) && | 819 | if ((lq->sta_id == 0xFF) && |
820 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) | 820 | (priv->iw_mode == NL80211_IFTYPE_ADHOC)) |
821 | return -EINVAL; | 821 | return -EINVAL; |
822 | 822 | ||
823 | if (lq->sta_id == 0xFF) | 823 | if (lq->sta_id == 0xFF) |
@@ -904,7 +904,7 @@ int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
904 | 904 | ||
905 | if ((is_ap) && | 905 | if ((is_ap) && |
906 | (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && | 906 | (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && |
907 | (priv->iw_mode == IEEE80211_IF_TYPE_STA)) | 907 | (priv->iw_mode == NL80211_IFTYPE_STATION)) |
908 | sta_id = iwl_add_station_flags(priv, addr, is_ap, | 908 | sta_id = iwl_add_station_flags(priv, addr, is_ap, |
909 | 0, cur_ht_config); | 909 | 0, cur_ht_config); |
910 | else | 910 | else |
@@ -938,11 +938,11 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
938 | 938 | ||
939 | /* If we are a client station in a BSS network, use the special | 939 | /* If we are a client station in a BSS network, use the special |
940 | * AP station entry (that's the only station we communicate with) */ | 940 | * AP station entry (that's the only station we communicate with) */ |
941 | case IEEE80211_IF_TYPE_STA: | 941 | case NL80211_IFTYPE_STATION: |
942 | return IWL_AP_ID; | 942 | return IWL_AP_ID; |
943 | 943 | ||
944 | /* If we are an AP, then find the station, or use BCAST */ | 944 | /* If we are an AP, then find the station, or use BCAST */ |
945 | case IEEE80211_IF_TYPE_AP: | 945 | case NL80211_IFTYPE_AP: |
946 | sta_id = iwl_find_station(priv, hdr->addr1); | 946 | sta_id = iwl_find_station(priv, hdr->addr1); |
947 | if (sta_id != IWL_INVALID_STATION) | 947 | if (sta_id != IWL_INVALID_STATION) |
948 | return sta_id; | 948 | return sta_id; |
@@ -950,7 +950,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
950 | 950 | ||
951 | /* If this frame is going out to an IBSS network, find the station, | 951 | /* If this frame is going out to an IBSS network, find the station, |
952 | * or create a new station table entry */ | 952 | * or create a new station table entry */ |
953 | case IEEE80211_IF_TYPE_IBSS: | 953 | case NL80211_IFTYPE_ADHOC: |
954 | sta_id = iwl_find_station(priv, hdr->addr1); | 954 | sta_id = iwl_find_station(priv, hdr->addr1); |
955 | if (sta_id != IWL_INVALID_STATION) | 955 | if (sta_id != IWL_INVALID_STATION) |
956 | return sta_id; | 956 | return sta_id; |
@@ -970,7 +970,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
970 | 970 | ||
971 | /* If we are in monitor mode, use BCAST. This is required for | 971 | /* If we are in monitor mode, use BCAST. This is required for |
972 | * packet injection. */ | 972 | * packet injection. */ |
973 | case IEEE80211_IF_TYPE_MNTR: | 973 | case NL80211_IFTYPE_MONITOR: |
974 | return priv->hw_params.bcast_sta_id; | 974 | return priv->hw_params.bcast_sta_id; |
975 | 975 | ||
976 | default: | 976 | default: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 9d5bcf46cbe9..e9feca4033f9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -814,10 +814,10 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
814 | 814 | ||
815 | /* drop all data frame if we are not associated */ | 815 | /* drop all data frame if we are not associated */ |
816 | if (ieee80211_is_data(fc) && | 816 | if (ieee80211_is_data(fc) && |
817 | (priv->iw_mode != IEEE80211_IF_TYPE_MNTR || | 817 | (priv->iw_mode != NL80211_IFTYPE_MONITOR || |
818 | !(info->flags & IEEE80211_TX_CTL_INJECTED)) && /* packet injection */ | 818 | !(info->flags & IEEE80211_TX_CTL_INJECTED)) && /* packet injection */ |
819 | (!iwl_is_associated(priv) || | 819 | (!iwl_is_associated(priv) || |
820 | ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) || | 820 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id) || |
821 | !priv->assoc_station_added)) { | 821 | !priv->assoc_station_added)) { |
822 | IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); | 822 | IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); |
823 | goto drop_unlock; | 823 | goto drop_unlock; |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index cbbe73a12887..62b26befddc5 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -1160,7 +1160,7 @@ static int iwl3945_commit_rxon(struct iwl3945_priv *priv) | |||
1160 | /* If we have set the ASSOC_MSK and we are in BSS mode then | 1160 | /* If we have set the ASSOC_MSK and we are in BSS mode then |
1161 | * add the IWL_AP_ID to the station rate table */ | 1161 | * add the IWL_AP_ID to the station rate table */ |
1162 | if (iwl3945_is_associated(priv) && | 1162 | if (iwl3945_is_associated(priv) && |
1163 | (priv->iw_mode == IEEE80211_IF_TYPE_STA)) | 1163 | (priv->iw_mode == NL80211_IFTYPE_STATION)) |
1164 | if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0) | 1164 | if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0) |
1165 | == IWL_INVALID_STATION) { | 1165 | == IWL_INVALID_STATION) { |
1166 | IWL_ERROR("Error adding AP address for transmit.\n"); | 1166 | IWL_ERROR("Error adding AP address for transmit.\n"); |
@@ -1447,8 +1447,8 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, | |||
1447 | { | 1447 | { |
1448 | 1448 | ||
1449 | if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || | 1449 | if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || |
1450 | ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && | 1450 | ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && |
1451 | (priv->iw_mode != IEEE80211_IF_TYPE_AP))) | 1451 | (priv->iw_mode != NL80211_IFTYPE_AP))) |
1452 | return 0; | 1452 | return 0; |
1453 | 1453 | ||
1454 | if (priv->ibss_beacon->len > left) | 1454 | if (priv->ibss_beacon->len > left) |
@@ -1746,14 +1746,14 @@ static void iwl3945_reset_qos(struct iwl3945_priv *priv) | |||
1746 | spin_lock_irqsave(&priv->lock, flags); | 1746 | spin_lock_irqsave(&priv->lock, flags); |
1747 | priv->qos_data.qos_active = 0; | 1747 | priv->qos_data.qos_active = 0; |
1748 | 1748 | ||
1749 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) { | 1749 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) { |
1750 | if (priv->qos_data.qos_enable) | 1750 | if (priv->qos_data.qos_enable) |
1751 | priv->qos_data.qos_active = 1; | 1751 | priv->qos_data.qos_active = 1; |
1752 | if (!(priv->active_rate & 0xfff0)) { | 1752 | if (!(priv->active_rate & 0xfff0)) { |
1753 | cw_min = 31; | 1753 | cw_min = 31; |
1754 | is_legacy = 1; | 1754 | is_legacy = 1; |
1755 | } | 1755 | } |
1756 | } else if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 1756 | } else if (priv->iw_mode == NL80211_IFTYPE_AP) { |
1757 | if (priv->qos_data.qos_enable) | 1757 | if (priv->qos_data.qos_enable) |
1758 | priv->qos_data.qos_active = 1; | 1758 | priv->qos_data.qos_active = 1; |
1759 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { | 1759 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { |
@@ -2120,7 +2120,7 @@ static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv) | |||
2120 | beacon_int = priv->beacon_int; | 2120 | beacon_int = priv->beacon_int; |
2121 | spin_unlock_irqrestore(&priv->lock, flags); | 2121 | spin_unlock_irqrestore(&priv->lock, flags); |
2122 | 2122 | ||
2123 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | 2123 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { |
2124 | if (beacon_int == 0) { | 2124 | if (beacon_int == 0) { |
2125 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); | 2125 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); |
2126 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); | 2126 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); |
@@ -2156,7 +2156,7 @@ static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv) | |||
2156 | 2156 | ||
2157 | static int iwl3945_scan_initiate(struct iwl3945_priv *priv) | 2157 | static int iwl3945_scan_initiate(struct iwl3945_priv *priv) |
2158 | { | 2158 | { |
2159 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2159 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2160 | IWL_ERROR("APs don't scan.\n"); | 2160 | IWL_ERROR("APs don't scan.\n"); |
2161 | return 0; | 2161 | return 0; |
2162 | } | 2162 | } |
@@ -2218,7 +2218,7 @@ static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, | |||
2218 | else | 2218 | else |
2219 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2219 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2220 | 2220 | ||
2221 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 2221 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
2222 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2222 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2223 | 2223 | ||
2224 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 2224 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; |
@@ -2237,23 +2237,23 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2237 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 2237 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
2238 | 2238 | ||
2239 | switch (priv->iw_mode) { | 2239 | switch (priv->iw_mode) { |
2240 | case IEEE80211_IF_TYPE_AP: | 2240 | case NL80211_IFTYPE_AP: |
2241 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 2241 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; |
2242 | break; | 2242 | break; |
2243 | 2243 | ||
2244 | case IEEE80211_IF_TYPE_STA: | 2244 | case NL80211_IFTYPE_STATION: |
2245 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; | 2245 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; |
2246 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; | 2246 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; |
2247 | break; | 2247 | break; |
2248 | 2248 | ||
2249 | case IEEE80211_IF_TYPE_IBSS: | 2249 | case NL80211_IFTYPE_ADHOC: |
2250 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; | 2250 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; |
2251 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; | 2251 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; |
2252 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | | 2252 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | |
2253 | RXON_FILTER_ACCEPT_GRP_MSK; | 2253 | RXON_FILTER_ACCEPT_GRP_MSK; |
2254 | break; | 2254 | break; |
2255 | 2255 | ||
2256 | case IEEE80211_IF_TYPE_MNTR: | 2256 | case NL80211_IFTYPE_MONITOR: |
2257 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; | 2257 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; |
2258 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | | 2258 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | |
2259 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; | 2259 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; |
@@ -2282,7 +2282,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2282 | * in some case A channels are all non IBSS | 2282 | * in some case A channels are all non IBSS |
2283 | * in this case force B/G channel | 2283 | * in this case force B/G channel |
2284 | */ | 2284 | */ |
2285 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 2285 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
2286 | !(is_channel_ibss(ch_info))) | 2286 | !(is_channel_ibss(ch_info))) |
2287 | ch_info = &priv->channel_info[0]; | 2287 | ch_info = &priv->channel_info[0]; |
2288 | 2288 | ||
@@ -2302,7 +2302,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) | |||
2302 | 2302 | ||
2303 | static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) | 2303 | static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) |
2304 | { | 2304 | { |
2305 | if (mode == IEEE80211_IF_TYPE_IBSS) { | 2305 | if (mode == NL80211_IFTYPE_ADHOC) { |
2306 | const struct iwl3945_channel_info *ch_info; | 2306 | const struct iwl3945_channel_info *ch_info; |
2307 | 2307 | ||
2308 | ch_info = iwl3945_get_channel_info(priv, | 2308 | ch_info = iwl3945_get_channel_info(priv, |
@@ -2469,11 +2469,11 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2469 | 2469 | ||
2470 | /* If we are a client station in a BSS network, use the special | 2470 | /* If we are a client station in a BSS network, use the special |
2471 | * AP station entry (that's the only station we communicate with) */ | 2471 | * AP station entry (that's the only station we communicate with) */ |
2472 | case IEEE80211_IF_TYPE_STA: | 2472 | case NL80211_IFTYPE_STATION: |
2473 | return IWL_AP_ID; | 2473 | return IWL_AP_ID; |
2474 | 2474 | ||
2475 | /* If we are an AP, then find the station, or use BCAST */ | 2475 | /* If we are an AP, then find the station, or use BCAST */ |
2476 | case IEEE80211_IF_TYPE_AP: | 2476 | case NL80211_IFTYPE_AP: |
2477 | sta_id = iwl3945_hw_find_station(priv, hdr->addr1); | 2477 | sta_id = iwl3945_hw_find_station(priv, hdr->addr1); |
2478 | if (sta_id != IWL_INVALID_STATION) | 2478 | if (sta_id != IWL_INVALID_STATION) |
2479 | return sta_id; | 2479 | return sta_id; |
@@ -2481,7 +2481,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2481 | 2481 | ||
2482 | /* If this frame is going out to an IBSS network, find the station, | 2482 | /* If this frame is going out to an IBSS network, find the station, |
2483 | * or create a new station table entry */ | 2483 | * or create a new station table entry */ |
2484 | case IEEE80211_IF_TYPE_IBSS: { | 2484 | case NL80211_IFTYPE_ADHOC: { |
2485 | DECLARE_MAC_BUF(mac); | 2485 | DECLARE_MAC_BUF(mac); |
2486 | 2486 | ||
2487 | /* Create new station table entry */ | 2487 | /* Create new station table entry */ |
@@ -2502,7 +2502,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2502 | } | 2502 | } |
2503 | /* If we are in monitor mode, use BCAST. This is required for | 2503 | /* If we are in monitor mode, use BCAST. This is required for |
2504 | * packet injection. */ | 2504 | * packet injection. */ |
2505 | case IEEE80211_IF_TYPE_MNTR: | 2505 | case NL80211_IFTYPE_MONITOR: |
2506 | return priv->hw_setting.bcast_sta_id; | 2506 | return priv->hw_setting.bcast_sta_id; |
2507 | 2507 | ||
2508 | default: | 2508 | default: |
@@ -2565,9 +2565,9 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb) | |||
2565 | 2565 | ||
2566 | /* drop all data frame if we are not associated */ | 2566 | /* drop all data frame if we are not associated */ |
2567 | if (ieee80211_is_data(fc) && | 2567 | if (ieee80211_is_data(fc) && |
2568 | (priv->iw_mode != IEEE80211_IF_TYPE_MNTR) && /* packet injection */ | 2568 | (priv->iw_mode != NL80211_IFTYPE_MONITOR) && /* packet injection */ |
2569 | (!iwl3945_is_associated(priv) || | 2569 | (!iwl3945_is_associated(priv) || |
2570 | ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id))) { | 2570 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) { |
2571 | IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); | 2571 | IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); |
2572 | goto drop_unlock; | 2572 | goto drop_unlock; |
2573 | } | 2573 | } |
@@ -2806,7 +2806,7 @@ static void iwl3945_radio_kill_sw(struct iwl3945_priv *priv, int disable_radio) | |||
2806 | if (disable_radio) { | 2806 | if (disable_radio) { |
2807 | iwl3945_scan_cancel(priv); | 2807 | iwl3945_scan_cancel(priv); |
2808 | /* FIXME: This is a workaround for AP */ | 2808 | /* FIXME: This is a workaround for AP */ |
2809 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 2809 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
2810 | spin_lock_irqsave(&priv->lock, flags); | 2810 | spin_lock_irqsave(&priv->lock, flags); |
2811 | iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET, | 2811 | iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET, |
2812 | CSR_UCODE_SW_BIT_RFKILL); | 2812 | CSR_UCODE_SW_BIT_RFKILL); |
@@ -3161,7 +3161,7 @@ static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv, | |||
3161 | le32_to_cpu(beacon->low_tsf), rate); | 3161 | le32_to_cpu(beacon->low_tsf), rate); |
3162 | #endif | 3162 | #endif |
3163 | 3163 | ||
3164 | if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && | 3164 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && |
3165 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) | 3165 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) |
3166 | queue_work(priv->workqueue, &priv->beacon_update); | 3166 | queue_work(priv->workqueue, &priv->beacon_update); |
3167 | } | 3167 | } |
@@ -6059,7 +6059,7 @@ static void iwl3945_bg_set_monitor(struct work_struct *work) | |||
6059 | if (!iwl3945_is_ready(priv)) | 6059 | if (!iwl3945_is_ready(priv)) |
6060 | IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n"); | 6060 | IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n"); |
6061 | else | 6061 | else |
6062 | if (iwl3945_set_mode(priv, IEEE80211_IF_TYPE_MNTR) != 0) | 6062 | if (iwl3945_set_mode(priv, NL80211_IFTYPE_MONITOR) != 0) |
6063 | IWL_ERROR("iwl3945_set_mode() failed\n"); | 6063 | IWL_ERROR("iwl3945_set_mode() failed\n"); |
6064 | 6064 | ||
6065 | mutex_unlock(&priv->mutex); | 6065 | mutex_unlock(&priv->mutex); |
@@ -6248,7 +6248,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6248 | /* select Rx antennas */ | 6248 | /* select Rx antennas */ |
6249 | scan->flags |= iwl3945_get_antenna_flags(priv); | 6249 | scan->flags |= iwl3945_get_antenna_flags(priv); |
6250 | 6250 | ||
6251 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) | 6251 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) |
6252 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | 6252 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; |
6253 | 6253 | ||
6254 | scan->channel_count = | 6254 | scan->channel_count = |
@@ -6323,7 +6323,7 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv) | |||
6323 | struct ieee80211_conf *conf = NULL; | 6323 | struct ieee80211_conf *conf = NULL; |
6324 | DECLARE_MAC_BUF(mac); | 6324 | DECLARE_MAC_BUF(mac); |
6325 | 6325 | ||
6326 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 6326 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
6327 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); | 6327 | IWL_ERROR("%s Should not be called in AP mode\n", __func__); |
6328 | return; | 6328 | return; |
6329 | } | 6329 | } |
@@ -6372,7 +6372,7 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv) | |||
6372 | else | 6372 | else |
6373 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 6373 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
6374 | 6374 | ||
6375 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 6375 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
6376 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 6376 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
6377 | 6377 | ||
6378 | } | 6378 | } |
@@ -6380,11 +6380,11 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv) | |||
6380 | iwl3945_commit_rxon(priv); | 6380 | iwl3945_commit_rxon(priv); |
6381 | 6381 | ||
6382 | switch (priv->iw_mode) { | 6382 | switch (priv->iw_mode) { |
6383 | case IEEE80211_IF_TYPE_STA: | 6383 | case NL80211_IFTYPE_STATION: |
6384 | iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); | 6384 | iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); |
6385 | break; | 6385 | break; |
6386 | 6386 | ||
6387 | case IEEE80211_IF_TYPE_IBSS: | 6387 | case NL80211_IFTYPE_ADHOC: |
6388 | 6388 | ||
6389 | /* clear out the station table */ | 6389 | /* clear out the station table */ |
6390 | iwl3945_clear_stations_table(priv); | 6390 | iwl3945_clear_stations_table(priv); |
@@ -6754,7 +6754,7 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv) | |||
6754 | priv->staging_rxon.flags &= | 6754 | priv->staging_rxon.flags &= |
6755 | ~RXON_FLG_SHORT_SLOT_MSK; | 6755 | ~RXON_FLG_SHORT_SLOT_MSK; |
6756 | 6756 | ||
6757 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) | 6757 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC) |
6758 | priv->staging_rxon.flags &= | 6758 | priv->staging_rxon.flags &= |
6759 | ~RXON_FLG_SHORT_SLOT_MSK; | 6759 | ~RXON_FLG_SHORT_SLOT_MSK; |
6760 | } | 6760 | } |
@@ -6791,7 +6791,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6791 | } | 6791 | } |
6792 | 6792 | ||
6793 | /* handle this temporarily here */ | 6793 | /* handle this temporarily here */ |
6794 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS && | 6794 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && |
6795 | conf->changed & IEEE80211_IFCC_BEACON) { | 6795 | conf->changed & IEEE80211_IFCC_BEACON) { |
6796 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 6796 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
6797 | if (!beacon) | 6797 | if (!beacon) |
@@ -6803,7 +6803,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6803 | 6803 | ||
6804 | /* XXX: this MUST use conf->mac_addr */ | 6804 | /* XXX: this MUST use conf->mac_addr */ |
6805 | 6805 | ||
6806 | if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) && | 6806 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && |
6807 | (!conf->ssid_len)) { | 6807 | (!conf->ssid_len)) { |
6808 | IWL_DEBUG_MAC80211 | 6808 | IWL_DEBUG_MAC80211 |
6809 | ("Leaving in AP mode because HostAPD is not ready.\n"); | 6809 | ("Leaving in AP mode because HostAPD is not ready.\n"); |
@@ -6826,7 +6826,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6826 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | 6826 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { |
6827 | */ | 6827 | */ |
6828 | 6828 | ||
6829 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 6829 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
6830 | if (!conf->bssid) { | 6830 | if (!conf->bssid) { |
6831 | conf->bssid = priv->mac_addr; | 6831 | conf->bssid = priv->mac_addr; |
6832 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | 6832 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); |
@@ -6861,11 +6861,11 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | |||
6861 | * to verify) - jpk */ | 6861 | * to verify) - jpk */ |
6862 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | 6862 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); |
6863 | 6863 | ||
6864 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 6864 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
6865 | iwl3945_config_ap(priv); | 6865 | iwl3945_config_ap(priv); |
6866 | else { | 6866 | else { |
6867 | rc = iwl3945_commit_rxon(priv); | 6867 | rc = iwl3945_commit_rxon(priv); |
6868 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) | 6868 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) |
6869 | iwl3945_add_station(priv, | 6869 | iwl3945_add_station(priv, |
6870 | priv->active_rxon.bssid_addr, 1, 0); | 6870 | priv->active_rxon.bssid_addr, 1, 0); |
6871 | } | 6871 | } |
@@ -6901,7 +6901,7 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw, | |||
6901 | 6901 | ||
6902 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { | 6902 | if (changed_flags & (*total_flags) & FIF_OTHER_BSS) { |
6903 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", | 6903 | IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n", |
6904 | IEEE80211_IF_TYPE_MNTR, | 6904 | NL80211_IFTYPE_MONITOR, |
6905 | changed_flags, *total_flags); | 6905 | changed_flags, *total_flags); |
6906 | /* queue work 'cuz mac80211 is holding a lock which | 6906 | /* queue work 'cuz mac80211 is holding a lock which |
6907 | * prevents us from issuing (synchronous) f/w cmds */ | 6907 | * prevents us from issuing (synchronous) f/w cmds */ |
@@ -7010,7 +7010,7 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7010 | goto out_unlock; | 7010 | goto out_unlock; |
7011 | } | 7011 | } |
7012 | 7012 | ||
7013 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { /* APs don't scan */ | 7013 | if (priv->iw_mode == NL80211_IFTYPE_AP) { /* APs don't scan */ |
7014 | rc = -EIO; | 7014 | rc = -EIO; |
7015 | IWL_ERROR("ERROR: APs don't scan\n"); | 7015 | IWL_ERROR("ERROR: APs don't scan\n"); |
7016 | goto out_unlock; | 7016 | goto out_unlock; |
@@ -7152,7 +7152,7 @@ static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
7152 | spin_unlock_irqrestore(&priv->lock, flags); | 7152 | spin_unlock_irqrestore(&priv->lock, flags); |
7153 | 7153 | ||
7154 | mutex_lock(&priv->mutex); | 7154 | mutex_lock(&priv->mutex); |
7155 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) | 7155 | if (priv->iw_mode == NL80211_IFTYPE_AP) |
7156 | iwl3945_activate_qos(priv, 1); | 7156 | iwl3945_activate_qos(priv, 1); |
7157 | else if (priv->assoc_id && iwl3945_is_associated(priv)) | 7157 | else if (priv->assoc_id && iwl3945_is_associated(priv)) |
7158 | iwl3945_activate_qos(priv, 0); | 7158 | iwl3945_activate_qos(priv, 0); |
@@ -7239,7 +7239,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7239 | priv->beacon_int = priv->hw->conf.beacon_int; | 7239 | priv->beacon_int = priv->hw->conf.beacon_int; |
7240 | priv->timestamp1 = 0; | 7240 | priv->timestamp1 = 0; |
7241 | priv->timestamp0 = 0; | 7241 | priv->timestamp0 = 0; |
7242 | if ((priv->iw_mode == IEEE80211_IF_TYPE_STA)) | 7242 | if ((priv->iw_mode == NL80211_IFTYPE_STATION)) |
7243 | priv->beacon_int = 0; | 7243 | priv->beacon_int = 0; |
7244 | 7244 | ||
7245 | spin_unlock_irqrestore(&priv->lock, flags); | 7245 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -7253,14 +7253,14 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7253 | /* we are restarting association process | 7253 | /* we are restarting association process |
7254 | * clear RXON_FILTER_ASSOC_MSK bit | 7254 | * clear RXON_FILTER_ASSOC_MSK bit |
7255 | */ | 7255 | */ |
7256 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 7256 | if (priv->iw_mode != NL80211_IFTYPE_AP) { |
7257 | iwl3945_scan_cancel_timeout(priv, 100); | 7257 | iwl3945_scan_cancel_timeout(priv, 100); |
7258 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7258 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7259 | iwl3945_commit_rxon(priv); | 7259 | iwl3945_commit_rxon(priv); |
7260 | } | 7260 | } |
7261 | 7261 | ||
7262 | /* Per mac80211.h: This is only used in IBSS mode... */ | 7262 | /* Per mac80211.h: This is only used in IBSS mode... */ |
7263 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 7263 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
7264 | 7264 | ||
7265 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); | 7265 | IWL_DEBUG_MAC80211("leave - not in IBSS\n"); |
7266 | mutex_unlock(&priv->mutex); | 7266 | mutex_unlock(&priv->mutex); |
@@ -7289,7 +7289,7 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
7289 | return -EIO; | 7289 | return -EIO; |
7290 | } | 7290 | } |
7291 | 7291 | ||
7292 | if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { | 7292 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { |
7293 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); | 7293 | IWL_DEBUG_MAC80211("leave - not IBSS\n"); |
7294 | mutex_unlock(&priv->mutex); | 7294 | mutex_unlock(&priv->mutex); |
7295 | return -EIO; | 7295 | return -EIO; |
@@ -7996,7 +7996,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7996 | IWL_DEBUG_INFO("Radio disabled.\n"); | 7996 | IWL_DEBUG_INFO("Radio disabled.\n"); |
7997 | } | 7997 | } |
7998 | 7998 | ||
7999 | priv->iw_mode = IEEE80211_IF_TYPE_STA; | 7999 | priv->iw_mode = NL80211_IFTYPE_STATION; |
8000 | 8000 | ||
8001 | printk(KERN_INFO DRV_NAME | 8001 | printk(KERN_INFO DRV_NAME |
8002 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); | 8002 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); |
@@ -8376,6 +8376,8 @@ static void __exit iwl3945_exit(void) | |||
8376 | iwl3945_rate_control_unregister(); | 8376 | iwl3945_rate_control_unregister(); |
8377 | } | 8377 | } |
8378 | 8378 | ||
8379 | MODULE_FIRMWARE("iwlwifi-3945" IWL3945_UCODE_API ".ucode"); | ||
8380 | |||
8379 | module_param_named(antenna, iwl3945_param_antenna, int, 0444); | 8381 | module_param_named(antenna, iwl3945_param_antenna, int, 0444); |
8380 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); | 8382 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); |
8381 | module_param_named(disable, iwl3945_param_disable, int, 0444); | 8383 | module_param_named(disable, iwl3945_param_disable, int, 0444); |
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 4ddf44b2758b..92be60415d04 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -823,11 +823,7 @@ static int assoc_helper_mode(struct lbs_private *priv, | |||
823 | } | 823 | } |
824 | 824 | ||
825 | priv->mode = assoc_req->mode; | 825 | priv->mode = assoc_req->mode; |
826 | ret = lbs_prepare_and_send_command(priv, | 826 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, assoc_req->mode); |
827 | CMD_802_11_SNMP_MIB, | ||
828 | 0, CMD_OPTION_WAITFORRSP, | ||
829 | OID_802_11_INFRASTRUCTURE_MODE, | ||
830 | /* Shoot me now */ (void *) (size_t) assoc_req->mode); | ||
831 | 827 | ||
832 | done: | 828 | done: |
833 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | 829 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 5fef05f3cd00..aee19fa844e4 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -480,138 +480,103 @@ int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action, | |||
480 | return ret; | 480 | return ret; |
481 | } | 481 | } |
482 | 482 | ||
483 | static int lbs_cmd_802_11_reset(struct cmd_ds_command *cmd, int cmd_action) | 483 | /** |
484 | { | 484 | * @brief Set an SNMP MIB value |
485 | struct cmd_ds_802_11_reset *reset = &cmd->params.reset; | 485 | * |
486 | 486 | * @param priv A pointer to struct lbs_private structure | |
487 | lbs_deb_enter(LBS_DEB_CMD); | 487 | * @param oid The OID to set in the firmware |
488 | 488 | * @param val Value to set the OID to | |
489 | cmd->command = cpu_to_le16(CMD_802_11_RESET); | 489 | * |
490 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN); | 490 | * @return 0 on success, error on failure |
491 | reset->action = cpu_to_le16(cmd_action); | 491 | */ |
492 | 492 | int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val) | |
493 | lbs_deb_leave(LBS_DEB_CMD); | ||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv, | ||
498 | struct cmd_ds_command *cmd, | ||
499 | int cmd_action, | ||
500 | int cmd_oid, void *pdata_buf) | ||
501 | { | 493 | { |
502 | struct cmd_ds_802_11_snmp_mib *pSNMPMIB = &cmd->params.smib; | 494 | struct cmd_ds_802_11_snmp_mib cmd; |
503 | u8 ucTemp; | 495 | int ret; |
504 | 496 | ||
505 | lbs_deb_enter(LBS_DEB_CMD); | 497 | lbs_deb_enter(LBS_DEB_CMD); |
506 | 498 | ||
507 | lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); | 499 | memset(&cmd, 0, sizeof (cmd)); |
508 | 500 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | |
509 | cmd->command = cpu_to_le16(CMD_802_11_SNMP_MIB); | 501 | cmd.action = cpu_to_le16(CMD_ACT_SET); |
510 | cmd->size = cpu_to_le16(sizeof(*pSNMPMIB) + S_DS_GEN); | 502 | cmd.oid = cpu_to_le16((u16) oid); |
511 | |||
512 | switch (cmd_oid) { | ||
513 | case OID_802_11_INFRASTRUCTURE_MODE: | ||
514 | { | ||
515 | u8 mode = (u8) (size_t) pdata_buf; | ||
516 | pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); | ||
517 | pSNMPMIB->oid = cpu_to_le16((u16) DESIRED_BSSTYPE_I); | ||
518 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u8)); | ||
519 | if (mode == IW_MODE_ADHOC) { | ||
520 | ucTemp = SNMP_MIB_VALUE_ADHOC; | ||
521 | } else { | ||
522 | /* Infra and Auto modes */ | ||
523 | ucTemp = SNMP_MIB_VALUE_INFRA; | ||
524 | } | ||
525 | |||
526 | memmove(pSNMPMIB->value, &ucTemp, sizeof(u8)); | ||
527 | 503 | ||
504 | switch (oid) { | ||
505 | case SNMP_MIB_OID_BSS_TYPE: | ||
506 | cmd.bufsize = cpu_to_le16(sizeof(u8)); | ||
507 | cmd.value[0] = (val == IW_MODE_ADHOC) ? 2 : 1; | ||
508 | break; | ||
509 | case SNMP_MIB_OID_11D_ENABLE: | ||
510 | case SNMP_MIB_OID_FRAG_THRESHOLD: | ||
511 | case SNMP_MIB_OID_RTS_THRESHOLD: | ||
512 | case SNMP_MIB_OID_SHORT_RETRY_LIMIT: | ||
513 | case SNMP_MIB_OID_LONG_RETRY_LIMIT: | ||
514 | cmd.bufsize = cpu_to_le16(sizeof(u16)); | ||
515 | *((__le16 *)(&cmd.value)) = cpu_to_le16(val); | ||
528 | break; | 516 | break; |
517 | default: | ||
518 | lbs_deb_cmd("SNMP_CMD: (set) unhandled OID 0x%x\n", oid); | ||
519 | ret = -EINVAL; | ||
520 | goto out; | ||
529 | } | 521 | } |
530 | 522 | ||
531 | case OID_802_11D_ENABLE: | 523 | lbs_deb_cmd("SNMP_CMD: (set) oid 0x%x, oid size 0x%x, value 0x%x\n", |
532 | { | 524 | le16_to_cpu(cmd.oid), le16_to_cpu(cmd.bufsize), val); |
533 | u32 ulTemp; | ||
534 | |||
535 | pSNMPMIB->oid = cpu_to_le16((u16) DOT11D_I); | ||
536 | |||
537 | if (cmd_action == CMD_ACT_SET) { | ||
538 | pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); | ||
539 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); | ||
540 | ulTemp = *(u32 *)pdata_buf; | ||
541 | *((__le16 *)(pSNMPMIB->value)) = | ||
542 | cpu_to_le16((u16) ulTemp); | ||
543 | } | ||
544 | break; | ||
545 | } | ||
546 | |||
547 | case OID_802_11_FRAGMENTATION_THRESHOLD: | ||
548 | { | ||
549 | u32 ulTemp; | ||
550 | |||
551 | pSNMPMIB->oid = cpu_to_le16((u16) FRAGTHRESH_I); | ||
552 | 525 | ||
553 | if (cmd_action == CMD_ACT_GET) { | 526 | ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd); |
554 | pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET); | ||
555 | } else if (cmd_action == CMD_ACT_SET) { | ||
556 | pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); | ||
557 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); | ||
558 | ulTemp = *((u32 *) pdata_buf); | ||
559 | *((__le16 *)(pSNMPMIB->value)) = | ||
560 | cpu_to_le16((u16) ulTemp); | ||
561 | 527 | ||
562 | } | 528 | out: |
563 | 529 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | |
564 | break; | 530 | return ret; |
565 | } | 531 | } |
566 | 532 | ||
567 | case OID_802_11_RTS_THRESHOLD: | 533 | /** |
568 | { | 534 | * @brief Get an SNMP MIB value |
535 | * | ||
536 | * @param priv A pointer to struct lbs_private structure | ||
537 | * @param oid The OID to retrieve from the firmware | ||
538 | * @param out_val Location for the returned value | ||
539 | * | ||
540 | * @return 0 on success, error on failure | ||
541 | */ | ||
542 | int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val) | ||
543 | { | ||
544 | struct cmd_ds_802_11_snmp_mib cmd; | ||
545 | int ret; | ||
569 | 546 | ||
570 | u32 ulTemp; | 547 | lbs_deb_enter(LBS_DEB_CMD); |
571 | pSNMPMIB->oid = cpu_to_le16(RTSTHRESH_I); | ||
572 | 548 | ||
573 | if (cmd_action == CMD_ACT_GET) { | 549 | memset(&cmd, 0, sizeof (cmd)); |
574 | pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET); | 550 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
575 | } else if (cmd_action == CMD_ACT_SET) { | 551 | cmd.action = cpu_to_le16(CMD_ACT_GET); |
576 | pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); | 552 | cmd.oid = cpu_to_le16(oid); |
577 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); | ||
578 | ulTemp = *((u32 *)pdata_buf); | ||
579 | *(__le16 *)(pSNMPMIB->value) = | ||
580 | cpu_to_le16((u16) ulTemp); | ||
581 | 553 | ||
582 | } | 554 | ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd); |
583 | break; | 555 | if (ret) |
584 | } | 556 | goto out; |
585 | case OID_802_11_TX_RETRYCOUNT: | ||
586 | pSNMPMIB->oid = cpu_to_le16((u16) SHORT_RETRYLIM_I); | ||
587 | |||
588 | if (cmd_action == CMD_ACT_GET) { | ||
589 | pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET); | ||
590 | } else if (cmd_action == CMD_ACT_SET) { | ||
591 | pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET); | ||
592 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); | ||
593 | *((__le16 *)(pSNMPMIB->value)) = | ||
594 | cpu_to_le16((u16) priv->txretrycount); | ||
595 | } | ||
596 | 557 | ||
558 | switch (le16_to_cpu(cmd.bufsize)) { | ||
559 | case sizeof(u8): | ||
560 | if (oid == SNMP_MIB_OID_BSS_TYPE) { | ||
561 | if (cmd.value[0] == 2) | ||
562 | *out_val = IW_MODE_ADHOC; | ||
563 | else | ||
564 | *out_val = IW_MODE_INFRA; | ||
565 | } else | ||
566 | *out_val = cmd.value[0]; | ||
567 | break; | ||
568 | case sizeof(u16): | ||
569 | *out_val = le16_to_cpu(*((__le16 *)(&cmd.value))); | ||
597 | break; | 570 | break; |
598 | default: | 571 | default: |
572 | lbs_deb_cmd("SNMP_CMD: (get) unhandled OID 0x%x size %d\n", | ||
573 | oid, le16_to_cpu(cmd.bufsize)); | ||
599 | break; | 574 | break; |
600 | } | 575 | } |
601 | 576 | ||
602 | lbs_deb_cmd( | 577 | out: |
603 | "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n", | 578 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
604 | le16_to_cpu(cmd->command), le16_to_cpu(cmd->size), | 579 | return ret; |
605 | le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result)); | ||
606 | |||
607 | lbs_deb_cmd( | ||
608 | "SNMP_CMD: action 0x%x, oid 0x%x, oidsize 0x%x, value 0x%x\n", | ||
609 | le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid), | ||
610 | le16_to_cpu(pSNMPMIB->bufsize), | ||
611 | le16_to_cpu(*(__le16 *) pSNMPMIB->value)); | ||
612 | |||
613 | lbs_deb_leave(LBS_DEB_CMD); | ||
614 | return 0; | ||
615 | } | 580 | } |
616 | 581 | ||
617 | /** | 582 | /** |
@@ -1419,19 +1384,10 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, | |||
1419 | ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf); | 1384 | ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf); |
1420 | break; | 1385 | break; |
1421 | 1386 | ||
1422 | case CMD_802_11_RESET: | ||
1423 | ret = lbs_cmd_802_11_reset(cmdptr, cmd_action); | ||
1424 | break; | ||
1425 | |||
1426 | case CMD_802_11_AUTHENTICATE: | 1387 | case CMD_802_11_AUTHENTICATE: |
1427 | ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf); | 1388 | ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf); |
1428 | break; | 1389 | break; |
1429 | 1390 | ||
1430 | case CMD_802_11_SNMP_MIB: | ||
1431 | ret = lbs_cmd_802_11_snmp_mib(priv, cmdptr, | ||
1432 | cmd_action, cmd_oid, pdata_buf); | ||
1433 | break; | ||
1434 | |||
1435 | case CMD_MAC_REG_ACCESS: | 1391 | case CMD_MAC_REG_ACCESS: |
1436 | case CMD_BBP_REG_ACCESS: | 1392 | case CMD_BBP_REG_ACCESS: |
1437 | case CMD_RF_REG_ACCESS: | 1393 | case CMD_RF_REG_ACCESS: |
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 336a181d857a..d002160f597d 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h | |||
@@ -73,4 +73,8 @@ int lbs_set_tx_power(struct lbs_private *priv, s16 dbm); | |||
73 | 73 | ||
74 | int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on); | 74 | int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on); |
75 | 75 | ||
76 | int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val); | ||
77 | |||
78 | int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val); | ||
79 | |||
76 | #endif /* _LBS_CMD_H */ | 80 | #endif /* _LBS_CMD_H */ |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 0371c83f5661..bcf2a9756fb6 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -146,48 +146,6 @@ static int lbs_ret_reg_access(struct lbs_private *priv, | |||
146 | return ret; | 146 | return ret; |
147 | } | 147 | } |
148 | 148 | ||
149 | static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv, | ||
150 | struct cmd_ds_command *resp) | ||
151 | { | ||
152 | struct cmd_ds_802_11_snmp_mib *smib = &resp->params.smib; | ||
153 | u16 oid = le16_to_cpu(smib->oid); | ||
154 | u16 querytype = le16_to_cpu(smib->querytype); | ||
155 | |||
156 | lbs_deb_enter(LBS_DEB_CMD); | ||
157 | |||
158 | lbs_deb_cmd("SNMP_RESP: oid 0x%x, querytype 0x%x\n", oid, | ||
159 | querytype); | ||
160 | lbs_deb_cmd("SNMP_RESP: Buf size %d\n", le16_to_cpu(smib->bufsize)); | ||
161 | |||
162 | if (querytype == CMD_ACT_GET) { | ||
163 | switch (oid) { | ||
164 | case FRAGTHRESH_I: | ||
165 | priv->fragthsd = | ||
166 | le16_to_cpu(*((__le16 *)(smib->value))); | ||
167 | lbs_deb_cmd("SNMP_RESP: frag threshold %u\n", | ||
168 | priv->fragthsd); | ||
169 | break; | ||
170 | case RTSTHRESH_I: | ||
171 | priv->rtsthsd = | ||
172 | le16_to_cpu(*((__le16 *)(smib->value))); | ||
173 | lbs_deb_cmd("SNMP_RESP: rts threshold %u\n", | ||
174 | priv->rtsthsd); | ||
175 | break; | ||
176 | case SHORT_RETRYLIM_I: | ||
177 | priv->txretrycount = | ||
178 | le16_to_cpu(*((__le16 *)(smib->value))); | ||
179 | lbs_deb_cmd("SNMP_RESP: tx retry count %u\n", | ||
180 | priv->rtsthsd); | ||
181 | break; | ||
182 | default: | ||
183 | break; | ||
184 | } | ||
185 | } | ||
186 | |||
187 | lbs_deb_enter(LBS_DEB_CMD); | ||
188 | return 0; | ||
189 | } | ||
190 | |||
191 | static int lbs_ret_802_11_rssi(struct lbs_private *priv, | 149 | static int lbs_ret_802_11_rssi(struct lbs_private *priv, |
192 | struct cmd_ds_command *resp) | 150 | struct cmd_ds_command *resp) |
193 | { | 151 | { |
@@ -258,10 +216,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, | |||
258 | ret = lbs_ret_80211_associate(priv, resp); | 216 | ret = lbs_ret_80211_associate(priv, resp); |
259 | break; | 217 | break; |
260 | 218 | ||
261 | case CMD_RET(CMD_802_11_SNMP_MIB): | ||
262 | ret = lbs_ret_802_11_snmp_mib(priv, resp); | ||
263 | break; | ||
264 | |||
265 | case CMD_RET(CMD_802_11_SET_AFC): | 219 | case CMD_RET(CMD_802_11_SET_AFC): |
266 | case CMD_RET(CMD_802_11_GET_AFC): | 220 | case CMD_RET(CMD_802_11_GET_AFC): |
267 | spin_lock_irqsave(&priv->driver_lock, flags); | 221 | spin_lock_irqsave(&priv->driver_lock, flags); |
@@ -271,7 +225,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, | |||
271 | 225 | ||
272 | break; | 226 | break; |
273 | 227 | ||
274 | case CMD_RET(CMD_802_11_RESET): | ||
275 | case CMD_RET(CMD_802_11_AUTHENTICATE): | 228 | case CMD_RET(CMD_802_11_AUTHENTICATE): |
276 | case CMD_RET(CMD_802_11_BEACON_STOP): | 229 | case CMD_RET(CMD_802_11_BEACON_STOP): |
277 | break; | 230 | break; |
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index c89d7a1041a8..58d11a35e61b 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -352,27 +352,6 @@ enum mv_ms_type { | |||
352 | MVMS_EVENT | 352 | MVMS_EVENT |
353 | }; | 353 | }; |
354 | 354 | ||
355 | /** SNMP_MIB_INDEX_e */ | ||
356 | enum SNMP_MIB_INDEX_e { | ||
357 | DESIRED_BSSTYPE_I = 0, | ||
358 | OP_RATESET_I, | ||
359 | BCNPERIOD_I, | ||
360 | DTIMPERIOD_I, | ||
361 | ASSOCRSP_TIMEOUT_I, | ||
362 | RTSTHRESH_I, | ||
363 | SHORT_RETRYLIM_I, | ||
364 | LONG_RETRYLIM_I, | ||
365 | FRAGTHRESH_I, | ||
366 | DOT11D_I, | ||
367 | DOT11H_I, | ||
368 | MANUFID_I, | ||
369 | PRODID_I, | ||
370 | MANUF_OUI_I, | ||
371 | MANUF_NAME_I, | ||
372 | MANUF_PRODNAME_I, | ||
373 | MANUF_PRODVER_I, | ||
374 | }; | ||
375 | |||
376 | /** KEY_TYPE_ID */ | 355 | /** KEY_TYPE_ID */ |
377 | enum KEY_TYPE_ID { | 356 | enum KEY_TYPE_ID { |
378 | KEY_TYPE_ID_WEP = 0, | 357 | KEY_TYPE_ID_WEP = 0, |
@@ -387,12 +366,6 @@ enum KEY_INFO_WPA { | |||
387 | KEY_INFO_WPA_ENABLED = 0x04 | 366 | KEY_INFO_WPA_ENABLED = 0x04 |
388 | }; | 367 | }; |
389 | 368 | ||
390 | /** SNMP_MIB_VALUE_e */ | ||
391 | enum SNMP_MIB_VALUE_e { | ||
392 | SNMP_MIB_VALUE_INFRA = 1, | ||
393 | SNMP_MIB_VALUE_ADHOC | ||
394 | }; | ||
395 | |||
396 | /* Default values for fwt commands. */ | 369 | /* Default values for fwt commands. */ |
397 | #define FWT_DEFAULT_METRIC 0 | 370 | #define FWT_DEFAULT_METRIC 0 |
398 | #define FWT_DEFAULT_DIR 1 | 371 | #define FWT_DEFAULT_DIR 1 |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index fd59e1816460..acb889e25900 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -240,9 +240,6 @@ struct lbs_private { | |||
240 | uint16_t enablehwauto; | 240 | uint16_t enablehwauto; |
241 | uint16_t ratebitmap; | 241 | uint16_t ratebitmap; |
242 | 242 | ||
243 | u32 fragthsd; | ||
244 | u32 rtsthsd; | ||
245 | |||
246 | u8 txretrycount; | 243 | u8 txretrycount; |
247 | 244 | ||
248 | /** Tx-related variables (for single packet tx) */ | 245 | /** Tx-related variables (for single packet tx) */ |
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index a916bb9bd5da..5004d7679c02 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h | |||
@@ -9,17 +9,6 @@ | |||
9 | #define DEFAULT_AD_HOC_CHANNEL 6 | 9 | #define DEFAULT_AD_HOC_CHANNEL 6 |
10 | #define DEFAULT_AD_HOC_CHANNEL_A 36 | 10 | #define DEFAULT_AD_HOC_CHANNEL_A 36 |
11 | 11 | ||
12 | /** IEEE 802.11 oids */ | ||
13 | #define OID_802_11_SSID 0x00008002 | ||
14 | #define OID_802_11_INFRASTRUCTURE_MODE 0x00008008 | ||
15 | #define OID_802_11_FRAGMENTATION_THRESHOLD 0x00008009 | ||
16 | #define OID_802_11_RTS_THRESHOLD 0x0000800A | ||
17 | #define OID_802_11_TX_ANTENNA_SELECTED 0x0000800D | ||
18 | #define OID_802_11_SUPPORTED_RATES 0x0000800E | ||
19 | #define OID_802_11_STATISTICS 0x00008012 | ||
20 | #define OID_802_11_TX_RETRYCOUNT 0x0000801D | ||
21 | #define OID_802_11D_ENABLE 0x00008020 | ||
22 | |||
23 | #define CMD_OPTION_WAITFORRSP 0x0002 | 12 | #define CMD_OPTION_WAITFORRSP 0x0002 |
24 | 13 | ||
25 | /** Host command IDs */ | 14 | /** Host command IDs */ |
@@ -191,6 +180,19 @@ | |||
191 | #define CMD_WAKE_METHOD_COMMAND_INT 0x0001 | 180 | #define CMD_WAKE_METHOD_COMMAND_INT 0x0001 |
192 | #define CMD_WAKE_METHOD_GPIO 0x0002 | 181 | #define CMD_WAKE_METHOD_GPIO 0x0002 |
193 | 182 | ||
183 | /* Object IDs for CMD_802_11_SNMP_MIB */ | ||
184 | #define SNMP_MIB_OID_BSS_TYPE 0x0000 | ||
185 | #define SNMP_MIB_OID_OP_RATE_SET 0x0001 | ||
186 | #define SNMP_MIB_OID_BEACON_PERIOD 0x0002 /* Reserved on v9+ */ | ||
187 | #define SNMP_MIB_OID_DTIM_PERIOD 0x0003 /* Reserved on v9+ */ | ||
188 | #define SNMP_MIB_OID_ASSOC_TIMEOUT 0x0004 /* Reserved on v9+ */ | ||
189 | #define SNMP_MIB_OID_RTS_THRESHOLD 0x0005 | ||
190 | #define SNMP_MIB_OID_SHORT_RETRY_LIMIT 0x0006 | ||
191 | #define SNMP_MIB_OID_LONG_RETRY_LIMIT 0x0007 | ||
192 | #define SNMP_MIB_OID_FRAG_THRESHOLD 0x0008 | ||
193 | #define SNMP_MIB_OID_11D_ENABLE 0x0009 | ||
194 | #define SNMP_MIB_OID_11H_ENABLE 0x000A | ||
195 | |||
194 | /* Define action or option for CMD_BT_ACCESS */ | 196 | /* Define action or option for CMD_BT_ACCESS */ |
195 | enum cmd_bt_access_opts { | 197 | enum cmd_bt_access_opts { |
196 | /* The bt commands start at 5 instead of 1 because the old dft commands | 198 | /* The bt commands start at 5 instead of 1 because the old dft commands |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 630b79967560..d9f9a12a739e 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -151,10 +151,6 @@ struct cmd_ds_get_hw_spec { | |||
151 | __le32 fwcapinfo; | 151 | __le32 fwcapinfo; |
152 | } __attribute__ ((packed)); | 152 | } __attribute__ ((packed)); |
153 | 153 | ||
154 | struct cmd_ds_802_11_reset { | ||
155 | __le16 action; | ||
156 | }; | ||
157 | |||
158 | struct cmd_ds_802_11_subscribe_event { | 154 | struct cmd_ds_802_11_subscribe_event { |
159 | struct cmd_header hdr; | 155 | struct cmd_header hdr; |
160 | 156 | ||
@@ -301,7 +297,9 @@ struct cmd_ds_802_11_get_stat { | |||
301 | }; | 297 | }; |
302 | 298 | ||
303 | struct cmd_ds_802_11_snmp_mib { | 299 | struct cmd_ds_802_11_snmp_mib { |
304 | __le16 querytype; | 300 | struct cmd_header hdr; |
301 | |||
302 | __le16 action; | ||
305 | __le16 oid; | 303 | __le16 oid; |
306 | __le16 bufsize; | 304 | __le16 bufsize; |
307 | u8 value[128]; | 305 | u8 value[128]; |
@@ -717,11 +715,9 @@ struct cmd_ds_command { | |||
717 | union { | 715 | union { |
718 | struct cmd_ds_802_11_ps_mode psmode; | 716 | struct cmd_ds_802_11_ps_mode psmode; |
719 | struct cmd_ds_802_11_associate associate; | 717 | struct cmd_ds_802_11_associate associate; |
720 | struct cmd_ds_802_11_reset reset; | ||
721 | struct cmd_ds_802_11_authenticate auth; | 718 | struct cmd_ds_802_11_authenticate auth; |
722 | struct cmd_ds_802_11_get_stat gstat; | 719 | struct cmd_ds_802_11_get_stat gstat; |
723 | struct cmd_ds_802_3_get_stat gstat_8023; | 720 | struct cmd_ds_802_3_get_stat gstat_8023; |
724 | struct cmd_ds_802_11_snmp_mib smib; | ||
725 | struct cmd_ds_802_11_rf_antenna rant; | 721 | struct cmd_ds_802_11_rf_antenna rant; |
726 | struct cmd_ds_802_11_monitor_mode monitor; | 722 | struct cmd_ds_802_11_monitor_mode monitor; |
727 | struct cmd_ds_802_11_rssi rssi; | 723 | struct cmd_ds_802_11_rssi rssi; |
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 7b02d612b076..cafbccb74143 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -439,11 +439,10 @@ static int if_usb_reset_device(struct if_usb_card *cardp) | |||
439 | *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); | 439 | *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); |
440 | 440 | ||
441 | cmd->command = cpu_to_le16(CMD_802_11_RESET); | 441 | cmd->command = cpu_to_le16(CMD_802_11_RESET); |
442 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN); | 442 | cmd->size = cpu_to_le16(sizeof(struct cmd_header)); |
443 | cmd->result = cpu_to_le16(0); | 443 | cmd->result = cpu_to_le16(0); |
444 | cmd->seqnum = cpu_to_le16(0x5a5a); | 444 | cmd->seqnum = cpu_to_le16(0x5a5a); |
445 | cmd->params.reset.action = cpu_to_le16(CMD_ACT_HALT); | 445 | usb_tx_block(cardp, cardp->ep_out_buf, 4 + sizeof(struct cmd_header)); |
446 | usb_tx_block(cardp, cardp->ep_out_buf, 4 + S_DS_GEN + sizeof(struct cmd_ds_802_11_reset)); | ||
447 | 446 | ||
448 | msleep(100); | 447 | msleep(100); |
449 | ret = usb_reset_device(cardp->udev); | 448 | ret = usb_reset_device(cardp->udev); |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index e8cadad2c863..11297dcf9fc3 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -30,6 +30,14 @@ static inline void lbs_postpone_association_work(struct lbs_private *priv) | |||
30 | queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); | 30 | queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); |
31 | } | 31 | } |
32 | 32 | ||
33 | static inline void lbs_do_association_work(struct lbs_private *priv) | ||
34 | { | ||
35 | if (priv->surpriseremoved) | ||
36 | return; | ||
37 | cancel_delayed_work(&priv->assoc_work); | ||
38 | queue_delayed_work(priv->work_thread, &priv->assoc_work, 0); | ||
39 | } | ||
40 | |||
33 | static inline void lbs_cancel_association_work(struct lbs_private *priv) | 41 | static inline void lbs_cancel_association_work(struct lbs_private *priv) |
34 | { | 42 | { |
35 | cancel_delayed_work(&priv->assoc_work); | 43 | cancel_delayed_work(&priv->assoc_work); |
@@ -266,21 +274,17 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, | |||
266 | { | 274 | { |
267 | int ret = 0; | 275 | int ret = 0; |
268 | struct lbs_private *priv = dev->priv; | 276 | struct lbs_private *priv = dev->priv; |
269 | u32 rthr = vwrq->value; | 277 | u32 val = vwrq->value; |
270 | 278 | ||
271 | lbs_deb_enter(LBS_DEB_WEXT); | 279 | lbs_deb_enter(LBS_DEB_WEXT); |
272 | 280 | ||
273 | if (vwrq->disabled) { | 281 | if (vwrq->disabled) |
274 | priv->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; | 282 | val = MRVDRV_RTS_MAX_VALUE; |
275 | } else { | ||
276 | if (rthr < MRVDRV_RTS_MIN_VALUE || rthr > MRVDRV_RTS_MAX_VALUE) | ||
277 | return -EINVAL; | ||
278 | priv->rtsthsd = rthr; | ||
279 | } | ||
280 | 283 | ||
281 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 284 | if (val > MRVDRV_RTS_MAX_VALUE) /* min rts value is 0 */ |
282 | CMD_ACT_SET, CMD_OPTION_WAITFORRSP, | 285 | return -EINVAL; |
283 | OID_802_11_RTS_THRESHOLD, &rthr); | 286 | |
287 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, (u16) val); | ||
284 | 288 | ||
285 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 289 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
286 | return ret; | 290 | return ret; |
@@ -289,21 +293,18 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, | |||
289 | static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, | 293 | static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, |
290 | struct iw_param *vwrq, char *extra) | 294 | struct iw_param *vwrq, char *extra) |
291 | { | 295 | { |
292 | int ret = 0; | ||
293 | struct lbs_private *priv = dev->priv; | 296 | struct lbs_private *priv = dev->priv; |
297 | int ret = 0; | ||
298 | u16 val = 0; | ||
294 | 299 | ||
295 | lbs_deb_enter(LBS_DEB_WEXT); | 300 | lbs_deb_enter(LBS_DEB_WEXT); |
296 | 301 | ||
297 | priv->rtsthsd = 0; | 302 | ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, &val); |
298 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | ||
299 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | ||
300 | OID_802_11_RTS_THRESHOLD, NULL); | ||
301 | if (ret) | 303 | if (ret) |
302 | goto out; | 304 | goto out; |
303 | 305 | ||
304 | vwrq->value = priv->rtsthsd; | 306 | vwrq->value = val; |
305 | vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) | 307 | vwrq->disabled = val > MRVDRV_RTS_MAX_VALUE; /* min rts value is 0 */ |
306 | || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); | ||
307 | vwrq->fixed = 1; | 308 | vwrq->fixed = 1; |
308 | 309 | ||
309 | out: | 310 | out: |
@@ -314,24 +315,19 @@ out: | |||
314 | static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, | 315 | static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, |
315 | struct iw_param *vwrq, char *extra) | 316 | struct iw_param *vwrq, char *extra) |
316 | { | 317 | { |
317 | int ret = 0; | ||
318 | u32 fthr = vwrq->value; | ||
319 | struct lbs_private *priv = dev->priv; | 318 | struct lbs_private *priv = dev->priv; |
319 | int ret = 0; | ||
320 | u32 val = vwrq->value; | ||
320 | 321 | ||
321 | lbs_deb_enter(LBS_DEB_WEXT); | 322 | lbs_deb_enter(LBS_DEB_WEXT); |
322 | 323 | ||
323 | if (vwrq->disabled) { | 324 | if (vwrq->disabled) |
324 | priv->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; | 325 | val = MRVDRV_FRAG_MAX_VALUE; |
325 | } else { | 326 | |
326 | if (fthr < MRVDRV_FRAG_MIN_VALUE | 327 | if (val < MRVDRV_FRAG_MIN_VALUE || val > MRVDRV_FRAG_MAX_VALUE) |
327 | || fthr > MRVDRV_FRAG_MAX_VALUE) | 328 | return -EINVAL; |
328 | return -EINVAL; | ||
329 | priv->fragthsd = fthr; | ||
330 | } | ||
331 | 329 | ||
332 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 330 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, (u16) val); |
333 | CMD_ACT_SET, CMD_OPTION_WAITFORRSP, | ||
334 | OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); | ||
335 | 331 | ||
336 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | 332 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
337 | return ret; | 333 | return ret; |
@@ -340,22 +336,19 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, | |||
340 | static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, | 336 | static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, |
341 | struct iw_param *vwrq, char *extra) | 337 | struct iw_param *vwrq, char *extra) |
342 | { | 338 | { |
343 | int ret = 0; | ||
344 | struct lbs_private *priv = dev->priv; | 339 | struct lbs_private *priv = dev->priv; |
340 | int ret = 0; | ||
341 | u16 val = 0; | ||
345 | 342 | ||
346 | lbs_deb_enter(LBS_DEB_WEXT); | 343 | lbs_deb_enter(LBS_DEB_WEXT); |
347 | 344 | ||
348 | priv->fragthsd = 0; | 345 | ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, &val); |
349 | ret = lbs_prepare_and_send_command(priv, | ||
350 | CMD_802_11_SNMP_MIB, | ||
351 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | ||
352 | OID_802_11_FRAGMENTATION_THRESHOLD, NULL); | ||
353 | if (ret) | 346 | if (ret) |
354 | goto out; | 347 | goto out; |
355 | 348 | ||
356 | vwrq->value = priv->fragthsd; | 349 | vwrq->value = val; |
357 | vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) | 350 | vwrq->disabled = ((val < MRVDRV_FRAG_MIN_VALUE) |
358 | || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); | 351 | || (val > MRVDRV_FRAG_MAX_VALUE)); |
359 | vwrq->fixed = 1; | 352 | vwrq->fixed = 1; |
360 | 353 | ||
361 | out: | 354 | out: |
@@ -382,7 +375,7 @@ static int mesh_wlan_get_mode(struct net_device *dev, | |||
382 | { | 375 | { |
383 | lbs_deb_enter(LBS_DEB_WEXT); | 376 | lbs_deb_enter(LBS_DEB_WEXT); |
384 | 377 | ||
385 | *uwrq = IW_MODE_REPEAT ; | 378 | *uwrq = IW_MODE_REPEAT; |
386 | 379 | ||
387 | lbs_deb_leave(LBS_DEB_WEXT); | 380 | lbs_deb_leave(LBS_DEB_WEXT); |
388 | return 0; | 381 | return 0; |
@@ -425,31 +418,44 @@ out: | |||
425 | static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, | 418 | static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, |
426 | struct iw_param *vwrq, char *extra) | 419 | struct iw_param *vwrq, char *extra) |
427 | { | 420 | { |
428 | int ret = 0; | ||
429 | struct lbs_private *priv = dev->priv; | 421 | struct lbs_private *priv = dev->priv; |
422 | int ret = 0; | ||
423 | u16 slimit = 0, llimit = 0; | ||
430 | 424 | ||
431 | lbs_deb_enter(LBS_DEB_WEXT); | 425 | lbs_deb_enter(LBS_DEB_WEXT); |
432 | 426 | ||
433 | if (vwrq->flags == IW_RETRY_LIMIT) { | 427 | if ((vwrq->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) |
434 | /* The MAC has a 4-bit Total_Tx_Count register | 428 | return -EOPNOTSUPP; |
435 | Total_Tx_Count = 1 + Tx_Retry_Count */ | 429 | |
430 | /* The MAC has a 4-bit Total_Tx_Count register | ||
431 | Total_Tx_Count = 1 + Tx_Retry_Count */ | ||
436 | #define TX_RETRY_MIN 0 | 432 | #define TX_RETRY_MIN 0 |
437 | #define TX_RETRY_MAX 14 | 433 | #define TX_RETRY_MAX 14 |
438 | if (vwrq->value < TX_RETRY_MIN || vwrq->value > TX_RETRY_MAX) | 434 | if (vwrq->value < TX_RETRY_MIN || vwrq->value > TX_RETRY_MAX) |
439 | return -EINVAL; | 435 | return -EINVAL; |
440 | 436 | ||
441 | /* Adding 1 to convert retry count to try count */ | 437 | /* Add 1 to convert retry count to try count */ |
442 | priv->txretrycount = vwrq->value + 1; | 438 | if (vwrq->flags & IW_RETRY_SHORT) |
439 | slimit = (u16) (vwrq->value + 1); | ||
440 | else if (vwrq->flags & IW_RETRY_LONG) | ||
441 | llimit = (u16) (vwrq->value + 1); | ||
442 | else | ||
443 | slimit = llimit = (u16) (vwrq->value + 1); /* set both */ | ||
443 | 444 | ||
444 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB, | 445 | if (llimit) { |
445 | CMD_ACT_SET, | 446 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_LONG_RETRY_LIMIT, |
446 | CMD_OPTION_WAITFORRSP, | 447 | llimit); |
447 | OID_802_11_TX_RETRYCOUNT, NULL); | 448 | if (ret) |
449 | goto out; | ||
450 | } | ||
448 | 451 | ||
452 | if (slimit) { | ||
453 | /* txretrycount follows the short retry limit */ | ||
454 | priv->txretrycount = slimit; | ||
455 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_SHORT_RETRY_LIMIT, | ||
456 | slimit); | ||
449 | if (ret) | 457 | if (ret) |
450 | goto out; | 458 | goto out; |
451 | } else { | ||
452 | return -EOPNOTSUPP; | ||
453 | } | 459 | } |
454 | 460 | ||
455 | out: | 461 | out: |
@@ -462,22 +468,30 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, | |||
462 | { | 468 | { |
463 | struct lbs_private *priv = dev->priv; | 469 | struct lbs_private *priv = dev->priv; |
464 | int ret = 0; | 470 | int ret = 0; |
471 | u16 val = 0; | ||
465 | 472 | ||
466 | lbs_deb_enter(LBS_DEB_WEXT); | 473 | lbs_deb_enter(LBS_DEB_WEXT); |
467 | 474 | ||
468 | priv->txretrycount = 0; | ||
469 | ret = lbs_prepare_and_send_command(priv, | ||
470 | CMD_802_11_SNMP_MIB, | ||
471 | CMD_ACT_GET, CMD_OPTION_WAITFORRSP, | ||
472 | OID_802_11_TX_RETRYCOUNT, NULL); | ||
473 | if (ret) | ||
474 | goto out; | ||
475 | |||
476 | vwrq->disabled = 0; | 475 | vwrq->disabled = 0; |
477 | if (!vwrq->flags) { | 476 | |
478 | vwrq->flags = IW_RETRY_LIMIT; | 477 | if (vwrq->flags & IW_RETRY_LONG) { |
478 | ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_LONG_RETRY_LIMIT, &val); | ||
479 | if (ret) | ||
480 | goto out; | ||
481 | |||
482 | /* Subtract 1 to convert try count to retry count */ | ||
483 | vwrq->value = val - 1; | ||
484 | vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; | ||
485 | } else { | ||
486 | ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_SHORT_RETRY_LIMIT, &val); | ||
487 | if (ret) | ||
488 | goto out; | ||
489 | |||
490 | /* txretry count follows the short retry limit */ | ||
491 | priv->txretrycount = val; | ||
479 | /* Subtract 1 to convert try count to retry count */ | 492 | /* Subtract 1 to convert try count to retry count */ |
480 | vwrq->value = priv->txretrycount - 1; | 493 | vwrq->value = val - 1; |
494 | vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; | ||
481 | } | 495 | } |
482 | 496 | ||
483 | out: | 497 | out: |
@@ -1578,12 +1592,14 @@ static int lbs_set_encodeext(struct net_device *dev, | |||
1578 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); | 1592 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); |
1579 | } | 1593 | } |
1580 | 1594 | ||
1581 | disable_wep (assoc_req); | 1595 | /* Only disable wep if necessary: can't waste time here. */ |
1596 | if (priv->mac_control & CMD_ACT_MAC_WEP_ENABLE) | ||
1597 | disable_wep(assoc_req); | ||
1582 | } | 1598 | } |
1583 | 1599 | ||
1584 | out: | 1600 | out: |
1585 | if (ret == 0) { | 1601 | if (ret == 0) { /* key installation is time critical: postpone not! */ |
1586 | lbs_postpone_association_work(priv); | 1602 | lbs_do_association_work(priv); |
1587 | } else { | 1603 | } else { |
1588 | lbs_cancel_association_work(priv); | 1604 | lbs_cancel_association_work(priv); |
1589 | } | 1605 | } |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index c948021bff6a..feff945ad856 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -219,7 +219,7 @@ static void lbtf_tx_work(struct work_struct *work) | |||
219 | struct sk_buff *skb = NULL; | 219 | struct sk_buff *skb = NULL; |
220 | int err; | 220 | int err; |
221 | 221 | ||
222 | if ((priv->vif->type == IEEE80211_IF_TYPE_AP) && | 222 | if ((priv->vif->type == NL80211_IFTYPE_AP) && |
223 | (!skb_queue_empty(&priv->bc_ps_buf))) | 223 | (!skb_queue_empty(&priv->bc_ps_buf))) |
224 | skb = skb_dequeue(&priv->bc_ps_buf); | 224 | skb = skb_dequeue(&priv->bc_ps_buf); |
225 | else if (priv->skb_to_tx) { | 225 | else if (priv->skb_to_tx) { |
@@ -326,11 +326,11 @@ static int lbtf_op_add_interface(struct ieee80211_hw *hw, | |||
326 | 326 | ||
327 | priv->vif = conf->vif; | 327 | priv->vif = conf->vif; |
328 | switch (conf->type) { | 328 | switch (conf->type) { |
329 | case IEEE80211_IF_TYPE_MESH_POINT: | 329 | case NL80211_IFTYPE_MESH_POINT: |
330 | case IEEE80211_IF_TYPE_AP: | 330 | case NL80211_IFTYPE_AP: |
331 | lbtf_set_mode(priv, LBTF_AP_MODE); | 331 | lbtf_set_mode(priv, LBTF_AP_MODE); |
332 | break; | 332 | break; |
333 | case IEEE80211_IF_TYPE_STA: | 333 | case NL80211_IFTYPE_STATION: |
334 | lbtf_set_mode(priv, LBTF_STA_MODE); | 334 | lbtf_set_mode(priv, LBTF_STA_MODE); |
335 | break; | 335 | break; |
336 | default: | 336 | default: |
@@ -346,8 +346,8 @@ static void lbtf_op_remove_interface(struct ieee80211_hw *hw, | |||
346 | { | 346 | { |
347 | struct lbtf_private *priv = hw->priv; | 347 | struct lbtf_private *priv = hw->priv; |
348 | 348 | ||
349 | if (priv->vif->type == IEEE80211_IF_TYPE_AP || | 349 | if (priv->vif->type == NL80211_IFTYPE_AP || |
350 | priv->vif->type == IEEE80211_IF_TYPE_MESH_POINT) | 350 | priv->vif->type == NL80211_IFTYPE_MESH_POINT) |
351 | lbtf_beacon_ctrl(priv, 0, 0); | 351 | lbtf_beacon_ctrl(priv, 0, 0); |
352 | lbtf_set_mode(priv, LBTF_PASSIVE_MODE); | 352 | lbtf_set_mode(priv, LBTF_PASSIVE_MODE); |
353 | lbtf_set_bssid(priv, 0, NULL); | 353 | lbtf_set_bssid(priv, 0, NULL); |
@@ -372,8 +372,8 @@ static int lbtf_op_config_interface(struct ieee80211_hw *hw, | |||
372 | struct sk_buff *beacon; | 372 | struct sk_buff *beacon; |
373 | 373 | ||
374 | switch (priv->vif->type) { | 374 | switch (priv->vif->type) { |
375 | case IEEE80211_IF_TYPE_AP: | 375 | case NL80211_IFTYPE_AP: |
376 | case IEEE80211_IF_TYPE_MESH_POINT: | 376 | case NL80211_IFTYPE_MESH_POINT: |
377 | beacon = ieee80211_beacon_get(hw, vif); | 377 | beacon = ieee80211_beacon_get(hw, vif); |
378 | if (beacon) { | 378 | if (beacon) { |
379 | lbtf_beacon_set(priv, beacon); | 379 | lbtf_beacon_set(priv, beacon); |
@@ -614,7 +614,7 @@ void lbtf_bcn_sent(struct lbtf_private *priv) | |||
614 | { | 614 | { |
615 | struct sk_buff *skb = NULL; | 615 | struct sk_buff *skb = NULL; |
616 | 616 | ||
617 | if (priv->vif->type != IEEE80211_IF_TYPE_AP) | 617 | if (priv->vif->type != NL80211_IFTYPE_AP) |
618 | return; | 618 | return; |
619 | 619 | ||
620 | if (skb_queue_empty(&priv->bc_ps_buf)) { | 620 | if (skb_queue_empty(&priv->bc_ps_buf)) { |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 6ba50f087f7b..c9e4a435b2fc 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * - RX filtering based on filter configuration (data->rx_filter) | 14 | * - RX filtering based on filter configuration (data->rx_filter) |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/spinlock.h> | ||
17 | #include <net/mac80211.h> | 19 | #include <net/mac80211.h> |
18 | #include <net/ieee80211_radiotap.h> | 20 | #include <net/ieee80211_radiotap.h> |
19 | #include <linux/if_arp.h> | 21 | #include <linux/if_arp.h> |
@@ -28,11 +30,56 @@ static int radios = 2; | |||
28 | module_param(radios, int, 0444); | 30 | module_param(radios, int, 0444); |
29 | MODULE_PARM_DESC(radios, "Number of simulated radios"); | 31 | MODULE_PARM_DESC(radios, "Number of simulated radios"); |
30 | 32 | ||
33 | struct hwsim_vif_priv { | ||
34 | u32 magic; | ||
35 | }; | ||
36 | |||
37 | #define HWSIM_VIF_MAGIC 0x69537748 | ||
38 | |||
39 | static inline void hwsim_check_magic(struct ieee80211_vif *vif) | ||
40 | { | ||
41 | struct hwsim_vif_priv *vp = (void *)vif->drv_priv; | ||
42 | WARN_ON(vp->magic != HWSIM_VIF_MAGIC); | ||
43 | } | ||
44 | |||
45 | static inline void hwsim_set_magic(struct ieee80211_vif *vif) | ||
46 | { | ||
47 | struct hwsim_vif_priv *vp = (void *)vif->drv_priv; | ||
48 | vp->magic = HWSIM_VIF_MAGIC; | ||
49 | } | ||
50 | |||
51 | static inline void hwsim_clear_magic(struct ieee80211_vif *vif) | ||
52 | { | ||
53 | struct hwsim_vif_priv *vp = (void *)vif->drv_priv; | ||
54 | vp->magic = 0; | ||
55 | } | ||
56 | |||
57 | struct hwsim_sta_priv { | ||
58 | u32 magic; | ||
59 | }; | ||
60 | |||
61 | #define HWSIM_STA_MAGIC 0x6d537748 | ||
62 | |||
63 | static inline void hwsim_check_sta_magic(struct ieee80211_sta *sta) | ||
64 | { | ||
65 | struct hwsim_sta_priv *sp = (void *)sta->drv_priv; | ||
66 | WARN_ON(sp->magic != HWSIM_VIF_MAGIC); | ||
67 | } | ||
68 | |||
69 | static inline void hwsim_set_sta_magic(struct ieee80211_sta *sta) | ||
70 | { | ||
71 | struct hwsim_sta_priv *sp = (void *)sta->drv_priv; | ||
72 | sp->magic = HWSIM_VIF_MAGIC; | ||
73 | } | ||
74 | |||
75 | static inline void hwsim_clear_sta_magic(struct ieee80211_sta *sta) | ||
76 | { | ||
77 | struct hwsim_sta_priv *sp = (void *)sta->drv_priv; | ||
78 | sp->magic = 0; | ||
79 | } | ||
31 | 80 | ||
32 | static struct class *hwsim_class; | 81 | static struct class *hwsim_class; |
33 | 82 | ||
34 | static struct ieee80211_hw **hwsim_radios; | ||
35 | static int hwsim_radio_count; | ||
36 | static struct net_device *hwsim_mon; /* global monitor netdev */ | 83 | static struct net_device *hwsim_mon; /* global monitor netdev */ |
37 | 84 | ||
38 | 85 | ||
@@ -68,7 +115,12 @@ static const struct ieee80211_rate hwsim_rates[] = { | |||
68 | { .bitrate = 540 } | 115 | { .bitrate = 540 } |
69 | }; | 116 | }; |
70 | 117 | ||
118 | static spinlock_t hwsim_radio_lock; | ||
119 | static struct list_head hwsim_radios; | ||
120 | |||
71 | struct mac80211_hwsim_data { | 121 | struct mac80211_hwsim_data { |
122 | struct list_head list; | ||
123 | struct ieee80211_hw *hw; | ||
72 | struct device *dev; | 124 | struct device *dev; |
73 | struct ieee80211_supported_band band; | 125 | struct ieee80211_supported_band band; |
74 | struct ieee80211_channel channels[ARRAY_SIZE(hwsim_channels)]; | 126 | struct ieee80211_channel channels[ARRAY_SIZE(hwsim_channels)]; |
@@ -144,11 +196,11 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, | |||
144 | } | 196 | } |
145 | 197 | ||
146 | 198 | ||
147 | static int mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | 199 | static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, |
148 | struct sk_buff *skb) | 200 | struct sk_buff *skb) |
149 | { | 201 | { |
150 | struct mac80211_hwsim_data *data = hw->priv; | 202 | struct mac80211_hwsim_data *data = hw->priv, *data2; |
151 | int i, ack = 0; | 203 | bool ack = false; |
152 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 204 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
153 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 205 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
154 | struct ieee80211_rx_status rx_status; | 206 | struct ieee80211_rx_status rx_status; |
@@ -161,13 +213,13 @@ static int mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
161 | /* TODO: simulate signal strength (and optional packet drop) */ | 213 | /* TODO: simulate signal strength (and optional packet drop) */ |
162 | 214 | ||
163 | /* Copy skb to all enabled radios that are on the current frequency */ | 215 | /* Copy skb to all enabled radios that are on the current frequency */ |
164 | for (i = 0; i < hwsim_radio_count; i++) { | 216 | spin_lock(&hwsim_radio_lock); |
165 | struct mac80211_hwsim_data *data2; | 217 | list_for_each_entry(data2, &hwsim_radios, list) { |
166 | struct sk_buff *nskb; | 218 | struct sk_buff *nskb; |
167 | 219 | ||
168 | if (hwsim_radios[i] == NULL || hwsim_radios[i] == hw) | 220 | if (data == data2) |
169 | continue; | 221 | continue; |
170 | data2 = hwsim_radios[i]->priv; | 222 | |
171 | if (!data2->started || !data2->radio_enabled || | 223 | if (!data2->started || !data2->radio_enabled || |
172 | data->channel->center_freq != data2->channel->center_freq) | 224 | data->channel->center_freq != data2->channel->center_freq) |
173 | continue; | 225 | continue; |
@@ -176,11 +228,12 @@ static int mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
176 | if (nskb == NULL) | 228 | if (nskb == NULL) |
177 | continue; | 229 | continue; |
178 | 230 | ||
179 | if (memcmp(hdr->addr1, hwsim_radios[i]->wiphy->perm_addr, | 231 | if (memcmp(hdr->addr1, data2->hw->wiphy->perm_addr, |
180 | ETH_ALEN) == 0) | 232 | ETH_ALEN) == 0) |
181 | ack = 1; | 233 | ack = true; |
182 | ieee80211_rx_irqsafe(hwsim_radios[i], nskb, &rx_status); | 234 | ieee80211_rx_irqsafe(data2->hw, nskb, &rx_status); |
183 | } | 235 | } |
236 | spin_unlock(&hwsim_radio_lock); | ||
184 | 237 | ||
185 | return ack; | 238 | return ack; |
186 | } | 239 | } |
@@ -189,7 +242,7 @@ static int mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
189 | static int mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 242 | static int mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
190 | { | 243 | { |
191 | struct mac80211_hwsim_data *data = hw->priv; | 244 | struct mac80211_hwsim_data *data = hw->priv; |
192 | int ack; | 245 | bool ack; |
193 | struct ieee80211_tx_info *txi; | 246 | struct ieee80211_tx_info *txi; |
194 | 247 | ||
195 | mac80211_hwsim_monitor_rx(hw, skb); | 248 | mac80211_hwsim_monitor_rx(hw, skb); |
@@ -210,6 +263,12 @@ static int mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
210 | ack = mac80211_hwsim_tx_frame(hw, skb); | 263 | ack = mac80211_hwsim_tx_frame(hw, skb); |
211 | 264 | ||
212 | txi = IEEE80211_SKB_CB(skb); | 265 | txi = IEEE80211_SKB_CB(skb); |
266 | |||
267 | if (txi->control.vif) | ||
268 | hwsim_check_magic(txi->control.vif); | ||
269 | if (txi->control.sta) | ||
270 | hwsim_check_sta_magic(txi->control.sta); | ||
271 | |||
213 | memset(&txi->status, 0, sizeof(txi->status)); | 272 | memset(&txi->status, 0, sizeof(txi->status)); |
214 | if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK)) { | 273 | if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK)) { |
215 | if (ack) | 274 | if (ack) |
@@ -246,6 +305,7 @@ static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw, | |||
246 | printk(KERN_DEBUG "%s:%s (type=%d mac_addr=%s)\n", | 305 | printk(KERN_DEBUG "%s:%s (type=%d mac_addr=%s)\n", |
247 | wiphy_name(hw->wiphy), __func__, conf->type, | 306 | wiphy_name(hw->wiphy), __func__, conf->type, |
248 | print_mac(mac, conf->mac_addr)); | 307 | print_mac(mac, conf->mac_addr)); |
308 | hwsim_set_magic(conf->vif); | ||
249 | return 0; | 309 | return 0; |
250 | } | 310 | } |
251 | 311 | ||
@@ -257,6 +317,8 @@ static void mac80211_hwsim_remove_interface( | |||
257 | printk(KERN_DEBUG "%s:%s (type=%d mac_addr=%s)\n", | 317 | printk(KERN_DEBUG "%s:%s (type=%d mac_addr=%s)\n", |
258 | wiphy_name(hw->wiphy), __func__, conf->type, | 318 | wiphy_name(hw->wiphy), __func__, conf->type, |
259 | print_mac(mac, conf->mac_addr)); | 319 | print_mac(mac, conf->mac_addr)); |
320 | hwsim_check_magic(conf->vif); | ||
321 | hwsim_clear_magic(conf->vif); | ||
260 | } | 322 | } |
261 | 323 | ||
262 | 324 | ||
@@ -267,7 +329,9 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, | |||
267 | struct sk_buff *skb; | 329 | struct sk_buff *skb; |
268 | struct ieee80211_tx_info *info; | 330 | struct ieee80211_tx_info *info; |
269 | 331 | ||
270 | if (vif->type != IEEE80211_IF_TYPE_AP) | 332 | hwsim_check_magic(vif); |
333 | |||
334 | if (vif->type != NL80211_IFTYPE_AP) | ||
271 | return; | 335 | return; |
272 | 336 | ||
273 | skb = ieee80211_beacon_get(hw, vif); | 337 | skb = ieee80211_beacon_get(hw, vif); |
@@ -341,7 +405,45 @@ static void mac80211_hwsim_configure_filter(struct ieee80211_hw *hw, | |||
341 | *total_flags = data->rx_filter; | 405 | *total_flags = data->rx_filter; |
342 | } | 406 | } |
343 | 407 | ||
408 | static int mac80211_hwsim_config_interface(struct ieee80211_hw *hw, | ||
409 | struct ieee80211_vif *vif, | ||
410 | struct ieee80211_if_conf *conf) | ||
411 | { | ||
412 | hwsim_check_magic(vif); | ||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | ||
417 | struct ieee80211_vif *vif, | ||
418 | struct ieee80211_bss_conf *info, | ||
419 | u32 changed) | ||
420 | { | ||
421 | hwsim_check_magic(vif); | ||
422 | } | ||
423 | |||
424 | static void mac80211_hwsim_sta_notify(struct ieee80211_hw *hw, | ||
425 | struct ieee80211_vif *vif, | ||
426 | enum sta_notify_cmd cmd, | ||
427 | struct ieee80211_sta *sta) | ||
428 | { | ||
429 | hwsim_check_magic(vif); | ||
430 | switch (cmd) { | ||
431 | case STA_NOTIFY_ADD: | ||
432 | hwsim_set_sta_magic(sta); | ||
433 | break; | ||
434 | case STA_NOTIFY_REMOVE: | ||
435 | hwsim_clear_sta_magic(sta); | ||
436 | break; | ||
437 | } | ||
438 | } | ||
344 | 439 | ||
440 | static int mac80211_hwsim_set_tim(struct ieee80211_hw *hw, | ||
441 | struct ieee80211_sta *sta, | ||
442 | bool set) | ||
443 | { | ||
444 | hwsim_check_sta_magic(sta); | ||
445 | return 0; | ||
446 | } | ||
345 | 447 | ||
346 | static const struct ieee80211_ops mac80211_hwsim_ops = | 448 | static const struct ieee80211_ops mac80211_hwsim_ops = |
347 | { | 449 | { |
@@ -352,23 +454,30 @@ static const struct ieee80211_ops mac80211_hwsim_ops = | |||
352 | .remove_interface = mac80211_hwsim_remove_interface, | 454 | .remove_interface = mac80211_hwsim_remove_interface, |
353 | .config = mac80211_hwsim_config, | 455 | .config = mac80211_hwsim_config, |
354 | .configure_filter = mac80211_hwsim_configure_filter, | 456 | .configure_filter = mac80211_hwsim_configure_filter, |
457 | .config_interface = mac80211_hwsim_config_interface, | ||
458 | .bss_info_changed = mac80211_hwsim_bss_info_changed, | ||
459 | .sta_notify = mac80211_hwsim_sta_notify, | ||
460 | .set_tim = mac80211_hwsim_set_tim, | ||
355 | }; | 461 | }; |
356 | 462 | ||
357 | 463 | ||
358 | static void mac80211_hwsim_free(void) | 464 | static void mac80211_hwsim_free(void) |
359 | { | 465 | { |
360 | int i; | 466 | struct list_head tmplist, *i, *tmp; |
361 | 467 | struct mac80211_hwsim_data *data; | |
362 | for (i = 0; i < hwsim_radio_count; i++) { | 468 | |
363 | if (hwsim_radios[i]) { | 469 | INIT_LIST_HEAD(&tmplist); |
364 | struct mac80211_hwsim_data *data; | 470 | |
365 | data = hwsim_radios[i]->priv; | 471 | spin_lock_bh(&hwsim_radio_lock); |
366 | ieee80211_unregister_hw(hwsim_radios[i]); | 472 | list_for_each_safe(i, tmp, &hwsim_radios) |
367 | device_unregister(data->dev); | 473 | list_move(i, &tmplist); |
368 | ieee80211_free_hw(hwsim_radios[i]); | 474 | spin_unlock_bh(&hwsim_radio_lock); |
369 | } | 475 | |
476 | list_for_each_entry(data, &tmplist, list) { | ||
477 | ieee80211_unregister_hw(data->hw); | ||
478 | device_unregister(data->dev); | ||
479 | ieee80211_free_hw(data->hw); | ||
370 | } | 480 | } |
371 | kfree(hwsim_radios); | ||
372 | class_destroy(hwsim_class); | 481 | class_destroy(hwsim_class); |
373 | } | 482 | } |
374 | 483 | ||
@@ -398,37 +507,32 @@ static int __init init_mac80211_hwsim(void) | |||
398 | struct ieee80211_hw *hw; | 507 | struct ieee80211_hw *hw; |
399 | DECLARE_MAC_BUF(mac); | 508 | DECLARE_MAC_BUF(mac); |
400 | 509 | ||
401 | if (radios < 1 || radios > 65535) | 510 | if (radios < 1 || radios > 100) |
402 | return -EINVAL; | 511 | return -EINVAL; |
403 | 512 | ||
404 | hwsim_radio_count = radios; | 513 | spin_lock_init(&hwsim_radio_lock); |
405 | hwsim_radios = kcalloc(hwsim_radio_count, | 514 | INIT_LIST_HEAD(&hwsim_radios); |
406 | sizeof(struct ieee80211_hw *), GFP_KERNEL); | ||
407 | if (hwsim_radios == NULL) | ||
408 | return -ENOMEM; | ||
409 | 515 | ||
410 | hwsim_class = class_create(THIS_MODULE, "mac80211_hwsim"); | 516 | hwsim_class = class_create(THIS_MODULE, "mac80211_hwsim"); |
411 | if (IS_ERR(hwsim_class)) { | 517 | if (IS_ERR(hwsim_class)) |
412 | kfree(hwsim_radios); | ||
413 | return PTR_ERR(hwsim_class); | 518 | return PTR_ERR(hwsim_class); |
414 | } | ||
415 | 519 | ||
416 | memset(addr, 0, ETH_ALEN); | 520 | memset(addr, 0, ETH_ALEN); |
417 | addr[0] = 0x02; | 521 | addr[0] = 0x02; |
418 | 522 | ||
419 | for (i = 0; i < hwsim_radio_count; i++) { | 523 | for (i = 0; i < radios; i++) { |
420 | printk(KERN_DEBUG "mac80211_hwsim: Initializing radio %d\n", | 524 | printk(KERN_DEBUG "mac80211_hwsim: Initializing radio %d\n", |
421 | i); | 525 | i); |
422 | hw = ieee80211_alloc_hw(sizeof(*data), &mac80211_hwsim_ops); | 526 | hw = ieee80211_alloc_hw(sizeof(*data), &mac80211_hwsim_ops); |
423 | if (hw == NULL) { | 527 | if (!hw) { |
424 | printk(KERN_DEBUG "mac80211_hwsim: ieee80211_alloc_hw " | 528 | printk(KERN_DEBUG "mac80211_hwsim: ieee80211_alloc_hw " |
425 | "failed\n"); | 529 | "failed\n"); |
426 | err = -ENOMEM; | 530 | err = -ENOMEM; |
427 | goto failed; | 531 | goto failed; |
428 | } | 532 | } |
429 | hwsim_radios[i] = hw; | ||
430 | |||
431 | data = hw->priv; | 533 | data = hw->priv; |
534 | data->hw = hw; | ||
535 | |||
432 | data->dev = device_create_drvdata(hwsim_class, NULL, 0, hw, | 536 | data->dev = device_create_drvdata(hwsim_class, NULL, 0, hw, |
433 | "hwsim%d", i); | 537 | "hwsim%d", i); |
434 | if (IS_ERR(data->dev)) { | 538 | if (IS_ERR(data->dev)) { |
@@ -452,6 +556,10 @@ static int __init init_mac80211_hwsim(void) | |||
452 | BIT(NL80211_IFTYPE_AP); | 556 | BIT(NL80211_IFTYPE_AP); |
453 | hw->ampdu_queues = 1; | 557 | hw->ampdu_queues = 1; |
454 | 558 | ||
559 | /* ask mac80211 to reserve space for magic */ | ||
560 | hw->vif_data_size = sizeof(struct hwsim_vif_priv); | ||
561 | hw->sta_data_size = sizeof(struct hwsim_sta_priv); | ||
562 | |||
455 | memcpy(data->channels, hwsim_channels, sizeof(hwsim_channels)); | 563 | memcpy(data->channels, hwsim_channels, sizeof(hwsim_channels)); |
456 | memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates)); | 564 | memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates)); |
457 | data->band.channels = data->channels; | 565 | data->band.channels = data->channels; |
@@ -486,6 +594,8 @@ static int __init init_mac80211_hwsim(void) | |||
486 | 594 | ||
487 | setup_timer(&data->beacon_timer, mac80211_hwsim_beacon, | 595 | setup_timer(&data->beacon_timer, mac80211_hwsim_beacon, |
488 | (unsigned long) hw); | 596 | (unsigned long) hw); |
597 | |||
598 | list_add_tail(&data->list, &hwsim_radios); | ||
489 | } | 599 | } |
490 | 600 | ||
491 | hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); | 601 | hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); |
@@ -517,7 +627,6 @@ failed_hw: | |||
517 | device_unregister(data->dev); | 627 | device_unregister(data->dev); |
518 | failed_drvdata: | 628 | failed_drvdata: |
519 | ieee80211_free_hw(hw); | 629 | ieee80211_free_hw(hw); |
520 | hwsim_radios[i] = NULL; | ||
521 | failed: | 630 | failed: |
522 | mac80211_hwsim_free(); | 631 | mac80211_hwsim_free(); |
523 | return err; | 632 | return err; |
@@ -526,8 +635,7 @@ failed: | |||
526 | 635 | ||
527 | static void __exit exit_mac80211_hwsim(void) | 636 | static void __exit exit_mac80211_hwsim(void) |
528 | { | 637 | { |
529 | printk(KERN_DEBUG "mac80211_hwsim: unregister %d radios\n", | 638 | printk(KERN_DEBUG "mac80211_hwsim: unregister radios\n"); |
530 | hwsim_radio_count); | ||
531 | 639 | ||
532 | unregister_netdev(hwsim_mon); | 640 | unregister_netdev(hwsim_mon); |
533 | mac80211_hwsim_free(); | 641 | mac80211_hwsim_free(); |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index ec0451cbb8e1..9a2fcc0163d6 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -4777,14 +4777,14 @@ static int orinoco_ioctl_get_encodeext(struct net_device *dev, | |||
4777 | encoding->flags |= IW_ENCODE_DISABLED; | 4777 | encoding->flags |= IW_ENCODE_DISABLED; |
4778 | break; | 4778 | break; |
4779 | case IW_ENCODE_ALG_WEP: | 4779 | case IW_ENCODE_ALG_WEP: |
4780 | ext->key_len = min(le16_to_cpu(priv->keys[idx].len), | 4780 | ext->key_len = min_t(u16, le16_to_cpu(priv->keys[idx].len), |
4781 | (u16) max_key_len); | 4781 | max_key_len); |
4782 | memcpy(ext->key, priv->keys[idx].data, ext->key_len); | 4782 | memcpy(ext->key, priv->keys[idx].data, ext->key_len); |
4783 | encoding->flags |= IW_ENCODE_ENABLED; | 4783 | encoding->flags |= IW_ENCODE_ENABLED; |
4784 | break; | 4784 | break; |
4785 | case IW_ENCODE_ALG_TKIP: | 4785 | case IW_ENCODE_ALG_TKIP: |
4786 | ext->key_len = min((u16) sizeof(struct orinoco_tkip_key), | 4786 | ext->key_len = min_t(u16, sizeof(struct orinoco_tkip_key), |
4787 | (u16) max_key_len); | 4787 | max_key_len); |
4788 | memcpy(ext->key, &priv->tkip_key[idx], ext->key_len); | 4788 | memcpy(ext->key, &priv->tkip_key[idx], ext->key_len); |
4789 | encoding->flags |= IW_ENCODE_ENABLED; | 4789 | encoding->flags |= IW_ENCODE_ENABLED; |
4790 | break; | 4790 | break; |
@@ -5686,9 +5686,9 @@ static inline char *orinoco_translate_ext_scan(struct net_device *dev, | |||
5686 | 5686 | ||
5687 | /* Timestamp */ | 5687 | /* Timestamp */ |
5688 | iwe.cmd = IWEVCUSTOM; | 5688 | iwe.cmd = IWEVCUSTOM; |
5689 | iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN, | 5689 | iwe.u.data.length = |
5690 | "tsf=%016llx", | 5690 | snprintf(custom, MAX_CUSTOM_LEN, "tsf=%016llx", |
5691 | le64_to_cpu(bss->timestamp)); | 5691 | (unsigned long long) le64_to_cpu(bss->timestamp)); |
5692 | if (iwe.u.data.length) | 5692 | if (iwe.u.data.length) |
5693 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, | 5693 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
5694 | &iwe, custom); | 5694 | &iwe, custom); |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index da51786254dc..bac58ed03e5c 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -1139,7 +1139,7 @@ static int p54_start(struct ieee80211_hw *dev) | |||
1139 | 1139 | ||
1140 | err = priv->open(dev); | 1140 | err = priv->open(dev); |
1141 | if (!err) | 1141 | if (!err) |
1142 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 1142 | priv->mode = NL80211_IFTYPE_MONITOR; |
1143 | 1143 | ||
1144 | p54_init_vdcf(dev); | 1144 | p54_init_vdcf(dev); |
1145 | 1145 | ||
@@ -1157,7 +1157,7 @@ static void p54_stop(struct ieee80211_hw *dev) | |||
1157 | kfree_skb(skb); | 1157 | kfree_skb(skb); |
1158 | priv->stop(dev); | 1158 | priv->stop(dev); |
1159 | priv->tsf_high32 = priv->tsf_low32 = 0; | 1159 | priv->tsf_high32 = priv->tsf_low32 = 0; |
1160 | priv->mode = IEEE80211_IF_TYPE_INVALID; | 1160 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; |
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | static int p54_add_interface(struct ieee80211_hw *dev, | 1163 | static int p54_add_interface(struct ieee80211_hw *dev, |
@@ -1165,11 +1165,11 @@ static int p54_add_interface(struct ieee80211_hw *dev, | |||
1165 | { | 1165 | { |
1166 | struct p54_common *priv = dev->priv; | 1166 | struct p54_common *priv = dev->priv; |
1167 | 1167 | ||
1168 | if (priv->mode != IEEE80211_IF_TYPE_MNTR) | 1168 | if (priv->mode != NL80211_IFTYPE_MONITOR) |
1169 | return -EOPNOTSUPP; | 1169 | return -EOPNOTSUPP; |
1170 | 1170 | ||
1171 | switch (conf->type) { | 1171 | switch (conf->type) { |
1172 | case IEEE80211_IF_TYPE_STA: | 1172 | case NL80211_IFTYPE_STATION: |
1173 | priv->mode = conf->type; | 1173 | priv->mode = conf->type; |
1174 | break; | 1174 | break; |
1175 | default: | 1175 | default: |
@@ -1181,7 +1181,7 @@ static int p54_add_interface(struct ieee80211_hw *dev, | |||
1181 | p54_set_filter(dev, 0, NULL); | 1181 | p54_set_filter(dev, 0, NULL); |
1182 | 1182 | ||
1183 | switch (conf->type) { | 1183 | switch (conf->type) { |
1184 | case IEEE80211_IF_TYPE_STA: | 1184 | case NL80211_IFTYPE_STATION: |
1185 | p54_set_filter(dev, 1, NULL); | 1185 | p54_set_filter(dev, 1, NULL); |
1186 | break; | 1186 | break; |
1187 | default: | 1187 | default: |
@@ -1198,7 +1198,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev, | |||
1198 | struct ieee80211_if_init_conf *conf) | 1198 | struct ieee80211_if_init_conf *conf) |
1199 | { | 1199 | { |
1200 | struct p54_common *priv = dev->priv; | 1200 | struct p54_common *priv = dev->priv; |
1201 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 1201 | priv->mode = NL80211_IFTYPE_MONITOR; |
1202 | memset(priv->mac_addr, 0, ETH_ALEN); | 1202 | memset(priv->mac_addr, 0, ETH_ALEN); |
1203 | p54_set_filter(dev, 0, NULL); | 1203 | p54_set_filter(dev, 0, NULL); |
1204 | } | 1204 | } |
@@ -1380,7 +1380,7 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len) | |||
1380 | return NULL; | 1380 | return NULL; |
1381 | 1381 | ||
1382 | priv = dev->priv; | 1382 | priv = dev->priv; |
1383 | priv->mode = IEEE80211_IF_TYPE_INVALID; | 1383 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; |
1384 | skb_queue_head_init(&priv->tx_queue); | 1384 | skb_queue_head_init(&priv->tx_queue); |
1385 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | /* not sure */ | 1385 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | /* not sure */ |
1386 | IEEE80211_HW_RX_INCLUDES_FCS | | 1386 | IEEE80211_HW_RX_INCLUDES_FCS | |
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index 1594786205f8..1c2a02a741af 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -616,7 +616,7 @@ static int p54p_suspend(struct pci_dev *pdev, pm_message_t state) | |||
616 | struct ieee80211_hw *dev = pci_get_drvdata(pdev); | 616 | struct ieee80211_hw *dev = pci_get_drvdata(pdev); |
617 | struct p54p_priv *priv = dev->priv; | 617 | struct p54p_priv *priv = dev->priv; |
618 | 618 | ||
619 | if (priv->common.mode != IEEE80211_IF_TYPE_INVALID) { | 619 | if (priv->common.mode != NL80211_IFTYPE_UNSPECIFIED) { |
620 | ieee80211_stop_queues(dev); | 620 | ieee80211_stop_queues(dev); |
621 | p54p_stop(dev); | 621 | p54p_stop(dev); |
622 | } | 622 | } |
@@ -634,7 +634,7 @@ static int p54p_resume(struct pci_dev *pdev) | |||
634 | pci_set_power_state(pdev, PCI_D0); | 634 | pci_set_power_state(pdev, PCI_D0); |
635 | pci_restore_state(pdev); | 635 | pci_restore_state(pdev); |
636 | 636 | ||
637 | if (priv->common.mode != IEEE80211_IF_TYPE_INVALID) { | 637 | if (priv->common.mode != NL80211_IFTYPE_UNSPECIFIED) { |
638 | p54p_open(dev); | 638 | p54p_open(dev); |
639 | ieee80211_wake_queues(dev); | 639 | ieee80211_wake_queues(dev); |
640 | } | 640 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index cb5f2d01a9c3..d3bf7bba611a 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -384,7 +384,7 @@ static void rt2500usb_config_intf(struct rt2x00_dev *rt2x00dev, | |||
384 | rt2500usb_register_read(rt2x00dev, TXRX_CSR20, ®); | 384 | rt2500usb_register_read(rt2x00dev, TXRX_CSR20, ®); |
385 | rt2x00_set_field16(®, TXRX_CSR20_OFFSET, bcn_preload >> 6); | 385 | rt2x00_set_field16(®, TXRX_CSR20_OFFSET, bcn_preload >> 6); |
386 | rt2x00_set_field16(®, TXRX_CSR20_BCN_EXPECT_WINDOW, | 386 | rt2x00_set_field16(®, TXRX_CSR20_BCN_EXPECT_WINDOW, |
387 | 2 * (conf->type != IEEE80211_IF_TYPE_STA)); | 387 | 2 * (conf->type != NL80211_IFTYPE_STATION)); |
388 | rt2500usb_register_write(rt2x00dev, TXRX_CSR20, reg); | 388 | rt2500usb_register_write(rt2x00dev, TXRX_CSR20, reg); |
389 | 389 | ||
390 | /* | 390 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 6f296cef76ad..1359a3768404 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -483,7 +483,7 @@ struct rt2x00intf_conf { | |||
483 | /* | 483 | /* |
484 | * Interface type | 484 | * Interface type |
485 | */ | 485 | */ |
486 | enum ieee80211_if_types type; | 486 | enum nl80211_iftype type; |
487 | 487 | ||
488 | /* | 488 | /* |
489 | * TSF sync value, this is dependant on the operation type. | 489 | * TSF sync value, this is dependant on the operation type. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index ca051f50ef10..4d5e87b015a0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev, | 32 | void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev, |
33 | struct rt2x00_intf *intf, | 33 | struct rt2x00_intf *intf, |
34 | enum ieee80211_if_types type, | 34 | enum nl80211_iftype type, |
35 | u8 *mac, u8 *bssid) | 35 | u8 *mac, u8 *bssid) |
36 | { | 36 | { |
37 | struct rt2x00intf_conf conf; | 37 | struct rt2x00intf_conf conf; |
@@ -40,11 +40,11 @@ void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev, | |||
40 | conf.type = type; | 40 | conf.type = type; |
41 | 41 | ||
42 | switch (type) { | 42 | switch (type) { |
43 | case IEEE80211_IF_TYPE_IBSS: | 43 | case NL80211_IFTYPE_ADHOC: |
44 | case IEEE80211_IF_TYPE_AP: | 44 | case NL80211_IFTYPE_AP: |
45 | conf.sync = TSF_SYNC_BEACON; | 45 | conf.sync = TSF_SYNC_BEACON; |
46 | break; | 46 | break; |
47 | case IEEE80211_IF_TYPE_STA: | 47 | case NL80211_IFTYPE_STATION: |
48 | conf.sync = TSF_SYNC_INFRA; | 48 | conf.sync = TSF_SYNC_INFRA; |
49 | break; | 49 | break; |
50 | default: | 50 | default: |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 2f3bfc606880..86840e3585e8 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -467,8 +467,8 @@ static void rt2x00lib_beacondone_iter(void *data, u8 *mac, | |||
467 | struct rt2x00_dev *rt2x00dev = data; | 467 | struct rt2x00_dev *rt2x00dev = data; |
468 | struct rt2x00_intf *intf = vif_to_intf(vif); | 468 | struct rt2x00_intf *intf = vif_to_intf(vif); |
469 | 469 | ||
470 | if (vif->type != IEEE80211_IF_TYPE_AP && | 470 | if (vif->type != NL80211_IFTYPE_AP && |
471 | vif->type != IEEE80211_IF_TYPE_IBSS) | 471 | vif->type != NL80211_IFTYPE_ADHOC) |
472 | return; | 472 | return; |
473 | 473 | ||
474 | /* | 474 | /* |
@@ -1212,8 +1212,8 @@ static void rt2x00lib_resume_intf(void *data, u8 *mac, | |||
1212 | /* | 1212 | /* |
1213 | * Master or Ad-hoc mode require a new beacon update. | 1213 | * Master or Ad-hoc mode require a new beacon update. |
1214 | */ | 1214 | */ |
1215 | if (vif->type == IEEE80211_IF_TYPE_AP || | 1215 | if (vif->type == NL80211_IFTYPE_AP || |
1216 | vif->type == IEEE80211_IF_TYPE_IBSS) | 1216 | vif->type == NL80211_IFTYPE_ADHOC) |
1217 | intf->delayed_flags |= DELAYED_UPDATE_BEACON; | 1217 | intf->delayed_flags |= DELAYED_UPDATE_BEACON; |
1218 | 1218 | ||
1219 | spin_unlock(&intf->lock); | 1219 | spin_unlock(&intf->lock); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 7bbc16b1b6c6..797eb619aa0a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -88,7 +88,7 @@ void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev); | |||
88 | */ | 88 | */ |
89 | void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev, | 89 | void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev, |
90 | struct rt2x00_intf *intf, | 90 | struct rt2x00_intf *intf, |
91 | enum ieee80211_if_types type, | 91 | enum nl80211_iftype type, |
92 | u8 *mac, u8 *bssid); | 92 | u8 *mac, u8 *bssid); |
93 | void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev, | 93 | void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev, |
94 | struct rt2x00_intf *intf, | 94 | struct rt2x00_intf *intf, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 56829fad3471..485c40de5cc0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -211,7 +211,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
211 | return -ENODEV; | 211 | return -ENODEV; |
212 | 212 | ||
213 | switch (conf->type) { | 213 | switch (conf->type) { |
214 | case IEEE80211_IF_TYPE_AP: | 214 | case NL80211_IFTYPE_AP: |
215 | /* | 215 | /* |
216 | * We don't support mixed combinations of | 216 | * We don't support mixed combinations of |
217 | * sta and ap interfaces. | 217 | * sta and ap interfaces. |
@@ -227,8 +227,8 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
227 | return -ENOBUFS; | 227 | return -ENOBUFS; |
228 | 228 | ||
229 | break; | 229 | break; |
230 | case IEEE80211_IF_TYPE_STA: | 230 | case NL80211_IFTYPE_STATION: |
231 | case IEEE80211_IF_TYPE_IBSS: | 231 | case NL80211_IFTYPE_ADHOC: |
232 | /* | 232 | /* |
233 | * We don't support mixed combinations of | 233 | * We don't support mixed combinations of |
234 | * sta and ap interfaces. | 234 | * sta and ap interfaces. |
@@ -268,7 +268,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
268 | * increase interface count and start initialization. | 268 | * increase interface count and start initialization. |
269 | */ | 269 | */ |
270 | 270 | ||
271 | if (conf->type == IEEE80211_IF_TYPE_AP) | 271 | if (conf->type == NL80211_IFTYPE_AP) |
272 | rt2x00dev->intf_ap_count++; | 272 | rt2x00dev->intf_ap_count++; |
273 | else | 273 | else |
274 | rt2x00dev->intf_sta_count++; | 274 | rt2x00dev->intf_sta_count++; |
@@ -277,7 +277,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
277 | spin_lock_init(&intf->seqlock); | 277 | spin_lock_init(&intf->seqlock); |
278 | intf->beacon = entry; | 278 | intf->beacon = entry; |
279 | 279 | ||
280 | if (conf->type == IEEE80211_IF_TYPE_AP) | 280 | if (conf->type == NL80211_IFTYPE_AP) |
281 | memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN); | 281 | memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN); |
282 | memcpy(&intf->mac, conf->mac_addr, ETH_ALEN); | 282 | memcpy(&intf->mac, conf->mac_addr, ETH_ALEN); |
283 | 283 | ||
@@ -311,11 +311,11 @@ void rt2x00mac_remove_interface(struct ieee80211_hw *hw, | |||
311 | * no interface is present. | 311 | * no interface is present. |
312 | */ | 312 | */ |
313 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || | 313 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || |
314 | (conf->type == IEEE80211_IF_TYPE_AP && !rt2x00dev->intf_ap_count) || | 314 | (conf->type == NL80211_IFTYPE_AP && !rt2x00dev->intf_ap_count) || |
315 | (conf->type != IEEE80211_IF_TYPE_AP && !rt2x00dev->intf_sta_count)) | 315 | (conf->type != NL80211_IFTYPE_AP && !rt2x00dev->intf_sta_count)) |
316 | return; | 316 | return; |
317 | 317 | ||
318 | if (conf->type == IEEE80211_IF_TYPE_AP) | 318 | if (conf->type == NL80211_IFTYPE_AP) |
319 | rt2x00dev->intf_ap_count--; | 319 | rt2x00dev->intf_ap_count--; |
320 | else | 320 | else |
321 | rt2x00dev->intf_sta_count--; | 321 | rt2x00dev->intf_sta_count--; |
@@ -331,7 +331,7 @@ void rt2x00mac_remove_interface(struct ieee80211_hw *hw, | |||
331 | * are cleared to prevent false ACKing of frames. | 331 | * are cleared to prevent false ACKing of frames. |
332 | */ | 332 | */ |
333 | rt2x00lib_config_intf(rt2x00dev, intf, | 333 | rt2x00lib_config_intf(rt2x00dev, intf, |
334 | IEEE80211_IF_TYPE_INVALID, NULL, NULL); | 334 | NL80211_IFTYPE_UNSPECIFIED, NULL, NULL); |
335 | } | 335 | } |
336 | EXPORT_SYMBOL_GPL(rt2x00mac_remove_interface); | 336 | EXPORT_SYMBOL_GPL(rt2x00mac_remove_interface); |
337 | 337 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index a5e965068c83..b7f4fe8fba6e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -155,7 +155,6 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
155 | { | 155 | { |
156 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 156 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
157 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); | 157 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); |
158 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); | ||
159 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; | 158 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; |
160 | struct ieee80211_rate *rate = | 159 | struct ieee80211_rate *rate = |
161 | ieee80211_get_tx_rate(rt2x00dev->hw, tx_info); | 160 | ieee80211_get_tx_rate(rt2x00dev->hw, tx_info); |
@@ -278,16 +277,22 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
278 | * sequence counter given by mac80211. | 277 | * sequence counter given by mac80211. |
279 | */ | 278 | */ |
280 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 279 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
281 | spin_lock_irqsave(&intf->seqlock, irqflags); | 280 | if (likely(tx_info->control.vif)) { |
281 | struct rt2x00_intf *intf; | ||
282 | 282 | ||
283 | if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) | 283 | intf = vif_to_intf(tx_info->control.vif); |
284 | intf->seqno += 0x10; | ||
285 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
286 | hdr->seq_ctrl |= cpu_to_le16(intf->seqno); | ||
287 | 284 | ||
288 | spin_unlock_irqrestore(&intf->seqlock, irqflags); | 285 | spin_lock_irqsave(&intf->seqlock, irqflags); |
289 | 286 | ||
290 | __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); | 287 | if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) |
288 | intf->seqno += 0x10; | ||
289 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
290 | hdr->seq_ctrl |= cpu_to_le16(intf->seqno); | ||
291 | |||
292 | spin_unlock_irqrestore(&intf->seqlock, irqflags); | ||
293 | |||
294 | __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); | ||
295 | } | ||
291 | } | 296 | } |
292 | 297 | ||
293 | /* | 298 | /* |
diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c index 861c76a65d6a..abcd641c54be 100644 --- a/drivers/net/wireless/rtl8180_dev.c +++ b/drivers/net/wireless/rtl8180_dev.c | |||
@@ -615,7 +615,7 @@ static int rtl8180_start(struct ieee80211_hw *dev) | |||
615 | reg |= RTL818X_CMD_TX_ENABLE; | 615 | reg |= RTL818X_CMD_TX_ENABLE; |
616 | rtl818x_iowrite8(priv, &priv->map->CMD, reg); | 616 | rtl818x_iowrite8(priv, &priv->map->CMD, reg); |
617 | 617 | ||
618 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 618 | priv->mode = NL80211_IFTYPE_MONITOR; |
619 | return 0; | 619 | return 0; |
620 | 620 | ||
621 | err_free_rings: | 621 | err_free_rings: |
@@ -633,7 +633,7 @@ static void rtl8180_stop(struct ieee80211_hw *dev) | |||
633 | u8 reg; | 633 | u8 reg; |
634 | int i; | 634 | int i; |
635 | 635 | ||
636 | priv->mode = IEEE80211_IF_TYPE_INVALID; | 636 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; |
637 | 637 | ||
638 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); | 638 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); |
639 | 639 | ||
@@ -661,11 +661,11 @@ static int rtl8180_add_interface(struct ieee80211_hw *dev, | |||
661 | { | 661 | { |
662 | struct rtl8180_priv *priv = dev->priv; | 662 | struct rtl8180_priv *priv = dev->priv; |
663 | 663 | ||
664 | if (priv->mode != IEEE80211_IF_TYPE_MNTR) | 664 | if (priv->mode != NL80211_IFTYPE_MONITOR) |
665 | return -EOPNOTSUPP; | 665 | return -EOPNOTSUPP; |
666 | 666 | ||
667 | switch (conf->type) { | 667 | switch (conf->type) { |
668 | case IEEE80211_IF_TYPE_STA: | 668 | case NL80211_IFTYPE_STATION: |
669 | priv->mode = conf->type; | 669 | priv->mode = conf->type; |
670 | break; | 670 | break; |
671 | default: | 671 | default: |
@@ -688,7 +688,7 @@ static void rtl8180_remove_interface(struct ieee80211_hw *dev, | |||
688 | struct ieee80211_if_init_conf *conf) | 688 | struct ieee80211_if_init_conf *conf) |
689 | { | 689 | { |
690 | struct rtl8180_priv *priv = dev->priv; | 690 | struct rtl8180_priv *priv = dev->priv; |
691 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 691 | priv->mode = NL80211_IFTYPE_MONITOR; |
692 | priv->vif = NULL; | 692 | priv->vif = NULL; |
693 | } | 693 | } |
694 | 694 | ||
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index 8a42bfa6d4f0..e9902613e2ee 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
@@ -836,11 +836,11 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev, | |||
836 | struct rtl8187_priv *priv = dev->priv; | 836 | struct rtl8187_priv *priv = dev->priv; |
837 | int i; | 837 | int i; |
838 | 838 | ||
839 | if (priv->mode != IEEE80211_IF_TYPE_MNTR) | 839 | if (priv->mode != NL80211_IFTYPE_MONITOR) |
840 | return -EOPNOTSUPP; | 840 | return -EOPNOTSUPP; |
841 | 841 | ||
842 | switch (conf->type) { | 842 | switch (conf->type) { |
843 | case IEEE80211_IF_TYPE_STA: | 843 | case NL80211_IFTYPE_STATION: |
844 | priv->mode = conf->type; | 844 | priv->mode = conf->type; |
845 | break; | 845 | break; |
846 | default: | 846 | default: |
@@ -865,7 +865,7 @@ static void rtl8187_remove_interface(struct ieee80211_hw *dev, | |||
865 | { | 865 | { |
866 | struct rtl8187_priv *priv = dev->priv; | 866 | struct rtl8187_priv *priv = dev->priv; |
867 | mutex_lock(&priv->conf_mutex); | 867 | mutex_lock(&priv->conf_mutex); |
868 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 868 | priv->mode = NL80211_IFTYPE_MONITOR; |
869 | priv->vif = NULL; | 869 | priv->vif = NULL; |
870 | mutex_unlock(&priv->conf_mutex); | 870 | mutex_unlock(&priv->conf_mutex); |
871 | } | 871 | } |
@@ -1057,7 +1057,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, | |||
1057 | dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; | 1057 | dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; |
1058 | 1058 | ||
1059 | 1059 | ||
1060 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 1060 | priv->mode = NL80211_IFTYPE_MONITOR; |
1061 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 1061 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
1062 | IEEE80211_HW_RX_INCLUDES_FCS; | 1062 | IEEE80211_HW_RX_INCLUDES_FCS; |
1063 | 1063 | ||
diff --git a/drivers/net/wireless/zd1211rw/Makefile b/drivers/net/wireless/zd1211rw/Makefile index cc36126cee88..1907eafb9b16 100644 --- a/drivers/net/wireless/zd1211rw/Makefile +++ b/drivers/net/wireless/zd1211rw/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | obj-$(CONFIG_ZD1211RW) += zd1211rw.o | 1 | obj-$(CONFIG_ZD1211RW) += zd1211rw.o |
2 | 2 | ||
3 | zd1211rw-objs := zd_chip.o zd_ieee80211.o zd_mac.o \ | 3 | zd1211rw-objs := zd_chip.o zd_mac.o \ |
4 | zd_rf_al2230.o zd_rf_rf2959.o \ | 4 | zd_rf_al2230.o zd_rf_rf2959.o \ |
5 | zd_rf_al7230b.o zd_rf_uw2453.o \ | 5 | zd_rf_al7230b.o zd_rf_uw2453.o \ |
6 | zd_rf.o zd_usb.o | 6 | zd_rf.o zd_usb.o |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index 0acb5c345734..e0ac58b8ff1f 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | #include "zd_def.h" | 29 | #include "zd_def.h" |
30 | #include "zd_chip.h" | 30 | #include "zd_chip.h" |
31 | #include "zd_ieee80211.h" | ||
32 | #include "zd_mac.h" | 31 | #include "zd_mac.h" |
33 | #include "zd_rf.h" | 32 | #include "zd_rf.h" |
34 | 33 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_ieee80211.c b/drivers/net/wireless/zd1211rw/zd_ieee80211.c deleted file mode 100644 index d8dc41ec0e5d..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_ieee80211.c +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | /* ZD1211 USB-WLAN driver for Linux | ||
2 | * | ||
3 | * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de> | ||
4 | * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * In the long term, we'll probably find a better way of handling regulatory | ||
23 | * requirements outside of the driver. | ||
24 | */ | ||
25 | |||
26 | #include <linux/kernel.h> | ||
27 | #include <net/mac80211.h> | ||
28 | |||
29 | #include "zd_ieee80211.h" | ||
30 | #include "zd_mac.h" | ||
31 | |||
32 | struct channel_range { | ||
33 | u8 regdomain; | ||
34 | u8 start; | ||
35 | u8 end; /* exclusive (channel must be less than end) */ | ||
36 | }; | ||
37 | |||
38 | static const struct channel_range channel_ranges[] = { | ||
39 | { ZD_REGDOMAIN_FCC, 1, 12 }, | ||
40 | { ZD_REGDOMAIN_IC, 1, 12 }, | ||
41 | { ZD_REGDOMAIN_ETSI, 1, 14 }, | ||
42 | { ZD_REGDOMAIN_JAPAN, 1, 14 }, | ||
43 | { ZD_REGDOMAIN_SPAIN, 1, 14 }, | ||
44 | { ZD_REGDOMAIN_FRANCE, 1, 14 }, | ||
45 | |||
46 | /* Japan originally only had channel 14 available (see CHNL_ID 0x40 in | ||
47 | * 802.11). However, in 2001 the range was extended to include channels | ||
48 | * 1-13. The ZyDAS devices still use the old region code but are | ||
49 | * designed to allow the extra channel access in Japan. */ | ||
50 | { ZD_REGDOMAIN_JAPAN_ADD, 1, 15 }, | ||
51 | }; | ||
52 | |||
53 | static const struct channel_range *zd_channel_range(u8 regdomain) | ||
54 | { | ||
55 | int i; | ||
56 | for (i = 0; i < ARRAY_SIZE(channel_ranges); i++) { | ||
57 | const struct channel_range *range = &channel_ranges[i]; | ||
58 | if (range->regdomain == regdomain) | ||
59 | return range; | ||
60 | } | ||
61 | return NULL; | ||
62 | } | ||
63 | |||
64 | #define CHAN_TO_IDX(chan) ((chan) - 1) | ||
65 | |||
66 | static void unmask_bg_channels(struct ieee80211_hw *hw, | ||
67 | const struct channel_range *range, | ||
68 | struct ieee80211_supported_band *sband) | ||
69 | { | ||
70 | u8 channel; | ||
71 | |||
72 | for (channel = range->start; channel < range->end; channel++) { | ||
73 | struct ieee80211_channel *chan = | ||
74 | &sband->channels[CHAN_TO_IDX(channel)]; | ||
75 | chan->flags = 0; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | void zd_geo_init(struct ieee80211_hw *hw, u8 regdomain) | ||
80 | { | ||
81 | struct zd_mac *mac = zd_hw_mac(hw); | ||
82 | const struct channel_range *range; | ||
83 | |||
84 | dev_dbg(zd_mac_dev(mac), "regdomain %#02x\n", regdomain); | ||
85 | |||
86 | range = zd_channel_range(regdomain); | ||
87 | if (!range) { | ||
88 | /* The vendor driver overrides the regulatory domain and | ||
89 | * allowed channel registers and unconditionally restricts | ||
90 | * available channels to 1-11 everywhere. Match their | ||
91 | * questionable behaviour only for regdomains which we don't | ||
92 | * recognise. */ | ||
93 | dev_warn(zd_mac_dev(mac), "Unrecognised regulatory domain: " | ||
94 | "%#02x. Defaulting to FCC.\n", regdomain); | ||
95 | range = zd_channel_range(ZD_REGDOMAIN_FCC); | ||
96 | } | ||
97 | |||
98 | unmask_bg_channels(hw, range, &mac->band); | ||
99 | } | ||
100 | |||
diff --git a/drivers/net/wireless/zd1211rw/zd_ieee80211.h b/drivers/net/wireless/zd1211rw/zd_ieee80211.h deleted file mode 100644 index 26b79f197587..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_ieee80211.h +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | /* ZD1211 USB-WLAN driver for Linux | ||
2 | * | ||
3 | * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de> | ||
4 | * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _ZD_IEEE80211_H | ||
22 | #define _ZD_IEEE80211_H | ||
23 | |||
24 | #include <net/mac80211.h> | ||
25 | |||
26 | /* Additional definitions from the standards. | ||
27 | */ | ||
28 | |||
29 | #define ZD_REGDOMAIN_FCC 0x10 | ||
30 | #define ZD_REGDOMAIN_IC 0x20 | ||
31 | #define ZD_REGDOMAIN_ETSI 0x30 | ||
32 | #define ZD_REGDOMAIN_SPAIN 0x31 | ||
33 | #define ZD_REGDOMAIN_FRANCE 0x32 | ||
34 | #define ZD_REGDOMAIN_JAPAN_ADD 0x40 | ||
35 | #define ZD_REGDOMAIN_JAPAN 0x41 | ||
36 | |||
37 | enum { | ||
38 | MIN_CHANNEL24 = 1, | ||
39 | MAX_CHANNEL24 = 14, | ||
40 | }; | ||
41 | |||
42 | void zd_geo_init(struct ieee80211_hw *hw, u8 regdomain); | ||
43 | |||
44 | #define ZD_PLCP_SERVICE_LENGTH_EXTENSION 0x80 | ||
45 | |||
46 | struct ofdm_plcp_header { | ||
47 | u8 prefix[3]; | ||
48 | __le16 service; | ||
49 | } __attribute__((packed)); | ||
50 | |||
51 | static inline u8 zd_ofdm_plcp_header_rate(const struct ofdm_plcp_header *header) | ||
52 | { | ||
53 | return header->prefix[0] & 0xf; | ||
54 | } | ||
55 | |||
56 | /* The following defines give the encoding of the 4-bit rate field in the | ||
57 | * OFDM (802.11a/802.11g) PLCP header. Notify that these values are used to | ||
58 | * define the zd-rate values for OFDM. | ||
59 | * | ||
60 | * See the struct zd_ctrlset definition in zd_mac.h. | ||
61 | */ | ||
62 | #define ZD_OFDM_PLCP_RATE_6M 0xb | ||
63 | #define ZD_OFDM_PLCP_RATE_9M 0xf | ||
64 | #define ZD_OFDM_PLCP_RATE_12M 0xa | ||
65 | #define ZD_OFDM_PLCP_RATE_18M 0xe | ||
66 | #define ZD_OFDM_PLCP_RATE_24M 0x9 | ||
67 | #define ZD_OFDM_PLCP_RATE_36M 0xd | ||
68 | #define ZD_OFDM_PLCP_RATE_48M 0x8 | ||
69 | #define ZD_OFDM_PLCP_RATE_54M 0xc | ||
70 | |||
71 | struct cck_plcp_header { | ||
72 | u8 signal; | ||
73 | u8 service; | ||
74 | __le16 length; | ||
75 | __le16 crc16; | ||
76 | } __attribute__((packed)); | ||
77 | |||
78 | static inline u8 zd_cck_plcp_header_signal(const struct cck_plcp_header *header) | ||
79 | { | ||
80 | return header->signal; | ||
81 | } | ||
82 | |||
83 | /* These defines give the encodings of the signal field in the 802.11b PLCP | ||
84 | * header. The signal field gives the bit rate of the following packet. Even | ||
85 | * if technically wrong we use CCK here also for the 1 MBit/s and 2 MBit/s | ||
86 | * rate to stay consistent with Zydas and our use of the term. | ||
87 | * | ||
88 | * Notify that these values are *not* used in the zd-rates. | ||
89 | */ | ||
90 | #define ZD_CCK_PLCP_SIGNAL_1M 0x0a | ||
91 | #define ZD_CCK_PLCP_SIGNAL_2M 0x14 | ||
92 | #define ZD_CCK_PLCP_SIGNAL_5M5 0x37 | ||
93 | #define ZD_CCK_PLCP_SIGNAL_11M 0x6e | ||
94 | |||
95 | #endif /* _ZD_IEEE80211_H */ | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index e019102b2285..a3da014f928d 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de> | 3 | * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de> |
4 | * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org> | 4 | * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org> |
5 | * Copyright (C) 2006-2007 Michael Wu <flamingice@sourmilk.net> | 5 | * Copyright (C) 2006-2007 Michael Wu <flamingice@sourmilk.net> |
6 | * Copyright (c) 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> | 6 | * Copyright (C) 2007-2008 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -29,9 +29,23 @@ | |||
29 | #include "zd_def.h" | 29 | #include "zd_def.h" |
30 | #include "zd_chip.h" | 30 | #include "zd_chip.h" |
31 | #include "zd_mac.h" | 31 | #include "zd_mac.h" |
32 | #include "zd_ieee80211.h" | ||
33 | #include "zd_rf.h" | 32 | #include "zd_rf.h" |
34 | 33 | ||
34 | struct zd_reg_alpha2_map { | ||
35 | u32 reg; | ||
36 | char alpha2[2]; | ||
37 | }; | ||
38 | |||
39 | static struct zd_reg_alpha2_map reg_alpha2_map[] = { | ||
40 | { ZD_REGDOMAIN_FCC, "US" }, | ||
41 | { ZD_REGDOMAIN_IC, "CA" }, | ||
42 | { ZD_REGDOMAIN_ETSI, "DE" }, /* Generic ETSI, use most restrictive */ | ||
43 | { ZD_REGDOMAIN_JAPAN, "JP" }, | ||
44 | { ZD_REGDOMAIN_JAPAN_ADD, "JP" }, | ||
45 | { ZD_REGDOMAIN_SPAIN, "ES" }, | ||
46 | { ZD_REGDOMAIN_FRANCE, "FR" }, | ||
47 | }; | ||
48 | |||
35 | /* This table contains the hardware specific values for the modulation rates. */ | 49 | /* This table contains the hardware specific values for the modulation rates. */ |
36 | static const struct ieee80211_rate zd_rates[] = { | 50 | static const struct ieee80211_rate zd_rates[] = { |
37 | { .bitrate = 10, | 51 | { .bitrate = 10, |
@@ -95,6 +109,21 @@ static void housekeeping_init(struct zd_mac *mac); | |||
95 | static void housekeeping_enable(struct zd_mac *mac); | 109 | static void housekeeping_enable(struct zd_mac *mac); |
96 | static void housekeeping_disable(struct zd_mac *mac); | 110 | static void housekeeping_disable(struct zd_mac *mac); |
97 | 111 | ||
112 | static int zd_reg2alpha2(u8 regdomain, char *alpha2) | ||
113 | { | ||
114 | unsigned int i; | ||
115 | struct zd_reg_alpha2_map *reg_map; | ||
116 | for (i = 0; i < ARRAY_SIZE(reg_alpha2_map); i++) { | ||
117 | reg_map = ®_alpha2_map[i]; | ||
118 | if (regdomain == reg_map->reg) { | ||
119 | alpha2[0] = reg_map->alpha2[0]; | ||
120 | alpha2[1] = reg_map->alpha2[1]; | ||
121 | return 0; | ||
122 | } | ||
123 | } | ||
124 | return 1; | ||
125 | } | ||
126 | |||
98 | int zd_mac_preinit_hw(struct ieee80211_hw *hw) | 127 | int zd_mac_preinit_hw(struct ieee80211_hw *hw) |
99 | { | 128 | { |
100 | int r; | 129 | int r; |
@@ -115,6 +144,7 @@ int zd_mac_init_hw(struct ieee80211_hw *hw) | |||
115 | int r; | 144 | int r; |
116 | struct zd_mac *mac = zd_hw_mac(hw); | 145 | struct zd_mac *mac = zd_hw_mac(hw); |
117 | struct zd_chip *chip = &mac->chip; | 146 | struct zd_chip *chip = &mac->chip; |
147 | char alpha2[2]; | ||
118 | u8 default_regdomain; | 148 | u8 default_regdomain; |
119 | 149 | ||
120 | r = zd_chip_enable_int(chip); | 150 | r = zd_chip_enable_int(chip); |
@@ -139,7 +169,9 @@ int zd_mac_init_hw(struct ieee80211_hw *hw) | |||
139 | if (r) | 169 | if (r) |
140 | goto disable_int; | 170 | goto disable_int; |
141 | 171 | ||
142 | zd_geo_init(hw, mac->regdomain); | 172 | r = zd_reg2alpha2(mac->regdomain, alpha2); |
173 | if (!r) | ||
174 | regulatory_hint(hw->wiphy, alpha2, NULL); | ||
143 | 175 | ||
144 | r = 0; | 176 | r = 0; |
145 | disable_int: | 177 | disable_int: |
@@ -684,15 +716,15 @@ static int zd_op_add_interface(struct ieee80211_hw *hw, | |||
684 | { | 716 | { |
685 | struct zd_mac *mac = zd_hw_mac(hw); | 717 | struct zd_mac *mac = zd_hw_mac(hw); |
686 | 718 | ||
687 | /* using IEEE80211_IF_TYPE_INVALID to indicate no mode selected */ | 719 | /* using NL80211_IFTYPE_UNSPECIFIED to indicate no mode selected */ |
688 | if (mac->type != IEEE80211_IF_TYPE_INVALID) | 720 | if (mac->type != NL80211_IFTYPE_UNSPECIFIED) |
689 | return -EOPNOTSUPP; | 721 | return -EOPNOTSUPP; |
690 | 722 | ||
691 | switch (conf->type) { | 723 | switch (conf->type) { |
692 | case IEEE80211_IF_TYPE_MNTR: | 724 | case NL80211_IFTYPE_MONITOR: |
693 | case IEEE80211_IF_TYPE_MESH_POINT: | 725 | case NL80211_IFTYPE_MESH_POINT: |
694 | case IEEE80211_IF_TYPE_STA: | 726 | case NL80211_IFTYPE_STATION: |
695 | case IEEE80211_IF_TYPE_IBSS: | 727 | case NL80211_IFTYPE_ADHOC: |
696 | mac->type = conf->type; | 728 | mac->type = conf->type; |
697 | break; | 729 | break; |
698 | default: | 730 | default: |
@@ -706,7 +738,7 @@ static void zd_op_remove_interface(struct ieee80211_hw *hw, | |||
706 | struct ieee80211_if_init_conf *conf) | 738 | struct ieee80211_if_init_conf *conf) |
707 | { | 739 | { |
708 | struct zd_mac *mac = zd_hw_mac(hw); | 740 | struct zd_mac *mac = zd_hw_mac(hw); |
709 | mac->type = IEEE80211_IF_TYPE_INVALID; | 741 | mac->type = NL80211_IFTYPE_UNSPECIFIED; |
710 | zd_set_beacon_interval(&mac->chip, 0); | 742 | zd_set_beacon_interval(&mac->chip, 0); |
711 | zd_write_mac_addr(&mac->chip, NULL); | 743 | zd_write_mac_addr(&mac->chip, NULL); |
712 | } | 744 | } |
@@ -725,8 +757,8 @@ static int zd_op_config_interface(struct ieee80211_hw *hw, | |||
725 | int associated; | 757 | int associated; |
726 | int r; | 758 | int r; |
727 | 759 | ||
728 | if (mac->type == IEEE80211_IF_TYPE_MESH_POINT || | 760 | if (mac->type == NL80211_IFTYPE_MESH_POINT || |
729 | mac->type == IEEE80211_IF_TYPE_IBSS) { | 761 | mac->type == NL80211_IFTYPE_ADHOC) { |
730 | associated = true; | 762 | associated = true; |
731 | if (conf->changed & IEEE80211_IFCC_BEACON) { | 763 | if (conf->changed & IEEE80211_IFCC_BEACON) { |
732 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | 764 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); |
@@ -753,7 +785,7 @@ static int zd_op_config_interface(struct ieee80211_hw *hw, | |||
753 | return 0; | 785 | return 0; |
754 | } | 786 | } |
755 | 787 | ||
756 | void zd_process_intr(struct work_struct *work) | 788 | static void zd_process_intr(struct work_struct *work) |
757 | { | 789 | { |
758 | u16 int_status; | 790 | u16 int_status; |
759 | struct zd_mac *mac = container_of(work, struct zd_mac, process_intr); | 791 | struct zd_mac *mac = container_of(work, struct zd_mac, process_intr); |
@@ -923,7 +955,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf) | |||
923 | spin_lock_init(&mac->lock); | 955 | spin_lock_init(&mac->lock); |
924 | mac->hw = hw; | 956 | mac->hw = hw; |
925 | 957 | ||
926 | mac->type = IEEE80211_IF_TYPE_INVALID; | 958 | mac->type = NL80211_IFTYPE_UNSPECIFIED; |
927 | 959 | ||
928 | memcpy(mac->channels, zd_channels, sizeof(zd_channels)); | 960 | memcpy(mac->channels, zd_channels, sizeof(zd_channels)); |
929 | memcpy(mac->rates, zd_rates, sizeof(zd_rates)); | 961 | memcpy(mac->rates, zd_rates, sizeof(zd_rates)); |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h index 18c1d56d3dd7..4c05d3ee4c37 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.h +++ b/drivers/net/wireless/zd1211rw/zd_mac.h | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <net/mac80211.h> | 25 | #include <net/mac80211.h> |
26 | 26 | ||
27 | #include "zd_chip.h" | 27 | #include "zd_chip.h" |
28 | #include "zd_ieee80211.h" | ||
29 | 28 | ||
30 | struct zd_ctrlset { | 29 | struct zd_ctrlset { |
31 | u8 modulation; | 30 | u8 modulation; |
@@ -187,6 +186,70 @@ struct zd_mac { | |||
187 | unsigned int pass_ctrl:1; | 186 | unsigned int pass_ctrl:1; |
188 | }; | 187 | }; |
189 | 188 | ||
189 | #define ZD_REGDOMAIN_FCC 0x10 | ||
190 | #define ZD_REGDOMAIN_IC 0x20 | ||
191 | #define ZD_REGDOMAIN_ETSI 0x30 | ||
192 | #define ZD_REGDOMAIN_SPAIN 0x31 | ||
193 | #define ZD_REGDOMAIN_FRANCE 0x32 | ||
194 | #define ZD_REGDOMAIN_JAPAN_ADD 0x40 | ||
195 | #define ZD_REGDOMAIN_JAPAN 0x41 | ||
196 | |||
197 | enum { | ||
198 | MIN_CHANNEL24 = 1, | ||
199 | MAX_CHANNEL24 = 14, | ||
200 | }; | ||
201 | |||
202 | #define ZD_PLCP_SERVICE_LENGTH_EXTENSION 0x80 | ||
203 | |||
204 | struct ofdm_plcp_header { | ||
205 | u8 prefix[3]; | ||
206 | __le16 service; | ||
207 | } __attribute__((packed)); | ||
208 | |||
209 | static inline u8 zd_ofdm_plcp_header_rate(const struct ofdm_plcp_header *header) | ||
210 | { | ||
211 | return header->prefix[0] & 0xf; | ||
212 | } | ||
213 | |||
214 | /* The following defines give the encoding of the 4-bit rate field in the | ||
215 | * OFDM (802.11a/802.11g) PLCP header. Notify that these values are used to | ||
216 | * define the zd-rate values for OFDM. | ||
217 | * | ||
218 | * See the struct zd_ctrlset definition in zd_mac.h. | ||
219 | */ | ||
220 | #define ZD_OFDM_PLCP_RATE_6M 0xb | ||
221 | #define ZD_OFDM_PLCP_RATE_9M 0xf | ||
222 | #define ZD_OFDM_PLCP_RATE_12M 0xa | ||
223 | #define ZD_OFDM_PLCP_RATE_18M 0xe | ||
224 | #define ZD_OFDM_PLCP_RATE_24M 0x9 | ||
225 | #define ZD_OFDM_PLCP_RATE_36M 0xd | ||
226 | #define ZD_OFDM_PLCP_RATE_48M 0x8 | ||
227 | #define ZD_OFDM_PLCP_RATE_54M 0xc | ||
228 | |||
229 | struct cck_plcp_header { | ||
230 | u8 signal; | ||
231 | u8 service; | ||
232 | __le16 length; | ||
233 | __le16 crc16; | ||
234 | } __attribute__((packed)); | ||
235 | |||
236 | static inline u8 zd_cck_plcp_header_signal(const struct cck_plcp_header *header) | ||
237 | { | ||
238 | return header->signal; | ||
239 | } | ||
240 | |||
241 | /* These defines give the encodings of the signal field in the 802.11b PLCP | ||
242 | * header. The signal field gives the bit rate of the following packet. Even | ||
243 | * if technically wrong we use CCK here also for the 1 MBit/s and 2 MBit/s | ||
244 | * rate to stay consistent with Zydas and our use of the term. | ||
245 | * | ||
246 | * Notify that these values are *not* used in the zd-rates. | ||
247 | */ | ||
248 | #define ZD_CCK_PLCP_SIGNAL_1M 0x0a | ||
249 | #define ZD_CCK_PLCP_SIGNAL_2M 0x14 | ||
250 | #define ZD_CCK_PLCP_SIGNAL_5M5 0x37 | ||
251 | #define ZD_CCK_PLCP_SIGNAL_11M 0x6e | ||
252 | |||
190 | static inline struct zd_mac *zd_hw_mac(struct ieee80211_hw *hw) | 253 | static inline struct zd_mac *zd_hw_mac(struct ieee80211_hw *hw) |
191 | { | 254 | { |
192 | return hw->priv; | 255 | return hw->priv; |
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c index ec4129312813..7207bfd2e6cd 100644 --- a/drivers/net/wireless/zd1211rw/zd_rf.c +++ b/drivers/net/wireless/zd1211rw/zd_rf.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #include "zd_def.h" | 24 | #include "zd_def.h" |
25 | #include "zd_rf.h" | 25 | #include "zd_rf.h" |
26 | #include "zd_ieee80211.h" | 26 | #include "zd_mac.h" |
27 | #include "zd_chip.h" | 27 | #include "zd_chip.h" |
28 | 28 | ||
29 | static const char * const rfs[] = { | 29 | static const char * const rfs[] = { |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 5e51f4e7600b..9bad65400fba 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -92,6 +92,20 @@ | |||
92 | * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by | 92 | * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by |
93 | * %NL80211_ATTR_IFINDEX. | 93 | * %NL80211_ATTR_IFINDEX. |
94 | * | 94 | * |
95 | * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command | ||
96 | * after being queried by the kernel. CRDA replies by sending a regulatory | ||
97 | * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our | ||
98 | * current alpha2 if it found a match. It also provides | ||
99 | * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each | ||
100 | * regulatory rule is a nested set of attributes given by | ||
101 | * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and | ||
102 | * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by | ||
103 | * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and | ||
104 | * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. | ||
105 | * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain | ||
106 | * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will | ||
107 | * store this as a valid request and then query userspace for it. | ||
108 | * | ||
95 | * @NL80211_CMD_MAX: highest used command number | 109 | * @NL80211_CMD_MAX: highest used command number |
96 | * @__NL80211_CMD_AFTER_LAST: internal use | 110 | * @__NL80211_CMD_AFTER_LAST: internal use |
97 | */ | 111 | */ |
@@ -131,7 +145,10 @@ enum nl80211_commands { | |||
131 | 145 | ||
132 | NL80211_CMD_SET_BSS, | 146 | NL80211_CMD_SET_BSS, |
133 | 147 | ||
134 | /* add commands here */ | 148 | NL80211_CMD_SET_REG, |
149 | NL80211_CMD_REQ_SET_REG, | ||
150 | |||
151 | /* add new commands above here */ | ||
135 | 152 | ||
136 | /* used to define NL80211_CMD_MAX below */ | 153 | /* used to define NL80211_CMD_MAX below */ |
137 | __NL80211_CMD_AFTER_LAST, | 154 | __NL80211_CMD_AFTER_LAST, |
@@ -197,10 +214,21 @@ enum nl80211_commands { | |||
197 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at | 214 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at |
198 | * &enum nl80211_mpath_info. | 215 | * &enum nl80211_mpath_info. |
199 | * | 216 | * |
200 | * | ||
201 | * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of | 217 | * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of |
202 | * &enum nl80211_mntr_flags. | 218 | * &enum nl80211_mntr_flags. |
203 | * | 219 | * |
220 | * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the | ||
221 | * current regulatory domain should be set to or is already set to. | ||
222 | * For example, 'CR', for Costa Rica. This attribute is used by the kernel | ||
223 | * to query the CRDA to retrieve one regulatory domain. This attribute can | ||
224 | * also be used by userspace to query the kernel for the currently set | ||
225 | * regulatory domain. We chose an alpha2 as that is also used by the | ||
226 | * IEEE-802.11d country information element to identify a country. | ||
227 | * Users can also simply ask the wireless core to set regulatory domain | ||
228 | * to a specific alpha2. | ||
229 | * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory | ||
230 | * rules. | ||
231 | * | ||
204 | * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) | 232 | * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) |
205 | * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled | 233 | * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled |
206 | * (u8, 0 or 1) | 234 | * (u8, 0 or 1) |
@@ -265,6 +293,9 @@ enum nl80211_attrs { | |||
265 | 293 | ||
266 | NL80211_ATTR_SUPPORTED_IFTYPES, | 294 | NL80211_ATTR_SUPPORTED_IFTYPES, |
267 | 295 | ||
296 | NL80211_ATTR_REG_ALPHA2, | ||
297 | NL80211_ATTR_REG_RULES, | ||
298 | |||
268 | /* add attributes here, update the policy in nl80211.c */ | 299 | /* add attributes here, update the policy in nl80211.c */ |
269 | 300 | ||
270 | __NL80211_ATTR_AFTER_LAST, | 301 | __NL80211_ATTR_AFTER_LAST, |
@@ -278,6 +309,7 @@ enum nl80211_attrs { | |||
278 | #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY | 309 | #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY |
279 | 310 | ||
280 | #define NL80211_MAX_SUPP_RATES 32 | 311 | #define NL80211_MAX_SUPP_RATES 32 |
312 | #define NL80211_MAX_SUPP_REG_RULES 32 | ||
281 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 | 313 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 |
282 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 | 314 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 |
283 | #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 | 315 | #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 |
@@ -473,6 +505,66 @@ enum nl80211_bitrate_attr { | |||
473 | }; | 505 | }; |
474 | 506 | ||
475 | /** | 507 | /** |
508 | * enum nl80211_reg_rule_attr - regulatory rule attributes | ||
509 | * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional | ||
510 | * considerations for a given frequency range. These are the | ||
511 | * &enum nl80211_reg_rule_flags. | ||
512 | * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory | ||
513 | * rule in KHz. This is not a center of frequency but an actual regulatory | ||
514 | * band edge. | ||
515 | * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule | ||
516 | * in KHz. This is not a center a frequency but an actual regulatory | ||
517 | * band edge. | ||
518 | * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this | ||
519 | * frequency range, in KHz. | ||
520 | * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain | ||
521 | * for a given frequency range. The value is in mBi (100 * dBi). | ||
522 | * If you don't have one then don't send this. | ||
523 | * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for | ||
524 | * a given frequency range. The value is in mBm (100 * dBm). | ||
525 | */ | ||
526 | enum nl80211_reg_rule_attr { | ||
527 | __NL80211_REG_RULE_ATTR_INVALID, | ||
528 | NL80211_ATTR_REG_RULE_FLAGS, | ||
529 | |||
530 | NL80211_ATTR_FREQ_RANGE_START, | ||
531 | NL80211_ATTR_FREQ_RANGE_END, | ||
532 | NL80211_ATTR_FREQ_RANGE_MAX_BW, | ||
533 | |||
534 | NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, | ||
535 | NL80211_ATTR_POWER_RULE_MAX_EIRP, | ||
536 | |||
537 | /* keep last */ | ||
538 | __NL80211_REG_RULE_ATTR_AFTER_LAST, | ||
539 | NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 | ||
540 | }; | ||
541 | |||
542 | /** | ||
543 | * enum nl80211_reg_rule_flags - regulatory rule flags | ||
544 | * | ||
545 | * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed | ||
546 | * @NL80211_RRF_NO_CCK: CCK modulation not allowed | ||
547 | * @NL80211_RRF_NO_INDOOR: indoor operation not allowed | ||
548 | * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed | ||
549 | * @NL80211_RRF_DFS: DFS support is required to be used | ||
550 | * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links | ||
551 | * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links | ||
552 | * @NL80211_RRF_PASSIVE_SCAN: passive scan is required | ||
553 | * @NL80211_RRF_NO_IBSS: no IBSS is allowed | ||
554 | */ | ||
555 | enum nl80211_reg_rule_flags { | ||
556 | NL80211_RRF_NO_OFDM = 1<<0, | ||
557 | NL80211_RRF_NO_CCK = 1<<1, | ||
558 | NL80211_RRF_NO_INDOOR = 1<<2, | ||
559 | NL80211_RRF_NO_OUTDOOR = 1<<3, | ||
560 | NL80211_RRF_DFS = 1<<4, | ||
561 | NL80211_RRF_PTP_ONLY = 1<<5, | ||
562 | NL80211_RRF_PTMP_ONLY = 1<<6, | ||
563 | NL80211_RRF_PASSIVE_SCAN = 1<<7, | ||
564 | NL80211_RRF_NO_IBSS = 1<<8, | ||
565 | }; | ||
566 | |||
567 | /** | ||
476 | * enum nl80211_mntr_flags - monitor configuration flags | 568 | * enum nl80211_mntr_flags - monitor configuration flags |
477 | * | 569 | * |
478 | * Monitor configuration flags. | 570 | * Monitor configuration flags. |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 0a72d1e3d3ab..9f40c4d417d7 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -287,6 +287,66 @@ struct bss_parameters { | |||
287 | int use_short_slot_time; | 287 | int use_short_slot_time; |
288 | }; | 288 | }; |
289 | 289 | ||
290 | /** | ||
291 | * enum reg_set_by - Indicates who is trying to set the regulatory domain | ||
292 | * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be | ||
293 | * using a static world regulatory domain by default. | ||
294 | * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain. | ||
295 | * @REGDOM_SET_BY_USER: User asked the wireless core to set the | ||
296 | * regulatory domain. | ||
297 | * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core | ||
298 | * it thinks its knows the regulatory domain we should be in. | ||
299 | * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country | ||
300 | * information element with regulatory information it thinks we | ||
301 | * should consider. | ||
302 | */ | ||
303 | enum reg_set_by { | ||
304 | REGDOM_SET_BY_INIT, | ||
305 | REGDOM_SET_BY_CORE, | ||
306 | REGDOM_SET_BY_USER, | ||
307 | REGDOM_SET_BY_DRIVER, | ||
308 | REGDOM_SET_BY_COUNTRY_IE, | ||
309 | }; | ||
310 | |||
311 | struct ieee80211_freq_range { | ||
312 | u32 start_freq_khz; | ||
313 | u32 end_freq_khz; | ||
314 | u32 max_bandwidth_khz; | ||
315 | }; | ||
316 | |||
317 | struct ieee80211_power_rule { | ||
318 | u32 max_antenna_gain; | ||
319 | u32 max_eirp; | ||
320 | }; | ||
321 | |||
322 | struct ieee80211_reg_rule { | ||
323 | struct ieee80211_freq_range freq_range; | ||
324 | struct ieee80211_power_rule power_rule; | ||
325 | u32 flags; | ||
326 | }; | ||
327 | |||
328 | struct ieee80211_regdomain { | ||
329 | u32 n_reg_rules; | ||
330 | char alpha2[2]; | ||
331 | struct ieee80211_reg_rule reg_rules[]; | ||
332 | }; | ||
333 | |||
334 | #define MHZ_TO_KHZ(freq) (freq * 1000) | ||
335 | #define KHZ_TO_MHZ(freq) (freq / 1000) | ||
336 | #define DBI_TO_MBI(gain) (gain * 100) | ||
337 | #define MBI_TO_DBI(gain) (gain / 100) | ||
338 | #define DBM_TO_MBM(gain) (gain * 100) | ||
339 | #define MBM_TO_DBM(gain) (gain / 100) | ||
340 | |||
341 | #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ | ||
342 | .freq_range.start_freq_khz = (start) * 1000, \ | ||
343 | .freq_range.end_freq_khz = (end) * 1000, \ | ||
344 | .freq_range.max_bandwidth_khz = (bw) * 1000, \ | ||
345 | .power_rule.max_antenna_gain = (gain) * 100, \ | ||
346 | .power_rule.max_eirp = (eirp) * 100, \ | ||
347 | .flags = reg_flags, \ | ||
348 | } | ||
349 | |||
290 | /* from net/wireless.h */ | 350 | /* from net/wireless.h */ |
291 | struct wiphy; | 351 | struct wiphy; |
292 | 352 | ||
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index fb9e62211c34..003e4a03874e 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -160,6 +160,7 @@ struct ieee80211_low_level_stats { | |||
160 | * @BSS_CHANGED_ERP_PREAMBLE: preamble changed | 160 | * @BSS_CHANGED_ERP_PREAMBLE: preamble changed |
161 | * @BSS_CHANGED_ERP_SLOT: slot timing changed | 161 | * @BSS_CHANGED_ERP_SLOT: slot timing changed |
162 | * @BSS_CHANGED_HT: 802.11n parameters changed | 162 | * @BSS_CHANGED_HT: 802.11n parameters changed |
163 | * @BSS_CHANGED_BASIC_RATES: Basic rateset changed | ||
163 | */ | 164 | */ |
164 | enum ieee80211_bss_change { | 165 | enum ieee80211_bss_change { |
165 | BSS_CHANGED_ASSOC = 1<<0, | 166 | BSS_CHANGED_ASSOC = 1<<0, |
@@ -167,6 +168,7 @@ enum ieee80211_bss_change { | |||
167 | BSS_CHANGED_ERP_PREAMBLE = 1<<2, | 168 | BSS_CHANGED_ERP_PREAMBLE = 1<<2, |
168 | BSS_CHANGED_ERP_SLOT = 1<<3, | 169 | BSS_CHANGED_ERP_SLOT = 1<<3, |
169 | BSS_CHANGED_HT = 1<<4, | 170 | BSS_CHANGED_HT = 1<<4, |
171 | BSS_CHANGED_BASIC_RATES = 1<<5, | ||
170 | }; | 172 | }; |
171 | 173 | ||
172 | /** | 174 | /** |
@@ -187,6 +189,9 @@ enum ieee80211_bss_change { | |||
187 | * @assoc_ht: association in HT mode | 189 | * @assoc_ht: association in HT mode |
188 | * @ht_conf: ht capabilities | 190 | * @ht_conf: ht capabilities |
189 | * @ht_bss_conf: ht extended capabilities | 191 | * @ht_bss_conf: ht extended capabilities |
192 | * @basic_rates: bitmap of basic rates, each bit stands for an | ||
193 | * index into the rate table configured by the driver in | ||
194 | * the current band. | ||
190 | */ | 195 | */ |
191 | struct ieee80211_bss_conf { | 196 | struct ieee80211_bss_conf { |
192 | /* association related data */ | 197 | /* association related data */ |
@@ -200,6 +205,7 @@ struct ieee80211_bss_conf { | |||
200 | u16 beacon_int; | 205 | u16 beacon_int; |
201 | u16 assoc_capability; | 206 | u16 assoc_capability; |
202 | u64 timestamp; | 207 | u64 timestamp; |
208 | u64 basic_rates; | ||
203 | /* ht related data */ | 209 | /* ht related data */ |
204 | bool assoc_ht; | 210 | bool assoc_ht; |
205 | struct ieee80211_ht_info *ht_conf; | 211 | struct ieee80211_ht_info *ht_conf; |
@@ -294,6 +300,9 @@ enum mac80211_tx_control_flags { | |||
294 | * (2) driver internal use (if applicable) | 300 | * (2) driver internal use (if applicable) |
295 | * (3) TX status information - driver tells mac80211 what happened | 301 | * (3) TX status information - driver tells mac80211 what happened |
296 | * | 302 | * |
303 | * The TX control's sta pointer is only valid during the ->tx call, | ||
304 | * it may be NULL. | ||
305 | * | ||
297 | * @flags: transmit info flags, defined above | 306 | * @flags: transmit info flags, defined above |
298 | * @band: TBD | 307 | * @band: TBD |
299 | * @tx_rate_idx: TBD | 308 | * @tx_rate_idx: TBD |
@@ -321,10 +330,11 @@ struct ieee80211_tx_info { | |||
321 | 330 | ||
322 | union { | 331 | union { |
323 | struct { | 332 | struct { |
333 | /* NB: vif can be NULL for injected frames */ | ||
324 | struct ieee80211_vif *vif; | 334 | struct ieee80211_vif *vif; |
325 | struct ieee80211_key_conf *hw_key; | 335 | struct ieee80211_key_conf *hw_key; |
336 | struct ieee80211_sta *sta; | ||
326 | unsigned long jiffies; | 337 | unsigned long jiffies; |
327 | u16 aid; | ||
328 | s8 rts_cts_rate_idx, alt_retry_rate_idx; | 338 | s8 rts_cts_rate_idx, alt_retry_rate_idx; |
329 | u8 retry_limit; | 339 | u8 retry_limit; |
330 | u8 icv_len; | 340 | u8 icv_len; |
@@ -472,33 +482,6 @@ struct ieee80211_conf { | |||
472 | }; | 482 | }; |
473 | 483 | ||
474 | /** | 484 | /** |
475 | * enum ieee80211_if_types - types of 802.11 network interfaces | ||
476 | * | ||
477 | * @IEEE80211_IF_TYPE_INVALID: invalid interface type, not used | ||
478 | * by mac80211 itself | ||
479 | * @IEEE80211_IF_TYPE_AP: interface in AP mode. | ||
480 | * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap | ||
481 | * daemon. Drivers should never see this type. | ||
482 | * @IEEE80211_IF_TYPE_STA: interface in STA (client) mode. | ||
483 | * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode. | ||
484 | * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode. | ||
485 | * @IEEE80211_IF_TYPE_WDS: interface in WDS mode. | ||
486 | * @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers | ||
487 | * will never see this type. | ||
488 | * @IEEE80211_IF_TYPE_MESH_POINT: 802.11s mesh point | ||
489 | */ | ||
490 | enum ieee80211_if_types { | ||
491 | IEEE80211_IF_TYPE_INVALID, | ||
492 | IEEE80211_IF_TYPE_AP, | ||
493 | IEEE80211_IF_TYPE_STA, | ||
494 | IEEE80211_IF_TYPE_IBSS, | ||
495 | IEEE80211_IF_TYPE_MESH_POINT, | ||
496 | IEEE80211_IF_TYPE_MNTR, | ||
497 | IEEE80211_IF_TYPE_WDS, | ||
498 | IEEE80211_IF_TYPE_VLAN, | ||
499 | }; | ||
500 | |||
501 | /** | ||
502 | * struct ieee80211_vif - per-interface data | 485 | * struct ieee80211_vif - per-interface data |
503 | * | 486 | * |
504 | * Data in this structure is continually present for driver | 487 | * Data in this structure is continually present for driver |
@@ -509,7 +492,7 @@ enum ieee80211_if_types { | |||
509 | * sizeof(void *). | 492 | * sizeof(void *). |
510 | */ | 493 | */ |
511 | struct ieee80211_vif { | 494 | struct ieee80211_vif { |
512 | enum ieee80211_if_types type; | 495 | enum nl80211_iftype type; |
513 | /* must be last */ | 496 | /* must be last */ |
514 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 497 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
515 | }; | 498 | }; |
@@ -517,7 +500,7 @@ struct ieee80211_vif { | |||
517 | static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | 500 | static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) |
518 | { | 501 | { |
519 | #ifdef CONFIG_MAC80211_MESH | 502 | #ifdef CONFIG_MAC80211_MESH |
520 | return vif->type == IEEE80211_IF_TYPE_MESH_POINT; | 503 | return vif->type == NL80211_IFTYPE_MESH_POINT; |
521 | #endif | 504 | #endif |
522 | return false; | 505 | return false; |
523 | } | 506 | } |
@@ -528,7 +511,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
528 | * @vif: pointer to a driver-use per-interface structure. The pointer | 511 | * @vif: pointer to a driver-use per-interface structure. The pointer |
529 | * itself is also used for various functions including | 512 | * itself is also used for various functions including |
530 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). | 513 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). |
531 | * @type: one of &enum ieee80211_if_types constants. Determines the type of | 514 | * @type: one of &enum nl80211_iftype constants. Determines the type of |
532 | * added/removed interface. | 515 | * added/removed interface. |
533 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | 516 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid |
534 | * until the interface is removed (i.e. it cannot be used after | 517 | * until the interface is removed (i.e. it cannot be used after |
@@ -544,7 +527,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
544 | * in pure monitor mode. | 527 | * in pure monitor mode. |
545 | */ | 528 | */ |
546 | struct ieee80211_if_init_conf { | 529 | struct ieee80211_if_init_conf { |
547 | enum ieee80211_if_types type; | 530 | enum nl80211_iftype type; |
548 | struct ieee80211_vif *vif; | 531 | struct ieee80211_vif *vif; |
549 | void *mac_addr; | 532 | void *mac_addr; |
550 | }; | 533 | }; |
@@ -673,6 +656,33 @@ enum set_key_cmd { | |||
673 | }; | 656 | }; |
674 | 657 | ||
675 | /** | 658 | /** |
659 | * struct ieee80211_sta - station table entry | ||
660 | * | ||
661 | * A station table entry represents a station we are possibly | ||
662 | * communicating with. Since stations are RCU-managed in | ||
663 | * mac80211, any ieee80211_sta pointer you get access to must | ||
664 | * either be protected by rcu_read_lock() explicitly or implicitly, | ||
665 | * or you must take good care to not use such a pointer after a | ||
666 | * call to your sta_notify callback that removed it. | ||
667 | * | ||
668 | * @addr: MAC address | ||
669 | * @aid: AID we assigned to the station if we're an AP | ||
670 | * @supp_rates: Bitmap of supported rates (per band) | ||
671 | * @ht_info: HT capabilities of this STA | ||
672 | * @drv_priv: data area for driver use, will always be aligned to | ||
673 | * sizeof(void *), size is determined in hw information. | ||
674 | */ | ||
675 | struct ieee80211_sta { | ||
676 | u64 supp_rates[IEEE80211_NUM_BANDS]; | ||
677 | u8 addr[ETH_ALEN]; | ||
678 | u16 aid; | ||
679 | struct ieee80211_ht_info ht_info; | ||
680 | |||
681 | /* must be last */ | ||
682 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | ||
683 | }; | ||
684 | |||
685 | /** | ||
676 | * enum sta_notify_cmd - sta notify command | 686 | * enum sta_notify_cmd - sta notify command |
677 | * | 687 | * |
678 | * Used with the sta_notify() callback in &struct ieee80211_ops, this | 688 | * Used with the sta_notify() callback in &struct ieee80211_ops, this |
@@ -816,6 +826,8 @@ enum ieee80211_hw_flags { | |||
816 | * | 826 | * |
817 | * @vif_data_size: size (in bytes) of the drv_priv data area | 827 | * @vif_data_size: size (in bytes) of the drv_priv data area |
818 | * within &struct ieee80211_vif. | 828 | * within &struct ieee80211_vif. |
829 | * @sta_data_size: size (in bytes) of the drv_priv data area | ||
830 | * within &struct ieee80211_sta. | ||
819 | */ | 831 | */ |
820 | struct ieee80211_hw { | 832 | struct ieee80211_hw { |
821 | struct ieee80211_conf conf; | 833 | struct ieee80211_conf conf; |
@@ -827,12 +839,15 @@ struct ieee80211_hw { | |||
827 | unsigned int extra_tx_headroom; | 839 | unsigned int extra_tx_headroom; |
828 | int channel_change_time; | 840 | int channel_change_time; |
829 | int vif_data_size; | 841 | int vif_data_size; |
842 | int sta_data_size; | ||
830 | u16 queues; | 843 | u16 queues; |
831 | u16 ampdu_queues; | 844 | u16 ampdu_queues; |
832 | u16 max_listen_interval; | 845 | u16 max_listen_interval; |
833 | s8 max_signal; | 846 | s8 max_signal; |
834 | }; | 847 | }; |
835 | 848 | ||
849 | struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy); | ||
850 | |||
836 | /** | 851 | /** |
837 | * SET_IEEE80211_DEV - set device for 802.11 hardware | 852 | * SET_IEEE80211_DEV - set device for 802.11 hardware |
838 | * | 853 | * |
@@ -1108,7 +1123,7 @@ enum ieee80211_ampdu_mlme_action { | |||
1108 | * This callback must be implemented and atomic. | 1123 | * This callback must be implemented and atomic. |
1109 | * | 1124 | * |
1110 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit | 1125 | * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit |
1111 | * must be set or cleared for a given AID. Must be atomic. | 1126 | * must be set or cleared for a given STA. Must be atomic. |
1112 | * | 1127 | * |
1113 | * @set_key: See the section "Hardware crypto acceleration" | 1128 | * @set_key: See the section "Hardware crypto acceleration" |
1114 | * This callback can sleep, and is only called between add_interface | 1129 | * This callback can sleep, and is only called between add_interface |
@@ -1122,7 +1137,9 @@ enum ieee80211_ampdu_mlme_action { | |||
1122 | * @hw_scan: Ask the hardware to service the scan request, no need to start | 1137 | * @hw_scan: Ask the hardware to service the scan request, no need to start |
1123 | * the scan state machine in stack. The scan must honour the channel | 1138 | * the scan state machine in stack. The scan must honour the channel |
1124 | * configuration done by the regulatory agent in the wiphy's registered | 1139 | * configuration done by the regulatory agent in the wiphy's registered |
1125 | * bands. | 1140 | * bands. When the scan finishes, ieee80211_scan_completed() must be |
1141 | * called; note that it also must be called when the scan cannot finish | ||
1142 | * because the hardware is turned off! Anything else is a bug! | ||
1126 | * | 1143 | * |
1127 | * @get_stats: return low-level statistics | 1144 | * @get_stats: return low-level statistics |
1128 | * | 1145 | * |
@@ -1192,7 +1209,8 @@ struct ieee80211_ops { | |||
1192 | unsigned int changed_flags, | 1209 | unsigned int changed_flags, |
1193 | unsigned int *total_flags, | 1210 | unsigned int *total_flags, |
1194 | int mc_count, struct dev_addr_list *mc_list); | 1211 | int mc_count, struct dev_addr_list *mc_list); |
1195 | int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); | 1212 | int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, |
1213 | bool set); | ||
1196 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 1214 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
1197 | const u8 *local_address, const u8 *address, | 1215 | const u8 *local_address, const u8 *address, |
1198 | struct ieee80211_key_conf *key); | 1216 | struct ieee80211_key_conf *key); |
@@ -1209,7 +1227,7 @@ struct ieee80211_ops { | |||
1209 | int (*set_retry_limit)(struct ieee80211_hw *hw, | 1227 | int (*set_retry_limit)(struct ieee80211_hw *hw, |
1210 | u32 short_retry, u32 long_retr); | 1228 | u32 short_retry, u32 long_retr); |
1211 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1229 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1212 | enum sta_notify_cmd, const u8 *addr); | 1230 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
1213 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, | 1231 | int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, |
1214 | const struct ieee80211_tx_queue_params *params); | 1232 | const struct ieee80211_tx_queue_params *params); |
1215 | int (*get_tx_stats)(struct ieee80211_hw *hw, | 1233 | int (*get_tx_stats)(struct ieee80211_hw *hw, |
@@ -1219,7 +1237,7 @@ struct ieee80211_ops { | |||
1219 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 1237 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
1220 | int (*ampdu_action)(struct ieee80211_hw *hw, | 1238 | int (*ampdu_action)(struct ieee80211_hw *hw, |
1221 | enum ieee80211_ampdu_mlme_action action, | 1239 | enum ieee80211_ampdu_mlme_action action, |
1222 | const u8 *addr, u16 tid, u16 *ssn); | 1240 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
1223 | }; | 1241 | }; |
1224 | 1242 | ||
1225 | /** | 1243 | /** |
@@ -1769,4 +1787,17 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, | |||
1769 | */ | 1787 | */ |
1770 | void ieee80211_notify_mac(struct ieee80211_hw *hw, | 1788 | void ieee80211_notify_mac(struct ieee80211_hw *hw, |
1771 | enum ieee80211_notification_types notif_type); | 1789 | enum ieee80211_notification_types notif_type); |
1790 | |||
1791 | /** | ||
1792 | * ieee80211_find_sta - find a station | ||
1793 | * | ||
1794 | * @hw: pointer as obtained from ieee80211_alloc_hw() | ||
1795 | * @addr: station's address | ||
1796 | * | ||
1797 | * This function must be called under RCU lock and the | ||
1798 | * resulting pointer is only valid under RCU lock as well. | ||
1799 | */ | ||
1800 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | ||
1801 | const u8 *addr); | ||
1802 | |||
1772 | #endif /* MAC80211_H */ | 1803 | #endif /* MAC80211_H */ |
diff --git a/include/net/wireless.h b/include/net/wireless.h index 1dc8ec3daa2f..e4378cc6bf8e 100644 --- a/include/net/wireless.h +++ b/include/net/wireless.h | |||
@@ -60,6 +60,7 @@ enum ieee80211_channel_flags { | |||
60 | * with cfg80211. | 60 | * with cfg80211. |
61 | * | 61 | * |
62 | * @center_freq: center frequency in MHz | 62 | * @center_freq: center frequency in MHz |
63 | * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz | ||
63 | * @hw_value: hardware-specific value for the channel | 64 | * @hw_value: hardware-specific value for the channel |
64 | * @flags: channel flags from &enum ieee80211_channel_flags. | 65 | * @flags: channel flags from &enum ieee80211_channel_flags. |
65 | * @orig_flags: channel flags at registration time, used by regulatory | 66 | * @orig_flags: channel flags at registration time, used by regulatory |
@@ -73,6 +74,7 @@ enum ieee80211_channel_flags { | |||
73 | struct ieee80211_channel { | 74 | struct ieee80211_channel { |
74 | enum ieee80211_band band; | 75 | enum ieee80211_band band; |
75 | u16 center_freq; | 76 | u16 center_freq; |
77 | u8 max_bandwidth; | ||
76 | u16 hw_value; | 78 | u16 hw_value; |
77 | u32 flags; | 79 | u32 flags; |
78 | int max_antenna_gain; | 80 | int max_antenna_gain; |
@@ -178,6 +180,7 @@ struct ieee80211_supported_band { | |||
178 | * struct wiphy - wireless hardware description | 180 | * struct wiphy - wireless hardware description |
179 | * @idx: the wiphy index assigned to this item | 181 | * @idx: the wiphy index assigned to this item |
180 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | 182 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> |
183 | * @reg_notifier: the driver's regulatory notification callback | ||
181 | */ | 184 | */ |
182 | struct wiphy { | 185 | struct wiphy { |
183 | /* assign these fields before you register the wiphy */ | 186 | /* assign these fields before you register the wiphy */ |
@@ -197,6 +200,9 @@ struct wiphy { | |||
197 | 200 | ||
198 | struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; | 201 | struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; |
199 | 202 | ||
203 | /* Lets us get back the wiphy on the callback */ | ||
204 | int (*reg_notifier)(struct wiphy *wiphy, enum reg_set_by setby); | ||
205 | |||
200 | /* fields below are read-only, assigned by cfg80211 */ | 206 | /* fields below are read-only, assigned by cfg80211 */ |
201 | 207 | ||
202 | /* the item in /sys/class/ieee80211/ points to this, | 208 | /* the item in /sys/class/ieee80211/ points to this, |
@@ -322,6 +328,58 @@ extern int ieee80211_frequency_to_channel(int freq); | |||
322 | */ | 328 | */ |
323 | extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, | 329 | extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, |
324 | int freq); | 330 | int freq); |
331 | /** | ||
332 | * __regulatory_hint - hint to the wireless core a regulatory domain | ||
333 | * @wiphy: if a driver is providing the hint this is the driver's very | ||
334 | * own &struct wiphy | ||
335 | * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain | ||
336 | * should be in. If @rd is set this should be NULL | ||
337 | * @rd: a complete regulatory domain, if passed the caller need not worry | ||
338 | * about freeing it | ||
339 | * | ||
340 | * The Wireless subsystem can use this function to hint to the wireless core | ||
341 | * what it believes should be the current regulatory domain by | ||
342 | * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory | ||
343 | * domain should be in or by providing a completely build regulatory domain. | ||
344 | * | ||
345 | * Returns -EALREADY if *a regulatory domain* has already been set. Note that | ||
346 | * this could be by another driver. It is safe for drivers to continue if | ||
347 | * -EALREADY is returned, if drivers are not capable of world roaming they | ||
348 | * should not register more channels than they support. Right now we only | ||
349 | * support listening to the first driver hint. If the driver is capable | ||
350 | * of world roaming but wants to respect its own EEPROM mappings for | ||
351 | * specific regulatory domains it should register the @reg_notifier callback | ||
352 | * on the &struct wiphy. Returns 0 if the hint went through fine or through an | ||
353 | * intersection operation. Otherwise a standard error code is returned. | ||
354 | * | ||
355 | */ | ||
356 | extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, | ||
357 | const char *alpha2, struct ieee80211_regdomain *rd); | ||
358 | /** | ||
359 | * regulatory_hint - driver hint to the wireless core a regulatory domain | ||
360 | * @wiphy: the driver's very own &struct wiphy | ||
361 | * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain | ||
362 | * should be in. If @rd is set this should be NULL. Note that if you | ||
363 | * set this to NULL you should still set rd->alpha2 to some accepted | ||
364 | * alpha2. | ||
365 | * @rd: a complete regulatory domain provided by the driver. If passed | ||
366 | * the driver does not need to worry about freeing it. | ||
367 | * | ||
368 | * Wireless drivers can use this function to hint to the wireless core | ||
369 | * what it believes should be the current regulatory domain by | ||
370 | * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory | ||
371 | * domain should be in or by providing a completely build regulatory domain. | ||
372 | * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried | ||
373 | * for a regulatory domain structure for the respective country. If | ||
374 | * a regulatory domain is build and passed you should set the alpha2 | ||
375 | * if possible, otherwise set it to the special value of "99" which tells | ||
376 | * the wireless core it is unknown. If you pass a built regulatory domain | ||
377 | * and we return non zero you are in charge of kfree()'ing the structure. | ||
378 | * | ||
379 | * See __regulatory_hint() documentation for possible return values. | ||
380 | */ | ||
381 | extern int regulatory_hint(struct wiphy *wiphy, | ||
382 | const char *alpha2, struct ieee80211_regdomain *rd); | ||
325 | 383 | ||
326 | /** | 384 | /** |
327 | * ieee80211_get_channel - get channel struct from wiphy for specified frequency | 385 | * ieee80211_get_channel - get channel struct from wiphy for specified frequency |
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 80d693392b0f..8427518e4f20 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -179,19 +179,6 @@ config MAC80211_VERBOSE_MPL_DEBUG | |||
179 | 179 | ||
180 | Do not select this option. | 180 | Do not select this option. |
181 | 181 | ||
182 | config MAC80211_LOWTX_FRAME_DUMP | ||
183 | bool "Debug frame dumping" | ||
184 | depends on MAC80211_DEBUG_MENU | ||
185 | ---help--- | ||
186 | Selecting this option will cause the stack to | ||
187 | print a message for each frame that is handed | ||
188 | to the lowlevel driver for transmission. This | ||
189 | message includes all MAC addresses and the | ||
190 | frame control field. | ||
191 | |||
192 | If unsure, say N and insert the debugging code | ||
193 | you require into the driver you are debugging. | ||
194 | |||
195 | config MAC80211_DEBUG_COUNTERS | 182 | config MAC80211_DEBUG_COUNTERS |
196 | bool "Extra statistics for TX/RX debugging" | 183 | bool "Extra statistics for TX/RX debugging" |
197 | depends on MAC80211_DEBUG_MENU | 184 | depends on MAC80211_DEBUG_MENU |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 928813ce08e2..e2574885db4a 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -17,26 +17,26 @@ | |||
17 | #include "rate.h" | 17 | #include "rate.h" |
18 | #include "mesh.h" | 18 | #include "mesh.h" |
19 | 19 | ||
20 | static enum ieee80211_if_types | 20 | struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy) |
21 | nl80211_type_to_mac80211_type(enum nl80211_iftype type) | 21 | { |
22 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
23 | return &local->hw; | ||
24 | } | ||
25 | EXPORT_SYMBOL(wiphy_to_hw); | ||
26 | |||
27 | static bool nl80211_type_check(enum nl80211_iftype type) | ||
22 | { | 28 | { |
23 | switch (type) { | 29 | switch (type) { |
24 | case NL80211_IFTYPE_UNSPECIFIED: | ||
25 | return IEEE80211_IF_TYPE_STA; | ||
26 | case NL80211_IFTYPE_ADHOC: | 30 | case NL80211_IFTYPE_ADHOC: |
27 | return IEEE80211_IF_TYPE_IBSS; | ||
28 | case NL80211_IFTYPE_STATION: | 31 | case NL80211_IFTYPE_STATION: |
29 | return IEEE80211_IF_TYPE_STA; | ||
30 | case NL80211_IFTYPE_MONITOR: | 32 | case NL80211_IFTYPE_MONITOR: |
31 | return IEEE80211_IF_TYPE_MNTR; | ||
32 | #ifdef CONFIG_MAC80211_MESH | 33 | #ifdef CONFIG_MAC80211_MESH |
33 | case NL80211_IFTYPE_MESH_POINT: | 34 | case NL80211_IFTYPE_MESH_POINT: |
34 | return IEEE80211_IF_TYPE_MESH_POINT; | ||
35 | #endif | 35 | #endif |
36 | case NL80211_IFTYPE_WDS: | 36 | case NL80211_IFTYPE_WDS: |
37 | return IEEE80211_IF_TYPE_WDS; | 37 | return true; |
38 | default: | 38 | default: |
39 | return IEEE80211_IF_TYPE_INVALID; | 39 | return false; |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
@@ -45,17 +45,15 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | |||
45 | struct vif_params *params) | 45 | struct vif_params *params) |
46 | { | 46 | { |
47 | struct ieee80211_local *local = wiphy_priv(wiphy); | 47 | struct ieee80211_local *local = wiphy_priv(wiphy); |
48 | enum ieee80211_if_types itype; | ||
49 | struct net_device *dev; | 48 | struct net_device *dev; |
50 | struct ieee80211_sub_if_data *sdata; | 49 | struct ieee80211_sub_if_data *sdata; |
51 | int err; | 50 | int err; |
52 | 51 | ||
53 | itype = nl80211_type_to_mac80211_type(type); | 52 | if (!nl80211_type_check(type)) |
54 | if (itype == IEEE80211_IF_TYPE_INVALID) | ||
55 | return -EINVAL; | 53 | return -EINVAL; |
56 | 54 | ||
57 | err = ieee80211_if_add(local, name, &dev, itype, params); | 55 | err = ieee80211_if_add(local, name, &dev, type, params); |
58 | if (err || itype != IEEE80211_IF_TYPE_MNTR || !flags) | 56 | if (err || type != NL80211_IFTYPE_MONITOR || !flags) |
59 | return err; | 57 | return err; |
60 | 58 | ||
61 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 59 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
@@ -86,7 +84,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex, | |||
86 | { | 84 | { |
87 | struct ieee80211_local *local = wiphy_priv(wiphy); | 85 | struct ieee80211_local *local = wiphy_priv(wiphy); |
88 | struct net_device *dev; | 86 | struct net_device *dev; |
89 | enum ieee80211_if_types itype; | ||
90 | struct ieee80211_sub_if_data *sdata; | 87 | struct ieee80211_sub_if_data *sdata; |
91 | int ret; | 88 | int ret; |
92 | 89 | ||
@@ -95,8 +92,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex, | |||
95 | if (!dev) | 92 | if (!dev) |
96 | return -ENODEV; | 93 | return -ENODEV; |
97 | 94 | ||
98 | itype = nl80211_type_to_mac80211_type(type); | 95 | if (!nl80211_type_check(type)) |
99 | if (itype == IEEE80211_IF_TYPE_INVALID) | ||
100 | return -EINVAL; | 96 | return -EINVAL; |
101 | 97 | ||
102 | if (dev == local->mdev) | 98 | if (dev == local->mdev) |
@@ -104,16 +100,16 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex, | |||
104 | 100 | ||
105 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 101 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
106 | 102 | ||
107 | ret = ieee80211_if_change_type(sdata, itype); | 103 | ret = ieee80211_if_change_type(sdata, type); |
108 | if (ret) | 104 | if (ret) |
109 | return ret; | 105 | return ret; |
110 | 106 | ||
111 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) | 107 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) |
112 | ieee80211_if_sta_set_mesh_id(&sdata->u.sta, | 108 | ieee80211_sdata_set_mesh_id(sdata, |
113 | params->mesh_id_len, | 109 | params->mesh_id_len, |
114 | params->mesh_id); | 110 | params->mesh_id); |
115 | 111 | ||
116 | if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR || !flags) | 112 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags) |
117 | return 0; | 113 | return 0; |
118 | 114 | ||
119 | sdata->u.mntr_flags = *flags; | 115 | sdata->u.mntr_flags = *flags; |
@@ -368,7 +364,7 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | |||
368 | sta = sta_info_get_by_idx(local, idx, dev); | 364 | sta = sta_info_get_by_idx(local, idx, dev); |
369 | if (sta) { | 365 | if (sta) { |
370 | ret = 0; | 366 | ret = 0; |
371 | memcpy(mac, sta->addr, ETH_ALEN); | 367 | memcpy(mac, sta->sta.addr, ETH_ALEN); |
372 | sta_set_sinfo(sta, sinfo); | 368 | sta_set_sinfo(sta, sinfo); |
373 | } | 369 | } |
374 | 370 | ||
@@ -509,7 +505,7 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, | |||
509 | 505 | ||
510 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 506 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
511 | 507 | ||
512 | if (sdata->vif.type != IEEE80211_IF_TYPE_AP) | 508 | if (sdata->vif.type != NL80211_IFTYPE_AP) |
513 | return -EINVAL; | 509 | return -EINVAL; |
514 | 510 | ||
515 | old = sdata->u.ap.beacon; | 511 | old = sdata->u.ap.beacon; |
@@ -532,7 +528,7 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, | |||
532 | 528 | ||
533 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 529 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
534 | 530 | ||
535 | if (sdata->vif.type != IEEE80211_IF_TYPE_AP) | 531 | if (sdata->vif.type != NL80211_IFTYPE_AP) |
536 | return -EINVAL; | 532 | return -EINVAL; |
537 | 533 | ||
538 | old = sdata->u.ap.beacon; | 534 | old = sdata->u.ap.beacon; |
@@ -554,7 +550,7 @@ static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) | |||
554 | 550 | ||
555 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 551 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
556 | 552 | ||
557 | if (sdata->vif.type != IEEE80211_IF_TYPE_AP) | 553 | if (sdata->vif.type != NL80211_IFTYPE_AP) |
558 | return -EINVAL; | 554 | return -EINVAL; |
559 | 555 | ||
560 | old = sdata->u.ap.beacon; | 556 | old = sdata->u.ap.beacon; |
@@ -597,7 +593,7 @@ static void ieee80211_send_layer2_update(struct sta_info *sta) | |||
597 | * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ | 593 | * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ |
598 | 594 | ||
599 | memset(msg->da, 0xff, ETH_ALEN); | 595 | memset(msg->da, 0xff, ETH_ALEN); |
600 | memcpy(msg->sa, sta->addr, ETH_ALEN); | 596 | memcpy(msg->sa, sta->sta.addr, ETH_ALEN); |
601 | msg->len = htons(6); | 597 | msg->len = htons(6); |
602 | msg->dsap = 0; | 598 | msg->dsap = 0; |
603 | msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ | 599 | msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ |
@@ -652,9 +648,9 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
652 | */ | 648 | */ |
653 | 649 | ||
654 | if (params->aid) { | 650 | if (params->aid) { |
655 | sta->aid = params->aid; | 651 | sta->sta.aid = params->aid; |
656 | if (sta->aid > IEEE80211_MAX_AID) | 652 | if (sta->sta.aid > IEEE80211_MAX_AID) |
657 | sta->aid = 0; /* XXX: should this be an error? */ | 653 | sta->sta.aid = 0; /* XXX: should this be an error? */ |
658 | } | 654 | } |
659 | 655 | ||
660 | if (params->listen_interval >= 0) | 656 | if (params->listen_interval >= 0) |
@@ -671,12 +667,12 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
671 | rates |= BIT(j); | 667 | rates |= BIT(j); |
672 | } | 668 | } |
673 | } | 669 | } |
674 | sta->supp_rates[local->oper_channel->band] = rates; | 670 | sta->sta.supp_rates[local->oper_channel->band] = rates; |
675 | } | 671 | } |
676 | 672 | ||
677 | if (params->ht_capa) { | 673 | if (params->ht_capa) { |
678 | ieee80211_ht_cap_ie_to_ht_info(params->ht_capa, | 674 | ieee80211_ht_cap_ie_to_ht_info(params->ht_capa, |
679 | &sta->ht_info); | 675 | &sta->sta.ht_info); |
680 | } | 676 | } |
681 | 677 | ||
682 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { | 678 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { |
@@ -709,8 +705,8 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | |||
709 | if (params->vlan) { | 705 | if (params->vlan) { |
710 | sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); | 706 | sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); |
711 | 707 | ||
712 | if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN && | 708 | if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && |
713 | sdata->vif.type != IEEE80211_IF_TYPE_AP) | 709 | sdata->vif.type != NL80211_IFTYPE_AP) |
714 | return -EINVAL; | 710 | return -EINVAL; |
715 | } else | 711 | } else |
716 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 712 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
@@ -740,8 +736,8 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | |||
740 | return err; | 736 | return err; |
741 | } | 737 | } |
742 | 738 | ||
743 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN || | 739 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN || |
744 | sdata->vif.type == IEEE80211_IF_TYPE_AP) | 740 | sdata->vif.type == NL80211_IFTYPE_AP) |
745 | ieee80211_send_layer2_update(sta); | 741 | ieee80211_send_layer2_update(sta); |
746 | 742 | ||
747 | rcu_read_unlock(); | 743 | rcu_read_unlock(); |
@@ -805,8 +801,8 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
805 | if (params->vlan && params->vlan != sta->sdata->dev) { | 801 | if (params->vlan && params->vlan != sta->sdata->dev) { |
806 | vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); | 802 | vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); |
807 | 803 | ||
808 | if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN && | 804 | if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN && |
809 | vlansdata->vif.type != IEEE80211_IF_TYPE_AP) { | 805 | vlansdata->vif.type != NL80211_IFTYPE_AP) { |
810 | rcu_read_unlock(); | 806 | rcu_read_unlock(); |
811 | return -EINVAL; | 807 | return -EINVAL; |
812 | } | 808 | } |
@@ -840,7 +836,7 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
840 | 836 | ||
841 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 837 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
842 | 838 | ||
843 | if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) | 839 | if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) |
844 | return -ENOTSUPP; | 840 | return -ENOTSUPP; |
845 | 841 | ||
846 | rcu_read_lock(); | 842 | rcu_read_lock(); |
@@ -896,7 +892,7 @@ static int ieee80211_change_mpath(struct wiphy *wiphy, | |||
896 | 892 | ||
897 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 893 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
898 | 894 | ||
899 | if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) | 895 | if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) |
900 | return -ENOTSUPP; | 896 | return -ENOTSUPP; |
901 | 897 | ||
902 | rcu_read_lock(); | 898 | rcu_read_lock(); |
@@ -923,7 +919,7 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop, | |||
923 | struct mpath_info *pinfo) | 919 | struct mpath_info *pinfo) |
924 | { | 920 | { |
925 | if (mpath->next_hop) | 921 | if (mpath->next_hop) |
926 | memcpy(next_hop, mpath->next_hop->addr, ETH_ALEN); | 922 | memcpy(next_hop, mpath->next_hop->sta.addr, ETH_ALEN); |
927 | else | 923 | else |
928 | memset(next_hop, 0, ETH_ALEN); | 924 | memset(next_hop, 0, ETH_ALEN); |
929 | 925 | ||
@@ -971,7 +967,7 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
971 | 967 | ||
972 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 968 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
973 | 969 | ||
974 | if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) | 970 | if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) |
975 | return -ENOTSUPP; | 971 | return -ENOTSUPP; |
976 | 972 | ||
977 | rcu_read_lock(); | 973 | rcu_read_lock(); |
@@ -999,7 +995,7 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
999 | 995 | ||
1000 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 996 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1001 | 997 | ||
1002 | if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) | 998 | if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) |
1003 | return -ENOTSUPP; | 999 | return -ENOTSUPP; |
1004 | 1000 | ||
1005 | rcu_read_lock(); | 1001 | rcu_read_lock(); |
@@ -1028,7 +1024,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
1028 | 1024 | ||
1029 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1025 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1030 | 1026 | ||
1031 | if (sdata->vif.type != IEEE80211_IF_TYPE_AP) | 1027 | if (sdata->vif.type != NL80211_IFTYPE_AP) |
1032 | return -EINVAL; | 1028 | return -EINVAL; |
1033 | 1029 | ||
1034 | if (params->use_cts_prot >= 0) { | 1030 | if (params->use_cts_prot >= 0) { |
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index ee509f1109e2..24ce54463310 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -51,8 +51,6 @@ DEBUGFS_READONLY_FILE(antenna_sel_tx, 20, "%d", | |||
51 | local->hw.conf.antenna_sel_tx); | 51 | local->hw.conf.antenna_sel_tx); |
52 | DEBUGFS_READONLY_FILE(antenna_sel_rx, 20, "%d", | 52 | DEBUGFS_READONLY_FILE(antenna_sel_rx, 20, "%d", |
53 | local->hw.conf.antenna_sel_rx); | 53 | local->hw.conf.antenna_sel_rx); |
54 | DEBUGFS_READONLY_FILE(bridge_packets, 20, "%d", | ||
55 | local->bridge_packets); | ||
56 | DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d", | 54 | DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d", |
57 | local->rts_threshold); | 55 | local->rts_threshold); |
58 | DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d", | 56 | DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d", |
@@ -206,7 +204,6 @@ void debugfs_hw_add(struct ieee80211_local *local) | |||
206 | DEBUGFS_ADD(frequency); | 204 | DEBUGFS_ADD(frequency); |
207 | DEBUGFS_ADD(antenna_sel_tx); | 205 | DEBUGFS_ADD(antenna_sel_tx); |
208 | DEBUGFS_ADD(antenna_sel_rx); | 206 | DEBUGFS_ADD(antenna_sel_rx); |
209 | DEBUGFS_ADD(bridge_packets); | ||
210 | DEBUGFS_ADD(rts_threshold); | 207 | DEBUGFS_ADD(rts_threshold); |
211 | DEBUGFS_ADD(fragmentation_threshold); | 208 | DEBUGFS_ADD(fragmentation_threshold); |
212 | DEBUGFS_ADD(short_retry_limit); | 209 | DEBUGFS_ADD(short_retry_limit); |
@@ -263,7 +260,6 @@ void debugfs_hw_del(struct ieee80211_local *local) | |||
263 | DEBUGFS_DEL(frequency); | 260 | DEBUGFS_DEL(frequency); |
264 | DEBUGFS_DEL(antenna_sel_tx); | 261 | DEBUGFS_DEL(antenna_sel_tx); |
265 | DEBUGFS_DEL(antenna_sel_rx); | 262 | DEBUGFS_DEL(antenna_sel_rx); |
266 | DEBUGFS_DEL(bridge_packets); | ||
267 | DEBUGFS_DEL(rts_threshold); | 263 | DEBUGFS_DEL(rts_threshold); |
268 | DEBUGFS_DEL(fragmentation_threshold); | 264 | DEBUGFS_DEL(fragmentation_threshold); |
269 | DEBUGFS_DEL(short_retry_limit); | 265 | DEBUGFS_DEL(short_retry_limit); |
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index cf82acec913a..a3294d109322 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -206,7 +206,8 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key) | |||
206 | rcu_read_lock(); | 206 | rcu_read_lock(); |
207 | sta = rcu_dereference(key->sta); | 207 | sta = rcu_dereference(key->sta); |
208 | if (sta) | 208 | if (sta) |
209 | sprintf(buf, "../../stations/%s", print_mac(mac, sta->addr)); | 209 | sprintf(buf, "../../stations/%s", |
210 | print_mac(mac, sta->sta.addr)); | ||
210 | rcu_read_unlock(); | 211 | rcu_read_unlock(); |
211 | 212 | ||
212 | /* using sta as a boolean is fine outside RCU lock */ | 213 | /* using sta as a boolean is fine outside RCU lock */ |
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 8165df578c92..2a4515623776 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -173,7 +173,6 @@ IEEE80211_IF_FILE(assoc_tries, u.sta.assoc_tries, DEC); | |||
173 | IEEE80211_IF_FILE(auth_algs, u.sta.auth_algs, HEX); | 173 | IEEE80211_IF_FILE(auth_algs, u.sta.auth_algs, HEX); |
174 | IEEE80211_IF_FILE(auth_alg, u.sta.auth_alg, DEC); | 174 | IEEE80211_IF_FILE(auth_alg, u.sta.auth_alg, DEC); |
175 | IEEE80211_IF_FILE(auth_transaction, u.sta.auth_transaction, DEC); | 175 | IEEE80211_IF_FILE(auth_transaction, u.sta.auth_transaction, DEC); |
176 | IEEE80211_IF_FILE(num_beacons_sta, u.sta.num_beacons, DEC); | ||
177 | 176 | ||
178 | static ssize_t ieee80211_if_fmt_flags( | 177 | static ssize_t ieee80211_if_fmt_flags( |
179 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) | 178 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) |
@@ -192,7 +191,6 @@ __IEEE80211_IF_FILE(flags); | |||
192 | /* AP attributes */ | 191 | /* AP attributes */ |
193 | IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC); | 192 | IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC); |
194 | IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC); | 193 | IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC); |
195 | IEEE80211_IF_FILE(num_beacons, u.ap.num_beacons, DEC); | ||
196 | 194 | ||
197 | static ssize_t ieee80211_if_fmt_num_buffered_multicast( | 195 | static ssize_t ieee80211_if_fmt_num_buffered_multicast( |
198 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) | 196 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) |
@@ -207,37 +205,37 @@ IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); | |||
207 | 205 | ||
208 | #ifdef CONFIG_MAC80211_MESH | 206 | #ifdef CONFIG_MAC80211_MESH |
209 | /* Mesh stats attributes */ | 207 | /* Mesh stats attributes */ |
210 | IEEE80211_IF_FILE(fwded_frames, u.sta.mshstats.fwded_frames, DEC); | 208 | IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC); |
211 | IEEE80211_IF_FILE(dropped_frames_ttl, u.sta.mshstats.dropped_frames_ttl, DEC); | 209 | IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC); |
212 | IEEE80211_IF_FILE(dropped_frames_no_route, | 210 | IEEE80211_IF_FILE(dropped_frames_no_route, |
213 | u.sta.mshstats.dropped_frames_no_route, DEC); | 211 | u.mesh.mshstats.dropped_frames_no_route, DEC); |
214 | IEEE80211_IF_FILE(estab_plinks, u.sta.mshstats.estab_plinks, ATOMIC); | 212 | IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); |
215 | 213 | ||
216 | /* Mesh parameters */ | 214 | /* Mesh parameters */ |
217 | IEEE80211_IF_WFILE(dot11MeshMaxRetries, | 215 | IEEE80211_IF_WFILE(dot11MeshMaxRetries, |
218 | u.sta.mshcfg.dot11MeshMaxRetries, DEC, u8); | 216 | u.mesh.mshcfg.dot11MeshMaxRetries, DEC, u8); |
219 | IEEE80211_IF_WFILE(dot11MeshRetryTimeout, | 217 | IEEE80211_IF_WFILE(dot11MeshRetryTimeout, |
220 | u.sta.mshcfg.dot11MeshRetryTimeout, DEC, u16); | 218 | u.mesh.mshcfg.dot11MeshRetryTimeout, DEC, u16); |
221 | IEEE80211_IF_WFILE(dot11MeshConfirmTimeout, | 219 | IEEE80211_IF_WFILE(dot11MeshConfirmTimeout, |
222 | u.sta.mshcfg.dot11MeshConfirmTimeout, DEC, u16); | 220 | u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC, u16); |
223 | IEEE80211_IF_WFILE(dot11MeshHoldingTimeout, | 221 | IEEE80211_IF_WFILE(dot11MeshHoldingTimeout, |
224 | u.sta.mshcfg.dot11MeshHoldingTimeout, DEC, u16); | 222 | u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC, u16); |
225 | IEEE80211_IF_WFILE(dot11MeshTTL, u.sta.mshcfg.dot11MeshTTL, DEC, u8); | 223 | IEEE80211_IF_WFILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC, u8); |
226 | IEEE80211_IF_WFILE(auto_open_plinks, u.sta.mshcfg.auto_open_plinks, DEC, u8); | 224 | IEEE80211_IF_WFILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC, u8); |
227 | IEEE80211_IF_WFILE(dot11MeshMaxPeerLinks, | 225 | IEEE80211_IF_WFILE(dot11MeshMaxPeerLinks, |
228 | u.sta.mshcfg.dot11MeshMaxPeerLinks, DEC, u16); | 226 | u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC, u16); |
229 | IEEE80211_IF_WFILE(dot11MeshHWMPactivePathTimeout, | 227 | IEEE80211_IF_WFILE(dot11MeshHWMPactivePathTimeout, |
230 | u.sta.mshcfg.dot11MeshHWMPactivePathTimeout, DEC, u32); | 228 | u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC, u32); |
231 | IEEE80211_IF_WFILE(dot11MeshHWMPpreqMinInterval, | 229 | IEEE80211_IF_WFILE(dot11MeshHWMPpreqMinInterval, |
232 | u.sta.mshcfg.dot11MeshHWMPpreqMinInterval, DEC, u16); | 230 | u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC, u16); |
233 | IEEE80211_IF_WFILE(dot11MeshHWMPnetDiameterTraversalTime, | 231 | IEEE80211_IF_WFILE(dot11MeshHWMPnetDiameterTraversalTime, |
234 | u.sta.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC, u16); | 232 | u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC, u16); |
235 | IEEE80211_IF_WFILE(dot11MeshHWMPmaxPREQretries, | 233 | IEEE80211_IF_WFILE(dot11MeshHWMPmaxPREQretries, |
236 | u.sta.mshcfg.dot11MeshHWMPmaxPREQretries, DEC, u8); | 234 | u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC, u8); |
237 | IEEE80211_IF_WFILE(path_refresh_time, | 235 | IEEE80211_IF_WFILE(path_refresh_time, |
238 | u.sta.mshcfg.path_refresh_time, DEC, u32); | 236 | u.mesh.mshcfg.path_refresh_time, DEC, u32); |
239 | IEEE80211_IF_WFILE(min_discovery_timeout, | 237 | IEEE80211_IF_WFILE(min_discovery_timeout, |
240 | u.sta.mshcfg.min_discovery_timeout, DEC, u16); | 238 | u.mesh.mshcfg.min_discovery_timeout, DEC, u16); |
241 | #endif | 239 | #endif |
242 | 240 | ||
243 | 241 | ||
@@ -265,7 +263,6 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata) | |||
265 | DEBUGFS_ADD(auth_alg, sta); | 263 | DEBUGFS_ADD(auth_alg, sta); |
266 | DEBUGFS_ADD(auth_transaction, sta); | 264 | DEBUGFS_ADD(auth_transaction, sta); |
267 | DEBUGFS_ADD(flags, sta); | 265 | DEBUGFS_ADD(flags, sta); |
268 | DEBUGFS_ADD(num_beacons_sta, sta); | ||
269 | } | 266 | } |
270 | 267 | ||
271 | static void add_ap_files(struct ieee80211_sub_if_data *sdata) | 268 | static void add_ap_files(struct ieee80211_sub_if_data *sdata) |
@@ -276,7 +273,6 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata) | |||
276 | 273 | ||
277 | DEBUGFS_ADD(num_sta_ps, ap); | 274 | DEBUGFS_ADD(num_sta_ps, ap); |
278 | DEBUGFS_ADD(dtim_count, ap); | 275 | DEBUGFS_ADD(dtim_count, ap); |
279 | DEBUGFS_ADD(num_beacons, ap); | ||
280 | DEBUGFS_ADD(num_buffered_multicast, ap); | 276 | DEBUGFS_ADD(num_buffered_multicast, ap); |
281 | } | 277 | } |
282 | 278 | ||
@@ -345,26 +341,26 @@ static void add_files(struct ieee80211_sub_if_data *sdata) | |||
345 | return; | 341 | return; |
346 | 342 | ||
347 | switch (sdata->vif.type) { | 343 | switch (sdata->vif.type) { |
348 | case IEEE80211_IF_TYPE_MESH_POINT: | 344 | case NL80211_IFTYPE_MESH_POINT: |
349 | #ifdef CONFIG_MAC80211_MESH | 345 | #ifdef CONFIG_MAC80211_MESH |
350 | add_mesh_stats(sdata); | 346 | add_mesh_stats(sdata); |
351 | add_mesh_config(sdata); | 347 | add_mesh_config(sdata); |
352 | #endif | 348 | #endif |
353 | /* fall through */ | 349 | break; |
354 | case IEEE80211_IF_TYPE_STA: | 350 | case NL80211_IFTYPE_STATION: |
355 | case IEEE80211_IF_TYPE_IBSS: | 351 | case NL80211_IFTYPE_ADHOC: |
356 | add_sta_files(sdata); | 352 | add_sta_files(sdata); |
357 | break; | 353 | break; |
358 | case IEEE80211_IF_TYPE_AP: | 354 | case NL80211_IFTYPE_AP: |
359 | add_ap_files(sdata); | 355 | add_ap_files(sdata); |
360 | break; | 356 | break; |
361 | case IEEE80211_IF_TYPE_WDS: | 357 | case NL80211_IFTYPE_WDS: |
362 | add_wds_files(sdata); | 358 | add_wds_files(sdata); |
363 | break; | 359 | break; |
364 | case IEEE80211_IF_TYPE_MNTR: | 360 | case NL80211_IFTYPE_MONITOR: |
365 | add_monitor_files(sdata); | 361 | add_monitor_files(sdata); |
366 | break; | 362 | break; |
367 | case IEEE80211_IF_TYPE_VLAN: | 363 | case NL80211_IFTYPE_AP_VLAN: |
368 | add_vlan_files(sdata); | 364 | add_vlan_files(sdata); |
369 | break; | 365 | break; |
370 | default: | 366 | default: |
@@ -398,7 +394,6 @@ static void del_sta_files(struct ieee80211_sub_if_data *sdata) | |||
398 | DEBUGFS_DEL(auth_alg, sta); | 394 | DEBUGFS_DEL(auth_alg, sta); |
399 | DEBUGFS_DEL(auth_transaction, sta); | 395 | DEBUGFS_DEL(auth_transaction, sta); |
400 | DEBUGFS_DEL(flags, sta); | 396 | DEBUGFS_DEL(flags, sta); |
401 | DEBUGFS_DEL(num_beacons_sta, sta); | ||
402 | } | 397 | } |
403 | 398 | ||
404 | static void del_ap_files(struct ieee80211_sub_if_data *sdata) | 399 | static void del_ap_files(struct ieee80211_sub_if_data *sdata) |
@@ -409,7 +404,6 @@ static void del_ap_files(struct ieee80211_sub_if_data *sdata) | |||
409 | 404 | ||
410 | DEBUGFS_DEL(num_sta_ps, ap); | 405 | DEBUGFS_DEL(num_sta_ps, ap); |
411 | DEBUGFS_DEL(dtim_count, ap); | 406 | DEBUGFS_DEL(dtim_count, ap); |
412 | DEBUGFS_DEL(num_beacons, ap); | ||
413 | DEBUGFS_DEL(num_buffered_multicast, ap); | 407 | DEBUGFS_DEL(num_buffered_multicast, ap); |
414 | } | 408 | } |
415 | 409 | ||
@@ -482,26 +476,26 @@ static void del_files(struct ieee80211_sub_if_data *sdata) | |||
482 | return; | 476 | return; |
483 | 477 | ||
484 | switch (sdata->vif.type) { | 478 | switch (sdata->vif.type) { |
485 | case IEEE80211_IF_TYPE_MESH_POINT: | 479 | case NL80211_IFTYPE_MESH_POINT: |
486 | #ifdef CONFIG_MAC80211_MESH | 480 | #ifdef CONFIG_MAC80211_MESH |
487 | del_mesh_stats(sdata); | 481 | del_mesh_stats(sdata); |
488 | del_mesh_config(sdata); | 482 | del_mesh_config(sdata); |
489 | #endif | 483 | #endif |
490 | /* fall through */ | 484 | break; |
491 | case IEEE80211_IF_TYPE_STA: | 485 | case NL80211_IFTYPE_STATION: |
492 | case IEEE80211_IF_TYPE_IBSS: | 486 | case NL80211_IFTYPE_ADHOC: |
493 | del_sta_files(sdata); | 487 | del_sta_files(sdata); |
494 | break; | 488 | break; |
495 | case IEEE80211_IF_TYPE_AP: | 489 | case NL80211_IFTYPE_AP: |
496 | del_ap_files(sdata); | 490 | del_ap_files(sdata); |
497 | break; | 491 | break; |
498 | case IEEE80211_IF_TYPE_WDS: | 492 | case NL80211_IFTYPE_WDS: |
499 | del_wds_files(sdata); | 493 | del_wds_files(sdata); |
500 | break; | 494 | break; |
501 | case IEEE80211_IF_TYPE_MNTR: | 495 | case NL80211_IFTYPE_MONITOR: |
502 | del_monitor_files(sdata); | 496 | del_monitor_files(sdata); |
503 | break; | 497 | break; |
504 | case IEEE80211_IF_TYPE_VLAN: | 498 | case NL80211_IFTYPE_AP_VLAN: |
505 | del_vlan_files(sdata); | 499 | del_vlan_files(sdata); |
506 | break; | 500 | break; |
507 | default: | 501 | default: |
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 6abe5427752b..81f350eaf8a3 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -50,7 +50,7 @@ static const struct file_operations sta_ ##name## _ops = { \ | |||
50 | STA_READ_##format(name, field) \ | 50 | STA_READ_##format(name, field) \ |
51 | STA_OPS(name) | 51 | STA_OPS(name) |
52 | 52 | ||
53 | STA_FILE(aid, aid, D); | 53 | STA_FILE(aid, sta.aid, D); |
54 | STA_FILE(dev, sdata->dev->name, S); | 54 | STA_FILE(dev, sdata->dev->name, S); |
55 | STA_FILE(rx_packets, rx_packets, LU); | 55 | STA_FILE(rx_packets, rx_packets, LU); |
56 | STA_FILE(tx_packets, tx_packets, LU); | 56 | STA_FILE(tx_packets, tx_packets, LU); |
@@ -176,7 +176,7 @@ static ssize_t sta_agg_status_write(struct file *file, | |||
176 | struct net_device *dev = sta->sdata->dev; | 176 | struct net_device *dev = sta->sdata->dev; |
177 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 177 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
178 | struct ieee80211_hw *hw = &local->hw; | 178 | struct ieee80211_hw *hw = &local->hw; |
179 | u8 *da = sta->addr; | 179 | u8 *da = sta->sta.addr; |
180 | static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0, | 180 | static int tid_static_tx[16] = {0, 0, 0, 0, 0, 0, 0, 0, |
181 | 0, 0, 0, 0, 0, 0, 0, 0}; | 181 | 0, 0, 0, 0, 0, 0, 0, 0}; |
182 | static int tid_static_rx[16] = {1, 1, 1, 1, 1, 1, 1, 1, | 182 | static int tid_static_rx[16] = {1, 1, 1, 1, 1, 1, 1, 1, |
@@ -253,7 +253,7 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta) | |||
253 | if (!stations_dir) | 253 | if (!stations_dir) |
254 | return; | 254 | return; |
255 | 255 | ||
256 | mac = print_mac(mbuf, sta->addr); | 256 | mac = print_mac(mbuf, sta->sta.addr); |
257 | 257 | ||
258 | sta->debugfs.dir = debugfs_create_dir(mac, stations_dir); | 258 | sta->debugfs.dir = debugfs_create_dir(mac, stations_dir); |
259 | if (!sta->debugfs.dir) | 259 | if (!sta->debugfs.dir) |
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 4dc35c9dabc7..dc7d9a3d70d5 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -89,7 +89,7 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, | |||
89 | memset(mgmt, 0, 24); | 89 | memset(mgmt, 0, 24); |
90 | memcpy(mgmt->da, da, ETH_ALEN); | 90 | memcpy(mgmt->da, da, ETH_ALEN); |
91 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 91 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
92 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 92 | if (sdata->vif.type == NL80211_IFTYPE_AP) |
93 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 93 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
94 | else | 94 | else |
95 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 95 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
@@ -139,7 +139,7 @@ static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *d | |||
139 | memset(mgmt, 0, 24); | 139 | memset(mgmt, 0, 24); |
140 | memcpy(mgmt->da, da, ETH_ALEN); | 140 | memcpy(mgmt->da, da, ETH_ALEN); |
141 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 141 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
142 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 142 | if (sdata->vif.type == NL80211_IFTYPE_AP) |
143 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 143 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
144 | else | 144 | else |
145 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 145 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
@@ -185,7 +185,7 @@ static void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, | |||
185 | memset(mgmt, 0, 24); | 185 | memset(mgmt, 0, 24); |
186 | memcpy(mgmt->da, da, ETH_ALEN); | 186 | memcpy(mgmt->da, da, ETH_ALEN); |
187 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 187 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
188 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 188 | if (sdata->vif.type == NL80211_IFTYPE_AP) |
189 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 189 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
190 | else | 190 | else |
191 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 191 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
@@ -274,7 +274,7 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r | |||
274 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 274 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
275 | 275 | ||
276 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP, | 276 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP, |
277 | ra, tid, NULL); | 277 | &sta->sta, tid, NULL); |
278 | if (ret) | 278 | if (ret) |
279 | printk(KERN_DEBUG "HW problem - can not stop rx " | 279 | printk(KERN_DEBUG "HW problem - can not stop rx " |
280 | "aggregation for tid %d\n", tid); | 280 | "aggregation for tid %d\n", tid); |
@@ -328,7 +328,7 @@ static void sta_addba_resp_timer_expired(unsigned long data) | |||
328 | 328 | ||
329 | rcu_read_lock(); | 329 | rcu_read_lock(); |
330 | 330 | ||
331 | sta = sta_info_get(local, temp_sta->addr); | 331 | sta = sta_info_get(local, temp_sta->sta.addr); |
332 | if (!sta) { | 332 | if (!sta) { |
333 | rcu_read_unlock(); | 333 | rcu_read_unlock(); |
334 | return; | 334 | return; |
@@ -354,7 +354,7 @@ static void sta_addba_resp_timer_expired(unsigned long data) | |||
354 | /* go through the state check in stop_BA_session */ | 354 | /* go through the state check in stop_BA_session */ |
355 | *state = HT_AGG_STATE_OPERATIONAL; | 355 | *state = HT_AGG_STATE_OPERATIONAL; |
356 | spin_unlock_bh(&sta->lock); | 356 | spin_unlock_bh(&sta->lock); |
357 | ieee80211_stop_tx_ba_session(hw, temp_sta->addr, tid, | 357 | ieee80211_stop_tx_ba_session(hw, temp_sta->sta.addr, tid, |
358 | WLAN_BACK_INITIATOR); | 358 | WLAN_BACK_INITIATOR); |
359 | 359 | ||
360 | timer_expired_exit: | 360 | timer_expired_exit: |
@@ -465,7 +465,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
465 | 465 | ||
466 | if (local->ops->ampdu_action) | 466 | if (local->ops->ampdu_action) |
467 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_START, | 467 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_START, |
468 | ra, tid, &start_seq_num); | 468 | &sta->sta, tid, &start_seq_num); |
469 | 469 | ||
470 | if (ret) { | 470 | if (ret) { |
471 | /* No need to requeue the packets in the agg queue, since we | 471 | /* No need to requeue the packets in the agg queue, since we |
@@ -557,7 +557,7 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | |||
557 | 557 | ||
558 | if (local->ops->ampdu_action) | 558 | if (local->ops->ampdu_action) |
559 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_STOP, | 559 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_STOP, |
560 | ra, tid, NULL); | 560 | &sta->sta, tid, NULL); |
561 | 561 | ||
562 | /* case HW denied going back to legacy */ | 562 | /* case HW denied going back to legacy */ |
563 | if (ret) { | 563 | if (ret) { |
@@ -767,7 +767,7 @@ static void sta_rx_agg_session_timer_expired(unsigned long data) | |||
767 | #ifdef CONFIG_MAC80211_HT_DEBUG | 767 | #ifdef CONFIG_MAC80211_HT_DEBUG |
768 | printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); | 768 | printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); |
769 | #endif | 769 | #endif |
770 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->addr, | 770 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->sta.addr, |
771 | (u16)*ptid, WLAN_BACK_TIMER, | 771 | (u16)*ptid, WLAN_BACK_TIMER, |
772 | WLAN_REASON_QSTA_TIMEOUT); | 772 | WLAN_REASON_QSTA_TIMEOUT); |
773 | } | 773 | } |
@@ -874,7 +874,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
874 | 874 | ||
875 | if (local->ops->ampdu_action) | 875 | if (local->ops->ampdu_action) |
876 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START, | 876 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START, |
877 | sta->addr, tid, &start_seq_num); | 877 | &sta->sta, tid, &start_seq_num); |
878 | #ifdef CONFIG_MAC80211_HT_DEBUG | 878 | #ifdef CONFIG_MAC80211_HT_DEBUG |
879 | printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret); | 879 | printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret); |
880 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 880 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
@@ -899,7 +899,7 @@ end: | |||
899 | spin_unlock_bh(&sta->lock); | 899 | spin_unlock_bh(&sta->lock); |
900 | 900 | ||
901 | end_no_lock: | 901 | end_no_lock: |
902 | ieee80211_send_addba_resp(sta->sdata, sta->addr, tid, | 902 | ieee80211_send_addba_resp(sta->sdata, sta->sta.addr, tid, |
903 | dialog_token, status, 1, buf_size, timeout); | 903 | dialog_token, status, 1, buf_size, timeout); |
904 | } | 904 | } |
905 | 905 | ||
@@ -952,7 +952,7 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
952 | /* this will allow the state check in stop_BA_session */ | 952 | /* this will allow the state check in stop_BA_session */ |
953 | *state = HT_AGG_STATE_OPERATIONAL; | 953 | *state = HT_AGG_STATE_OPERATIONAL; |
954 | spin_unlock_bh(&sta->lock); | 954 | spin_unlock_bh(&sta->lock); |
955 | ieee80211_stop_tx_ba_session(hw, sta->addr, tid, | 955 | ieee80211_stop_tx_ba_session(hw, sta->sta.addr, tid, |
956 | WLAN_BACK_INITIATOR); | 956 | WLAN_BACK_INITIATOR); |
957 | } | 957 | } |
958 | } | 958 | } |
@@ -979,14 +979,14 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, | |||
979 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 979 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
980 | 980 | ||
981 | if (initiator == WLAN_BACK_INITIATOR) | 981 | if (initiator == WLAN_BACK_INITIATOR) |
982 | ieee80211_sta_stop_rx_ba_session(sdata, sta->addr, tid, | 982 | ieee80211_sta_stop_rx_ba_session(sdata, sta->sta.addr, tid, |
983 | WLAN_BACK_INITIATOR, 0); | 983 | WLAN_BACK_INITIATOR, 0); |
984 | else { /* WLAN_BACK_RECIPIENT */ | 984 | else { /* WLAN_BACK_RECIPIENT */ |
985 | spin_lock_bh(&sta->lock); | 985 | spin_lock_bh(&sta->lock); |
986 | sta->ampdu_mlme.tid_state_tx[tid] = | 986 | sta->ampdu_mlme.tid_state_tx[tid] = |
987 | HT_AGG_STATE_OPERATIONAL; | 987 | HT_AGG_STATE_OPERATIONAL; |
988 | spin_unlock_bh(&sta->lock); | 988 | spin_unlock_bh(&sta->lock); |
989 | ieee80211_stop_tx_ba_session(&local->hw, sta->addr, tid, | 989 | ieee80211_stop_tx_ba_session(&local->hw, sta->sta.addr, tid, |
990 | WLAN_BACK_RECIPIENT); | 990 | WLAN_BACK_RECIPIENT); |
991 | } | 991 | } |
992 | } | 992 | } |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 6f334e4c3d66..3912fba6d3d0 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -29,9 +29,6 @@ | |||
29 | #include "key.h" | 29 | #include "key.h" |
30 | #include "sta_info.h" | 30 | #include "sta_info.h" |
31 | 31 | ||
32 | /* ieee80211.o internal definitions, etc. These are not included into | ||
33 | * low-level drivers. */ | ||
34 | |||
35 | struct ieee80211_local; | 32 | struct ieee80211_local; |
36 | 33 | ||
37 | /* Maximum number of broadcast/multicast frames to buffer when some of the | 34 | /* Maximum number of broadcast/multicast frames to buffer when some of the |
@@ -71,9 +68,9 @@ struct ieee80211_fragment_entry { | |||
71 | }; | 68 | }; |
72 | 69 | ||
73 | 70 | ||
74 | struct ieee80211_sta_bss { | 71 | struct ieee80211_bss { |
75 | struct list_head list; | 72 | struct list_head list; |
76 | struct ieee80211_sta_bss *hnext; | 73 | struct ieee80211_bss *hnext; |
77 | size_t ssid_len; | 74 | size_t ssid_len; |
78 | 75 | ||
79 | atomic_t users; | 76 | atomic_t users; |
@@ -112,7 +109,7 @@ struct ieee80211_sta_bss { | |||
112 | u8 erp_value; | 109 | u8 erp_value; |
113 | }; | 110 | }; |
114 | 111 | ||
115 | static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss) | 112 | static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss) |
116 | { | 113 | { |
117 | #ifdef CONFIG_MAC80211_MESH | 114 | #ifdef CONFIG_MAC80211_MESH |
118 | return bss->mesh_cfg; | 115 | return bss->mesh_cfg; |
@@ -120,7 +117,7 @@ static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss) | |||
120 | return NULL; | 117 | return NULL; |
121 | } | 118 | } |
122 | 119 | ||
123 | static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss) | 120 | static inline u8 *bss_mesh_id(struct ieee80211_bss *bss) |
124 | { | 121 | { |
125 | #ifdef CONFIG_MAC80211_MESH | 122 | #ifdef CONFIG_MAC80211_MESH |
126 | return bss->mesh_id; | 123 | return bss->mesh_id; |
@@ -128,7 +125,7 @@ static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss) | |||
128 | return NULL; | 125 | return NULL; |
129 | } | 126 | } |
130 | 127 | ||
131 | static inline u8 bss_mesh_id_len(struct ieee80211_sta_bss *bss) | 128 | static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss) |
132 | { | 129 | { |
133 | #ifdef CONFIG_MAC80211_MESH | 130 | #ifdef CONFIG_MAC80211_MESH |
134 | return bss->mesh_id_len; | 131 | return bss->mesh_id_len; |
@@ -232,7 +229,6 @@ struct ieee80211_if_ap { | |||
232 | struct sk_buff_head ps_bc_buf; | 229 | struct sk_buff_head ps_bc_buf; |
233 | atomic_t num_sta_ps; /* number of stations in PS mode */ | 230 | atomic_t num_sta_ps; /* number of stations in PS mode */ |
234 | int dtim_count; | 231 | int dtim_count; |
235 | int num_beacons; /* number of TXed beacon frames for this BSS */ | ||
236 | }; | 232 | }; |
237 | 233 | ||
238 | struct ieee80211_if_wds { | 234 | struct ieee80211_if_wds { |
@@ -293,13 +289,13 @@ struct mesh_config { | |||
293 | #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) | 289 | #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) |
294 | #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) | 290 | #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) |
295 | #define IEEE80211_STA_PRIVACY_INVOKED BIT(13) | 291 | #define IEEE80211_STA_PRIVACY_INVOKED BIT(13) |
296 | /* flags for MLME request*/ | 292 | /* flags for MLME request */ |
297 | #define IEEE80211_STA_REQ_SCAN 0 | 293 | #define IEEE80211_STA_REQ_SCAN 0 |
298 | #define IEEE80211_STA_REQ_DIRECT_PROBE 1 | 294 | #define IEEE80211_STA_REQ_DIRECT_PROBE 1 |
299 | #define IEEE80211_STA_REQ_AUTH 2 | 295 | #define IEEE80211_STA_REQ_AUTH 2 |
300 | #define IEEE80211_STA_REQ_RUN 3 | 296 | #define IEEE80211_STA_REQ_RUN 3 |
301 | 297 | ||
302 | /* flags used for setting mlme state */ | 298 | /* STA/IBSS MLME states */ |
303 | enum ieee80211_sta_mlme_state { | 299 | enum ieee80211_sta_mlme_state { |
304 | IEEE80211_STA_MLME_DISABLED, | 300 | IEEE80211_STA_MLME_DISABLED, |
305 | IEEE80211_STA_MLME_DIRECT_PROBE, | 301 | IEEE80211_STA_MLME_DIRECT_PROBE, |
@@ -308,7 +304,6 @@ enum ieee80211_sta_mlme_state { | |||
308 | IEEE80211_STA_MLME_ASSOCIATED, | 304 | IEEE80211_STA_MLME_ASSOCIATED, |
309 | IEEE80211_STA_MLME_IBSS_SEARCH, | 305 | IEEE80211_STA_MLME_IBSS_SEARCH, |
310 | IEEE80211_STA_MLME_IBSS_JOINED, | 306 | IEEE80211_STA_MLME_IBSS_JOINED, |
311 | IEEE80211_STA_MLME_MESH_UP | ||
312 | }; | 307 | }; |
313 | 308 | ||
314 | /* bitfield of allowed auth algs */ | 309 | /* bitfield of allowed auth algs */ |
@@ -325,34 +320,6 @@ struct ieee80211_if_sta { | |||
325 | size_t ssid_len; | 320 | size_t ssid_len; |
326 | u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; | 321 | u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; |
327 | size_t scan_ssid_len; | 322 | size_t scan_ssid_len; |
328 | #ifdef CONFIG_MAC80211_MESH | ||
329 | struct timer_list mesh_path_timer; | ||
330 | u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; | ||
331 | size_t mesh_id_len; | ||
332 | /* Active Path Selection Protocol Identifier */ | ||
333 | u8 mesh_pp_id[4]; | ||
334 | /* Active Path Selection Metric Identifier */ | ||
335 | u8 mesh_pm_id[4]; | ||
336 | /* Congestion Control Mode Identifier */ | ||
337 | u8 mesh_cc_id[4]; | ||
338 | /* Local mesh Destination Sequence Number */ | ||
339 | u32 dsn; | ||
340 | /* Last used PREQ ID */ | ||
341 | u32 preq_id; | ||
342 | atomic_t mpaths; | ||
343 | /* Timestamp of last DSN update */ | ||
344 | unsigned long last_dsn_update; | ||
345 | /* Timestamp of last DSN sent */ | ||
346 | unsigned long last_preq; | ||
347 | struct mesh_rmc *rmc; | ||
348 | spinlock_t mesh_preq_queue_lock; | ||
349 | struct mesh_preq_queue preq_queue; | ||
350 | int preq_queue_len; | ||
351 | struct mesh_stats mshstats; | ||
352 | struct mesh_config mshcfg; | ||
353 | u32 mesh_seqnum; | ||
354 | bool accepting_plinks; | ||
355 | #endif | ||
356 | u16 aid; | 323 | u16 aid; |
357 | u16 ap_capab, capab; | 324 | u16 ap_capab, capab; |
358 | u8 *extra_ie; /* to be added to the end of AssocReq */ | 325 | u8 *extra_ie; /* to be added to the end of AssocReq */ |
@@ -384,31 +351,70 @@ struct ieee80211_if_sta { | |||
384 | u32 supp_rates_bits[IEEE80211_NUM_BANDS]; | 351 | u32 supp_rates_bits[IEEE80211_NUM_BANDS]; |
385 | 352 | ||
386 | int wmm_last_param_set; | 353 | int wmm_last_param_set; |
387 | int num_beacons; /* number of TXed beacon frames by this STA */ | ||
388 | }; | 354 | }; |
389 | 355 | ||
390 | static inline void ieee80211_if_sta_set_mesh_id(struct ieee80211_if_sta *ifsta, | 356 | struct ieee80211_if_mesh { |
391 | u8 mesh_id_len, u8 *mesh_id) | 357 | struct work_struct work; |
392 | { | 358 | struct timer_list housekeeping_timer; |
393 | #ifdef CONFIG_MAC80211_MESH | 359 | struct timer_list mesh_path_timer; |
394 | ifsta->mesh_id_len = mesh_id_len; | 360 | struct sk_buff_head skb_queue; |
395 | memcpy(ifsta->mesh_id, mesh_id, mesh_id_len); | 361 | |
396 | #endif | 362 | bool housekeeping; |
397 | } | 363 | |
364 | u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; | ||
365 | size_t mesh_id_len; | ||
366 | /* Active Path Selection Protocol Identifier */ | ||
367 | u8 mesh_pp_id[4]; | ||
368 | /* Active Path Selection Metric Identifier */ | ||
369 | u8 mesh_pm_id[4]; | ||
370 | /* Congestion Control Mode Identifier */ | ||
371 | u8 mesh_cc_id[4]; | ||
372 | /* Local mesh Destination Sequence Number */ | ||
373 | u32 dsn; | ||
374 | /* Last used PREQ ID */ | ||
375 | u32 preq_id; | ||
376 | atomic_t mpaths; | ||
377 | /* Timestamp of last DSN update */ | ||
378 | unsigned long last_dsn_update; | ||
379 | /* Timestamp of last DSN sent */ | ||
380 | unsigned long last_preq; | ||
381 | struct mesh_rmc *rmc; | ||
382 | spinlock_t mesh_preq_queue_lock; | ||
383 | struct mesh_preq_queue preq_queue; | ||
384 | int preq_queue_len; | ||
385 | struct mesh_stats mshstats; | ||
386 | struct mesh_config mshcfg; | ||
387 | u32 mesh_seqnum; | ||
388 | bool accepting_plinks; | ||
389 | }; | ||
398 | 390 | ||
399 | #ifdef CONFIG_MAC80211_MESH | 391 | #ifdef CONFIG_MAC80211_MESH |
400 | #define IEEE80211_IFSTA_MESH_CTR_INC(sta, name) \ | 392 | #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ |
401 | do { (sta)->mshstats.name++; } while (0) | 393 | do { (msh)->mshstats.name++; } while (0) |
402 | #else | 394 | #else |
403 | #define IEEE80211_IFSTA_MESH_CTR_INC(sta, name) \ | 395 | #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ |
404 | do { } while (0) | 396 | do { } while (0) |
405 | #endif | 397 | #endif |
406 | 398 | ||
407 | /* flags used in struct ieee80211_sub_if_data.flags */ | 399 | /** |
408 | #define IEEE80211_SDATA_ALLMULTI BIT(0) | 400 | * enum ieee80211_sub_if_data_flags - virtual interface flags |
409 | #define IEEE80211_SDATA_PROMISC BIT(1) | 401 | * |
410 | #define IEEE80211_SDATA_USERSPACE_MLME BIT(2) | 402 | * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets |
411 | #define IEEE80211_SDATA_OPERATING_GMODE BIT(3) | 403 | * @IEEE80211_SDATA_PROMISC: interface is promisc |
404 | * @IEEE80211_SDATA_USERSPACE_MLME: userspace MLME is active | ||
405 | * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode | ||
406 | * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between | ||
407 | * associated stations and deliver multicast frames both | ||
408 | * back to wireless media and to the local net stack. | ||
409 | */ | ||
410 | enum ieee80211_sub_if_data_flags { | ||
411 | IEEE80211_SDATA_ALLMULTI = BIT(0), | ||
412 | IEEE80211_SDATA_PROMISC = BIT(1), | ||
413 | IEEE80211_SDATA_USERSPACE_MLME = BIT(2), | ||
414 | IEEE80211_SDATA_OPERATING_GMODE = BIT(3), | ||
415 | IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(4), | ||
416 | }; | ||
417 | |||
412 | struct ieee80211_sub_if_data { | 418 | struct ieee80211_sub_if_data { |
413 | struct list_head list; | 419 | struct list_head list; |
414 | 420 | ||
@@ -424,11 +430,6 @@ struct ieee80211_sub_if_data { | |||
424 | 430 | ||
425 | int drop_unencrypted; | 431 | int drop_unencrypted; |
426 | 432 | ||
427 | /* | ||
428 | * basic rates of this AP or the AP we're associated to | ||
429 | */ | ||
430 | u64 basic_rates; | ||
431 | |||
432 | /* Fragment table for host-based reassembly */ | 433 | /* Fragment table for host-based reassembly */ |
433 | struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; | 434 | struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; |
434 | unsigned int fragment_next; | 435 | unsigned int fragment_next; |
@@ -455,6 +456,9 @@ struct ieee80211_sub_if_data { | |||
455 | struct ieee80211_if_wds wds; | 456 | struct ieee80211_if_wds wds; |
456 | struct ieee80211_if_vlan vlan; | 457 | struct ieee80211_if_vlan vlan; |
457 | struct ieee80211_if_sta sta; | 458 | struct ieee80211_if_sta sta; |
459 | #ifdef CONFIG_MAC80211_MESH | ||
460 | struct ieee80211_if_mesh mesh; | ||
461 | #endif | ||
458 | u32 mntr_flags; | 462 | u32 mntr_flags; |
459 | } u; | 463 | } u; |
460 | 464 | ||
@@ -477,7 +481,6 @@ struct ieee80211_sub_if_data { | |||
477 | struct dentry *auth_alg; | 481 | struct dentry *auth_alg; |
478 | struct dentry *auth_transaction; | 482 | struct dentry *auth_transaction; |
479 | struct dentry *flags; | 483 | struct dentry *flags; |
480 | struct dentry *num_beacons_sta; | ||
481 | struct dentry *force_unicast_rateidx; | 484 | struct dentry *force_unicast_rateidx; |
482 | struct dentry *max_ratectrl_rateidx; | 485 | struct dentry *max_ratectrl_rateidx; |
483 | } sta; | 486 | } sta; |
@@ -485,7 +488,6 @@ struct ieee80211_sub_if_data { | |||
485 | struct dentry *drop_unencrypted; | 488 | struct dentry *drop_unencrypted; |
486 | struct dentry *num_sta_ps; | 489 | struct dentry *num_sta_ps; |
487 | struct dentry *dtim_count; | 490 | struct dentry *dtim_count; |
488 | struct dentry *num_beacons; | ||
489 | struct dentry *force_unicast_rateidx; | 491 | struct dentry *force_unicast_rateidx; |
490 | struct dentry *max_ratectrl_rateidx; | 492 | struct dentry *max_ratectrl_rateidx; |
491 | struct dentry *num_buffered_multicast; | 493 | struct dentry *num_buffered_multicast; |
@@ -548,6 +550,19 @@ struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) | |||
548 | return container_of(p, struct ieee80211_sub_if_data, vif); | 550 | return container_of(p, struct ieee80211_sub_if_data, vif); |
549 | } | 551 | } |
550 | 552 | ||
553 | static inline void | ||
554 | ieee80211_sdata_set_mesh_id(struct ieee80211_sub_if_data *sdata, | ||
555 | u8 mesh_id_len, u8 *mesh_id) | ||
556 | { | ||
557 | #ifdef CONFIG_MAC80211_MESH | ||
558 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | ||
559 | ifmsh->mesh_id_len = mesh_id_len; | ||
560 | memcpy(ifmsh->mesh_id, mesh_id, mesh_id_len); | ||
561 | #else | ||
562 | WARN_ON(1); | ||
563 | #endif | ||
564 | } | ||
565 | |||
551 | enum { | 566 | enum { |
552 | IEEE80211_RX_MSG = 1, | 567 | IEEE80211_RX_MSG = 1, |
553 | IEEE80211_TX_STATUS_MSG = 2, | 568 | IEEE80211_TX_STATUS_MSG = 2, |
@@ -621,10 +636,6 @@ struct ieee80211_local { | |||
621 | struct crypto_blkcipher *wep_rx_tfm; | 636 | struct crypto_blkcipher *wep_rx_tfm; |
622 | u32 wep_iv; | 637 | u32 wep_iv; |
623 | 638 | ||
624 | int bridge_packets; /* bridge packets between associated stations and | ||
625 | * deliver multicast frames both back to wireless | ||
626 | * media and to the local net stack */ | ||
627 | |||
628 | struct list_head interfaces; | 639 | struct list_head interfaces; |
629 | 640 | ||
630 | /* | 641 | /* |
@@ -634,8 +645,8 @@ struct ieee80211_local { | |||
634 | spinlock_t key_lock; | 645 | spinlock_t key_lock; |
635 | 646 | ||
636 | 647 | ||
637 | bool sta_sw_scanning; | 648 | /* Scanning and BSS list */ |
638 | bool sta_hw_scanning; | 649 | bool sw_scanning, hw_scanning; |
639 | int scan_channel_idx; | 650 | int scan_channel_idx; |
640 | enum ieee80211_band scan_band; | 651 | enum ieee80211_band scan_band; |
641 | 652 | ||
@@ -646,9 +657,9 @@ struct ieee80211_local { | |||
646 | struct ieee80211_channel *oper_channel, *scan_channel; | 657 | struct ieee80211_channel *oper_channel, *scan_channel; |
647 | u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; | 658 | u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; |
648 | size_t scan_ssid_len; | 659 | size_t scan_ssid_len; |
649 | struct list_head sta_bss_list; | 660 | struct list_head bss_list; |
650 | struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE]; | 661 | struct ieee80211_bss *bss_hash[STA_HASH_SIZE]; |
651 | spinlock_t sta_bss_lock; | 662 | spinlock_t bss_lock; |
652 | 663 | ||
653 | /* SNMP counters */ | 664 | /* SNMP counters */ |
654 | /* dot11CountersTable */ | 665 | /* dot11CountersTable */ |
@@ -712,7 +723,6 @@ struct ieee80211_local { | |||
712 | struct dentry *frequency; | 723 | struct dentry *frequency; |
713 | struct dentry *antenna_sel_tx; | 724 | struct dentry *antenna_sel_tx; |
714 | struct dentry *antenna_sel_rx; | 725 | struct dentry *antenna_sel_rx; |
715 | struct dentry *bridge_packets; | ||
716 | struct dentry *rts_threshold; | 726 | struct dentry *rts_threshold; |
717 | struct dentry *fragmentation_threshold; | 727 | struct dentry *fragmentation_threshold; |
718 | struct dentry *short_retry_limit; | 728 | struct dentry *short_retry_limit; |
@@ -868,87 +878,81 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) | |||
868 | } | 878 | } |
869 | 879 | ||
870 | 880 | ||
871 | /* ieee80211.c */ | ||
872 | int ieee80211_hw_config(struct ieee80211_local *local); | 881 | int ieee80211_hw_config(struct ieee80211_local *local); |
873 | int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed); | 882 | int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed); |
874 | void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); | 883 | void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); |
875 | u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, | 884 | u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, |
876 | struct ieee80211_ht_info *req_ht_cap, | 885 | struct ieee80211_ht_info *req_ht_cap, |
877 | struct ieee80211_ht_bss_info *req_bss_cap); | 886 | struct ieee80211_ht_bss_info *req_bss_cap); |
887 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | ||
888 | u32 changed); | ||
889 | void ieee80211_configure_filter(struct ieee80211_local *local); | ||
878 | 890 | ||
879 | /* ieee80211_ioctl.c */ | 891 | /* wireless extensions */ |
880 | extern const struct iw_handler_def ieee80211_iw_handler_def; | 892 | extern const struct iw_handler_def ieee80211_iw_handler_def; |
881 | int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq); | ||
882 | 893 | ||
883 | /* ieee80211_sta.c */ | 894 | /* STA/IBSS code */ |
884 | void ieee80211_sta_timer(unsigned long data); | 895 | void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); |
885 | void ieee80211_sta_work(struct work_struct *work); | 896 | void ieee80211_scan_work(struct work_struct *work); |
886 | void ieee80211_sta_scan_work(struct work_struct *work); | ||
887 | void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | 897 | void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
888 | struct ieee80211_rx_status *rx_status); | 898 | struct ieee80211_rx_status *rx_status); |
889 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len); | 899 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len); |
890 | int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len); | 900 | int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len); |
891 | int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid); | 901 | int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid); |
892 | int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len); | ||
893 | void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, | 902 | void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, |
894 | struct ieee80211_if_sta *ifsta); | 903 | struct ieee80211_if_sta *ifsta); |
895 | int ieee80211_sta_scan_results(struct ieee80211_local *local, | ||
896 | struct iw_request_info *info, | ||
897 | char *buf, size_t len); | ||
898 | ieee80211_rx_result ieee80211_sta_rx_scan( | ||
899 | struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | ||
900 | struct ieee80211_rx_status *rx_status); | ||
901 | void ieee80211_rx_bss_list_init(struct ieee80211_local *local); | ||
902 | void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local); | ||
903 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len); | ||
904 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | 904 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, |
905 | struct sk_buff *skb, u8 *bssid, | 905 | struct sk_buff *skb, u8 *bssid, |
906 | u8 *addr, u64 supp_rates); | 906 | u8 *addr, u64 supp_rates); |
907 | int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason); | 907 | int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason); |
908 | int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason); | 908 | int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason); |
909 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | ||
910 | u32 changed); | ||
911 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); | 909 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); |
912 | u64 ieee80211_sta_get_rates(struct ieee80211_local *local, | 910 | u64 ieee80211_sta_get_rates(struct ieee80211_local *local, |
913 | struct ieee802_11_elems *elems, | 911 | struct ieee802_11_elems *elems, |
914 | enum ieee80211_band band); | 912 | enum ieee80211_band band); |
915 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | 913 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
916 | u8 *ssid, size_t ssid_len); | 914 | u8 *ssid, size_t ssid_len); |
917 | void ieee802_11_parse_elems(u8 *start, size_t len, | 915 | |
918 | struct ieee802_11_elems *elems); | 916 | /* scan/BSS handling */ |
917 | int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, | ||
918 | u8 *ssid, size_t ssid_len); | ||
919 | int ieee80211_scan_results(struct ieee80211_local *local, | ||
920 | struct iw_request_info *info, | ||
921 | char *buf, size_t len); | ||
922 | ieee80211_rx_result | ||
923 | ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, | ||
924 | struct sk_buff *skb, | ||
925 | struct ieee80211_rx_status *rx_status); | ||
926 | void ieee80211_rx_bss_list_init(struct ieee80211_local *local); | ||
927 | void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local); | ||
928 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, | ||
929 | char *ie, size_t len); | ||
930 | |||
919 | void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); | 931 | void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); |
920 | int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, | 932 | int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata, |
921 | u8 *ssid, size_t ssid_len); | 933 | u8 *ssid, size_t ssid_len); |
922 | struct ieee80211_sta_bss * | 934 | struct ieee80211_bss * |
923 | ieee80211_bss_info_update(struct ieee80211_local *local, | 935 | ieee80211_bss_info_update(struct ieee80211_local *local, |
924 | struct ieee80211_rx_status *rx_status, | 936 | struct ieee80211_rx_status *rx_status, |
925 | struct ieee80211_mgmt *mgmt, | 937 | struct ieee80211_mgmt *mgmt, |
926 | size_t len, | 938 | size_t len, |
927 | struct ieee802_11_elems *elems, | 939 | struct ieee802_11_elems *elems, |
928 | int freq, bool beacon); | 940 | int freq, bool beacon); |
929 | struct ieee80211_sta_bss * | 941 | struct ieee80211_bss * |
930 | ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq, | 942 | ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq, |
931 | u8 *ssid, u8 ssid_len); | 943 | u8 *ssid, u8 ssid_len); |
932 | struct ieee80211_sta_bss * | 944 | struct ieee80211_bss * |
933 | ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, | 945 | ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, |
934 | u8 *ssid, u8 ssid_len); | 946 | u8 *ssid, u8 ssid_len); |
935 | void ieee80211_rx_bss_put(struct ieee80211_local *local, | 947 | void ieee80211_rx_bss_put(struct ieee80211_local *local, |
936 | struct ieee80211_sta_bss *bss); | 948 | struct ieee80211_bss *bss); |
937 | |||
938 | #ifdef CONFIG_MAC80211_MESH | ||
939 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata); | ||
940 | #else | ||
941 | static inline void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) | ||
942 | {} | ||
943 | #endif | ||
944 | 949 | ||
945 | /* interface handling */ | 950 | /* interface handling */ |
946 | void ieee80211_if_setup(struct net_device *dev); | ||
947 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, | 951 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, |
948 | struct net_device **new_dev, enum ieee80211_if_types type, | 952 | struct net_device **new_dev, enum nl80211_iftype type, |
949 | struct vif_params *params); | 953 | struct vif_params *params); |
950 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | 954 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, |
951 | enum ieee80211_if_types type); | 955 | enum nl80211_iftype type); |
952 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); | 956 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); |
953 | void ieee80211_remove_interfaces(struct ieee80211_local *local); | 957 | void ieee80211_remove_interfaces(struct ieee80211_local *local); |
954 | 958 | ||
@@ -992,7 +996,7 @@ extern void *mac80211_wiphy_privid; /* for wiphy privid */ | |||
992 | extern const unsigned char rfc1042_header[6]; | 996 | extern const unsigned char rfc1042_header[6]; |
993 | extern const unsigned char bridge_tunnel_header[6]; | 997 | extern const unsigned char bridge_tunnel_header[6]; |
994 | u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, | 998 | u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, |
995 | enum ieee80211_if_types type); | 999 | enum nl80211_iftype type); |
996 | int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, | 1000 | int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, |
997 | int rate, int erp, int short_preamble); | 1001 | int rate, int erp, int short_preamble); |
998 | void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, | 1002 | void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, |
@@ -1000,6 +1004,11 @@ void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int ke | |||
1000 | void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata); | 1004 | void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata); |
1001 | void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | 1005 | void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
1002 | int encrypt); | 1006 | int encrypt); |
1007 | void ieee802_11_parse_elems(u8 *start, size_t len, | ||
1008 | struct ieee802_11_elems *elems); | ||
1009 | int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq); | ||
1010 | u64 ieee80211_mandatory_rates(struct ieee80211_local *local, | ||
1011 | enum ieee80211_band band); | ||
1003 | 1012 | ||
1004 | #ifdef CONFIG_MAC80211_NOINLINE | 1013 | #ifdef CONFIG_MAC80211_NOINLINE |
1005 | #define debug_noinline noinline | 1014 | #define debug_noinline noinline |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 672cec60a2fb..a72fbebb8ea2 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1,4 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Interface handling (except master interface) | ||
3 | * | ||
2 | * Copyright 2002-2005, Instant802 Networks, Inc. | 4 | * Copyright 2002-2005, Instant802 Networks, Inc. |
3 | * Copyright 2005-2006, Devicescape Software, Inc. | 5 | * Copyright 2005-2006, Devicescape Software, Inc. |
4 | * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> | 6 | * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> |
@@ -17,7 +19,540 @@ | |||
17 | #include "sta_info.h" | 19 | #include "sta_info.h" |
18 | #include "debugfs_netdev.h" | 20 | #include "debugfs_netdev.h" |
19 | #include "mesh.h" | 21 | #include "mesh.h" |
22 | #include "led.h" | ||
23 | |||
24 | static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) | ||
25 | { | ||
26 | int meshhdrlen; | ||
27 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
28 | |||
29 | meshhdrlen = (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) ? 5 : 0; | ||
30 | |||
31 | /* FIX: what would be proper limits for MTU? | ||
32 | * This interface uses 802.3 frames. */ | ||
33 | if (new_mtu < 256 || | ||
34 | new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) { | ||
35 | return -EINVAL; | ||
36 | } | ||
37 | |||
38 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
39 | printk(KERN_DEBUG "%s: setting MTU %d\n", dev->name, new_mtu); | ||
40 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
41 | dev->mtu = new_mtu; | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static inline int identical_mac_addr_allowed(int type1, int type2) | ||
46 | { | ||
47 | return type1 == NL80211_IFTYPE_MONITOR || | ||
48 | type2 == NL80211_IFTYPE_MONITOR || | ||
49 | (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_WDS) || | ||
50 | (type1 == NL80211_IFTYPE_WDS && | ||
51 | (type2 == NL80211_IFTYPE_WDS || | ||
52 | type2 == NL80211_IFTYPE_AP)) || | ||
53 | (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_AP_VLAN) || | ||
54 | (type1 == NL80211_IFTYPE_AP_VLAN && | ||
55 | (type2 == NL80211_IFTYPE_AP || | ||
56 | type2 == NL80211_IFTYPE_AP_VLAN)); | ||
57 | } | ||
58 | |||
59 | static int ieee80211_open(struct net_device *dev) | ||
60 | { | ||
61 | struct ieee80211_sub_if_data *sdata, *nsdata; | ||
62 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
63 | struct sta_info *sta; | ||
64 | struct ieee80211_if_init_conf conf; | ||
65 | u32 changed = 0; | ||
66 | int res; | ||
67 | bool need_hw_reconfig = 0; | ||
68 | u8 null_addr[ETH_ALEN] = {0}; | ||
69 | |||
70 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
71 | |||
72 | /* fail early if user set an invalid address */ | ||
73 | if (compare_ether_addr(dev->dev_addr, null_addr) && | ||
74 | !is_valid_ether_addr(dev->dev_addr)) | ||
75 | return -EADDRNOTAVAIL; | ||
76 | |||
77 | /* we hold the RTNL here so can safely walk the list */ | ||
78 | list_for_each_entry(nsdata, &local->interfaces, list) { | ||
79 | struct net_device *ndev = nsdata->dev; | ||
80 | |||
81 | if (ndev != dev && netif_running(ndev)) { | ||
82 | /* | ||
83 | * Allow only a single IBSS interface to be up at any | ||
84 | * time. This is restricted because beacon distribution | ||
85 | * cannot work properly if both are in the same IBSS. | ||
86 | * | ||
87 | * To remove this restriction we'd have to disallow them | ||
88 | * from setting the same SSID on different IBSS interfaces | ||
89 | * belonging to the same hardware. Then, however, we're | ||
90 | * faced with having to adopt two different TSF timers... | ||
91 | */ | ||
92 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && | ||
93 | nsdata->vif.type == NL80211_IFTYPE_ADHOC) | ||
94 | return -EBUSY; | ||
95 | |||
96 | /* | ||
97 | * The remaining checks are only performed for interfaces | ||
98 | * with the same MAC address. | ||
99 | */ | ||
100 | if (compare_ether_addr(dev->dev_addr, ndev->dev_addr)) | ||
101 | continue; | ||
102 | |||
103 | /* | ||
104 | * check whether it may have the same address | ||
105 | */ | ||
106 | if (!identical_mac_addr_allowed(sdata->vif.type, | ||
107 | nsdata->vif.type)) | ||
108 | return -ENOTUNIQ; | ||
109 | |||
110 | /* | ||
111 | * can only add VLANs to enabled APs | ||
112 | */ | ||
113 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | ||
114 | nsdata->vif.type == NL80211_IFTYPE_AP) | ||
115 | sdata->bss = &nsdata->u.ap; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | switch (sdata->vif.type) { | ||
120 | case NL80211_IFTYPE_WDS: | ||
121 | if (!is_valid_ether_addr(sdata->u.wds.remote_addr)) | ||
122 | return -ENOLINK; | ||
123 | break; | ||
124 | case NL80211_IFTYPE_AP_VLAN: | ||
125 | if (!sdata->bss) | ||
126 | return -ENOLINK; | ||
127 | list_add(&sdata->u.vlan.list, &sdata->bss->vlans); | ||
128 | break; | ||
129 | case NL80211_IFTYPE_AP: | ||
130 | sdata->bss = &sdata->u.ap; | ||
131 | break; | ||
132 | case NL80211_IFTYPE_MESH_POINT: | ||
133 | if (!ieee80211_vif_is_mesh(&sdata->vif)) | ||
134 | break; | ||
135 | /* mesh ifaces must set allmulti to forward mcast traffic */ | ||
136 | atomic_inc(&local->iff_allmultis); | ||
137 | break; | ||
138 | case NL80211_IFTYPE_STATION: | ||
139 | case NL80211_IFTYPE_MONITOR: | ||
140 | case NL80211_IFTYPE_ADHOC: | ||
141 | /* no special treatment */ | ||
142 | break; | ||
143 | case NL80211_IFTYPE_UNSPECIFIED: | ||
144 | case __NL80211_IFTYPE_AFTER_LAST: | ||
145 | /* cannot happen */ | ||
146 | WARN_ON(1); | ||
147 | break; | ||
148 | } | ||
149 | |||
150 | if (local->open_count == 0) { | ||
151 | res = 0; | ||
152 | if (local->ops->start) | ||
153 | res = local->ops->start(local_to_hw(local)); | ||
154 | if (res) | ||
155 | goto err_del_bss; | ||
156 | need_hw_reconfig = 1; | ||
157 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * Check all interfaces and copy the hopefully now-present | ||
162 | * MAC address to those that have the special null one. | ||
163 | */ | ||
164 | list_for_each_entry(nsdata, &local->interfaces, list) { | ||
165 | struct net_device *ndev = nsdata->dev; | ||
166 | |||
167 | /* | ||
168 | * No need to check netif_running since we do not allow | ||
169 | * it to start up with this invalid address. | ||
170 | */ | ||
171 | if (compare_ether_addr(null_addr, ndev->dev_addr) == 0) | ||
172 | memcpy(ndev->dev_addr, | ||
173 | local->hw.wiphy->perm_addr, | ||
174 | ETH_ALEN); | ||
175 | } | ||
176 | |||
177 | if (compare_ether_addr(null_addr, local->mdev->dev_addr) == 0) | ||
178 | memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr, | ||
179 | ETH_ALEN); | ||
180 | |||
181 | /* | ||
182 | * Validate the MAC address for this device. | ||
183 | */ | ||
184 | if (!is_valid_ether_addr(dev->dev_addr)) { | ||
185 | if (!local->open_count && local->ops->stop) | ||
186 | local->ops->stop(local_to_hw(local)); | ||
187 | return -EADDRNOTAVAIL; | ||
188 | } | ||
189 | |||
190 | switch (sdata->vif.type) { | ||
191 | case NL80211_IFTYPE_AP_VLAN: | ||
192 | /* no need to tell driver */ | ||
193 | break; | ||
194 | case NL80211_IFTYPE_MONITOR: | ||
195 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { | ||
196 | local->cooked_mntrs++; | ||
197 | break; | ||
198 | } | ||
199 | |||
200 | /* must be before the call to ieee80211_configure_filter */ | ||
201 | local->monitors++; | ||
202 | if (local->monitors == 1) | ||
203 | local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; | ||
204 | |||
205 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | ||
206 | local->fif_fcsfail++; | ||
207 | if (sdata->u.mntr_flags & MONITOR_FLAG_PLCPFAIL) | ||
208 | local->fif_plcpfail++; | ||
209 | if (sdata->u.mntr_flags & MONITOR_FLAG_CONTROL) | ||
210 | local->fif_control++; | ||
211 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) | ||
212 | local->fif_other_bss++; | ||
213 | |||
214 | netif_addr_lock_bh(local->mdev); | ||
215 | ieee80211_configure_filter(local); | ||
216 | netif_addr_unlock_bh(local->mdev); | ||
217 | break; | ||
218 | case NL80211_IFTYPE_STATION: | ||
219 | case NL80211_IFTYPE_ADHOC: | ||
220 | sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; | ||
221 | /* fall through */ | ||
222 | default: | ||
223 | conf.vif = &sdata->vif; | ||
224 | conf.type = sdata->vif.type; | ||
225 | conf.mac_addr = dev->dev_addr; | ||
226 | res = local->ops->add_interface(local_to_hw(local), &conf); | ||
227 | if (res) | ||
228 | goto err_stop; | ||
229 | |||
230 | if (ieee80211_vif_is_mesh(&sdata->vif)) | ||
231 | ieee80211_start_mesh(sdata); | ||
232 | changed |= ieee80211_reset_erp_info(sdata); | ||
233 | ieee80211_bss_info_change_notify(sdata, changed); | ||
234 | ieee80211_enable_keys(sdata); | ||
235 | |||
236 | if (sdata->vif.type == NL80211_IFTYPE_STATION && | ||
237 | !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)) | ||
238 | netif_carrier_off(dev); | ||
239 | else | ||
240 | netif_carrier_on(dev); | ||
241 | } | ||
242 | |||
243 | if (sdata->vif.type == NL80211_IFTYPE_WDS) { | ||
244 | /* Create STA entry for the WDS peer */ | ||
245 | sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, | ||
246 | GFP_KERNEL); | ||
247 | if (!sta) { | ||
248 | res = -ENOMEM; | ||
249 | goto err_del_interface; | ||
250 | } | ||
251 | |||
252 | /* no locking required since STA is not live yet */ | ||
253 | sta->flags |= WLAN_STA_AUTHORIZED; | ||
254 | |||
255 | res = sta_info_insert(sta); | ||
256 | if (res) { | ||
257 | /* STA has been freed */ | ||
258 | goto err_del_interface; | ||
259 | } | ||
260 | } | ||
20 | 261 | ||
262 | if (local->open_count == 0) { | ||
263 | res = dev_open(local->mdev); | ||
264 | WARN_ON(res); | ||
265 | if (res) | ||
266 | goto err_del_interface; | ||
267 | tasklet_enable(&local->tx_pending_tasklet); | ||
268 | tasklet_enable(&local->tasklet); | ||
269 | } | ||
270 | |||
271 | /* | ||
272 | * set_multicast_list will be invoked by the networking core | ||
273 | * which will check whether any increments here were done in | ||
274 | * error and sync them down to the hardware as filter flags. | ||
275 | */ | ||
276 | if (sdata->flags & IEEE80211_SDATA_ALLMULTI) | ||
277 | atomic_inc(&local->iff_allmultis); | ||
278 | |||
279 | if (sdata->flags & IEEE80211_SDATA_PROMISC) | ||
280 | atomic_inc(&local->iff_promiscs); | ||
281 | |||
282 | local->open_count++; | ||
283 | if (need_hw_reconfig) { | ||
284 | ieee80211_hw_config(local); | ||
285 | /* | ||
286 | * set default queue parameters so drivers don't | ||
287 | * need to initialise the hardware if the hardware | ||
288 | * doesn't start up with sane defaults | ||
289 | */ | ||
290 | ieee80211_set_wmm_default(sdata); | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * ieee80211_sta_work is disabled while network interface | ||
295 | * is down. Therefore, some configuration changes may not | ||
296 | * yet be effective. Trigger execution of ieee80211_sta_work | ||
297 | * to fix this. | ||
298 | */ | ||
299 | if (sdata->vif.type == NL80211_IFTYPE_STATION || | ||
300 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { | ||
301 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
302 | queue_work(local->hw.workqueue, &ifsta->work); | ||
303 | } | ||
304 | |||
305 | netif_tx_start_all_queues(dev); | ||
306 | |||
307 | return 0; | ||
308 | err_del_interface: | ||
309 | local->ops->remove_interface(local_to_hw(local), &conf); | ||
310 | err_stop: | ||
311 | if (!local->open_count && local->ops->stop) | ||
312 | local->ops->stop(local_to_hw(local)); | ||
313 | err_del_bss: | ||
314 | sdata->bss = NULL; | ||
315 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | ||
316 | list_del(&sdata->u.vlan.list); | ||
317 | return res; | ||
318 | } | ||
319 | |||
320 | static int ieee80211_stop(struct net_device *dev) | ||
321 | { | ||
322 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
323 | struct ieee80211_local *local = sdata->local; | ||
324 | struct ieee80211_if_init_conf conf; | ||
325 | struct sta_info *sta; | ||
326 | |||
327 | /* | ||
328 | * Stop TX on this interface first. | ||
329 | */ | ||
330 | netif_tx_stop_all_queues(dev); | ||
331 | |||
332 | /* | ||
333 | * Now delete all active aggregation sessions. | ||
334 | */ | ||
335 | rcu_read_lock(); | ||
336 | |||
337 | list_for_each_entry_rcu(sta, &local->sta_list, list) { | ||
338 | if (sta->sdata == sdata) | ||
339 | ieee80211_sta_tear_down_BA_sessions(sdata, | ||
340 | sta->sta.addr); | ||
341 | } | ||
342 | |||
343 | rcu_read_unlock(); | ||
344 | |||
345 | /* | ||
346 | * Remove all stations associated with this interface. | ||
347 | * | ||
348 | * This must be done before calling ops->remove_interface() | ||
349 | * because otherwise we can later invoke ops->sta_notify() | ||
350 | * whenever the STAs are removed, and that invalidates driver | ||
351 | * assumptions about always getting a vif pointer that is valid | ||
352 | * (because if we remove a STA after ops->remove_interface() | ||
353 | * the driver will have removed the vif info already!) | ||
354 | * | ||
355 | * We could relax this and only unlink the stations from the | ||
356 | * hash table and list but keep them on a per-sdata list that | ||
357 | * will be inserted back again when the interface is brought | ||
358 | * up again, but I don't currently see a use case for that, | ||
359 | * except with WDS which gets a STA entry created when it is | ||
360 | * brought up. | ||
361 | */ | ||
362 | sta_info_flush(local, sdata); | ||
363 | |||
364 | /* | ||
365 | * Don't count this interface for promisc/allmulti while it | ||
366 | * is down. dev_mc_unsync() will invoke set_multicast_list | ||
367 | * on the master interface which will sync these down to the | ||
368 | * hardware as filter flags. | ||
369 | */ | ||
370 | if (sdata->flags & IEEE80211_SDATA_ALLMULTI) | ||
371 | atomic_dec(&local->iff_allmultis); | ||
372 | |||
373 | if (sdata->flags & IEEE80211_SDATA_PROMISC) | ||
374 | atomic_dec(&local->iff_promiscs); | ||
375 | |||
376 | dev_mc_unsync(local->mdev, dev); | ||
377 | |||
378 | /* APs need special treatment */ | ||
379 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | ||
380 | struct ieee80211_sub_if_data *vlan, *tmp; | ||
381 | struct beacon_data *old_beacon = sdata->u.ap.beacon; | ||
382 | |||
383 | /* remove beacon */ | ||
384 | rcu_assign_pointer(sdata->u.ap.beacon, NULL); | ||
385 | synchronize_rcu(); | ||
386 | kfree(old_beacon); | ||
387 | |||
388 | /* down all dependent devices, that is VLANs */ | ||
389 | list_for_each_entry_safe(vlan, tmp, &sdata->u.ap.vlans, | ||
390 | u.vlan.list) | ||
391 | dev_close(vlan->dev); | ||
392 | WARN_ON(!list_empty(&sdata->u.ap.vlans)); | ||
393 | } | ||
394 | |||
395 | local->open_count--; | ||
396 | |||
397 | switch (sdata->vif.type) { | ||
398 | case NL80211_IFTYPE_AP_VLAN: | ||
399 | list_del(&sdata->u.vlan.list); | ||
400 | /* no need to tell driver */ | ||
401 | break; | ||
402 | case NL80211_IFTYPE_MONITOR: | ||
403 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { | ||
404 | local->cooked_mntrs--; | ||
405 | break; | ||
406 | } | ||
407 | |||
408 | local->monitors--; | ||
409 | if (local->monitors == 0) | ||
410 | local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP; | ||
411 | |||
412 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | ||
413 | local->fif_fcsfail--; | ||
414 | if (sdata->u.mntr_flags & MONITOR_FLAG_PLCPFAIL) | ||
415 | local->fif_plcpfail--; | ||
416 | if (sdata->u.mntr_flags & MONITOR_FLAG_CONTROL) | ||
417 | local->fif_control--; | ||
418 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) | ||
419 | local->fif_other_bss--; | ||
420 | |||
421 | netif_addr_lock_bh(local->mdev); | ||
422 | ieee80211_configure_filter(local); | ||
423 | netif_addr_unlock_bh(local->mdev); | ||
424 | break; | ||
425 | case NL80211_IFTYPE_STATION: | ||
426 | case NL80211_IFTYPE_ADHOC: | ||
427 | sdata->u.sta.state = IEEE80211_STA_MLME_DISABLED; | ||
428 | memset(sdata->u.sta.bssid, 0, ETH_ALEN); | ||
429 | del_timer_sync(&sdata->u.sta.timer); | ||
430 | /* | ||
431 | * If the timer fired while we waited for it, it will have | ||
432 | * requeued the work. Now the work will be running again | ||
433 | * but will not rearm the timer again because it checks | ||
434 | * whether the interface is running, which, at this point, | ||
435 | * it no longer is. | ||
436 | */ | ||
437 | cancel_work_sync(&sdata->u.sta.work); | ||
438 | /* | ||
439 | * When we get here, the interface is marked down. | ||
440 | * Call synchronize_rcu() to wait for the RX path | ||
441 | * should it be using the interface and enqueuing | ||
442 | * frames at this very time on another CPU. | ||
443 | */ | ||
444 | synchronize_rcu(); | ||
445 | skb_queue_purge(&sdata->u.sta.skb_queue); | ||
446 | |||
447 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; | ||
448 | kfree(sdata->u.sta.extra_ie); | ||
449 | sdata->u.sta.extra_ie = NULL; | ||
450 | sdata->u.sta.extra_ie_len = 0; | ||
451 | /* fall through */ | ||
452 | case NL80211_IFTYPE_MESH_POINT: | ||
453 | if (ieee80211_vif_is_mesh(&sdata->vif)) { | ||
454 | /* allmulti is always set on mesh ifaces */ | ||
455 | atomic_dec(&local->iff_allmultis); | ||
456 | ieee80211_stop_mesh(sdata); | ||
457 | } | ||
458 | /* fall through */ | ||
459 | default: | ||
460 | if (local->scan_sdata == sdata) { | ||
461 | if (!local->ops->hw_scan) | ||
462 | cancel_delayed_work_sync(&local->scan_work); | ||
463 | /* | ||
464 | * The software scan can no longer run now, so we can | ||
465 | * clear out the scan_sdata reference. However, the | ||
466 | * hardware scan may still be running. The complete | ||
467 | * function must be prepared to handle a NULL value. | ||
468 | */ | ||
469 | local->scan_sdata = NULL; | ||
470 | /* | ||
471 | * The memory barrier guarantees that another CPU | ||
472 | * that is hardware-scanning will now see the fact | ||
473 | * that this interface is gone. | ||
474 | */ | ||
475 | smp_mb(); | ||
476 | /* | ||
477 | * If software scanning, complete the scan but since | ||
478 | * the scan_sdata is NULL already don't send out a | ||
479 | * scan event to userspace -- the scan is incomplete. | ||
480 | */ | ||
481 | if (local->sw_scanning) | ||
482 | ieee80211_scan_completed(&local->hw); | ||
483 | } | ||
484 | |||
485 | conf.vif = &sdata->vif; | ||
486 | conf.type = sdata->vif.type; | ||
487 | conf.mac_addr = dev->dev_addr; | ||
488 | /* disable all keys for as long as this netdev is down */ | ||
489 | ieee80211_disable_keys(sdata); | ||
490 | local->ops->remove_interface(local_to_hw(local), &conf); | ||
491 | } | ||
492 | |||
493 | sdata->bss = NULL; | ||
494 | |||
495 | if (local->open_count == 0) { | ||
496 | if (netif_running(local->mdev)) | ||
497 | dev_close(local->mdev); | ||
498 | |||
499 | if (local->ops->stop) | ||
500 | local->ops->stop(local_to_hw(local)); | ||
501 | |||
502 | ieee80211_led_radio(local, 0); | ||
503 | |||
504 | flush_workqueue(local->hw.workqueue); | ||
505 | |||
506 | tasklet_disable(&local->tx_pending_tasklet); | ||
507 | tasklet_disable(&local->tasklet); | ||
508 | } | ||
509 | |||
510 | return 0; | ||
511 | } | ||
512 | |||
513 | static void ieee80211_set_multicast_list(struct net_device *dev) | ||
514 | { | ||
515 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
516 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
517 | int allmulti, promisc, sdata_allmulti, sdata_promisc; | ||
518 | |||
519 | allmulti = !!(dev->flags & IFF_ALLMULTI); | ||
520 | promisc = !!(dev->flags & IFF_PROMISC); | ||
521 | sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI); | ||
522 | sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC); | ||
523 | |||
524 | if (allmulti != sdata_allmulti) { | ||
525 | if (dev->flags & IFF_ALLMULTI) | ||
526 | atomic_inc(&local->iff_allmultis); | ||
527 | else | ||
528 | atomic_dec(&local->iff_allmultis); | ||
529 | sdata->flags ^= IEEE80211_SDATA_ALLMULTI; | ||
530 | } | ||
531 | |||
532 | if (promisc != sdata_promisc) { | ||
533 | if (dev->flags & IFF_PROMISC) | ||
534 | atomic_inc(&local->iff_promiscs); | ||
535 | else | ||
536 | atomic_dec(&local->iff_promiscs); | ||
537 | sdata->flags ^= IEEE80211_SDATA_PROMISC; | ||
538 | } | ||
539 | |||
540 | dev_mc_sync(local->mdev, dev); | ||
541 | } | ||
542 | |||
543 | static void ieee80211_if_setup(struct net_device *dev) | ||
544 | { | ||
545 | ether_setup(dev); | ||
546 | dev->hard_start_xmit = ieee80211_subif_start_xmit; | ||
547 | dev->wireless_handlers = &ieee80211_iw_handler_def; | ||
548 | dev->set_multicast_list = ieee80211_set_multicast_list; | ||
549 | dev->change_mtu = ieee80211_change_mtu; | ||
550 | dev->open = ieee80211_open; | ||
551 | dev->stop = ieee80211_stop; | ||
552 | dev->destructor = free_netdev; | ||
553 | /* we will validate the address ourselves in ->open */ | ||
554 | dev->validate_addr = NULL; | ||
555 | } | ||
21 | /* | 556 | /* |
22 | * Called when the netdev is removed or, by the code below, before | 557 | * Called when the netdev is removed or, by the code below, before |
23 | * the interface type changes. | 558 | * the interface type changes. |
@@ -41,7 +576,7 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
41 | sdata->fragment_next = 0; | 576 | sdata->fragment_next = 0; |
42 | 577 | ||
43 | switch (sdata->vif.type) { | 578 | switch (sdata->vif.type) { |
44 | case IEEE80211_IF_TYPE_AP: | 579 | case NL80211_IFTYPE_AP: |
45 | beacon = sdata->u.ap.beacon; | 580 | beacon = sdata->u.ap.beacon; |
46 | rcu_assign_pointer(sdata->u.ap.beacon, NULL); | 581 | rcu_assign_pointer(sdata->u.ap.beacon, NULL); |
47 | synchronize_rcu(); | 582 | synchronize_rcu(); |
@@ -53,23 +588,23 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
53 | } | 588 | } |
54 | 589 | ||
55 | break; | 590 | break; |
56 | case IEEE80211_IF_TYPE_MESH_POINT: | 591 | case NL80211_IFTYPE_MESH_POINT: |
57 | /* Allow compiler to elide mesh_rmc_free call. */ | ||
58 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 592 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
59 | mesh_rmc_free(sdata); | 593 | mesh_rmc_free(sdata); |
60 | /* fall through */ | 594 | break; |
61 | case IEEE80211_IF_TYPE_STA: | 595 | case NL80211_IFTYPE_STATION: |
62 | case IEEE80211_IF_TYPE_IBSS: | 596 | case NL80211_IFTYPE_ADHOC: |
63 | kfree(sdata->u.sta.extra_ie); | 597 | kfree(sdata->u.sta.extra_ie); |
64 | kfree(sdata->u.sta.assocreq_ies); | 598 | kfree(sdata->u.sta.assocreq_ies); |
65 | kfree(sdata->u.sta.assocresp_ies); | 599 | kfree(sdata->u.sta.assocresp_ies); |
66 | kfree_skb(sdata->u.sta.probe_resp); | 600 | kfree_skb(sdata->u.sta.probe_resp); |
67 | break; | 601 | break; |
68 | case IEEE80211_IF_TYPE_WDS: | 602 | case NL80211_IFTYPE_WDS: |
69 | case IEEE80211_IF_TYPE_VLAN: | 603 | case NL80211_IFTYPE_AP_VLAN: |
70 | case IEEE80211_IF_TYPE_MNTR: | 604 | case NL80211_IFTYPE_MONITOR: |
71 | break; | 605 | break; |
72 | case IEEE80211_IF_TYPE_INVALID: | 606 | case NL80211_IFTYPE_UNSPECIFIED: |
607 | case __NL80211_IFTYPE_AFTER_LAST: | ||
73 | BUG(); | 608 | BUG(); |
74 | break; | 609 | break; |
75 | } | 610 | } |
@@ -82,55 +617,42 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
82 | * Helper function to initialise an interface to a specific type. | 617 | * Helper function to initialise an interface to a specific type. |
83 | */ | 618 | */ |
84 | static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | 619 | static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, |
85 | enum ieee80211_if_types type) | 620 | enum nl80211_iftype type) |
86 | { | 621 | { |
87 | struct ieee80211_if_sta *ifsta; | ||
88 | |||
89 | /* clear type-dependent union */ | 622 | /* clear type-dependent union */ |
90 | memset(&sdata->u, 0, sizeof(sdata->u)); | 623 | memset(&sdata->u, 0, sizeof(sdata->u)); |
91 | 624 | ||
92 | /* and set some type-dependent values */ | 625 | /* and set some type-dependent values */ |
93 | sdata->vif.type = type; | 626 | sdata->vif.type = type; |
627 | sdata->dev->hard_start_xmit = ieee80211_subif_start_xmit; | ||
94 | 628 | ||
95 | /* only monitor differs */ | 629 | /* only monitor differs */ |
96 | sdata->dev->type = ARPHRD_ETHER; | 630 | sdata->dev->type = ARPHRD_ETHER; |
97 | 631 | ||
98 | switch (type) { | 632 | switch (type) { |
99 | case IEEE80211_IF_TYPE_AP: | 633 | case NL80211_IFTYPE_AP: |
100 | skb_queue_head_init(&sdata->u.ap.ps_bc_buf); | 634 | skb_queue_head_init(&sdata->u.ap.ps_bc_buf); |
101 | INIT_LIST_HEAD(&sdata->u.ap.vlans); | 635 | INIT_LIST_HEAD(&sdata->u.ap.vlans); |
102 | break; | 636 | break; |
103 | case IEEE80211_IF_TYPE_MESH_POINT: | 637 | case NL80211_IFTYPE_STATION: |
104 | case IEEE80211_IF_TYPE_STA: | 638 | case NL80211_IFTYPE_ADHOC: |
105 | case IEEE80211_IF_TYPE_IBSS: | 639 | ieee80211_sta_setup_sdata(sdata); |
106 | ifsta = &sdata->u.sta; | 640 | break; |
107 | INIT_WORK(&ifsta->work, ieee80211_sta_work); | 641 | case NL80211_IFTYPE_MESH_POINT: |
108 | setup_timer(&ifsta->timer, ieee80211_sta_timer, | ||
109 | (unsigned long) sdata); | ||
110 | skb_queue_head_init(&ifsta->skb_queue); | ||
111 | |||
112 | ifsta->capab = WLAN_CAPABILITY_ESS; | ||
113 | ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN | | ||
114 | IEEE80211_AUTH_ALG_SHARED_KEY; | ||
115 | ifsta->flags |= IEEE80211_STA_CREATE_IBSS | | ||
116 | IEEE80211_STA_AUTO_BSSID_SEL | | ||
117 | IEEE80211_STA_AUTO_CHANNEL_SEL; | ||
118 | if (ieee80211_num_regular_queues(&sdata->local->hw) >= 4) | ||
119 | ifsta->flags |= IEEE80211_STA_WMM_ENABLED; | ||
120 | |||
121 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 642 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
122 | ieee80211_mesh_init_sdata(sdata); | 643 | ieee80211_mesh_init_sdata(sdata); |
123 | break; | 644 | break; |
124 | case IEEE80211_IF_TYPE_MNTR: | 645 | case NL80211_IFTYPE_MONITOR: |
125 | sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP; | 646 | sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP; |
126 | sdata->dev->hard_start_xmit = ieee80211_monitor_start_xmit; | 647 | sdata->dev->hard_start_xmit = ieee80211_monitor_start_xmit; |
127 | sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | | 648 | sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | |
128 | MONITOR_FLAG_OTHER_BSS; | 649 | MONITOR_FLAG_OTHER_BSS; |
129 | break; | 650 | break; |
130 | case IEEE80211_IF_TYPE_WDS: | 651 | case NL80211_IFTYPE_WDS: |
131 | case IEEE80211_IF_TYPE_VLAN: | 652 | case NL80211_IFTYPE_AP_VLAN: |
132 | break; | 653 | break; |
133 | case IEEE80211_IF_TYPE_INVALID: | 654 | case NL80211_IFTYPE_UNSPECIFIED: |
655 | case __NL80211_IFTYPE_AFTER_LAST: | ||
134 | BUG(); | 656 | BUG(); |
135 | break; | 657 | break; |
136 | } | 658 | } |
@@ -139,7 +661,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
139 | } | 661 | } |
140 | 662 | ||
141 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | 663 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, |
142 | enum ieee80211_if_types type) | 664 | enum nl80211_iftype type) |
143 | { | 665 | { |
144 | ASSERT_RTNL(); | 666 | ASSERT_RTNL(); |
145 | 667 | ||
@@ -160,14 +682,16 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
160 | ieee80211_setup_sdata(sdata, type); | 682 | ieee80211_setup_sdata(sdata, type); |
161 | 683 | ||
162 | /* reset some values that shouldn't be kept across type changes */ | 684 | /* reset some values that shouldn't be kept across type changes */ |
163 | sdata->basic_rates = 0; | 685 | sdata->bss_conf.basic_rates = |
686 | ieee80211_mandatory_rates(sdata->local, | ||
687 | sdata->local->hw.conf.channel->band); | ||
164 | sdata->drop_unencrypted = 0; | 688 | sdata->drop_unencrypted = 0; |
165 | 689 | ||
166 | return 0; | 690 | return 0; |
167 | } | 691 | } |
168 | 692 | ||
169 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, | 693 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, |
170 | struct net_device **new_dev, enum ieee80211_if_types type, | 694 | struct net_device **new_dev, enum nl80211_iftype type, |
171 | struct vif_params *params) | 695 | struct vif_params *params) |
172 | { | 696 | { |
173 | struct net_device *ndev; | 697 | struct net_device *ndev; |
@@ -225,9 +749,9 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
225 | 749 | ||
226 | if (ieee80211_vif_is_mesh(&sdata->vif) && | 750 | if (ieee80211_vif_is_mesh(&sdata->vif) && |
227 | params && params->mesh_id_len) | 751 | params && params->mesh_id_len) |
228 | ieee80211_if_sta_set_mesh_id(&sdata->u.sta, | 752 | ieee80211_sdata_set_mesh_id(sdata, |
229 | params->mesh_id_len, | 753 | params->mesh_id_len, |
230 | params->mesh_id); | 754 | params->mesh_id); |
231 | 755 | ||
232 | list_add_tail_rcu(&sdata->list, &local->interfaces); | 756 | list_add_tail_rcu(&sdata->list, &local->interfaces); |
233 | 757 | ||
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 6597c779e35a..57afcd38cd9e 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -118,12 +118,12 @@ static const u8 *get_mac_for_key(struct ieee80211_key *key) | |||
118 | * address to indicate a transmit-only key. | 118 | * address to indicate a transmit-only key. |
119 | */ | 119 | */ |
120 | if (key->conf.alg != ALG_WEP && | 120 | if (key->conf.alg != ALG_WEP && |
121 | (key->sdata->vif.type == IEEE80211_IF_TYPE_AP || | 121 | (key->sdata->vif.type == NL80211_IFTYPE_AP || |
122 | key->sdata->vif.type == IEEE80211_IF_TYPE_VLAN)) | 122 | key->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) |
123 | addr = zero_addr; | 123 | addr = zero_addr; |
124 | 124 | ||
125 | if (key->sta) | 125 | if (key->sta) |
126 | addr = key->sta->addr; | 126 | addr = key->sta->sta.addr; |
127 | 127 | ||
128 | return addr; | 128 | return addr; |
129 | } | 129 | } |
@@ -331,7 +331,7 @@ void ieee80211_key_link(struct ieee80211_key *key, | |||
331 | */ | 331 | */ |
332 | key->conf.flags |= IEEE80211_KEY_FLAG_PAIRWISE; | 332 | key->conf.flags |= IEEE80211_KEY_FLAG_PAIRWISE; |
333 | } else { | 333 | } else { |
334 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) { | 334 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
335 | struct sta_info *ap; | 335 | struct sta_info *ap; |
336 | 336 | ||
337 | /* | 337 | /* |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 6a7f4fae18c2..c307dba7ec03 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -45,16 +45,9 @@ struct ieee80211_tx_status_rtap_hdr { | |||
45 | u8 data_retries; | 45 | u8 data_retries; |
46 | } __attribute__ ((packed)); | 46 | } __attribute__ ((packed)); |
47 | 47 | ||
48 | /* common interface routines */ | ||
49 | |||
50 | static int header_parse_80211(const struct sk_buff *skb, unsigned char *haddr) | ||
51 | { | ||
52 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ | ||
53 | return ETH_ALEN; | ||
54 | } | ||
55 | 48 | ||
56 | /* must be called under mdev tx lock */ | 49 | /* must be called under mdev tx lock */ |
57 | static void ieee80211_configure_filter(struct ieee80211_local *local) | 50 | void ieee80211_configure_filter(struct ieee80211_local *local) |
58 | { | 51 | { |
59 | unsigned int changed_flags; | 52 | unsigned int changed_flags; |
60 | unsigned int new_flags = 0; | 53 | unsigned int new_flags = 0; |
@@ -97,6 +90,20 @@ static void ieee80211_configure_filter(struct ieee80211_local *local) | |||
97 | 90 | ||
98 | /* master interface */ | 91 | /* master interface */ |
99 | 92 | ||
93 | static int header_parse_80211(const struct sk_buff *skb, unsigned char *haddr) | ||
94 | { | ||
95 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ | ||
96 | return ETH_ALEN; | ||
97 | } | ||
98 | |||
99 | static const struct header_ops ieee80211_header_ops = { | ||
100 | .create = eth_header, | ||
101 | .parse = header_parse_80211, | ||
102 | .rebuild = eth_rebuild_header, | ||
103 | .cache = eth_header_cache, | ||
104 | .cache_update = eth_header_cache_update, | ||
105 | }; | ||
106 | |||
100 | static int ieee80211_master_open(struct net_device *dev) | 107 | static int ieee80211_master_open(struct net_device *dev) |
101 | { | 108 | { |
102 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 109 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
@@ -139,519 +146,6 @@ static void ieee80211_master_set_multicast_list(struct net_device *dev) | |||
139 | ieee80211_configure_filter(local); | 146 | ieee80211_configure_filter(local); |
140 | } | 147 | } |
141 | 148 | ||
142 | /* regular interfaces */ | ||
143 | |||
144 | static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) | ||
145 | { | ||
146 | int meshhdrlen; | ||
147 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
148 | |||
149 | meshhdrlen = (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) ? 5 : 0; | ||
150 | |||
151 | /* FIX: what would be proper limits for MTU? | ||
152 | * This interface uses 802.3 frames. */ | ||
153 | if (new_mtu < 256 || | ||
154 | new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) { | ||
155 | return -EINVAL; | ||
156 | } | ||
157 | |||
158 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
159 | printk(KERN_DEBUG "%s: setting MTU %d\n", dev->name, new_mtu); | ||
160 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | ||
161 | dev->mtu = new_mtu; | ||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static inline int identical_mac_addr_allowed(int type1, int type2) | ||
166 | { | ||
167 | return (type1 == IEEE80211_IF_TYPE_MNTR || | ||
168 | type2 == IEEE80211_IF_TYPE_MNTR || | ||
169 | (type1 == IEEE80211_IF_TYPE_AP && | ||
170 | type2 == IEEE80211_IF_TYPE_WDS) || | ||
171 | (type1 == IEEE80211_IF_TYPE_WDS && | ||
172 | (type2 == IEEE80211_IF_TYPE_WDS || | ||
173 | type2 == IEEE80211_IF_TYPE_AP)) || | ||
174 | (type1 == IEEE80211_IF_TYPE_AP && | ||
175 | type2 == IEEE80211_IF_TYPE_VLAN) || | ||
176 | (type1 == IEEE80211_IF_TYPE_VLAN && | ||
177 | (type2 == IEEE80211_IF_TYPE_AP || | ||
178 | type2 == IEEE80211_IF_TYPE_VLAN))); | ||
179 | } | ||
180 | |||
181 | static int ieee80211_open(struct net_device *dev) | ||
182 | { | ||
183 | struct ieee80211_sub_if_data *sdata, *nsdata; | ||
184 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
185 | struct sta_info *sta; | ||
186 | struct ieee80211_if_init_conf conf; | ||
187 | u32 changed = 0; | ||
188 | int res; | ||
189 | bool need_hw_reconfig = 0; | ||
190 | u8 null_addr[ETH_ALEN] = {0}; | ||
191 | |||
192 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
193 | |||
194 | /* fail early if user set an invalid address */ | ||
195 | if (compare_ether_addr(dev->dev_addr, null_addr) && | ||
196 | !is_valid_ether_addr(dev->dev_addr)) | ||
197 | return -EADDRNOTAVAIL; | ||
198 | |||
199 | /* we hold the RTNL here so can safely walk the list */ | ||
200 | list_for_each_entry(nsdata, &local->interfaces, list) { | ||
201 | struct net_device *ndev = nsdata->dev; | ||
202 | |||
203 | if (ndev != dev && netif_running(ndev)) { | ||
204 | /* | ||
205 | * Allow only a single IBSS interface to be up at any | ||
206 | * time. This is restricted because beacon distribution | ||
207 | * cannot work properly if both are in the same IBSS. | ||
208 | * | ||
209 | * To remove this restriction we'd have to disallow them | ||
210 | * from setting the same SSID on different IBSS interfaces | ||
211 | * belonging to the same hardware. Then, however, we're | ||
212 | * faced with having to adopt two different TSF timers... | ||
213 | */ | ||
214 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | ||
215 | nsdata->vif.type == IEEE80211_IF_TYPE_IBSS) | ||
216 | return -EBUSY; | ||
217 | |||
218 | /* | ||
219 | * The remaining checks are only performed for interfaces | ||
220 | * with the same MAC address. | ||
221 | */ | ||
222 | if (compare_ether_addr(dev->dev_addr, ndev->dev_addr)) | ||
223 | continue; | ||
224 | |||
225 | /* | ||
226 | * check whether it may have the same address | ||
227 | */ | ||
228 | if (!identical_mac_addr_allowed(sdata->vif.type, | ||
229 | nsdata->vif.type)) | ||
230 | return -ENOTUNIQ; | ||
231 | |||
232 | /* | ||
233 | * can only add VLANs to enabled APs | ||
234 | */ | ||
235 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN && | ||
236 | nsdata->vif.type == IEEE80211_IF_TYPE_AP) | ||
237 | sdata->bss = &nsdata->u.ap; | ||
238 | } | ||
239 | } | ||
240 | |||
241 | switch (sdata->vif.type) { | ||
242 | case IEEE80211_IF_TYPE_WDS: | ||
243 | if (!is_valid_ether_addr(sdata->u.wds.remote_addr)) | ||
244 | return -ENOLINK; | ||
245 | break; | ||
246 | case IEEE80211_IF_TYPE_VLAN: | ||
247 | if (!sdata->bss) | ||
248 | return -ENOLINK; | ||
249 | list_add(&sdata->u.vlan.list, &sdata->bss->vlans); | ||
250 | break; | ||
251 | case IEEE80211_IF_TYPE_AP: | ||
252 | sdata->bss = &sdata->u.ap; | ||
253 | break; | ||
254 | case IEEE80211_IF_TYPE_MESH_POINT: | ||
255 | /* mesh ifaces must set allmulti to forward mcast traffic */ | ||
256 | atomic_inc(&local->iff_allmultis); | ||
257 | break; | ||
258 | case IEEE80211_IF_TYPE_STA: | ||
259 | case IEEE80211_IF_TYPE_MNTR: | ||
260 | case IEEE80211_IF_TYPE_IBSS: | ||
261 | /* no special treatment */ | ||
262 | break; | ||
263 | case IEEE80211_IF_TYPE_INVALID: | ||
264 | /* cannot happen */ | ||
265 | WARN_ON(1); | ||
266 | break; | ||
267 | } | ||
268 | |||
269 | if (local->open_count == 0) { | ||
270 | res = 0; | ||
271 | if (local->ops->start) | ||
272 | res = local->ops->start(local_to_hw(local)); | ||
273 | if (res) | ||
274 | goto err_del_bss; | ||
275 | need_hw_reconfig = 1; | ||
276 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); | ||
277 | } | ||
278 | |||
279 | /* | ||
280 | * Check all interfaces and copy the hopefully now-present | ||
281 | * MAC address to those that have the special null one. | ||
282 | */ | ||
283 | list_for_each_entry(nsdata, &local->interfaces, list) { | ||
284 | struct net_device *ndev = nsdata->dev; | ||
285 | |||
286 | /* | ||
287 | * No need to check netif_running since we do not allow | ||
288 | * it to start up with this invalid address. | ||
289 | */ | ||
290 | if (compare_ether_addr(null_addr, ndev->dev_addr) == 0) | ||
291 | memcpy(ndev->dev_addr, | ||
292 | local->hw.wiphy->perm_addr, | ||
293 | ETH_ALEN); | ||
294 | } | ||
295 | |||
296 | if (compare_ether_addr(null_addr, local->mdev->dev_addr) == 0) | ||
297 | memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr, | ||
298 | ETH_ALEN); | ||
299 | |||
300 | /* | ||
301 | * Validate the MAC address for this device. | ||
302 | */ | ||
303 | if (!is_valid_ether_addr(dev->dev_addr)) { | ||
304 | if (!local->open_count && local->ops->stop) | ||
305 | local->ops->stop(local_to_hw(local)); | ||
306 | return -EADDRNOTAVAIL; | ||
307 | } | ||
308 | |||
309 | switch (sdata->vif.type) { | ||
310 | case IEEE80211_IF_TYPE_VLAN: | ||
311 | /* no need to tell driver */ | ||
312 | break; | ||
313 | case IEEE80211_IF_TYPE_MNTR: | ||
314 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { | ||
315 | local->cooked_mntrs++; | ||
316 | break; | ||
317 | } | ||
318 | |||
319 | /* must be before the call to ieee80211_configure_filter */ | ||
320 | local->monitors++; | ||
321 | if (local->monitors == 1) | ||
322 | local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; | ||
323 | |||
324 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | ||
325 | local->fif_fcsfail++; | ||
326 | if (sdata->u.mntr_flags & MONITOR_FLAG_PLCPFAIL) | ||
327 | local->fif_plcpfail++; | ||
328 | if (sdata->u.mntr_flags & MONITOR_FLAG_CONTROL) | ||
329 | local->fif_control++; | ||
330 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) | ||
331 | local->fif_other_bss++; | ||
332 | |||
333 | netif_addr_lock_bh(local->mdev); | ||
334 | ieee80211_configure_filter(local); | ||
335 | netif_addr_unlock_bh(local->mdev); | ||
336 | break; | ||
337 | case IEEE80211_IF_TYPE_STA: | ||
338 | case IEEE80211_IF_TYPE_IBSS: | ||
339 | sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; | ||
340 | /* fall through */ | ||
341 | default: | ||
342 | conf.vif = &sdata->vif; | ||
343 | conf.type = sdata->vif.type; | ||
344 | conf.mac_addr = dev->dev_addr; | ||
345 | res = local->ops->add_interface(local_to_hw(local), &conf); | ||
346 | if (res) | ||
347 | goto err_stop; | ||
348 | |||
349 | if (ieee80211_vif_is_mesh(&sdata->vif)) | ||
350 | ieee80211_start_mesh(sdata); | ||
351 | changed |= ieee80211_reset_erp_info(sdata); | ||
352 | ieee80211_bss_info_change_notify(sdata, changed); | ||
353 | ieee80211_enable_keys(sdata); | ||
354 | |||
355 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA && | ||
356 | !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)) | ||
357 | netif_carrier_off(dev); | ||
358 | else | ||
359 | netif_carrier_on(dev); | ||
360 | } | ||
361 | |||
362 | if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | ||
363 | /* Create STA entry for the WDS peer */ | ||
364 | sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, | ||
365 | GFP_KERNEL); | ||
366 | if (!sta) { | ||
367 | res = -ENOMEM; | ||
368 | goto err_del_interface; | ||
369 | } | ||
370 | |||
371 | /* no locking required since STA is not live yet */ | ||
372 | sta->flags |= WLAN_STA_AUTHORIZED; | ||
373 | |||
374 | res = sta_info_insert(sta); | ||
375 | if (res) { | ||
376 | /* STA has been freed */ | ||
377 | goto err_del_interface; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | if (local->open_count == 0) { | ||
382 | res = dev_open(local->mdev); | ||
383 | WARN_ON(res); | ||
384 | if (res) | ||
385 | goto err_del_interface; | ||
386 | tasklet_enable(&local->tx_pending_tasklet); | ||
387 | tasklet_enable(&local->tasklet); | ||
388 | } | ||
389 | |||
390 | /* | ||
391 | * set_multicast_list will be invoked by the networking core | ||
392 | * which will check whether any increments here were done in | ||
393 | * error and sync them down to the hardware as filter flags. | ||
394 | */ | ||
395 | if (sdata->flags & IEEE80211_SDATA_ALLMULTI) | ||
396 | atomic_inc(&local->iff_allmultis); | ||
397 | |||
398 | if (sdata->flags & IEEE80211_SDATA_PROMISC) | ||
399 | atomic_inc(&local->iff_promiscs); | ||
400 | |||
401 | local->open_count++; | ||
402 | if (need_hw_reconfig) { | ||
403 | ieee80211_hw_config(local); | ||
404 | /* | ||
405 | * set default queue parameters so drivers don't | ||
406 | * need to initialise the hardware if the hardware | ||
407 | * doesn't start up with sane defaults | ||
408 | */ | ||
409 | ieee80211_set_wmm_default(sdata); | ||
410 | } | ||
411 | |||
412 | /* | ||
413 | * ieee80211_sta_work is disabled while network interface | ||
414 | * is down. Therefore, some configuration changes may not | ||
415 | * yet be effective. Trigger execution of ieee80211_sta_work | ||
416 | * to fix this. | ||
417 | */ | ||
418 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | ||
419 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | ||
420 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
421 | queue_work(local->hw.workqueue, &ifsta->work); | ||
422 | } | ||
423 | |||
424 | netif_tx_start_all_queues(dev); | ||
425 | |||
426 | return 0; | ||
427 | err_del_interface: | ||
428 | local->ops->remove_interface(local_to_hw(local), &conf); | ||
429 | err_stop: | ||
430 | if (!local->open_count && local->ops->stop) | ||
431 | local->ops->stop(local_to_hw(local)); | ||
432 | err_del_bss: | ||
433 | sdata->bss = NULL; | ||
434 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) | ||
435 | list_del(&sdata->u.vlan.list); | ||
436 | return res; | ||
437 | } | ||
438 | |||
439 | static int ieee80211_stop(struct net_device *dev) | ||
440 | { | ||
441 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
442 | struct ieee80211_local *local = sdata->local; | ||
443 | struct ieee80211_if_init_conf conf; | ||
444 | struct sta_info *sta; | ||
445 | |||
446 | /* | ||
447 | * Stop TX on this interface first. | ||
448 | */ | ||
449 | netif_tx_stop_all_queues(dev); | ||
450 | |||
451 | /* | ||
452 | * Now delete all active aggregation sessions. | ||
453 | */ | ||
454 | rcu_read_lock(); | ||
455 | |||
456 | list_for_each_entry_rcu(sta, &local->sta_list, list) { | ||
457 | if (sta->sdata == sdata) | ||
458 | ieee80211_sta_tear_down_BA_sessions(sdata, sta->addr); | ||
459 | } | ||
460 | |||
461 | rcu_read_unlock(); | ||
462 | |||
463 | /* | ||
464 | * Remove all stations associated with this interface. | ||
465 | * | ||
466 | * This must be done before calling ops->remove_interface() | ||
467 | * because otherwise we can later invoke ops->sta_notify() | ||
468 | * whenever the STAs are removed, and that invalidates driver | ||
469 | * assumptions about always getting a vif pointer that is valid | ||
470 | * (because if we remove a STA after ops->remove_interface() | ||
471 | * the driver will have removed the vif info already!) | ||
472 | * | ||
473 | * We could relax this and only unlink the stations from the | ||
474 | * hash table and list but keep them on a per-sdata list that | ||
475 | * will be inserted back again when the interface is brought | ||
476 | * up again, but I don't currently see a use case for that, | ||
477 | * except with WDS which gets a STA entry created when it is | ||
478 | * brought up. | ||
479 | */ | ||
480 | sta_info_flush(local, sdata); | ||
481 | |||
482 | /* | ||
483 | * Don't count this interface for promisc/allmulti while it | ||
484 | * is down. dev_mc_unsync() will invoke set_multicast_list | ||
485 | * on the master interface which will sync these down to the | ||
486 | * hardware as filter flags. | ||
487 | */ | ||
488 | if (sdata->flags & IEEE80211_SDATA_ALLMULTI) | ||
489 | atomic_dec(&local->iff_allmultis); | ||
490 | |||
491 | if (sdata->flags & IEEE80211_SDATA_PROMISC) | ||
492 | atomic_dec(&local->iff_promiscs); | ||
493 | |||
494 | dev_mc_unsync(local->mdev, dev); | ||
495 | |||
496 | /* APs need special treatment */ | ||
497 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | ||
498 | struct ieee80211_sub_if_data *vlan, *tmp; | ||
499 | struct beacon_data *old_beacon = sdata->u.ap.beacon; | ||
500 | |||
501 | /* remove beacon */ | ||
502 | rcu_assign_pointer(sdata->u.ap.beacon, NULL); | ||
503 | synchronize_rcu(); | ||
504 | kfree(old_beacon); | ||
505 | |||
506 | /* down all dependent devices, that is VLANs */ | ||
507 | list_for_each_entry_safe(vlan, tmp, &sdata->u.ap.vlans, | ||
508 | u.vlan.list) | ||
509 | dev_close(vlan->dev); | ||
510 | WARN_ON(!list_empty(&sdata->u.ap.vlans)); | ||
511 | } | ||
512 | |||
513 | local->open_count--; | ||
514 | |||
515 | switch (sdata->vif.type) { | ||
516 | case IEEE80211_IF_TYPE_VLAN: | ||
517 | list_del(&sdata->u.vlan.list); | ||
518 | /* no need to tell driver */ | ||
519 | break; | ||
520 | case IEEE80211_IF_TYPE_MNTR: | ||
521 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { | ||
522 | local->cooked_mntrs--; | ||
523 | break; | ||
524 | } | ||
525 | |||
526 | local->monitors--; | ||
527 | if (local->monitors == 0) | ||
528 | local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP; | ||
529 | |||
530 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | ||
531 | local->fif_fcsfail--; | ||
532 | if (sdata->u.mntr_flags & MONITOR_FLAG_PLCPFAIL) | ||
533 | local->fif_plcpfail--; | ||
534 | if (sdata->u.mntr_flags & MONITOR_FLAG_CONTROL) | ||
535 | local->fif_control--; | ||
536 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) | ||
537 | local->fif_other_bss--; | ||
538 | |||
539 | netif_addr_lock_bh(local->mdev); | ||
540 | ieee80211_configure_filter(local); | ||
541 | netif_addr_unlock_bh(local->mdev); | ||
542 | break; | ||
543 | case IEEE80211_IF_TYPE_MESH_POINT: | ||
544 | /* allmulti is always set on mesh ifaces */ | ||
545 | atomic_dec(&local->iff_allmultis); | ||
546 | /* fall through */ | ||
547 | case IEEE80211_IF_TYPE_STA: | ||
548 | case IEEE80211_IF_TYPE_IBSS: | ||
549 | sdata->u.sta.state = IEEE80211_STA_MLME_DISABLED; | ||
550 | memset(sdata->u.sta.bssid, 0, ETH_ALEN); | ||
551 | del_timer_sync(&sdata->u.sta.timer); | ||
552 | /* | ||
553 | * When we get here, the interface is marked down. | ||
554 | * Call synchronize_rcu() to wait for the RX path | ||
555 | * should it be using the interface and enqueuing | ||
556 | * frames at this very time on another CPU. | ||
557 | */ | ||
558 | synchronize_rcu(); | ||
559 | skb_queue_purge(&sdata->u.sta.skb_queue); | ||
560 | |||
561 | if (local->scan_sdata == sdata) { | ||
562 | if (!local->ops->hw_scan) { | ||
563 | local->sta_sw_scanning = 0; | ||
564 | cancel_delayed_work(&local->scan_work); | ||
565 | } else | ||
566 | local->sta_hw_scanning = 0; | ||
567 | } | ||
568 | |||
569 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; | ||
570 | kfree(sdata->u.sta.extra_ie); | ||
571 | sdata->u.sta.extra_ie = NULL; | ||
572 | sdata->u.sta.extra_ie_len = 0; | ||
573 | /* fall through */ | ||
574 | default: | ||
575 | conf.vif = &sdata->vif; | ||
576 | conf.type = sdata->vif.type; | ||
577 | conf.mac_addr = dev->dev_addr; | ||
578 | /* disable all keys for as long as this netdev is down */ | ||
579 | ieee80211_disable_keys(sdata); | ||
580 | local->ops->remove_interface(local_to_hw(local), &conf); | ||
581 | } | ||
582 | |||
583 | sdata->bss = NULL; | ||
584 | |||
585 | if (local->open_count == 0) { | ||
586 | if (netif_running(local->mdev)) | ||
587 | dev_close(local->mdev); | ||
588 | |||
589 | if (local->ops->stop) | ||
590 | local->ops->stop(local_to_hw(local)); | ||
591 | |||
592 | ieee80211_led_radio(local, 0); | ||
593 | |||
594 | flush_workqueue(local->hw.workqueue); | ||
595 | |||
596 | tasklet_disable(&local->tx_pending_tasklet); | ||
597 | tasklet_disable(&local->tasklet); | ||
598 | } | ||
599 | |||
600 | return 0; | ||
601 | } | ||
602 | |||
603 | static void ieee80211_set_multicast_list(struct net_device *dev) | ||
604 | { | ||
605 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
606 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
607 | int allmulti, promisc, sdata_allmulti, sdata_promisc; | ||
608 | |||
609 | allmulti = !!(dev->flags & IFF_ALLMULTI); | ||
610 | promisc = !!(dev->flags & IFF_PROMISC); | ||
611 | sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI); | ||
612 | sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC); | ||
613 | |||
614 | if (allmulti != sdata_allmulti) { | ||
615 | if (dev->flags & IFF_ALLMULTI) | ||
616 | atomic_inc(&local->iff_allmultis); | ||
617 | else | ||
618 | atomic_dec(&local->iff_allmultis); | ||
619 | sdata->flags ^= IEEE80211_SDATA_ALLMULTI; | ||
620 | } | ||
621 | |||
622 | if (promisc != sdata_promisc) { | ||
623 | if (dev->flags & IFF_PROMISC) | ||
624 | atomic_inc(&local->iff_promiscs); | ||
625 | else | ||
626 | atomic_dec(&local->iff_promiscs); | ||
627 | sdata->flags ^= IEEE80211_SDATA_PROMISC; | ||
628 | } | ||
629 | |||
630 | dev_mc_sync(local->mdev, dev); | ||
631 | } | ||
632 | |||
633 | static const struct header_ops ieee80211_header_ops = { | ||
634 | .create = eth_header, | ||
635 | .parse = header_parse_80211, | ||
636 | .rebuild = eth_rebuild_header, | ||
637 | .cache = eth_header_cache, | ||
638 | .cache_update = eth_header_cache_update, | ||
639 | }; | ||
640 | |||
641 | void ieee80211_if_setup(struct net_device *dev) | ||
642 | { | ||
643 | ether_setup(dev); | ||
644 | dev->hard_start_xmit = ieee80211_subif_start_xmit; | ||
645 | dev->wireless_handlers = &ieee80211_iw_handler_def; | ||
646 | dev->set_multicast_list = ieee80211_set_multicast_list; | ||
647 | dev->change_mtu = ieee80211_change_mtu; | ||
648 | dev->open = ieee80211_open; | ||
649 | dev->stop = ieee80211_stop; | ||
650 | dev->destructor = free_netdev; | ||
651 | /* we will validate the address ourselves in ->open */ | ||
652 | dev->validate_addr = NULL; | ||
653 | } | ||
654 | |||
655 | /* everything else */ | 149 | /* everything else */ |
656 | 150 | ||
657 | int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed) | 151 | int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed) |
@@ -662,18 +156,21 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed) | |||
662 | if (WARN_ON(!netif_running(sdata->dev))) | 156 | if (WARN_ON(!netif_running(sdata->dev))) |
663 | return 0; | 157 | return 0; |
664 | 158 | ||
159 | if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) | ||
160 | return -EINVAL; | ||
161 | |||
665 | if (!local->ops->config_interface) | 162 | if (!local->ops->config_interface) |
666 | return 0; | 163 | return 0; |
667 | 164 | ||
668 | memset(&conf, 0, sizeof(conf)); | 165 | memset(&conf, 0, sizeof(conf)); |
669 | conf.changed = changed; | 166 | conf.changed = changed; |
670 | 167 | ||
671 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 168 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
672 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 169 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
673 | conf.bssid = sdata->u.sta.bssid; | 170 | conf.bssid = sdata->u.sta.bssid; |
674 | conf.ssid = sdata->u.sta.ssid; | 171 | conf.ssid = sdata->u.sta.ssid; |
675 | conf.ssid_len = sdata->u.sta.ssid_len; | 172 | conf.ssid_len = sdata->u.sta.ssid_len; |
676 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 173 | } else if (sdata->vif.type == NL80211_IFTYPE_AP) { |
677 | conf.bssid = sdata->dev->dev_addr; | 174 | conf.bssid = sdata->dev->dev_addr; |
678 | conf.ssid = sdata->u.ap.ssid; | 175 | conf.ssid = sdata->u.ap.ssid; |
679 | conf.ssid_len = sdata->u.ap.ssid_len; | 176 | conf.ssid_len = sdata->u.ap.ssid_len; |
@@ -702,7 +199,7 @@ int ieee80211_hw_config(struct ieee80211_local *local) | |||
702 | struct ieee80211_channel *chan; | 199 | struct ieee80211_channel *chan; |
703 | int ret = 0; | 200 | int ret = 0; |
704 | 201 | ||
705 | if (local->sta_sw_scanning) | 202 | if (local->sw_scanning) |
706 | chan = local->scan_channel; | 203 | chan = local->scan_channel; |
707 | else | 204 | else |
708 | chan = local->oper_channel; | 205 | chan = local->oper_channel; |
@@ -827,6 +324,9 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
827 | { | 324 | { |
828 | struct ieee80211_local *local = sdata->local; | 325 | struct ieee80211_local *local = sdata->local; |
829 | 326 | ||
327 | if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) | ||
328 | return; | ||
329 | |||
830 | if (!changed) | 330 | if (!changed) |
831 | return; | 331 | return; |
832 | 332 | ||
@@ -1046,29 +546,27 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1046 | 546 | ||
1047 | rcu_read_lock(); | 547 | rcu_read_lock(); |
1048 | 548 | ||
1049 | if (info->status.excessive_retries) { | 549 | sta = sta_info_get(local, hdr->addr1); |
1050 | sta = sta_info_get(local, hdr->addr1); | 550 | |
1051 | if (sta) { | 551 | if (sta) { |
1052 | if (test_sta_flags(sta, WLAN_STA_PS)) { | 552 | if (info->status.excessive_retries && |
1053 | /* | 553 | test_sta_flags(sta, WLAN_STA_PS)) { |
1054 | * The STA is in power save mode, so assume | 554 | /* |
1055 | * that this TX packet failed because of that. | 555 | * The STA is in power save mode, so assume |
1056 | */ | 556 | * that this TX packet failed because of that. |
1057 | ieee80211_handle_filtered_frame(local, sta, skb); | 557 | */ |
1058 | rcu_read_unlock(); | 558 | ieee80211_handle_filtered_frame(local, sta, skb); |
1059 | return; | 559 | rcu_read_unlock(); |
1060 | } | 560 | return; |
1061 | } | 561 | } |
1062 | } | ||
1063 | 562 | ||
1064 | fc = hdr->frame_control; | 563 | fc = hdr->frame_control; |
564 | |||
565 | if ((info->flags & IEEE80211_TX_STAT_AMPDU_NO_BACK) && | ||
566 | (ieee80211_is_data_qos(fc))) { | ||
567 | u16 tid, ssn; | ||
568 | u8 *qc; | ||
1065 | 569 | ||
1066 | if ((info->flags & IEEE80211_TX_STAT_AMPDU_NO_BACK) && | ||
1067 | (ieee80211_is_data_qos(fc))) { | ||
1068 | u16 tid, ssn; | ||
1069 | u8 *qc; | ||
1070 | sta = sta_info_get(local, hdr->addr1); | ||
1071 | if (sta) { | ||
1072 | qc = ieee80211_get_qos_ctl(hdr); | 570 | qc = ieee80211_get_qos_ctl(hdr); |
1073 | tid = qc[0] & 0xf; | 571 | tid = qc[0] & 0xf; |
1074 | ssn = ((le16_to_cpu(hdr->seq_ctrl) + 0x10) | 572 | ssn = ((le16_to_cpu(hdr->seq_ctrl) + 0x10) |
@@ -1076,17 +574,19 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1076 | ieee80211_send_bar(sta->sdata, hdr->addr1, | 574 | ieee80211_send_bar(sta->sdata, hdr->addr1, |
1077 | tid, ssn); | 575 | tid, ssn); |
1078 | } | 576 | } |
1079 | } | ||
1080 | 577 | ||
1081 | if (info->flags & IEEE80211_TX_STAT_TX_FILTERED) { | 578 | if (info->flags & IEEE80211_TX_STAT_TX_FILTERED) { |
1082 | sta = sta_info_get(local, hdr->addr1); | ||
1083 | if (sta) { | ||
1084 | ieee80211_handle_filtered_frame(local, sta, skb); | 579 | ieee80211_handle_filtered_frame(local, sta, skb); |
1085 | rcu_read_unlock(); | 580 | rcu_read_unlock(); |
1086 | return; | 581 | return; |
582 | } else { | ||
583 | if (info->status.excessive_retries) | ||
584 | sta->tx_retry_failed++; | ||
585 | sta->tx_retry_count += info->status.retry_count; | ||
1087 | } | 586 | } |
1088 | } else | 587 | |
1089 | rate_control_tx_status(local->mdev, skb); | 588 | rate_control_tx_status(local->mdev, skb); |
589 | } | ||
1090 | 590 | ||
1091 | rcu_read_unlock(); | 591 | rcu_read_unlock(); |
1092 | 592 | ||
@@ -1174,7 +674,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1174 | 674 | ||
1175 | rcu_read_lock(); | 675 | rcu_read_lock(); |
1176 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 676 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
1177 | if (sdata->vif.type == IEEE80211_IF_TYPE_MNTR) { | 677 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { |
1178 | if (!netif_running(sdata->dev)) | 678 | if (!netif_running(sdata->dev)) |
1179 | continue; | 679 | continue; |
1180 | 680 | ||
@@ -1250,8 +750,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
1250 | 750 | ||
1251 | local->hw.queues = 1; /* default */ | 751 | local->hw.queues = 1; /* default */ |
1252 | 752 | ||
1253 | local->bridge_packets = 1; | ||
1254 | |||
1255 | local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; | 753 | local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; |
1256 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; | 754 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; |
1257 | local->short_retry_limit = 7; | 755 | local->short_retry_limit = 7; |
@@ -1262,7 +760,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
1262 | 760 | ||
1263 | spin_lock_init(&local->key_lock); | 761 | spin_lock_init(&local->key_lock); |
1264 | 762 | ||
1265 | INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work); | 763 | INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work); |
1266 | 764 | ||
1267 | sta_info_init(local); | 765 | sta_info_init(local); |
1268 | 766 | ||
@@ -1422,7 +920,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
1422 | 920 | ||
1423 | /* add one default STA interface */ | 921 | /* add one default STA interface */ |
1424 | result = ieee80211_if_add(local, "wlan%d", NULL, | 922 | result = ieee80211_if_add(local, "wlan%d", NULL, |
1425 | IEEE80211_IF_TYPE_STA, NULL); | 923 | NL80211_IFTYPE_STATION, NULL); |
1426 | if (result) | 924 | if (result) |
1427 | printk(KERN_WARNING "%s: Failed to add default virtual iface\n", | 925 | printk(KERN_WARNING "%s: Failed to add default virtual iface\n", |
1428 | wiphy_name(local->hw.wiphy)); | 926 | wiphy_name(local->hw.wiphy)); |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 3ccb3599c04f..30cf891fd3a8 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -12,6 +12,9 @@ | |||
12 | #include "ieee80211_i.h" | 12 | #include "ieee80211_i.h" |
13 | #include "mesh.h" | 13 | #include "mesh.h" |
14 | 14 | ||
15 | #define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ) | ||
16 | #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) | ||
17 | |||
15 | #define PP_OFFSET 1 /* Path Selection Protocol */ | 18 | #define PP_OFFSET 1 /* Path Selection Protocol */ |
16 | #define PM_OFFSET 5 /* Path Selection Metric */ | 19 | #define PM_OFFSET 5 /* Path Selection Metric */ |
17 | #define CC_OFFSET 9 /* Congestion Control Mode */ | 20 | #define CC_OFFSET 9 /* Congestion Control Mode */ |
@@ -35,6 +38,16 @@ void ieee80211s_stop(void) | |||
35 | kmem_cache_destroy(rm_cache); | 38 | kmem_cache_destroy(rm_cache); |
36 | } | 39 | } |
37 | 40 | ||
41 | static void ieee80211_mesh_housekeeping_timer(unsigned long data) | ||
42 | { | ||
43 | struct ieee80211_sub_if_data *sdata = (void *) data; | ||
44 | struct ieee80211_local *local = sdata->local; | ||
45 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | ||
46 | |||
47 | ifmsh->housekeeping = true; | ||
48 | queue_work(local->hw.workqueue, &ifmsh->work); | ||
49 | } | ||
50 | |||
38 | /** | 51 | /** |
39 | * mesh_matches_local - check if the config of a mesh point matches ours | 52 | * mesh_matches_local - check if the config of a mesh point matches ours |
40 | * | 53 | * |
@@ -46,7 +59,7 @@ void ieee80211s_stop(void) | |||
46 | */ | 59 | */ |
47 | bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_data *sdata) | 60 | bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_data *sdata) |
48 | { | 61 | { |
49 | struct ieee80211_if_sta *sta = &sdata->u.sta; | 62 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
50 | 63 | ||
51 | /* | 64 | /* |
52 | * As support for each feature is added, check for matching | 65 | * As support for each feature is added, check for matching |
@@ -58,11 +71,11 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat | |||
58 | * - MDA enabled | 71 | * - MDA enabled |
59 | * - Power management control on fc | 72 | * - Power management control on fc |
60 | */ | 73 | */ |
61 | if (sta->mesh_id_len == ie->mesh_id_len && | 74 | if (ifmsh->mesh_id_len == ie->mesh_id_len && |
62 | memcmp(sta->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 && | 75 | memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 && |
63 | memcmp(sta->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 && | 76 | memcmp(ifmsh->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 && |
64 | memcmp(sta->mesh_pm_id, ie->mesh_config + PM_OFFSET, 4) == 0 && | 77 | memcmp(ifmsh->mesh_pm_id, ie->mesh_config + PM_OFFSET, 4) == 0 && |
65 | memcmp(sta->mesh_cc_id, ie->mesh_config + CC_OFFSET, 4) == 0) | 78 | memcmp(ifmsh->mesh_cc_id, ie->mesh_config + CC_OFFSET, 4) == 0) |
66 | return true; | 79 | return true; |
67 | 80 | ||
68 | return false; | 81 | return false; |
@@ -95,11 +108,11 @@ void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata) | |||
95 | */ | 108 | */ |
96 | free_plinks = mesh_plink_availables(sdata); | 109 | free_plinks = mesh_plink_availables(sdata); |
97 | 110 | ||
98 | if (free_plinks != sdata->u.sta.accepting_plinks) | 111 | if (free_plinks != sdata->u.mesh.accepting_plinks) |
99 | ieee80211_sta_timer((unsigned long) sdata); | 112 | ieee80211_mesh_housekeeping_timer((unsigned long) sdata); |
100 | } | 113 | } |
101 | 114 | ||
102 | void mesh_ids_set_default(struct ieee80211_if_sta *sta) | 115 | void mesh_ids_set_default(struct ieee80211_if_mesh *sta) |
103 | { | 116 | { |
104 | u8 def_id[4] = {0x00, 0x0F, 0xAC, 0xff}; | 117 | u8 def_id[4] = {0x00, 0x0F, 0xAC, 0xff}; |
105 | 118 | ||
@@ -112,22 +125,22 @@ int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) | |||
112 | { | 125 | { |
113 | int i; | 126 | int i; |
114 | 127 | ||
115 | sdata->u.sta.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL); | 128 | sdata->u.mesh.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL); |
116 | if (!sdata->u.sta.rmc) | 129 | if (!sdata->u.mesh.rmc) |
117 | return -ENOMEM; | 130 | return -ENOMEM; |
118 | sdata->u.sta.rmc->idx_mask = RMC_BUCKETS - 1; | 131 | sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1; |
119 | for (i = 0; i < RMC_BUCKETS; i++) | 132 | for (i = 0; i < RMC_BUCKETS; i++) |
120 | INIT_LIST_HEAD(&sdata->u.sta.rmc->bucket[i].list); | 133 | INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i].list); |
121 | return 0; | 134 | return 0; |
122 | } | 135 | } |
123 | 136 | ||
124 | void mesh_rmc_free(struct ieee80211_sub_if_data *sdata) | 137 | void mesh_rmc_free(struct ieee80211_sub_if_data *sdata) |
125 | { | 138 | { |
126 | struct mesh_rmc *rmc = sdata->u.sta.rmc; | 139 | struct mesh_rmc *rmc = sdata->u.mesh.rmc; |
127 | struct rmc_entry *p, *n; | 140 | struct rmc_entry *p, *n; |
128 | int i; | 141 | int i; |
129 | 142 | ||
130 | if (!sdata->u.sta.rmc) | 143 | if (!sdata->u.mesh.rmc) |
131 | return; | 144 | return; |
132 | 145 | ||
133 | for (i = 0; i < RMC_BUCKETS; i++) | 146 | for (i = 0; i < RMC_BUCKETS; i++) |
@@ -137,7 +150,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata) | |||
137 | } | 150 | } |
138 | 151 | ||
139 | kfree(rmc); | 152 | kfree(rmc); |
140 | sdata->u.sta.rmc = NULL; | 153 | sdata->u.mesh.rmc = NULL; |
141 | } | 154 | } |
142 | 155 | ||
143 | /** | 156 | /** |
@@ -155,7 +168,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata) | |||
155 | int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, | 168 | int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, |
156 | struct ieee80211_sub_if_data *sdata) | 169 | struct ieee80211_sub_if_data *sdata) |
157 | { | 170 | { |
158 | struct mesh_rmc *rmc = sdata->u.sta.rmc; | 171 | struct mesh_rmc *rmc = sdata->u.mesh.rmc; |
159 | u32 seqnum = 0; | 172 | u32 seqnum = 0; |
160 | int entries = 0; | 173 | int entries = 0; |
161 | u8 idx; | 174 | u8 idx; |
@@ -217,11 +230,11 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
217 | } | 230 | } |
218 | } | 231 | } |
219 | 232 | ||
220 | pos = skb_put(skb, 2 + sdata->u.sta.mesh_id_len); | 233 | pos = skb_put(skb, 2 + sdata->u.mesh.mesh_id_len); |
221 | *pos++ = WLAN_EID_MESH_ID; | 234 | *pos++ = WLAN_EID_MESH_ID; |
222 | *pos++ = sdata->u.sta.mesh_id_len; | 235 | *pos++ = sdata->u.mesh.mesh_id_len; |
223 | if (sdata->u.sta.mesh_id_len) | 236 | if (sdata->u.mesh.mesh_id_len) |
224 | memcpy(pos, sdata->u.sta.mesh_id, sdata->u.sta.mesh_id_len); | 237 | memcpy(pos, sdata->u.mesh.mesh_id, sdata->u.mesh.mesh_id_len); |
225 | 238 | ||
226 | pos = skb_put(skb, 21); | 239 | pos = skb_put(skb, 21); |
227 | *pos++ = WLAN_EID_MESH_CONFIG; | 240 | *pos++ = WLAN_EID_MESH_CONFIG; |
@@ -230,15 +243,15 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
230 | *pos++ = 1; | 243 | *pos++ = 1; |
231 | 244 | ||
232 | /* Active path selection protocol ID */ | 245 | /* Active path selection protocol ID */ |
233 | memcpy(pos, sdata->u.sta.mesh_pp_id, 4); | 246 | memcpy(pos, sdata->u.mesh.mesh_pp_id, 4); |
234 | pos += 4; | 247 | pos += 4; |
235 | 248 | ||
236 | /* Active path selection metric ID */ | 249 | /* Active path selection metric ID */ |
237 | memcpy(pos, sdata->u.sta.mesh_pm_id, 4); | 250 | memcpy(pos, sdata->u.mesh.mesh_pm_id, 4); |
238 | pos += 4; | 251 | pos += 4; |
239 | 252 | ||
240 | /* Congestion control mode identifier */ | 253 | /* Congestion control mode identifier */ |
241 | memcpy(pos, sdata->u.sta.mesh_cc_id, 4); | 254 | memcpy(pos, sdata->u.mesh.mesh_cc_id, 4); |
242 | pos += 4; | 255 | pos += 4; |
243 | 256 | ||
244 | /* Channel precedence: | 257 | /* Channel precedence: |
@@ -248,8 +261,8 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
248 | pos += 4; | 261 | pos += 4; |
249 | 262 | ||
250 | /* Mesh capability */ | 263 | /* Mesh capability */ |
251 | sdata->u.sta.accepting_plinks = mesh_plink_availables(sdata); | 264 | sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata); |
252 | *pos++ = sdata->u.sta.accepting_plinks ? ACCEPT_PLINKS : 0x00; | 265 | *pos++ = sdata->u.mesh.accepting_plinks ? ACCEPT_PLINKS : 0x00; |
253 | *pos++ = 0x00; | 266 | *pos++ = 0x00; |
254 | 267 | ||
255 | return; | 268 | return; |
@@ -337,10 +350,10 @@ static void ieee80211_mesh_path_timer(unsigned long data) | |||
337 | { | 350 | { |
338 | struct ieee80211_sub_if_data *sdata = | 351 | struct ieee80211_sub_if_data *sdata = |
339 | (struct ieee80211_sub_if_data *) data; | 352 | (struct ieee80211_sub_if_data *) data; |
340 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 353 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
341 | struct ieee80211_local *local = wdev_priv(&sdata->wdev); | 354 | struct ieee80211_local *local = wdev_priv(&sdata->wdev); |
342 | 355 | ||
343 | queue_work(local->hw.workqueue, &ifsta->work); | 356 | queue_work(local->hw.workqueue, &ifmsh->work); |
344 | } | 357 | } |
345 | 358 | ||
346 | struct mesh_table *mesh_table_grow(struct mesh_table *tbl) | 359 | struct mesh_table *mesh_table_grow(struct mesh_table *tbl) |
@@ -392,50 +405,264 @@ int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr, | |||
392 | struct ieee80211_sub_if_data *sdata) | 405 | struct ieee80211_sub_if_data *sdata) |
393 | { | 406 | { |
394 | meshhdr->flags = 0; | 407 | meshhdr->flags = 0; |
395 | meshhdr->ttl = sdata->u.sta.mshcfg.dot11MeshTTL; | 408 | meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; |
396 | put_unaligned(cpu_to_le32(sdata->u.sta.mesh_seqnum), &meshhdr->seqnum); | 409 | put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &meshhdr->seqnum); |
397 | sdata->u.sta.mesh_seqnum++; | 410 | sdata->u.mesh.mesh_seqnum++; |
398 | 411 | ||
399 | return 6; | 412 | return 6; |
400 | } | 413 | } |
401 | 414 | ||
415 | static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, | ||
416 | struct ieee80211_if_mesh *ifmsh) | ||
417 | { | ||
418 | bool free_plinks; | ||
419 | |||
420 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
421 | printk(KERN_DEBUG "%s: running mesh housekeeping\n", | ||
422 | sdata->dev->name); | ||
423 | #endif | ||
424 | |||
425 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); | ||
426 | mesh_path_expire(sdata); | ||
427 | |||
428 | free_plinks = mesh_plink_availables(sdata); | ||
429 | if (free_plinks != sdata->u.mesh.accepting_plinks) | ||
430 | ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | ||
431 | |||
432 | ifmsh->housekeeping = false; | ||
433 | mod_timer(&ifmsh->housekeeping_timer, | ||
434 | round_jiffies(jiffies + IEEE80211_MESH_HOUSEKEEPING_INTERVAL)); | ||
435 | } | ||
436 | |||
437 | |||
438 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) | ||
439 | { | ||
440 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | ||
441 | struct ieee80211_local *local = sdata->local; | ||
442 | |||
443 | ifmsh->housekeeping = true; | ||
444 | queue_work(local->hw.workqueue, &ifmsh->work); | ||
445 | ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | ||
446 | } | ||
447 | |||
448 | void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) | ||
449 | { | ||
450 | del_timer_sync(&sdata->u.mesh.housekeeping_timer); | ||
451 | /* | ||
452 | * If the timer fired while we waited for it, it will have | ||
453 | * requeued the work. Now the work will be running again | ||
454 | * but will not rearm the timer again because it checks | ||
455 | * whether the interface is running, which, at this point, | ||
456 | * it no longer is. | ||
457 | */ | ||
458 | cancel_work_sync(&sdata->u.mesh.work); | ||
459 | |||
460 | /* | ||
461 | * When we get here, the interface is marked down. | ||
462 | * Call synchronize_rcu() to wait for the RX path | ||
463 | * should it be using the interface and enqueuing | ||
464 | * frames at this very time on another CPU. | ||
465 | */ | ||
466 | synchronize_rcu(); | ||
467 | skb_queue_purge(&sdata->u.mesh.skb_queue); | ||
468 | } | ||
469 | |||
470 | static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | ||
471 | u16 stype, | ||
472 | struct ieee80211_mgmt *mgmt, | ||
473 | size_t len, | ||
474 | struct ieee80211_rx_status *rx_status) | ||
475 | { | ||
476 | struct ieee80211_local *local= sdata->local; | ||
477 | struct ieee802_11_elems elems; | ||
478 | struct ieee80211_channel *channel; | ||
479 | u64 supp_rates = 0; | ||
480 | size_t baselen; | ||
481 | int freq; | ||
482 | enum ieee80211_band band = rx_status->band; | ||
483 | |||
484 | /* ignore ProbeResp to foreign address */ | ||
485 | if (stype == IEEE80211_STYPE_PROBE_RESP && | ||
486 | compare_ether_addr(mgmt->da, sdata->dev->dev_addr)) | ||
487 | return; | ||
488 | |||
489 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; | ||
490 | if (baselen > len) | ||
491 | return; | ||
492 | |||
493 | ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, | ||
494 | &elems); | ||
495 | |||
496 | if (elems.ds_params && elems.ds_params_len == 1) | ||
497 | freq = ieee80211_channel_to_frequency(elems.ds_params[0]); | ||
498 | else | ||
499 | freq = rx_status->freq; | ||
500 | |||
501 | channel = ieee80211_get_channel(local->hw.wiphy, freq); | ||
502 | |||
503 | if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) | ||
504 | return; | ||
505 | |||
506 | if (elems.mesh_id && elems.mesh_config && | ||
507 | mesh_matches_local(&elems, sdata)) { | ||
508 | supp_rates = ieee80211_sta_get_rates(local, &elems, band); | ||
509 | |||
510 | mesh_neighbour_update(mgmt->sa, supp_rates, sdata, | ||
511 | mesh_peer_accepts_plinks(&elems)); | ||
512 | } | ||
513 | } | ||
514 | |||
515 | static void ieee80211_mesh_rx_mgmt_action(struct ieee80211_sub_if_data *sdata, | ||
516 | struct ieee80211_mgmt *mgmt, | ||
517 | size_t len, | ||
518 | struct ieee80211_rx_status *rx_status) | ||
519 | { | ||
520 | switch (mgmt->u.action.category) { | ||
521 | case PLINK_CATEGORY: | ||
522 | mesh_rx_plink_frame(sdata, mgmt, len, rx_status); | ||
523 | break; | ||
524 | case MESH_PATH_SEL_CATEGORY: | ||
525 | mesh_rx_path_sel_frame(sdata, mgmt, len); | ||
526 | break; | ||
527 | } | ||
528 | } | ||
529 | |||
530 | static void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | ||
531 | struct sk_buff *skb) | ||
532 | { | ||
533 | struct ieee80211_rx_status *rx_status; | ||
534 | struct ieee80211_if_mesh *ifmsh; | ||
535 | struct ieee80211_mgmt *mgmt; | ||
536 | u16 stype; | ||
537 | |||
538 | ifmsh = &sdata->u.mesh; | ||
539 | |||
540 | rx_status = (struct ieee80211_rx_status *) skb->cb; | ||
541 | mgmt = (struct ieee80211_mgmt *) skb->data; | ||
542 | stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE; | ||
543 | |||
544 | switch (stype) { | ||
545 | case IEEE80211_STYPE_PROBE_RESP: | ||
546 | case IEEE80211_STYPE_BEACON: | ||
547 | ieee80211_mesh_rx_bcn_presp(sdata, stype, mgmt, skb->len, | ||
548 | rx_status); | ||
549 | break; | ||
550 | case IEEE80211_STYPE_ACTION: | ||
551 | ieee80211_mesh_rx_mgmt_action(sdata, mgmt, skb->len, rx_status); | ||
552 | break; | ||
553 | } | ||
554 | |||
555 | kfree_skb(skb); | ||
556 | } | ||
557 | |||
558 | static void ieee80211_mesh_work(struct work_struct *work) | ||
559 | { | ||
560 | struct ieee80211_sub_if_data *sdata = | ||
561 | container_of(work, struct ieee80211_sub_if_data, u.mesh.work); | ||
562 | struct ieee80211_local *local = sdata->local; | ||
563 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | ||
564 | struct sk_buff *skb; | ||
565 | |||
566 | if (!netif_running(sdata->dev)) | ||
567 | return; | ||
568 | |||
569 | if (local->sw_scanning || local->hw_scanning) | ||
570 | return; | ||
571 | |||
572 | while ((skb = skb_dequeue(&ifmsh->skb_queue))) | ||
573 | ieee80211_mesh_rx_queued_mgmt(sdata, skb); | ||
574 | |||
575 | if (ifmsh->preq_queue_len && | ||
576 | time_after(jiffies, | ||
577 | ifmsh->last_preq + msecs_to_jiffies(ifmsh->mshcfg.dot11MeshHWMPpreqMinInterval))) | ||
578 | mesh_path_start_discovery(sdata); | ||
579 | |||
580 | if (ifmsh->housekeeping) | ||
581 | ieee80211_mesh_housekeeping(sdata, ifmsh); | ||
582 | } | ||
583 | |||
584 | void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) | ||
585 | { | ||
586 | struct ieee80211_sub_if_data *sdata; | ||
587 | |||
588 | rcu_read_lock(); | ||
589 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | ||
590 | if (ieee80211_vif_is_mesh(&sdata->vif)) | ||
591 | queue_work(local->hw.workqueue, &sdata->u.mesh.work); | ||
592 | rcu_read_unlock(); | ||
593 | } | ||
594 | |||
402 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) | 595 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) |
403 | { | 596 | { |
404 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 597 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
405 | 598 | ||
406 | ifsta->mshcfg.dot11MeshRetryTimeout = MESH_RET_T; | 599 | INIT_WORK(&ifmsh->work, ieee80211_mesh_work); |
407 | ifsta->mshcfg.dot11MeshConfirmTimeout = MESH_CONF_T; | 600 | setup_timer(&ifmsh->housekeeping_timer, |
408 | ifsta->mshcfg.dot11MeshHoldingTimeout = MESH_HOLD_T; | 601 | ieee80211_mesh_housekeeping_timer, |
409 | ifsta->mshcfg.dot11MeshMaxRetries = MESH_MAX_RETR; | 602 | (unsigned long) sdata); |
410 | ifsta->mshcfg.dot11MeshTTL = MESH_TTL; | 603 | skb_queue_head_init(&sdata->u.mesh.skb_queue); |
411 | ifsta->mshcfg.auto_open_plinks = true; | 604 | |
412 | ifsta->mshcfg.dot11MeshMaxPeerLinks = | 605 | ifmsh->mshcfg.dot11MeshRetryTimeout = MESH_RET_T; |
606 | ifmsh->mshcfg.dot11MeshConfirmTimeout = MESH_CONF_T; | ||
607 | ifmsh->mshcfg.dot11MeshHoldingTimeout = MESH_HOLD_T; | ||
608 | ifmsh->mshcfg.dot11MeshMaxRetries = MESH_MAX_RETR; | ||
609 | ifmsh->mshcfg.dot11MeshTTL = MESH_TTL; | ||
610 | ifmsh->mshcfg.auto_open_plinks = true; | ||
611 | ifmsh->mshcfg.dot11MeshMaxPeerLinks = | ||
413 | MESH_MAX_ESTAB_PLINKS; | 612 | MESH_MAX_ESTAB_PLINKS; |
414 | ifsta->mshcfg.dot11MeshHWMPactivePathTimeout = | 613 | ifmsh->mshcfg.dot11MeshHWMPactivePathTimeout = |
415 | MESH_PATH_TIMEOUT; | 614 | MESH_PATH_TIMEOUT; |
416 | ifsta->mshcfg.dot11MeshHWMPpreqMinInterval = | 615 | ifmsh->mshcfg.dot11MeshHWMPpreqMinInterval = |
417 | MESH_PREQ_MIN_INT; | 616 | MESH_PREQ_MIN_INT; |
418 | ifsta->mshcfg.dot11MeshHWMPnetDiameterTraversalTime = | 617 | ifmsh->mshcfg.dot11MeshHWMPnetDiameterTraversalTime = |
419 | MESH_DIAM_TRAVERSAL_TIME; | 618 | MESH_DIAM_TRAVERSAL_TIME; |
420 | ifsta->mshcfg.dot11MeshHWMPmaxPREQretries = | 619 | ifmsh->mshcfg.dot11MeshHWMPmaxPREQretries = |
421 | MESH_MAX_PREQ_RETRIES; | 620 | MESH_MAX_PREQ_RETRIES; |
422 | ifsta->mshcfg.path_refresh_time = | 621 | ifmsh->mshcfg.path_refresh_time = |
423 | MESH_PATH_REFRESH_TIME; | 622 | MESH_PATH_REFRESH_TIME; |
424 | ifsta->mshcfg.min_discovery_timeout = | 623 | ifmsh->mshcfg.min_discovery_timeout = |
425 | MESH_MIN_DISCOVERY_TIMEOUT; | 624 | MESH_MIN_DISCOVERY_TIMEOUT; |
426 | ifsta->accepting_plinks = true; | 625 | ifmsh->accepting_plinks = true; |
427 | ifsta->preq_id = 0; | 626 | ifmsh->preq_id = 0; |
428 | ifsta->dsn = 0; | 627 | ifmsh->dsn = 0; |
429 | atomic_set(&ifsta->mpaths, 0); | 628 | atomic_set(&ifmsh->mpaths, 0); |
430 | mesh_rmc_init(sdata); | 629 | mesh_rmc_init(sdata); |
431 | ifsta->last_preq = jiffies; | 630 | ifmsh->last_preq = jiffies; |
432 | /* Allocate all mesh structures when creating the first mesh interface. */ | 631 | /* Allocate all mesh structures when creating the first mesh interface. */ |
433 | if (!mesh_allocated) | 632 | if (!mesh_allocated) |
434 | ieee80211s_init(); | 633 | ieee80211s_init(); |
435 | mesh_ids_set_default(ifsta); | 634 | mesh_ids_set_default(ifmsh); |
436 | setup_timer(&ifsta->mesh_path_timer, | 635 | setup_timer(&ifmsh->mesh_path_timer, |
437 | ieee80211_mesh_path_timer, | 636 | ieee80211_mesh_path_timer, |
438 | (unsigned long) sdata); | 637 | (unsigned long) sdata); |
439 | INIT_LIST_HEAD(&ifsta->preq_queue.list); | 638 | INIT_LIST_HEAD(&ifmsh->preq_queue.list); |
440 | spin_lock_init(&ifsta->mesh_preq_queue_lock); | 639 | spin_lock_init(&ifmsh->mesh_preq_queue_lock); |
640 | } | ||
641 | |||
642 | ieee80211_rx_result | ||
643 | ieee80211_mesh_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | ||
644 | struct ieee80211_rx_status *rx_status) | ||
645 | { | ||
646 | struct ieee80211_local *local = sdata->local; | ||
647 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | ||
648 | struct ieee80211_mgmt *mgmt; | ||
649 | u16 fc; | ||
650 | |||
651 | if (skb->len < 24) | ||
652 | return RX_DROP_MONITOR; | ||
653 | |||
654 | mgmt = (struct ieee80211_mgmt *) skb->data; | ||
655 | fc = le16_to_cpu(mgmt->frame_control); | ||
656 | |||
657 | switch (fc & IEEE80211_FCTL_STYPE) { | ||
658 | case IEEE80211_STYPE_PROBE_RESP: | ||
659 | case IEEE80211_STYPE_BEACON: | ||
660 | case IEEE80211_STYPE_ACTION: | ||
661 | memcpy(skb->cb, rx_status, sizeof(*rx_status)); | ||
662 | skb_queue_tail(&ifmsh->skb_queue, skb); | ||
663 | queue_work(local->hw.workqueue, &ifmsh->work); | ||
664 | return RX_QUEUED; | ||
665 | } | ||
666 | |||
667 | return RX_CONTINUE; | ||
441 | } | 668 | } |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 84ff5d828fdb..8ee414a0447c 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -206,7 +206,7 @@ int mesh_rmc_check(u8 *addr, struct ieee80211s_hdr *mesh_hdr, | |||
206 | struct ieee80211_sub_if_data *sdata); | 206 | struct ieee80211_sub_if_data *sdata); |
207 | bool mesh_matches_local(struct ieee802_11_elems *ie, | 207 | bool mesh_matches_local(struct ieee802_11_elems *ie, |
208 | struct ieee80211_sub_if_data *sdata); | 208 | struct ieee80211_sub_if_data *sdata); |
209 | void mesh_ids_set_default(struct ieee80211_if_sta *sta); | 209 | void mesh_ids_set_default(struct ieee80211_if_mesh *mesh); |
210 | void mesh_mgmt_ies_add(struct sk_buff *skb, | 210 | void mesh_mgmt_ies_add(struct sk_buff *skb, |
211 | struct ieee80211_sub_if_data *sdata); | 211 | struct ieee80211_sub_if_data *sdata); |
212 | void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); | 212 | void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); |
@@ -214,6 +214,11 @@ int mesh_rmc_init(struct ieee80211_sub_if_data *sdata); | |||
214 | void ieee80211s_init(void); | 214 | void ieee80211s_init(void); |
215 | void ieee80211s_stop(void); | 215 | void ieee80211s_stop(void); |
216 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); | 216 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); |
217 | ieee80211_rx_result | ||
218 | ieee80211_mesh_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | ||
219 | struct ieee80211_rx_status *rx_status); | ||
220 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata); | ||
221 | void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata); | ||
217 | 222 | ||
218 | /* Mesh paths */ | 223 | /* Mesh paths */ |
219 | int mesh_nexthop_lookup(struct sk_buff *skb, | 224 | int mesh_nexthop_lookup(struct sk_buff *skb, |
@@ -269,8 +274,8 @@ extern int mesh_allocated; | |||
269 | 274 | ||
270 | static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata) | 275 | static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata) |
271 | { | 276 | { |
272 | return sdata->u.sta.mshcfg.dot11MeshMaxPeerLinks - | 277 | return sdata->u.mesh.mshcfg.dot11MeshMaxPeerLinks - |
273 | atomic_read(&sdata->u.sta.mshstats.estab_plinks); | 278 | atomic_read(&sdata->u.mesh.mshstats.estab_plinks); |
274 | } | 279 | } |
275 | 280 | ||
276 | static inline bool mesh_plink_availables(struct ieee80211_sub_if_data *sdata) | 281 | static inline bool mesh_plink_availables(struct ieee80211_sub_if_data *sdata) |
@@ -288,8 +293,12 @@ static inline void mesh_path_activate(struct mesh_path *mpath) | |||
288 | for (i = 0; i <= x->hash_mask; i++) \ | 293 | for (i = 0; i <= x->hash_mask; i++) \ |
289 | hlist_for_each_entry_rcu(node, p, &x->hash_buckets[i], list) | 294 | hlist_for_each_entry_rcu(node, p, &x->hash_buckets[i], list) |
290 | 295 | ||
296 | void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local); | ||
297 | |||
291 | #else | 298 | #else |
292 | #define mesh_allocated 0 | 299 | #define mesh_allocated 0 |
300 | static inline void | ||
301 | ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {} | ||
293 | #endif | 302 | #endif |
294 | 303 | ||
295 | #endif /* IEEE80211S_H */ | 304 | #endif /* IEEE80211S_H */ |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 210d6b852406..501c7831adb4 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -64,14 +64,14 @@ static inline u32 u32_field_get(u8 *preq_elem, int offset, bool ae) | |||
64 | #define DSN_LT(x, y) ((long) (x) - (long) (y) < 0) | 64 | #define DSN_LT(x, y) ((long) (x) - (long) (y) < 0) |
65 | 65 | ||
66 | #define net_traversal_jiffies(s) \ | 66 | #define net_traversal_jiffies(s) \ |
67 | msecs_to_jiffies(s->u.sta.mshcfg.dot11MeshHWMPnetDiameterTraversalTime) | 67 | msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime) |
68 | #define default_lifetime(s) \ | 68 | #define default_lifetime(s) \ |
69 | MSEC_TO_TU(s->u.sta.mshcfg.dot11MeshHWMPactivePathTimeout) | 69 | MSEC_TO_TU(s->u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout) |
70 | #define min_preq_int_jiff(s) \ | 70 | #define min_preq_int_jiff(s) \ |
71 | (msecs_to_jiffies(s->u.sta.mshcfg.dot11MeshHWMPpreqMinInterval)) | 71 | (msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval)) |
72 | #define max_preq_retries(s) (s->u.sta.mshcfg.dot11MeshHWMPmaxPREQretries) | 72 | #define max_preq_retries(s) (s->u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries) |
73 | #define disc_timeout_jiff(s) \ | 73 | #define disc_timeout_jiff(s) \ |
74 | msecs_to_jiffies(sdata->u.sta.mshcfg.min_discovery_timeout) | 74 | msecs_to_jiffies(sdata->u.mesh.mshcfg.min_discovery_timeout) |
75 | 75 | ||
76 | enum mpath_frame_type { | 76 | enum mpath_frame_type { |
77 | MPATH_PREQ = 0, | 77 | MPATH_PREQ = 0, |
@@ -223,7 +223,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local, | |||
223 | /* bitrate is in units of 100 Kbps, while we need rate in units of | 223 | /* bitrate is in units of 100 Kbps, while we need rate in units of |
224 | * 1Mbps. This will be corrected on tx_time computation. | 224 | * 1Mbps. This will be corrected on tx_time computation. |
225 | */ | 225 | */ |
226 | rate = sband->bitrates[sta->txrate_idx].bitrate; | 226 | rate = sband->bitrates[sta->last_txrate_idx].bitrate; |
227 | tx_time = (device_constant + 10 * test_frame_len / rate); | 227 | tx_time = (device_constant + 10 * test_frame_len / rate); |
228 | estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err)); | 228 | estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err)); |
229 | result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ; | 229 | result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ; |
@@ -395,7 +395,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, | |||
395 | static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | 395 | static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, |
396 | struct ieee80211_mgmt *mgmt, | 396 | struct ieee80211_mgmt *mgmt, |
397 | u8 *preq_elem, u32 metric) { | 397 | u8 *preq_elem, u32 metric) { |
398 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 398 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
399 | struct mesh_path *mpath; | 399 | struct mesh_path *mpath; |
400 | u8 *dst_addr, *orig_addr; | 400 | u8 *dst_addr, *orig_addr; |
401 | u8 dst_flags, ttl; | 401 | u8 dst_flags, ttl; |
@@ -414,11 +414,11 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
414 | forward = false; | 414 | forward = false; |
415 | reply = true; | 415 | reply = true; |
416 | metric = 0; | 416 | metric = 0; |
417 | if (time_after(jiffies, ifsta->last_dsn_update + | 417 | if (time_after(jiffies, ifmsh->last_dsn_update + |
418 | net_traversal_jiffies(sdata)) || | 418 | net_traversal_jiffies(sdata)) || |
419 | time_before(jiffies, ifsta->last_dsn_update)) { | 419 | time_before(jiffies, ifmsh->last_dsn_update)) { |
420 | dst_dsn = ++ifsta->dsn; | 420 | dst_dsn = ++ifmsh->dsn; |
421 | ifsta->last_dsn_update = jiffies; | 421 | ifmsh->last_dsn_update = jiffies; |
422 | } | 422 | } |
423 | } else { | 423 | } else { |
424 | rcu_read_lock(); | 424 | rcu_read_lock(); |
@@ -444,7 +444,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
444 | 444 | ||
445 | if (reply) { | 445 | if (reply) { |
446 | lifetime = PREQ_IE_LIFETIME(preq_elem); | 446 | lifetime = PREQ_IE_LIFETIME(preq_elem); |
447 | ttl = ifsta->mshcfg.dot11MeshTTL; | 447 | ttl = ifmsh->mshcfg.dot11MeshTTL; |
448 | if (ttl != 0) | 448 | if (ttl != 0) |
449 | mesh_path_sel_frame_tx(MPATH_PREP, 0, dst_addr, | 449 | mesh_path_sel_frame_tx(MPATH_PREP, 0, dst_addr, |
450 | cpu_to_le32(dst_dsn), 0, orig_addr, | 450 | cpu_to_le32(dst_dsn), 0, orig_addr, |
@@ -452,7 +452,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
452 | cpu_to_le32(lifetime), cpu_to_le32(metric), | 452 | cpu_to_le32(lifetime), cpu_to_le32(metric), |
453 | 0, sdata); | 453 | 0, sdata); |
454 | else | 454 | else |
455 | ifsta->mshstats.dropped_frames_ttl++; | 455 | ifmsh->mshstats.dropped_frames_ttl++; |
456 | } | 456 | } |
457 | 457 | ||
458 | if (forward) { | 458 | if (forward) { |
@@ -462,7 +462,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
462 | ttl = PREQ_IE_TTL(preq_elem); | 462 | ttl = PREQ_IE_TTL(preq_elem); |
463 | lifetime = PREQ_IE_LIFETIME(preq_elem); | 463 | lifetime = PREQ_IE_LIFETIME(preq_elem); |
464 | if (ttl <= 1) { | 464 | if (ttl <= 1) { |
465 | ifsta->mshstats.dropped_frames_ttl++; | 465 | ifmsh->mshstats.dropped_frames_ttl++; |
466 | return; | 466 | return; |
467 | } | 467 | } |
468 | --ttl; | 468 | --ttl; |
@@ -475,7 +475,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
475 | hopcount, ttl, cpu_to_le32(lifetime), | 475 | hopcount, ttl, cpu_to_le32(lifetime), |
476 | cpu_to_le32(metric), cpu_to_le32(preq_id), | 476 | cpu_to_le32(metric), cpu_to_le32(preq_id), |
477 | sdata); | 477 | sdata); |
478 | ifsta->mshstats.fwded_frames++; | 478 | ifmsh->mshstats.fwded_frames++; |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
@@ -503,7 +503,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
503 | 503 | ||
504 | ttl = PREP_IE_TTL(prep_elem); | 504 | ttl = PREP_IE_TTL(prep_elem); |
505 | if (ttl <= 1) { | 505 | if (ttl <= 1) { |
506 | sdata->u.sta.mshstats.dropped_frames_ttl++; | 506 | sdata->u.mesh.mshstats.dropped_frames_ttl++; |
507 | return; | 507 | return; |
508 | } | 508 | } |
509 | 509 | ||
@@ -517,7 +517,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
517 | spin_unlock_bh(&mpath->state_lock); | 517 | spin_unlock_bh(&mpath->state_lock); |
518 | goto fail; | 518 | goto fail; |
519 | } | 519 | } |
520 | memcpy(next_hop, mpath->next_hop->addr, ETH_ALEN); | 520 | memcpy(next_hop, mpath->next_hop->sta.addr, ETH_ALEN); |
521 | spin_unlock_bh(&mpath->state_lock); | 521 | spin_unlock_bh(&mpath->state_lock); |
522 | --ttl; | 522 | --ttl; |
523 | flags = PREP_IE_FLAGS(prep_elem); | 523 | flags = PREP_IE_FLAGS(prep_elem); |
@@ -529,16 +529,16 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
529 | 529 | ||
530 | mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr, | 530 | mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr, |
531 | cpu_to_le32(orig_dsn), 0, dst_addr, | 531 | cpu_to_le32(orig_dsn), 0, dst_addr, |
532 | cpu_to_le32(dst_dsn), mpath->next_hop->addr, hopcount, ttl, | 532 | cpu_to_le32(dst_dsn), mpath->next_hop->sta.addr, hopcount, ttl, |
533 | cpu_to_le32(lifetime), cpu_to_le32(metric), | 533 | cpu_to_le32(lifetime), cpu_to_le32(metric), |
534 | 0, sdata); | 534 | 0, sdata); |
535 | rcu_read_unlock(); | 535 | rcu_read_unlock(); |
536 | sdata->u.sta.mshstats.fwded_frames++; | 536 | sdata->u.mesh.mshstats.fwded_frames++; |
537 | return; | 537 | return; |
538 | 538 | ||
539 | fail: | 539 | fail: |
540 | rcu_read_unlock(); | 540 | rcu_read_unlock(); |
541 | sdata->u.sta.mshstats.dropped_frames_no_route++; | 541 | sdata->u.mesh.mshstats.dropped_frames_no_route++; |
542 | return; | 542 | return; |
543 | } | 543 | } |
544 | 544 | ||
@@ -557,7 +557,7 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata, | |||
557 | if (mpath) { | 557 | if (mpath) { |
558 | spin_lock_bh(&mpath->state_lock); | 558 | spin_lock_bh(&mpath->state_lock); |
559 | if (mpath->flags & MESH_PATH_ACTIVE && | 559 | if (mpath->flags & MESH_PATH_ACTIVE && |
560 | memcmp(ta, mpath->next_hop->addr, ETH_ALEN) == 0 && | 560 | memcmp(ta, mpath->next_hop->sta.addr, ETH_ALEN) == 0 && |
561 | (!(mpath->flags & MESH_PATH_DSN_VALID) || | 561 | (!(mpath->flags & MESH_PATH_DSN_VALID) || |
562 | DSN_GT(dst_dsn, mpath->dsn))) { | 562 | DSN_GT(dst_dsn, mpath->dsn))) { |
563 | mpath->flags &= ~MESH_PATH_ACTIVE; | 563 | mpath->flags &= ~MESH_PATH_ACTIVE; |
@@ -631,7 +631,7 @@ void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata, | |||
631 | static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | 631 | static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) |
632 | { | 632 | { |
633 | struct ieee80211_sub_if_data *sdata = mpath->sdata; | 633 | struct ieee80211_sub_if_data *sdata = mpath->sdata; |
634 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 634 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
635 | struct mesh_preq_queue *preq_node; | 635 | struct mesh_preq_queue *preq_node; |
636 | 636 | ||
637 | preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_KERNEL); | 637 | preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_KERNEL); |
@@ -640,9 +640,9 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | |||
640 | return; | 640 | return; |
641 | } | 641 | } |
642 | 642 | ||
643 | spin_lock(&ifsta->mesh_preq_queue_lock); | 643 | spin_lock(&ifmsh->mesh_preq_queue_lock); |
644 | if (ifsta->preq_queue_len == MAX_PREQ_QUEUE_LEN) { | 644 | if (ifmsh->preq_queue_len == MAX_PREQ_QUEUE_LEN) { |
645 | spin_unlock(&ifsta->mesh_preq_queue_lock); | 645 | spin_unlock(&ifmsh->mesh_preq_queue_lock); |
646 | kfree(preq_node); | 646 | kfree(preq_node); |
647 | if (printk_ratelimit()) | 647 | if (printk_ratelimit()) |
648 | printk(KERN_DEBUG "Mesh HWMP: PREQ node queue full\n"); | 648 | printk(KERN_DEBUG "Mesh HWMP: PREQ node queue full\n"); |
@@ -652,21 +652,21 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | |||
652 | memcpy(preq_node->dst, mpath->dst, ETH_ALEN); | 652 | memcpy(preq_node->dst, mpath->dst, ETH_ALEN); |
653 | preq_node->flags = flags; | 653 | preq_node->flags = flags; |
654 | 654 | ||
655 | list_add_tail(&preq_node->list, &ifsta->preq_queue.list); | 655 | list_add_tail(&preq_node->list, &ifmsh->preq_queue.list); |
656 | ++ifsta->preq_queue_len; | 656 | ++ifmsh->preq_queue_len; |
657 | spin_unlock(&ifsta->mesh_preq_queue_lock); | 657 | spin_unlock(&ifmsh->mesh_preq_queue_lock); |
658 | 658 | ||
659 | if (time_after(jiffies, ifsta->last_preq + min_preq_int_jiff(sdata))) | 659 | if (time_after(jiffies, ifmsh->last_preq + min_preq_int_jiff(sdata))) |
660 | queue_work(sdata->local->hw.workqueue, &ifsta->work); | 660 | queue_work(sdata->local->hw.workqueue, &ifmsh->work); |
661 | 661 | ||
662 | else if (time_before(jiffies, ifsta->last_preq)) { | 662 | else if (time_before(jiffies, ifmsh->last_preq)) { |
663 | /* avoid long wait if did not send preqs for a long time | 663 | /* avoid long wait if did not send preqs for a long time |
664 | * and jiffies wrapped around | 664 | * and jiffies wrapped around |
665 | */ | 665 | */ |
666 | ifsta->last_preq = jiffies - min_preq_int_jiff(sdata) - 1; | 666 | ifmsh->last_preq = jiffies - min_preq_int_jiff(sdata) - 1; |
667 | queue_work(sdata->local->hw.workqueue, &ifsta->work); | 667 | queue_work(sdata->local->hw.workqueue, &ifmsh->work); |
668 | } else | 668 | } else |
669 | mod_timer(&ifsta->mesh_path_timer, ifsta->last_preq + | 669 | mod_timer(&ifmsh->mesh_path_timer, ifmsh->last_preq + |
670 | min_preq_int_jiff(sdata)); | 670 | min_preq_int_jiff(sdata)); |
671 | } | 671 | } |
672 | 672 | ||
@@ -677,25 +677,25 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | |||
677 | */ | 677 | */ |
678 | void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) | 678 | void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) |
679 | { | 679 | { |
680 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 680 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
681 | struct mesh_preq_queue *preq_node; | 681 | struct mesh_preq_queue *preq_node; |
682 | struct mesh_path *mpath; | 682 | struct mesh_path *mpath; |
683 | u8 ttl, dst_flags; | 683 | u8 ttl, dst_flags; |
684 | u32 lifetime; | 684 | u32 lifetime; |
685 | 685 | ||
686 | spin_lock(&ifsta->mesh_preq_queue_lock); | 686 | spin_lock(&ifmsh->mesh_preq_queue_lock); |
687 | if (!ifsta->preq_queue_len || | 687 | if (!ifmsh->preq_queue_len || |
688 | time_before(jiffies, ifsta->last_preq + | 688 | time_before(jiffies, ifmsh->last_preq + |
689 | min_preq_int_jiff(sdata))) { | 689 | min_preq_int_jiff(sdata))) { |
690 | spin_unlock(&ifsta->mesh_preq_queue_lock); | 690 | spin_unlock(&ifmsh->mesh_preq_queue_lock); |
691 | return; | 691 | return; |
692 | } | 692 | } |
693 | 693 | ||
694 | preq_node = list_first_entry(&ifsta->preq_queue.list, | 694 | preq_node = list_first_entry(&ifmsh->preq_queue.list, |
695 | struct mesh_preq_queue, list); | 695 | struct mesh_preq_queue, list); |
696 | list_del(&preq_node->list); | 696 | list_del(&preq_node->list); |
697 | --ifsta->preq_queue_len; | 697 | --ifmsh->preq_queue_len; |
698 | spin_unlock(&ifsta->mesh_preq_queue_lock); | 698 | spin_unlock(&ifmsh->mesh_preq_queue_lock); |
699 | 699 | ||
700 | rcu_read_lock(); | 700 | rcu_read_lock(); |
701 | mpath = mesh_path_lookup(preq_node->dst, sdata); | 701 | mpath = mesh_path_lookup(preq_node->dst, sdata); |
@@ -720,18 +720,18 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) | |||
720 | goto enddiscovery; | 720 | goto enddiscovery; |
721 | } | 721 | } |
722 | 722 | ||
723 | ifsta->last_preq = jiffies; | 723 | ifmsh->last_preq = jiffies; |
724 | 724 | ||
725 | if (time_after(jiffies, ifsta->last_dsn_update + | 725 | if (time_after(jiffies, ifmsh->last_dsn_update + |
726 | net_traversal_jiffies(sdata)) || | 726 | net_traversal_jiffies(sdata)) || |
727 | time_before(jiffies, ifsta->last_dsn_update)) { | 727 | time_before(jiffies, ifmsh->last_dsn_update)) { |
728 | ++ifsta->dsn; | 728 | ++ifmsh->dsn; |
729 | sdata->u.sta.last_dsn_update = jiffies; | 729 | sdata->u.mesh.last_dsn_update = jiffies; |
730 | } | 730 | } |
731 | lifetime = default_lifetime(sdata); | 731 | lifetime = default_lifetime(sdata); |
732 | ttl = sdata->u.sta.mshcfg.dot11MeshTTL; | 732 | ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; |
733 | if (ttl == 0) { | 733 | if (ttl == 0) { |
734 | sdata->u.sta.mshstats.dropped_frames_ttl++; | 734 | sdata->u.mesh.mshstats.dropped_frames_ttl++; |
735 | spin_unlock_bh(&mpath->state_lock); | 735 | spin_unlock_bh(&mpath->state_lock); |
736 | goto enddiscovery; | 736 | goto enddiscovery; |
737 | } | 737 | } |
@@ -743,10 +743,10 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) | |||
743 | 743 | ||
744 | spin_unlock_bh(&mpath->state_lock); | 744 | spin_unlock_bh(&mpath->state_lock); |
745 | mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->dev->dev_addr, | 745 | mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->dev->dev_addr, |
746 | cpu_to_le32(ifsta->dsn), dst_flags, mpath->dst, | 746 | cpu_to_le32(ifmsh->dsn), dst_flags, mpath->dst, |
747 | cpu_to_le32(mpath->dsn), sdata->dev->broadcast, 0, | 747 | cpu_to_le32(mpath->dsn), sdata->dev->broadcast, 0, |
748 | ttl, cpu_to_le32(lifetime), 0, | 748 | ttl, cpu_to_le32(lifetime), 0, |
749 | cpu_to_le32(ifsta->preq_id++), sdata); | 749 | cpu_to_le32(ifmsh->preq_id++), sdata); |
750 | mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); | 750 | mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); |
751 | 751 | ||
752 | enddiscovery: | 752 | enddiscovery: |
@@ -783,7 +783,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb, | |||
783 | mpath = mesh_path_lookup(dst_addr, sdata); | 783 | mpath = mesh_path_lookup(dst_addr, sdata); |
784 | if (!mpath) { | 784 | if (!mpath) { |
785 | dev_kfree_skb(skb); | 785 | dev_kfree_skb(skb); |
786 | sdata->u.sta.mshstats.dropped_frames_no_route++; | 786 | sdata->u.mesh.mshstats.dropped_frames_no_route++; |
787 | err = -ENOSPC; | 787 | err = -ENOSPC; |
788 | goto endlookup; | 788 | goto endlookup; |
789 | } | 789 | } |
@@ -791,7 +791,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb, | |||
791 | 791 | ||
792 | if (mpath->flags & MESH_PATH_ACTIVE) { | 792 | if (mpath->flags & MESH_PATH_ACTIVE) { |
793 | if (time_after(jiffies, mpath->exp_time - | 793 | if (time_after(jiffies, mpath->exp_time - |
794 | msecs_to_jiffies(sdata->u.sta.mshcfg.path_refresh_time)) | 794 | msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) |
795 | && !memcmp(sdata->dev->dev_addr, hdr->addr4, | 795 | && !memcmp(sdata->dev->dev_addr, hdr->addr4, |
796 | ETH_ALEN) | 796 | ETH_ALEN) |
797 | && !(mpath->flags & MESH_PATH_RESOLVING) | 797 | && !(mpath->flags & MESH_PATH_RESOLVING) |
@@ -799,7 +799,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb, | |||
799 | mesh_queue_preq(mpath, | 799 | mesh_queue_preq(mpath, |
800 | PREQ_Q_F_START | PREQ_Q_F_REFRESH); | 800 | PREQ_Q_F_START | PREQ_Q_F_REFRESH); |
801 | } | 801 | } |
802 | memcpy(hdr->addr1, mpath->next_hop->addr, | 802 | memcpy(hdr->addr1, mpath->next_hop->sta.addr, |
803 | ETH_ALEN); | 803 | ETH_ALEN); |
804 | } else { | 804 | } else { |
805 | if (!(mpath->flags & MESH_PATH_RESOLVING)) { | 805 | if (!(mpath->flags & MESH_PATH_RESOLVING)) { |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 0a60f55f32ab..e4fa2905fadc 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -153,7 +153,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata) | |||
153 | if (is_multicast_ether_addr(dst)) | 153 | if (is_multicast_ether_addr(dst)) |
154 | return -ENOTSUPP; | 154 | return -ENOTSUPP; |
155 | 155 | ||
156 | if (atomic_add_unless(&sdata->u.sta.mpaths, 1, MESH_MAX_MPATHS) == 0) | 156 | if (atomic_add_unless(&sdata->u.mesh.mpaths, 1, MESH_MAX_MPATHS) == 0) |
157 | return -ENOSPC; | 157 | return -ENOSPC; |
158 | 158 | ||
159 | err = -ENOMEM; | 159 | err = -ENOMEM; |
@@ -221,7 +221,7 @@ err_exists: | |||
221 | err_node_alloc: | 221 | err_node_alloc: |
222 | kfree(new_mpath); | 222 | kfree(new_mpath); |
223 | err_path_alloc: | 223 | err_path_alloc: |
224 | atomic_dec(&sdata->u.sta.mpaths); | 224 | atomic_dec(&sdata->u.mesh.mpaths); |
225 | return err; | 225 | return err; |
226 | } | 226 | } |
227 | 227 | ||
@@ -306,7 +306,7 @@ static void mesh_path_node_reclaim(struct rcu_head *rp) | |||
306 | struct ieee80211_sub_if_data *sdata = node->mpath->sdata; | 306 | struct ieee80211_sub_if_data *sdata = node->mpath->sdata; |
307 | 307 | ||
308 | del_timer_sync(&node->mpath->timer); | 308 | del_timer_sync(&node->mpath->timer); |
309 | atomic_dec(&sdata->u.sta.mpaths); | 309 | atomic_dec(&sdata->u.mesh.mpaths); |
310 | kfree(node->mpath); | 310 | kfree(node->mpath); |
311 | kfree(node); | 311 | kfree(node); |
312 | } | 312 | } |
@@ -401,7 +401,7 @@ void mesh_path_discard_frame(struct sk_buff *skb, | |||
401 | } | 401 | } |
402 | 402 | ||
403 | kfree_skb(skb); | 403 | kfree_skb(skb); |
404 | sdata->u.sta.mshstats.dropped_frames_no_route++; | 404 | sdata->u.mesh.mshstats.dropped_frames_no_route++; |
405 | } | 405 | } |
406 | 406 | ||
407 | /** | 407 | /** |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 7356462dee96..faac101c0f85 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -36,11 +36,11 @@ | |||
36 | #define MESH_SECURITY_AUTHENTICATION_IMPOSSIBLE 9 | 36 | #define MESH_SECURITY_AUTHENTICATION_IMPOSSIBLE 9 |
37 | #define MESH_SECURITY_FAILED_VERIFICATION 10 | 37 | #define MESH_SECURITY_FAILED_VERIFICATION 10 |
38 | 38 | ||
39 | #define dot11MeshMaxRetries(s) (s->u.sta.mshcfg.dot11MeshMaxRetries) | 39 | #define dot11MeshMaxRetries(s) (s->u.mesh.mshcfg.dot11MeshMaxRetries) |
40 | #define dot11MeshRetryTimeout(s) (s->u.sta.mshcfg.dot11MeshRetryTimeout) | 40 | #define dot11MeshRetryTimeout(s) (s->u.mesh.mshcfg.dot11MeshRetryTimeout) |
41 | #define dot11MeshConfirmTimeout(s) (s->u.sta.mshcfg.dot11MeshConfirmTimeout) | 41 | #define dot11MeshConfirmTimeout(s) (s->u.mesh.mshcfg.dot11MeshConfirmTimeout) |
42 | #define dot11MeshHoldingTimeout(s) (s->u.sta.mshcfg.dot11MeshHoldingTimeout) | 42 | #define dot11MeshHoldingTimeout(s) (s->u.mesh.mshcfg.dot11MeshHoldingTimeout) |
43 | #define dot11MeshMaxPeerLinks(s) (s->u.sta.mshcfg.dot11MeshMaxPeerLinks) | 43 | #define dot11MeshMaxPeerLinks(s) (s->u.mesh.mshcfg.dot11MeshMaxPeerLinks) |
44 | 44 | ||
45 | enum plink_frame_type { | 45 | enum plink_frame_type { |
46 | PLINK_OPEN = 0, | 46 | PLINK_OPEN = 0, |
@@ -63,14 +63,14 @@ enum plink_event { | |||
63 | static inline | 63 | static inline |
64 | void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata) | 64 | void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata) |
65 | { | 65 | { |
66 | atomic_inc(&sdata->u.sta.mshstats.estab_plinks); | 66 | atomic_inc(&sdata->u.mesh.mshstats.estab_plinks); |
67 | mesh_accept_plinks_update(sdata); | 67 | mesh_accept_plinks_update(sdata); |
68 | } | 68 | } |
69 | 69 | ||
70 | static inline | 70 | static inline |
71 | void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata) | 71 | void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata) |
72 | { | 72 | { |
73 | atomic_dec(&sdata->u.sta.mshstats.estab_plinks); | 73 | atomic_dec(&sdata->u.mesh.mshstats.estab_plinks); |
74 | mesh_accept_plinks_update(sdata); | 74 | mesh_accept_plinks_update(sdata); |
75 | } | 75 | } |
76 | 76 | ||
@@ -106,7 +106,7 @@ static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, | |||
106 | return NULL; | 106 | return NULL; |
107 | 107 | ||
108 | sta->flags = WLAN_STA_AUTHORIZED; | 108 | sta->flags = WLAN_STA_AUTHORIZED; |
109 | sta->supp_rates[local->hw.conf.channel->band] = rates; | 109 | sta->sta.supp_rates[local->hw.conf.channel->band] = rates; |
110 | 110 | ||
111 | return sta; | 111 | return sta; |
112 | } | 112 | } |
@@ -243,10 +243,10 @@ void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct ieee80211_sub_if_data | |||
243 | } | 243 | } |
244 | 244 | ||
245 | sta->last_rx = jiffies; | 245 | sta->last_rx = jiffies; |
246 | sta->supp_rates[local->hw.conf.channel->band] = rates; | 246 | sta->sta.supp_rates[local->hw.conf.channel->band] = rates; |
247 | if (peer_accepting_plinks && sta->plink_state == PLINK_LISTEN && | 247 | if (peer_accepting_plinks && sta->plink_state == PLINK_LISTEN && |
248 | sdata->u.sta.accepting_plinks && | 248 | sdata->u.mesh.accepting_plinks && |
249 | sdata->u.sta.mshcfg.auto_open_plinks) | 249 | sdata->u.mesh.mshcfg.auto_open_plinks) |
250 | mesh_plink_open(sta); | 250 | mesh_plink_open(sta); |
251 | 251 | ||
252 | rcu_read_unlock(); | 252 | rcu_read_unlock(); |
@@ -275,7 +275,7 @@ static void mesh_plink_timer(unsigned long data) | |||
275 | return; | 275 | return; |
276 | } | 276 | } |
277 | mpl_dbg("Mesh plink timer for %s fired on state %d\n", | 277 | mpl_dbg("Mesh plink timer for %s fired on state %d\n", |
278 | print_mac(mac, sta->addr), sta->plink_state); | 278 | print_mac(mac, sta->sta.addr), sta->plink_state); |
279 | reason = 0; | 279 | reason = 0; |
280 | llid = sta->llid; | 280 | llid = sta->llid; |
281 | plid = sta->plid; | 281 | plid = sta->plid; |
@@ -288,7 +288,7 @@ static void mesh_plink_timer(unsigned long data) | |||
288 | if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { | 288 | if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { |
289 | u32 rand; | 289 | u32 rand; |
290 | mpl_dbg("Mesh plink for %s (retry, timeout): %d %d\n", | 290 | mpl_dbg("Mesh plink for %s (retry, timeout): %d %d\n", |
291 | print_mac(mac, sta->addr), | 291 | print_mac(mac, sta->sta.addr), |
292 | sta->plink_retries, sta->plink_timeout); | 292 | sta->plink_retries, sta->plink_timeout); |
293 | get_random_bytes(&rand, sizeof(u32)); | 293 | get_random_bytes(&rand, sizeof(u32)); |
294 | sta->plink_timeout = sta->plink_timeout + | 294 | sta->plink_timeout = sta->plink_timeout + |
@@ -296,7 +296,7 @@ static void mesh_plink_timer(unsigned long data) | |||
296 | ++sta->plink_retries; | 296 | ++sta->plink_retries; |
297 | mod_plink_timer(sta, sta->plink_timeout); | 297 | mod_plink_timer(sta, sta->plink_timeout); |
298 | spin_unlock_bh(&sta->lock); | 298 | spin_unlock_bh(&sta->lock); |
299 | mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->addr, llid, | 299 | mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->sta.addr, llid, |
300 | 0, 0); | 300 | 0, 0); |
301 | break; | 301 | break; |
302 | } | 302 | } |
@@ -309,7 +309,7 @@ static void mesh_plink_timer(unsigned long data) | |||
309 | sta->plink_state = PLINK_HOLDING; | 309 | sta->plink_state = PLINK_HOLDING; |
310 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); | 310 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); |
311 | spin_unlock_bh(&sta->lock); | 311 | spin_unlock_bh(&sta->lock); |
312 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, plid, | 312 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid, plid, |
313 | reason); | 313 | reason); |
314 | break; | 314 | break; |
315 | case PLINK_HOLDING: | 315 | case PLINK_HOLDING: |
@@ -352,10 +352,10 @@ int mesh_plink_open(struct sta_info *sta) | |||
352 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); | 352 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); |
353 | spin_unlock_bh(&sta->lock); | 353 | spin_unlock_bh(&sta->lock); |
354 | mpl_dbg("Mesh plink: starting establishment with %s\n", | 354 | mpl_dbg("Mesh plink: starting establishment with %s\n", |
355 | print_mac(mac, sta->addr)); | 355 | print_mac(mac, sta->sta.addr)); |
356 | 356 | ||
357 | return mesh_plink_frame_tx(sdata, PLINK_OPEN, | 357 | return mesh_plink_frame_tx(sdata, PLINK_OPEN, |
358 | sta->addr, llid, 0, 0); | 358 | sta->sta.addr, llid, 0, 0); |
359 | } | 359 | } |
360 | 360 | ||
361 | void mesh_plink_block(struct sta_info *sta) | 361 | void mesh_plink_block(struct sta_info *sta) |
@@ -379,7 +379,7 @@ int mesh_plink_close(struct sta_info *sta) | |||
379 | #endif | 379 | #endif |
380 | 380 | ||
381 | mpl_dbg("Mesh plink: closing link with %s\n", | 381 | mpl_dbg("Mesh plink: closing link with %s\n", |
382 | print_mac(mac, sta->addr)); | 382 | print_mac(mac, sta->sta.addr)); |
383 | spin_lock_bh(&sta->lock); | 383 | spin_lock_bh(&sta->lock); |
384 | sta->reason = cpu_to_le16(MESH_LINK_CANCELLED); | 384 | sta->reason = cpu_to_le16(MESH_LINK_CANCELLED); |
385 | reason = sta->reason; | 385 | reason = sta->reason; |
@@ -400,7 +400,7 @@ int mesh_plink_close(struct sta_info *sta) | |||
400 | llid = sta->llid; | 400 | llid = sta->llid; |
401 | plid = sta->plid; | 401 | plid = sta->plid; |
402 | spin_unlock_bh(&sta->lock); | 402 | spin_unlock_bh(&sta->lock); |
403 | mesh_plink_frame_tx(sta->sdata, PLINK_CLOSE, sta->addr, llid, | 403 | mesh_plink_frame_tx(sta->sdata, PLINK_CLOSE, sta->sta.addr, llid, |
404 | plid, reason); | 404 | plid, reason); |
405 | return 0; | 405 | return 0; |
406 | } | 406 | } |
@@ -577,9 +577,9 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
577 | sta->llid = llid; | 577 | sta->llid = llid; |
578 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); | 578 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); |
579 | spin_unlock_bh(&sta->lock); | 579 | spin_unlock_bh(&sta->lock); |
580 | mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->addr, llid, | 580 | mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->sta.addr, llid, |
581 | 0, 0); | 581 | 0, 0); |
582 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, | 582 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, |
583 | llid, plid, 0); | 583 | llid, plid, 0); |
584 | break; | 584 | break; |
585 | default: | 585 | default: |
@@ -604,7 +604,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
604 | 604 | ||
605 | llid = sta->llid; | 605 | llid = sta->llid; |
606 | spin_unlock_bh(&sta->lock); | 606 | spin_unlock_bh(&sta->lock); |
607 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, | 607 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid, |
608 | plid, reason); | 608 | plid, reason); |
609 | break; | 609 | break; |
610 | case OPN_ACPT: | 610 | case OPN_ACPT: |
@@ -613,7 +613,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
613 | sta->plid = plid; | 613 | sta->plid = plid; |
614 | llid = sta->llid; | 614 | llid = sta->llid; |
615 | spin_unlock_bh(&sta->lock); | 615 | spin_unlock_bh(&sta->lock); |
616 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, llid, | 616 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid, |
617 | plid, 0); | 617 | plid, 0); |
618 | break; | 618 | break; |
619 | case CNF_ACPT: | 619 | case CNF_ACPT: |
@@ -646,13 +646,13 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
646 | 646 | ||
647 | llid = sta->llid; | 647 | llid = sta->llid; |
648 | spin_unlock_bh(&sta->lock); | 648 | spin_unlock_bh(&sta->lock); |
649 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, | 649 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid, |
650 | plid, reason); | 650 | plid, reason); |
651 | break; | 651 | break; |
652 | case OPN_ACPT: | 652 | case OPN_ACPT: |
653 | llid = sta->llid; | 653 | llid = sta->llid; |
654 | spin_unlock_bh(&sta->lock); | 654 | spin_unlock_bh(&sta->lock); |
655 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, llid, | 655 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid, |
656 | plid, 0); | 656 | plid, 0); |
657 | break; | 657 | break; |
658 | case CNF_ACPT: | 658 | case CNF_ACPT: |
@@ -661,7 +661,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
661 | mesh_plink_inc_estab_count(sdata); | 661 | mesh_plink_inc_estab_count(sdata); |
662 | spin_unlock_bh(&sta->lock); | 662 | spin_unlock_bh(&sta->lock); |
663 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", | 663 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", |
664 | print_mac(mac, sta->addr)); | 664 | print_mac(mac, sta->sta.addr)); |
665 | break; | 665 | break; |
666 | default: | 666 | default: |
667 | spin_unlock_bh(&sta->lock); | 667 | spin_unlock_bh(&sta->lock); |
@@ -685,7 +685,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
685 | 685 | ||
686 | llid = sta->llid; | 686 | llid = sta->llid; |
687 | spin_unlock_bh(&sta->lock); | 687 | spin_unlock_bh(&sta->lock); |
688 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, | 688 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid, |
689 | plid, reason); | 689 | plid, reason); |
690 | break; | 690 | break; |
691 | case OPN_ACPT: | 691 | case OPN_ACPT: |
@@ -694,8 +694,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
694 | mesh_plink_inc_estab_count(sdata); | 694 | mesh_plink_inc_estab_count(sdata); |
695 | spin_unlock_bh(&sta->lock); | 695 | spin_unlock_bh(&sta->lock); |
696 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", | 696 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", |
697 | print_mac(mac, sta->addr)); | 697 | print_mac(mac, sta->sta.addr)); |
698 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, llid, | 698 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid, |
699 | plid, 0); | 699 | plid, 0); |
700 | break; | 700 | break; |
701 | default: | 701 | default: |
@@ -714,13 +714,13 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
714 | llid = sta->llid; | 714 | llid = sta->llid; |
715 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); | 715 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); |
716 | spin_unlock_bh(&sta->lock); | 716 | spin_unlock_bh(&sta->lock); |
717 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, | 717 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid, |
718 | plid, reason); | 718 | plid, reason); |
719 | break; | 719 | break; |
720 | case OPN_ACPT: | 720 | case OPN_ACPT: |
721 | llid = sta->llid; | 721 | llid = sta->llid; |
722 | spin_unlock_bh(&sta->lock); | 722 | spin_unlock_bh(&sta->lock); |
723 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, llid, | 723 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid, |
724 | plid, 0); | 724 | plid, 0); |
725 | break; | 725 | break; |
726 | default: | 726 | default: |
@@ -743,8 +743,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
743 | llid = sta->llid; | 743 | llid = sta->llid; |
744 | reason = sta->reason; | 744 | reason = sta->reason; |
745 | spin_unlock_bh(&sta->lock); | 745 | spin_unlock_bh(&sta->lock); |
746 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, | 746 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, |
747 | plid, reason); | 747 | llid, plid, reason); |
748 | break; | 748 | break; |
749 | default: | 749 | default: |
750 | spin_unlock_bh(&sta->lock); | 750 | spin_unlock_bh(&sta->lock); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 2c06f6965b7d..8611a8318c9c 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -22,11 +22,11 @@ | |||
22 | #include <linux/rtnetlink.h> | 22 | #include <linux/rtnetlink.h> |
23 | #include <net/iw_handler.h> | 23 | #include <net/iw_handler.h> |
24 | #include <net/mac80211.h> | 24 | #include <net/mac80211.h> |
25 | #include <asm/unaligned.h> | ||
25 | 26 | ||
26 | #include "ieee80211_i.h" | 27 | #include "ieee80211_i.h" |
27 | #include "rate.h" | 28 | #include "rate.h" |
28 | #include "led.h" | 29 | #include "led.h" |
29 | #include "mesh.h" | ||
30 | 30 | ||
31 | #define IEEE80211_ASSOC_SCANS_MAX_TRIES 2 | 31 | #define IEEE80211_ASSOC_SCANS_MAX_TRIES 2 |
32 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) | 32 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) |
@@ -34,7 +34,6 @@ | |||
34 | #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) | 34 | #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) |
35 | #define IEEE80211_ASSOC_MAX_TRIES 3 | 35 | #define IEEE80211_ASSOC_MAX_TRIES 3 |
36 | #define IEEE80211_MONITORING_INTERVAL (2 * HZ) | 36 | #define IEEE80211_MONITORING_INTERVAL (2 * HZ) |
37 | #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) | ||
38 | #define IEEE80211_PROBE_INTERVAL (60 * HZ) | 37 | #define IEEE80211_PROBE_INTERVAL (60 * HZ) |
39 | #define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) | 38 | #define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) |
40 | #define IEEE80211_SCAN_INTERVAL (2 * HZ) | 39 | #define IEEE80211_SCAN_INTERVAL (2 * HZ) |
@@ -43,7 +42,6 @@ | |||
43 | 42 | ||
44 | #define IEEE80211_IBSS_MERGE_INTERVAL (30 * HZ) | 43 | #define IEEE80211_IBSS_MERGE_INTERVAL (30 * HZ) |
45 | #define IEEE80211_IBSS_INACTIVITY_LIMIT (60 * HZ) | 44 | #define IEEE80211_IBSS_INACTIVITY_LIMIT (60 * HZ) |
46 | #define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ) | ||
47 | 45 | ||
48 | #define IEEE80211_IBSS_MAX_STA_ENTRIES 128 | 46 | #define IEEE80211_IBSS_MAX_STA_ENTRIES 128 |
49 | 47 | ||
@@ -54,7 +52,7 @@ static int ecw2cw(int ecw) | |||
54 | return (1 << ecw) - 1; | 52 | return (1 << ecw) - 1; |
55 | } | 53 | } |
56 | 54 | ||
57 | static u8 *ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie) | 55 | static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie) |
58 | { | 56 | { |
59 | u8 *end, *pos; | 57 | u8 *end, *pos; |
60 | 58 | ||
@@ -74,7 +72,7 @@ static u8 *ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie) | |||
74 | return NULL; | 72 | return NULL; |
75 | } | 73 | } |
76 | 74 | ||
77 | static int ieee80211_compatible_rates(struct ieee80211_sta_bss *bss, | 75 | static int ieee80211_compatible_rates(struct ieee80211_bss *bss, |
78 | struct ieee80211_supported_band *sband, | 76 | struct ieee80211_supported_band *sband, |
79 | u64 *rates) | 77 | u64 *rates) |
80 | { | 78 | { |
@@ -95,44 +93,46 @@ static int ieee80211_compatible_rates(struct ieee80211_sta_bss *bss, | |||
95 | return count; | 93 | return count; |
96 | } | 94 | } |
97 | 95 | ||
98 | /* frame sending functions */ | 96 | /* also used by mesh code */ |
99 | static void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | 97 | u64 ieee80211_sta_get_rates(struct ieee80211_local *local, |
100 | struct ieee80211_if_sta *ifsta, | 98 | struct ieee802_11_elems *elems, |
101 | int transaction, u8 *extra, size_t extra_len, | 99 | enum ieee80211_band band) |
102 | int encrypt) | ||
103 | { | 100 | { |
104 | struct ieee80211_local *local = sdata->local; | 101 | struct ieee80211_supported_band *sband; |
105 | struct sk_buff *skb; | 102 | struct ieee80211_rate *bitrates; |
106 | struct ieee80211_mgmt *mgmt; | 103 | size_t num_rates; |
104 | u64 supp_rates; | ||
105 | int i, j; | ||
106 | sband = local->hw.wiphy->bands[band]; | ||
107 | 107 | ||
108 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + | 108 | if (!sband) { |
109 | sizeof(*mgmt) + 6 + extra_len); | 109 | WARN_ON(1); |
110 | if (!skb) { | 110 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
111 | printk(KERN_DEBUG "%s: failed to allocate buffer for auth " | ||
112 | "frame\n", sdata->dev->name); | ||
113 | return; | ||
114 | } | 111 | } |
115 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
116 | |||
117 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); | ||
118 | memset(mgmt, 0, 24 + 6); | ||
119 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
120 | IEEE80211_STYPE_AUTH); | ||
121 | if (encrypt) | ||
122 | mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | ||
123 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | ||
124 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
125 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | ||
126 | mgmt->u.auth.auth_alg = cpu_to_le16(ifsta->auth_alg); | ||
127 | mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); | ||
128 | ifsta->auth_transaction = transaction + 1; | ||
129 | mgmt->u.auth.status_code = cpu_to_le16(0); | ||
130 | if (extra) | ||
131 | memcpy(skb_put(skb, extra_len), extra, extra_len); | ||
132 | 112 | ||
133 | ieee80211_tx_skb(sdata, skb, encrypt); | 113 | bitrates = sband->bitrates; |
114 | num_rates = sband->n_bitrates; | ||
115 | supp_rates = 0; | ||
116 | for (i = 0; i < elems->supp_rates_len + | ||
117 | elems->ext_supp_rates_len; i++) { | ||
118 | u8 rate = 0; | ||
119 | int own_rate; | ||
120 | if (i < elems->supp_rates_len) | ||
121 | rate = elems->supp_rates[i]; | ||
122 | else if (elems->ext_supp_rates) | ||
123 | rate = elems->ext_supp_rates | ||
124 | [i - elems->supp_rates_len]; | ||
125 | own_rate = 5 * (rate & 0x7f); | ||
126 | for (j = 0; j < num_rates; j++) | ||
127 | if (bitrates[j].bitrate == own_rate) | ||
128 | supp_rates |= BIT(j); | ||
129 | } | ||
130 | return supp_rates; | ||
134 | } | 131 | } |
135 | 132 | ||
133 | /* frame sending functions */ | ||
134 | |||
135 | /* also used by scanning code */ | ||
136 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | 136 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
137 | u8 *ssid, size_t ssid_len) | 137 | u8 *ssid, size_t ssid_len) |
138 | { | 138 | { |
@@ -193,6 +193,43 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | |||
193 | ieee80211_tx_skb(sdata, skb, 0); | 193 | ieee80211_tx_skb(sdata, skb, 0); |
194 | } | 194 | } |
195 | 195 | ||
196 | static void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | ||
197 | struct ieee80211_if_sta *ifsta, | ||
198 | int transaction, u8 *extra, size_t extra_len, | ||
199 | int encrypt) | ||
200 | { | ||
201 | struct ieee80211_local *local = sdata->local; | ||
202 | struct sk_buff *skb; | ||
203 | struct ieee80211_mgmt *mgmt; | ||
204 | |||
205 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + | ||
206 | sizeof(*mgmt) + 6 + extra_len); | ||
207 | if (!skb) { | ||
208 | printk(KERN_DEBUG "%s: failed to allocate buffer for auth " | ||
209 | "frame\n", sdata->dev->name); | ||
210 | return; | ||
211 | } | ||
212 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
213 | |||
214 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); | ||
215 | memset(mgmt, 0, 24 + 6); | ||
216 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
217 | IEEE80211_STYPE_AUTH); | ||
218 | if (encrypt) | ||
219 | mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | ||
220 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | ||
221 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
222 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | ||
223 | mgmt->u.auth.auth_alg = cpu_to_le16(ifsta->auth_alg); | ||
224 | mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); | ||
225 | ifsta->auth_transaction = transaction + 1; | ||
226 | mgmt->u.auth.status_code = cpu_to_le16(0); | ||
227 | if (extra) | ||
228 | memcpy(skb_put(skb, extra_len), extra, extra_len); | ||
229 | |||
230 | ieee80211_tx_skb(sdata, skb, encrypt); | ||
231 | } | ||
232 | |||
196 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | 233 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, |
197 | struct ieee80211_if_sta *ifsta) | 234 | struct ieee80211_if_sta *ifsta) |
198 | { | 235 | { |
@@ -202,7 +239,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | |||
202 | u8 *pos, *ies, *ht_add_ie; | 239 | u8 *pos, *ies, *ht_add_ie; |
203 | int i, len, count, rates_len, supp_rates_len; | 240 | int i, len, count, rates_len, supp_rates_len; |
204 | u16 capab; | 241 | u16 capab; |
205 | struct ieee80211_sta_bss *bss; | 242 | struct ieee80211_bss *bss; |
206 | int wmm = 0; | 243 | int wmm = 0; |
207 | struct ieee80211_supported_band *sband; | 244 | struct ieee80211_supported_band *sband; |
208 | u64 rates = 0; | 245 | u64 rates = 0; |
@@ -433,7 +470,7 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, | |||
433 | 470 | ||
434 | /* MLME */ | 471 | /* MLME */ |
435 | static void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | 472 | static void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, |
436 | struct ieee80211_sta_bss *bss) | 473 | struct ieee80211_bss *bss) |
437 | { | 474 | { |
438 | struct ieee80211_local *local = sdata->local; | 475 | struct ieee80211_local *local = sdata->local; |
439 | int i, have_higher_than_11mbit = 0; | 476 | int i, have_higher_than_11mbit = 0; |
@@ -584,7 +621,7 @@ static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata, | |||
584 | } | 621 | } |
585 | 622 | ||
586 | static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, | 623 | static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, |
587 | struct ieee80211_sta_bss *bss) | 624 | struct ieee80211_bss *bss) |
588 | { | 625 | { |
589 | u32 changed = 0; | 626 | u32 changed = 0; |
590 | 627 | ||
@@ -637,11 +674,11 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
637 | struct ieee80211_conf *conf = &local_to_hw(local)->conf; | 674 | struct ieee80211_conf *conf = &local_to_hw(local)->conf; |
638 | u32 changed = BSS_CHANGED_ASSOC; | 675 | u32 changed = BSS_CHANGED_ASSOC; |
639 | 676 | ||
640 | struct ieee80211_sta_bss *bss; | 677 | struct ieee80211_bss *bss; |
641 | 678 | ||
642 | ifsta->flags |= IEEE80211_STA_ASSOCIATED; | 679 | ifsta->flags |= IEEE80211_STA_ASSOCIATED; |
643 | 680 | ||
644 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 681 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
645 | return; | 682 | return; |
646 | 683 | ||
647 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, | 684 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
@@ -673,6 +710,12 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
673 | ieee80211_led_assoc(local, 1); | 710 | ieee80211_led_assoc(local, 1); |
674 | 711 | ||
675 | sdata->bss_conf.assoc = 1; | 712 | sdata->bss_conf.assoc = 1; |
713 | /* | ||
714 | * For now just always ask the driver to update the basic rateset | ||
715 | * when we have associated, we aren't checking whether it actually | ||
716 | * changed or not. | ||
717 | */ | ||
718 | changed |= BSS_CHANGED_BASIC_RATES; | ||
676 | ieee80211_bss_info_change_notify(sdata, changed); | 719 | ieee80211_bss_info_change_notify(sdata, changed); |
677 | 720 | ||
678 | netif_tx_start_all_queues(sdata->dev); | 721 | netif_tx_start_all_queues(sdata->dev); |
@@ -761,7 +804,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
761 | netif_tx_stop_all_queues(sdata->dev); | 804 | netif_tx_stop_all_queues(sdata->dev); |
762 | netif_carrier_off(sdata->dev); | 805 | netif_carrier_off(sdata->dev); |
763 | 806 | ||
764 | ieee80211_sta_tear_down_BA_sessions(sdata, sta->addr); | 807 | ieee80211_sta_tear_down_BA_sessions(sdata, sta->sta.addr); |
765 | 808 | ||
766 | if (self_disconnected) { | 809 | if (self_disconnected) { |
767 | if (deauth) | 810 | if (deauth) |
@@ -809,7 +852,7 @@ static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata, | |||
809 | struct ieee80211_if_sta *ifsta) | 852 | struct ieee80211_if_sta *ifsta) |
810 | { | 853 | { |
811 | struct ieee80211_local *local = sdata->local; | 854 | struct ieee80211_local *local = sdata->local; |
812 | struct ieee80211_sta_bss *bss; | 855 | struct ieee80211_bss *bss; |
813 | int bss_privacy; | 856 | int bss_privacy; |
814 | int wep_privacy; | 857 | int wep_privacy; |
815 | int privacy_invoked; | 858 | int privacy_invoked; |
@@ -959,17 +1002,17 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
959 | DECLARE_MAC_BUF(mac); | 1002 | DECLARE_MAC_BUF(mac); |
960 | 1003 | ||
961 | if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && | 1004 | if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && |
962 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 1005 | sdata->vif.type != NL80211_IFTYPE_ADHOC) |
963 | return; | 1006 | return; |
964 | 1007 | ||
965 | if (len < 24 + 6) | 1008 | if (len < 24 + 6) |
966 | return; | 1009 | return; |
967 | 1010 | ||
968 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 1011 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC && |
969 | memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) | 1012 | memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) |
970 | return; | 1013 | return; |
971 | 1014 | ||
972 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 1015 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC && |
973 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) | 1016 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) |
974 | return; | 1017 | return; |
975 | 1018 | ||
@@ -977,7 +1020,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
977 | auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); | 1020 | auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); |
978 | status_code = le16_to_cpu(mgmt->u.auth.status_code); | 1021 | status_code = le16_to_cpu(mgmt->u.auth.status_code); |
979 | 1022 | ||
980 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 1023 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
981 | /* | 1024 | /* |
982 | * IEEE 802.11 standard does not require authentication in IBSS | 1025 | * IEEE 802.11 standard does not require authentication in IBSS |
983 | * networks and most implementations do not seem to use it. | 1026 | * networks and most implementations do not seem to use it. |
@@ -1182,7 +1225,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1182 | /* Add STA entry for the AP */ | 1225 | /* Add STA entry for the AP */ |
1183 | sta = sta_info_get(local, ifsta->bssid); | 1226 | sta = sta_info_get(local, ifsta->bssid); |
1184 | if (!sta) { | 1227 | if (!sta) { |
1185 | struct ieee80211_sta_bss *bss; | 1228 | struct ieee80211_bss *bss; |
1186 | int err; | 1229 | int err; |
1187 | 1230 | ||
1188 | sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); | 1231 | sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); |
@@ -1258,8 +1301,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1258 | } | 1301 | } |
1259 | } | 1302 | } |
1260 | 1303 | ||
1261 | sta->supp_rates[local->hw.conf.channel->band] = rates; | 1304 | sta->sta.supp_rates[local->hw.conf.channel->band] = rates; |
1262 | sdata->basic_rates = basic_rates; | 1305 | sdata->bss_conf.basic_rates = basic_rates; |
1263 | 1306 | ||
1264 | /* cf. IEEE 802.11 9.2.12 */ | 1307 | /* cf. IEEE 802.11 9.2.12 */ |
1265 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && | 1308 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && |
@@ -1273,11 +1316,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1273 | struct ieee80211_ht_bss_info bss_info; | 1316 | struct ieee80211_ht_bss_info bss_info; |
1274 | ieee80211_ht_cap_ie_to_ht_info( | 1317 | ieee80211_ht_cap_ie_to_ht_info( |
1275 | (struct ieee80211_ht_cap *) | 1318 | (struct ieee80211_ht_cap *) |
1276 | elems.ht_cap_elem, &sta->ht_info); | 1319 | elems.ht_cap_elem, &sta->sta.ht_info); |
1277 | ieee80211_ht_addt_info_ie_to_ht_bss_info( | 1320 | ieee80211_ht_addt_info_ie_to_ht_bss_info( |
1278 | (struct ieee80211_ht_addt_info *) | 1321 | (struct ieee80211_ht_addt_info *) |
1279 | elems.ht_info_elem, &bss_info); | 1322 | elems.ht_info_elem, &bss_info); |
1280 | ieee80211_handle_ht(local, 1, &sta->ht_info, &bss_info); | 1323 | ieee80211_handle_ht(local, 1, &sta->sta.ht_info, &bss_info); |
1281 | } | 1324 | } |
1282 | 1325 | ||
1283 | rate_control_rate_init(sta, local); | 1326 | rate_control_rate_init(sta, local); |
@@ -1302,7 +1345,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1302 | 1345 | ||
1303 | static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | 1346 | static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, |
1304 | struct ieee80211_if_sta *ifsta, | 1347 | struct ieee80211_if_sta *ifsta, |
1305 | struct ieee80211_sta_bss *bss) | 1348 | struct ieee80211_bss *bss) |
1306 | { | 1349 | { |
1307 | struct ieee80211_local *local = sdata->local; | 1350 | struct ieee80211_local *local = sdata->local; |
1308 | int res, rates, i, j; | 1351 | int res, rates, i, j; |
@@ -1416,70 +1459,6 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
1416 | return res; | 1459 | return res; |
1417 | } | 1460 | } |
1418 | 1461 | ||
1419 | u64 ieee80211_sta_get_rates(struct ieee80211_local *local, | ||
1420 | struct ieee802_11_elems *elems, | ||
1421 | enum ieee80211_band band) | ||
1422 | { | ||
1423 | struct ieee80211_supported_band *sband; | ||
1424 | struct ieee80211_rate *bitrates; | ||
1425 | size_t num_rates; | ||
1426 | u64 supp_rates; | ||
1427 | int i, j; | ||
1428 | sband = local->hw.wiphy->bands[band]; | ||
1429 | |||
1430 | if (!sband) { | ||
1431 | WARN_ON(1); | ||
1432 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1433 | } | ||
1434 | |||
1435 | bitrates = sband->bitrates; | ||
1436 | num_rates = sband->n_bitrates; | ||
1437 | supp_rates = 0; | ||
1438 | for (i = 0; i < elems->supp_rates_len + | ||
1439 | elems->ext_supp_rates_len; i++) { | ||
1440 | u8 rate = 0; | ||
1441 | int own_rate; | ||
1442 | if (i < elems->supp_rates_len) | ||
1443 | rate = elems->supp_rates[i]; | ||
1444 | else if (elems->ext_supp_rates) | ||
1445 | rate = elems->ext_supp_rates | ||
1446 | [i - elems->supp_rates_len]; | ||
1447 | own_rate = 5 * (rate & 0x7f); | ||
1448 | for (j = 0; j < num_rates; j++) | ||
1449 | if (bitrates[j].bitrate == own_rate) | ||
1450 | supp_rates |= BIT(j); | ||
1451 | } | ||
1452 | return supp_rates; | ||
1453 | } | ||
1454 | |||
1455 | static u64 ieee80211_sta_get_mandatory_rates(struct ieee80211_local *local, | ||
1456 | enum ieee80211_band band) | ||
1457 | { | ||
1458 | struct ieee80211_supported_band *sband; | ||
1459 | struct ieee80211_rate *bitrates; | ||
1460 | u64 mandatory_rates; | ||
1461 | enum ieee80211_rate_flags mandatory_flag; | ||
1462 | int i; | ||
1463 | |||
1464 | sband = local->hw.wiphy->bands[band]; | ||
1465 | if (!sband) { | ||
1466 | WARN_ON(1); | ||
1467 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1468 | } | ||
1469 | |||
1470 | if (band == IEEE80211_BAND_2GHZ) | ||
1471 | mandatory_flag = IEEE80211_RATE_MANDATORY_B; | ||
1472 | else | ||
1473 | mandatory_flag = IEEE80211_RATE_MANDATORY_A; | ||
1474 | |||
1475 | bitrates = sband->bitrates; | ||
1476 | mandatory_rates = 0; | ||
1477 | for (i = 0; i < sband->n_bitrates; i++) | ||
1478 | if (bitrates[i].flags & mandatory_flag) | ||
1479 | mandatory_rates |= BIT(i); | ||
1480 | return mandatory_rates; | ||
1481 | } | ||
1482 | |||
1483 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | 1462 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, |
1484 | struct ieee80211_mgmt *mgmt, | 1463 | struct ieee80211_mgmt *mgmt, |
1485 | size_t len, | 1464 | size_t len, |
@@ -1489,7 +1468,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1489 | { | 1468 | { |
1490 | struct ieee80211_local *local = sdata->local; | 1469 | struct ieee80211_local *local = sdata->local; |
1491 | int freq; | 1470 | int freq; |
1492 | struct ieee80211_sta_bss *bss; | 1471 | struct ieee80211_bss *bss; |
1493 | struct sta_info *sta; | 1472 | struct sta_info *sta; |
1494 | struct ieee80211_channel *channel; | 1473 | struct ieee80211_channel *channel; |
1495 | u64 beacon_timestamp, rx_timestamp; | 1474 | u64 beacon_timestamp, rx_timestamp; |
@@ -1508,15 +1487,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1508 | if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) | 1487 | if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) |
1509 | return; | 1488 | return; |
1510 | 1489 | ||
1511 | if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id && | 1490 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && elems->supp_rates && |
1512 | elems->mesh_config && mesh_matches_local(elems, sdata)) { | ||
1513 | supp_rates = ieee80211_sta_get_rates(local, elems, band); | ||
1514 | |||
1515 | mesh_neighbour_update(mgmt->sa, supp_rates, sdata, | ||
1516 | mesh_peer_accepts_plinks(elems)); | ||
1517 | } | ||
1518 | |||
1519 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems->supp_rates && | ||
1520 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) { | 1491 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) { |
1521 | supp_rates = ieee80211_sta_get_rates(local, elems, band); | 1492 | supp_rates = ieee80211_sta_get_rates(local, elems, band); |
1522 | 1493 | ||
@@ -1526,20 +1497,21 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1526 | if (sta) { | 1497 | if (sta) { |
1527 | u64 prev_rates; | 1498 | u64 prev_rates; |
1528 | 1499 | ||
1529 | prev_rates = sta->supp_rates[band]; | 1500 | prev_rates = sta->sta.supp_rates[band]; |
1530 | /* make sure mandatory rates are always added */ | 1501 | /* make sure mandatory rates are always added */ |
1531 | sta->supp_rates[band] = supp_rates | | 1502 | sta->sta.supp_rates[band] = supp_rates | |
1532 | ieee80211_sta_get_mandatory_rates(local, band); | 1503 | ieee80211_mandatory_rates(local, band); |
1533 | 1504 | ||
1534 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1505 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1535 | if (sta->supp_rates[band] != prev_rates) | 1506 | if (sta->sta.supp_rates[band] != prev_rates) |
1536 | printk(KERN_DEBUG "%s: updated supp_rates set " | 1507 | printk(KERN_DEBUG "%s: updated supp_rates set " |
1537 | "for %s based on beacon info (0x%llx | " | 1508 | "for %s based on beacon info (0x%llx | " |
1538 | "0x%llx -> 0x%llx)\n", | 1509 | "0x%llx -> 0x%llx)\n", |
1539 | sdata->dev->name, print_mac(mac, sta->addr), | 1510 | sdata->dev->name, |
1511 | print_mac(mac, sta->sta.addr), | ||
1540 | (unsigned long long) prev_rates, | 1512 | (unsigned long long) prev_rates, |
1541 | (unsigned long long) supp_rates, | 1513 | (unsigned long long) supp_rates, |
1542 | (unsigned long long) sta->supp_rates[band]); | 1514 | (unsigned long long) sta->sta.supp_rates[band]); |
1543 | #endif | 1515 | #endif |
1544 | } else { | 1516 | } else { |
1545 | ieee80211_ibss_add_sta(sdata, NULL, mgmt->bssid, | 1517 | ieee80211_ibss_add_sta(sdata, NULL, mgmt->bssid, |
@@ -1561,14 +1533,14 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
1561 | * In STA mode, the remaining parameters should not be overridden | 1533 | * In STA mode, the remaining parameters should not be overridden |
1562 | * by beacons because they're not necessarily accurate there. | 1534 | * by beacons because they're not necessarily accurate there. |
1563 | */ | 1535 | */ |
1564 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 1536 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC && |
1565 | bss->last_probe_resp && beacon) { | 1537 | bss->last_probe_resp && beacon) { |
1566 | ieee80211_rx_bss_put(local, bss); | 1538 | ieee80211_rx_bss_put(local, bss); |
1567 | return; | 1539 | return; |
1568 | } | 1540 | } |
1569 | 1541 | ||
1570 | /* check if we need to merge IBSS */ | 1542 | /* check if we need to merge IBSS */ |
1571 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && beacon && | 1543 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && beacon && |
1572 | bss->capability & WLAN_CAPABILITY_IBSS && | 1544 | bss->capability & WLAN_CAPABILITY_IBSS && |
1573 | bss->freq == local->oper_channel->center_freq && | 1545 | bss->freq == local->oper_channel->center_freq && |
1574 | elems->ssid_len == sdata->u.sta.ssid_len && | 1546 | elems->ssid_len == sdata->u.sta.ssid_len && |
@@ -1678,7 +1650,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1678 | 1650 | ||
1679 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, true); | 1651 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, true); |
1680 | 1652 | ||
1681 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 1653 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
1682 | return; | 1654 | return; |
1683 | ifsta = &sdata->u.sta; | 1655 | ifsta = &sdata->u.sta; |
1684 | 1656 | ||
@@ -1729,7 +1701,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1729 | DECLARE_MAC_BUF(mac3); | 1701 | DECLARE_MAC_BUF(mac3); |
1730 | #endif | 1702 | #endif |
1731 | 1703 | ||
1732 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS || | 1704 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC || |
1733 | ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED || | 1705 | ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED || |
1734 | len < 24 + 2 || !ifsta->probe_resp) | 1706 | len < 24 + 2 || !ifsta->probe_resp) |
1735 | return; | 1707 | return; |
@@ -1785,26 +1757,6 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1785 | ieee80211_tx_skb(sdata, skb, 0); | 1757 | ieee80211_tx_skb(sdata, skb, 0); |
1786 | } | 1758 | } |
1787 | 1759 | ||
1788 | static void ieee80211_rx_mgmt_action(struct ieee80211_sub_if_data *sdata, | ||
1789 | struct ieee80211_if_sta *ifsta, | ||
1790 | struct ieee80211_mgmt *mgmt, | ||
1791 | size_t len, | ||
1792 | struct ieee80211_rx_status *rx_status) | ||
1793 | { | ||
1794 | /* currently we only handle mesh interface action frames here */ | ||
1795 | if (!ieee80211_vif_is_mesh(&sdata->vif)) | ||
1796 | return; | ||
1797 | |||
1798 | switch (mgmt->u.action.category) { | ||
1799 | case PLINK_CATEGORY: | ||
1800 | mesh_rx_plink_frame(sdata, mgmt, len, rx_status); | ||
1801 | break; | ||
1802 | case MESH_PATH_SEL_CATEGORY: | ||
1803 | mesh_rx_path_sel_frame(sdata, mgmt, len); | ||
1804 | break; | ||
1805 | } | ||
1806 | } | ||
1807 | |||
1808 | void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | 1760 | void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
1809 | struct ieee80211_rx_status *rx_status) | 1761 | struct ieee80211_rx_status *rx_status) |
1810 | { | 1762 | { |
@@ -1825,7 +1777,6 @@ void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff * | |||
1825 | case IEEE80211_STYPE_PROBE_REQ: | 1777 | case IEEE80211_STYPE_PROBE_REQ: |
1826 | case IEEE80211_STYPE_PROBE_RESP: | 1778 | case IEEE80211_STYPE_PROBE_RESP: |
1827 | case IEEE80211_STYPE_BEACON: | 1779 | case IEEE80211_STYPE_BEACON: |
1828 | case IEEE80211_STYPE_ACTION: | ||
1829 | memcpy(skb->cb, rx_status, sizeof(*rx_status)); | 1780 | memcpy(skb->cb, rx_status, sizeof(*rx_status)); |
1830 | case IEEE80211_STYPE_AUTH: | 1781 | case IEEE80211_STYPE_AUTH: |
1831 | case IEEE80211_STYPE_ASSOC_RESP: | 1782 | case IEEE80211_STYPE_ASSOC_RESP: |
@@ -1881,9 +1832,6 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
1881 | case IEEE80211_STYPE_DISASSOC: | 1832 | case IEEE80211_STYPE_DISASSOC: |
1882 | ieee80211_rx_mgmt_disassoc(sdata, ifsta, mgmt, skb->len); | 1833 | ieee80211_rx_mgmt_disassoc(sdata, ifsta, mgmt, skb->len); |
1883 | break; | 1834 | break; |
1884 | case IEEE80211_STYPE_ACTION: | ||
1885 | ieee80211_rx_mgmt_action(sdata, ifsta, mgmt, skb->len, rx_status); | ||
1886 | break; | ||
1887 | } | 1835 | } |
1888 | 1836 | ||
1889 | kfree_skb(skb); | 1837 | kfree_skb(skb); |
@@ -1913,32 +1861,6 @@ static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata) | |||
1913 | } | 1861 | } |
1914 | 1862 | ||
1915 | 1863 | ||
1916 | static void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, unsigned long exp_time) | ||
1917 | { | ||
1918 | struct ieee80211_local *local = sdata->local; | ||
1919 | struct sta_info *sta, *tmp; | ||
1920 | LIST_HEAD(tmp_list); | ||
1921 | DECLARE_MAC_BUF(mac); | ||
1922 | unsigned long flags; | ||
1923 | |||
1924 | spin_lock_irqsave(&local->sta_lock, flags); | ||
1925 | list_for_each_entry_safe(sta, tmp, &local->sta_list, list) | ||
1926 | if (time_after(jiffies, sta->last_rx + exp_time)) { | ||
1927 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | ||
1928 | printk(KERN_DEBUG "%s: expiring inactive STA %s\n", | ||
1929 | sdata->dev->name, print_mac(mac, sta->addr)); | ||
1930 | #endif | ||
1931 | __sta_info_unlink(&sta); | ||
1932 | if (sta) | ||
1933 | list_add(&sta->list, &tmp_list); | ||
1934 | } | ||
1935 | spin_unlock_irqrestore(&local->sta_lock, flags); | ||
1936 | |||
1937 | list_for_each_entry_safe(sta, tmp, &tmp_list, list) | ||
1938 | sta_info_destroy(sta); | ||
1939 | } | ||
1940 | |||
1941 | |||
1942 | static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata, | 1864 | static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata, |
1943 | struct ieee80211_if_sta *ifsta) | 1865 | struct ieee80211_if_sta *ifsta) |
1944 | { | 1866 | { |
@@ -1950,40 +1872,11 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata, | |||
1950 | 1872 | ||
1951 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " | 1873 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " |
1952 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); | 1874 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); |
1953 | ieee80211_sta_req_scan(sdata, ifsta->ssid, ifsta->ssid_len); | 1875 | ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len); |
1954 | } | 1876 | } |
1955 | 1877 | ||
1956 | 1878 | ||
1957 | #ifdef CONFIG_MAC80211_MESH | 1879 | static void ieee80211_sta_timer(unsigned long data) |
1958 | static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, | ||
1959 | struct ieee80211_if_sta *ifsta) | ||
1960 | { | ||
1961 | bool free_plinks; | ||
1962 | |||
1963 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); | ||
1964 | mesh_path_expire(sdata); | ||
1965 | |||
1966 | free_plinks = mesh_plink_availables(sdata); | ||
1967 | if (free_plinks != sdata->u.sta.accepting_plinks) | ||
1968 | ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | ||
1969 | |||
1970 | mod_timer(&ifsta->timer, jiffies + | ||
1971 | IEEE80211_MESH_HOUSEKEEPING_INTERVAL); | ||
1972 | } | ||
1973 | |||
1974 | |||
1975 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) | ||
1976 | { | ||
1977 | struct ieee80211_if_sta *ifsta; | ||
1978 | ifsta = &sdata->u.sta; | ||
1979 | ifsta->state = IEEE80211_STA_MLME_MESH_UP; | ||
1980 | ieee80211_sta_timer((unsigned long)sdata); | ||
1981 | ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | ||
1982 | } | ||
1983 | #endif | ||
1984 | |||
1985 | |||
1986 | void ieee80211_sta_timer(unsigned long data) | ||
1987 | { | 1880 | { |
1988 | struct ieee80211_sub_if_data *sdata = | 1881 | struct ieee80211_sub_if_data *sdata = |
1989 | (struct ieee80211_sub_if_data *) data; | 1882 | (struct ieee80211_sub_if_data *) data; |
@@ -2026,28 +1919,6 @@ static void ieee80211_sta_reset_auth(struct ieee80211_sub_if_data *sdata, | |||
2026 | } | 1919 | } |
2027 | 1920 | ||
2028 | 1921 | ||
2029 | void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, | ||
2030 | struct ieee80211_if_sta *ifsta) | ||
2031 | { | ||
2032 | struct ieee80211_local *local = sdata->local; | ||
2033 | |||
2034 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | ||
2035 | return; | ||
2036 | |||
2037 | if ((ifsta->flags & (IEEE80211_STA_BSSID_SET | | ||
2038 | IEEE80211_STA_AUTO_BSSID_SEL)) && | ||
2039 | (ifsta->flags & (IEEE80211_STA_SSID_SET | | ||
2040 | IEEE80211_STA_AUTO_SSID_SEL))) { | ||
2041 | |||
2042 | if (ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) | ||
2043 | ieee80211_set_disassoc(sdata, ifsta, true, true, | ||
2044 | WLAN_REASON_DEAUTH_LEAVING); | ||
2045 | |||
2046 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); | ||
2047 | queue_work(local->hw.workqueue, &ifsta->work); | ||
2048 | } | ||
2049 | } | ||
2050 | |||
2051 | static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta, | 1922 | static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta, |
2052 | const char *ssid, int ssid_len) | 1923 | const char *ssid, int ssid_len) |
2053 | { | 1924 | { |
@@ -2082,7 +1953,7 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata, | |||
2082 | struct ieee80211_if_sta *ifsta) | 1953 | struct ieee80211_if_sta *ifsta) |
2083 | { | 1954 | { |
2084 | struct ieee80211_local *local = sdata->local; | 1955 | struct ieee80211_local *local = sdata->local; |
2085 | struct ieee80211_sta_bss *bss; | 1956 | struct ieee80211_bss *bss; |
2086 | struct ieee80211_supported_band *sband; | 1957 | struct ieee80211_supported_band *sband; |
2087 | u8 bssid[ETH_ALEN], *pos; | 1958 | u8 bssid[ETH_ALEN], *pos; |
2088 | int i; | 1959 | int i; |
@@ -2143,7 +2014,7 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, | |||
2143 | struct ieee80211_if_sta *ifsta) | 2014 | struct ieee80211_if_sta *ifsta) |
2144 | { | 2015 | { |
2145 | struct ieee80211_local *local = sdata->local; | 2016 | struct ieee80211_local *local = sdata->local; |
2146 | struct ieee80211_sta_bss *bss; | 2017 | struct ieee80211_bss *bss; |
2147 | int found = 0; | 2018 | int found = 0; |
2148 | u8 bssid[ETH_ALEN]; | 2019 | u8 bssid[ETH_ALEN]; |
2149 | int active_ibss; | 2020 | int active_ibss; |
@@ -2158,8 +2029,8 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, | |||
2158 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", | 2029 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", |
2159 | sdata->dev->name, active_ibss); | 2030 | sdata->dev->name, active_ibss); |
2160 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2031 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
2161 | spin_lock_bh(&local->sta_bss_lock); | 2032 | spin_lock_bh(&local->bss_lock); |
2162 | list_for_each_entry(bss, &local->sta_bss_list, list) { | 2033 | list_for_each_entry(bss, &local->bss_list, list) { |
2163 | if (ifsta->ssid_len != bss->ssid_len || | 2034 | if (ifsta->ssid_len != bss->ssid_len || |
2164 | memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0 | 2035 | memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0 |
2165 | || !(bss->capability & WLAN_CAPABILITY_IBSS)) | 2036 | || !(bss->capability & WLAN_CAPABILITY_IBSS)) |
@@ -2173,7 +2044,7 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, | |||
2173 | if (active_ibss || memcmp(bssid, ifsta->bssid, ETH_ALEN) != 0) | 2044 | if (active_ibss || memcmp(bssid, ifsta->bssid, ETH_ALEN) != 0) |
2174 | break; | 2045 | break; |
2175 | } | 2046 | } |
2176 | spin_unlock_bh(&local->sta_bss_lock); | 2047 | spin_unlock_bh(&local->bss_lock); |
2177 | 2048 | ||
2178 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2049 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2179 | if (found) | 2050 | if (found) |
@@ -2218,7 +2089,7 @@ dont_join: | |||
2218 | IEEE80211_SCAN_INTERVAL)) { | 2089 | IEEE80211_SCAN_INTERVAL)) { |
2219 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " | 2090 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
2220 | "join\n", sdata->dev->name); | 2091 | "join\n", sdata->dev->name); |
2221 | return ieee80211_sta_req_scan(sdata, ifsta->ssid, | 2092 | return ieee80211_request_scan(sdata, ifsta->ssid, |
2222 | ifsta->ssid_len); | 2093 | ifsta->ssid_len); |
2223 | } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) { | 2094 | } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) { |
2224 | int interval = IEEE80211_SCAN_INTERVAL; | 2095 | int interval = IEEE80211_SCAN_INTERVAL; |
@@ -2249,169 +2120,16 @@ dont_join: | |||
2249 | } | 2120 | } |
2250 | 2121 | ||
2251 | 2122 | ||
2252 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len) | ||
2253 | { | ||
2254 | struct ieee80211_if_sta *ifsta; | ||
2255 | int res; | ||
2256 | |||
2257 | if (len > IEEE80211_MAX_SSID_LEN) | ||
2258 | return -EINVAL; | ||
2259 | |||
2260 | ifsta = &sdata->u.sta; | ||
2261 | |||
2262 | if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0) { | ||
2263 | memset(ifsta->ssid, 0, sizeof(ifsta->ssid)); | ||
2264 | memcpy(ifsta->ssid, ssid, len); | ||
2265 | ifsta->ssid_len = len; | ||
2266 | ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET; | ||
2267 | |||
2268 | res = 0; | ||
2269 | /* | ||
2270 | * Hack! MLME code needs to be cleaned up to have different | ||
2271 | * entry points for configuration and internal selection change | ||
2272 | */ | ||
2273 | if (netif_running(sdata->dev)) | ||
2274 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_SSID); | ||
2275 | if (res) { | ||
2276 | printk(KERN_DEBUG "%s: Failed to config new SSID to " | ||
2277 | "the low-level driver\n", sdata->dev->name); | ||
2278 | return res; | ||
2279 | } | ||
2280 | } | ||
2281 | |||
2282 | if (len) | ||
2283 | ifsta->flags |= IEEE80211_STA_SSID_SET; | ||
2284 | else | ||
2285 | ifsta->flags &= ~IEEE80211_STA_SSID_SET; | ||
2286 | |||
2287 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | ||
2288 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { | ||
2289 | ifsta->ibss_join_req = jiffies; | ||
2290 | ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH; | ||
2291 | return ieee80211_sta_find_ibss(sdata, ifsta); | ||
2292 | } | ||
2293 | |||
2294 | return 0; | ||
2295 | } | ||
2296 | |||
2297 | |||
2298 | int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len) | ||
2299 | { | ||
2300 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2301 | memcpy(ssid, ifsta->ssid, ifsta->ssid_len); | ||
2302 | *len = ifsta->ssid_len; | ||
2303 | return 0; | ||
2304 | } | ||
2305 | |||
2306 | |||
2307 | int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid) | ||
2308 | { | ||
2309 | struct ieee80211_if_sta *ifsta; | ||
2310 | int res; | ||
2311 | |||
2312 | ifsta = &sdata->u.sta; | ||
2313 | |||
2314 | if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { | ||
2315 | memcpy(ifsta->bssid, bssid, ETH_ALEN); | ||
2316 | res = 0; | ||
2317 | /* | ||
2318 | * Hack! See also ieee80211_sta_set_ssid. | ||
2319 | */ | ||
2320 | if (netif_running(sdata->dev)) | ||
2321 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID); | ||
2322 | if (res) { | ||
2323 | printk(KERN_DEBUG "%s: Failed to config new BSSID to " | ||
2324 | "the low-level driver\n", sdata->dev->name); | ||
2325 | return res; | ||
2326 | } | ||
2327 | } | ||
2328 | |||
2329 | if (is_valid_ether_addr(bssid)) | ||
2330 | ifsta->flags |= IEEE80211_STA_BSSID_SET; | ||
2331 | else | ||
2332 | ifsta->flags &= ~IEEE80211_STA_BSSID_SET; | ||
2333 | |||
2334 | return 0; | ||
2335 | } | ||
2336 | |||
2337 | |||
2338 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len) | ||
2339 | { | ||
2340 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2341 | |||
2342 | kfree(ifsta->extra_ie); | ||
2343 | if (len == 0) { | ||
2344 | ifsta->extra_ie = NULL; | ||
2345 | ifsta->extra_ie_len = 0; | ||
2346 | return 0; | ||
2347 | } | ||
2348 | ifsta->extra_ie = kmalloc(len, GFP_KERNEL); | ||
2349 | if (!ifsta->extra_ie) { | ||
2350 | ifsta->extra_ie_len = 0; | ||
2351 | return -ENOMEM; | ||
2352 | } | ||
2353 | memcpy(ifsta->extra_ie, ie, len); | ||
2354 | ifsta->extra_ie_len = len; | ||
2355 | return 0; | ||
2356 | } | ||
2357 | |||
2358 | |||
2359 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | ||
2360 | struct sk_buff *skb, u8 *bssid, | ||
2361 | u8 *addr, u64 supp_rates) | ||
2362 | { | ||
2363 | struct ieee80211_local *local = sdata->local; | ||
2364 | struct sta_info *sta; | ||
2365 | DECLARE_MAC_BUF(mac); | ||
2366 | int band = local->hw.conf.channel->band; | ||
2367 | |||
2368 | /* TODO: Could consider removing the least recently used entry and | ||
2369 | * allow new one to be added. */ | ||
2370 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | ||
2371 | if (net_ratelimit()) { | ||
2372 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " | ||
2373 | "entry %s\n", sdata->dev->name, print_mac(mac, addr)); | ||
2374 | } | ||
2375 | return NULL; | ||
2376 | } | ||
2377 | |||
2378 | if (compare_ether_addr(bssid, sdata->u.sta.bssid)) | ||
2379 | return NULL; | ||
2380 | |||
2381 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
2382 | printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", | ||
2383 | wiphy_name(local->hw.wiphy), print_mac(mac, addr), sdata->dev->name); | ||
2384 | #endif | ||
2385 | |||
2386 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); | ||
2387 | if (!sta) | ||
2388 | return NULL; | ||
2389 | |||
2390 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); | ||
2391 | |||
2392 | /* make sure mandatory rates are always added */ | ||
2393 | sta->supp_rates[band] = supp_rates | | ||
2394 | ieee80211_sta_get_mandatory_rates(local, band); | ||
2395 | |||
2396 | rate_control_rate_init(sta, local); | ||
2397 | |||
2398 | if (sta_info_insert(sta)) | ||
2399 | return NULL; | ||
2400 | |||
2401 | return sta; | ||
2402 | } | ||
2403 | |||
2404 | |||
2405 | static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, | 2123 | static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, |
2406 | struct ieee80211_if_sta *ifsta) | 2124 | struct ieee80211_if_sta *ifsta) |
2407 | { | 2125 | { |
2408 | struct ieee80211_local *local = sdata->local; | 2126 | struct ieee80211_local *local = sdata->local; |
2409 | struct ieee80211_sta_bss *bss, *selected = NULL; | 2127 | struct ieee80211_bss *bss, *selected = NULL; |
2410 | int top_rssi = 0, freq; | 2128 | int top_rssi = 0, freq; |
2411 | 2129 | ||
2412 | spin_lock_bh(&local->sta_bss_lock); | 2130 | spin_lock_bh(&local->bss_lock); |
2413 | freq = local->oper_channel->center_freq; | 2131 | freq = local->oper_channel->center_freq; |
2414 | list_for_each_entry(bss, &local->sta_bss_list, list) { | 2132 | list_for_each_entry(bss, &local->bss_list, list) { |
2415 | if (!(bss->capability & WLAN_CAPABILITY_ESS)) | 2133 | if (!(bss->capability & WLAN_CAPABILITY_ESS)) |
2416 | continue; | 2134 | continue; |
2417 | 2135 | ||
@@ -2441,7 +2159,7 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, | |||
2441 | } | 2159 | } |
2442 | if (selected) | 2160 | if (selected) |
2443 | atomic_inc(&selected->users); | 2161 | atomic_inc(&selected->users); |
2444 | spin_unlock_bh(&local->sta_bss_lock); | 2162 | spin_unlock_bh(&local->bss_lock); |
2445 | 2163 | ||
2446 | if (selected) { | 2164 | if (selected) { |
2447 | ieee80211_set_freq(sdata, selected->freq); | 2165 | ieee80211_set_freq(sdata, selected->freq); |
@@ -2468,9 +2186,9 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, | |||
2468 | if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) { | 2186 | if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) { |
2469 | ifsta->assoc_scan_tries++; | 2187 | ifsta->assoc_scan_tries++; |
2470 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) | 2188 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) |
2471 | ieee80211_sta_start_scan(sdata, NULL, 0); | 2189 | ieee80211_start_scan(sdata, NULL, 0); |
2472 | else | 2190 | else |
2473 | ieee80211_sta_start_scan(sdata, ifsta->ssid, | 2191 | ieee80211_start_scan(sdata, ifsta->ssid, |
2474 | ifsta->ssid_len); | 2192 | ifsta->ssid_len); |
2475 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; | 2193 | ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; |
2476 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); | 2194 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); |
@@ -2481,61 +2199,7 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, | |||
2481 | } | 2199 | } |
2482 | 2200 | ||
2483 | 2201 | ||
2484 | int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason) | 2202 | static void ieee80211_sta_work(struct work_struct *work) |
2485 | { | ||
2486 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2487 | |||
2488 | printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", | ||
2489 | sdata->dev->name, reason); | ||
2490 | |||
2491 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | ||
2492 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | ||
2493 | return -EINVAL; | ||
2494 | |||
2495 | ieee80211_set_disassoc(sdata, ifsta, true, true, reason); | ||
2496 | return 0; | ||
2497 | } | ||
2498 | |||
2499 | |||
2500 | int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason) | ||
2501 | { | ||
2502 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2503 | |||
2504 | printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", | ||
2505 | sdata->dev->name, reason); | ||
2506 | |||
2507 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | ||
2508 | return -EINVAL; | ||
2509 | |||
2510 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) | ||
2511 | return -1; | ||
2512 | |||
2513 | ieee80211_set_disassoc(sdata, ifsta, false, true, reason); | ||
2514 | return 0; | ||
2515 | } | ||
2516 | |||
2517 | void ieee80211_notify_mac(struct ieee80211_hw *hw, | ||
2518 | enum ieee80211_notification_types notif_type) | ||
2519 | { | ||
2520 | struct ieee80211_local *local = hw_to_local(hw); | ||
2521 | struct ieee80211_sub_if_data *sdata; | ||
2522 | |||
2523 | switch (notif_type) { | ||
2524 | case IEEE80211_NOTIFY_RE_ASSOC: | ||
2525 | rcu_read_lock(); | ||
2526 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | ||
2527 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | ||
2528 | continue; | ||
2529 | |||
2530 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); | ||
2531 | } | ||
2532 | rcu_read_unlock(); | ||
2533 | break; | ||
2534 | } | ||
2535 | } | ||
2536 | EXPORT_SYMBOL(ieee80211_notify_mac); | ||
2537 | |||
2538 | void ieee80211_sta_work(struct work_struct *work) | ||
2539 | { | 2203 | { |
2540 | struct ieee80211_sub_if_data *sdata = | 2204 | struct ieee80211_sub_if_data *sdata = |
2541 | container_of(work, struct ieee80211_sub_if_data, u.sta.work); | 2205 | container_of(work, struct ieee80211_sub_if_data, u.sta.work); |
@@ -2546,30 +2210,23 @@ void ieee80211_sta_work(struct work_struct *work) | |||
2546 | if (!netif_running(sdata->dev)) | 2210 | if (!netif_running(sdata->dev)) |
2547 | return; | 2211 | return; |
2548 | 2212 | ||
2549 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 2213 | if (local->sw_scanning || local->hw_scanning) |
2550 | return; | 2214 | return; |
2551 | 2215 | ||
2552 | if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA && | 2216 | if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION && |
2553 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 2217 | sdata->vif.type != NL80211_IFTYPE_ADHOC)) |
2554 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)) | ||
2555 | return; | 2218 | return; |
2556 | ifsta = &sdata->u.sta; | 2219 | ifsta = &sdata->u.sta; |
2557 | 2220 | ||
2558 | while ((skb = skb_dequeue(&ifsta->skb_queue))) | 2221 | while ((skb = skb_dequeue(&ifsta->skb_queue))) |
2559 | ieee80211_sta_rx_queued_mgmt(sdata, skb); | 2222 | ieee80211_sta_rx_queued_mgmt(sdata, skb); |
2560 | 2223 | ||
2561 | #ifdef CONFIG_MAC80211_MESH | ||
2562 | if (ifsta->preq_queue_len && | ||
2563 | time_after(jiffies, | ||
2564 | ifsta->last_preq + msecs_to_jiffies(ifsta->mshcfg.dot11MeshHWMPpreqMinInterval))) | ||
2565 | mesh_path_start_discovery(sdata); | ||
2566 | #endif | ||
2567 | |||
2568 | if (ifsta->state != IEEE80211_STA_MLME_DIRECT_PROBE && | 2224 | if (ifsta->state != IEEE80211_STA_MLME_DIRECT_PROBE && |
2569 | ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && | 2225 | ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && |
2570 | ifsta->state != IEEE80211_STA_MLME_ASSOCIATE && | 2226 | ifsta->state != IEEE80211_STA_MLME_ASSOCIATE && |
2571 | test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { | 2227 | test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { |
2572 | ieee80211_sta_start_scan(sdata, ifsta->scan_ssid, ifsta->scan_ssid_len); | 2228 | ieee80211_start_scan(sdata, ifsta->scan_ssid, |
2229 | ifsta->scan_ssid_len); | ||
2573 | return; | 2230 | return; |
2574 | } | 2231 | } |
2575 | 2232 | ||
@@ -2601,11 +2258,6 @@ void ieee80211_sta_work(struct work_struct *work) | |||
2601 | case IEEE80211_STA_MLME_IBSS_JOINED: | 2258 | case IEEE80211_STA_MLME_IBSS_JOINED: |
2602 | ieee80211_sta_merge_ibss(sdata, ifsta); | 2259 | ieee80211_sta_merge_ibss(sdata, ifsta); |
2603 | break; | 2260 | break; |
2604 | #ifdef CONFIG_MAC80211_MESH | ||
2605 | case IEEE80211_STA_MLME_MESH_UP: | ||
2606 | ieee80211_mesh_housekeeping(sdata, ifsta); | ||
2607 | break; | ||
2608 | #endif | ||
2609 | default: | 2261 | default: |
2610 | WARN_ON(1); | 2262 | WARN_ON(1); |
2611 | break; | 2263 | break; |
@@ -2620,16 +2272,281 @@ void ieee80211_sta_work(struct work_struct *work) | |||
2620 | } | 2272 | } |
2621 | } | 2273 | } |
2622 | 2274 | ||
2275 | static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) | ||
2276 | { | ||
2277 | if (sdata->vif.type == NL80211_IFTYPE_STATION) | ||
2278 | queue_work(sdata->local->hw.workqueue, | ||
2279 | &sdata->u.sta.work); | ||
2280 | } | ||
2281 | |||
2282 | /* interface setup */ | ||
2283 | void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata) | ||
2284 | { | ||
2285 | struct ieee80211_if_sta *ifsta; | ||
2286 | |||
2287 | ifsta = &sdata->u.sta; | ||
2288 | INIT_WORK(&ifsta->work, ieee80211_sta_work); | ||
2289 | setup_timer(&ifsta->timer, ieee80211_sta_timer, | ||
2290 | (unsigned long) sdata); | ||
2291 | skb_queue_head_init(&ifsta->skb_queue); | ||
2292 | |||
2293 | ifsta->capab = WLAN_CAPABILITY_ESS; | ||
2294 | ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN | | ||
2295 | IEEE80211_AUTH_ALG_SHARED_KEY; | ||
2296 | ifsta->flags |= IEEE80211_STA_CREATE_IBSS | | ||
2297 | IEEE80211_STA_AUTO_BSSID_SEL | | ||
2298 | IEEE80211_STA_AUTO_CHANNEL_SEL; | ||
2299 | if (ieee80211_num_regular_queues(&sdata->local->hw) >= 4) | ||
2300 | ifsta->flags |= IEEE80211_STA_WMM_ENABLED; | ||
2301 | } | ||
2302 | |||
2303 | /* | ||
2304 | * Add a new IBSS station, will also be called by the RX code when, | ||
2305 | * in IBSS mode, receiving a frame from a yet-unknown station, hence | ||
2306 | * must be callable in atomic context. | ||
2307 | */ | ||
2308 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | ||
2309 | struct sk_buff *skb, u8 *bssid, | ||
2310 | u8 *addr, u64 supp_rates) | ||
2311 | { | ||
2312 | struct ieee80211_local *local = sdata->local; | ||
2313 | struct sta_info *sta; | ||
2314 | DECLARE_MAC_BUF(mac); | ||
2315 | int band = local->hw.conf.channel->band; | ||
2316 | |||
2317 | /* TODO: Could consider removing the least recently used entry and | ||
2318 | * allow new one to be added. */ | ||
2319 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | ||
2320 | if (net_ratelimit()) { | ||
2321 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " | ||
2322 | "entry %s\n", sdata->dev->name, print_mac(mac, addr)); | ||
2323 | } | ||
2324 | return NULL; | ||
2325 | } | ||
2326 | |||
2327 | if (compare_ether_addr(bssid, sdata->u.sta.bssid)) | ||
2328 | return NULL; | ||
2329 | |||
2330 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
2331 | printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", | ||
2332 | wiphy_name(local->hw.wiphy), print_mac(mac, addr), sdata->dev->name); | ||
2333 | #endif | ||
2334 | |||
2335 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); | ||
2336 | if (!sta) | ||
2337 | return NULL; | ||
2338 | |||
2339 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); | ||
2340 | |||
2341 | /* make sure mandatory rates are always added */ | ||
2342 | sta->sta.supp_rates[band] = supp_rates | | ||
2343 | ieee80211_mandatory_rates(local, band); | ||
2344 | |||
2345 | rate_control_rate_init(sta, local); | ||
2346 | |||
2347 | if (sta_info_insert(sta)) | ||
2348 | return NULL; | ||
2349 | |||
2350 | return sta; | ||
2351 | } | ||
2352 | |||
2353 | /* configuration hooks */ | ||
2354 | void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, | ||
2355 | struct ieee80211_if_sta *ifsta) | ||
2356 | { | ||
2357 | struct ieee80211_local *local = sdata->local; | ||
2358 | |||
2359 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | ||
2360 | return; | ||
2361 | |||
2362 | if ((ifsta->flags & (IEEE80211_STA_BSSID_SET | | ||
2363 | IEEE80211_STA_AUTO_BSSID_SEL)) && | ||
2364 | (ifsta->flags & (IEEE80211_STA_SSID_SET | | ||
2365 | IEEE80211_STA_AUTO_SSID_SEL))) { | ||
2366 | |||
2367 | if (ifsta->state == IEEE80211_STA_MLME_ASSOCIATED) | ||
2368 | ieee80211_set_disassoc(sdata, ifsta, true, true, | ||
2369 | WLAN_REASON_DEAUTH_LEAVING); | ||
2370 | |||
2371 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); | ||
2372 | queue_work(local->hw.workqueue, &ifsta->work); | ||
2373 | } | ||
2374 | } | ||
2375 | |||
2376 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len) | ||
2377 | { | ||
2378 | struct ieee80211_if_sta *ifsta; | ||
2379 | int res; | ||
2380 | |||
2381 | if (len > IEEE80211_MAX_SSID_LEN) | ||
2382 | return -EINVAL; | ||
2383 | |||
2384 | ifsta = &sdata->u.sta; | ||
2385 | |||
2386 | if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0) { | ||
2387 | memset(ifsta->ssid, 0, sizeof(ifsta->ssid)); | ||
2388 | memcpy(ifsta->ssid, ssid, len); | ||
2389 | ifsta->ssid_len = len; | ||
2390 | ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET; | ||
2391 | |||
2392 | res = 0; | ||
2393 | /* | ||
2394 | * Hack! MLME code needs to be cleaned up to have different | ||
2395 | * entry points for configuration and internal selection change | ||
2396 | */ | ||
2397 | if (netif_running(sdata->dev)) | ||
2398 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_SSID); | ||
2399 | if (res) { | ||
2400 | printk(KERN_DEBUG "%s: Failed to config new SSID to " | ||
2401 | "the low-level driver\n", sdata->dev->name); | ||
2402 | return res; | ||
2403 | } | ||
2404 | } | ||
2405 | |||
2406 | if (len) | ||
2407 | ifsta->flags |= IEEE80211_STA_SSID_SET; | ||
2408 | else | ||
2409 | ifsta->flags &= ~IEEE80211_STA_SSID_SET; | ||
2410 | |||
2411 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && | ||
2412 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { | ||
2413 | ifsta->ibss_join_req = jiffies; | ||
2414 | ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH; | ||
2415 | return ieee80211_sta_find_ibss(sdata, ifsta); | ||
2416 | } | ||
2417 | |||
2418 | return 0; | ||
2419 | } | ||
2420 | |||
2421 | int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len) | ||
2422 | { | ||
2423 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2424 | memcpy(ssid, ifsta->ssid, ifsta->ssid_len); | ||
2425 | *len = ifsta->ssid_len; | ||
2426 | return 0; | ||
2427 | } | ||
2428 | |||
2429 | int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid) | ||
2430 | { | ||
2431 | struct ieee80211_if_sta *ifsta; | ||
2432 | int res; | ||
2433 | |||
2434 | ifsta = &sdata->u.sta; | ||
2435 | |||
2436 | if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { | ||
2437 | memcpy(ifsta->bssid, bssid, ETH_ALEN); | ||
2438 | res = 0; | ||
2439 | /* | ||
2440 | * Hack! See also ieee80211_sta_set_ssid. | ||
2441 | */ | ||
2442 | if (netif_running(sdata->dev)) | ||
2443 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID); | ||
2444 | if (res) { | ||
2445 | printk(KERN_DEBUG "%s: Failed to config new BSSID to " | ||
2446 | "the low-level driver\n", sdata->dev->name); | ||
2447 | return res; | ||
2448 | } | ||
2449 | } | ||
2450 | |||
2451 | if (is_valid_ether_addr(bssid)) | ||
2452 | ifsta->flags |= IEEE80211_STA_BSSID_SET; | ||
2453 | else | ||
2454 | ifsta->flags &= ~IEEE80211_STA_BSSID_SET; | ||
2455 | |||
2456 | return 0; | ||
2457 | } | ||
2458 | |||
2459 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len) | ||
2460 | { | ||
2461 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2462 | |||
2463 | kfree(ifsta->extra_ie); | ||
2464 | if (len == 0) { | ||
2465 | ifsta->extra_ie = NULL; | ||
2466 | ifsta->extra_ie_len = 0; | ||
2467 | return 0; | ||
2468 | } | ||
2469 | ifsta->extra_ie = kmalloc(len, GFP_KERNEL); | ||
2470 | if (!ifsta->extra_ie) { | ||
2471 | ifsta->extra_ie_len = 0; | ||
2472 | return -ENOMEM; | ||
2473 | } | ||
2474 | memcpy(ifsta->extra_ie, ie, len); | ||
2475 | ifsta->extra_ie_len = len; | ||
2476 | return 0; | ||
2477 | } | ||
2478 | |||
2479 | int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason) | ||
2480 | { | ||
2481 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2482 | |||
2483 | printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", | ||
2484 | sdata->dev->name, reason); | ||
2485 | |||
2486 | if (sdata->vif.type != NL80211_IFTYPE_STATION && | ||
2487 | sdata->vif.type != NL80211_IFTYPE_ADHOC) | ||
2488 | return -EINVAL; | ||
2489 | |||
2490 | ieee80211_set_disassoc(sdata, ifsta, true, true, reason); | ||
2491 | return 0; | ||
2492 | } | ||
2493 | |||
2494 | int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason) | ||
2495 | { | ||
2496 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
2497 | |||
2498 | printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", | ||
2499 | sdata->dev->name, reason); | ||
2500 | |||
2501 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | ||
2502 | return -EINVAL; | ||
2503 | |||
2504 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) | ||
2505 | return -1; | ||
2506 | |||
2507 | ieee80211_set_disassoc(sdata, ifsta, false, true, reason); | ||
2508 | return 0; | ||
2509 | } | ||
2510 | |||
2511 | /* scan finished notification */ | ||
2623 | void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local) | 2512 | void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local) |
2624 | { | 2513 | { |
2625 | struct ieee80211_sub_if_data *sdata = local->scan_sdata; | 2514 | struct ieee80211_sub_if_data *sdata = local->scan_sdata; |
2626 | struct ieee80211_if_sta *ifsta; | 2515 | struct ieee80211_if_sta *ifsta; |
2627 | 2516 | ||
2628 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 2517 | if (sdata && sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
2629 | ifsta = &sdata->u.sta; | 2518 | ifsta = &sdata->u.sta; |
2630 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || | 2519 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || |
2631 | (!(ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED) && | 2520 | (!(ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED) && |
2632 | !ieee80211_sta_active_ibss(sdata))) | 2521 | !ieee80211_sta_active_ibss(sdata))) |
2633 | ieee80211_sta_find_ibss(sdata, ifsta); | 2522 | ieee80211_sta_find_ibss(sdata, ifsta); |
2634 | } | 2523 | } |
2524 | |||
2525 | /* Restart STA timers */ | ||
2526 | rcu_read_lock(); | ||
2527 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | ||
2528 | ieee80211_restart_sta_timer(sdata); | ||
2529 | rcu_read_unlock(); | ||
2530 | } | ||
2531 | |||
2532 | /* driver notification call */ | ||
2533 | void ieee80211_notify_mac(struct ieee80211_hw *hw, | ||
2534 | enum ieee80211_notification_types notif_type) | ||
2535 | { | ||
2536 | struct ieee80211_local *local = hw_to_local(hw); | ||
2537 | struct ieee80211_sub_if_data *sdata; | ||
2538 | |||
2539 | switch (notif_type) { | ||
2540 | case IEEE80211_NOTIFY_RE_ASSOC: | ||
2541 | rcu_read_lock(); | ||
2542 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | ||
2543 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | ||
2544 | continue; | ||
2545 | |||
2546 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); | ||
2547 | } | ||
2548 | rcu_read_unlock(); | ||
2549 | break; | ||
2550 | } | ||
2635 | } | 2551 | } |
2552 | EXPORT_SYMBOL(ieee80211_notify_mac); | ||
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h index ede7ab56f65b..5f18c27eb900 100644 --- a/net/mac80211/rate.h +++ b/net/mac80211/rate.h | |||
@@ -134,7 +134,7 @@ static inline int rate_supported(struct sta_info *sta, | |||
134 | enum ieee80211_band band, | 134 | enum ieee80211_band band, |
135 | int index) | 135 | int index) |
136 | { | 136 | { |
137 | return (sta == NULL || sta->supp_rates[band] & BIT(index)); | 137 | return (sta == NULL || sta->sta.supp_rates[band] & BIT(index)); |
138 | } | 138 | } |
139 | 139 | ||
140 | static inline s8 | 140 | static inline s8 |
diff --git a/net/mac80211/rc80211_pid.h b/net/mac80211/rc80211_pid.h index 0a9135b974b5..ffafc5da572e 100644 --- a/net/mac80211/rc80211_pid.h +++ b/net/mac80211/rc80211_pid.h | |||
@@ -180,6 +180,8 @@ struct rc_pid_sta_info { | |||
180 | u32 tx_num_failed; | 180 | u32 tx_num_failed; |
181 | u32 tx_num_xmit; | 181 | u32 tx_num_xmit; |
182 | 182 | ||
183 | int txrate_idx; | ||
184 | |||
183 | /* Average failed frames percentage error (i.e. actual vs. target | 185 | /* Average failed frames percentage error (i.e. actual vs. target |
184 | * percentage), scaled by RC_PID_SMOOTHING. This value is computed | 186 | * percentage), scaled by RC_PID_SMOOTHING. This value is computed |
185 | * using using an exponential weighted average technique: | 187 | * using using an exponential weighted average technique: |
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c index a914ba73ccf5..bc1c4569caa1 100644 --- a/net/mac80211/rc80211_pid_algo.c +++ b/net/mac80211/rc80211_pid_algo.c | |||
@@ -75,7 +75,8 @@ static void rate_control_pid_adjust_rate(struct ieee80211_local *local, | |||
75 | struct ieee80211_sub_if_data *sdata; | 75 | struct ieee80211_sub_if_data *sdata; |
76 | struct ieee80211_supported_band *sband; | 76 | struct ieee80211_supported_band *sband; |
77 | int cur_sorted, new_sorted, probe, tmp, n_bitrates, band; | 77 | int cur_sorted, new_sorted, probe, tmp, n_bitrates, band; |
78 | int cur = sta->txrate_idx; | 78 | struct rc_pid_sta_info *spinfo = (void *)sta->rate_ctrl_priv; |
79 | int cur = spinfo->txrate_idx; | ||
79 | 80 | ||
80 | sdata = sta->sdata; | 81 | sdata = sta->sdata; |
81 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 82 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
@@ -111,7 +112,7 @@ static void rate_control_pid_adjust_rate(struct ieee80211_local *local, | |||
111 | /* Fit the rate found to the nearest supported rate. */ | 112 | /* Fit the rate found to the nearest supported rate. */ |
112 | do { | 113 | do { |
113 | if (rate_supported(sta, band, rinfo[tmp].index)) { | 114 | if (rate_supported(sta, band, rinfo[tmp].index)) { |
114 | sta->txrate_idx = rinfo[tmp].index; | 115 | spinfo->txrate_idx = rinfo[tmp].index; |
115 | break; | 116 | break; |
116 | } | 117 | } |
117 | if (adj < 0) | 118 | if (adj < 0) |
@@ -121,9 +122,9 @@ static void rate_control_pid_adjust_rate(struct ieee80211_local *local, | |||
121 | } while (tmp < n_bitrates && tmp >= 0); | 122 | } while (tmp < n_bitrates && tmp >= 0); |
122 | 123 | ||
123 | #ifdef CONFIG_MAC80211_DEBUGFS | 124 | #ifdef CONFIG_MAC80211_DEBUGFS |
124 | rate_control_pid_event_rate_change( | 125 | rate_control_pid_event_rate_change(&spinfo->events, |
125 | &((struct rc_pid_sta_info *)sta->rate_ctrl_priv)->events, | 126 | spinfo->txrate_idx, |
126 | sta->txrate_idx, sband->bitrates[sta->txrate_idx].bitrate); | 127 | sband->bitrates[spinfo->txrate_idx].bitrate); |
127 | #endif | 128 | #endif |
128 | } | 129 | } |
129 | 130 | ||
@@ -148,9 +149,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo, | |||
148 | struct ieee80211_local *local, | 149 | struct ieee80211_local *local, |
149 | struct sta_info *sta) | 150 | struct sta_info *sta) |
150 | { | 151 | { |
151 | #ifdef CONFIG_MAC80211_MESH | ||
152 | struct ieee80211_sub_if_data *sdata = sta->sdata; | 152 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
153 | #endif | ||
154 | struct rc_pid_sta_info *spinfo = sta->rate_ctrl_priv; | 153 | struct rc_pid_sta_info *spinfo = sta->rate_ctrl_priv; |
155 | struct rc_pid_rateinfo *rinfo = pinfo->rinfo; | 154 | struct rc_pid_rateinfo *rinfo = pinfo->rinfo; |
156 | struct ieee80211_supported_band *sband; | 155 | struct ieee80211_supported_band *sband; |
@@ -181,11 +180,8 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo, | |||
181 | pf = spinfo->last_pf; | 180 | pf = spinfo->last_pf; |
182 | else { | 181 | else { |
183 | pf = spinfo->tx_num_failed * 100 / spinfo->tx_num_xmit; | 182 | pf = spinfo->tx_num_failed * 100 / spinfo->tx_num_xmit; |
184 | #ifdef CONFIG_MAC80211_MESH | 183 | if (ieee80211_vif_is_mesh(&sdata->vif) && pf == 100) |
185 | if (pf == 100 && | ||
186 | sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) | ||
187 | mesh_plink_broken(sta); | 184 | mesh_plink_broken(sta); |
188 | #endif | ||
189 | pf <<= RC_PID_ARITH_SHIFT; | 185 | pf <<= RC_PID_ARITH_SHIFT; |
190 | sta->fail_avg = ((pf + (spinfo->last_pf << 3)) / 9) | 186 | sta->fail_avg = ((pf + (spinfo->last_pf << 3)) / 9) |
191 | >> RC_PID_ARITH_SHIFT; | 187 | >> RC_PID_ARITH_SHIFT; |
@@ -195,16 +191,16 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo, | |||
195 | spinfo->tx_num_failed = 0; | 191 | spinfo->tx_num_failed = 0; |
196 | 192 | ||
197 | /* If we just switched rate, update the rate behaviour info. */ | 193 | /* If we just switched rate, update the rate behaviour info. */ |
198 | if (pinfo->oldrate != sta->txrate_idx) { | 194 | if (pinfo->oldrate != spinfo->txrate_idx) { |
199 | 195 | ||
200 | i = rinfo[pinfo->oldrate].rev_index; | 196 | i = rinfo[pinfo->oldrate].rev_index; |
201 | j = rinfo[sta->txrate_idx].rev_index; | 197 | j = rinfo[spinfo->txrate_idx].rev_index; |
202 | 198 | ||
203 | tmp = (pf - spinfo->last_pf); | 199 | tmp = (pf - spinfo->last_pf); |
204 | tmp = RC_PID_DO_ARITH_RIGHT_SHIFT(tmp, RC_PID_ARITH_SHIFT); | 200 | tmp = RC_PID_DO_ARITH_RIGHT_SHIFT(tmp, RC_PID_ARITH_SHIFT); |
205 | 201 | ||
206 | rinfo[j].diff = rinfo[i].diff + tmp; | 202 | rinfo[j].diff = rinfo[i].diff + tmp; |
207 | pinfo->oldrate = sta->txrate_idx; | 203 | pinfo->oldrate = spinfo->txrate_idx; |
208 | } | 204 | } |
209 | rate_control_pid_normalize(pinfo, sband->n_bitrates); | 205 | rate_control_pid_normalize(pinfo, sband->n_bitrates); |
210 | 206 | ||
@@ -257,19 +253,20 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev, | |||
257 | if (!sta) | 253 | if (!sta) |
258 | goto unlock; | 254 | goto unlock; |
259 | 255 | ||
256 | spinfo = sta->rate_ctrl_priv; | ||
257 | |||
260 | /* Don't update the state if we're not controlling the rate. */ | 258 | /* Don't update the state if we're not controlling the rate. */ |
261 | sdata = sta->sdata; | 259 | sdata = sta->sdata; |
262 | if (sdata->force_unicast_rateidx > -1) { | 260 | if (sdata->force_unicast_rateidx > -1) { |
263 | sta->txrate_idx = sdata->max_ratectrl_rateidx; | 261 | spinfo->txrate_idx = sdata->max_ratectrl_rateidx; |
264 | goto unlock; | 262 | goto unlock; |
265 | } | 263 | } |
266 | 264 | ||
267 | /* Ignore all frames that were sent with a different rate than the rate | 265 | /* Ignore all frames that were sent with a different rate than the rate |
268 | * we currently advise mac80211 to use. */ | 266 | * we currently advise mac80211 to use. */ |
269 | if (info->tx_rate_idx != sta->txrate_idx) | 267 | if (info->tx_rate_idx != spinfo->txrate_idx) |
270 | goto unlock; | 268 | goto unlock; |
271 | 269 | ||
272 | spinfo = sta->rate_ctrl_priv; | ||
273 | spinfo->tx_num_xmit++; | 270 | spinfo->tx_num_xmit++; |
274 | 271 | ||
275 | #ifdef CONFIG_MAC80211_DEBUGFS | 272 | #ifdef CONFIG_MAC80211_DEBUGFS |
@@ -287,17 +284,6 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev, | |||
287 | spinfo->tx_num_xmit++; | 284 | spinfo->tx_num_xmit++; |
288 | } | 285 | } |
289 | 286 | ||
290 | if (info->status.excessive_retries) { | ||
291 | sta->tx_retry_failed++; | ||
292 | sta->tx_num_consecutive_failures++; | ||
293 | sta->tx_num_mpdu_fail++; | ||
294 | } else { | ||
295 | sta->tx_num_consecutive_failures = 0; | ||
296 | sta->tx_num_mpdu_ok++; | ||
297 | } | ||
298 | sta->tx_retry_count += info->status.retry_count; | ||
299 | sta->tx_num_mpdu_fail += info->status.retry_count; | ||
300 | |||
301 | /* Update PID controller state. */ | 287 | /* Update PID controller state. */ |
302 | period = (HZ * pinfo->sampling_period + 500) / 1000; | 288 | period = (HZ * pinfo->sampling_period + 500) / 1000; |
303 | if (!period) | 289 | if (!period) |
@@ -317,6 +303,7 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev, | |||
317 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 303 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
318 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 304 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
319 | struct ieee80211_sub_if_data *sdata; | 305 | struct ieee80211_sub_if_data *sdata; |
306 | struct rc_pid_sta_info *spinfo; | ||
320 | struct sta_info *sta; | 307 | struct sta_info *sta; |
321 | int rateidx; | 308 | int rateidx; |
322 | u16 fc; | 309 | u16 fc; |
@@ -337,16 +324,15 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev, | |||
337 | 324 | ||
338 | /* If a forced rate is in effect, select it. */ | 325 | /* If a forced rate is in effect, select it. */ |
339 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 326 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
327 | spinfo = (struct rc_pid_sta_info *)sta->rate_ctrl_priv; | ||
340 | if (sdata->force_unicast_rateidx > -1) | 328 | if (sdata->force_unicast_rateidx > -1) |
341 | sta->txrate_idx = sdata->force_unicast_rateidx; | 329 | spinfo->txrate_idx = sdata->force_unicast_rateidx; |
342 | 330 | ||
343 | rateidx = sta->txrate_idx; | 331 | rateidx = spinfo->txrate_idx; |
344 | 332 | ||
345 | if (rateidx >= sband->n_bitrates) | 333 | if (rateidx >= sband->n_bitrates) |
346 | rateidx = sband->n_bitrates - 1; | 334 | rateidx = sband->n_bitrates - 1; |
347 | 335 | ||
348 | sta->last_txrate_idx = rateidx; | ||
349 | |||
350 | rcu_read_unlock(); | 336 | rcu_read_unlock(); |
351 | 337 | ||
352 | sel->rate_idx = rateidx; | 338 | sel->rate_idx = rateidx; |
@@ -367,9 +353,10 @@ static void rate_control_pid_rate_init(void *priv, void *priv_sta, | |||
367 | * Until that method is implemented, we will use the lowest supported | 353 | * Until that method is implemented, we will use the lowest supported |
368 | * rate as a workaround. */ | 354 | * rate as a workaround. */ |
369 | struct ieee80211_supported_band *sband; | 355 | struct ieee80211_supported_band *sband; |
356 | struct rc_pid_sta_info *spinfo = (void *)sta->rate_ctrl_priv; | ||
370 | 357 | ||
371 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 358 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
372 | sta->txrate_idx = rate_lowest_index(local, sband, sta); | 359 | spinfo->txrate_idx = rate_lowest_index(local, sband, sta); |
373 | sta->fail_avg = 0; | 360 | sta->fail_avg = 0; |
374 | } | 361 | } |
375 | 362 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index d0803797902b..92d898b901e9 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -295,7 +295,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
295 | if (!netif_running(sdata->dev)) | 295 | if (!netif_running(sdata->dev)) |
296 | continue; | 296 | continue; |
297 | 297 | ||
298 | if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR) | 298 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) |
299 | continue; | 299 | continue; |
300 | 300 | ||
301 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) | 301 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) |
@@ -403,12 +403,12 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) | |||
403 | struct ieee80211_local *local = rx->local; | 403 | struct ieee80211_local *local = rx->local; |
404 | struct sk_buff *skb = rx->skb; | 404 | struct sk_buff *skb = rx->skb; |
405 | 405 | ||
406 | if (unlikely(local->sta_hw_scanning)) | 406 | if (unlikely(local->hw_scanning)) |
407 | return ieee80211_sta_rx_scan(rx->sdata, skb, rx->status); | 407 | return ieee80211_scan_rx(rx->sdata, skb, rx->status); |
408 | 408 | ||
409 | if (unlikely(local->sta_sw_scanning)) { | 409 | if (unlikely(local->sw_scanning)) { |
410 | /* drop all the other packets during a software scan anyway */ | 410 | /* drop all the other packets during a software scan anyway */ |
411 | if (ieee80211_sta_rx_scan(rx->sdata, skb, rx->status) | 411 | if (ieee80211_scan_rx(rx->sdata, skb, rx->status) |
412 | != RX_QUEUED) | 412 | != RX_QUEUED) |
413 | dev_kfree_skb(skb); | 413 | dev_kfree_skb(skb); |
414 | return RX_QUEUED; | 414 | return RX_QUEUED; |
@@ -501,8 +501,8 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
501 | /* Drop disallowed frame classes based on STA auth/assoc state; | 501 | /* Drop disallowed frame classes based on STA auth/assoc state; |
502 | * IEEE 802.11, Chap 5.5. | 502 | * IEEE 802.11, Chap 5.5. |
503 | * | 503 | * |
504 | * 80211.o does filtering only based on association state, i.e., it | 504 | * mac80211 filters only based on association state, i.e. it drops |
505 | * drops Class 3 frames from not associated stations. hostapd sends | 505 | * Class 3 frames from not associated stations. hostapd sends |
506 | * deauth/disassoc frames when needed. In addition, hostapd is | 506 | * deauth/disassoc frames when needed. In addition, hostapd is |
507 | * responsible for filtering on both auth and assoc states. | 507 | * responsible for filtering on both auth and assoc states. |
508 | */ | 508 | */ |
@@ -512,7 +512,7 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
512 | 512 | ||
513 | if (unlikely((ieee80211_is_data(hdr->frame_control) || | 513 | if (unlikely((ieee80211_is_data(hdr->frame_control) || |
514 | ieee80211_is_pspoll(hdr->frame_control)) && | 514 | ieee80211_is_pspoll(hdr->frame_control)) && |
515 | rx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 515 | rx->sdata->vif.type != NL80211_IFTYPE_ADHOC && |
516 | (!rx->sta || !test_sta_flags(rx->sta, WLAN_STA_ASSOC)))) { | 516 | (!rx->sta || !test_sta_flags(rx->sta, WLAN_STA_ASSOC)))) { |
517 | if ((!ieee80211_has_fromds(hdr->frame_control) && | 517 | if ((!ieee80211_has_fromds(hdr->frame_control) && |
518 | !ieee80211_has_tods(hdr->frame_control) && | 518 | !ieee80211_has_tods(hdr->frame_control) && |
@@ -661,7 +661,7 @@ static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta) | |||
661 | set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL); | 661 | set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL); |
662 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 662 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
663 | printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n", | 663 | printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n", |
664 | dev->name, print_mac(mac, sta->addr), sta->aid); | 664 | dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid); |
665 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 665 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
666 | } | 666 | } |
667 | 667 | ||
@@ -685,7 +685,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) | |||
685 | 685 | ||
686 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 686 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
687 | printk(KERN_DEBUG "%s: STA %s aid %d exits power save mode\n", | 687 | printk(KERN_DEBUG "%s: STA %s aid %d exits power save mode\n", |
688 | dev->name, print_mac(mac, sta->addr), sta->aid); | 688 | dev->name, print_mac(mac, sta->sta.addr), sta->sta.aid); |
689 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 689 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
690 | 690 | ||
691 | /* Send all buffered frames to the station */ | 691 | /* Send all buffered frames to the station */ |
@@ -702,7 +702,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) | |||
702 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 702 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
703 | printk(KERN_DEBUG "%s: STA %s aid %d send PS frame " | 703 | printk(KERN_DEBUG "%s: STA %s aid %d send PS frame " |
704 | "since STA not sleeping anymore\n", dev->name, | 704 | "since STA not sleeping anymore\n", dev->name, |
705 | print_mac(mac, sta->addr), sta->aid); | 705 | print_mac(mac, sta->sta.addr), sta->sta.aid); |
706 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 706 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
707 | info->flags |= IEEE80211_TX_CTL_REQUEUE; | 707 | info->flags |= IEEE80211_TX_CTL_REQUEUE; |
708 | dev_queue_xmit(skb); | 708 | dev_queue_xmit(skb); |
@@ -724,14 +724,14 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
724 | /* Update last_rx only for IBSS packets which are for the current | 724 | /* Update last_rx only for IBSS packets which are for the current |
725 | * BSSID to avoid keeping the current IBSS network alive in cases where | 725 | * BSSID to avoid keeping the current IBSS network alive in cases where |
726 | * other STAs are using different BSSID. */ | 726 | * other STAs are using different BSSID. */ |
727 | if (rx->sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 727 | if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
728 | u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len, | 728 | u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len, |
729 | IEEE80211_IF_TYPE_IBSS); | 729 | NL80211_IFTYPE_ADHOC); |
730 | if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0) | 730 | if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0) |
731 | sta->last_rx = jiffies; | 731 | sta->last_rx = jiffies; |
732 | } else | 732 | } else |
733 | if (!is_multicast_ether_addr(hdr->addr1) || | 733 | if (!is_multicast_ether_addr(hdr->addr1) || |
734 | rx->sdata->vif.type == IEEE80211_IF_TYPE_STA) { | 734 | rx->sdata->vif.type == NL80211_IFTYPE_STATION) { |
735 | /* Update last_rx only for unicast frames in order to prevent | 735 | /* Update last_rx only for unicast frames in order to prevent |
736 | * the Probe Request frames (the only broadcast frames from a | 736 | * the Probe Request frames (the only broadcast frames from a |
737 | * STA in infrastructure mode) from keeping a connection alive. | 737 | * STA in infrastructure mode) from keeping a connection alive. |
@@ -751,8 +751,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
751 | sta->last_noise = rx->status->noise; | 751 | sta->last_noise = rx->status->noise; |
752 | 752 | ||
753 | if (!ieee80211_has_morefrags(hdr->frame_control) && | 753 | if (!ieee80211_has_morefrags(hdr->frame_control) && |
754 | (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP || | 754 | (rx->sdata->vif.type == NL80211_IFTYPE_AP || |
755 | rx->sdata->vif.type == IEEE80211_IF_TYPE_VLAN)) { | 755 | rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) { |
756 | /* Change STA power saving mode only in the end of a frame | 756 | /* Change STA power saving mode only in the end of a frame |
757 | * exchange sequence */ | 757 | * exchange sequence */ |
758 | if (test_sta_flags(sta, WLAN_STA_PS) && | 758 | if (test_sta_flags(sta, WLAN_STA_PS) && |
@@ -982,8 +982,8 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
982 | !(rx->flags & IEEE80211_RX_RA_MATCH))) | 982 | !(rx->flags & IEEE80211_RX_RA_MATCH))) |
983 | return RX_CONTINUE; | 983 | return RX_CONTINUE; |
984 | 984 | ||
985 | if ((sdata->vif.type != IEEE80211_IF_TYPE_AP) && | 985 | if ((sdata->vif.type != NL80211_IFTYPE_AP) && |
986 | (sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) | 986 | (sdata->vif.type != NL80211_IFTYPE_AP_VLAN)) |
987 | return RX_DROP_UNUSABLE; | 987 | return RX_DROP_UNUSABLE; |
988 | 988 | ||
989 | skb = skb_dequeue(&rx->sta->tx_filtered); | 989 | skb = skb_dequeue(&rx->sta->tx_filtered); |
@@ -1007,7 +1007,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
1007 | 1007 | ||
1008 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1008 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
1009 | printk(KERN_DEBUG "STA %s aid %d: PS Poll (entries after %d)\n", | 1009 | printk(KERN_DEBUG "STA %s aid %d: PS Poll (entries after %d)\n", |
1010 | print_mac(mac, rx->sta->addr), rx->sta->aid, | 1010 | print_mac(mac, rx->sta->sta.addr), rx->sta->sta.aid, |
1011 | skb_queue_len(&rx->sta->ps_tx_buf)); | 1011 | skb_queue_len(&rx->sta->ps_tx_buf)); |
1012 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1012 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1013 | 1013 | ||
@@ -1032,7 +1032,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
1032 | */ | 1032 | */ |
1033 | printk(KERN_DEBUG "%s: STA %s sent PS Poll even " | 1033 | printk(KERN_DEBUG "%s: STA %s sent PS Poll even " |
1034 | "though there are no buffered frames for it\n", | 1034 | "though there are no buffered frames for it\n", |
1035 | rx->dev->name, print_mac(mac, rx->sta->addr)); | 1035 | rx->dev->name, print_mac(mac, rx->sta->sta.addr)); |
1036 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1036 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1037 | } | 1037 | } |
1038 | 1038 | ||
@@ -1131,23 +1131,23 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1131 | switch (hdr->frame_control & | 1131 | switch (hdr->frame_control & |
1132 | cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { | 1132 | cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { |
1133 | case __constant_cpu_to_le16(IEEE80211_FCTL_TODS): | 1133 | case __constant_cpu_to_le16(IEEE80211_FCTL_TODS): |
1134 | if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP && | 1134 | if (unlikely(sdata->vif.type != NL80211_IFTYPE_AP && |
1135 | sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) | 1135 | sdata->vif.type != NL80211_IFTYPE_AP_VLAN)) |
1136 | return -1; | 1136 | return -1; |
1137 | break; | 1137 | break; |
1138 | case __constant_cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): | 1138 | case __constant_cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): |
1139 | if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS && | 1139 | if (unlikely(sdata->vif.type != NL80211_IFTYPE_WDS && |
1140 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)) | 1140 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT)) |
1141 | return -1; | 1141 | return -1; |
1142 | break; | 1142 | break; |
1143 | case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS): | 1143 | case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS): |
1144 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA || | 1144 | if (sdata->vif.type != NL80211_IFTYPE_STATION || |
1145 | (is_multicast_ether_addr(dst) && | 1145 | (is_multicast_ether_addr(dst) && |
1146 | !compare_ether_addr(src, dev->dev_addr))) | 1146 | !compare_ether_addr(src, dev->dev_addr))) |
1147 | return -1; | 1147 | return -1; |
1148 | break; | 1148 | break; |
1149 | case __constant_cpu_to_le16(0): | 1149 | case __constant_cpu_to_le16(0): |
1150 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 1150 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC) |
1151 | return -1; | 1151 | return -1; |
1152 | break; | 1152 | break; |
1153 | } | 1153 | } |
@@ -1221,8 +1221,9 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1221 | skb = rx->skb; | 1221 | skb = rx->skb; |
1222 | xmit_skb = NULL; | 1222 | xmit_skb = NULL; |
1223 | 1223 | ||
1224 | if (local->bridge_packets && (sdata->vif.type == IEEE80211_IF_TYPE_AP || | 1224 | if ((sdata->vif.type == NL80211_IFTYPE_AP || |
1225 | sdata->vif.type == IEEE80211_IF_TYPE_VLAN) && | 1225 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && |
1226 | !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && | ||
1226 | (rx->flags & IEEE80211_RX_RA_MATCH)) { | 1227 | (rx->flags & IEEE80211_RX_RA_MATCH)) { |
1227 | if (is_multicast_ether_addr(ehdr->h_dest)) { | 1228 | if (is_multicast_ether_addr(ehdr->h_dest)) { |
1228 | /* | 1229 | /* |
@@ -1404,7 +1405,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1404 | 1405 | ||
1405 | if (rx->flags & IEEE80211_RX_RA_MATCH) { | 1406 | if (rx->flags & IEEE80211_RX_RA_MATCH) { |
1406 | if (!mesh_hdr->ttl) | 1407 | if (!mesh_hdr->ttl) |
1407 | IEEE80211_IFSTA_MESH_CTR_INC(&rx->sdata->u.sta, | 1408 | IEEE80211_IFSTA_MESH_CTR_INC(&rx->sdata->u.mesh, |
1408 | dropped_frames_ttl); | 1409 | dropped_frames_ttl); |
1409 | else { | 1410 | else { |
1410 | struct ieee80211_hdr *fwd_hdr; | 1411 | struct ieee80211_hdr *fwd_hdr; |
@@ -1535,8 +1536,8 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
1535 | * FIXME: revisit this, I'm sure we should handle most | 1536 | * FIXME: revisit this, I'm sure we should handle most |
1536 | * of these frames in other modes as well! | 1537 | * of these frames in other modes as well! |
1537 | */ | 1538 | */ |
1538 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 1539 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
1539 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 1540 | sdata->vif.type != NL80211_IFTYPE_ADHOC) |
1540 | return RX_DROP_MONITOR; | 1541 | return RX_DROP_MONITOR; |
1541 | 1542 | ||
1542 | switch (mgmt->u.action.category) { | 1543 | switch (mgmt->u.action.category) { |
@@ -1591,9 +1592,11 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) | |||
1591 | if (!(rx->flags & IEEE80211_RX_RA_MATCH)) | 1592 | if (!(rx->flags & IEEE80211_RX_RA_MATCH)) |
1592 | return RX_DROP_MONITOR; | 1593 | return RX_DROP_MONITOR; |
1593 | 1594 | ||
1594 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 1595 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
1595 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 1596 | return ieee80211_mesh_rx_mgmt(sdata, rx->skb, rx->status); |
1596 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) | 1597 | |
1598 | if (sdata->vif.type != NL80211_IFTYPE_STATION && | ||
1599 | sdata->vif.type != NL80211_IFTYPE_ADHOC) | ||
1597 | return RX_DROP_MONITOR; | 1600 | return RX_DROP_MONITOR; |
1598 | 1601 | ||
1599 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) | 1602 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) |
@@ -1629,7 +1632,7 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, | |||
1629 | if (!ieee80211_has_protected(hdr->frame_control)) | 1632 | if (!ieee80211_has_protected(hdr->frame_control)) |
1630 | goto ignore; | 1633 | goto ignore; |
1631 | 1634 | ||
1632 | if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) { | 1635 | if (rx->sdata->vif.type == NL80211_IFTYPE_AP && keyidx) { |
1633 | /* | 1636 | /* |
1634 | * APs with pairwise keys should never receive Michael MIC | 1637 | * APs with pairwise keys should never receive Michael MIC |
1635 | * errors for non-zero keyidx because these are reserved for | 1638 | * errors for non-zero keyidx because these are reserved for |
@@ -1699,7 +1702,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx) | |||
1699 | if (!netif_running(sdata->dev)) | 1702 | if (!netif_running(sdata->dev)) |
1700 | continue; | 1703 | continue; |
1701 | 1704 | ||
1702 | if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR || | 1705 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR || |
1703 | !(sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)) | 1706 | !(sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)) |
1704 | continue; | 1707 | continue; |
1705 | 1708 | ||
@@ -1798,7 +1801,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1798 | int multicast = is_multicast_ether_addr(hdr->addr1); | 1801 | int multicast = is_multicast_ether_addr(hdr->addr1); |
1799 | 1802 | ||
1800 | switch (sdata->vif.type) { | 1803 | switch (sdata->vif.type) { |
1801 | case IEEE80211_IF_TYPE_STA: | 1804 | case NL80211_IFTYPE_STATION: |
1802 | if (!bssid) | 1805 | if (!bssid) |
1803 | return 0; | 1806 | return 0; |
1804 | if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { | 1807 | if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { |
@@ -1813,7 +1816,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1813 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 1816 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
1814 | } | 1817 | } |
1815 | break; | 1818 | break; |
1816 | case IEEE80211_IF_TYPE_IBSS: | 1819 | case NL80211_IFTYPE_ADHOC: |
1817 | if (!bssid) | 1820 | if (!bssid) |
1818 | return 0; | 1821 | return 0; |
1819 | if (ieee80211_is_beacon(hdr->frame_control)) { | 1822 | if (ieee80211_is_beacon(hdr->frame_control)) { |
@@ -1834,7 +1837,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1834 | bssid, hdr->addr2, | 1837 | bssid, hdr->addr2, |
1835 | BIT(rx->status->rate_idx)); | 1838 | BIT(rx->status->rate_idx)); |
1836 | break; | 1839 | break; |
1837 | case IEEE80211_IF_TYPE_MESH_POINT: | 1840 | case NL80211_IFTYPE_MESH_POINT: |
1838 | if (!multicast && | 1841 | if (!multicast && |
1839 | compare_ether_addr(sdata->dev->dev_addr, | 1842 | compare_ether_addr(sdata->dev->dev_addr, |
1840 | hdr->addr1) != 0) { | 1843 | hdr->addr1) != 0) { |
@@ -1844,8 +1847,8 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1844 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 1847 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
1845 | } | 1848 | } |
1846 | break; | 1849 | break; |
1847 | case IEEE80211_IF_TYPE_VLAN: | 1850 | case NL80211_IFTYPE_AP_VLAN: |
1848 | case IEEE80211_IF_TYPE_AP: | 1851 | case NL80211_IFTYPE_AP: |
1849 | if (!bssid) { | 1852 | if (!bssid) { |
1850 | if (compare_ether_addr(sdata->dev->dev_addr, | 1853 | if (compare_ether_addr(sdata->dev->dev_addr, |
1851 | hdr->addr1)) | 1854 | hdr->addr1)) |
@@ -1857,16 +1860,17 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1857 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 1860 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
1858 | } | 1861 | } |
1859 | break; | 1862 | break; |
1860 | case IEEE80211_IF_TYPE_WDS: | 1863 | case NL80211_IFTYPE_WDS: |
1861 | if (bssid || !ieee80211_is_data(hdr->frame_control)) | 1864 | if (bssid || !ieee80211_is_data(hdr->frame_control)) |
1862 | return 0; | 1865 | return 0; |
1863 | if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) | 1866 | if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) |
1864 | return 0; | 1867 | return 0; |
1865 | break; | 1868 | break; |
1866 | case IEEE80211_IF_TYPE_MNTR: | 1869 | case NL80211_IFTYPE_MONITOR: |
1867 | /* take everything */ | 1870 | /* take everything */ |
1868 | break; | 1871 | break; |
1869 | case IEEE80211_IF_TYPE_INVALID: | 1872 | case NL80211_IFTYPE_UNSPECIFIED: |
1873 | case __NL80211_IFTYPE_AFTER_LAST: | ||
1870 | /* should never get here */ | 1874 | /* should never get here */ |
1871 | WARN_ON(1); | 1875 | WARN_ON(1); |
1872 | break; | 1876 | break; |
@@ -1915,7 +1919,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
1915 | return; | 1919 | return; |
1916 | } | 1920 | } |
1917 | 1921 | ||
1918 | if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning)) | 1922 | if (unlikely(local->sw_scanning || local->hw_scanning)) |
1919 | rx.flags |= IEEE80211_RX_IN_SCAN; | 1923 | rx.flags |= IEEE80211_RX_IN_SCAN; |
1920 | 1924 | ||
1921 | ieee80211_parse_qos(&rx); | 1925 | ieee80211_parse_qos(&rx); |
@@ -1927,7 +1931,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
1927 | if (!netif_running(sdata->dev)) | 1931 | if (!netif_running(sdata->dev)) |
1928 | continue; | 1932 | continue; |
1929 | 1933 | ||
1930 | if (sdata->vif.type == IEEE80211_IF_TYPE_MNTR) | 1934 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) |
1931 | continue; | 1935 | continue; |
1932 | 1936 | ||
1933 | bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type); | 1937 | bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type); |
@@ -2136,7 +2140,7 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local, | |||
2136 | /* if this mpdu is fragmented - terminate rx aggregation session */ | 2140 | /* if this mpdu is fragmented - terminate rx aggregation session */ |
2137 | sc = le16_to_cpu(hdr->seq_ctrl); | 2141 | sc = le16_to_cpu(hdr->seq_ctrl); |
2138 | if (sc & IEEE80211_SCTL_FRAG) { | 2142 | if (sc & IEEE80211_SCTL_FRAG) { |
2139 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->addr, | 2143 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->sta.addr, |
2140 | tid, 0, WLAN_REASON_QSTA_REQUIRE_SETUP); | 2144 | tid, 0, WLAN_REASON_QSTA_REQUIRE_SETUP); |
2141 | ret = 1; | 2145 | ret = 1; |
2142 | goto end_reorder; | 2146 | goto end_reorder; |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 010781b806f3..8e6685e7ae85 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -32,26 +32,26 @@ | |||
32 | 32 | ||
33 | void ieee80211_rx_bss_list_init(struct ieee80211_local *local) | 33 | void ieee80211_rx_bss_list_init(struct ieee80211_local *local) |
34 | { | 34 | { |
35 | spin_lock_init(&local->sta_bss_lock); | 35 | spin_lock_init(&local->bss_lock); |
36 | INIT_LIST_HEAD(&local->sta_bss_list); | 36 | INIT_LIST_HEAD(&local->bss_list); |
37 | } | 37 | } |
38 | 38 | ||
39 | void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local) | 39 | void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local) |
40 | { | 40 | { |
41 | struct ieee80211_sta_bss *bss, *tmp; | 41 | struct ieee80211_bss *bss, *tmp; |
42 | 42 | ||
43 | list_for_each_entry_safe(bss, tmp, &local->sta_bss_list, list) | 43 | list_for_each_entry_safe(bss, tmp, &local->bss_list, list) |
44 | ieee80211_rx_bss_put(local, bss); | 44 | ieee80211_rx_bss_put(local, bss); |
45 | } | 45 | } |
46 | 46 | ||
47 | struct ieee80211_sta_bss * | 47 | struct ieee80211_bss * |
48 | ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, | 48 | ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, |
49 | u8 *ssid, u8 ssid_len) | 49 | u8 *ssid, u8 ssid_len) |
50 | { | 50 | { |
51 | struct ieee80211_sta_bss *bss; | 51 | struct ieee80211_bss *bss; |
52 | 52 | ||
53 | spin_lock_bh(&local->sta_bss_lock); | 53 | spin_lock_bh(&local->bss_lock); |
54 | bss = local->sta_bss_hash[STA_HASH(bssid)]; | 54 | bss = local->bss_hash[STA_HASH(bssid)]; |
55 | while (bss) { | 55 | while (bss) { |
56 | if (!bss_mesh_cfg(bss) && | 56 | if (!bss_mesh_cfg(bss) && |
57 | !memcmp(bss->bssid, bssid, ETH_ALEN) && | 57 | !memcmp(bss->bssid, bssid, ETH_ALEN) && |
@@ -63,13 +63,13 @@ ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, | |||
63 | } | 63 | } |
64 | bss = bss->hnext; | 64 | bss = bss->hnext; |
65 | } | 65 | } |
66 | spin_unlock_bh(&local->sta_bss_lock); | 66 | spin_unlock_bh(&local->bss_lock); |
67 | return bss; | 67 | return bss; |
68 | } | 68 | } |
69 | 69 | ||
70 | /* Caller must hold local->sta_bss_lock */ | 70 | /* Caller must hold local->bss_lock */ |
71 | static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local, | 71 | static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local, |
72 | struct ieee80211_sta_bss *bss) | 72 | struct ieee80211_bss *bss) |
73 | { | 73 | { |
74 | u8 hash_idx; | 74 | u8 hash_idx; |
75 | 75 | ||
@@ -79,20 +79,20 @@ static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local, | |||
79 | else | 79 | else |
80 | hash_idx = STA_HASH(bss->bssid); | 80 | hash_idx = STA_HASH(bss->bssid); |
81 | 81 | ||
82 | bss->hnext = local->sta_bss_hash[hash_idx]; | 82 | bss->hnext = local->bss_hash[hash_idx]; |
83 | local->sta_bss_hash[hash_idx] = bss; | 83 | local->bss_hash[hash_idx] = bss; |
84 | } | 84 | } |
85 | 85 | ||
86 | /* Caller must hold local->sta_bss_lock */ | 86 | /* Caller must hold local->bss_lock */ |
87 | static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local, | 87 | static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local, |
88 | struct ieee80211_sta_bss *bss) | 88 | struct ieee80211_bss *bss) |
89 | { | 89 | { |
90 | struct ieee80211_sta_bss *b, *prev = NULL; | 90 | struct ieee80211_bss *b, *prev = NULL; |
91 | b = local->sta_bss_hash[STA_HASH(bss->bssid)]; | 91 | b = local->bss_hash[STA_HASH(bss->bssid)]; |
92 | while (b) { | 92 | while (b) { |
93 | if (b == bss) { | 93 | if (b == bss) { |
94 | if (!prev) | 94 | if (!prev) |
95 | local->sta_bss_hash[STA_HASH(bss->bssid)] = | 95 | local->bss_hash[STA_HASH(bss->bssid)] = |
96 | bss->hnext; | 96 | bss->hnext; |
97 | else | 97 | else |
98 | prev->hnext = bss->hnext; | 98 | prev->hnext = bss->hnext; |
@@ -103,11 +103,11 @@ static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local, | |||
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | struct ieee80211_sta_bss * | 106 | struct ieee80211_bss * |
107 | ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq, | 107 | ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq, |
108 | u8 *ssid, u8 ssid_len) | 108 | u8 *ssid, u8 ssid_len) |
109 | { | 109 | { |
110 | struct ieee80211_sta_bss *bss; | 110 | struct ieee80211_bss *bss; |
111 | 111 | ||
112 | bss = kzalloc(sizeof(*bss), GFP_ATOMIC); | 112 | bss = kzalloc(sizeof(*bss), GFP_ATOMIC); |
113 | if (!bss) | 113 | if (!bss) |
@@ -120,23 +120,23 @@ ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq, | |||
120 | bss->ssid_len = ssid_len; | 120 | bss->ssid_len = ssid_len; |
121 | } | 121 | } |
122 | 122 | ||
123 | spin_lock_bh(&local->sta_bss_lock); | 123 | spin_lock_bh(&local->bss_lock); |
124 | /* TODO: order by RSSI? */ | 124 | /* TODO: order by RSSI? */ |
125 | list_add_tail(&bss->list, &local->sta_bss_list); | 125 | list_add_tail(&bss->list, &local->bss_list); |
126 | __ieee80211_rx_bss_hash_add(local, bss); | 126 | __ieee80211_rx_bss_hash_add(local, bss); |
127 | spin_unlock_bh(&local->sta_bss_lock); | 127 | spin_unlock_bh(&local->bss_lock); |
128 | return bss; | 128 | return bss; |
129 | } | 129 | } |
130 | 130 | ||
131 | #ifdef CONFIG_MAC80211_MESH | 131 | #ifdef CONFIG_MAC80211_MESH |
132 | static struct ieee80211_sta_bss * | 132 | static struct ieee80211_bss * |
133 | ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, | 133 | ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, |
134 | u8 *mesh_cfg, int freq) | 134 | u8 *mesh_cfg, int freq) |
135 | { | 135 | { |
136 | struct ieee80211_sta_bss *bss; | 136 | struct ieee80211_bss *bss; |
137 | 137 | ||
138 | spin_lock_bh(&local->sta_bss_lock); | 138 | spin_lock_bh(&local->bss_lock); |
139 | bss = local->sta_bss_hash[mesh_id_hash(mesh_id, mesh_id_len)]; | 139 | bss = local->bss_hash[mesh_id_hash(mesh_id, mesh_id_len)]; |
140 | while (bss) { | 140 | while (bss) { |
141 | if (bss_mesh_cfg(bss) && | 141 | if (bss_mesh_cfg(bss) && |
142 | !memcmp(bss_mesh_cfg(bss), mesh_cfg, MESH_CFG_CMP_LEN) && | 142 | !memcmp(bss_mesh_cfg(bss), mesh_cfg, MESH_CFG_CMP_LEN) && |
@@ -149,15 +149,15 @@ ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_i | |||
149 | } | 149 | } |
150 | bss = bss->hnext; | 150 | bss = bss->hnext; |
151 | } | 151 | } |
152 | spin_unlock_bh(&local->sta_bss_lock); | 152 | spin_unlock_bh(&local->bss_lock); |
153 | return bss; | 153 | return bss; |
154 | } | 154 | } |
155 | 155 | ||
156 | static struct ieee80211_sta_bss * | 156 | static struct ieee80211_bss * |
157 | ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, | 157 | ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, |
158 | u8 *mesh_cfg, int mesh_config_len, int freq) | 158 | u8 *mesh_cfg, int mesh_config_len, int freq) |
159 | { | 159 | { |
160 | struct ieee80211_sta_bss *bss; | 160 | struct ieee80211_bss *bss; |
161 | 161 | ||
162 | if (mesh_config_len != MESH_CFG_LEN) | 162 | if (mesh_config_len != MESH_CFG_LEN) |
163 | return NULL; | 163 | return NULL; |
@@ -186,16 +186,16 @@ ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_i | |||
186 | memcpy(bss->mesh_cfg, mesh_cfg, MESH_CFG_CMP_LEN); | 186 | memcpy(bss->mesh_cfg, mesh_cfg, MESH_CFG_CMP_LEN); |
187 | bss->mesh_id_len = mesh_id_len; | 187 | bss->mesh_id_len = mesh_id_len; |
188 | bss->freq = freq; | 188 | bss->freq = freq; |
189 | spin_lock_bh(&local->sta_bss_lock); | 189 | spin_lock_bh(&local->bss_lock); |
190 | /* TODO: order by RSSI? */ | 190 | /* TODO: order by RSSI? */ |
191 | list_add_tail(&bss->list, &local->sta_bss_list); | 191 | list_add_tail(&bss->list, &local->bss_list); |
192 | __ieee80211_rx_bss_hash_add(local, bss); | 192 | __ieee80211_rx_bss_hash_add(local, bss); |
193 | spin_unlock_bh(&local->sta_bss_lock); | 193 | spin_unlock_bh(&local->bss_lock); |
194 | return bss; | 194 | return bss; |
195 | } | 195 | } |
196 | #endif | 196 | #endif |
197 | 197 | ||
198 | static void ieee80211_rx_bss_free(struct ieee80211_sta_bss *bss) | 198 | static void ieee80211_rx_bss_free(struct ieee80211_bss *bss) |
199 | { | 199 | { |
200 | kfree(bss->ies); | 200 | kfree(bss->ies); |
201 | kfree(bss_mesh_id(bss)); | 201 | kfree(bss_mesh_id(bss)); |
@@ -204,21 +204,21 @@ static void ieee80211_rx_bss_free(struct ieee80211_sta_bss *bss) | |||
204 | } | 204 | } |
205 | 205 | ||
206 | void ieee80211_rx_bss_put(struct ieee80211_local *local, | 206 | void ieee80211_rx_bss_put(struct ieee80211_local *local, |
207 | struct ieee80211_sta_bss *bss) | 207 | struct ieee80211_bss *bss) |
208 | { | 208 | { |
209 | local_bh_disable(); | 209 | local_bh_disable(); |
210 | if (!atomic_dec_and_lock(&bss->users, &local->sta_bss_lock)) { | 210 | if (!atomic_dec_and_lock(&bss->users, &local->bss_lock)) { |
211 | local_bh_enable(); | 211 | local_bh_enable(); |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | 214 | ||
215 | __ieee80211_rx_bss_hash_del(local, bss); | 215 | __ieee80211_rx_bss_hash_del(local, bss); |
216 | list_del(&bss->list); | 216 | list_del(&bss->list); |
217 | spin_unlock_bh(&local->sta_bss_lock); | 217 | spin_unlock_bh(&local->bss_lock); |
218 | ieee80211_rx_bss_free(bss); | 218 | ieee80211_rx_bss_free(bss); |
219 | } | 219 | } |
220 | 220 | ||
221 | struct ieee80211_sta_bss * | 221 | struct ieee80211_bss * |
222 | ieee80211_bss_info_update(struct ieee80211_local *local, | 222 | ieee80211_bss_info_update(struct ieee80211_local *local, |
223 | struct ieee80211_rx_status *rx_status, | 223 | struct ieee80211_rx_status *rx_status, |
224 | struct ieee80211_mgmt *mgmt, | 224 | struct ieee80211_mgmt *mgmt, |
@@ -226,7 +226,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
226 | struct ieee802_11_elems *elems, | 226 | struct ieee802_11_elems *elems, |
227 | int freq, bool beacon) | 227 | int freq, bool beacon) |
228 | { | 228 | { |
229 | struct ieee80211_sta_bss *bss; | 229 | struct ieee80211_bss *bss; |
230 | int clen; | 230 | int clen; |
231 | 231 | ||
232 | #ifdef CONFIG_MAC80211_MESH | 232 | #ifdef CONFIG_MAC80211_MESH |
@@ -252,9 +252,9 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
252 | } else { | 252 | } else { |
253 | #if 0 | 253 | #if 0 |
254 | /* TODO: order by RSSI? */ | 254 | /* TODO: order by RSSI? */ |
255 | spin_lock_bh(&local->sta_bss_lock); | 255 | spin_lock_bh(&local->bss_lock); |
256 | list_move_tail(&bss->list, &local->sta_bss_list); | 256 | list_move_tail(&bss->list, &local->bss_list); |
257 | spin_unlock_bh(&local->sta_bss_lock); | 257 | spin_unlock_bh(&local->bss_lock); |
258 | #endif | 258 | #endif |
259 | } | 259 | } |
260 | 260 | ||
@@ -327,11 +327,11 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
327 | } | 327 | } |
328 | 328 | ||
329 | ieee80211_rx_result | 329 | ieee80211_rx_result |
330 | ieee80211_sta_rx_scan(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | 330 | ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
331 | struct ieee80211_rx_status *rx_status) | 331 | struct ieee80211_rx_status *rx_status) |
332 | { | 332 | { |
333 | struct ieee80211_mgmt *mgmt; | 333 | struct ieee80211_mgmt *mgmt; |
334 | struct ieee80211_sta_bss *bss; | 334 | struct ieee80211_bss *bss; |
335 | u8 *elements; | 335 | u8 *elements; |
336 | struct ieee80211_channel *channel; | 336 | struct ieee80211_channel *channel; |
337 | size_t baselen; | 337 | size_t baselen; |
@@ -424,38 +424,37 @@ static void ieee80211_send_nullfunc(struct ieee80211_local *local, | |||
424 | ieee80211_tx_skb(sdata, skb, 0); | 424 | ieee80211_tx_skb(sdata, skb, 0); |
425 | } | 425 | } |
426 | 426 | ||
427 | static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) | ||
428 | { | ||
429 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | ||
430 | ieee80211_vif_is_mesh(&sdata->vif)) | ||
431 | ieee80211_sta_timer((unsigned long)sdata); | ||
432 | } | ||
433 | |||
434 | void ieee80211_scan_completed(struct ieee80211_hw *hw) | 427 | void ieee80211_scan_completed(struct ieee80211_hw *hw) |
435 | { | 428 | { |
436 | struct ieee80211_local *local = hw_to_local(hw); | 429 | struct ieee80211_local *local = hw_to_local(hw); |
437 | struct ieee80211_sub_if_data *sdata; | 430 | struct ieee80211_sub_if_data *sdata; |
438 | union iwreq_data wrqu; | 431 | union iwreq_data wrqu; |
439 | 432 | ||
433 | if (WARN_ON(!local->hw_scanning && !local->sw_scanning)) | ||
434 | return; | ||
435 | |||
440 | local->last_scan_completed = jiffies; | 436 | local->last_scan_completed = jiffies; |
441 | memset(&wrqu, 0, sizeof(wrqu)); | 437 | memset(&wrqu, 0, sizeof(wrqu)); |
442 | wireless_send_event(local->scan_sdata->dev, SIOCGIWSCAN, &wrqu, NULL); | ||
443 | 438 | ||
444 | if (local->sta_hw_scanning) { | 439 | /* |
445 | local->sta_hw_scanning = 0; | 440 | * local->scan_sdata could have been NULLed by the interface |
441 | * down code in case we were scanning on an interface that is | ||
442 | * being taken down. | ||
443 | */ | ||
444 | sdata = local->scan_sdata; | ||
445 | if (sdata) | ||
446 | wireless_send_event(sdata->dev, SIOCGIWSCAN, &wrqu, NULL); | ||
447 | |||
448 | if (local->hw_scanning) { | ||
449 | local->hw_scanning = false; | ||
446 | if (ieee80211_hw_config(local)) | 450 | if (ieee80211_hw_config(local)) |
447 | printk(KERN_DEBUG "%s: failed to restore operational " | 451 | printk(KERN_DEBUG "%s: failed to restore operational " |
448 | "channel after scan\n", wiphy_name(local->hw.wiphy)); | 452 | "channel after scan\n", wiphy_name(local->hw.wiphy)); |
449 | /* Restart STA timer for HW scan case */ | ||
450 | rcu_read_lock(); | ||
451 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | ||
452 | ieee80211_restart_sta_timer(sdata); | ||
453 | rcu_read_unlock(); | ||
454 | 453 | ||
455 | goto done; | 454 | goto done; |
456 | } | 455 | } |
457 | 456 | ||
458 | local->sta_sw_scanning = 0; | 457 | local->sw_scanning = false; |
459 | if (ieee80211_hw_config(local)) | 458 | if (ieee80211_hw_config(local)) |
460 | printk(KERN_DEBUG "%s: failed to restore operational " | 459 | printk(KERN_DEBUG "%s: failed to restore operational " |
461 | "channel after scan\n", wiphy_name(local->hw.wiphy)); | 460 | "channel after scan\n", wiphy_name(local->hw.wiphy)); |
@@ -476,25 +475,24 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw) | |||
476 | rcu_read_lock(); | 475 | rcu_read_lock(); |
477 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 476 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
478 | /* Tell AP we're back */ | 477 | /* Tell AP we're back */ |
479 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) { | 478 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
480 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) { | 479 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) { |
481 | ieee80211_send_nullfunc(local, sdata, 0); | 480 | ieee80211_send_nullfunc(local, sdata, 0); |
482 | netif_tx_wake_all_queues(sdata->dev); | 481 | netif_tx_wake_all_queues(sdata->dev); |
483 | } | 482 | } |
484 | } else | 483 | } else |
485 | netif_tx_wake_all_queues(sdata->dev); | 484 | netif_tx_wake_all_queues(sdata->dev); |
486 | |||
487 | ieee80211_restart_sta_timer(sdata); | ||
488 | } | 485 | } |
489 | rcu_read_unlock(); | 486 | rcu_read_unlock(); |
490 | 487 | ||
491 | done: | 488 | done: |
492 | ieee80211_mlme_notify_scan_completed(local); | 489 | ieee80211_mlme_notify_scan_completed(local); |
490 | ieee80211_mesh_notify_scan_completed(local); | ||
493 | } | 491 | } |
494 | EXPORT_SYMBOL(ieee80211_scan_completed); | 492 | EXPORT_SYMBOL(ieee80211_scan_completed); |
495 | 493 | ||
496 | 494 | ||
497 | void ieee80211_sta_scan_work(struct work_struct *work) | 495 | void ieee80211_scan_work(struct work_struct *work) |
498 | { | 496 | { |
499 | struct ieee80211_local *local = | 497 | struct ieee80211_local *local = |
500 | container_of(work, struct ieee80211_local, scan_work.work); | 498 | container_of(work, struct ieee80211_local, scan_work.work); |
@@ -504,7 +502,10 @@ void ieee80211_sta_scan_work(struct work_struct *work) | |||
504 | int skip; | 502 | int skip; |
505 | unsigned long next_delay = 0; | 503 | unsigned long next_delay = 0; |
506 | 504 | ||
507 | if (!local->sta_sw_scanning) | 505 | /* |
506 | * Avoid re-scheduling when the sdata is going away. | ||
507 | */ | ||
508 | if (!netif_running(sdata->dev)) | ||
508 | return; | 509 | return; |
509 | 510 | ||
510 | switch (local->scan_state) { | 511 | switch (local->scan_state) { |
@@ -538,7 +539,7 @@ void ieee80211_sta_scan_work(struct work_struct *work) | |||
538 | chan = &sband->channels[local->scan_channel_idx]; | 539 | chan = &sband->channels[local->scan_channel_idx]; |
539 | 540 | ||
540 | if (chan->flags & IEEE80211_CHAN_DISABLED || | 541 | if (chan->flags & IEEE80211_CHAN_DISABLED || |
541 | (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | 542 | (sdata->vif.type == NL80211_IFTYPE_ADHOC && |
542 | chan->flags & IEEE80211_CHAN_NO_IBSS)) | 543 | chan->flags & IEEE80211_CHAN_NO_IBSS)) |
543 | skip = 1; | 544 | skip = 1; |
544 | 545 | ||
@@ -583,14 +584,13 @@ void ieee80211_sta_scan_work(struct work_struct *work) | |||
583 | break; | 584 | break; |
584 | } | 585 | } |
585 | 586 | ||
586 | if (local->sta_sw_scanning) | 587 | queue_delayed_work(local->hw.workqueue, &local->scan_work, |
587 | queue_delayed_work(local->hw.workqueue, &local->scan_work, | 588 | next_delay); |
588 | next_delay); | ||
589 | } | 589 | } |
590 | 590 | ||
591 | 591 | ||
592 | int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, | 592 | int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata, |
593 | u8 *ssid, size_t ssid_len) | 593 | u8 *ssid, size_t ssid_len) |
594 | { | 594 | { |
595 | struct ieee80211_local *local = scan_sdata->local; | 595 | struct ieee80211_local *local = scan_sdata->local; |
596 | struct ieee80211_sub_if_data *sdata; | 596 | struct ieee80211_sub_if_data *sdata; |
@@ -615,27 +615,30 @@ int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, | |||
615 | * ResultCode: SUCCESS, INVALID_PARAMETERS | 615 | * ResultCode: SUCCESS, INVALID_PARAMETERS |
616 | */ | 616 | */ |
617 | 617 | ||
618 | if (local->sta_sw_scanning || local->sta_hw_scanning) { | 618 | if (local->sw_scanning || local->hw_scanning) { |
619 | if (local->scan_sdata == scan_sdata) | 619 | if (local->scan_sdata == scan_sdata) |
620 | return 0; | 620 | return 0; |
621 | return -EBUSY; | 621 | return -EBUSY; |
622 | } | 622 | } |
623 | 623 | ||
624 | if (local->ops->hw_scan) { | 624 | if (local->ops->hw_scan) { |
625 | int rc = local->ops->hw_scan(local_to_hw(local), | 625 | int rc; |
626 | ssid, ssid_len); | 626 | |
627 | if (!rc) { | 627 | local->hw_scanning = true; |
628 | local->sta_hw_scanning = 1; | 628 | rc = local->ops->hw_scan(local_to_hw(local), ssid, ssid_len); |
629 | local->scan_sdata = scan_sdata; | 629 | if (rc) { |
630 | local->hw_scanning = false; | ||
631 | return rc; | ||
630 | } | 632 | } |
631 | return rc; | 633 | local->scan_sdata = scan_sdata; |
634 | return 0; | ||
632 | } | 635 | } |
633 | 636 | ||
634 | local->sta_sw_scanning = 1; | 637 | local->sw_scanning = true; |
635 | 638 | ||
636 | rcu_read_lock(); | 639 | rcu_read_lock(); |
637 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 640 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
638 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) { | 641 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
639 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) { | 642 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) { |
640 | netif_tx_stop_all_queues(sdata->dev); | 643 | netif_tx_stop_all_queues(sdata->dev); |
641 | ieee80211_send_nullfunc(local, sdata, 1); | 644 | ieee80211_send_nullfunc(local, sdata, 1); |
@@ -672,13 +675,14 @@ int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, | |||
672 | } | 675 | } |
673 | 676 | ||
674 | 677 | ||
675 | int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len) | 678 | int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, |
679 | u8 *ssid, size_t ssid_len) | ||
676 | { | 680 | { |
677 | struct ieee80211_local *local = sdata->local; | 681 | struct ieee80211_local *local = sdata->local; |
678 | struct ieee80211_if_sta *ifsta; | 682 | struct ieee80211_if_sta *ifsta; |
679 | 683 | ||
680 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 684 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
681 | return ieee80211_sta_start_scan(sdata, ssid, ssid_len); | 685 | return ieee80211_start_scan(sdata, ssid, ssid_len); |
682 | 686 | ||
683 | /* | 687 | /* |
684 | * STA has a state machine that might need to defer scanning | 688 | * STA has a state machine that might need to defer scanning |
@@ -686,7 +690,7 @@ int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t | |||
686 | * queue it up to the state machine in that case. | 690 | * queue it up to the state machine in that case. |
687 | */ | 691 | */ |
688 | 692 | ||
689 | if (local->sta_sw_scanning || local->sta_hw_scanning) { | 693 | if (local->sw_scanning || local->hw_scanning) { |
690 | if (local->scan_sdata == sdata) | 694 | if (local->scan_sdata == sdata) |
691 | return 0; | 695 | return 0; |
692 | return -EBUSY; | 696 | return -EBUSY; |
@@ -704,9 +708,9 @@ int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t | |||
704 | } | 708 | } |
705 | 709 | ||
706 | 710 | ||
707 | static void ieee80211_sta_add_scan_ies(struct iw_request_info *info, | 711 | static void ieee80211_scan_add_ies(struct iw_request_info *info, |
708 | struct ieee80211_sta_bss *bss, | 712 | struct ieee80211_bss *bss, |
709 | char **current_ev, char *end_buf) | 713 | char **current_ev, char *end_buf) |
710 | { | 714 | { |
711 | u8 *pos, *end, *next; | 715 | u8 *pos, *end, *next; |
712 | struct iw_event iwe; | 716 | struct iw_event iwe; |
@@ -746,10 +750,10 @@ static void ieee80211_sta_add_scan_ies(struct iw_request_info *info, | |||
746 | 750 | ||
747 | 751 | ||
748 | static char * | 752 | static char * |
749 | ieee80211_sta_scan_result(struct ieee80211_local *local, | 753 | ieee80211_scan_result(struct ieee80211_local *local, |
750 | struct iw_request_info *info, | 754 | struct iw_request_info *info, |
751 | struct ieee80211_sta_bss *bss, | 755 | struct ieee80211_bss *bss, |
752 | char *current_ev, char *end_buf) | 756 | char *current_ev, char *end_buf) |
753 | { | 757 | { |
754 | struct iw_event iwe; | 758 | struct iw_event iwe; |
755 | char *buf; | 759 | char *buf; |
@@ -825,7 +829,7 @@ ieee80211_sta_scan_result(struct ieee80211_local *local, | |||
825 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, | 829 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
826 | &iwe, ""); | 830 | &iwe, ""); |
827 | 831 | ||
828 | ieee80211_sta_add_scan_ies(info, bss, ¤t_ev, end_buf); | 832 | ieee80211_scan_add_ies(info, bss, ¤t_ev, end_buf); |
829 | 833 | ||
830 | if (bss->supp_rates_len > 0) { | 834 | if (bss->supp_rates_len > 0) { |
831 | /* display all supported rates in readable format */ | 835 | /* display all supported rates in readable format */ |
@@ -911,23 +915,23 @@ ieee80211_sta_scan_result(struct ieee80211_local *local, | |||
911 | } | 915 | } |
912 | 916 | ||
913 | 917 | ||
914 | int ieee80211_sta_scan_results(struct ieee80211_local *local, | 918 | int ieee80211_scan_results(struct ieee80211_local *local, |
915 | struct iw_request_info *info, | 919 | struct iw_request_info *info, |
916 | char *buf, size_t len) | 920 | char *buf, size_t len) |
917 | { | 921 | { |
918 | char *current_ev = buf; | 922 | char *current_ev = buf; |
919 | char *end_buf = buf + len; | 923 | char *end_buf = buf + len; |
920 | struct ieee80211_sta_bss *bss; | 924 | struct ieee80211_bss *bss; |
921 | 925 | ||
922 | spin_lock_bh(&local->sta_bss_lock); | 926 | spin_lock_bh(&local->bss_lock); |
923 | list_for_each_entry(bss, &local->sta_bss_list, list) { | 927 | list_for_each_entry(bss, &local->bss_list, list) { |
924 | if (buf + len - current_ev <= IW_EV_ADDR_LEN) { | 928 | if (buf + len - current_ev <= IW_EV_ADDR_LEN) { |
925 | spin_unlock_bh(&local->sta_bss_lock); | 929 | spin_unlock_bh(&local->bss_lock); |
926 | return -E2BIG; | 930 | return -E2BIG; |
927 | } | 931 | } |
928 | current_ev = ieee80211_sta_scan_result(local, info, bss, | 932 | current_ev = ieee80211_scan_result(local, info, bss, |
929 | current_ev, end_buf); | 933 | current_ev, end_buf); |
930 | } | 934 | } |
931 | spin_unlock_bh(&local->sta_bss_lock); | 935 | spin_unlock_bh(&local->bss_lock); |
932 | return current_ev - buf; | 936 | return current_ev - buf; |
933 | } | 937 | } |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index f2ba653b9d69..d9774ac2e0f7 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -73,11 +73,11 @@ static int sta_info_hash_del(struct ieee80211_local *local, | |||
73 | { | 73 | { |
74 | struct sta_info *s; | 74 | struct sta_info *s; |
75 | 75 | ||
76 | s = local->sta_hash[STA_HASH(sta->addr)]; | 76 | s = local->sta_hash[STA_HASH(sta->sta.addr)]; |
77 | if (!s) | 77 | if (!s) |
78 | return -ENOENT; | 78 | return -ENOENT; |
79 | if (s == sta) { | 79 | if (s == sta) { |
80 | rcu_assign_pointer(local->sta_hash[STA_HASH(sta->addr)], | 80 | rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], |
81 | s->hnext); | 81 | s->hnext); |
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
@@ -94,13 +94,13 @@ static int sta_info_hash_del(struct ieee80211_local *local, | |||
94 | 94 | ||
95 | /* protected by RCU */ | 95 | /* protected by RCU */ |
96 | static struct sta_info *__sta_info_find(struct ieee80211_local *local, | 96 | static struct sta_info *__sta_info_find(struct ieee80211_local *local, |
97 | u8 *addr) | 97 | const u8 *addr) |
98 | { | 98 | { |
99 | struct sta_info *sta; | 99 | struct sta_info *sta; |
100 | 100 | ||
101 | sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); | 101 | sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); |
102 | while (sta) { | 102 | while (sta) { |
103 | if (compare_ether_addr(sta->addr, addr) == 0) | 103 | if (compare_ether_addr(sta->sta.addr, addr) == 0) |
104 | break; | 104 | break; |
105 | sta = rcu_dereference(sta->hnext); | 105 | sta = rcu_dereference(sta->hnext); |
106 | } | 106 | } |
@@ -151,7 +151,7 @@ static void __sta_info_free(struct ieee80211_local *local, | |||
151 | 151 | ||
152 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 152 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
153 | printk(KERN_DEBUG "%s: Destroyed STA %s\n", | 153 | printk(KERN_DEBUG "%s: Destroyed STA %s\n", |
154 | wiphy_name(local->hw.wiphy), print_mac(mbuf, sta->addr)); | 154 | wiphy_name(local->hw.wiphy), print_mac(mbuf, sta->sta.addr)); |
155 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 155 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
156 | 156 | ||
157 | kfree(sta); | 157 | kfree(sta); |
@@ -219,8 +219,8 @@ void sta_info_destroy(struct sta_info *sta) | |||
219 | static void sta_info_hash_add(struct ieee80211_local *local, | 219 | static void sta_info_hash_add(struct ieee80211_local *local, |
220 | struct sta_info *sta) | 220 | struct sta_info *sta) |
221 | { | 221 | { |
222 | sta->hnext = local->sta_hash[STA_HASH(sta->addr)]; | 222 | sta->hnext = local->sta_hash[STA_HASH(sta->sta.addr)]; |
223 | rcu_assign_pointer(local->sta_hash[STA_HASH(sta->addr)], sta); | 223 | rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta); |
224 | } | 224 | } |
225 | 225 | ||
226 | struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | 226 | struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, |
@@ -231,14 +231,14 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
231 | int i; | 231 | int i; |
232 | DECLARE_MAC_BUF(mbuf); | 232 | DECLARE_MAC_BUF(mbuf); |
233 | 233 | ||
234 | sta = kzalloc(sizeof(*sta), gfp); | 234 | sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp); |
235 | if (!sta) | 235 | if (!sta) |
236 | return NULL; | 236 | return NULL; |
237 | 237 | ||
238 | spin_lock_init(&sta->lock); | 238 | spin_lock_init(&sta->lock); |
239 | spin_lock_init(&sta->flaglock); | 239 | spin_lock_init(&sta->flaglock); |
240 | 240 | ||
241 | memcpy(sta->addr, addr, ETH_ALEN); | 241 | memcpy(sta->sta.addr, addr, ETH_ALEN); |
242 | sta->local = local; | 242 | sta->local = local; |
243 | sta->sdata = sdata; | 243 | sta->sdata = sdata; |
244 | 244 | ||
@@ -271,7 +271,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
271 | 271 | ||
272 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 272 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
273 | printk(KERN_DEBUG "%s: Allocated STA %s\n", | 273 | printk(KERN_DEBUG "%s: Allocated STA %s\n", |
274 | wiphy_name(local->hw.wiphy), print_mac(mbuf, sta->addr)); | 274 | wiphy_name(local->hw.wiphy), print_mac(mbuf, sta->sta.addr)); |
275 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 275 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
276 | 276 | ||
277 | #ifdef CONFIG_MAC80211_MESH | 277 | #ifdef CONFIG_MAC80211_MESH |
@@ -300,15 +300,15 @@ int sta_info_insert(struct sta_info *sta) | |||
300 | goto out_free; | 300 | goto out_free; |
301 | } | 301 | } |
302 | 302 | ||
303 | if (WARN_ON(compare_ether_addr(sta->addr, sdata->dev->dev_addr) == 0 || | 303 | if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 || |
304 | is_multicast_ether_addr(sta->addr))) { | 304 | is_multicast_ether_addr(sta->sta.addr))) { |
305 | err = -EINVAL; | 305 | err = -EINVAL; |
306 | goto out_free; | 306 | goto out_free; |
307 | } | 307 | } |
308 | 308 | ||
309 | spin_lock_irqsave(&local->sta_lock, flags); | 309 | spin_lock_irqsave(&local->sta_lock, flags); |
310 | /* check if STA exists already */ | 310 | /* check if STA exists already */ |
311 | if (__sta_info_find(local, sta->addr)) { | 311 | if (__sta_info_find(local, sta->sta.addr)) { |
312 | spin_unlock_irqrestore(&local->sta_lock, flags); | 312 | spin_unlock_irqrestore(&local->sta_lock, flags); |
313 | err = -EEXIST; | 313 | err = -EEXIST; |
314 | goto out_free; | 314 | goto out_free; |
@@ -319,18 +319,18 @@ int sta_info_insert(struct sta_info *sta) | |||
319 | 319 | ||
320 | /* notify driver */ | 320 | /* notify driver */ |
321 | if (local->ops->sta_notify) { | 321 | if (local->ops->sta_notify) { |
322 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) | 322 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
323 | sdata = container_of(sdata->bss, | 323 | sdata = container_of(sdata->bss, |
324 | struct ieee80211_sub_if_data, | 324 | struct ieee80211_sub_if_data, |
325 | u.ap); | 325 | u.ap); |
326 | 326 | ||
327 | local->ops->sta_notify(local_to_hw(local), &sdata->vif, | 327 | local->ops->sta_notify(local_to_hw(local), &sdata->vif, |
328 | STA_NOTIFY_ADD, sta->addr); | 328 | STA_NOTIFY_ADD, &sta->sta); |
329 | } | 329 | } |
330 | 330 | ||
331 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 331 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
332 | printk(KERN_DEBUG "%s: Inserted STA %s\n", | 332 | printk(KERN_DEBUG "%s: Inserted STA %s\n", |
333 | wiphy_name(local->hw.wiphy), print_mac(mac, sta->addr)); | 333 | wiphy_name(local->hw.wiphy), print_mac(mac, sta->sta.addr)); |
334 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 334 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
335 | 335 | ||
336 | spin_unlock_irqrestore(&local->sta_lock, flags); | 336 | spin_unlock_irqrestore(&local->sta_lock, flags); |
@@ -379,11 +379,12 @@ static void __sta_info_set_tim_bit(struct ieee80211_if_ap *bss, | |||
379 | { | 379 | { |
380 | BUG_ON(!bss); | 380 | BUG_ON(!bss); |
381 | 381 | ||
382 | __bss_tim_set(bss, sta->aid); | 382 | __bss_tim_set(bss, sta->sta.aid); |
383 | 383 | ||
384 | if (sta->local->ops->set_tim) { | 384 | if (sta->local->ops->set_tim) { |
385 | sta->local->tim_in_locked_section = true; | 385 | sta->local->tim_in_locked_section = true; |
386 | sta->local->ops->set_tim(local_to_hw(sta->local), sta->aid, 1); | 386 | sta->local->ops->set_tim(local_to_hw(sta->local), |
387 | &sta->sta, true); | ||
387 | sta->local->tim_in_locked_section = false; | 388 | sta->local->tim_in_locked_section = false; |
388 | } | 389 | } |
389 | } | 390 | } |
@@ -404,11 +405,12 @@ static void __sta_info_clear_tim_bit(struct ieee80211_if_ap *bss, | |||
404 | { | 405 | { |
405 | BUG_ON(!bss); | 406 | BUG_ON(!bss); |
406 | 407 | ||
407 | __bss_tim_clear(bss, sta->aid); | 408 | __bss_tim_clear(bss, sta->sta.aid); |
408 | 409 | ||
409 | if (sta->local->ops->set_tim) { | 410 | if (sta->local->ops->set_tim) { |
410 | sta->local->tim_in_locked_section = true; | 411 | sta->local->tim_in_locked_section = true; |
411 | sta->local->ops->set_tim(local_to_hw(sta->local), sta->aid, 0); | 412 | sta->local->ops->set_tim(local_to_hw(sta->local), |
413 | &sta->sta, false); | ||
412 | sta->local->tim_in_locked_section = false; | 414 | sta->local->tim_in_locked_section = false; |
413 | } | 415 | } |
414 | } | 416 | } |
@@ -424,7 +426,7 @@ void sta_info_clear_tim_bit(struct sta_info *sta) | |||
424 | spin_unlock_irqrestore(&sta->local->sta_lock, flags); | 426 | spin_unlock_irqrestore(&sta->local->sta_lock, flags); |
425 | } | 427 | } |
426 | 428 | ||
427 | void __sta_info_unlink(struct sta_info **sta) | 429 | static void __sta_info_unlink(struct sta_info **sta) |
428 | { | 430 | { |
429 | struct ieee80211_local *local = (*sta)->local; | 431 | struct ieee80211_local *local = (*sta)->local; |
430 | struct ieee80211_sub_if_data *sdata = (*sta)->sdata; | 432 | struct ieee80211_sub_if_data *sdata = (*sta)->sdata; |
@@ -456,13 +458,13 @@ void __sta_info_unlink(struct sta_info **sta) | |||
456 | local->num_sta--; | 458 | local->num_sta--; |
457 | 459 | ||
458 | if (local->ops->sta_notify) { | 460 | if (local->ops->sta_notify) { |
459 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) | 461 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
460 | sdata = container_of(sdata->bss, | 462 | sdata = container_of(sdata->bss, |
461 | struct ieee80211_sub_if_data, | 463 | struct ieee80211_sub_if_data, |
462 | u.ap); | 464 | u.ap); |
463 | 465 | ||
464 | local->ops->sta_notify(local_to_hw(local), &sdata->vif, | 466 | local->ops->sta_notify(local_to_hw(local), &sdata->vif, |
465 | STA_NOTIFY_REMOVE, (*sta)->addr); | 467 | STA_NOTIFY_REMOVE, &(*sta)->sta); |
466 | } | 468 | } |
467 | 469 | ||
468 | if (ieee80211_vif_is_mesh(&sdata->vif)) { | 470 | if (ieee80211_vif_is_mesh(&sdata->vif)) { |
@@ -474,7 +476,7 @@ void __sta_info_unlink(struct sta_info **sta) | |||
474 | 476 | ||
475 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 477 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
476 | printk(KERN_DEBUG "%s: Removed STA %s\n", | 478 | printk(KERN_DEBUG "%s: Removed STA %s\n", |
477 | wiphy_name(local->hw.wiphy), print_mac(mbuf, (*sta)->addr)); | 479 | wiphy_name(local->hw.wiphy), print_mac(mbuf, (*sta)->sta.addr)); |
478 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 480 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
479 | 481 | ||
480 | /* | 482 | /* |
@@ -570,7 +572,7 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local, | |||
570 | local->total_ps_buffered--; | 572 | local->total_ps_buffered--; |
571 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 573 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
572 | printk(KERN_DEBUG "Buffered frame expired (STA " | 574 | printk(KERN_DEBUG "Buffered frame expired (STA " |
573 | "%s)\n", print_mac(mac, sta->addr)); | 575 | "%s)\n", print_mac(mac, sta->sta.addr)); |
574 | #endif | 576 | #endif |
575 | dev_kfree_skb(skb); | 577 | dev_kfree_skb(skb); |
576 | 578 | ||
@@ -802,3 +804,40 @@ void sta_info_flush_delayed(struct ieee80211_sub_if_data *sdata) | |||
802 | schedule_work(&local->sta_flush_work); | 804 | schedule_work(&local->sta_flush_work); |
803 | spin_unlock_irqrestore(&local->sta_lock, flags); | 805 | spin_unlock_irqrestore(&local->sta_lock, flags); |
804 | } | 806 | } |
807 | |||
808 | void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | ||
809 | unsigned long exp_time) | ||
810 | { | ||
811 | struct ieee80211_local *local = sdata->local; | ||
812 | struct sta_info *sta, *tmp; | ||
813 | LIST_HEAD(tmp_list); | ||
814 | DECLARE_MAC_BUF(mac); | ||
815 | unsigned long flags; | ||
816 | |||
817 | spin_lock_irqsave(&local->sta_lock, flags); | ||
818 | list_for_each_entry_safe(sta, tmp, &local->sta_list, list) | ||
819 | if (time_after(jiffies, sta->last_rx + exp_time)) { | ||
820 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | ||
821 | printk(KERN_DEBUG "%s: expiring inactive STA %s\n", | ||
822 | sdata->dev->name, print_mac(mac, sta->sta.addr)); | ||
823 | #endif | ||
824 | __sta_info_unlink(&sta); | ||
825 | if (sta) | ||
826 | list_add(&sta->list, &tmp_list); | ||
827 | } | ||
828 | spin_unlock_irqrestore(&local->sta_lock, flags); | ||
829 | |||
830 | list_for_each_entry_safe(sta, tmp, &tmp_list, list) | ||
831 | sta_info_destroy(sta); | ||
832 | } | ||
833 | |||
834 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | ||
835 | const u8 *addr) | ||
836 | { | ||
837 | struct sta_info *sta = __sta_info_find(hw_to_local(hw), addr); | ||
838 | |||
839 | if (!sta) | ||
840 | return NULL; | ||
841 | return &sta->sta; | ||
842 | } | ||
843 | EXPORT_SYMBOL(ieee80211_find_sta); | ||
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 4a581a5b5766..daedfa9e1c63 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -167,8 +167,6 @@ struct sta_ampdu_mlme { | |||
167 | * @lock: used for locking all fields that require locking, see comments | 167 | * @lock: used for locking all fields that require locking, see comments |
168 | * in the header file. | 168 | * in the header file. |
169 | * @flaglock: spinlock for flags accesses | 169 | * @flaglock: spinlock for flags accesses |
170 | * @ht_info: HT capabilities of this STA | ||
171 | * @supp_rates: Bitmap of supported rates (per band) | ||
172 | * @addr: MAC address of this STA | 170 | * @addr: MAC address of this STA |
173 | * @aid: STA's unique AID (1..2007, 0 = not assigned yet), | 171 | * @aid: STA's unique AID (1..2007, 0 = not assigned yet), |
174 | * only used in AP (and IBSS?) mode | 172 | * only used in AP (and IBSS?) mode |
@@ -195,15 +193,11 @@ struct sta_ampdu_mlme { | |||
195 | * @tx_filtered_count: TBD | 193 | * @tx_filtered_count: TBD |
196 | * @tx_retry_failed: TBD | 194 | * @tx_retry_failed: TBD |
197 | * @tx_retry_count: TBD | 195 | * @tx_retry_count: TBD |
198 | * @tx_num_consecutive_failures: TBD | ||
199 | * @tx_num_mpdu_ok: TBD | ||
200 | * @tx_num_mpdu_fail: TBD | ||
201 | * @fail_avg: moving percentage of failed MSDUs | 196 | * @fail_avg: moving percentage of failed MSDUs |
202 | * @tx_packets: number of RX/TX MSDUs | 197 | * @tx_packets: number of RX/TX MSDUs |
203 | * @tx_bytes: TBD | 198 | * @tx_bytes: TBD |
204 | * @tx_fragments: number of transmitted MPDUs | 199 | * @tx_fragments: number of transmitted MPDUs |
205 | * @txrate_idx: TBD | 200 | * @last_txrate_idx: Index of the last used transmit rate |
206 | * @last_txrate_idx: TBD | ||
207 | * @tid_seq: TBD | 201 | * @tid_seq: TBD |
208 | * @wme_tx_queue: TBD | 202 | * @wme_tx_queue: TBD |
209 | * @ampdu_mlme: TBD | 203 | * @ampdu_mlme: TBD |
@@ -218,6 +212,7 @@ struct sta_ampdu_mlme { | |||
218 | * @plink_timeout: TBD | 212 | * @plink_timeout: TBD |
219 | * @plink_timer: TBD | 213 | * @plink_timer: TBD |
220 | * @debugfs: debug filesystem info | 214 | * @debugfs: debug filesystem info |
215 | * @sta: station information we share with the driver | ||
221 | */ | 216 | */ |
222 | struct sta_info { | 217 | struct sta_info { |
223 | /* General information, mostly static */ | 218 | /* General information, mostly static */ |
@@ -230,10 +225,7 @@ struct sta_info { | |||
230 | void *rate_ctrl_priv; | 225 | void *rate_ctrl_priv; |
231 | spinlock_t lock; | 226 | spinlock_t lock; |
232 | spinlock_t flaglock; | 227 | spinlock_t flaglock; |
233 | struct ieee80211_ht_info ht_info; | 228 | |
234 | u64 supp_rates[IEEE80211_NUM_BANDS]; | ||
235 | u8 addr[ETH_ALEN]; | ||
236 | u16 aid; | ||
237 | u16 listen_interval; | 229 | u16 listen_interval; |
238 | 230 | ||
239 | /* | 231 | /* |
@@ -273,10 +265,6 @@ struct sta_info { | |||
273 | /* Updated from TX status path only, no locking requirements */ | 265 | /* Updated from TX status path only, no locking requirements */ |
274 | unsigned long tx_filtered_count; | 266 | unsigned long tx_filtered_count; |
275 | unsigned long tx_retry_failed, tx_retry_count; | 267 | unsigned long tx_retry_failed, tx_retry_count; |
276 | /* TODO: update in generic code not rate control? */ | ||
277 | u32 tx_num_consecutive_failures; | ||
278 | u32 tx_num_mpdu_ok; | ||
279 | u32 tx_num_mpdu_fail; | ||
280 | /* moving percentage of failed MSDUs */ | 268 | /* moving percentage of failed MSDUs */ |
281 | unsigned int fail_avg; | 269 | unsigned int fail_avg; |
282 | 270 | ||
@@ -284,8 +272,7 @@ struct sta_info { | |||
284 | unsigned long tx_packets; | 272 | unsigned long tx_packets; |
285 | unsigned long tx_bytes; | 273 | unsigned long tx_bytes; |
286 | unsigned long tx_fragments; | 274 | unsigned long tx_fragments; |
287 | int txrate_idx; | 275 | unsigned int last_txrate_idx; |
288 | int last_txrate_idx; | ||
289 | u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; | 276 | u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; |
290 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS | 277 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS |
291 | unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; | 278 | unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; |
@@ -327,6 +314,9 @@ struct sta_info { | |||
327 | struct dentry *agg_status; | 314 | struct dentry *agg_status; |
328 | } debugfs; | 315 | } debugfs; |
329 | #endif | 316 | #endif |
317 | |||
318 | /* keep last! */ | ||
319 | struct ieee80211_sta sta; | ||
330 | }; | 320 | }; |
331 | 321 | ||
332 | static inline enum plink_state sta_plink_state(struct sta_info *sta) | 322 | static inline enum plink_state sta_plink_state(struct sta_info *sta) |
@@ -452,7 +442,6 @@ int sta_info_insert(struct sta_info *sta); | |||
452 | * has already unlinked it. | 442 | * has already unlinked it. |
453 | */ | 443 | */ |
454 | void sta_info_unlink(struct sta_info **sta); | 444 | void sta_info_unlink(struct sta_info **sta); |
455 | void __sta_info_unlink(struct sta_info **sta); | ||
456 | 445 | ||
457 | void sta_info_destroy(struct sta_info *sta); | 446 | void sta_info_destroy(struct sta_info *sta); |
458 | void sta_info_set_tim_bit(struct sta_info *sta); | 447 | void sta_info_set_tim_bit(struct sta_info *sta); |
@@ -464,5 +453,7 @@ void sta_info_stop(struct ieee80211_local *local); | |||
464 | int sta_info_flush(struct ieee80211_local *local, | 453 | int sta_info_flush(struct ieee80211_local *local, |
465 | struct ieee80211_sub_if_data *sdata); | 454 | struct ieee80211_sub_if_data *sdata); |
466 | void sta_info_flush_delayed(struct ieee80211_sub_if_data *sdata); | 455 | void sta_info_flush_delayed(struct ieee80211_sub_if_data *sdata); |
456 | void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | ||
457 | unsigned long exp_time); | ||
467 | 458 | ||
468 | #endif /* STA_INFO_H */ | 459 | #endif /* STA_INFO_H */ |
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index 995f7af3d25e..34b32bc8f609 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -304,7 +304,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
304 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { | 304 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { |
305 | u8 bcast[ETH_ALEN] = | 305 | u8 bcast[ETH_ALEN] = |
306 | {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | 306 | {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
307 | u8 *sta_addr = key->sta->addr; | 307 | u8 *sta_addr = key->sta->sta.addr; |
308 | 308 | ||
309 | if (is_multicast_ether_addr(ra)) | 309 | if (is_multicast_ether_addr(ra)) |
310 | sta_addr = bcast; | 310 | sta_addr = bcast; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c413d4836afe..20d683641b42 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -38,43 +38,6 @@ | |||
38 | 38 | ||
39 | /* misc utils */ | 39 | /* misc utils */ |
40 | 40 | ||
41 | #ifdef CONFIG_MAC80211_LOWTX_FRAME_DUMP | ||
42 | static void ieee80211_dump_frame(const char *ifname, const char *title, | ||
43 | const struct sk_buff *skb) | ||
44 | { | ||
45 | const struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
46 | unsigned int hdrlen; | ||
47 | DECLARE_MAC_BUF(mac); | ||
48 | |||
49 | printk(KERN_DEBUG "%s: %s (len=%d)", ifname, title, skb->len); | ||
50 | if (skb->len < 4) { | ||
51 | printk("\n"); | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | ||
56 | if (hdrlen > skb->len) | ||
57 | hdrlen = skb->len; | ||
58 | if (hdrlen >= 4) | ||
59 | printk(" FC=0x%04x DUR=0x%04x", | ||
60 | le16_to_cpu(hdr->frame_control), le16_to_cpu(hdr->duration_id)); | ||
61 | if (hdrlen >= 10) | ||
62 | printk(" A1=%s", print_mac(mac, hdr->addr1)); | ||
63 | if (hdrlen >= 16) | ||
64 | printk(" A2=%s", print_mac(mac, hdr->addr2)); | ||
65 | if (hdrlen >= 24) | ||
66 | printk(" A3=%s", print_mac(mac, hdr->addr3)); | ||
67 | if (hdrlen >= 30) | ||
68 | printk(" A4=%s", print_mac(mac, hdr->addr4)); | ||
69 | printk("\n"); | ||
70 | } | ||
71 | #else /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */ | ||
72 | static inline void ieee80211_dump_frame(const char *ifname, const char *title, | ||
73 | struct sk_buff *skb) | ||
74 | { | ||
75 | } | ||
76 | #endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */ | ||
77 | |||
78 | static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | 41 | static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, |
79 | int next_frag_len) | 42 | int next_frag_len) |
80 | { | 43 | { |
@@ -111,7 +74,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
111 | hdr = (struct ieee80211_hdr *)tx->skb->data; | 74 | hdr = (struct ieee80211_hdr *)tx->skb->data; |
112 | if (ieee80211_is_ctl(hdr->frame_control)) { | 75 | if (ieee80211_is_ctl(hdr->frame_control)) { |
113 | /* TODO: These control frames are not currently sent by | 76 | /* TODO: These control frames are not currently sent by |
114 | * 80211.o, but should they be implemented, this function | 77 | * mac80211, but should they be implemented, this function |
115 | * needs to be updated to support duration field calculation. | 78 | * needs to be updated to support duration field calculation. |
116 | * | 79 | * |
117 | * RTS: time needed to transmit pending data/mgmt frame plus | 80 | * RTS: time needed to transmit pending data/mgmt frame plus |
@@ -153,7 +116,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
153 | if (r->bitrate > txrate->bitrate) | 116 | if (r->bitrate > txrate->bitrate) |
154 | break; | 117 | break; |
155 | 118 | ||
156 | if (tx->sdata->basic_rates & BIT(i)) | 119 | if (tx->sdata->bss_conf.basic_rates & BIT(i)) |
157 | rate = r->bitrate; | 120 | rate = r->bitrate; |
158 | 121 | ||
159 | switch (sband->band) { | 122 | switch (sband->band) { |
@@ -222,11 +185,11 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
222 | if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) | 185 | if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) |
223 | return TX_CONTINUE; | 186 | return TX_CONTINUE; |
224 | 187 | ||
225 | if (unlikely(tx->local->sta_sw_scanning) && | 188 | if (unlikely(tx->local->sw_scanning) && |
226 | !ieee80211_is_probe_req(hdr->frame_control)) | 189 | !ieee80211_is_probe_req(hdr->frame_control)) |
227 | return TX_DROP; | 190 | return TX_DROP; |
228 | 191 | ||
229 | if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) | 192 | if (tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT) |
230 | return TX_CONTINUE; | 193 | return TX_CONTINUE; |
231 | 194 | ||
232 | if (tx->flags & IEEE80211_TX_PS_BUFFERED) | 195 | if (tx->flags & IEEE80211_TX_PS_BUFFERED) |
@@ -236,7 +199,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
236 | 199 | ||
237 | if (likely(tx->flags & IEEE80211_TX_UNICAST)) { | 200 | if (likely(tx->flags & IEEE80211_TX_UNICAST)) { |
238 | if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && | 201 | if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && |
239 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 202 | tx->sdata->vif.type != NL80211_IFTYPE_ADHOC && |
240 | ieee80211_is_data(hdr->frame_control))) { | 203 | ieee80211_is_data(hdr->frame_control))) { |
241 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 204 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
242 | DECLARE_MAC_BUF(mac); | 205 | DECLARE_MAC_BUF(mac); |
@@ -250,7 +213,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
250 | } else { | 213 | } else { |
251 | if (unlikely(ieee80211_is_data(hdr->frame_control) && | 214 | if (unlikely(ieee80211_is_data(hdr->frame_control) && |
252 | tx->local->num_sta == 0 && | 215 | tx->local->num_sta == 0 && |
253 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS)) { | 216 | tx->sdata->vif.type != NL80211_IFTYPE_ADHOC)) { |
254 | /* | 217 | /* |
255 | * No associated STAs - no need to send multicast | 218 | * No associated STAs - no need to send multicast |
256 | * frames. | 219 | * frames. |
@@ -281,7 +244,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) | |||
281 | 244 | ||
282 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 245 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
283 | struct ieee80211_if_ap *ap; | 246 | struct ieee80211_if_ap *ap; |
284 | if (sdata->vif.type != IEEE80211_IF_TYPE_AP) | 247 | if (sdata->vif.type != NL80211_IFTYPE_AP) |
285 | continue; | 248 | continue; |
286 | ap = &sdata->u.ap; | 249 | ap = &sdata->u.ap; |
287 | skb = skb_dequeue(&ap->ps_bc_buf); | 250 | skb = skb_dequeue(&ap->ps_bc_buf); |
@@ -381,7 +344,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
381 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 344 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
382 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " | 345 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " |
383 | "before %d)\n", | 346 | "before %d)\n", |
384 | print_mac(mac, sta->addr), sta->aid, | 347 | print_mac(mac, sta->sta.addr), sta->sta.aid, |
385 | skb_queue_len(&sta->ps_tx_buf)); | 348 | skb_queue_len(&sta->ps_tx_buf)); |
386 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 349 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
387 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) | 350 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) |
@@ -392,7 +355,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
392 | if (net_ratelimit()) { | 355 | if (net_ratelimit()) { |
393 | printk(KERN_DEBUG "%s: STA %s TX " | 356 | printk(KERN_DEBUG "%s: STA %s TX " |
394 | "buffer full - dropping oldest frame\n", | 357 | "buffer full - dropping oldest frame\n", |
395 | tx->dev->name, print_mac(mac, sta->addr)); | 358 | tx->dev->name, print_mac(mac, sta->sta.addr)); |
396 | } | 359 | } |
397 | #endif | 360 | #endif |
398 | dev_kfree_skb(old); | 361 | dev_kfree_skb(old); |
@@ -411,7 +374,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
411 | else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { | 374 | else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { |
412 | printk(KERN_DEBUG "%s: STA %s in PS mode, but pspoll " | 375 | printk(KERN_DEBUG "%s: STA %s in PS mode, but pspoll " |
413 | "set -> send frame\n", tx->dev->name, | 376 | "set -> send frame\n", tx->dev->name, |
414 | print_mac(mac, sta->addr)); | 377 | print_mac(mac, sta->sta.addr)); |
415 | } | 378 | } |
416 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 379 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
417 | clear_sta_flags(sta, WLAN_STA_PSPOLL); | 380 | clear_sta_flags(sta, WLAN_STA_PSPOLL); |
@@ -485,6 +448,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
485 | 448 | ||
486 | if (likely(tx->rate_idx < 0)) { | 449 | if (likely(tx->rate_idx < 0)) { |
487 | rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); | 450 | rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); |
451 | if (tx->sta) | ||
452 | tx->sta->last_txrate_idx = rsel.rate_idx; | ||
488 | tx->rate_idx = rsel.rate_idx; | 453 | tx->rate_idx = rsel.rate_idx; |
489 | if (unlikely(rsel.probe_idx >= 0)) { | 454 | if (unlikely(rsel.probe_idx >= 0)) { |
490 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 455 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
@@ -528,7 +493,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
528 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 493 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
529 | 494 | ||
530 | if (tx->sta) | 495 | if (tx->sta) |
531 | info->control.aid = tx->sta->aid; | 496 | info->control.sta = &tx->sta->sta; |
532 | 497 | ||
533 | if (!info->control.retry_limit) { | 498 | if (!info->control.retry_limit) { |
534 | if (!is_multicast_ether_addr(hdr->addr1)) { | 499 | if (!is_multicast_ether_addr(hdr->addr1)) { |
@@ -594,7 +559,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
594 | for (idx = 0; idx < sband->n_bitrates; idx++) { | 559 | for (idx = 0; idx < sband->n_bitrates; idx++) { |
595 | if (sband->bitrates[idx].bitrate > rate->bitrate) | 560 | if (sband->bitrates[idx].bitrate > rate->bitrate) |
596 | continue; | 561 | continue; |
597 | if (tx->sdata->basic_rates & BIT(idx) && | 562 | if (tx->sdata->bss_conf.basic_rates & BIT(idx) && |
598 | (baserate < 0 || | 563 | (baserate < 0 || |
599 | (sband->bitrates[baserate].bitrate | 564 | (sband->bitrates[baserate].bitrate |
600 | < sband->bitrates[idx].bitrate))) | 565 | < sband->bitrates[idx].bitrate))) |
@@ -608,7 +573,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
608 | } | 573 | } |
609 | 574 | ||
610 | if (tx->sta) | 575 | if (tx->sta) |
611 | info->control.aid = tx->sta->aid; | 576 | info->control.sta = &tx->sta->sta; |
612 | 577 | ||
613 | return TX_CONTINUE; | 578 | return TX_CONTINUE; |
614 | } | 579 | } |
@@ -622,7 +587,14 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | |||
622 | u8 *qc; | 587 | u8 *qc; |
623 | int tid; | 588 | int tid; |
624 | 589 | ||
625 | /* only for injected frames */ | 590 | /* |
591 | * Packet injection may want to control the sequence | ||
592 | * number, if we have no matching interface then we | ||
593 | * neither assign one ourselves nor ask the driver to. | ||
594 | */ | ||
595 | if (unlikely(!info->control.vif)) | ||
596 | return TX_CONTINUE; | ||
597 | |||
626 | if (unlikely(ieee80211_is_ctl(hdr->frame_control))) | 598 | if (unlikely(ieee80211_is_ctl(hdr->frame_control))) |
627 | return TX_CONTINUE; | 599 | return TX_CONTINUE; |
628 | 600 | ||
@@ -847,7 +819,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
847 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 819 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
848 | 820 | ||
849 | skb->do_not_encrypt = 1; | 821 | skb->do_not_encrypt = 1; |
850 | info->flags |= IEEE80211_TX_CTL_INJECTED; | ||
851 | tx->flags &= ~IEEE80211_TX_FRAGMENTED; | 822 | tx->flags &= ~IEEE80211_TX_FRAGMENTED; |
852 | 823 | ||
853 | /* | 824 | /* |
@@ -979,7 +950,7 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
979 | 950 | ||
980 | /* process and remove the injection radiotap header */ | 951 | /* process and remove the injection radiotap header */ |
981 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 952 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
982 | if (unlikely(sdata->vif.type == IEEE80211_IF_TYPE_MNTR)) { | 953 | if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) { |
983 | if (__ieee80211_parse_tx_radiotap(tx, skb) == TX_DROP) | 954 | if (__ieee80211_parse_tx_radiotap(tx, skb) == TX_DROP) |
984 | return TX_DROP; | 955 | return TX_DROP; |
985 | 956 | ||
@@ -1060,8 +1031,6 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1060 | return IEEE80211_TX_AGAIN; | 1031 | return IEEE80211_TX_AGAIN; |
1061 | info = IEEE80211_SKB_CB(skb); | 1032 | info = IEEE80211_SKB_CB(skb); |
1062 | 1033 | ||
1063 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), | ||
1064 | "TX to low-level driver", skb); | ||
1065 | ret = local->ops->tx(local_to_hw(local), skb); | 1034 | ret = local->ops->tx(local_to_hw(local), skb); |
1066 | if (ret) | 1035 | if (ret) |
1067 | return IEEE80211_TX_AGAIN; | 1036 | return IEEE80211_TX_AGAIN; |
@@ -1091,9 +1060,6 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1091 | ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 1060 | ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
1092 | } | 1061 | } |
1093 | 1062 | ||
1094 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), | ||
1095 | "TX to low-level driver", | ||
1096 | tx->extra_frag[i]); | ||
1097 | ret = local->ops->tx(local_to_hw(local), | 1063 | ret = local->ops->tx(local_to_hw(local), |
1098 | tx->extra_frag[i]); | 1064 | tx->extra_frag[i]); |
1099 | if (ret) | 1065 | if (ret) |
@@ -1298,6 +1264,11 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1298 | struct ieee80211_sub_if_data *osdata; | 1264 | struct ieee80211_sub_if_data *osdata; |
1299 | int headroom; | 1265 | int headroom; |
1300 | bool may_encrypt; | 1266 | bool may_encrypt; |
1267 | enum { | ||
1268 | NOT_MONITOR, | ||
1269 | FOUND_SDATA, | ||
1270 | UNKNOWN_ADDRESS, | ||
1271 | } monitor_iface = NOT_MONITOR; | ||
1301 | int ret; | 1272 | int ret; |
1302 | 1273 | ||
1303 | if (skb->iif) | 1274 | if (skb->iif) |
@@ -1330,9 +1301,53 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1330 | if (mesh_nexthop_lookup(skb, osdata)) | 1301 | if (mesh_nexthop_lookup(skb, osdata)) |
1331 | return 0; | 1302 | return 0; |
1332 | if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) | 1303 | if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) |
1333 | IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.sta, | 1304 | IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.mesh, |
1334 | fwded_frames); | 1305 | fwded_frames); |
1335 | } | 1306 | } |
1307 | } else if (unlikely(osdata->vif.type == NL80211_IFTYPE_MONITOR)) { | ||
1308 | struct ieee80211_sub_if_data *sdata; | ||
1309 | struct ieee80211_local *local = osdata->local; | ||
1310 | struct ieee80211_hdr *hdr; | ||
1311 | int hdrlen; | ||
1312 | u16 len_rthdr; | ||
1313 | |||
1314 | info->flags |= IEEE80211_TX_CTL_INJECTED; | ||
1315 | monitor_iface = UNKNOWN_ADDRESS; | ||
1316 | |||
1317 | len_rthdr = ieee80211_get_radiotap_len(skb->data); | ||
1318 | hdr = (struct ieee80211_hdr *)skb->data + len_rthdr; | ||
1319 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | ||
1320 | |||
1321 | /* check the header is complete in the frame */ | ||
1322 | if (likely(skb->len >= len_rthdr + hdrlen)) { | ||
1323 | /* | ||
1324 | * We process outgoing injected frames that have a | ||
1325 | * local address we handle as though they are our | ||
1326 | * own frames. | ||
1327 | * This code here isn't entirely correct, the local | ||
1328 | * MAC address is not necessarily enough to find | ||
1329 | * the interface to use; for that proper VLAN/WDS | ||
1330 | * support we will need a different mechanism. | ||
1331 | */ | ||
1332 | |||
1333 | rcu_read_lock(); | ||
1334 | list_for_each_entry_rcu(sdata, &local->interfaces, | ||
1335 | list) { | ||
1336 | if (!netif_running(sdata->dev)) | ||
1337 | continue; | ||
1338 | if (compare_ether_addr(sdata->dev->dev_addr, | ||
1339 | hdr->addr2)) { | ||
1340 | dev_hold(sdata->dev); | ||
1341 | dev_put(odev); | ||
1342 | osdata = sdata; | ||
1343 | odev = osdata->dev; | ||
1344 | skb->iif = sdata->dev->ifindex; | ||
1345 | monitor_iface = FOUND_SDATA; | ||
1346 | break; | ||
1347 | } | ||
1348 | } | ||
1349 | rcu_read_unlock(); | ||
1350 | } | ||
1336 | } | 1351 | } |
1337 | 1352 | ||
1338 | may_encrypt = !skb->do_not_encrypt; | 1353 | may_encrypt = !skb->do_not_encrypt; |
@@ -1349,7 +1364,12 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1349 | return 0; | 1364 | return 0; |
1350 | } | 1365 | } |
1351 | 1366 | ||
1352 | info->control.vif = &osdata->vif; | 1367 | if (osdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
1368 | osdata = container_of(osdata->bss, | ||
1369 | struct ieee80211_sub_if_data, | ||
1370 | u.ap); | ||
1371 | if (likely(monitor_iface != UNKNOWN_ADDRESS)) | ||
1372 | info->control.vif = &osdata->vif; | ||
1353 | ret = ieee80211_tx(odev, skb); | 1373 | ret = ieee80211_tx(odev, skb); |
1354 | dev_put(odev); | 1374 | dev_put(odev); |
1355 | 1375 | ||
@@ -1457,8 +1477,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1457 | fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); | 1477 | fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); |
1458 | 1478 | ||
1459 | switch (sdata->vif.type) { | 1479 | switch (sdata->vif.type) { |
1460 | case IEEE80211_IF_TYPE_AP: | 1480 | case NL80211_IFTYPE_AP: |
1461 | case IEEE80211_IF_TYPE_VLAN: | 1481 | case NL80211_IFTYPE_AP_VLAN: |
1462 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); | 1482 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); |
1463 | /* DA BSSID SA */ | 1483 | /* DA BSSID SA */ |
1464 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1484 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
@@ -1466,7 +1486,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1466 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); | 1486 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); |
1467 | hdrlen = 24; | 1487 | hdrlen = 24; |
1468 | break; | 1488 | break; |
1469 | case IEEE80211_IF_TYPE_WDS: | 1489 | case NL80211_IFTYPE_WDS: |
1470 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1490 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1471 | /* RA TA DA SA */ | 1491 | /* RA TA DA SA */ |
1472 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); | 1492 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); |
@@ -1476,16 +1496,16 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1476 | hdrlen = 30; | 1496 | hdrlen = 30; |
1477 | break; | 1497 | break; |
1478 | #ifdef CONFIG_MAC80211_MESH | 1498 | #ifdef CONFIG_MAC80211_MESH |
1479 | case IEEE80211_IF_TYPE_MESH_POINT: | 1499 | case NL80211_IFTYPE_MESH_POINT: |
1480 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1500 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1481 | /* RA TA DA SA */ | 1501 | /* RA TA DA SA */ |
1482 | memset(hdr.addr1, 0, ETH_ALEN); | 1502 | memset(hdr.addr1, 0, ETH_ALEN); |
1483 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1503 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); |
1484 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1504 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1485 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1505 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1486 | if (!sdata->u.sta.mshcfg.dot11MeshTTL) { | 1506 | if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { |
1487 | /* Do not send frames with mesh_ttl == 0 */ | 1507 | /* Do not send frames with mesh_ttl == 0 */ |
1488 | sdata->u.sta.mshstats.dropped_frames_ttl++; | 1508 | sdata->u.mesh.mshstats.dropped_frames_ttl++; |
1489 | ret = 0; | 1509 | ret = 0; |
1490 | goto fail; | 1510 | goto fail; |
1491 | } | 1511 | } |
@@ -1493,7 +1513,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1493 | hdrlen = 30; | 1513 | hdrlen = 30; |
1494 | break; | 1514 | break; |
1495 | #endif | 1515 | #endif |
1496 | case IEEE80211_IF_TYPE_STA: | 1516 | case NL80211_IFTYPE_STATION: |
1497 | fc |= cpu_to_le16(IEEE80211_FCTL_TODS); | 1517 | fc |= cpu_to_le16(IEEE80211_FCTL_TODS); |
1498 | /* BSSID SA DA */ | 1518 | /* BSSID SA DA */ |
1499 | memcpy(hdr.addr1, sdata->u.sta.bssid, ETH_ALEN); | 1519 | memcpy(hdr.addr1, sdata->u.sta.bssid, ETH_ALEN); |
@@ -1501,7 +1521,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1501 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1521 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1502 | hdrlen = 24; | 1522 | hdrlen = 24; |
1503 | break; | 1523 | break; |
1504 | case IEEE80211_IF_TYPE_IBSS: | 1524 | case NL80211_IFTYPE_ADHOC: |
1505 | /* DA SA BSSID */ | 1525 | /* DA SA BSSID */ |
1506 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1526 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
1507 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); | 1527 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); |
@@ -1580,19 +1600,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1580 | nh_pos -= skip_header_bytes; | 1600 | nh_pos -= skip_header_bytes; |
1581 | h_pos -= skip_header_bytes; | 1601 | h_pos -= skip_header_bytes; |
1582 | 1602 | ||
1583 | /* TODO: implement support for fragments so that there is no need to | ||
1584 | * reallocate and copy payload; it might be enough to support one | ||
1585 | * extra fragment that would be copied in the beginning of the frame | ||
1586 | * data.. anyway, it would be nice to include this into skb structure | ||
1587 | * somehow | ||
1588 | * | ||
1589 | * There are few options for this: | ||
1590 | * use skb->cb as an extra space for 802.11 header | ||
1591 | * allocate new buffer if not enough headroom | ||
1592 | * make sure that there is enough headroom in every skb by increasing | ||
1593 | * build in headroom in __dev_alloc_skb() (linux/skbuff.h) and | ||
1594 | * alloc_skb() (net/core/skbuff.c) | ||
1595 | */ | ||
1596 | head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); | 1603 | head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); |
1597 | 1604 | ||
1598 | /* | 1605 | /* |
@@ -1815,10 +1822,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1815 | struct rate_selection rsel; | 1822 | struct rate_selection rsel; |
1816 | struct beacon_data *beacon; | 1823 | struct beacon_data *beacon; |
1817 | struct ieee80211_supported_band *sband; | 1824 | struct ieee80211_supported_band *sband; |
1818 | struct ieee80211_mgmt *mgmt; | ||
1819 | int *num_beacons; | ||
1820 | enum ieee80211_band band = local->hw.conf.channel->band; | 1825 | enum ieee80211_band band = local->hw.conf.channel->band; |
1821 | u8 *pos; | ||
1822 | 1826 | ||
1823 | sband = local->hw.wiphy->bands[band]; | 1827 | sband = local->hw.wiphy->bands[band]; |
1824 | 1828 | ||
@@ -1827,7 +1831,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1827 | sdata = vif_to_sdata(vif); | 1831 | sdata = vif_to_sdata(vif); |
1828 | bdev = sdata->dev; | 1832 | bdev = sdata->dev; |
1829 | 1833 | ||
1830 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 1834 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
1831 | ap = &sdata->u.ap; | 1835 | ap = &sdata->u.ap; |
1832 | beacon = rcu_dereference(ap->beacon); | 1836 | beacon = rcu_dereference(ap->beacon); |
1833 | if (ap && beacon) { | 1837 | if (ap && beacon) { |
@@ -1865,11 +1869,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1865 | if (beacon->tail) | 1869 | if (beacon->tail) |
1866 | memcpy(skb_put(skb, beacon->tail_len), | 1870 | memcpy(skb_put(skb, beacon->tail_len), |
1867 | beacon->tail, beacon->tail_len); | 1871 | beacon->tail, beacon->tail_len); |
1868 | |||
1869 | num_beacons = &ap->num_beacons; | ||
1870 | } else | 1872 | } else |
1871 | goto out; | 1873 | goto out; |
1872 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 1874 | } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
1873 | struct ieee80211_hdr *hdr; | 1875 | struct ieee80211_hdr *hdr; |
1874 | ifsta = &sdata->u.sta; | 1876 | ifsta = &sdata->u.sta; |
1875 | 1877 | ||
@@ -1884,8 +1886,10 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1884 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1886 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1885 | IEEE80211_STYPE_BEACON); | 1887 | IEEE80211_STYPE_BEACON); |
1886 | 1888 | ||
1887 | num_beacons = &ifsta->num_beacons; | ||
1888 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { | 1889 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { |
1890 | struct ieee80211_mgmt *mgmt; | ||
1891 | u8 *pos; | ||
1892 | |||
1889 | /* headroom, head length, tail length and maximum TIM length */ | 1893 | /* headroom, head length, tail length and maximum TIM length */ |
1890 | skb = dev_alloc_skb(local->tx_headroom + 400); | 1894 | skb = dev_alloc_skb(local->tx_headroom + 400); |
1891 | if (!skb) | 1895 | if (!skb) |
@@ -1909,8 +1913,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1909 | *pos++ = 0x0; | 1913 | *pos++ = 0x0; |
1910 | 1914 | ||
1911 | mesh_mgmt_ies_add(skb, sdata); | 1915 | mesh_mgmt_ies_add(skb, sdata); |
1912 | |||
1913 | num_beacons = &sdata->u.sta.num_beacons; | ||
1914 | } else { | 1916 | } else { |
1915 | WARN_ON(1); | 1917 | WARN_ON(1); |
1916 | goto out; | 1918 | goto out; |
@@ -1947,7 +1949,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1947 | info->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | 1949 | info->antenna_sel_tx = local->hw.conf.antenna_sel_tx; |
1948 | info->control.retry_limit = 1; | 1950 | info->control.retry_limit = 1; |
1949 | 1951 | ||
1950 | (*num_beacons)++; | ||
1951 | out: | 1952 | out: |
1952 | rcu_read_unlock(); | 1953 | rcu_read_unlock(); |
1953 | return skb; | 1954 | return skb; |
@@ -2009,7 +2010,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
2009 | rcu_read_lock(); | 2010 | rcu_read_lock(); |
2010 | beacon = rcu_dereference(bss->beacon); | 2011 | beacon = rcu_dereference(bss->beacon); |
2011 | 2012 | ||
2012 | if (sdata->vif.type != IEEE80211_IF_TYPE_AP || !beacon || !beacon->head) | 2013 | if (sdata->vif.type != NL80211_IFTYPE_AP || !beacon || !beacon->head) |
2013 | goto out; | 2014 | goto out; |
2014 | 2015 | ||
2015 | if (bss->dtim_count != 0) | 2016 | if (bss->dtim_count != 0) |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index c3a22ab2ad2e..f32561ec224c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -43,7 +43,7 @@ const unsigned char bridge_tunnel_header[] __aligned(2) = | |||
43 | 43 | ||
44 | 44 | ||
45 | u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, | 45 | u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, |
46 | enum ieee80211_if_types type) | 46 | enum nl80211_iftype type) |
47 | { | 47 | { |
48 | __le16 fc = hdr->frame_control; | 48 | __le16 fc = hdr->frame_control; |
49 | 49 | ||
@@ -77,10 +77,10 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, | |||
77 | 77 | ||
78 | if (ieee80211_is_back_req(fc)) { | 78 | if (ieee80211_is_back_req(fc)) { |
79 | switch (type) { | 79 | switch (type) { |
80 | case IEEE80211_IF_TYPE_STA: | 80 | case NL80211_IFTYPE_STATION: |
81 | return hdr->addr2; | 81 | return hdr->addr2; |
82 | case IEEE80211_IF_TYPE_AP: | 82 | case NL80211_IFTYPE_AP: |
83 | case IEEE80211_IF_TYPE_VLAN: | 83 | case NL80211_IFTYPE_AP_VLAN: |
84 | return hdr->addr1; | 84 | return hdr->addr1; |
85 | default: | 85 | default: |
86 | break; /* fall through to the return */ | 86 | break; /* fall through to the return */ |
@@ -231,16 +231,21 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, | |||
231 | struct ieee80211_rate *rate) | 231 | struct ieee80211_rate *rate) |
232 | { | 232 | { |
233 | struct ieee80211_local *local = hw_to_local(hw); | 233 | struct ieee80211_local *local = hw_to_local(hw); |
234 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | 234 | struct ieee80211_sub_if_data *sdata; |
235 | u16 dur; | 235 | u16 dur; |
236 | int erp; | 236 | int erp; |
237 | bool short_preamble = false; | ||
237 | 238 | ||
238 | erp = 0; | 239 | erp = 0; |
239 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | 240 | if (vif) { |
240 | erp = rate->flags & IEEE80211_RATE_ERP_G; | 241 | sdata = vif_to_sdata(vif); |
242 | short_preamble = sdata->bss_conf.use_short_preamble; | ||
243 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
244 | erp = rate->flags & IEEE80211_RATE_ERP_G; | ||
245 | } | ||
241 | 246 | ||
242 | dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, erp, | 247 | dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, erp, |
243 | sdata->bss_conf.use_short_preamble); | 248 | short_preamble); |
244 | 249 | ||
245 | return cpu_to_le16(dur); | 250 | return cpu_to_le16(dur); |
246 | } | 251 | } |
@@ -252,7 +257,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | |||
252 | { | 257 | { |
253 | struct ieee80211_local *local = hw_to_local(hw); | 258 | struct ieee80211_local *local = hw_to_local(hw); |
254 | struct ieee80211_rate *rate; | 259 | struct ieee80211_rate *rate; |
255 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | 260 | struct ieee80211_sub_if_data *sdata; |
256 | bool short_preamble; | 261 | bool short_preamble; |
257 | int erp; | 262 | int erp; |
258 | u16 dur; | 263 | u16 dur; |
@@ -260,13 +265,17 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, | |||
260 | 265 | ||
261 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 266 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
262 | 267 | ||
263 | short_preamble = sdata->bss_conf.use_short_preamble; | 268 | short_preamble = false; |
264 | 269 | ||
265 | rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; | 270 | rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; |
266 | 271 | ||
267 | erp = 0; | 272 | erp = 0; |
268 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | 273 | if (vif) { |
269 | erp = rate->flags & IEEE80211_RATE_ERP_G; | 274 | sdata = vif_to_sdata(vif); |
275 | short_preamble = sdata->bss_conf.use_short_preamble; | ||
276 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
277 | erp = rate->flags & IEEE80211_RATE_ERP_G; | ||
278 | } | ||
270 | 279 | ||
271 | /* CTS duration */ | 280 | /* CTS duration */ |
272 | dur = ieee80211_frame_duration(local, 10, rate->bitrate, | 281 | dur = ieee80211_frame_duration(local, 10, rate->bitrate, |
@@ -289,7 +298,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, | |||
289 | { | 298 | { |
290 | struct ieee80211_local *local = hw_to_local(hw); | 299 | struct ieee80211_local *local = hw_to_local(hw); |
291 | struct ieee80211_rate *rate; | 300 | struct ieee80211_rate *rate; |
292 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | 301 | struct ieee80211_sub_if_data *sdata; |
293 | bool short_preamble; | 302 | bool short_preamble; |
294 | int erp; | 303 | int erp; |
295 | u16 dur; | 304 | u16 dur; |
@@ -297,12 +306,16 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, | |||
297 | 306 | ||
298 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 307 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
299 | 308 | ||
300 | short_preamble = sdata->bss_conf.use_short_preamble; | 309 | short_preamble = false; |
301 | 310 | ||
302 | rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; | 311 | rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; |
303 | erp = 0; | 312 | erp = 0; |
304 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | 313 | if (vif) { |
305 | erp = rate->flags & IEEE80211_RATE_ERP_G; | 314 | sdata = vif_to_sdata(vif); |
315 | short_preamble = sdata->bss_conf.use_short_preamble; | ||
316 | if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
317 | erp = rate->flags & IEEE80211_RATE_ERP_G; | ||
318 | } | ||
306 | 319 | ||
307 | /* Data frame duration */ | 320 | /* Data frame duration */ |
308 | dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, | 321 | dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, |
@@ -376,15 +389,16 @@ void ieee80211_iterate_active_interfaces( | |||
376 | 389 | ||
377 | list_for_each_entry(sdata, &local->interfaces, list) { | 390 | list_for_each_entry(sdata, &local->interfaces, list) { |
378 | switch (sdata->vif.type) { | 391 | switch (sdata->vif.type) { |
379 | case IEEE80211_IF_TYPE_INVALID: | 392 | case __NL80211_IFTYPE_AFTER_LAST: |
380 | case IEEE80211_IF_TYPE_MNTR: | 393 | case NL80211_IFTYPE_UNSPECIFIED: |
381 | case IEEE80211_IF_TYPE_VLAN: | 394 | case NL80211_IFTYPE_MONITOR: |
395 | case NL80211_IFTYPE_AP_VLAN: | ||
382 | continue; | 396 | continue; |
383 | case IEEE80211_IF_TYPE_AP: | 397 | case NL80211_IFTYPE_AP: |
384 | case IEEE80211_IF_TYPE_STA: | 398 | case NL80211_IFTYPE_STATION: |
385 | case IEEE80211_IF_TYPE_IBSS: | 399 | case NL80211_IFTYPE_ADHOC: |
386 | case IEEE80211_IF_TYPE_WDS: | 400 | case NL80211_IFTYPE_WDS: |
387 | case IEEE80211_IF_TYPE_MESH_POINT: | 401 | case NL80211_IFTYPE_MESH_POINT: |
388 | break; | 402 | break; |
389 | } | 403 | } |
390 | if (netif_running(sdata->dev)) | 404 | if (netif_running(sdata->dev)) |
@@ -409,15 +423,16 @@ void ieee80211_iterate_active_interfaces_atomic( | |||
409 | 423 | ||
410 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 424 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
411 | switch (sdata->vif.type) { | 425 | switch (sdata->vif.type) { |
412 | case IEEE80211_IF_TYPE_INVALID: | 426 | case __NL80211_IFTYPE_AFTER_LAST: |
413 | case IEEE80211_IF_TYPE_MNTR: | 427 | case NL80211_IFTYPE_UNSPECIFIED: |
414 | case IEEE80211_IF_TYPE_VLAN: | 428 | case NL80211_IFTYPE_MONITOR: |
429 | case NL80211_IFTYPE_AP_VLAN: | ||
415 | continue; | 430 | continue; |
416 | case IEEE80211_IF_TYPE_AP: | 431 | case NL80211_IFTYPE_AP: |
417 | case IEEE80211_IF_TYPE_STA: | 432 | case NL80211_IFTYPE_STATION: |
418 | case IEEE80211_IF_TYPE_IBSS: | 433 | case NL80211_IFTYPE_ADHOC: |
419 | case IEEE80211_IF_TYPE_WDS: | 434 | case NL80211_IFTYPE_WDS: |
420 | case IEEE80211_IF_TYPE_MESH_POINT: | 435 | case NL80211_IFTYPE_MESH_POINT: |
421 | break; | 436 | break; |
422 | } | 437 | } |
423 | if (netif_running(sdata->dev)) | 438 | if (netif_running(sdata->dev)) |
@@ -612,3 +627,59 @@ void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | |||
612 | 627 | ||
613 | dev_queue_xmit(skb); | 628 | dev_queue_xmit(skb); |
614 | } | 629 | } |
630 | |||
631 | int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz) | ||
632 | { | ||
633 | int ret = -EINVAL; | ||
634 | struct ieee80211_channel *chan; | ||
635 | struct ieee80211_local *local = sdata->local; | ||
636 | |||
637 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | ||
638 | |||
639 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | ||
640 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && | ||
641 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | ||
642 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | ||
643 | "%d MHz\n", sdata->dev->name, chan->center_freq); | ||
644 | return ret; | ||
645 | } | ||
646 | local->oper_channel = chan; | ||
647 | |||
648 | if (local->sw_scanning || local->hw_scanning) | ||
649 | ret = 0; | ||
650 | else | ||
651 | ret = ieee80211_hw_config(local); | ||
652 | |||
653 | rate_control_clear(local); | ||
654 | } | ||
655 | |||
656 | return ret; | ||
657 | } | ||
658 | |||
659 | u64 ieee80211_mandatory_rates(struct ieee80211_local *local, | ||
660 | enum ieee80211_band band) | ||
661 | { | ||
662 | struct ieee80211_supported_band *sband; | ||
663 | struct ieee80211_rate *bitrates; | ||
664 | u64 mandatory_rates; | ||
665 | enum ieee80211_rate_flags mandatory_flag; | ||
666 | int i; | ||
667 | |||
668 | sband = local->hw.wiphy->bands[band]; | ||
669 | if (!sband) { | ||
670 | WARN_ON(1); | ||
671 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
672 | } | ||
673 | |||
674 | if (band == IEEE80211_BAND_2GHZ) | ||
675 | mandatory_flag = IEEE80211_RATE_MANDATORY_B; | ||
676 | else | ||
677 | mandatory_flag = IEEE80211_RATE_MANDATORY_A; | ||
678 | |||
679 | bitrates = sband->bitrates; | ||
680 | mandatory_rates = 0; | ||
681 | for (i = 0; i < sband->n_bitrates; i++) | ||
682 | if (bitrates[i].flags & mandatory_flag) | ||
683 | mandatory_rates |= BIT(i); | ||
684 | return mandatory_rates; | ||
685 | } | ||
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index beae664ab480..7e0d53abde24 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -122,8 +122,8 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev, | |||
122 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) | 122 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) |
123 | return -EOPNOTSUPP; | 123 | return -EOPNOTSUPP; |
124 | 124 | ||
125 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 125 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
126 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 126 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
127 | int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length); | 127 | int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length); |
128 | if (ret) | 128 | if (ret) |
129 | return ret; | 129 | return ret; |
@@ -273,21 +273,21 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev, | |||
273 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 273 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
274 | int type; | 274 | int type; |
275 | 275 | ||
276 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) | 276 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
277 | return -EOPNOTSUPP; | 277 | return -EOPNOTSUPP; |
278 | 278 | ||
279 | switch (*mode) { | 279 | switch (*mode) { |
280 | case IW_MODE_INFRA: | 280 | case IW_MODE_INFRA: |
281 | type = IEEE80211_IF_TYPE_STA; | 281 | type = NL80211_IFTYPE_STATION; |
282 | break; | 282 | break; |
283 | case IW_MODE_ADHOC: | 283 | case IW_MODE_ADHOC: |
284 | type = IEEE80211_IF_TYPE_IBSS; | 284 | type = NL80211_IFTYPE_ADHOC; |
285 | break; | 285 | break; |
286 | case IW_MODE_REPEAT: | 286 | case IW_MODE_REPEAT: |
287 | type = IEEE80211_IF_TYPE_WDS; | 287 | type = NL80211_IFTYPE_WDS; |
288 | break; | 288 | break; |
289 | case IW_MODE_MONITOR: | 289 | case IW_MODE_MONITOR: |
290 | type = IEEE80211_IF_TYPE_MNTR; | 290 | type = NL80211_IFTYPE_MONITOR; |
291 | break; | 291 | break; |
292 | default: | 292 | default: |
293 | return -EINVAL; | 293 | return -EINVAL; |
@@ -305,22 +305,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
305 | 305 | ||
306 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 306 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
307 | switch (sdata->vif.type) { | 307 | switch (sdata->vif.type) { |
308 | case IEEE80211_IF_TYPE_AP: | 308 | case NL80211_IFTYPE_AP: |
309 | *mode = IW_MODE_MASTER; | 309 | *mode = IW_MODE_MASTER; |
310 | break; | 310 | break; |
311 | case IEEE80211_IF_TYPE_STA: | 311 | case NL80211_IFTYPE_STATION: |
312 | *mode = IW_MODE_INFRA; | 312 | *mode = IW_MODE_INFRA; |
313 | break; | 313 | break; |
314 | case IEEE80211_IF_TYPE_IBSS: | 314 | case NL80211_IFTYPE_ADHOC: |
315 | *mode = IW_MODE_ADHOC; | 315 | *mode = IW_MODE_ADHOC; |
316 | break; | 316 | break; |
317 | case IEEE80211_IF_TYPE_MNTR: | 317 | case NL80211_IFTYPE_MONITOR: |
318 | *mode = IW_MODE_MONITOR; | 318 | *mode = IW_MODE_MONITOR; |
319 | break; | 319 | break; |
320 | case IEEE80211_IF_TYPE_WDS: | 320 | case NL80211_IFTYPE_WDS: |
321 | *mode = IW_MODE_REPEAT; | 321 | *mode = IW_MODE_REPEAT; |
322 | break; | 322 | break; |
323 | case IEEE80211_IF_TYPE_VLAN: | 323 | case NL80211_IFTYPE_AP_VLAN: |
324 | *mode = IW_MODE_SECOND; /* FIXME */ | 324 | *mode = IW_MODE_SECOND; /* FIXME */ |
325 | break; | 325 | break; |
326 | default: | 326 | default: |
@@ -330,47 +330,19 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
330 | return 0; | 330 | return 0; |
331 | } | 331 | } |
332 | 332 | ||
333 | int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz) | ||
334 | { | ||
335 | int ret = -EINVAL; | ||
336 | struct ieee80211_channel *chan; | ||
337 | struct ieee80211_local *local = sdata->local; | ||
338 | |||
339 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | ||
340 | |||
341 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | ||
342 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | ||
343 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | ||
344 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | ||
345 | "%d MHz\n", sdata->dev->name, chan->center_freq); | ||
346 | return ret; | ||
347 | } | ||
348 | local->oper_channel = chan; | ||
349 | |||
350 | if (local->sta_sw_scanning || local->sta_hw_scanning) | ||
351 | ret = 0; | ||
352 | else | ||
353 | ret = ieee80211_hw_config(local); | ||
354 | |||
355 | rate_control_clear(local); | ||
356 | } | ||
357 | |||
358 | return ret; | ||
359 | } | ||
360 | |||
361 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, | 333 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, |
362 | struct iw_request_info *info, | 334 | struct iw_request_info *info, |
363 | struct iw_freq *freq, char *extra) | 335 | struct iw_freq *freq, char *extra) |
364 | { | 336 | { |
365 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 337 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
366 | 338 | ||
367 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 339 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
368 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; | 340 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; |
369 | 341 | ||
370 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ | 342 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ |
371 | if (freq->e == 0) { | 343 | if (freq->e == 0) { |
372 | if (freq->m < 0) { | 344 | if (freq->m < 0) { |
373 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 345 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
374 | sdata->u.sta.flags |= | 346 | sdata->u.sta.flags |= |
375 | IEEE80211_STA_AUTO_CHANNEL_SEL; | 347 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
376 | return 0; | 348 | return 0; |
@@ -414,8 +386,8 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
414 | len--; | 386 | len--; |
415 | 387 | ||
416 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 388 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
417 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 389 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
418 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 390 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
419 | int ret; | 391 | int ret; |
420 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { | 392 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { |
421 | if (len > IEEE80211_MAX_SSID_LEN) | 393 | if (len > IEEE80211_MAX_SSID_LEN) |
@@ -435,7 +407,7 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
435 | return 0; | 407 | return 0; |
436 | } | 408 | } |
437 | 409 | ||
438 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 410 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
439 | memcpy(sdata->u.ap.ssid, ssid, len); | 411 | memcpy(sdata->u.ap.ssid, ssid, len); |
440 | memset(sdata->u.ap.ssid + len, 0, | 412 | memset(sdata->u.ap.ssid + len, 0, |
441 | IEEE80211_MAX_SSID_LEN - len); | 413 | IEEE80211_MAX_SSID_LEN - len); |
@@ -454,8 +426,8 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, | |||
454 | 426 | ||
455 | struct ieee80211_sub_if_data *sdata; | 427 | struct ieee80211_sub_if_data *sdata; |
456 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 428 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
457 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 429 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
458 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 430 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
459 | int res = ieee80211_sta_get_ssid(sdata, ssid, &len); | 431 | int res = ieee80211_sta_get_ssid(sdata, ssid, &len); |
460 | if (res == 0) { | 432 | if (res == 0) { |
461 | data->length = len; | 433 | data->length = len; |
@@ -465,7 +437,7 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, | |||
465 | return res; | 437 | return res; |
466 | } | 438 | } |
467 | 439 | ||
468 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 440 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
469 | len = sdata->u.ap.ssid_len; | 441 | len = sdata->u.ap.ssid_len; |
470 | if (len > IW_ESSID_MAX_SIZE) | 442 | if (len > IW_ESSID_MAX_SIZE) |
471 | len = IW_ESSID_MAX_SIZE; | 443 | len = IW_ESSID_MAX_SIZE; |
@@ -485,8 +457,8 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, | |||
485 | struct ieee80211_sub_if_data *sdata; | 457 | struct ieee80211_sub_if_data *sdata; |
486 | 458 | ||
487 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 459 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
488 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 460 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
489 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 461 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
490 | int ret; | 462 | int ret; |
491 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { | 463 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { |
492 | memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data, | 464 | memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data, |
@@ -505,7 +477,7 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, | |||
505 | return ret; | 477 | return ret; |
506 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); | 478 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
507 | return 0; | 479 | return 0; |
508 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 480 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
509 | /* | 481 | /* |
510 | * If it is necessary to update the WDS peer address | 482 | * If it is necessary to update the WDS peer address |
511 | * while the interface is running, then we need to do | 483 | * while the interface is running, then we need to do |
@@ -533,8 +505,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
533 | struct ieee80211_sub_if_data *sdata; | 505 | struct ieee80211_sub_if_data *sdata; |
534 | 506 | ||
535 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 507 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
536 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 508 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
537 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 509 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
538 | if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATED || | 510 | if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATED || |
539 | sdata->u.sta.state == IEEE80211_STA_MLME_IBSS_JOINED) { | 511 | sdata->u.sta.state == IEEE80211_STA_MLME_IBSS_JOINED) { |
540 | ap_addr->sa_family = ARPHRD_ETHER; | 512 | ap_addr->sa_family = ARPHRD_ETHER; |
@@ -544,7 +516,7 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
544 | memset(&ap_addr->sa_data, 0, ETH_ALEN); | 516 | memset(&ap_addr->sa_data, 0, ETH_ALEN); |
545 | return 0; | 517 | return 0; |
546 | } | 518 | } |
547 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 519 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
548 | ap_addr->sa_family = ARPHRD_ETHER; | 520 | ap_addr->sa_family = ARPHRD_ETHER; |
549 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); | 521 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |
550 | return 0; | 522 | return 0; |
@@ -566,10 +538,10 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev, | |||
566 | if (!netif_running(dev)) | 538 | if (!netif_running(dev)) |
567 | return -ENETDOWN; | 539 | return -ENETDOWN; |
568 | 540 | ||
569 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 541 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
570 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 542 | sdata->vif.type != NL80211_IFTYPE_ADHOC && |
571 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT && | 543 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && |
572 | sdata->vif.type != IEEE80211_IF_TYPE_AP) | 544 | sdata->vif.type != NL80211_IFTYPE_AP) |
573 | return -EOPNOTSUPP; | 545 | return -EOPNOTSUPP; |
574 | 546 | ||
575 | /* if SSID was specified explicitly then use that */ | 547 | /* if SSID was specified explicitly then use that */ |
@@ -580,7 +552,7 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev, | |||
580 | ssid_len = req->essid_len; | 552 | ssid_len = req->essid_len; |
581 | } | 553 | } |
582 | 554 | ||
583 | return ieee80211_sta_req_scan(sdata, ssid, ssid_len); | 555 | return ieee80211_request_scan(sdata, ssid, ssid_len); |
584 | } | 556 | } |
585 | 557 | ||
586 | 558 | ||
@@ -594,10 +566,10 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev, | |||
594 | 566 | ||
595 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 567 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
596 | 568 | ||
597 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 569 | if (local->sw_scanning || local->hw_scanning) |
598 | return -EAGAIN; | 570 | return -EAGAIN; |
599 | 571 | ||
600 | res = ieee80211_sta_scan_results(local, info, extra, data->length); | 572 | res = ieee80211_scan_results(local, info, extra, data->length); |
601 | if (res >= 0) { | 573 | if (res >= 0) { |
602 | data->length = res; | 574 | data->length = res; |
603 | return 0; | 575 | return 0; |
@@ -655,7 +627,7 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev, | |||
655 | 627 | ||
656 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 628 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
657 | 629 | ||
658 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 630 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
659 | return -EOPNOTSUPP; | 631 | return -EOPNOTSUPP; |
660 | 632 | ||
661 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 633 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
@@ -664,8 +636,8 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev, | |||
664 | 636 | ||
665 | sta = sta_info_get(local, sdata->u.sta.bssid); | 637 | sta = sta_info_get(local, sdata->u.sta.bssid); |
666 | 638 | ||
667 | if (sta && sta->txrate_idx < sband->n_bitrates) | 639 | if (sta && sta->last_txrate_idx < sband->n_bitrates) |
668 | rate->value = sband->bitrates[sta->txrate_idx].bitrate; | 640 | rate->value = sband->bitrates[sta->last_txrate_idx].bitrate; |
669 | else | 641 | else |
670 | rate->value = 0; | 642 | rate->value = 0; |
671 | 643 | ||
@@ -886,8 +858,8 @@ static int ieee80211_ioctl_siwmlme(struct net_device *dev, | |||
886 | struct iw_mlme *mlme = (struct iw_mlme *) extra; | 858 | struct iw_mlme *mlme = (struct iw_mlme *) extra; |
887 | 859 | ||
888 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 860 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
889 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 861 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
890 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 862 | sdata->vif.type != NL80211_IFTYPE_ADHOC) |
891 | return -EINVAL; | 863 | return -EINVAL; |
892 | 864 | ||
893 | switch (mlme->cmd) { | 865 | switch (mlme->cmd) { |
@@ -982,7 +954,7 @@ static int ieee80211_ioctl_giwencode(struct net_device *dev, | |||
982 | erq->length = sdata->keys[idx]->conf.keylen; | 954 | erq->length = sdata->keys[idx]->conf.keylen; |
983 | erq->flags |= IW_ENCODE_ENABLED; | 955 | erq->flags |= IW_ENCODE_ENABLED; |
984 | 956 | ||
985 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) { | 957 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
986 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 958 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
987 | switch (ifsta->auth_alg) { | 959 | switch (ifsta->auth_alg) { |
988 | case WLAN_AUTH_OPEN: | 960 | case WLAN_AUTH_OPEN: |
@@ -1056,7 +1028,7 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
1056 | sdata->drop_unencrypted = !!data->value; | 1028 | sdata->drop_unencrypted = !!data->value; |
1057 | break; | 1029 | break; |
1058 | case IW_AUTH_PRIVACY_INVOKED: | 1030 | case IW_AUTH_PRIVACY_INVOKED: |
1059 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 1031 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
1060 | ret = -EINVAL; | 1032 | ret = -EINVAL; |
1061 | else { | 1033 | else { |
1062 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; | 1034 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; |
@@ -1071,8 +1043,8 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
1071 | } | 1043 | } |
1072 | break; | 1044 | break; |
1073 | case IW_AUTH_80211_AUTH_ALG: | 1045 | case IW_AUTH_80211_AUTH_ALG: |
1074 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1046 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1075 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1047 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1076 | sdata->u.sta.auth_algs = data->value; | 1048 | sdata->u.sta.auth_algs = data->value; |
1077 | else | 1049 | else |
1078 | ret = -EOPNOTSUPP; | 1050 | ret = -EOPNOTSUPP; |
@@ -1094,8 +1066,8 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev | |||
1094 | 1066 | ||
1095 | rcu_read_lock(); | 1067 | rcu_read_lock(); |
1096 | 1068 | ||
1097 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1069 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1098 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1070 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1099 | sta = sta_info_get(local, sdata->u.sta.bssid); | 1071 | sta = sta_info_get(local, sdata->u.sta.bssid); |
1100 | if (!sta) { | 1072 | if (!sta) { |
1101 | wstats->discard.fragment = 0; | 1073 | wstats->discard.fragment = 0; |
@@ -1125,8 +1097,8 @@ static int ieee80211_ioctl_giwauth(struct net_device *dev, | |||
1125 | 1097 | ||
1126 | switch (data->flags & IW_AUTH_INDEX) { | 1098 | switch (data->flags & IW_AUTH_INDEX) { |
1127 | case IW_AUTH_80211_AUTH_ALG: | 1099 | case IW_AUTH_80211_AUTH_ALG: |
1128 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1100 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1129 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1101 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1130 | data->value = sdata->u.sta.auth_algs; | 1102 | data->value = sdata->u.sta.auth_algs; |
1131 | else | 1103 | else |
1132 | ret = -EOPNOTSUPP; | 1104 | ret = -EOPNOTSUPP; |
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index 7229e958879d..6748dedcab50 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c | |||
@@ -210,7 +210,7 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local, | |||
210 | DECLARE_MAC_BUF(mac); | 210 | DECLARE_MAC_BUF(mac); |
211 | printk(KERN_DEBUG "allocated aggregation queue" | 211 | printk(KERN_DEBUG "allocated aggregation queue" |
212 | " %d tid %d addr %s pool=0x%lX\n", | 212 | " %d tid %d addr %s pool=0x%lX\n", |
213 | i, tid, print_mac(mac, sta->addr), | 213 | i, tid, print_mac(mac, sta->sta.addr), |
214 | local->queue_pool[0]); | 214 | local->queue_pool[0]); |
215 | } | 215 | } |
216 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 216 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h index 465e274df7c5..bc62f28a4d3d 100644 --- a/net/mac80211/wme.h +++ b/net/mac80211/wme.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * IEEE 802.11 driver (80211.o) - QoS datatypes | ||
3 | * Copyright 2004, Instant802 Networks, Inc. | 2 | * Copyright 2004, Instant802 Networks, Inc. |
4 | * Copyright 2005, Devicescape Software, Inc. | 3 | * Copyright 2005, Devicescape Software, Inc. |
5 | * | 4 | * |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 78021780b885..37ae9a959f63 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -256,7 +256,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) | |||
256 | 256 | ||
257 | res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm, | 257 | res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm, |
258 | key, skb->data + hdrlen, | 258 | key, skb->data + hdrlen, |
259 | skb->len - hdrlen, rx->sta->addr, | 259 | skb->len - hdrlen, rx->sta->sta.addr, |
260 | hdr->addr1, hwaccel, rx->queue, | 260 | hdr->addr1, hwaccel, rx->queue, |
261 | &rx->tkip_iv32, | 261 | &rx->tkip_iv32, |
262 | &rx->tkip_iv16); | 262 | &rx->tkip_iv16); |
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index d5735799ccd9..ea0dc04b3c77 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -512,21 +512,9 @@ static void rfkill_release(struct device *dev) | |||
512 | #ifdef CONFIG_PM | 512 | #ifdef CONFIG_PM |
513 | static int rfkill_suspend(struct device *dev, pm_message_t state) | 513 | static int rfkill_suspend(struct device *dev, pm_message_t state) |
514 | { | 514 | { |
515 | struct rfkill *rfkill = to_rfkill(dev); | 515 | /* mark class device as suspended */ |
516 | 516 | if (dev->power.power_state.event != state.event) | |
517 | if (dev->power.power_state.event != state.event) { | ||
518 | if (state.event & PM_EVENT_SLEEP) { | ||
519 | /* Stop transmitter, keep state, no notifies */ | ||
520 | update_rfkill_state(rfkill); | ||
521 | |||
522 | mutex_lock(&rfkill->mutex); | ||
523 | rfkill->toggle_radio(rfkill->data, | ||
524 | RFKILL_STATE_SOFT_BLOCKED); | ||
525 | mutex_unlock(&rfkill->mutex); | ||
526 | } | ||
527 | |||
528 | dev->power.power_state = state; | 517 | dev->power.power_state = state; |
529 | } | ||
530 | 518 | ||
531 | return 0; | 519 | return 0; |
532 | } | 520 | } |
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig index 833b024f8f66..b97bd9fe6b79 100644 --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig | |||
@@ -14,6 +14,38 @@ config NL80211 | |||
14 | 14 | ||
15 | If unsure, say Y. | 15 | If unsure, say Y. |
16 | 16 | ||
17 | config WIRELESS_OLD_REGULATORY | ||
18 | bool "Old wireless static regulatory defintions" | ||
19 | default n | ||
20 | ---help--- | ||
21 | This option enables the old static regulatory information | ||
22 | and uses it within the new framework. This is available | ||
23 | temporarily as an option to help prevent immediate issues | ||
24 | due to the switch to the new regulatory framework which | ||
25 | does require a new userspace application which has the | ||
26 | database of regulatory information (CRDA) and another for | ||
27 | setting regulatory domains (iw). | ||
28 | |||
29 | For more information see: | ||
30 | |||
31 | http://wireless.kernel.org/en/developers/Regulatory/CRDA | ||
32 | http://wireless.kernel.org/en/users/Documentation/iw | ||
33 | |||
34 | It is important to note though that if you *do* have CRDA present | ||
35 | and if this option is enabled CRDA *will* be called to update the | ||
36 | regulatory domain (for US and JP only). Support for letting the user | ||
37 | set the regulatory domain through iw is also supported. This option | ||
38 | mainly exists to leave around for a kernel release some old static | ||
39 | regulatory domains that were defined and to keep around the old | ||
40 | ieee80211_regdom module parameter. This is being phased out and you | ||
41 | should stop using them ASAP. | ||
42 | |||
43 | Say N unless you cannot install a new userspace application | ||
44 | or have one currently depending on the ieee80211_regdom module | ||
45 | parameter and cannot port it to use the new userspace interfaces. | ||
46 | |||
47 | This is scheduled for removal for 2.6.29. | ||
48 | |||
17 | config WIRELESS_EXT | 49 | config WIRELESS_EXT |
18 | bool "Wireless extensions" | 50 | bool "Wireless extensions" |
19 | default n | 51 | default n |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 7e995ac06a0c..a910cd2d0fd1 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -13,12 +13,14 @@ | |||
13 | #include <linux/debugfs.h> | 13 | #include <linux/debugfs.h> |
14 | #include <linux/notifier.h> | 14 | #include <linux/notifier.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/list.h> | ||
16 | #include <net/genetlink.h> | 17 | #include <net/genetlink.h> |
17 | #include <net/cfg80211.h> | 18 | #include <net/cfg80211.h> |
18 | #include <net/wireless.h> | 19 | #include <net/wireless.h> |
19 | #include "nl80211.h" | 20 | #include "nl80211.h" |
20 | #include "core.h" | 21 | #include "core.h" |
21 | #include "sysfs.h" | 22 | #include "sysfs.h" |
23 | #include "reg.h" | ||
22 | 24 | ||
23 | /* name for sysfs, %d is appended */ | 25 | /* name for sysfs, %d is appended */ |
24 | #define PHY_NAME "phy" | 26 | #define PHY_NAME "phy" |
@@ -27,6 +29,107 @@ MODULE_AUTHOR("Johannes Berg"); | |||
27 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
28 | MODULE_DESCRIPTION("wireless configuration support"); | 30 | MODULE_DESCRIPTION("wireless configuration support"); |
29 | 31 | ||
32 | struct list_head regulatory_requests; | ||
33 | |||
34 | /* Central wireless core regulatory domains, we only need two, | ||
35 | * the current one and a world regulatory domain in case we have no | ||
36 | * information to give us an alpha2 */ | ||
37 | struct ieee80211_regdomain *cfg80211_regdomain; | ||
38 | |||
39 | /* We keep a static world regulatory domain in case of the absence of CRDA */ | ||
40 | const struct ieee80211_regdomain world_regdom = { | ||
41 | .n_reg_rules = 1, | ||
42 | .alpha2 = "00", | ||
43 | .reg_rules = { | ||
44 | REG_RULE(2402, 2472, 40, 6, 20, | ||
45 | NL80211_RRF_PASSIVE_SCAN | | ||
46 | NL80211_RRF_NO_IBSS), | ||
47 | } | ||
48 | }; | ||
49 | |||
50 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
51 | /* All this fucking static junk will be removed soon, so | ||
52 | * don't fucking count on it !@#$ */ | ||
53 | |||
54 | static char *ieee80211_regdom = "US"; | ||
55 | module_param(ieee80211_regdom, charp, 0444); | ||
56 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); | ||
57 | |||
58 | /* We assume 40 MHz bandwidth for the old regulatory work. | ||
59 | * We make emphasis we are using the exact same frequencies | ||
60 | * as before */ | ||
61 | |||
62 | const struct ieee80211_regdomain us_regdom = { | ||
63 | .n_reg_rules = 6, | ||
64 | .alpha2 = "US", | ||
65 | .reg_rules = { | ||
66 | /* IEEE 802.11b/g, channels 1..11 */ | ||
67 | REG_RULE(2412-20, 2462+20, 40, 6, 27, 0), | ||
68 | /* IEEE 802.11a, channel 36 */ | ||
69 | REG_RULE(5180-20, 5180+20, 40, 6, 23, 0), | ||
70 | /* IEEE 802.11a, channel 40 */ | ||
71 | REG_RULE(5200-20, 5200+20, 40, 6, 23, 0), | ||
72 | /* IEEE 802.11a, channel 44 */ | ||
73 | REG_RULE(5220-20, 5220+20, 40, 6, 23, 0), | ||
74 | /* IEEE 802.11a, channels 48..64 */ | ||
75 | REG_RULE(5240-20, 5320+20, 40, 6, 23, 0), | ||
76 | /* IEEE 802.11a, channels 149..165, outdoor */ | ||
77 | REG_RULE(5745-20, 5825+20, 40, 6, 30, 0), | ||
78 | } | ||
79 | }; | ||
80 | |||
81 | const struct ieee80211_regdomain jp_regdom = { | ||
82 | .n_reg_rules = 3, | ||
83 | .alpha2 = "JP", | ||
84 | .reg_rules = { | ||
85 | /* IEEE 802.11b/g, channels 1..14 */ | ||
86 | REG_RULE(2412-20, 2484+20, 40, 6, 20, 0), | ||
87 | /* IEEE 802.11a, channels 34..48 */ | ||
88 | REG_RULE(5170-20, 5240+20, 40, 6, 20, | ||
89 | NL80211_RRF_PASSIVE_SCAN), | ||
90 | /* IEEE 802.11a, channels 52..64 */ | ||
91 | REG_RULE(5260-20, 5320+20, 40, 6, 20, | ||
92 | NL80211_RRF_NO_IBSS | | ||
93 | NL80211_RRF_DFS), | ||
94 | } | ||
95 | }; | ||
96 | |||
97 | const struct ieee80211_regdomain eu_regdom = { | ||
98 | .n_reg_rules = 6, | ||
99 | /* This alpha2 is bogus, we leave it here just for stupid | ||
100 | * backward compatibility */ | ||
101 | .alpha2 = "EU", | ||
102 | .reg_rules = { | ||
103 | /* IEEE 802.11b/g, channels 1..13 */ | ||
104 | REG_RULE(2412-20, 2472+20, 40, 6, 20, 0), | ||
105 | /* IEEE 802.11a, channel 36 */ | ||
106 | REG_RULE(5180-20, 5180+20, 40, 6, 23, | ||
107 | NL80211_RRF_PASSIVE_SCAN), | ||
108 | /* IEEE 802.11a, channel 40 */ | ||
109 | REG_RULE(5200-20, 5200+20, 40, 6, 23, | ||
110 | NL80211_RRF_PASSIVE_SCAN), | ||
111 | /* IEEE 802.11a, channel 44 */ | ||
112 | REG_RULE(5220-20, 5220+20, 40, 6, 23, | ||
113 | NL80211_RRF_PASSIVE_SCAN), | ||
114 | /* IEEE 802.11a, channels 48..64 */ | ||
115 | REG_RULE(5240-20, 5320+20, 40, 6, 20, | ||
116 | NL80211_RRF_NO_IBSS | | ||
117 | NL80211_RRF_DFS), | ||
118 | /* IEEE 802.11a, channels 100..140 */ | ||
119 | REG_RULE(5500-20, 5700+20, 40, 6, 30, | ||
120 | NL80211_RRF_NO_IBSS | | ||
121 | NL80211_RRF_DFS), | ||
122 | } | ||
123 | }; | ||
124 | |||
125 | #endif | ||
126 | |||
127 | struct ieee80211_regdomain *cfg80211_world_regdom = | ||
128 | (struct ieee80211_regdomain *) &world_regdom; | ||
129 | |||
130 | LIST_HEAD(regulatory_requests); | ||
131 | DEFINE_MUTEX(cfg80211_reg_mutex); | ||
132 | |||
30 | /* RCU might be appropriate here since we usually | 133 | /* RCU might be appropriate here since we usually |
31 | * only read the list, and that can happen quite | 134 | * only read the list, and that can happen quite |
32 | * often because we need to do it for each command */ | 135 | * often because we need to do it for each command */ |
@@ -302,7 +405,9 @@ int wiphy_register(struct wiphy *wiphy) | |||
302 | ieee80211_set_bitrate_flags(wiphy); | 405 | ieee80211_set_bitrate_flags(wiphy); |
303 | 406 | ||
304 | /* set up regulatory info */ | 407 | /* set up regulatory info */ |
305 | wiphy_update_regulatory(wiphy); | 408 | mutex_lock(&cfg80211_reg_mutex); |
409 | wiphy_update_regulatory(wiphy, REGDOM_SET_BY_CORE); | ||
410 | mutex_unlock(&cfg80211_reg_mutex); | ||
306 | 411 | ||
307 | mutex_lock(&cfg80211_drv_mutex); | 412 | mutex_lock(&cfg80211_drv_mutex); |
308 | 413 | ||
@@ -409,9 +514,35 @@ static struct notifier_block cfg80211_netdev_notifier = { | |||
409 | .notifier_call = cfg80211_netdev_notifier_call, | 514 | .notifier_call = cfg80211_netdev_notifier_call, |
410 | }; | 515 | }; |
411 | 516 | ||
517 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
518 | const struct ieee80211_regdomain *static_regdom(char *alpha2) | ||
519 | { | ||
520 | if (alpha2[0] == 'U' && alpha2[1] == 'S') | ||
521 | return &us_regdom; | ||
522 | if (alpha2[0] == 'J' && alpha2[1] == 'P') | ||
523 | return &jp_regdom; | ||
524 | if (alpha2[0] == 'E' && alpha2[1] == 'U') | ||
525 | return &eu_regdom; | ||
526 | /* Default, as per the old rules */ | ||
527 | return &us_regdom; | ||
528 | } | ||
529 | #endif | ||
530 | |||
412 | static int cfg80211_init(void) | 531 | static int cfg80211_init(void) |
413 | { | 532 | { |
414 | int err = wiphy_sysfs_init(); | 533 | int err; |
534 | |||
535 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
536 | cfg80211_regdomain = | ||
537 | (struct ieee80211_regdomain *) static_regdom(ieee80211_regdom); | ||
538 | /* Used during reset_regdomains_static() */ | ||
539 | cfg80211_world_regdom = cfg80211_regdomain; | ||
540 | #else | ||
541 | cfg80211_regdomain = | ||
542 | (struct ieee80211_regdomain *) cfg80211_world_regdom; | ||
543 | #endif | ||
544 | |||
545 | err = wiphy_sysfs_init(); | ||
415 | if (err) | 546 | if (err) |
416 | goto out_fail_sysfs; | 547 | goto out_fail_sysfs; |
417 | 548 | ||
@@ -425,8 +556,33 @@ static int cfg80211_init(void) | |||
425 | 556 | ||
426 | ieee80211_debugfs_dir = debugfs_create_dir("ieee80211", NULL); | 557 | ieee80211_debugfs_dir = debugfs_create_dir("ieee80211", NULL); |
427 | 558 | ||
559 | err = regulatory_init(); | ||
560 | if (err) | ||
561 | goto out_fail_reg; | ||
562 | |||
563 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
564 | printk(KERN_INFO "cfg80211: Using old static regulatory domain:\n"); | ||
565 | print_regdomain_info(cfg80211_regdomain); | ||
566 | /* The old code still requests for a new regdomain and if | ||
567 | * you have CRDA you get it updated, otherwise you get | ||
568 | * stuck with the static values. We ignore "EU" code as | ||
569 | * that is not a valid ISO / IEC 3166 alpha2 */ | ||
570 | if (ieee80211_regdom[0] != 'E' && | ||
571 | ieee80211_regdom[1] != 'U') | ||
572 | err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, | ||
573 | ieee80211_regdom, NULL); | ||
574 | #else | ||
575 | err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, "00", NULL); | ||
576 | if (err) | ||
577 | printk(KERN_ERR "cfg80211: calling CRDA failed - " | ||
578 | "unable to update world regulatory domain, " | ||
579 | "using static definition\n"); | ||
580 | #endif | ||
581 | |||
428 | return 0; | 582 | return 0; |
429 | 583 | ||
584 | out_fail_reg: | ||
585 | debugfs_remove(ieee80211_debugfs_dir); | ||
430 | out_fail_nl80211: | 586 | out_fail_nl80211: |
431 | unregister_netdevice_notifier(&cfg80211_netdev_notifier); | 587 | unregister_netdevice_notifier(&cfg80211_netdev_notifier); |
432 | out_fail_notifier: | 588 | out_fail_notifier: |
@@ -434,6 +590,7 @@ out_fail_notifier: | |||
434 | out_fail_sysfs: | 590 | out_fail_sysfs: |
435 | return err; | 591 | return err; |
436 | } | 592 | } |
593 | |||
437 | subsys_initcall(cfg80211_init); | 594 | subsys_initcall(cfg80211_init); |
438 | 595 | ||
439 | static void cfg80211_exit(void) | 596 | static void cfg80211_exit(void) |
@@ -442,5 +599,6 @@ static void cfg80211_exit(void) | |||
442 | nl80211_exit(); | 599 | nl80211_exit(); |
443 | unregister_netdevice_notifier(&cfg80211_netdev_notifier); | 600 | unregister_netdevice_notifier(&cfg80211_netdev_notifier); |
444 | wiphy_sysfs_exit(); | 601 | wiphy_sysfs_exit(); |
602 | regulatory_exit(); | ||
445 | } | 603 | } |
446 | module_exit(cfg80211_exit); | 604 | module_exit(cfg80211_exit); |
diff --git a/net/wireless/core.h b/net/wireless/core.h index 7a02c356d63d..771cc5cc7658 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -79,6 +79,6 @@ extern int cfg80211_dev_rename(struct cfg80211_registered_device *drv, | |||
79 | char *newname); | 79 | char *newname); |
80 | 80 | ||
81 | void ieee80211_set_bitrate_flags(struct wiphy *wiphy); | 81 | void ieee80211_set_bitrate_flags(struct wiphy *wiphy); |
82 | void wiphy_update_regulatory(struct wiphy *wiphy); | 82 | void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby); |
83 | 83 | ||
84 | #endif /* __NET_WIRELESS_CORE_H */ | 84 | #endif /* __NET_WIRELESS_CORE_H */ |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 77880ba8b619..1221d726ed50 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <net/cfg80211.h> | 18 | #include <net/cfg80211.h> |
19 | #include "core.h" | 19 | #include "core.h" |
20 | #include "nl80211.h" | 20 | #include "nl80211.h" |
21 | #include "reg.h" | ||
21 | 22 | ||
22 | /* the netlink family */ | 23 | /* the netlink family */ |
23 | static struct genl_family nl80211_fam = { | 24 | static struct genl_family nl80211_fam = { |
@@ -88,6 +89,9 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = { | |||
88 | .len = IEEE80211_MAX_MESH_ID_LEN }, | 89 | .len = IEEE80211_MAX_MESH_ID_LEN }, |
89 | [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, | 90 | [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, |
90 | 91 | ||
92 | [NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 }, | ||
93 | [NL80211_ATTR_REG_RULES] = { .type = NLA_NESTED }, | ||
94 | |||
91 | [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, | 95 | [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, |
92 | [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, | 96 | [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, |
93 | [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, | 97 | [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, |
@@ -1599,6 +1603,141 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) | |||
1599 | return err; | 1603 | return err; |
1600 | } | 1604 | } |
1601 | 1605 | ||
1606 | static const struct nla_policy | ||
1607 | reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = { | ||
1608 | [NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 }, | ||
1609 | [NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 }, | ||
1610 | [NL80211_ATTR_FREQ_RANGE_END] = { .type = NLA_U32 }, | ||
1611 | [NL80211_ATTR_FREQ_RANGE_MAX_BW] = { .type = NLA_U32 }, | ||
1612 | [NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN] = { .type = NLA_U32 }, | ||
1613 | [NL80211_ATTR_POWER_RULE_MAX_EIRP] = { .type = NLA_U32 }, | ||
1614 | }; | ||
1615 | |||
1616 | static int parse_reg_rule(struct nlattr *tb[], | ||
1617 | struct ieee80211_reg_rule *reg_rule) | ||
1618 | { | ||
1619 | struct ieee80211_freq_range *freq_range = ®_rule->freq_range; | ||
1620 | struct ieee80211_power_rule *power_rule = ®_rule->power_rule; | ||
1621 | |||
1622 | if (!tb[NL80211_ATTR_REG_RULE_FLAGS]) | ||
1623 | return -EINVAL; | ||
1624 | if (!tb[NL80211_ATTR_FREQ_RANGE_START]) | ||
1625 | return -EINVAL; | ||
1626 | if (!tb[NL80211_ATTR_FREQ_RANGE_END]) | ||
1627 | return -EINVAL; | ||
1628 | if (!tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]) | ||
1629 | return -EINVAL; | ||
1630 | if (!tb[NL80211_ATTR_POWER_RULE_MAX_EIRP]) | ||
1631 | return -EINVAL; | ||
1632 | |||
1633 | reg_rule->flags = nla_get_u32(tb[NL80211_ATTR_REG_RULE_FLAGS]); | ||
1634 | |||
1635 | freq_range->start_freq_khz = | ||
1636 | nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_START]); | ||
1637 | freq_range->end_freq_khz = | ||
1638 | nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]); | ||
1639 | freq_range->max_bandwidth_khz = | ||
1640 | nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]); | ||
1641 | |||
1642 | power_rule->max_eirp = | ||
1643 | nla_get_u32(tb[NL80211_ATTR_POWER_RULE_MAX_EIRP]); | ||
1644 | |||
1645 | if (tb[NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN]) | ||
1646 | power_rule->max_antenna_gain = | ||
1647 | nla_get_u32(tb[NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN]); | ||
1648 | |||
1649 | return 0; | ||
1650 | } | ||
1651 | |||
1652 | static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) | ||
1653 | { | ||
1654 | int r; | ||
1655 | char *data = NULL; | ||
1656 | |||
1657 | if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) | ||
1658 | return -EINVAL; | ||
1659 | |||
1660 | data = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]); | ||
1661 | |||
1662 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
1663 | /* We ignore world regdom requests with the old regdom setup */ | ||
1664 | if (is_world_regdom(data)) | ||
1665 | return -EINVAL; | ||
1666 | #endif | ||
1667 | mutex_lock(&cfg80211_drv_mutex); | ||
1668 | r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data, NULL); | ||
1669 | mutex_unlock(&cfg80211_drv_mutex); | ||
1670 | return r; | ||
1671 | } | ||
1672 | |||
1673 | static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) | ||
1674 | { | ||
1675 | struct nlattr *tb[NL80211_REG_RULE_ATTR_MAX + 1]; | ||
1676 | struct nlattr *nl_reg_rule; | ||
1677 | char *alpha2 = NULL; | ||
1678 | int rem_reg_rules = 0, r = 0; | ||
1679 | u32 num_rules = 0, rule_idx = 0, size_of_regd; | ||
1680 | struct ieee80211_regdomain *rd = NULL; | ||
1681 | |||
1682 | if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) | ||
1683 | return -EINVAL; | ||
1684 | |||
1685 | if (!info->attrs[NL80211_ATTR_REG_RULES]) | ||
1686 | return -EINVAL; | ||
1687 | |||
1688 | alpha2 = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]); | ||
1689 | |||
1690 | nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], | ||
1691 | rem_reg_rules) { | ||
1692 | num_rules++; | ||
1693 | if (num_rules > NL80211_MAX_SUPP_REG_RULES) | ||
1694 | goto bad_reg; | ||
1695 | } | ||
1696 | |||
1697 | if (!reg_is_valid_request(alpha2)) | ||
1698 | return -EINVAL; | ||
1699 | |||
1700 | size_of_regd = sizeof(struct ieee80211_regdomain) + | ||
1701 | (num_rules * sizeof(struct ieee80211_reg_rule)); | ||
1702 | |||
1703 | rd = kzalloc(size_of_regd, GFP_KERNEL); | ||
1704 | if (!rd) | ||
1705 | return -ENOMEM; | ||
1706 | |||
1707 | rd->n_reg_rules = num_rules; | ||
1708 | rd->alpha2[0] = alpha2[0]; | ||
1709 | rd->alpha2[1] = alpha2[1]; | ||
1710 | |||
1711 | nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], | ||
1712 | rem_reg_rules) { | ||
1713 | nla_parse(tb, NL80211_REG_RULE_ATTR_MAX, | ||
1714 | nla_data(nl_reg_rule), nla_len(nl_reg_rule), | ||
1715 | reg_rule_policy); | ||
1716 | r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]); | ||
1717 | if (r) | ||
1718 | goto bad_reg; | ||
1719 | |||
1720 | rule_idx++; | ||
1721 | |||
1722 | if (rule_idx > NL80211_MAX_SUPP_REG_RULES) | ||
1723 | goto bad_reg; | ||
1724 | } | ||
1725 | |||
1726 | BUG_ON(rule_idx != num_rules); | ||
1727 | |||
1728 | mutex_lock(&cfg80211_drv_mutex); | ||
1729 | r = set_regdom(rd); | ||
1730 | mutex_unlock(&cfg80211_drv_mutex); | ||
1731 | if (r) | ||
1732 | goto bad_reg; | ||
1733 | |||
1734 | return r; | ||
1735 | |||
1736 | bad_reg: | ||
1737 | kfree(rd); | ||
1738 | return -EINVAL; | ||
1739 | } | ||
1740 | |||
1602 | static struct genl_ops nl80211_ops[] = { | 1741 | static struct genl_ops nl80211_ops[] = { |
1603 | { | 1742 | { |
1604 | .cmd = NL80211_CMD_GET_WIPHY, | 1743 | .cmd = NL80211_CMD_GET_WIPHY, |
@@ -1736,6 +1875,18 @@ static struct genl_ops nl80211_ops[] = { | |||
1736 | .policy = nl80211_policy, | 1875 | .policy = nl80211_policy, |
1737 | .flags = GENL_ADMIN_PERM, | 1876 | .flags = GENL_ADMIN_PERM, |
1738 | }, | 1877 | }, |
1878 | { | ||
1879 | .cmd = NL80211_CMD_SET_REG, | ||
1880 | .doit = nl80211_set_reg, | ||
1881 | .policy = nl80211_policy, | ||
1882 | .flags = GENL_ADMIN_PERM, | ||
1883 | }, | ||
1884 | { | ||
1885 | .cmd = NL80211_CMD_REQ_SET_REG, | ||
1886 | .doit = nl80211_req_set_reg, | ||
1887 | .policy = nl80211_policy, | ||
1888 | .flags = GENL_ADMIN_PERM, | ||
1889 | }, | ||
1739 | }; | 1890 | }; |
1740 | 1891 | ||
1741 | /* multicast groups */ | 1892 | /* multicast groups */ |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 855bff4b3250..592b2e391d42 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -2,179 +2,758 @@ | |||
2 | * Copyright 2002-2005, Instant802 Networks, Inc. | 2 | * Copyright 2002-2005, Instant802 Networks, Inc. |
3 | * Copyright 2005-2006, Devicescape Software, Inc. | 3 | * Copyright 2005-2006, Devicescape Software, Inc. |
4 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | 4 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> |
5 | * Copyright 2008 Luis R. Rodriguez <lrodriguz@atheros.com> | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
9 | */ | 10 | */ |
10 | 11 | ||
11 | /* | 12 | /** |
12 | * This regulatory domain control implementation is highly incomplete, it | 13 | * DOC: Wireless regulatory infrastructure |
13 | * only exists for the purpose of not regressing mac80211. | ||
14 | * | ||
15 | * For now, drivers can restrict the set of allowed channels by either | ||
16 | * not registering those channels or setting the IEEE80211_CHAN_DISABLED | ||
17 | * flag; that flag will only be *set* by this code, never *cleared. | ||
18 | * | 14 | * |
19 | * The usual implementation is for a driver to read a device EEPROM to | 15 | * The usual implementation is for a driver to read a device EEPROM to |
20 | * determine which regulatory domain it should be operating under, then | 16 | * determine which regulatory domain it should be operating under, then |
21 | * looking up the allowable channels in a driver-local table and finally | 17 | * looking up the allowable channels in a driver-local table and finally |
22 | * registering those channels in the wiphy structure. | 18 | * registering those channels in the wiphy structure. |
23 | * | 19 | * |
24 | * Alternatively, drivers that trust the regulatory domain control here | 20 | * Another set of compliance enforcement is for drivers to use their |
25 | * will register a complete set of capabilities and the control code | 21 | * own compliance limits which can be stored on the EEPROM. The host |
26 | * will restrict the set by setting the IEEE80211_CHAN_* flags. | 22 | * driver or firmware may ensure these are used. |
23 | * | ||
24 | * In addition to all this we provide an extra layer of regulatory | ||
25 | * conformance. For drivers which do not have any regulatory | ||
26 | * information CRDA provides the complete regulatory solution. | ||
27 | * For others it provides a community effort on further restrictions | ||
28 | * to enhance compliance. | ||
29 | * | ||
30 | * Note: When number of rules --> infinity we will not be able to | ||
31 | * index on alpha2 any more, instead we'll probably have to | ||
32 | * rely on some SHA1 checksum of the regdomain for example. | ||
33 | * | ||
27 | */ | 34 | */ |
28 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
36 | #include <linux/list.h> | ||
37 | #include <linux/random.h> | ||
38 | #include <linux/nl80211.h> | ||
39 | #include <linux/platform_device.h> | ||
29 | #include <net/wireless.h> | 40 | #include <net/wireless.h> |
41 | #include <net/cfg80211.h> | ||
30 | #include "core.h" | 42 | #include "core.h" |
43 | #include "reg.h" | ||
31 | 44 | ||
32 | static char *ieee80211_regdom = "US"; | 45 | /* To trigger userspace events */ |
33 | module_param(ieee80211_regdom, charp, 0444); | 46 | static struct platform_device *reg_pdev; |
34 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); | ||
35 | 47 | ||
36 | struct ieee80211_channel_range { | 48 | /* Keep the ordering from large to small */ |
37 | short start_freq; | 49 | static u32 supported_bandwidths[] = { |
38 | short end_freq; | 50 | MHZ_TO_KHZ(40), |
39 | int max_power; | 51 | MHZ_TO_KHZ(20), |
40 | int max_antenna_gain; | ||
41 | u32 flags; | ||
42 | }; | 52 | }; |
43 | 53 | ||
44 | struct ieee80211_regdomain { | 54 | bool is_world_regdom(char *alpha2) |
45 | const char *code; | 55 | { |
46 | const struct ieee80211_channel_range *ranges; | 56 | if (!alpha2) |
47 | int n_ranges; | 57 | return false; |
48 | }; | 58 | if (alpha2[0] == '0' && alpha2[1] == '0') |
59 | return true; | ||
60 | return false; | ||
61 | } | ||
49 | 62 | ||
50 | #define RANGE_PWR(_start, _end, _pwr, _ag, _flags) \ | 63 | static bool is_alpha2_set(char *alpha2) |
51 | { _start, _end, _pwr, _ag, _flags } | 64 | { |
65 | if (!alpha2) | ||
66 | return false; | ||
67 | if (alpha2[0] != 0 && alpha2[1] != 0) | ||
68 | return true; | ||
69 | return false; | ||
70 | } | ||
52 | 71 | ||
72 | static bool is_alpha_upper(char letter) | ||
73 | { | ||
74 | /* ASCII A - Z */ | ||
75 | if (letter >= 65 && letter <= 90) | ||
76 | return true; | ||
77 | return false; | ||
78 | } | ||
53 | 79 | ||
54 | /* | 80 | static bool is_unknown_alpha2(char *alpha2) |
55 | * Ideally, in the future, these definitions will be loaded from a | 81 | { |
56 | * userspace table via some daemon. | 82 | if (!alpha2) |
57 | */ | 83 | return false; |
58 | static const struct ieee80211_channel_range ieee80211_US_channels[] = { | 84 | /* Special case where regulatory domain was built by driver |
59 | /* IEEE 802.11b/g, channels 1..11 */ | 85 | * but a specific alpha2 cannot be determined */ |
60 | RANGE_PWR(2412, 2462, 27, 6, 0), | 86 | if (alpha2[0] == '9' && alpha2[1] == '9') |
61 | /* IEEE 802.11a, channel 36*/ | 87 | return true; |
62 | RANGE_PWR(5180, 5180, 23, 6, 0), | 88 | return false; |
63 | /* IEEE 802.11a, channel 40*/ | 89 | } |
64 | RANGE_PWR(5200, 5200, 23, 6, 0), | ||
65 | /* IEEE 802.11a, channel 44*/ | ||
66 | RANGE_PWR(5220, 5220, 23, 6, 0), | ||
67 | /* IEEE 802.11a, channels 48..64 */ | ||
68 | RANGE_PWR(5240, 5320, 23, 6, 0), | ||
69 | /* IEEE 802.11a, channels 149..165, outdoor */ | ||
70 | RANGE_PWR(5745, 5825, 30, 6, 0), | ||
71 | }; | ||
72 | 90 | ||
73 | static const struct ieee80211_channel_range ieee80211_JP_channels[] = { | 91 | static bool is_an_alpha2(char *alpha2) |
74 | /* IEEE 802.11b/g, channels 1..14 */ | 92 | { |
75 | RANGE_PWR(2412, 2484, 20, 6, 0), | 93 | if (!alpha2) |
76 | /* IEEE 802.11a, channels 34..48 */ | 94 | return false; |
77 | RANGE_PWR(5170, 5240, 20, 6, IEEE80211_CHAN_PASSIVE_SCAN), | 95 | if (is_alpha_upper(alpha2[0]) && is_alpha_upper(alpha2[1])) |
78 | /* IEEE 802.11a, channels 52..64 */ | 96 | return true; |
79 | RANGE_PWR(5260, 5320, 20, 6, IEEE80211_CHAN_NO_IBSS | | 97 | return false; |
80 | IEEE80211_CHAN_RADAR), | 98 | } |
81 | }; | ||
82 | 99 | ||
83 | static const struct ieee80211_channel_range ieee80211_EU_channels[] = { | 100 | static bool alpha2_equal(char *alpha2_x, char *alpha2_y) |
84 | /* IEEE 802.11b/g, channels 1..13 */ | 101 | { |
85 | RANGE_PWR(2412, 2472, 20, 6, 0), | 102 | if (!alpha2_x || !alpha2_y) |
86 | /* IEEE 802.11a, channel 36*/ | 103 | return false; |
87 | RANGE_PWR(5180, 5180, 23, 6, IEEE80211_CHAN_PASSIVE_SCAN), | 104 | if (alpha2_x[0] == alpha2_y[0] && |
88 | /* IEEE 802.11a, channel 40*/ | 105 | alpha2_x[1] == alpha2_y[1]) |
89 | RANGE_PWR(5200, 5200, 23, 6, IEEE80211_CHAN_PASSIVE_SCAN), | 106 | return true; |
90 | /* IEEE 802.11a, channel 44*/ | 107 | return false; |
91 | RANGE_PWR(5220, 5220, 23, 6, IEEE80211_CHAN_PASSIVE_SCAN), | 108 | } |
92 | /* IEEE 802.11a, channels 48..64 */ | 109 | |
93 | RANGE_PWR(5240, 5320, 23, 6, IEEE80211_CHAN_NO_IBSS | | 110 | static bool regdom_changed(char *alpha2) |
94 | IEEE80211_CHAN_RADAR), | 111 | { |
95 | /* IEEE 802.11a, channels 100..140 */ | 112 | if (!cfg80211_regdomain) |
96 | RANGE_PWR(5500, 5700, 30, 6, IEEE80211_CHAN_NO_IBSS | | 113 | return true; |
97 | IEEE80211_CHAN_RADAR), | 114 | if (alpha2_equal(cfg80211_regdomain->alpha2, alpha2)) |
98 | }; | 115 | return false; |
116 | return true; | ||
117 | } | ||
118 | |||
119 | /* This lets us keep regulatory code which is updated on a regulatory | ||
120 | * basis in userspace. */ | ||
121 | static int call_crda(const char *alpha2) | ||
122 | { | ||
123 | char country_env[9 + 2] = "COUNTRY="; | ||
124 | char *envp[] = { | ||
125 | country_env, | ||
126 | NULL | ||
127 | }; | ||
128 | |||
129 | if (!is_world_regdom((char *) alpha2)) | ||
130 | printk(KERN_INFO "cfg80211: Calling CRDA for country: %c%c\n", | ||
131 | alpha2[0], alpha2[1]); | ||
132 | else | ||
133 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
134 | return -EINVAL; | ||
135 | #else | ||
136 | printk(KERN_INFO "cfg80211: Calling CRDA to update world " | ||
137 | "regulatory domain\n"); | ||
138 | #endif | ||
139 | |||
140 | country_env[8] = alpha2[0]; | ||
141 | country_env[9] = alpha2[1]; | ||
142 | |||
143 | return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, envp); | ||
144 | } | ||
145 | |||
146 | /* This has the logic which determines when a new request | ||
147 | * should be ignored. */ | ||
148 | static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by, | ||
149 | char *alpha2, struct ieee80211_regdomain *rd) | ||
150 | { | ||
151 | struct regulatory_request *last_request = NULL; | ||
99 | 152 | ||
100 | #define REGDOM(_code) \ | 153 | /* All initial requests are respected */ |
101 | { \ | 154 | if (list_empty(®ulatory_requests)) |
102 | .code = __stringify(_code), \ | 155 | return 0; |
103 | .ranges = ieee80211_ ##_code## _channels, \ | 156 | |
104 | .n_ranges = ARRAY_SIZE(ieee80211_ ##_code## _channels), \ | 157 | last_request = list_first_entry(®ulatory_requests, |
158 | struct regulatory_request, list); | ||
159 | |||
160 | switch (set_by) { | ||
161 | case REGDOM_SET_BY_INIT: | ||
162 | return -EINVAL; | ||
163 | case REGDOM_SET_BY_CORE: | ||
164 | /* Always respect new wireless core hints, should only | ||
165 | * come in for updating the world regulatory domain at init | ||
166 | * anyway */ | ||
167 | return 0; | ||
168 | case REGDOM_SET_BY_COUNTRY_IE: | ||
169 | if (last_request->initiator == set_by) { | ||
170 | if (last_request->wiphy != wiphy) { | ||
171 | /* Two cards with two APs claiming different | ||
172 | * different Country IE alpha2s! | ||
173 | * You're special!! */ | ||
174 | if (!alpha2_equal(last_request->alpha2, | ||
175 | cfg80211_regdomain->alpha2)) { | ||
176 | /* XXX: Deal with conflict, consider | ||
177 | * building a new one out of the | ||
178 | * intersection */ | ||
179 | WARN_ON(1); | ||
180 | return -EOPNOTSUPP; | ||
181 | } | ||
182 | return -EALREADY; | ||
183 | } | ||
184 | /* Two consecutive Country IE hints on the same wiphy */ | ||
185 | if (!alpha2_equal(cfg80211_regdomain->alpha2, alpha2)) | ||
186 | return 0; | ||
187 | return -EALREADY; | ||
188 | } | ||
189 | if (WARN_ON(!is_alpha2_set(alpha2) || !is_an_alpha2(alpha2)), | ||
190 | "Invalid Country IE regulatory hint passed " | ||
191 | "to the wireless core\n") | ||
192 | return -EINVAL; | ||
193 | /* We ignore Country IE hints for now, as we haven't yet | ||
194 | * added the dot11MultiDomainCapabilityEnabled flag | ||
195 | * for wiphys */ | ||
196 | return 1; | ||
197 | case REGDOM_SET_BY_DRIVER: | ||
198 | BUG_ON(!wiphy); | ||
199 | if (last_request->initiator == set_by) { | ||
200 | /* Two separate drivers hinting different things, | ||
201 | * this is possible if you have two devices present | ||
202 | * on a system with different EEPROM regulatory | ||
203 | * readings. XXX: Do intersection, we support only | ||
204 | * the first regulatory hint for now */ | ||
205 | if (last_request->wiphy != wiphy) | ||
206 | return -EALREADY; | ||
207 | if (rd) | ||
208 | return -EALREADY; | ||
209 | /* Driver should not be trying to hint different | ||
210 | * regulatory domains! */ | ||
211 | BUG_ON(!alpha2_equal(alpha2, | ||
212 | cfg80211_regdomain->alpha2)); | ||
213 | return -EALREADY; | ||
214 | } | ||
215 | if (last_request->initiator == REGDOM_SET_BY_CORE) | ||
216 | return 0; | ||
217 | /* XXX: Handle intersection, and add the | ||
218 | * dot11MultiDomainCapabilityEnabled flag to wiphy. For now | ||
219 | * we assume the driver has this set to false, following the | ||
220 | * 802.11d dot11MultiDomainCapabilityEnabled documentation */ | ||
221 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) | ||
222 | return 0; | ||
223 | return 0; | ||
224 | case REGDOM_SET_BY_USER: | ||
225 | if (last_request->initiator == set_by || | ||
226 | last_request->initiator == REGDOM_SET_BY_CORE) | ||
227 | return 0; | ||
228 | /* Drivers can use their wiphy's reg_notifier() | ||
229 | * to override any information */ | ||
230 | if (last_request->initiator == REGDOM_SET_BY_DRIVER) | ||
231 | return 0; | ||
232 | /* XXX: Handle intersection */ | ||
233 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) | ||
234 | return -EOPNOTSUPP; | ||
235 | return 0; | ||
236 | default: | ||
237 | return -EINVAL; | ||
105 | } | 238 | } |
239 | } | ||
106 | 240 | ||
107 | static const struct ieee80211_regdomain ieee80211_regdoms[] = { | 241 | static bool __reg_is_valid_request(char *alpha2, |
108 | REGDOM(US), | 242 | struct regulatory_request **request) |
109 | REGDOM(JP), | 243 | { |
110 | REGDOM(EU), | 244 | struct regulatory_request *req; |
111 | }; | 245 | if (list_empty(®ulatory_requests)) |
246 | return false; | ||
247 | list_for_each_entry(req, ®ulatory_requests, list) { | ||
248 | if (alpha2_equal(req->alpha2, alpha2)) { | ||
249 | *request = req; | ||
250 | return true; | ||
251 | } | ||
252 | } | ||
253 | return false; | ||
254 | } | ||
112 | 255 | ||
256 | /* Used by nl80211 before kmalloc'ing our regulatory domain */ | ||
257 | bool reg_is_valid_request(char *alpha2) | ||
258 | { | ||
259 | struct regulatory_request *request = NULL; | ||
260 | return __reg_is_valid_request(alpha2, &request); | ||
261 | } | ||
113 | 262 | ||
114 | static const struct ieee80211_regdomain *get_regdom(void) | 263 | /* Sanity check on a regulatory rule */ |
264 | static bool is_valid_reg_rule(struct ieee80211_reg_rule *rule) | ||
115 | { | 265 | { |
116 | static const struct ieee80211_channel_range | 266 | struct ieee80211_freq_range *freq_range = &rule->freq_range; |
117 | ieee80211_world_channels[] = { | 267 | u32 freq_diff; |
118 | /* IEEE 802.11b/g, channels 1..11 */ | 268 | |
119 | RANGE_PWR(2412, 2462, 27, 6, 0), | 269 | if (freq_range->start_freq_khz == 0 || freq_range->end_freq_khz == 0) |
120 | }; | 270 | return false; |
121 | static const struct ieee80211_regdomain regdom_world = REGDOM(world); | 271 | |
122 | int i; | 272 | if (freq_range->start_freq_khz > freq_range->end_freq_khz) |
273 | return false; | ||
274 | |||
275 | freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; | ||
276 | |||
277 | if (freq_range->max_bandwidth_khz > freq_diff) | ||
278 | return false; | ||
279 | |||
280 | return true; | ||
281 | } | ||
282 | |||
283 | static bool is_valid_rd(struct ieee80211_regdomain *rd) | ||
284 | { | ||
285 | struct ieee80211_reg_rule *reg_rule = NULL; | ||
286 | unsigned int i; | ||
123 | 287 | ||
124 | for (i = 0; i < ARRAY_SIZE(ieee80211_regdoms); i++) | 288 | if (!rd->n_reg_rules) |
125 | if (strcmp(ieee80211_regdom, ieee80211_regdoms[i].code) == 0) | 289 | return false; |
126 | return &ieee80211_regdoms[i]; | ||
127 | 290 | ||
128 | return ®dom_world; | 291 | for (i = 0; i < rd->n_reg_rules; i++) { |
292 | reg_rule = &rd->reg_rules[i]; | ||
293 | if (!is_valid_reg_rule(reg_rule)) | ||
294 | return false; | ||
295 | } | ||
296 | |||
297 | return true; | ||
129 | } | 298 | } |
130 | 299 | ||
300 | /* Returns value in KHz */ | ||
301 | static u32 freq_max_bandwidth(const struct ieee80211_freq_range *freq_range, | ||
302 | u32 freq) | ||
303 | { | ||
304 | unsigned int i; | ||
305 | for (i = 0; i < ARRAY_SIZE(supported_bandwidths); i++) { | ||
306 | u32 start_freq_khz = freq - supported_bandwidths[i]/2; | ||
307 | u32 end_freq_khz = freq + supported_bandwidths[i]/2; | ||
308 | if (start_freq_khz >= freq_range->start_freq_khz && | ||
309 | end_freq_khz <= freq_range->end_freq_khz) | ||
310 | return supported_bandwidths[i]; | ||
311 | } | ||
312 | return 0; | ||
313 | } | ||
131 | 314 | ||
132 | static void handle_channel(struct ieee80211_channel *chan, | 315 | /* XXX: add support for the rest of enum nl80211_reg_rule_flags, we may |
133 | const struct ieee80211_regdomain *rd) | 316 | * want to just have the channel structure use these */ |
317 | static u32 map_regdom_flags(u32 rd_flags) | ||
318 | { | ||
319 | u32 channel_flags = 0; | ||
320 | if (rd_flags & NL80211_RRF_PASSIVE_SCAN) | ||
321 | channel_flags |= IEEE80211_CHAN_PASSIVE_SCAN; | ||
322 | if (rd_flags & NL80211_RRF_NO_IBSS) | ||
323 | channel_flags |= IEEE80211_CHAN_NO_IBSS; | ||
324 | if (rd_flags & NL80211_RRF_DFS) | ||
325 | channel_flags |= IEEE80211_CHAN_RADAR; | ||
326 | return channel_flags; | ||
327 | } | ||
328 | |||
329 | /** | ||
330 | * freq_reg_info - get regulatory information for the given frequency | ||
331 | * @center_freq: Frequency in KHz for which we want regulatory information for | ||
332 | * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one | ||
333 | * you can set this to 0. If this frequency is allowed we then set | ||
334 | * this value to the maximum allowed bandwidth. | ||
335 | * @reg_rule: the regulatory rule which we have for this frequency | ||
336 | * | ||
337 | * Use this function to get the regulatory rule for a specific frequency. | ||
338 | */ | ||
339 | static int freq_reg_info(u32 center_freq, u32 *bandwidth, | ||
340 | const struct ieee80211_reg_rule **reg_rule) | ||
134 | { | 341 | { |
135 | int i; | 342 | int i; |
136 | u32 flags = chan->orig_flags; | 343 | u32 max_bandwidth = 0; |
137 | const struct ieee80211_channel_range *rg = NULL; | ||
138 | 344 | ||
139 | for (i = 0; i < rd->n_ranges; i++) { | 345 | if (!cfg80211_regdomain) |
140 | if (rd->ranges[i].start_freq <= chan->center_freq && | 346 | return -EINVAL; |
141 | chan->center_freq <= rd->ranges[i].end_freq) { | 347 | |
142 | rg = &rd->ranges[i]; | 348 | for (i = 0; i < cfg80211_regdomain->n_reg_rules; i++) { |
349 | const struct ieee80211_reg_rule *rr; | ||
350 | const struct ieee80211_freq_range *fr = NULL; | ||
351 | const struct ieee80211_power_rule *pr = NULL; | ||
352 | |||
353 | rr = &cfg80211_regdomain->reg_rules[i]; | ||
354 | fr = &rr->freq_range; | ||
355 | pr = &rr->power_rule; | ||
356 | max_bandwidth = freq_max_bandwidth(fr, center_freq); | ||
357 | if (max_bandwidth && *bandwidth <= max_bandwidth) { | ||
358 | *reg_rule = rr; | ||
359 | *bandwidth = max_bandwidth; | ||
143 | break; | 360 | break; |
144 | } | 361 | } |
145 | } | 362 | } |
146 | 363 | ||
147 | if (!rg) { | 364 | return !max_bandwidth; |
148 | /* not found */ | 365 | } |
366 | |||
367 | static void handle_channel(struct ieee80211_channel *chan) | ||
368 | { | ||
369 | int r; | ||
370 | u32 flags = chan->orig_flags; | ||
371 | u32 max_bandwidth = 0; | ||
372 | const struct ieee80211_reg_rule *reg_rule = NULL; | ||
373 | const struct ieee80211_power_rule *power_rule = NULL; | ||
374 | |||
375 | r = freq_reg_info(MHZ_TO_KHZ(chan->center_freq), | ||
376 | &max_bandwidth, ®_rule); | ||
377 | |||
378 | if (r) { | ||
149 | flags |= IEEE80211_CHAN_DISABLED; | 379 | flags |= IEEE80211_CHAN_DISABLED; |
150 | chan->flags = flags; | 380 | chan->flags = flags; |
151 | return; | 381 | return; |
152 | } | 382 | } |
153 | 383 | ||
154 | chan->flags = flags; | 384 | power_rule = ®_rule->power_rule; |
385 | |||
386 | chan->flags = flags | map_regdom_flags(reg_rule->flags); | ||
155 | chan->max_antenna_gain = min(chan->orig_mag, | 387 | chan->max_antenna_gain = min(chan->orig_mag, |
156 | rg->max_antenna_gain); | 388 | (int) MBI_TO_DBI(power_rule->max_antenna_gain)); |
389 | chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth); | ||
157 | if (chan->orig_mpwr) | 390 | if (chan->orig_mpwr) |
158 | chan->max_power = min(chan->orig_mpwr, rg->max_power); | 391 | chan->max_power = min(chan->orig_mpwr, |
392 | (int) MBM_TO_DBM(power_rule->max_eirp)); | ||
159 | else | 393 | else |
160 | chan->max_power = rg->max_power; | 394 | chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); |
161 | } | 395 | } |
162 | 396 | ||
163 | static void handle_band(struct ieee80211_supported_band *sband, | 397 | static void handle_band(struct ieee80211_supported_band *sband) |
164 | const struct ieee80211_regdomain *rd) | ||
165 | { | 398 | { |
166 | int i; | 399 | int i; |
167 | 400 | ||
168 | for (i = 0; i < sband->n_channels; i++) | 401 | for (i = 0; i < sband->n_channels; i++) |
169 | handle_channel(&sband->channels[i], rd); | 402 | handle_channel(&sband->channels[i]); |
170 | } | 403 | } |
171 | 404 | ||
172 | void wiphy_update_regulatory(struct wiphy *wiphy) | 405 | static void update_all_wiphy_regulatory(enum reg_set_by setby) |
173 | { | 406 | { |
174 | enum ieee80211_band band; | 407 | struct cfg80211_registered_device *drv; |
175 | const struct ieee80211_regdomain *rd = get_regdom(); | ||
176 | 408 | ||
177 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) | 409 | list_for_each_entry(drv, &cfg80211_drv_list, list) |
410 | wiphy_update_regulatory(&drv->wiphy, setby); | ||
411 | } | ||
412 | |||
413 | void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby) | ||
414 | { | ||
415 | enum ieee80211_band band; | ||
416 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | ||
178 | if (wiphy->bands[band]) | 417 | if (wiphy->bands[band]) |
179 | handle_band(wiphy->bands[band], rd); | 418 | handle_band(wiphy->bands[band]); |
419 | if (wiphy->reg_notifier) | ||
420 | wiphy->reg_notifier(wiphy, setby); | ||
421 | } | ||
422 | } | ||
423 | |||
424 | /* Caller must hold &cfg80211_drv_mutex */ | ||
425 | int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by, | ||
426 | const char *alpha2, struct ieee80211_regdomain *rd) | ||
427 | { | ||
428 | struct regulatory_request *request; | ||
429 | char *rd_alpha2; | ||
430 | int r = 0; | ||
431 | |||
432 | r = ignore_request(wiphy, set_by, (char *) alpha2, rd); | ||
433 | if (r) | ||
434 | return r; | ||
435 | |||
436 | if (rd) | ||
437 | rd_alpha2 = rd->alpha2; | ||
438 | else | ||
439 | rd_alpha2 = (char *) alpha2; | ||
440 | |||
441 | switch (set_by) { | ||
442 | case REGDOM_SET_BY_CORE: | ||
443 | case REGDOM_SET_BY_COUNTRY_IE: | ||
444 | case REGDOM_SET_BY_DRIVER: | ||
445 | case REGDOM_SET_BY_USER: | ||
446 | request = kzalloc(sizeof(struct regulatory_request), | ||
447 | GFP_KERNEL); | ||
448 | if (!request) | ||
449 | return -ENOMEM; | ||
450 | |||
451 | request->alpha2[0] = rd_alpha2[0]; | ||
452 | request->alpha2[1] = rd_alpha2[1]; | ||
453 | request->initiator = set_by; | ||
454 | request->wiphy = wiphy; | ||
455 | |||
456 | list_add_tail(&request->list, ®ulatory_requests); | ||
457 | if (rd) | ||
458 | break; | ||
459 | r = call_crda(alpha2); | ||
460 | #ifndef CONFIG_WIRELESS_OLD_REGULATORY | ||
461 | if (r) | ||
462 | printk(KERN_ERR "cfg80211: Failed calling CRDA\n"); | ||
463 | #endif | ||
464 | break; | ||
465 | default: | ||
466 | r = -ENOTSUPP; | ||
467 | break; | ||
468 | } | ||
469 | |||
470 | return r; | ||
471 | } | ||
472 | |||
473 | /* If rd is not NULL and if this call fails the caller must free it */ | ||
474 | int regulatory_hint(struct wiphy *wiphy, const char *alpha2, | ||
475 | struct ieee80211_regdomain *rd) | ||
476 | { | ||
477 | int r; | ||
478 | BUG_ON(!rd && !alpha2); | ||
479 | |||
480 | mutex_lock(&cfg80211_drv_mutex); | ||
481 | |||
482 | r = __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2, rd); | ||
483 | if (r || !rd) | ||
484 | goto unlock_and_exit; | ||
485 | |||
486 | /* If the driver passed a regulatory domain we skipped asking | ||
487 | * userspace for one so we can now go ahead and set it */ | ||
488 | r = set_regdom(rd); | ||
489 | |||
490 | unlock_and_exit: | ||
491 | mutex_unlock(&cfg80211_drv_mutex); | ||
492 | return r; | ||
493 | } | ||
494 | EXPORT_SYMBOL(regulatory_hint); | ||
495 | |||
496 | |||
497 | static void print_rd_rules(struct ieee80211_regdomain *rd) | ||
498 | { | ||
499 | unsigned int i; | ||
500 | struct ieee80211_reg_rule *reg_rule = NULL; | ||
501 | struct ieee80211_freq_range *freq_range = NULL; | ||
502 | struct ieee80211_power_rule *power_rule = NULL; | ||
503 | |||
504 | printk(KERN_INFO "\t(start_freq - end_freq @ bandwidth), " | ||
505 | "(max_antenna_gain, max_eirp)\n"); | ||
506 | |||
507 | for (i = 0; i < rd->n_reg_rules; i++) { | ||
508 | reg_rule = &rd->reg_rules[i]; | ||
509 | freq_range = ®_rule->freq_range; | ||
510 | power_rule = ®_rule->power_rule; | ||
511 | |||
512 | /* There may not be documentation for max antenna gain | ||
513 | * in certain regions */ | ||
514 | if (power_rule->max_antenna_gain) | ||
515 | printk(KERN_INFO "\t(%d KHz - %d KHz @ %d KHz), " | ||
516 | "(%d mBi, %d mBm)\n", | ||
517 | freq_range->start_freq_khz, | ||
518 | freq_range->end_freq_khz, | ||
519 | freq_range->max_bandwidth_khz, | ||
520 | power_rule->max_antenna_gain, | ||
521 | power_rule->max_eirp); | ||
522 | else | ||
523 | printk(KERN_INFO "\t(%d KHz - %d KHz @ %d KHz), " | ||
524 | "(N/A, %d mBm)\n", | ||
525 | freq_range->start_freq_khz, | ||
526 | freq_range->end_freq_khz, | ||
527 | freq_range->max_bandwidth_khz, | ||
528 | power_rule->max_eirp); | ||
529 | } | ||
530 | } | ||
531 | |||
532 | static void print_regdomain(struct ieee80211_regdomain *rd) | ||
533 | { | ||
534 | |||
535 | if (is_world_regdom(rd->alpha2)) | ||
536 | printk(KERN_INFO "cfg80211: World regulatory " | ||
537 | "domain updated:\n"); | ||
538 | else { | ||
539 | if (is_unknown_alpha2(rd->alpha2)) | ||
540 | printk(KERN_INFO "cfg80211: Regulatory domain " | ||
541 | "changed to driver built-in settings " | ||
542 | "(unknown country)\n"); | ||
543 | else | ||
544 | printk(KERN_INFO "cfg80211: Regulatory domain " | ||
545 | "changed to country: %c%c\n", | ||
546 | rd->alpha2[0], rd->alpha2[1]); | ||
547 | } | ||
548 | print_rd_rules(rd); | ||
549 | } | ||
550 | |||
551 | void print_regdomain_info(struct ieee80211_regdomain *rd) | ||
552 | { | ||
553 | printk(KERN_INFO "cfg80211: Regulatory domain: %c%c\n", | ||
554 | rd->alpha2[0], rd->alpha2[1]); | ||
555 | print_rd_rules(rd); | ||
556 | } | ||
557 | |||
558 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
559 | |||
560 | static bool is_old_static_regdom(struct ieee80211_regdomain *rd) | ||
561 | { | ||
562 | if (rd == &us_regdom || rd == &jp_regdom || rd == &eu_regdom) | ||
563 | return true; | ||
564 | return false; | ||
565 | } | ||
566 | |||
567 | /* The old crap never deals with a world regulatory domain, it only | ||
568 | * deals with the static regulatory domain passed and if possible | ||
569 | * an updated "US" or "JP" regulatory domain. We do however store the | ||
570 | * old static regulatory domain in cfg80211_world_regdom for convenience | ||
571 | * of use here */ | ||
572 | static void reset_regdomains_static(void) | ||
573 | { | ||
574 | if (!is_old_static_regdom(cfg80211_regdomain)) | ||
575 | kfree(cfg80211_regdomain); | ||
576 | /* This is setting the regdom to the old static regdom */ | ||
577 | cfg80211_regdomain = | ||
578 | (struct ieee80211_regdomain *) cfg80211_world_regdom; | ||
579 | } | ||
580 | #else | ||
581 | static void reset_regdomains(void) | ||
582 | { | ||
583 | if (cfg80211_world_regdom && cfg80211_world_regdom != &world_regdom) { | ||
584 | if (cfg80211_world_regdom == cfg80211_regdomain) { | ||
585 | kfree(cfg80211_regdomain); | ||
586 | } else { | ||
587 | kfree(cfg80211_world_regdom); | ||
588 | kfree(cfg80211_regdomain); | ||
589 | } | ||
590 | } else if (cfg80211_regdomain && cfg80211_regdomain != &world_regdom) | ||
591 | kfree(cfg80211_regdomain); | ||
592 | |||
593 | cfg80211_world_regdom = (struct ieee80211_regdomain *) &world_regdom; | ||
594 | cfg80211_regdomain = NULL; | ||
595 | } | ||
596 | |||
597 | /* Dynamic world regulatory domain requested by the wireless | ||
598 | * core upon initialization */ | ||
599 | static void update_world_regdomain(struct ieee80211_regdomain *rd) | ||
600 | { | ||
601 | BUG_ON(list_empty(®ulatory_requests)); | ||
602 | |||
603 | reset_regdomains(); | ||
604 | |||
605 | cfg80211_world_regdom = rd; | ||
606 | cfg80211_regdomain = rd; | ||
607 | } | ||
608 | #endif | ||
609 | |||
610 | static int __set_regdom(struct ieee80211_regdomain *rd) | ||
611 | { | ||
612 | struct regulatory_request *request = NULL; | ||
613 | |||
614 | /* Some basic sanity checks first */ | ||
615 | |||
616 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
617 | /* We ignore the world regdom with the old static regdomains setup | ||
618 | * as there is no point to it with satic regulatory definitions :( | ||
619 | * Don't worry this shit will be removed soon... */ | ||
620 | if (is_world_regdom(rd->alpha2)) | ||
621 | return -EINVAL; | ||
622 | #else | ||
623 | if (is_world_regdom(rd->alpha2)) { | ||
624 | if (WARN_ON(!__reg_is_valid_request(rd->alpha2, &request))) | ||
625 | return -EINVAL; | ||
626 | update_world_regdomain(rd); | ||
627 | return 0; | ||
628 | } | ||
629 | #endif | ||
630 | |||
631 | if (!is_alpha2_set(rd->alpha2) && !is_an_alpha2(rd->alpha2) && | ||
632 | !is_unknown_alpha2(rd->alpha2)) | ||
633 | return -EINVAL; | ||
634 | |||
635 | if (list_empty(®ulatory_requests)) | ||
636 | return -EINVAL; | ||
637 | |||
638 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
639 | /* Static "US" and "JP" will be overridden, but just once */ | ||
640 | if (!is_old_static_regdom(cfg80211_regdomain) && | ||
641 | !regdom_changed(rd->alpha2)) | ||
642 | return -EINVAL; | ||
643 | #else | ||
644 | if (!regdom_changed(rd->alpha2)) | ||
645 | return -EINVAL; | ||
646 | #endif | ||
647 | |||
648 | /* Now lets set the regulatory domain, update all driver channels | ||
649 | * and finally inform them of what we have done, in case they want | ||
650 | * to review or adjust their own settings based on their own | ||
651 | * internal EEPROM data */ | ||
652 | |||
653 | if (WARN_ON(!__reg_is_valid_request(rd->alpha2, &request))) | ||
654 | return -EINVAL; | ||
655 | |||
656 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
657 | reset_regdomains_static(); | ||
658 | #else | ||
659 | reset_regdomains(); | ||
660 | #endif | ||
661 | |||
662 | /* Country IE parsing coming soon */ | ||
663 | switch (request->initiator) { | ||
664 | case REGDOM_SET_BY_CORE: | ||
665 | case REGDOM_SET_BY_DRIVER: | ||
666 | case REGDOM_SET_BY_USER: | ||
667 | if (!is_valid_rd(rd)) { | ||
668 | printk(KERN_ERR "cfg80211: Invalid " | ||
669 | "regulatory domain detected:\n"); | ||
670 | print_regdomain_info(rd); | ||
671 | return -EINVAL; | ||
672 | } | ||
673 | break; | ||
674 | case REGDOM_SET_BY_COUNTRY_IE: /* Not yet */ | ||
675 | WARN_ON(1); | ||
676 | default: | ||
677 | return -EOPNOTSUPP; | ||
678 | } | ||
679 | |||
680 | /* Tada! */ | ||
681 | cfg80211_regdomain = rd; | ||
682 | request->granted = 1; | ||
683 | |||
684 | return 0; | ||
685 | } | ||
686 | |||
687 | |||
688 | /* Use this call to set the current regulatory domain. Conflicts with | ||
689 | * multiple drivers can be ironed out later. Caller must've already | ||
690 | * kmalloc'd the rd structure. If this calls fails you should kfree() | ||
691 | * the passed rd. Caller must hold cfg80211_drv_mutex */ | ||
692 | int set_regdom(struct ieee80211_regdomain *rd) | ||
693 | { | ||
694 | struct regulatory_request *this_request = NULL, *prev_request = NULL; | ||
695 | int r; | ||
696 | |||
697 | if (!list_empty(®ulatory_requests)) | ||
698 | prev_request = list_first_entry(®ulatory_requests, | ||
699 | struct regulatory_request, list); | ||
700 | |||
701 | /* Note that this doesn't update the wiphys, this is done below */ | ||
702 | r = __set_regdom(rd); | ||
703 | if (r) | ||
704 | return r; | ||
705 | |||
706 | BUG_ON((!__reg_is_valid_request(rd->alpha2, &this_request))); | ||
707 | |||
708 | /* The initial standard core update of the world regulatory domain, no | ||
709 | * need to keep that request info around if it didn't fail. */ | ||
710 | if (is_world_regdom(rd->alpha2) && | ||
711 | this_request->initiator == REGDOM_SET_BY_CORE && | ||
712 | this_request->granted) { | ||
713 | list_del(&this_request->list); | ||
714 | kfree(this_request); | ||
715 | this_request = NULL; | ||
716 | } | ||
717 | |||
718 | /* Remove old requests, we only leave behind the last one */ | ||
719 | if (prev_request) { | ||
720 | list_del(&prev_request->list); | ||
721 | kfree(prev_request); | ||
722 | prev_request = NULL; | ||
723 | } | ||
724 | |||
725 | /* This would make this whole thing pointless */ | ||
726 | BUG_ON(rd != cfg80211_regdomain); | ||
727 | |||
728 | /* update all wiphys now with the new established regulatory domain */ | ||
729 | update_all_wiphy_regulatory(this_request->initiator); | ||
730 | |||
731 | print_regdomain(rd); | ||
732 | |||
733 | return r; | ||
734 | } | ||
735 | |||
736 | int regulatory_init(void) | ||
737 | { | ||
738 | reg_pdev = platform_device_register_simple("regulatory", 0, NULL, 0); | ||
739 | if (IS_ERR(reg_pdev)) | ||
740 | return PTR_ERR(reg_pdev); | ||
741 | return 0; | ||
742 | } | ||
743 | |||
744 | void regulatory_exit(void) | ||
745 | { | ||
746 | struct regulatory_request *req, *req_tmp; | ||
747 | mutex_lock(&cfg80211_drv_mutex); | ||
748 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
749 | reset_regdomains_static(); | ||
750 | #else | ||
751 | reset_regdomains(); | ||
752 | #endif | ||
753 | list_for_each_entry_safe(req, req_tmp, ®ulatory_requests, list) { | ||
754 | list_del(&req->list); | ||
755 | kfree(req); | ||
756 | } | ||
757 | platform_device_unregister(reg_pdev); | ||
758 | mutex_unlock(&cfg80211_drv_mutex); | ||
180 | } | 759 | } |
diff --git a/net/wireless/reg.h b/net/wireless/reg.h new file mode 100644 index 000000000000..d75fd0232972 --- /dev/null +++ b/net/wireless/reg.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef __NET_WIRELESS_REG_H | ||
2 | #define __NET_WIRELESS_REG_H | ||
3 | |||
4 | extern const struct ieee80211_regdomain world_regdom; | ||
5 | #ifdef CONFIG_WIRELESS_OLD_REGULATORY | ||
6 | extern const struct ieee80211_regdomain us_regdom; | ||
7 | extern const struct ieee80211_regdomain jp_regdom; | ||
8 | extern const struct ieee80211_regdomain eu_regdom; | ||
9 | #endif | ||
10 | |||
11 | extern struct ieee80211_regdomain *cfg80211_regdomain; | ||
12 | extern struct ieee80211_regdomain *cfg80211_world_regdom; | ||
13 | extern struct list_head regulatory_requests; | ||
14 | |||
15 | struct regdom_last_setby { | ||
16 | struct wiphy *wiphy; | ||
17 | u8 initiator; | ||
18 | }; | ||
19 | |||
20 | /* wiphy is set if this request's initiator is REGDOM_SET_BY_DRIVER */ | ||
21 | struct regulatory_request { | ||
22 | struct list_head list; | ||
23 | struct wiphy *wiphy; | ||
24 | int granted; | ||
25 | enum reg_set_by initiator; | ||
26 | char alpha2[2]; | ||
27 | }; | ||
28 | |||
29 | bool is_world_regdom(char *alpha2); | ||
30 | bool reg_is_valid_request(char *alpha2); | ||
31 | |||
32 | int set_regdom(struct ieee80211_regdomain *rd); | ||
33 | int __regulatory_hint_alpha2(struct wiphy *wiphy, enum reg_set_by set_by, | ||
34 | const char *alpha2); | ||
35 | |||
36 | int regulatory_init(void); | ||
37 | void regulatory_exit(void); | ||
38 | |||
39 | void print_regdomain_info(struct ieee80211_regdomain *); | ||
40 | |||
41 | /* If a char is A-Z */ | ||
42 | #define IS_ALPHA(letter) (letter >= 65 && letter <= 90) | ||
43 | |||
44 | #endif /* __NET_WIRELESS_REG_H */ | ||