diff options
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r-- | drivers/net/wireless/libertas/wext.c | 778 |
1 files changed, 410 insertions, 368 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 69f52b6e59c8..8939251a2f4c 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -22,6 +22,14 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * the rates supported by the card | ||
26 | */ | ||
27 | static u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES] = | ||
28 | { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12, | ||
29 | 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00 | ||
30 | }; | ||
31 | |||
32 | /** | ||
25 | * @brief Convert mw value to dbm value | 33 | * @brief Convert mw value to dbm value |
26 | * | 34 | * |
27 | * @param mw the value of mw | 35 | * @param mw the value of mw |
@@ -102,8 +110,8 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada | |||
102 | } | 110 | } |
103 | 111 | ||
104 | if (!cfp && channel) | 112 | if (!cfp && channel) |
105 | lbs_pr_debug(1, "libertas_find_cfp_by_band_and_channel(): cannot find " | 113 | lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find " |
106 | "cfp by band %d & channel %d\n", band, channel); | 114 | "cfp by band %d / channel %d\n", band, channel); |
107 | 115 | ||
108 | return cfp; | 116 | return cfp; |
109 | } | 117 | } |
@@ -143,113 +151,12 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter, | |||
143 | } | 151 | } |
144 | 152 | ||
145 | if (!cfp && freq) | 153 | if (!cfp && freq) |
146 | lbs_pr_debug(1, "find_cfp_by_band_and_freql(): cannot find cfp by " | 154 | lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by " |
147 | "band %d & freq %d\n", band, freq); | 155 | "band %d / freq %d\n", band, freq); |
148 | 156 | ||
149 | return cfp; | 157 | return cfp; |
150 | } | 158 | } |
151 | 159 | ||
152 | static int updatecurrentchannel(wlan_private * priv) | ||
153 | { | ||
154 | int ret; | ||
155 | |||
156 | /* | ||
157 | ** the channel in f/w could be out of sync, get the current channel | ||
158 | */ | ||
159 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel, | ||
160 | cmd_opt_802_11_rf_channel_get, | ||
161 | cmd_option_waitforrsp, 0, NULL); | ||
162 | |||
163 | lbs_pr_debug(1, "Current channel = %d\n", | ||
164 | priv->adapter->curbssparams.channel); | ||
165 | |||
166 | return ret; | ||
167 | } | ||
168 | |||
169 | static int setcurrentchannel(wlan_private * priv, int channel) | ||
170 | { | ||
171 | lbs_pr_debug(1, "Set channel = %d\n", channel); | ||
172 | |||
173 | /* | ||
174 | ** Current channel is not set to adhocchannel requested, set channel | ||
175 | */ | ||
176 | return (libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel, | ||
177 | cmd_opt_802_11_rf_channel_set, | ||
178 | cmd_option_waitforrsp, 0, &channel)); | ||
179 | } | ||
180 | |||
181 | static int changeadhocchannel(wlan_private * priv, int channel) | ||
182 | { | ||
183 | int ret = 0; | ||
184 | wlan_adapter *adapter = priv->adapter; | ||
185 | |||
186 | adapter->adhocchannel = channel; | ||
187 | |||
188 | updatecurrentchannel(priv); | ||
189 | |||
190 | if (adapter->curbssparams.channel == adapter->adhocchannel) { | ||
191 | /* adhocchannel is set to the current channel already */ | ||
192 | LEAVE(); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | lbs_pr_debug(1, "Updating channel from %d to %d\n", | ||
197 | adapter->curbssparams.channel, adapter->adhocchannel); | ||
198 | |||
199 | setcurrentchannel(priv, adapter->adhocchannel); | ||
200 | |||
201 | updatecurrentchannel(priv); | ||
202 | |||
203 | if (adapter->curbssparams.channel != adapter->adhocchannel) { | ||
204 | lbs_pr_debug(1, "failed to updated channel to %d, channel = %d\n", | ||
205 | adapter->adhocchannel, adapter->curbssparams.channel); | ||
206 | LEAVE(); | ||
207 | return -1; | ||
208 | } | ||
209 | |||
210 | if (adapter->connect_status == libertas_connected) { | ||
211 | int i; | ||
212 | struct WLAN_802_11_SSID curadhocssid; | ||
213 | |||
214 | lbs_pr_debug(1, "channel Changed while in an IBSS\n"); | ||
215 | |||
216 | /* Copy the current ssid */ | ||
217 | memcpy(&curadhocssid, &adapter->curbssparams.ssid, | ||
218 | sizeof(struct WLAN_802_11_SSID)); | ||
219 | |||
220 | /* Exit Adhoc mode */ | ||
221 | lbs_pr_debug(1, "In changeadhocchannel(): Sending Adhoc Stop\n"); | ||
222 | ret = libertas_stop_adhoc_network(priv); | ||
223 | |||
224 | if (ret) { | ||
225 | LEAVE(); | ||
226 | return ret; | ||
227 | } | ||
228 | /* Scan for the network, do not save previous results. Stale | ||
229 | * scan data will cause us to join a non-existant adhoc network | ||
230 | */ | ||
231 | libertas_send_specific_SSID_scan(priv, &curadhocssid, 0); | ||
232 | |||
233 | // find out the BSSID that matches the current SSID | ||
234 | i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL, | ||
235 | IW_MODE_ADHOC); | ||
236 | |||
237 | if (i >= 0) { | ||
238 | lbs_pr_debug(1, "SSID found at %d in List," | ||
239 | "so join\n", i); | ||
240 | libertas_join_adhoc_network(priv, &adapter->scantable[i]); | ||
241 | } else { | ||
242 | // else send START command | ||
243 | lbs_pr_debug(1, "SSID not found in list, " | ||
244 | "so creating adhoc with ssid = %s\n", | ||
245 | curadhocssid.ssid); | ||
246 | libertas_start_adhoc_network(priv, &curadhocssid); | ||
247 | } // end of else (START command) | ||
248 | } | ||
249 | |||
250 | LEAVE(); | ||
251 | return 0; | ||
252 | } | ||
253 | 160 | ||
254 | /** | 161 | /** |
255 | * @brief Set Radio On/OFF | 162 | * @brief Set Radio On/OFF |
@@ -263,10 +170,10 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option) | |||
263 | int ret = 0; | 170 | int ret = 0; |
264 | wlan_adapter *adapter = priv->adapter; | 171 | wlan_adapter *adapter = priv->adapter; |
265 | 172 | ||
266 | ENTER(); | 173 | lbs_deb_enter(LBS_DEB_WEXT); |
267 | 174 | ||
268 | if (adapter->radioon != option) { | 175 | if (adapter->radioon != option) { |
269 | lbs_pr_debug(1, "Switching %s the Radio\n", option ? "On" : "Off"); | 176 | lbs_deb_wext("switching radio %s\n", option ? "on" : "off"); |
270 | adapter->radioon = option; | 177 | adapter->radioon = option; |
271 | 178 | ||
272 | ret = libertas_prepare_and_send_command(priv, | 179 | ret = libertas_prepare_and_send_command(priv, |
@@ -275,7 +182,7 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option) | |||
275 | cmd_option_waitforrsp, 0, NULL); | 182 | cmd_option_waitforrsp, 0, NULL); |
276 | } | 183 | } |
277 | 184 | ||
278 | LEAVE(); | 185 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
279 | return ret; | 186 | return ret; |
280 | } | 187 | } |
281 | 188 | ||
@@ -312,15 +219,15 @@ static int get_active_data_rates(wlan_adapter * adapter, | |||
312 | { | 219 | { |
313 | int k = 0; | 220 | int k = 0; |
314 | 221 | ||
315 | ENTER(); | 222 | lbs_deb_enter(LBS_DEB_WEXT); |
316 | 223 | ||
317 | if (adapter->connect_status != libertas_connected) { | 224 | if (adapter->connect_status != libertas_connected) { |
318 | if (adapter->mode == IW_MODE_INFRA) { | 225 | if (adapter->mode == IW_MODE_INFRA) { |
319 | lbs_pr_debug(1, "Infra\n"); | 226 | lbs_deb_wext("infra\n"); |
320 | k = copyrates(rates, k, libertas_supported_rates, | 227 | k = copyrates(rates, k, libertas_supported_rates, |
321 | sizeof(libertas_supported_rates)); | 228 | sizeof(libertas_supported_rates)); |
322 | } else { | 229 | } else { |
323 | lbs_pr_debug(1, "Adhoc G\n"); | 230 | lbs_deb_wext("Adhoc G\n"); |
324 | k = copyrates(rates, k, libertas_adhoc_rates_g, | 231 | k = copyrates(rates, k, libertas_adhoc_rates_g, |
325 | sizeof(libertas_adhoc_rates_g)); | 232 | sizeof(libertas_adhoc_rates_g)); |
326 | } | 233 | } |
@@ -329,8 +236,7 @@ static int get_active_data_rates(wlan_adapter * adapter, | |||
329 | adapter->curbssparams.numofrates); | 236 | adapter->curbssparams.numofrates); |
330 | } | 237 | } |
331 | 238 | ||
332 | LEAVE(); | 239 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", k); |
333 | |||
334 | return k; | 240 | return k; |
335 | } | 241 | } |
336 | 242 | ||
@@ -342,7 +248,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info, | |||
342 | char mrvl[6] = { "MRVL-" }; | 248 | char mrvl[6] = { "MRVL-" }; |
343 | int cnt; | 249 | int cnt; |
344 | 250 | ||
345 | ENTER(); | 251 | lbs_deb_enter(LBS_DEB_WEXT); |
346 | 252 | ||
347 | strcpy(cwrq, mrvl); | 253 | strcpy(cwrq, mrvl); |
348 | 254 | ||
@@ -360,8 +266,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info, | |||
360 | } | 266 | } |
361 | *cwrq = '\0'; | 267 | *cwrq = '\0'; |
362 | 268 | ||
363 | LEAVE(); | 269 | lbs_deb_leave(LBS_DEB_WEXT); |
364 | |||
365 | return 0; | 270 | return 0; |
366 | } | 271 | } |
367 | 272 | ||
@@ -372,14 +277,14 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info, | |||
372 | wlan_adapter *adapter = priv->adapter; | 277 | wlan_adapter *adapter = priv->adapter; |
373 | struct chan_freq_power *cfp; | 278 | struct chan_freq_power *cfp; |
374 | 279 | ||
375 | ENTER(); | 280 | lbs_deb_enter(LBS_DEB_WEXT); |
376 | 281 | ||
377 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, | 282 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, |
378 | adapter->curbssparams.channel); | 283 | adapter->curbssparams.channel); |
379 | 284 | ||
380 | if (!cfp) { | 285 | if (!cfp) { |
381 | if (adapter->curbssparams.channel) | 286 | if (adapter->curbssparams.channel) |
382 | lbs_pr_debug(1, "Invalid channel=%d\n", | 287 | lbs_deb_wext("invalid channel %d\n", |
383 | adapter->curbssparams.channel); | 288 | adapter->curbssparams.channel); |
384 | return -EINVAL; | 289 | return -EINVAL; |
385 | } | 290 | } |
@@ -387,9 +292,8 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info, | |||
387 | fwrq->m = (long)cfp->freq * 100000; | 292 | fwrq->m = (long)cfp->freq * 100000; |
388 | fwrq->e = 1; | 293 | fwrq->e = 1; |
389 | 294 | ||
390 | lbs_pr_debug(1, "freq=%u\n", fwrq->m); | 295 | lbs_deb_wext("freq %u\n", fwrq->m); |
391 | 296 | lbs_deb_leave(LBS_DEB_WEXT); | |
392 | LEAVE(); | ||
393 | return 0; | 297 | return 0; |
394 | } | 298 | } |
395 | 299 | ||
@@ -399,7 +303,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info, | |||
399 | wlan_private *priv = dev->priv; | 303 | wlan_private *priv = dev->priv; |
400 | wlan_adapter *adapter = priv->adapter; | 304 | wlan_adapter *adapter = priv->adapter; |
401 | 305 | ||
402 | ENTER(); | 306 | lbs_deb_enter(LBS_DEB_WEXT); |
403 | 307 | ||
404 | if (adapter->connect_status == libertas_connected) { | 308 | if (adapter->connect_status == libertas_connected) { |
405 | memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); | 309 | memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); |
@@ -408,7 +312,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info, | |||
408 | } | 312 | } |
409 | awrq->sa_family = ARPHRD_ETHER; | 313 | awrq->sa_family = ARPHRD_ETHER; |
410 | 314 | ||
411 | LEAVE(); | 315 | lbs_deb_leave(LBS_DEB_WEXT); |
412 | return 0; | 316 | return 0; |
413 | } | 317 | } |
414 | 318 | ||
@@ -418,7 +322,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info, | |||
418 | wlan_private *priv = dev->priv; | 322 | wlan_private *priv = dev->priv; |
419 | wlan_adapter *adapter = priv->adapter; | 323 | wlan_adapter *adapter = priv->adapter; |
420 | 324 | ||
421 | ENTER(); | 325 | lbs_deb_enter(LBS_DEB_WEXT); |
422 | 326 | ||
423 | /* | 327 | /* |
424 | * Check the size of the string | 328 | * Check the size of the string |
@@ -433,7 +337,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info, | |||
433 | memcpy(adapter->nodename, extra, dwrq->length); | 337 | memcpy(adapter->nodename, extra, dwrq->length); |
434 | mutex_unlock(&adapter->lock); | 338 | mutex_unlock(&adapter->lock); |
435 | 339 | ||
436 | LEAVE(); | 340 | lbs_deb_leave(LBS_DEB_WEXT); |
437 | return 0; | 341 | return 0; |
438 | } | 342 | } |
439 | 343 | ||
@@ -443,7 +347,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info, | |||
443 | wlan_private *priv = dev->priv; | 347 | wlan_private *priv = dev->priv; |
444 | wlan_adapter *adapter = priv->adapter; | 348 | wlan_adapter *adapter = priv->adapter; |
445 | 349 | ||
446 | ENTER(); | 350 | lbs_deb_enter(LBS_DEB_WEXT); |
447 | 351 | ||
448 | /* | 352 | /* |
449 | * Get the Nick Name saved | 353 | * Get the Nick Name saved |
@@ -464,19 +368,43 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info, | |||
464 | */ | 368 | */ |
465 | dwrq->length = strlen(extra) + 1; | 369 | dwrq->length = strlen(extra) + 1; |
466 | 370 | ||
467 | LEAVE(); | 371 | lbs_deb_leave(LBS_DEB_WEXT); |
468 | return 0; | 372 | return 0; |
469 | } | 373 | } |
470 | 374 | ||
375 | static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, | ||
376 | struct iw_point *dwrq, char *extra) | ||
377 | { | ||
378 | wlan_private *priv = dev->priv; | ||
379 | wlan_adapter *adapter = priv->adapter; | ||
380 | |||
381 | lbs_deb_enter(LBS_DEB_WEXT); | ||
382 | |||
383 | /* Use nickname to indicate that mesh is on */ | ||
384 | |||
385 | if (adapter->connect_status == libertas_connected) { | ||
386 | strncpy(extra, "Mesh", 12); | ||
387 | extra[12] = '\0'; | ||
388 | dwrq->length = strlen(extra) + 1; | ||
389 | } | ||
390 | |||
391 | else { | ||
392 | extra[0] = '\0'; | ||
393 | dwrq->length = 1 ; | ||
394 | } | ||
395 | |||
396 | lbs_deb_leave(LBS_DEB_WEXT); | ||
397 | return 0; | ||
398 | } | ||
471 | static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, | 399 | static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, |
472 | struct iw_param *vwrq, char *extra) | 400 | struct iw_param *vwrq, char *extra) |
473 | { | 401 | { |
474 | int ret = 0; | 402 | int ret = 0; |
475 | wlan_private *priv = dev->priv; | 403 | wlan_private *priv = dev->priv; |
476 | wlan_adapter *adapter = priv->adapter; | 404 | wlan_adapter *adapter = priv->adapter; |
477 | int rthr = vwrq->value; | 405 | u32 rthr = vwrq->value; |
478 | 406 | ||
479 | ENTER(); | 407 | lbs_deb_enter(LBS_DEB_WEXT); |
480 | 408 | ||
481 | if (vwrq->disabled) { | 409 | if (vwrq->disabled) { |
482 | adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; | 410 | adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; |
@@ -490,7 +418,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, | |||
490 | cmd_act_set, cmd_option_waitforrsp, | 418 | cmd_act_set, cmd_option_waitforrsp, |
491 | OID_802_11_RTS_THRESHOLD, &rthr); | 419 | OID_802_11_RTS_THRESHOLD, &rthr); |
492 | 420 | ||
493 | LEAVE(); | 421 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
494 | return ret; | 422 | return ret; |
495 | } | 423 | } |
496 | 424 | ||
@@ -501,35 +429,34 @@ static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info, | |||
501 | wlan_private *priv = dev->priv; | 429 | wlan_private *priv = dev->priv; |
502 | wlan_adapter *adapter = priv->adapter; | 430 | wlan_adapter *adapter = priv->adapter; |
503 | 431 | ||
504 | ENTER(); | 432 | lbs_deb_enter(LBS_DEB_WEXT); |
505 | 433 | ||
506 | adapter->rtsthsd = 0; | 434 | adapter->rtsthsd = 0; |
507 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, | 435 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, |
508 | cmd_act_get, cmd_option_waitforrsp, | 436 | cmd_act_get, cmd_option_waitforrsp, |
509 | OID_802_11_RTS_THRESHOLD, NULL); | 437 | OID_802_11_RTS_THRESHOLD, NULL); |
510 | if (ret) { | 438 | if (ret) |
511 | LEAVE(); | 439 | goto out; |
512 | return ret; | ||
513 | } | ||
514 | 440 | ||
515 | vwrq->value = adapter->rtsthsd; | 441 | vwrq->value = adapter->rtsthsd; |
516 | vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) | 442 | vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) |
517 | || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); | 443 | || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); |
518 | vwrq->fixed = 1; | 444 | vwrq->fixed = 1; |
519 | 445 | ||
520 | LEAVE(); | 446 | out: |
521 | return 0; | 447 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
448 | return ret; | ||
522 | } | 449 | } |
523 | 450 | ||
524 | static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, | 451 | static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, |
525 | struct iw_param *vwrq, char *extra) | 452 | struct iw_param *vwrq, char *extra) |
526 | { | 453 | { |
527 | int ret = 0; | 454 | int ret = 0; |
528 | int fthr = vwrq->value; | 455 | u32 fthr = vwrq->value; |
529 | wlan_private *priv = dev->priv; | 456 | wlan_private *priv = dev->priv; |
530 | wlan_adapter *adapter = priv->adapter; | 457 | wlan_adapter *adapter = priv->adapter; |
531 | 458 | ||
532 | ENTER(); | 459 | lbs_deb_enter(LBS_DEB_WEXT); |
533 | 460 | ||
534 | if (vwrq->disabled) { | 461 | if (vwrq->disabled) { |
535 | adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; | 462 | adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; |
@@ -543,7 +470,8 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, | |||
543 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, | 470 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, |
544 | cmd_act_set, cmd_option_waitforrsp, | 471 | cmd_act_set, cmd_option_waitforrsp, |
545 | OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); | 472 | OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); |
546 | LEAVE(); | 473 | |
474 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | ||
547 | return ret; | 475 | return ret; |
548 | } | 476 | } |
549 | 477 | ||
@@ -554,24 +482,23 @@ static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info, | |||
554 | wlan_private *priv = dev->priv; | 482 | wlan_private *priv = dev->priv; |
555 | wlan_adapter *adapter = priv->adapter; | 483 | wlan_adapter *adapter = priv->adapter; |
556 | 484 | ||
557 | ENTER(); | 485 | lbs_deb_enter(LBS_DEB_WEXT); |
558 | 486 | ||
559 | adapter->fragthsd = 0; | 487 | adapter->fragthsd = 0; |
560 | ret = libertas_prepare_and_send_command(priv, | 488 | ret = libertas_prepare_and_send_command(priv, |
561 | cmd_802_11_snmp_mib, | 489 | cmd_802_11_snmp_mib, |
562 | cmd_act_get, cmd_option_waitforrsp, | 490 | cmd_act_get, cmd_option_waitforrsp, |
563 | OID_802_11_FRAGMENTATION_THRESHOLD, NULL); | 491 | OID_802_11_FRAGMENTATION_THRESHOLD, NULL); |
564 | if (ret) { | 492 | if (ret) |
565 | LEAVE(); | 493 | goto out; |
566 | return ret; | ||
567 | } | ||
568 | 494 | ||
569 | vwrq->value = adapter->fragthsd; | 495 | vwrq->value = adapter->fragthsd; |
570 | vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) | 496 | vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) |
571 | || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); | 497 | || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); |
572 | vwrq->fixed = 1; | 498 | vwrq->fixed = 1; |
573 | 499 | ||
574 | LEAVE(); | 500 | out: |
501 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | ||
575 | return ret; | 502 | return ret; |
576 | } | 503 | } |
577 | 504 | ||
@@ -581,11 +508,23 @@ static int wlan_get_mode(struct net_device *dev, | |||
581 | wlan_private *priv = dev->priv; | 508 | wlan_private *priv = dev->priv; |
582 | wlan_adapter *adapter = priv->adapter; | 509 | wlan_adapter *adapter = priv->adapter; |
583 | 510 | ||
584 | ENTER(); | 511 | lbs_deb_enter(LBS_DEB_WEXT); |
585 | 512 | ||
586 | *uwrq = adapter->mode; | 513 | *uwrq = adapter->mode; |
587 | 514 | ||
588 | LEAVE(); | 515 | lbs_deb_leave(LBS_DEB_WEXT); |
516 | return 0; | ||
517 | } | ||
518 | |||
519 | static int mesh_wlan_get_mode(struct net_device *dev, | ||
520 | struct iw_request_info *info, u32 * uwrq, | ||
521 | char *extra) | ||
522 | { | ||
523 | lbs_deb_enter(LBS_DEB_WEXT); | ||
524 | |||
525 | *uwrq = IW_MODE_REPEAT ; | ||
526 | |||
527 | lbs_deb_leave(LBS_DEB_WEXT); | ||
589 | return 0; | 528 | return 0; |
590 | } | 529 | } |
591 | 530 | ||
@@ -597,19 +536,17 @@ static int wlan_get_txpow(struct net_device *dev, | |||
597 | wlan_private *priv = dev->priv; | 536 | wlan_private *priv = dev->priv; |
598 | wlan_adapter *adapter = priv->adapter; | 537 | wlan_adapter *adapter = priv->adapter; |
599 | 538 | ||
600 | ENTER(); | 539 | lbs_deb_enter(LBS_DEB_WEXT); |
601 | 540 | ||
602 | ret = libertas_prepare_and_send_command(priv, | 541 | ret = libertas_prepare_and_send_command(priv, |
603 | cmd_802_11_rf_tx_power, | 542 | cmd_802_11_rf_tx_power, |
604 | cmd_act_tx_power_opt_get, | 543 | cmd_act_tx_power_opt_get, |
605 | cmd_option_waitforrsp, 0, NULL); | 544 | cmd_option_waitforrsp, 0, NULL); |
606 | 545 | ||
607 | if (ret) { | 546 | if (ret) |
608 | LEAVE(); | 547 | goto out; |
609 | return ret; | ||
610 | } | ||
611 | 548 | ||
612 | lbs_pr_debug(1, "TXPOWER GET %d dbm.\n", adapter->txpowerlevel); | 549 | lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel); |
613 | vwrq->value = adapter->txpowerlevel; | 550 | vwrq->value = adapter->txpowerlevel; |
614 | vwrq->fixed = 1; | 551 | vwrq->fixed = 1; |
615 | if (adapter->radioon) { | 552 | if (adapter->radioon) { |
@@ -619,8 +556,9 @@ static int wlan_get_txpow(struct net_device *dev, | |||
619 | vwrq->disabled = 1; | 556 | vwrq->disabled = 1; |
620 | } | 557 | } |
621 | 558 | ||
622 | LEAVE(); | 559 | out: |
623 | return 0; | 560 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
561 | return ret; | ||
624 | } | 562 | } |
625 | 563 | ||
626 | static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, | 564 | static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, |
@@ -630,7 +568,7 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, | |||
630 | wlan_private *priv = dev->priv; | 568 | wlan_private *priv = dev->priv; |
631 | wlan_adapter *adapter = priv->adapter; | 569 | wlan_adapter *adapter = priv->adapter; |
632 | 570 | ||
633 | ENTER(); | 571 | lbs_deb_enter(LBS_DEB_WEXT); |
634 | 572 | ||
635 | if (vwrq->flags == IW_RETRY_LIMIT) { | 573 | if (vwrq->flags == IW_RETRY_LIMIT) { |
636 | /* The MAC has a 4-bit Total_Tx_Count register | 574 | /* The MAC has a 4-bit Total_Tx_Count register |
@@ -648,16 +586,15 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, | |||
648 | cmd_option_waitforrsp, | 586 | cmd_option_waitforrsp, |
649 | OID_802_11_TX_RETRYCOUNT, NULL); | 587 | OID_802_11_TX_RETRYCOUNT, NULL); |
650 | 588 | ||
651 | if (ret) { | 589 | if (ret) |
652 | LEAVE(); | 590 | goto out; |
653 | return ret; | ||
654 | } | ||
655 | } else { | 591 | } else { |
656 | return -EOPNOTSUPP; | 592 | return -EOPNOTSUPP; |
657 | } | 593 | } |
658 | 594 | ||
659 | LEAVE(); | 595 | out: |
660 | return 0; | 596 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
597 | return ret; | ||
661 | } | 598 | } |
662 | 599 | ||
663 | static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, | 600 | static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, |
@@ -667,16 +604,16 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, | |||
667 | wlan_adapter *adapter = priv->adapter; | 604 | wlan_adapter *adapter = priv->adapter; |
668 | int ret = 0; | 605 | int ret = 0; |
669 | 606 | ||
670 | ENTER(); | 607 | lbs_deb_enter(LBS_DEB_WEXT); |
608 | |||
671 | adapter->txretrycount = 0; | 609 | adapter->txretrycount = 0; |
672 | ret = libertas_prepare_and_send_command(priv, | 610 | ret = libertas_prepare_and_send_command(priv, |
673 | cmd_802_11_snmp_mib, | 611 | cmd_802_11_snmp_mib, |
674 | cmd_act_get, cmd_option_waitforrsp, | 612 | cmd_act_get, cmd_option_waitforrsp, |
675 | OID_802_11_TX_RETRYCOUNT, NULL); | 613 | OID_802_11_TX_RETRYCOUNT, NULL); |
676 | if (ret) { | 614 | if (ret) |
677 | LEAVE(); | 615 | goto out; |
678 | return ret; | 616 | |
679 | } | ||
680 | vwrq->disabled = 0; | 617 | vwrq->disabled = 0; |
681 | if (!vwrq->flags) { | 618 | if (!vwrq->flags) { |
682 | vwrq->flags = IW_RETRY_LIMIT; | 619 | vwrq->flags = IW_RETRY_LIMIT; |
@@ -684,8 +621,9 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, | |||
684 | vwrq->value = adapter->txretrycount - 1; | 621 | vwrq->value = adapter->txretrycount - 1; |
685 | } | 622 | } |
686 | 623 | ||
687 | LEAVE(); | 624 | out: |
688 | return 0; | 625 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
626 | return ret; | ||
689 | } | 627 | } |
690 | 628 | ||
691 | static inline void sort_channels(struct iw_freq *freq, int num) | 629 | static inline void sort_channels(struct iw_freq *freq, int num) |
@@ -739,7 +677,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
739 | 677 | ||
740 | u8 flag = 0; | 678 | u8 flag = 0; |
741 | 679 | ||
742 | ENTER(); | 680 | lbs_deb_enter(LBS_DEB_WEXT); |
743 | 681 | ||
744 | dwrq->length = sizeof(struct iw_range); | 682 | dwrq->length = sizeof(struct iw_range); |
745 | memset(range, 0, sizeof(struct iw_range)); | 683 | memset(range, 0, sizeof(struct iw_range)); |
@@ -755,7 +693,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
755 | range->bitrate[i] = (rates[i] & 0x7f) * 500000; | 693 | range->bitrate[i] = (rates[i] & 0x7f) * 500000; |
756 | } | 694 | } |
757 | range->num_bitrates = i; | 695 | range->num_bitrates = i; |
758 | lbs_pr_debug(1, "IW_MAX_BITRATES=%d num_bitrates=%d\n", IW_MAX_BITRATES, | 696 | lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES, |
759 | range->num_bitrates); | 697 | range->num_bitrates); |
760 | 698 | ||
761 | range->num_frequency = 0; | 699 | range->num_frequency = 0; |
@@ -768,18 +706,17 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
768 | &adapter->parsed_region_chan; | 706 | &adapter->parsed_region_chan; |
769 | 707 | ||
770 | if (parsed_region_chan == NULL) { | 708 | if (parsed_region_chan == NULL) { |
771 | lbs_pr_debug(1, "11D:parsed_region_chan is NULL\n"); | 709 | lbs_deb_wext("11d: parsed_region_chan is NULL\n"); |
772 | LEAVE(); | 710 | goto out; |
773 | return 0; | ||
774 | } | 711 | } |
775 | band = parsed_region_chan->band; | 712 | band = parsed_region_chan->band; |
776 | lbs_pr_debug(1, "band=%d NoOfChan=%d\n", band, | 713 | lbs_deb_wext("band %d, nr_char %d\n", band, |
777 | parsed_region_chan->nr_chan); | 714 | parsed_region_chan->nr_chan); |
778 | 715 | ||
779 | for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) | 716 | for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) |
780 | && (i < parsed_region_chan->nr_chan); i++) { | 717 | && (i < parsed_region_chan->nr_chan); i++) { |
781 | chan_no = parsed_region_chan->chanpwr[i].chan; | 718 | chan_no = parsed_region_chan->chanpwr[i].chan; |
782 | lbs_pr_debug(1, "chan_no=%d\n", chan_no); | 719 | lbs_deb_wext("chan_no %d\n", chan_no); |
783 | range->freq[range->num_frequency].i = (long)chan_no; | 720 | range->freq[range->num_frequency].i = (long)chan_no; |
784 | range->freq[range->num_frequency].m = | 721 | range->freq[range->num_frequency].m = |
785 | (long)libertas_chan_2_freq(chan_no, band) * 100000; | 722 | (long)libertas_chan_2_freq(chan_no, band) * 100000; |
@@ -808,7 +745,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
808 | } | 745 | } |
809 | } | 746 | } |
810 | 747 | ||
811 | lbs_pr_debug(1, "IW_MAX_FREQUENCIES=%d num_frequency=%d\n", | 748 | lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n", |
812 | IW_MAX_FREQUENCIES, range->num_frequency); | 749 | IW_MAX_FREQUENCIES, range->num_frequency); |
813 | 750 | ||
814 | range->num_channels = range->num_frequency; | 751 | range->num_channels = range->num_frequency; |
@@ -903,7 +840,8 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
903 | | IW_ENC_CAPA_CIPHER_CCMP; | 840 | | IW_ENC_CAPA_CIPHER_CCMP; |
904 | } | 841 | } |
905 | 842 | ||
906 | LEAVE(); | 843 | out: |
844 | lbs_deb_leave(LBS_DEB_WEXT); | ||
907 | return 0; | 845 | return 0; |
908 | } | 846 | } |
909 | 847 | ||
@@ -913,7 +851,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, | |||
913 | wlan_private *priv = dev->priv; | 851 | wlan_private *priv = dev->priv; |
914 | wlan_adapter *adapter = priv->adapter; | 852 | wlan_adapter *adapter = priv->adapter; |
915 | 853 | ||
916 | ENTER(); | 854 | lbs_deb_enter(LBS_DEB_WEXT); |
917 | 855 | ||
918 | /* PS is currently supported only in Infrastructure mode | 856 | /* PS is currently supported only in Infrastructure mode |
919 | * Remove this check if it is to be supported in IBSS mode also | 857 | * Remove this check if it is to be supported in IBSS mode also |
@@ -929,11 +867,11 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, | |||
929 | } | 867 | } |
930 | 868 | ||
931 | if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { | 869 | if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { |
932 | lbs_pr_debug(1, | 870 | lbs_deb_wext( |
933 | "Setting power timeout command is not supported\n"); | 871 | "setting power timeout is not supported\n"); |
934 | return -EINVAL; | 872 | return -EINVAL; |
935 | } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { | 873 | } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { |
936 | lbs_pr_debug(1, "Setting power period command is not supported\n"); | 874 | lbs_deb_wext("setting power period not supported\n"); |
937 | return -EINVAL; | 875 | return -EINVAL; |
938 | } | 876 | } |
939 | 877 | ||
@@ -947,7 +885,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, | |||
947 | libertas_ps_sleep(priv, cmd_option_waitforrsp); | 885 | libertas_ps_sleep(priv, cmd_option_waitforrsp); |
948 | } | 886 | } |
949 | 887 | ||
950 | LEAVE(); | 888 | lbs_deb_leave(LBS_DEB_WEXT); |
951 | return 0; | 889 | return 0; |
952 | } | 890 | } |
953 | 891 | ||
@@ -958,19 +896,20 @@ static int wlan_get_power(struct net_device *dev, struct iw_request_info *info, | |||
958 | wlan_adapter *adapter = priv->adapter; | 896 | wlan_adapter *adapter = priv->adapter; |
959 | int mode; | 897 | int mode; |
960 | 898 | ||
961 | ENTER(); | 899 | lbs_deb_enter(LBS_DEB_WEXT); |
962 | 900 | ||
963 | mode = adapter->psmode; | 901 | mode = adapter->psmode; |
964 | 902 | ||
965 | if ((vwrq->disabled = (mode == wlan802_11powermodecam)) | 903 | if ((vwrq->disabled = (mode == wlan802_11powermodecam)) |
966 | || adapter->connect_status == libertas_disconnected) { | 904 | || adapter->connect_status == libertas_disconnected) |
967 | LEAVE(); | 905 | { |
968 | return 0; | 906 | goto out; |
969 | } | 907 | } |
970 | 908 | ||
971 | vwrq->value = 0; | 909 | vwrq->value = 0; |
972 | 910 | ||
973 | LEAVE(); | 911 | out: |
912 | lbs_deb_leave(LBS_DEB_WEXT); | ||
974 | return 0; | 913 | return 0; |
975 | } | 914 | } |
976 | 915 | ||
@@ -1063,6 +1002,16 @@ static const struct iw_priv_args wlan_private_args[] = { | |||
1063 | IW_PRIV_TYPE_CHAR | 128, | 1002 | IW_PRIV_TYPE_CHAR | 128, |
1064 | IW_PRIV_TYPE_CHAR | 128, | 1003 | IW_PRIV_TYPE_CHAR | 128, |
1065 | "bt_list"}, | 1004 | "bt_list"}, |
1005 | { | ||
1006 | WLAN_SUBCMD_BT_SET_INVERT, | ||
1007 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, | ||
1008 | IW_PRIV_TYPE_NONE, | ||
1009 | "bt_set_invert"}, | ||
1010 | { | ||
1011 | WLAN_SUBCMD_BT_GET_INVERT, | ||
1012 | IW_PRIV_TYPE_NONE, | ||
1013 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, | ||
1014 | "bt_get_invert"}, | ||
1066 | /* FWT Management */ | 1015 | /* FWT Management */ |
1067 | { | 1016 | { |
1068 | WLAN_SUBCMD_FWT_ADD, | 1017 | WLAN_SUBCMD_FWT_ADD, |
@@ -1125,7 +1074,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1125 | u8 rssi; | 1074 | u8 rssi; |
1126 | u32 tx_retries; | 1075 | u32 tx_retries; |
1127 | 1076 | ||
1128 | ENTER(); | 1077 | lbs_deb_enter(LBS_DEB_WEXT); |
1129 | 1078 | ||
1130 | priv->wstats.status = adapter->mode; | 1079 | priv->wstats.status = adapter->mode; |
1131 | 1080 | ||
@@ -1145,8 +1094,8 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1145 | CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); | 1094 | CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); |
1146 | } | 1095 | } |
1147 | 1096 | ||
1148 | lbs_pr_debug(1, "Signal Level = %#x\n", priv->wstats.qual.level); | 1097 | lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level); |
1149 | lbs_pr_debug(1, "Noise = %#x\n", priv->wstats.qual.noise); | 1098 | lbs_deb_wext("noise %#x\n", priv->wstats.qual.noise); |
1150 | 1099 | ||
1151 | rssi = priv->wstats.qual.level - priv->wstats.qual.noise; | 1100 | rssi = priv->wstats.qual.level - priv->wstats.qual.noise; |
1152 | if (rssi < 15) | 1101 | if (rssi < 15) |
@@ -1166,7 +1115,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1166 | /* Quality by TX errors */ | 1115 | /* Quality by TX errors */ |
1167 | priv->wstats.discard.retries = priv->stats.tx_errors; | 1116 | priv->wstats.discard.retries = priv->stats.tx_errors; |
1168 | 1117 | ||
1169 | tx_retries = adapter->logmsg.retry; | 1118 | tx_retries = le16_to_cpu(adapter->logmsg.retry); |
1170 | 1119 | ||
1171 | if (tx_retries > 75) | 1120 | if (tx_retries > 75) |
1172 | tx_qual = (90 - tx_retries) * POOR / 15; | 1121 | tx_qual = (90 - tx_retries) * POOR / 15; |
@@ -1182,10 +1131,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1182 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; | 1131 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; |
1183 | quality = min(quality, tx_qual); | 1132 | quality = min(quality, tx_qual); |
1184 | 1133 | ||
1185 | priv->wstats.discard.code = adapter->logmsg.wepundecryptable; | 1134 | priv->wstats.discard.code = le16_to_cpu(adapter->logmsg.wepundecryptable); |
1186 | priv->wstats.discard.fragment = adapter->logmsg.fcserror; | 1135 | priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag); |
1187 | priv->wstats.discard.retries = tx_retries; | 1136 | priv->wstats.discard.retries = tx_retries; |
1188 | priv->wstats.discard.misc = adapter->logmsg.ackfailure; | 1137 | priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure); |
1189 | 1138 | ||
1190 | /* Calculate quality */ | 1139 | /* Calculate quality */ |
1191 | priv->wstats.qual.qual = max(quality, (u32)100); | 1140 | priv->wstats.qual.qual = max(quality, (u32)100); |
@@ -1209,7 +1158,7 @@ out: | |||
1209 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; | 1158 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; |
1210 | } | 1159 | } |
1211 | 1160 | ||
1212 | LEAVE (); | 1161 | lbs_deb_leave(LBS_DEB_WEXT); |
1213 | return &priv->wstats; | 1162 | return &priv->wstats; |
1214 | 1163 | ||
1215 | 1164 | ||
@@ -1218,81 +1167,59 @@ out: | |||
1218 | static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, | 1167 | static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, |
1219 | struct iw_freq *fwrq, char *extra) | 1168 | struct iw_freq *fwrq, char *extra) |
1220 | { | 1169 | { |
1221 | int ret = 0; | 1170 | int ret = -EINVAL; |
1222 | wlan_private *priv = dev->priv; | 1171 | wlan_private *priv = dev->priv; |
1223 | wlan_adapter *adapter = priv->adapter; | 1172 | wlan_adapter *adapter = priv->adapter; |
1224 | int rc = -EINPROGRESS; /* Call commit handler */ | ||
1225 | struct chan_freq_power *cfp; | 1173 | struct chan_freq_power *cfp; |
1174 | struct assoc_request * assoc_req; | ||
1226 | 1175 | ||
1227 | ENTER(); | 1176 | lbs_deb_enter(LBS_DEB_WEXT); |
1228 | 1177 | ||
1229 | /* | 1178 | mutex_lock(&adapter->lock); |
1230 | * If setting by frequency, convert to a channel | 1179 | assoc_req = wlan_get_association_request(adapter); |
1231 | */ | 1180 | if (!assoc_req) { |
1232 | if (fwrq->e == 1) { | 1181 | ret = -ENOMEM; |
1182 | goto out; | ||
1183 | } | ||
1233 | 1184 | ||
1185 | /* If setting by frequency, convert to a channel */ | ||
1186 | if (fwrq->e == 1) { | ||
1234 | long f = fwrq->m / 100000; | 1187 | long f = fwrq->m / 100000; |
1235 | int c = 0; | ||
1236 | 1188 | ||
1237 | cfp = find_cfp_by_band_and_freq(adapter, 0, f); | 1189 | cfp = find_cfp_by_band_and_freq(adapter, 0, f); |
1238 | if (!cfp) { | 1190 | if (!cfp) { |
1239 | lbs_pr_debug(1, "Invalid freq=%ld\n", f); | 1191 | lbs_deb_wext("invalid freq %ld\n", f); |
1240 | return -EINVAL; | 1192 | goto out; |
1241 | } | 1193 | } |
1242 | 1194 | ||
1243 | c = (int)cfp->channel; | ||
1244 | |||
1245 | if (c < 0) | ||
1246 | return -EINVAL; | ||
1247 | |||
1248 | fwrq->e = 0; | 1195 | fwrq->e = 0; |
1249 | fwrq->m = c; | 1196 | fwrq->m = (int) cfp->channel; |
1250 | } | 1197 | } |
1251 | 1198 | ||
1252 | /* | 1199 | /* Setting by channel number */ |
1253 | * Setting by channel number | ||
1254 | */ | ||
1255 | if (fwrq->m > 1000 || fwrq->e > 0) { | 1200 | if (fwrq->m > 1000 || fwrq->e > 0) { |
1256 | rc = -EOPNOTSUPP; | 1201 | goto out; |
1257 | } else { | 1202 | } |
1258 | int channel = fwrq->m; | ||
1259 | 1203 | ||
1260 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, channel); | 1204 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, fwrq->m); |
1261 | if (!cfp) { | 1205 | if (!cfp) { |
1262 | rc = -EINVAL; | 1206 | goto out; |
1263 | } else { | 1207 | } |
1264 | if (adapter->mode == IW_MODE_ADHOC) { | 1208 | |
1265 | rc = changeadhocchannel(priv, channel); | 1209 | assoc_req->channel = fwrq->m; |
1266 | /* If station is WEP enabled, send the | 1210 | ret = 0; |
1267 | * command to set WEP in firmware | 1211 | |
1268 | */ | 1212 | out: |
1269 | if (adapter->secinfo.wep_enabled) { | 1213 | if (ret == 0) { |
1270 | lbs_pr_debug(1, "set_freq: WEP enabled\n"); | 1214 | set_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags); |
1271 | ret = libertas_prepare_and_send_command(priv, | 1215 | wlan_postpone_association_work(priv); |
1272 | cmd_802_11_set_wep, | 1216 | } else { |
1273 | cmd_act_add, | 1217 | wlan_cancel_association_work(priv); |
1274 | cmd_option_waitforrsp, | ||
1275 | 0, | ||
1276 | NULL); | ||
1277 | |||
1278 | if (ret) { | ||
1279 | LEAVE(); | ||
1280 | return ret; | ||
1281 | } | ||
1282 | |||
1283 | adapter->currentpacketfilter |= | ||
1284 | cmd_act_mac_wep_enable; | ||
1285 | |||
1286 | libertas_set_mac_packet_filter(priv); | ||
1287 | } | ||
1288 | } else { | ||
1289 | rc = -EOPNOTSUPP; | ||
1290 | } | ||
1291 | } | ||
1292 | } | 1218 | } |
1219 | mutex_unlock(&adapter->lock); | ||
1293 | 1220 | ||
1294 | LEAVE(); | 1221 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1295 | return rc; | 1222 | return ret; |
1296 | } | 1223 | } |
1297 | 1224 | ||
1298 | /** | 1225 | /** |
@@ -1338,9 +1265,9 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
1338 | u8 rates[WLAN_SUPPORTED_RATES]; | 1265 | u8 rates[WLAN_SUPPORTED_RATES]; |
1339 | u8 *rate; | 1266 | u8 *rate; |
1340 | 1267 | ||
1341 | ENTER(); | 1268 | lbs_deb_enter(LBS_DEB_WEXT); |
1342 | 1269 | ||
1343 | lbs_pr_debug(1, "Vwrq->value = %d\n", vwrq->value); | 1270 | lbs_deb_wext("vwrq->value %d\n", vwrq->value); |
1344 | 1271 | ||
1345 | if (vwrq->value == -1) { | 1272 | if (vwrq->value == -1) { |
1346 | action = cmd_act_set_tx_auto; // Auto | 1273 | action = cmd_act_set_tx_auto; // Auto |
@@ -1357,15 +1284,15 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
1357 | get_active_data_rates(adapter, rates); | 1284 | get_active_data_rates(adapter, rates); |
1358 | rate = rates; | 1285 | rate = rates; |
1359 | while (*rate) { | 1286 | while (*rate) { |
1360 | lbs_pr_debug(1, "Rate=0x%X Wanted=0x%X\n", *rate, | 1287 | lbs_deb_wext("rate=0x%X, wanted data_rate 0x%X\n", *rate, |
1361 | data_rate); | 1288 | data_rate); |
1362 | if ((*rate & 0x7f) == (data_rate & 0x7f)) | 1289 | if ((*rate & 0x7f) == (data_rate & 0x7f)) |
1363 | break; | 1290 | break; |
1364 | rate++; | 1291 | rate++; |
1365 | } | 1292 | } |
1366 | if (!*rate) { | 1293 | if (!*rate) { |
1367 | lbs_pr_alert( "The fixed data rate 0x%X is out " | 1294 | lbs_pr_alert("fixed data rate 0x%X out " |
1368 | "of range.\n", data_rate); | 1295 | "of range\n", data_rate); |
1369 | return -EINVAL; | 1296 | return -EINVAL; |
1370 | } | 1297 | } |
1371 | 1298 | ||
@@ -1377,7 +1304,7 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
1377 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate, | 1304 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate, |
1378 | action, cmd_option_waitforrsp, 0, NULL); | 1305 | action, cmd_option_waitforrsp, 0, NULL); |
1379 | 1306 | ||
1380 | LEAVE(); | 1307 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1381 | return ret; | 1308 | return ret; |
1382 | } | 1309 | } |
1383 | 1310 | ||
@@ -1387,7 +1314,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info, | |||
1387 | wlan_private *priv = dev->priv; | 1314 | wlan_private *priv = dev->priv; |
1388 | wlan_adapter *adapter = priv->adapter; | 1315 | wlan_adapter *adapter = priv->adapter; |
1389 | 1316 | ||
1390 | ENTER(); | 1317 | lbs_deb_enter(LBS_DEB_WEXT); |
1391 | 1318 | ||
1392 | if (adapter->is_datarate_auto) { | 1319 | if (adapter->is_datarate_auto) { |
1393 | vwrq->fixed = 0; | 1320 | vwrq->fixed = 0; |
@@ -1397,7 +1324,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info, | |||
1397 | 1324 | ||
1398 | vwrq->value = adapter->datarate * 500000; | 1325 | vwrq->value = adapter->datarate * 500000; |
1399 | 1326 | ||
1400 | LEAVE(); | 1327 | lbs_deb_leave(LBS_DEB_WEXT); |
1401 | return 0; | 1328 | return 0; |
1402 | } | 1329 | } |
1403 | 1330 | ||
@@ -1409,12 +1336,12 @@ static int wlan_set_mode(struct net_device *dev, | |||
1409 | wlan_adapter *adapter = priv->adapter; | 1336 | wlan_adapter *adapter = priv->adapter; |
1410 | struct assoc_request * assoc_req; | 1337 | struct assoc_request * assoc_req; |
1411 | 1338 | ||
1412 | ENTER(); | 1339 | lbs_deb_enter(LBS_DEB_WEXT); |
1413 | 1340 | ||
1414 | if ( (*uwrq != IW_MODE_ADHOC) | 1341 | if ( (*uwrq != IW_MODE_ADHOC) |
1415 | && (*uwrq != IW_MODE_INFRA) | 1342 | && (*uwrq != IW_MODE_INFRA) |
1416 | && (*uwrq != IW_MODE_AUTO)) { | 1343 | && (*uwrq != IW_MODE_AUTO)) { |
1417 | lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq); | 1344 | lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq); |
1418 | ret = -EINVAL; | 1345 | ret = -EINVAL; |
1419 | goto out; | 1346 | goto out; |
1420 | } | 1347 | } |
@@ -1428,12 +1355,12 @@ static int wlan_set_mode(struct net_device *dev, | |||
1428 | assoc_req->mode = *uwrq; | 1355 | assoc_req->mode = *uwrq; |
1429 | set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); | 1356 | set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); |
1430 | wlan_postpone_association_work(priv); | 1357 | wlan_postpone_association_work(priv); |
1431 | lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq); | 1358 | lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq); |
1432 | } | 1359 | } |
1433 | mutex_unlock(&adapter->lock); | 1360 | mutex_unlock(&adapter->lock); |
1434 | 1361 | ||
1435 | out: | 1362 | out: |
1436 | LEAVE(); | 1363 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1437 | return ret; | 1364 | return ret; |
1438 | } | 1365 | } |
1439 | 1366 | ||
@@ -1455,9 +1382,9 @@ static int wlan_get_encode(struct net_device *dev, | |||
1455 | wlan_adapter *adapter = priv->adapter; | 1382 | wlan_adapter *adapter = priv->adapter; |
1456 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; | 1383 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; |
1457 | 1384 | ||
1458 | ENTER(); | 1385 | lbs_deb_enter(LBS_DEB_WEXT); |
1459 | 1386 | ||
1460 | lbs_pr_debug(1, "flags=0x%x index=%d length=%d wep_tx_keyidx=%d\n", | 1387 | lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n", |
1461 | dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); | 1388 | dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); |
1462 | 1389 | ||
1463 | dwrq->flags = 0; | 1390 | dwrq->flags = 0; |
@@ -1513,13 +1440,13 @@ static int wlan_get_encode(struct net_device *dev, | |||
1513 | 1440 | ||
1514 | dwrq->flags |= IW_ENCODE_NOKEY; | 1441 | dwrq->flags |= IW_ENCODE_NOKEY; |
1515 | 1442 | ||
1516 | lbs_pr_debug(1, "key:%02x:%02x:%02x:%02x:%02x:%02x keylen=%d\n", | 1443 | lbs_deb_wext("key: " MAC_FMT ", keylen %d\n", |
1517 | extra[0], extra[1], extra[2], | 1444 | extra[0], extra[1], extra[2], |
1518 | extra[3], extra[4], extra[5], dwrq->length); | 1445 | extra[3], extra[4], extra[5], dwrq->length); |
1519 | 1446 | ||
1520 | lbs_pr_debug(1, "Return flags=0x%x\n", dwrq->flags); | 1447 | lbs_deb_wext("return flags 0x%x\n", dwrq->flags); |
1521 | 1448 | ||
1522 | LEAVE(); | 1449 | lbs_deb_leave(LBS_DEB_WEXT); |
1523 | return 0; | 1450 | return 0; |
1524 | } | 1451 | } |
1525 | 1452 | ||
@@ -1539,20 +1466,21 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req, | |||
1539 | u16 index, | 1466 | u16 index, |
1540 | int set_tx_key) | 1467 | int set_tx_key) |
1541 | { | 1468 | { |
1469 | int ret = 0; | ||
1542 | struct WLAN_802_11_KEY *pkey; | 1470 | struct WLAN_802_11_KEY *pkey; |
1543 | 1471 | ||
1544 | ENTER(); | 1472 | lbs_deb_enter(LBS_DEB_WEXT); |
1545 | 1473 | ||
1546 | /* Paranoid validation of key index */ | 1474 | /* Paranoid validation of key index */ |
1547 | if (index > 3) { | 1475 | if (index > 3) { |
1548 | LEAVE(); | 1476 | ret = -EINVAL; |
1549 | return -EINVAL; | 1477 | goto out; |
1550 | } | 1478 | } |
1551 | 1479 | ||
1552 | /* validate max key length */ | 1480 | /* validate max key length */ |
1553 | if (key_length > KEY_LEN_WEP_104) { | 1481 | if (key_length > KEY_LEN_WEP_104) { |
1554 | LEAVE(); | 1482 | ret = -EINVAL; |
1555 | return -EINVAL; | 1483 | goto out; |
1556 | } | 1484 | } |
1557 | 1485 | ||
1558 | pkey = &assoc_req->wep_keys[index]; | 1486 | pkey = &assoc_req->wep_keys[index]; |
@@ -1570,17 +1498,18 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req, | |||
1570 | if (set_tx_key) { | 1498 | if (set_tx_key) { |
1571 | /* Ensure the chosen key is valid */ | 1499 | /* Ensure the chosen key is valid */ |
1572 | if (!pkey->len) { | 1500 | if (!pkey->len) { |
1573 | lbs_pr_debug(1, "key not set, so cannot enable it\n"); | 1501 | lbs_deb_wext("key not set, so cannot enable it\n"); |
1574 | LEAVE(); | 1502 | ret = -EINVAL; |
1575 | return -EINVAL; | 1503 | goto out; |
1576 | } | 1504 | } |
1577 | assoc_req->wep_tx_keyidx = index; | 1505 | assoc_req->wep_tx_keyidx = index; |
1578 | } | 1506 | } |
1579 | 1507 | ||
1580 | assoc_req->secinfo.wep_enabled = 1; | 1508 | assoc_req->secinfo.wep_enabled = 1; |
1581 | 1509 | ||
1582 | LEAVE(); | 1510 | out: |
1583 | return 0; | 1511 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1512 | return ret; | ||
1584 | } | 1513 | } |
1585 | 1514 | ||
1586 | static int validate_key_index(u16 def_index, u16 raw_index, | 1515 | static int validate_key_index(u16 def_index, u16 raw_index, |
@@ -1605,6 +1534,8 @@ static void disable_wep(struct assoc_request *assoc_req) | |||
1605 | { | 1534 | { |
1606 | int i; | 1535 | int i; |
1607 | 1536 | ||
1537 | lbs_deb_enter(LBS_DEB_WEXT); | ||
1538 | |||
1608 | /* Set Open System auth mode */ | 1539 | /* Set Open System auth mode */ |
1609 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; | 1540 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; |
1610 | 1541 | ||
@@ -1615,6 +1546,27 @@ static void disable_wep(struct assoc_request *assoc_req) | |||
1615 | 1546 | ||
1616 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); | 1547 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); |
1617 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); | 1548 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); |
1549 | |||
1550 | lbs_deb_leave(LBS_DEB_WEXT); | ||
1551 | } | ||
1552 | |||
1553 | static void disable_wpa(struct assoc_request *assoc_req) | ||
1554 | { | ||
1555 | lbs_deb_enter(LBS_DEB_WEXT); | ||
1556 | |||
1557 | memset(&assoc_req->wpa_mcast_key, 0, sizeof (struct WLAN_802_11_KEY)); | ||
1558 | assoc_req->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST; | ||
1559 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); | ||
1560 | |||
1561 | memset(&assoc_req->wpa_unicast_key, 0, sizeof (struct WLAN_802_11_KEY)); | ||
1562 | assoc_req->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST; | ||
1563 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1564 | |||
1565 | assoc_req->secinfo.WPAenabled = 0; | ||
1566 | assoc_req->secinfo.WPA2enabled = 0; | ||
1567 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); | ||
1568 | |||
1569 | lbs_deb_leave(LBS_DEB_WEXT); | ||
1618 | } | 1570 | } |
1619 | 1571 | ||
1620 | /** | 1572 | /** |
@@ -1636,7 +1588,7 @@ static int wlan_set_encode(struct net_device *dev, | |||
1636 | struct assoc_request * assoc_req; | 1588 | struct assoc_request * assoc_req; |
1637 | u16 is_default = 0, index = 0, set_tx_key = 0; | 1589 | u16 is_default = 0, index = 0, set_tx_key = 0; |
1638 | 1590 | ||
1639 | ENTER(); | 1591 | lbs_deb_enter(LBS_DEB_WEXT); |
1640 | 1592 | ||
1641 | mutex_lock(&adapter->lock); | 1593 | mutex_lock(&adapter->lock); |
1642 | assoc_req = wlan_get_association_request(adapter); | 1594 | assoc_req = wlan_get_association_request(adapter); |
@@ -1647,6 +1599,7 @@ static int wlan_set_encode(struct net_device *dev, | |||
1647 | 1599 | ||
1648 | if (dwrq->flags & IW_ENCODE_DISABLED) { | 1600 | if (dwrq->flags & IW_ENCODE_DISABLED) { |
1649 | disable_wep (assoc_req); | 1601 | disable_wep (assoc_req); |
1602 | disable_wpa (assoc_req); | ||
1650 | goto out; | 1603 | goto out; |
1651 | } | 1604 | } |
1652 | 1605 | ||
@@ -1688,7 +1641,7 @@ out: | |||
1688 | } | 1641 | } |
1689 | mutex_unlock(&adapter->lock); | 1642 | mutex_unlock(&adapter->lock); |
1690 | 1643 | ||
1691 | LEAVE(); | 1644 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1692 | return ret; | 1645 | return ret; |
1693 | } | 1646 | } |
1694 | 1647 | ||
@@ -1712,7 +1665,7 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1712 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | 1665 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
1713 | int index, max_key_len; | 1666 | int index, max_key_len; |
1714 | 1667 | ||
1715 | ENTER(); | 1668 | lbs_deb_enter(LBS_DEB_WEXT); |
1716 | 1669 | ||
1717 | max_key_len = dwrq->length - sizeof(*ext); | 1670 | max_key_len = dwrq->length - sizeof(*ext); |
1718 | if (max_key_len < 0) | 1671 | if (max_key_len < 0) |
@@ -1748,6 +1701,7 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1748 | if ( adapter->secinfo.wep_enabled | 1701 | if ( adapter->secinfo.wep_enabled |
1749 | && !adapter->secinfo.WPAenabled | 1702 | && !adapter->secinfo.WPAenabled |
1750 | && !adapter->secinfo.WPA2enabled) { | 1703 | && !adapter->secinfo.WPA2enabled) { |
1704 | /* WEP */ | ||
1751 | ext->alg = IW_ENCODE_ALG_WEP; | 1705 | ext->alg = IW_ENCODE_ALG_WEP; |
1752 | ext->key_len = adapter->wep_keys[index].len; | 1706 | ext->key_len = adapter->wep_keys[index].len; |
1753 | key = &adapter->wep_keys[index].key[0]; | 1707 | key = &adapter->wep_keys[index].key[0]; |
@@ -1755,8 +1709,27 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1755 | && (adapter->secinfo.WPAenabled || | 1709 | && (adapter->secinfo.WPAenabled || |
1756 | adapter->secinfo.WPA2enabled)) { | 1710 | adapter->secinfo.WPA2enabled)) { |
1757 | /* WPA */ | 1711 | /* WPA */ |
1758 | ext->alg = IW_ENCODE_ALG_TKIP; | 1712 | struct WLAN_802_11_KEY * pkey = NULL; |
1759 | ext->key_len = 0; | 1713 | |
1714 | if ( adapter->wpa_mcast_key.len | ||
1715 | && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) | ||
1716 | pkey = &adapter->wpa_mcast_key; | ||
1717 | else if ( adapter->wpa_unicast_key.len | ||
1718 | && (adapter->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) | ||
1719 | pkey = &adapter->wpa_unicast_key; | ||
1720 | |||
1721 | if (pkey) { | ||
1722 | if (pkey->type == KEY_TYPE_ID_AES) { | ||
1723 | ext->alg = IW_ENCODE_ALG_CCMP; | ||
1724 | } else { | ||
1725 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
1726 | } | ||
1727 | ext->key_len = pkey->len; | ||
1728 | key = &pkey->key[0]; | ||
1729 | } else { | ||
1730 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
1731 | ext->key_len = 0; | ||
1732 | } | ||
1760 | } else { | 1733 | } else { |
1761 | goto out; | 1734 | goto out; |
1762 | } | 1735 | } |
@@ -1775,7 +1748,7 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1775 | ret = 0; | 1748 | ret = 0; |
1776 | 1749 | ||
1777 | out: | 1750 | out: |
1778 | LEAVE(); | 1751 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1779 | return ret; | 1752 | return ret; |
1780 | } | 1753 | } |
1781 | 1754 | ||
@@ -1800,7 +1773,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1800 | int alg = ext->alg; | 1773 | int alg = ext->alg; |
1801 | struct assoc_request * assoc_req; | 1774 | struct assoc_request * assoc_req; |
1802 | 1775 | ||
1803 | ENTER(); | 1776 | lbs_deb_enter(LBS_DEB_WEXT); |
1804 | 1777 | ||
1805 | mutex_lock(&adapter->lock); | 1778 | mutex_lock(&adapter->lock); |
1806 | assoc_req = wlan_get_association_request(adapter); | 1779 | assoc_req = wlan_get_association_request(adapter); |
@@ -1811,6 +1784,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1811 | 1784 | ||
1812 | if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { | 1785 | if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { |
1813 | disable_wep (assoc_req); | 1786 | disable_wep (assoc_req); |
1787 | disable_wpa (assoc_req); | ||
1814 | } else if (alg == IW_ENCODE_ALG_WEP) { | 1788 | } else if (alg == IW_ENCODE_ALG_WEP) { |
1815 | u16 is_default = 0, index, set_tx_key = 0; | 1789 | u16 is_default = 0, index, set_tx_key = 0; |
1816 | 1790 | ||
@@ -1846,7 +1820,6 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1846 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); | 1820 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); |
1847 | if (set_tx_key) | 1821 | if (set_tx_key) |
1848 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); | 1822 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); |
1849 | |||
1850 | } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { | 1823 | } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { |
1851 | struct WLAN_802_11_KEY * pkey; | 1824 | struct WLAN_802_11_KEY * pkey; |
1852 | 1825 | ||
@@ -1855,36 +1828,43 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1855 | && (ext->key_len != KEY_LEN_WPA_TKIP)) | 1828 | && (ext->key_len != KEY_LEN_WPA_TKIP)) |
1856 | || ((alg == IW_ENCODE_ALG_CCMP) | 1829 | || ((alg == IW_ENCODE_ALG_CCMP) |
1857 | && (ext->key_len != KEY_LEN_WPA_AES))) { | 1830 | && (ext->key_len != KEY_LEN_WPA_AES))) { |
1858 | lbs_pr_debug(1, "Invalid size %d for key of alg" | 1831 | lbs_deb_wext("invalid size %d for key of alg" |
1859 | "type %d.\n", | 1832 | "type %d\n", |
1860 | ext->key_len, | 1833 | ext->key_len, |
1861 | alg); | 1834 | alg); |
1862 | ret = -EINVAL; | 1835 | ret = -EINVAL; |
1863 | goto out; | 1836 | goto out; |
1864 | } | 1837 | } |
1865 | 1838 | ||
1866 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) | 1839 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
1867 | pkey = &assoc_req->wpa_mcast_key; | 1840 | pkey = &assoc_req->wpa_mcast_key; |
1868 | else | 1841 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); |
1842 | } else { | ||
1869 | pkey = &assoc_req->wpa_unicast_key; | 1843 | pkey = &assoc_req->wpa_unicast_key; |
1844 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1845 | } | ||
1870 | 1846 | ||
1871 | memset(pkey, 0, sizeof (struct WLAN_802_11_KEY)); | 1847 | memset(pkey, 0, sizeof (struct WLAN_802_11_KEY)); |
1872 | memcpy(pkey->key, ext->key, ext->key_len); | 1848 | memcpy(pkey->key, ext->key, ext->key_len); |
1873 | pkey->len = ext->key_len; | 1849 | pkey->len = ext->key_len; |
1874 | pkey->flags = KEY_INFO_WPA_ENABLED; | 1850 | if (pkey->len) |
1851 | pkey->flags |= KEY_INFO_WPA_ENABLED; | ||
1875 | 1852 | ||
1853 | /* Do this after zeroing key structure */ | ||
1876 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { | 1854 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
1877 | pkey->flags |= KEY_INFO_WPA_MCAST; | 1855 | pkey->flags |= KEY_INFO_WPA_MCAST; |
1878 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); | ||
1879 | } else { | 1856 | } else { |
1880 | pkey->flags |= KEY_INFO_WPA_UNICAST; | 1857 | pkey->flags |= KEY_INFO_WPA_UNICAST; |
1881 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1882 | } | 1858 | } |
1883 | 1859 | ||
1884 | if (alg == IW_ENCODE_ALG_TKIP) | 1860 | if (alg == IW_ENCODE_ALG_TKIP) { |
1885 | pkey->type = KEY_TYPE_ID_TKIP; | 1861 | pkey->type = KEY_TYPE_ID_TKIP; |
1886 | else if (alg == IW_ENCODE_ALG_CCMP) | 1862 | } else if (alg == IW_ENCODE_ALG_CCMP) { |
1887 | pkey->type = KEY_TYPE_ID_AES; | 1863 | pkey->type = KEY_TYPE_ID_AES; |
1864 | } else { | ||
1865 | ret = -EINVAL; | ||
1866 | goto out; | ||
1867 | } | ||
1888 | 1868 | ||
1889 | /* If WPA isn't enabled yet, do that now */ | 1869 | /* If WPA isn't enabled yet, do that now */ |
1890 | if ( assoc_req->secinfo.WPAenabled == 0 | 1870 | if ( assoc_req->secinfo.WPAenabled == 0 |
@@ -1905,7 +1885,7 @@ out: | |||
1905 | } | 1885 | } |
1906 | mutex_unlock(&adapter->lock); | 1886 | mutex_unlock(&adapter->lock); |
1907 | 1887 | ||
1908 | LEAVE(); | 1888 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1909 | return ret; | 1889 | return ret; |
1910 | } | 1890 | } |
1911 | 1891 | ||
@@ -1920,7 +1900,7 @@ static int wlan_set_genie(struct net_device *dev, | |||
1920 | int ret = 0; | 1900 | int ret = 0; |
1921 | struct assoc_request * assoc_req; | 1901 | struct assoc_request * assoc_req; |
1922 | 1902 | ||
1923 | ENTER(); | 1903 | lbs_deb_enter(LBS_DEB_WEXT); |
1924 | 1904 | ||
1925 | mutex_lock(&adapter->lock); | 1905 | mutex_lock(&adapter->lock); |
1926 | assoc_req = wlan_get_association_request(adapter); | 1906 | assoc_req = wlan_get_association_request(adapter); |
@@ -1952,7 +1932,7 @@ out: | |||
1952 | } | 1932 | } |
1953 | mutex_unlock(&adapter->lock); | 1933 | mutex_unlock(&adapter->lock); |
1954 | 1934 | ||
1955 | LEAVE(); | 1935 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1956 | return ret; | 1936 | return ret; |
1957 | } | 1937 | } |
1958 | 1938 | ||
@@ -1961,27 +1941,28 @@ static int wlan_get_genie(struct net_device *dev, | |||
1961 | struct iw_point *dwrq, | 1941 | struct iw_point *dwrq, |
1962 | char *extra) | 1942 | char *extra) |
1963 | { | 1943 | { |
1944 | int ret = 0; | ||
1964 | wlan_private *priv = dev->priv; | 1945 | wlan_private *priv = dev->priv; |
1965 | wlan_adapter *adapter = priv->adapter; | 1946 | wlan_adapter *adapter = priv->adapter; |
1966 | 1947 | ||
1967 | ENTER(); | 1948 | lbs_deb_enter(LBS_DEB_WEXT); |
1968 | 1949 | ||
1969 | if (adapter->wpa_ie_len == 0) { | 1950 | if (adapter->wpa_ie_len == 0) { |
1970 | dwrq->length = 0; | 1951 | dwrq->length = 0; |
1971 | LEAVE(); | 1952 | goto out; |
1972 | return 0; | ||
1973 | } | 1953 | } |
1974 | 1954 | ||
1975 | if (dwrq->length < adapter->wpa_ie_len) { | 1955 | if (dwrq->length < adapter->wpa_ie_len) { |
1976 | LEAVE(); | 1956 | ret = -E2BIG; |
1977 | return -E2BIG; | 1957 | goto out; |
1978 | } | 1958 | } |
1979 | 1959 | ||
1980 | dwrq->length = adapter->wpa_ie_len; | 1960 | dwrq->length = adapter->wpa_ie_len; |
1981 | memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); | 1961 | memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); |
1982 | 1962 | ||
1983 | LEAVE(); | 1963 | out: |
1984 | return 0; | 1964 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1965 | return ret; | ||
1985 | } | 1966 | } |
1986 | 1967 | ||
1987 | 1968 | ||
@@ -1996,7 +1977,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
1996 | int ret = 0; | 1977 | int ret = 0; |
1997 | int updated = 0; | 1978 | int updated = 0; |
1998 | 1979 | ||
1999 | ENTER(); | 1980 | lbs_deb_enter(LBS_DEB_WEXT); |
2000 | 1981 | ||
2001 | mutex_lock(&adapter->lock); | 1982 | mutex_lock(&adapter->lock); |
2002 | assoc_req = wlan_get_association_request(adapter); | 1983 | assoc_req = wlan_get_association_request(adapter); |
@@ -2010,6 +1991,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
2010 | case IW_AUTH_CIPHER_PAIRWISE: | 1991 | case IW_AUTH_CIPHER_PAIRWISE: |
2011 | case IW_AUTH_CIPHER_GROUP: | 1992 | case IW_AUTH_CIPHER_GROUP: |
2012 | case IW_AUTH_KEY_MGMT: | 1993 | case IW_AUTH_KEY_MGMT: |
1994 | case IW_AUTH_DROP_UNENCRYPTED: | ||
2013 | /* | 1995 | /* |
2014 | * libertas does not use these parameters | 1996 | * libertas does not use these parameters |
2015 | */ | 1997 | */ |
@@ -2019,6 +2001,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
2019 | if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { | 2001 | if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { |
2020 | assoc_req->secinfo.WPAenabled = 0; | 2002 | assoc_req->secinfo.WPAenabled = 0; |
2021 | assoc_req->secinfo.WPA2enabled = 0; | 2003 | assoc_req->secinfo.WPA2enabled = 0; |
2004 | disable_wpa (assoc_req); | ||
2022 | } | 2005 | } |
2023 | if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { | 2006 | if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { |
2024 | assoc_req->secinfo.WPAenabled = 1; | 2007 | assoc_req->secinfo.WPAenabled = 1; |
@@ -2033,17 +2016,6 @@ static int wlan_set_auth(struct net_device *dev, | |||
2033 | updated = 1; | 2016 | updated = 1; |
2034 | break; | 2017 | break; |
2035 | 2018 | ||
2036 | case IW_AUTH_DROP_UNENCRYPTED: | ||
2037 | if (dwrq->value) { | ||
2038 | adapter->currentpacketfilter |= | ||
2039 | cmd_act_mac_strict_protection_enable; | ||
2040 | } else { | ||
2041 | adapter->currentpacketfilter &= | ||
2042 | ~cmd_act_mac_strict_protection_enable; | ||
2043 | } | ||
2044 | updated = 1; | ||
2045 | break; | ||
2046 | |||
2047 | case IW_AUTH_80211_AUTH_ALG: | 2019 | case IW_AUTH_80211_AUTH_ALG: |
2048 | if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { | 2020 | if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { |
2049 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; | 2021 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; |
@@ -2069,6 +2041,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
2069 | } else { | 2041 | } else { |
2070 | assoc_req->secinfo.WPAenabled = 0; | 2042 | assoc_req->secinfo.WPAenabled = 0; |
2071 | assoc_req->secinfo.WPA2enabled = 0; | 2043 | assoc_req->secinfo.WPA2enabled = 0; |
2044 | disable_wpa (assoc_req); | ||
2072 | } | 2045 | } |
2073 | updated = 1; | 2046 | updated = 1; |
2074 | break; | 2047 | break; |
@@ -2088,7 +2061,7 @@ out: | |||
2088 | } | 2061 | } |
2089 | mutex_unlock(&adapter->lock); | 2062 | mutex_unlock(&adapter->lock); |
2090 | 2063 | ||
2091 | LEAVE(); | 2064 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
2092 | return ret; | 2065 | return ret; |
2093 | } | 2066 | } |
2094 | 2067 | ||
@@ -2097,10 +2070,11 @@ static int wlan_get_auth(struct net_device *dev, | |||
2097 | struct iw_param *dwrq, | 2070 | struct iw_param *dwrq, |
2098 | char *extra) | 2071 | char *extra) |
2099 | { | 2072 | { |
2073 | int ret = 0; | ||
2100 | wlan_private *priv = dev->priv; | 2074 | wlan_private *priv = dev->priv; |
2101 | wlan_adapter *adapter = priv->adapter; | 2075 | wlan_adapter *adapter = priv->adapter; |
2102 | 2076 | ||
2103 | ENTER(); | 2077 | lbs_deb_enter(LBS_DEB_WEXT); |
2104 | 2078 | ||
2105 | switch (dwrq->flags & IW_AUTH_INDEX) { | 2079 | switch (dwrq->flags & IW_AUTH_INDEX) { |
2106 | case IW_AUTH_WPA_VERSION: | 2080 | case IW_AUTH_WPA_VERSION: |
@@ -2113,13 +2087,6 @@ static int wlan_get_auth(struct net_device *dev, | |||
2113 | dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; | 2087 | dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; |
2114 | break; | 2088 | break; |
2115 | 2089 | ||
2116 | case IW_AUTH_DROP_UNENCRYPTED: | ||
2117 | dwrq->value = 0; | ||
2118 | if (adapter->currentpacketfilter & | ||
2119 | cmd_act_mac_strict_protection_enable) | ||
2120 | dwrq->value = 1; | ||
2121 | break; | ||
2122 | |||
2123 | case IW_AUTH_80211_AUTH_ALG: | 2090 | case IW_AUTH_80211_AUTH_ALG: |
2124 | dwrq->value = adapter->secinfo.auth_mode; | 2091 | dwrq->value = adapter->secinfo.auth_mode; |
2125 | break; | 2092 | break; |
@@ -2130,12 +2097,11 @@ static int wlan_get_auth(struct net_device *dev, | |||
2130 | break; | 2097 | break; |
2131 | 2098 | ||
2132 | default: | 2099 | default: |
2133 | LEAVE(); | 2100 | ret = -EOPNOTSUPP; |
2134 | return -EOPNOTSUPP; | ||
2135 | } | 2101 | } |
2136 | 2102 | ||
2137 | LEAVE(); | 2103 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
2138 | return 0; | 2104 | return ret; |
2139 | } | 2105 | } |
2140 | 2106 | ||
2141 | 2107 | ||
@@ -2148,7 +2114,7 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info, | |||
2148 | 2114 | ||
2149 | u16 dbm; | 2115 | u16 dbm; |
2150 | 2116 | ||
2151 | ENTER(); | 2117 | lbs_deb_enter(LBS_DEB_WEXT); |
2152 | 2118 | ||
2153 | if (vwrq->disabled) { | 2119 | if (vwrq->disabled) { |
2154 | wlan_radio_ioctl(priv, RADIO_OFF); | 2120 | wlan_radio_ioctl(priv, RADIO_OFF); |
@@ -2169,14 +2135,14 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info, | |||
2169 | if (vwrq->fixed == 0) | 2135 | if (vwrq->fixed == 0) |
2170 | dbm = 0xffff; | 2136 | dbm = 0xffff; |
2171 | 2137 | ||
2172 | lbs_pr_debug(1, "<1>TXPOWER SET %d dbm.\n", dbm); | 2138 | lbs_deb_wext("txpower set %d dbm\n", dbm); |
2173 | 2139 | ||
2174 | ret = libertas_prepare_and_send_command(priv, | 2140 | ret = libertas_prepare_and_send_command(priv, |
2175 | cmd_802_11_rf_tx_power, | 2141 | cmd_802_11_rf_tx_power, |
2176 | cmd_act_tx_power_opt_set_low, | 2142 | cmd_act_tx_power_opt_set_low, |
2177 | cmd_option_waitforrsp, 0, (void *)&dbm); | 2143 | cmd_option_waitforrsp, 0, (void *)&dbm); |
2178 | 2144 | ||
2179 | LEAVE(); | 2145 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
2180 | return ret; | 2146 | return ret; |
2181 | } | 2147 | } |
2182 | 2148 | ||
@@ -2186,7 +2152,8 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2186 | wlan_private *priv = dev->priv; | 2152 | wlan_private *priv = dev->priv; |
2187 | wlan_adapter *adapter = priv->adapter; | 2153 | wlan_adapter *adapter = priv->adapter; |
2188 | 2154 | ||
2189 | ENTER(); | 2155 | lbs_deb_enter(LBS_DEB_WEXT); |
2156 | |||
2190 | /* | 2157 | /* |
2191 | * Note : if dwrq->flags != 0, we should get the relevant SSID from | 2158 | * Note : if dwrq->flags != 0, we should get the relevant SSID from |
2192 | * the SSID list... | 2159 | * the SSID list... |
@@ -2196,12 +2163,12 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2196 | * Get the current SSID | 2163 | * Get the current SSID |
2197 | */ | 2164 | */ |
2198 | if (adapter->connect_status == libertas_connected) { | 2165 | if (adapter->connect_status == libertas_connected) { |
2199 | memcpy(extra, adapter->curbssparams.ssid.ssid, | 2166 | memcpy(extra, adapter->curbssparams.ssid, |
2200 | adapter->curbssparams.ssid.ssidlength); | 2167 | adapter->curbssparams.ssid_len); |
2201 | extra[adapter->curbssparams.ssid.ssidlength] = '\0'; | 2168 | extra[adapter->curbssparams.ssid_len] = '\0'; |
2202 | } else { | 2169 | } else { |
2203 | memset(extra, 0, 32); | 2170 | memset(extra, 0, 32); |
2204 | extra[adapter->curbssparams.ssid.ssidlength] = '\0'; | 2171 | extra[adapter->curbssparams.ssid_len] = '\0'; |
2205 | } | 2172 | } |
2206 | /* | 2173 | /* |
2207 | * If none, we may want to get the one that was set | 2174 | * If none, we may want to get the one that was set |
@@ -2209,14 +2176,14 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2209 | 2176 | ||
2210 | /* To make the driver backward compatible with WPA supplicant v0.2.4 */ | 2177 | /* To make the driver backward compatible with WPA supplicant v0.2.4 */ |
2211 | if (dwrq->length == 32) /* check with WPA supplicant buffer size */ | 2178 | if (dwrq->length == 32) /* check with WPA supplicant buffer size */ |
2212 | dwrq->length = min_t(size_t, adapter->curbssparams.ssid.ssidlength, | 2179 | dwrq->length = min_t(size_t, adapter->curbssparams.ssid_len, |
2213 | IW_ESSID_MAX_SIZE); | 2180 | IW_ESSID_MAX_SIZE); |
2214 | else | 2181 | else |
2215 | dwrq->length = adapter->curbssparams.ssid.ssidlength + 1; | 2182 | dwrq->length = adapter->curbssparams.ssid_len + 1; |
2216 | 2183 | ||
2217 | dwrq->flags = 1; /* active */ | 2184 | dwrq->flags = 1; /* active */ |
2218 | 2185 | ||
2219 | LEAVE(); | 2186 | lbs_deb_leave(LBS_DEB_WEXT); |
2220 | return 0; | 2187 | return 0; |
2221 | } | 2188 | } |
2222 | 2189 | ||
@@ -2226,38 +2193,43 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info, | |||
2226 | wlan_private *priv = dev->priv; | 2193 | wlan_private *priv = dev->priv; |
2227 | wlan_adapter *adapter = priv->adapter; | 2194 | wlan_adapter *adapter = priv->adapter; |
2228 | int ret = 0; | 2195 | int ret = 0; |
2229 | struct WLAN_802_11_SSID ssid; | 2196 | u8 ssid[IW_ESSID_MAX_SIZE]; |
2197 | u8 ssid_len = 0; | ||
2230 | struct assoc_request * assoc_req; | 2198 | struct assoc_request * assoc_req; |
2231 | int ssid_len = dwrq->length; | 2199 | int in_ssid_len = dwrq->length; |
2232 | 2200 | ||
2233 | ENTER(); | 2201 | lbs_deb_enter(LBS_DEB_WEXT); |
2234 | 2202 | ||
2235 | /* | 2203 | /* |
2236 | * WE-20 and earlier NULL pad the end of the SSID and increment | 2204 | * WE-20 and earlier NULL pad the end of the SSID and increment |
2237 | * SSID length so it can be used like a string. WE-21 and later don't, | 2205 | * SSID length so it can be used like a string. WE-21 and later don't, |
2238 | * but some userspace tools aren't able to cope with the change. | 2206 | * but some userspace tools aren't able to cope with the change. |
2239 | */ | 2207 | */ |
2240 | if ((ssid_len > 0) && (extra[ssid_len - 1] == '\0')) | 2208 | if ((in_ssid_len > 0) && (extra[in_ssid_len - 1] == '\0')) |
2241 | ssid_len--; | 2209 | in_ssid_len--; |
2242 | 2210 | ||
2243 | /* Check the size of the string */ | 2211 | /* Check the size of the string */ |
2244 | if (ssid_len > IW_ESSID_MAX_SIZE) { | 2212 | if (in_ssid_len > IW_ESSID_MAX_SIZE) { |
2245 | ret = -E2BIG; | 2213 | ret = -E2BIG; |
2246 | goto out; | 2214 | goto out; |
2247 | } | 2215 | } |
2248 | 2216 | ||
2249 | memset(&ssid, 0, sizeof(struct WLAN_802_11_SSID)); | 2217 | memset(&ssid, 0, sizeof(ssid)); |
2250 | 2218 | ||
2251 | if (!dwrq->flags || !ssid_len) { | 2219 | if (!dwrq->flags || !in_ssid_len) { |
2252 | /* "any" SSID requested; leave SSID blank */ | 2220 | /* "any" SSID requested; leave SSID blank */ |
2253 | } else { | 2221 | } else { |
2254 | /* Specific SSID requested */ | 2222 | /* Specific SSID requested */ |
2255 | memcpy(&ssid.ssid, extra, ssid_len); | 2223 | memcpy(&ssid, extra, in_ssid_len); |
2256 | ssid.ssidlength = ssid_len; | 2224 | ssid_len = in_ssid_len; |
2257 | } | 2225 | } |
2258 | 2226 | ||
2259 | lbs_pr_debug(1, "Requested new SSID = %s\n", | 2227 | if (!ssid_len) { |
2260 | (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any"); | 2228 | lbs_deb_wext("requested any SSID\n"); |
2229 | } else { | ||
2230 | lbs_deb_wext("requested SSID '%s'\n", | ||
2231 | escape_essid(ssid, ssid_len)); | ||
2232 | } | ||
2261 | 2233 | ||
2262 | out: | 2234 | out: |
2263 | mutex_lock(&adapter->lock); | 2235 | mutex_lock(&adapter->lock); |
@@ -2268,7 +2240,8 @@ out: | |||
2268 | ret = -ENOMEM; | 2240 | ret = -ENOMEM; |
2269 | } else { | 2241 | } else { |
2270 | /* Copy the SSID to the association request */ | 2242 | /* Copy the SSID to the association request */ |
2271 | memcpy(&assoc_req->ssid, &ssid, sizeof(struct WLAN_802_11_SSID)); | 2243 | memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE); |
2244 | assoc_req->ssid_len = ssid_len; | ||
2272 | set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); | 2245 | set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); |
2273 | wlan_postpone_association_work(priv); | 2246 | wlan_postpone_association_work(priv); |
2274 | } | 2247 | } |
@@ -2281,7 +2254,7 @@ out: | |||
2281 | 2254 | ||
2282 | mutex_unlock(&adapter->lock); | 2255 | mutex_unlock(&adapter->lock); |
2283 | 2256 | ||
2284 | LEAVE(); | 2257 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
2285 | return ret; | 2258 | return ret; |
2286 | } | 2259 | } |
2287 | 2260 | ||
@@ -2302,12 +2275,12 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info, | |||
2302 | struct assoc_request * assoc_req; | 2275 | struct assoc_request * assoc_req; |
2303 | int ret = 0; | 2276 | int ret = 0; |
2304 | 2277 | ||
2305 | ENTER(); | 2278 | lbs_deb_enter(LBS_DEB_WEXT); |
2306 | 2279 | ||
2307 | if (awrq->sa_family != ARPHRD_ETHER) | 2280 | if (awrq->sa_family != ARPHRD_ETHER) |
2308 | return -EINVAL; | 2281 | return -EINVAL; |
2309 | 2282 | ||
2310 | lbs_pr_debug(1, "ASSOC: WAP: sa_data: " MAC_FMT "\n", MAC_ARG(awrq->sa_data)); | 2283 | lbs_deb_wext("ASSOC: WAP: sa_data " MAC_FMT "\n", MAC_ARG(awrq->sa_data)); |
2311 | 2284 | ||
2312 | mutex_lock(&adapter->lock); | 2285 | mutex_lock(&adapter->lock); |
2313 | 2286 | ||
@@ -2330,22 +2303,23 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info, | |||
2330 | 2303 | ||
2331 | void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen) | 2304 | void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen) |
2332 | { | 2305 | { |
2333 | union { | ||
2334 | u32 l; | ||
2335 | u8 c[4]; | ||
2336 | } ver; | ||
2337 | char fwver[32]; | 2306 | char fwver[32]; |
2338 | 2307 | ||
2339 | mutex_lock(&adapter->lock); | 2308 | mutex_lock(&adapter->lock); |
2340 | ver.l = adapter->fwreleasenumber; | ||
2341 | mutex_unlock(&adapter->lock); | ||
2342 | 2309 | ||
2343 | if (ver.c[3] == 0) | 2310 | if (adapter->fwreleasenumber[3] == 0) |
2344 | sprintf(fwver, "%u.%u.%u", ver.c[2], ver.c[1], ver.c[0]); | 2311 | sprintf(fwver, "%u.%u.%u", |
2312 | adapter->fwreleasenumber[2], | ||
2313 | adapter->fwreleasenumber[1], | ||
2314 | adapter->fwreleasenumber[0]); | ||
2345 | else | 2315 | else |
2346 | sprintf(fwver, "%u.%u.%u.p%u", | 2316 | sprintf(fwver, "%u.%u.%u.p%u", |
2347 | ver.c[2], ver.c[1], ver.c[0], ver.c[3]); | 2317 | adapter->fwreleasenumber[2], |
2318 | adapter->fwreleasenumber[1], | ||
2319 | adapter->fwreleasenumber[0], | ||
2320 | adapter->fwreleasenumber[3]); | ||
2348 | 2321 | ||
2322 | mutex_unlock(&adapter->lock); | ||
2349 | snprintf(fwversion, maxlen, fwver); | 2323 | snprintf(fwversion, maxlen, fwver); |
2350 | } | 2324 | } |
2351 | 2325 | ||
@@ -2411,6 +2385,63 @@ static const iw_handler wlan_handler[] = { | |||
2411 | (iw_handler) NULL, /* SIOCSIWPMKSA */ | 2385 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
2412 | }; | 2386 | }; |
2413 | 2387 | ||
2388 | static const iw_handler mesh_wlan_handler[] = { | ||
2389 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ | ||
2390 | (iw_handler) wlan_get_name, /* SIOCGIWNAME */ | ||
2391 | (iw_handler) NULL, /* SIOCSIWNWID */ | ||
2392 | (iw_handler) NULL, /* SIOCGIWNWID */ | ||
2393 | (iw_handler) wlan_set_freq, /* SIOCSIWFREQ */ | ||
2394 | (iw_handler) wlan_get_freq, /* SIOCGIWFREQ */ | ||
2395 | (iw_handler) NULL, /* SIOCSIWMODE */ | ||
2396 | (iw_handler) mesh_wlan_get_mode, /* SIOCGIWMODE */ | ||
2397 | (iw_handler) NULL, /* SIOCSIWSENS */ | ||
2398 | (iw_handler) NULL, /* SIOCGIWSENS */ | ||
2399 | (iw_handler) NULL, /* SIOCSIWRANGE */ | ||
2400 | (iw_handler) wlan_get_range, /* SIOCGIWRANGE */ | ||
2401 | (iw_handler) NULL, /* SIOCSIWPRIV */ | ||
2402 | (iw_handler) NULL, /* SIOCGIWPRIV */ | ||
2403 | (iw_handler) NULL, /* SIOCSIWSTATS */ | ||
2404 | (iw_handler) NULL, /* SIOCGIWSTATS */ | ||
2405 | iw_handler_set_spy, /* SIOCSIWSPY */ | ||
2406 | iw_handler_get_spy, /* SIOCGIWSPY */ | ||
2407 | iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ | ||
2408 | iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ | ||
2409 | (iw_handler) NULL, /* SIOCSIWAP */ | ||
2410 | (iw_handler) NULL, /* SIOCGIWAP */ | ||
2411 | (iw_handler) NULL, /* SIOCSIWMLME */ | ||
2412 | (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */ | ||
2413 | (iw_handler) libertas_set_scan, /* SIOCSIWSCAN */ | ||
2414 | (iw_handler) libertas_get_scan, /* SIOCGIWSCAN */ | ||
2415 | (iw_handler) NULL, /* SIOCSIWESSID */ | ||
2416 | (iw_handler) NULL, /* SIOCGIWESSID */ | ||
2417 | (iw_handler) NULL, /* SIOCSIWNICKN */ | ||
2418 | (iw_handler) mesh_get_nick, /* SIOCGIWNICKN */ | ||
2419 | (iw_handler) NULL, /* -- hole -- */ | ||
2420 | (iw_handler) NULL, /* -- hole -- */ | ||
2421 | (iw_handler) wlan_set_rate, /* SIOCSIWRATE */ | ||
2422 | (iw_handler) wlan_get_rate, /* SIOCGIWRATE */ | ||
2423 | (iw_handler) wlan_set_rts, /* SIOCSIWRTS */ | ||
2424 | (iw_handler) wlan_get_rts, /* SIOCGIWRTS */ | ||
2425 | (iw_handler) wlan_set_frag, /* SIOCSIWFRAG */ | ||
2426 | (iw_handler) wlan_get_frag, /* SIOCGIWFRAG */ | ||
2427 | (iw_handler) wlan_set_txpow, /* SIOCSIWTXPOW */ | ||
2428 | (iw_handler) wlan_get_txpow, /* SIOCGIWTXPOW */ | ||
2429 | (iw_handler) wlan_set_retry, /* SIOCSIWRETRY */ | ||
2430 | (iw_handler) wlan_get_retry, /* SIOCGIWRETRY */ | ||
2431 | (iw_handler) wlan_set_encode, /* SIOCSIWENCODE */ | ||
2432 | (iw_handler) wlan_get_encode, /* SIOCGIWENCODE */ | ||
2433 | (iw_handler) wlan_set_power, /* SIOCSIWPOWER */ | ||
2434 | (iw_handler) wlan_get_power, /* SIOCGIWPOWER */ | ||
2435 | (iw_handler) NULL, /* -- hole -- */ | ||
2436 | (iw_handler) NULL, /* -- hole -- */ | ||
2437 | (iw_handler) wlan_set_genie, /* SIOCSIWGENIE */ | ||
2438 | (iw_handler) wlan_get_genie, /* SIOCGIWGENIE */ | ||
2439 | (iw_handler) wlan_set_auth, /* SIOCSIWAUTH */ | ||
2440 | (iw_handler) wlan_get_auth, /* SIOCGIWAUTH */ | ||
2441 | (iw_handler) wlan_set_encodeext,/* SIOCSIWENCODEEXT */ | ||
2442 | (iw_handler) wlan_get_encodeext,/* SIOCGIWENCODEEXT */ | ||
2443 | (iw_handler) NULL, /* SIOCSIWPMKSA */ | ||
2444 | }; | ||
2414 | struct iw_handler_def libertas_handler_def = { | 2445 | struct iw_handler_def libertas_handler_def = { |
2415 | .num_standard = sizeof(wlan_handler) / sizeof(iw_handler), | 2446 | .num_standard = sizeof(wlan_handler) / sizeof(iw_handler), |
2416 | .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler), | 2447 | .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler), |
@@ -2421,3 +2452,14 @@ struct iw_handler_def libertas_handler_def = { | |||
2421 | .private_args = (struct iw_priv_args *)wlan_private_args, | 2452 | .private_args = (struct iw_priv_args *)wlan_private_args, |
2422 | .get_wireless_stats = wlan_get_wireless_stats, | 2453 | .get_wireless_stats = wlan_get_wireless_stats, |
2423 | }; | 2454 | }; |
2455 | |||
2456 | struct iw_handler_def mesh_handler_def = { | ||
2457 | .num_standard = sizeof(mesh_wlan_handler) / sizeof(iw_handler), | ||
2458 | .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler), | ||
2459 | .num_private_args = sizeof(wlan_private_args) / | ||
2460 | sizeof(struct iw_priv_args), | ||
2461 | .standard = (iw_handler *) mesh_wlan_handler, | ||
2462 | .private = (iw_handler *) wlan_private_handler, | ||
2463 | .private_args = (struct iw_priv_args *)wlan_private_args, | ||
2464 | .get_wireless_stats = wlan_get_wireless_stats, | ||
2465 | }; | ||