ext4: reduce contention on s_orphan_lock
[linux/fpc-iii.git] / drivers / staging / wlan-ng / prism2sta.c
blobf9ccf2371dba0a40f8cea7324d9b95f7cf765898
1 /* src/prism2/driver/prism2sta.c
3 * Implements the station functionality for prism2
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
6 * --------------------------------------------------------------------
8 * linux-wlan
10 * The contents of this file are subject to the Mozilla Public
11 * License Version 1.1 (the "License"); you may not use this file
12 * except in compliance with the License. You may obtain a copy of
13 * the License at http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS
16 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17 * implied. See the License for the specific language governing
18 * rights and limitations under the License.
20 * Alternatively, the contents of this file may be used under the
21 * terms of the GNU Public License version 2 (the "GPL"), in which
22 * case the provisions of the GPL are applicable instead of the
23 * above. If you wish to allow the use of your version of this file
24 * only under the terms of the GPL and not to allow others to use
25 * your version of this file under the MPL, indicate your decision
26 * by deleting the provisions above and replace them with the notice
27 * and other provisions required by the GPL. If you do not delete
28 * the provisions above, a recipient may use your version of this
29 * file under either the MPL or the GPL.
31 * --------------------------------------------------------------------
33 * Inquiries regarding the linux-wlan Open Source project can be
34 * made directly to:
36 * AbsoluteValue Systems Inc.
37 * info@linux-wlan.com
38 * http://www.linux-wlan.com
40 * --------------------------------------------------------------------
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
45 * --------------------------------------------------------------------
47 * This file implements the module and linux pcmcia routines for the
48 * prism2 driver.
50 * --------------------------------------------------------------------
53 #include <linux/module.h>
54 #include <linux/moduleparam.h>
55 #include <linux/kernel.h>
56 #include <linux/sched.h>
57 #include <linux/types.h>
58 #include <linux/slab.h>
59 #include <linux/wireless.h>
60 #include <linux/netdevice.h>
61 #include <linux/workqueue.h>
62 #include <linux/byteorder/generic.h>
63 #include <linux/ctype.h>
65 #include <linux/io.h>
66 #include <linux/delay.h>
67 #include <asm/byteorder.h>
68 #include <linux/if_arp.h>
69 #include <linux/if_ether.h>
70 #include <linux/bitops.h>
72 #include "p80211types.h"
73 #include "p80211hdr.h"
74 #include "p80211mgmt.h"
75 #include "p80211conv.h"
76 #include "p80211msg.h"
77 #include "p80211netdev.h"
78 #include "p80211req.h"
79 #include "p80211metadef.h"
80 #include "p80211metastruct.h"
81 #include "hfa384x.h"
82 #include "prism2mgmt.h"
84 /* Create a string of printable chars from something that might not be */
85 /* It's recommended that the str be 4*len + 1 bytes long */
86 #define wlan_mkprintstr(buf, buflen, str, strlen) \
87 { \
88 int i = 0; \
89 int j = 0; \
90 memset(str, 0, (strlen)); \
91 for (i = 0; i < (buflen); i++) { \
92 if (isprint((buf)[i])) { \
93 (str)[j] = (buf)[i]; \
94 j++; \
95 } else { \
96 (str)[j] = '\\'; \
97 (str)[j+1] = 'x'; \
98 (str)[j+2] = hex_asc_hi((buf)[i]); \
99 (str)[j+3] = hex_asc_lo((buf)[i]); \
100 j += 4; \
105 static char *dev_info = "prism2_usb";
106 static wlandevice_t *create_wlan(void);
108 int prism2_reset_holdtime = 30; /* Reset hold time in ms */
109 int prism2_reset_settletime = 100; /* Reset settle time in ms */
111 static int prism2_doreset; /* Do a reset at init? */
113 module_param(prism2_doreset, int, 0644);
114 MODULE_PARM_DESC(prism2_doreset, "Issue a reset on initialization");
116 module_param(prism2_reset_holdtime, int, 0644);
117 MODULE_PARM_DESC(prism2_reset_holdtime, "reset hold time in ms");
118 module_param(prism2_reset_settletime, int, 0644);
119 MODULE_PARM_DESC(prism2_reset_settletime, "reset settle time in ms");
121 MODULE_LICENSE("Dual MPL/GPL");
123 void prism2_connect_result(wlandevice_t *wlandev, u8 failed);
124 void prism2_disconnected(wlandevice_t *wlandev);
125 void prism2_roamed(wlandevice_t *wlandev);
127 static int prism2sta_open(wlandevice_t *wlandev);
128 static int prism2sta_close(wlandevice_t *wlandev);
129 static void prism2sta_reset(wlandevice_t *wlandev);
130 static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
131 union p80211_hdr *p80211_hdr,
132 struct p80211_metawep *p80211_wep);
133 static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg);
134 static int prism2sta_getcardinfo(wlandevice_t *wlandev);
135 static int prism2sta_globalsetup(wlandevice_t *wlandev);
136 static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev);
138 static void prism2sta_inf_handover(wlandevice_t *wlandev,
139 hfa384x_InfFrame_t *inf);
140 static void prism2sta_inf_tallies(wlandevice_t *wlandev,
141 hfa384x_InfFrame_t *inf);
142 static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
143 hfa384x_InfFrame_t *inf);
144 static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
145 hfa384x_InfFrame_t *inf);
146 static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
147 hfa384x_InfFrame_t *inf);
148 static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
149 hfa384x_InfFrame_t *inf);
150 static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
151 hfa384x_InfFrame_t *inf);
152 static void prism2sta_inf_authreq(wlandevice_t *wlandev,
153 hfa384x_InfFrame_t *inf);
154 static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
155 hfa384x_InfFrame_t *inf);
156 static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
157 hfa384x_InfFrame_t *inf);
159 /*----------------------------------------------------------------
160 * prism2sta_open
162 * WLAN device open method. Called from p80211netdev when kernel
163 * device open (start) method is called in response to the
164 * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP
165 * from clear to set.
167 * Arguments:
168 * wlandev wlan device structure
170 * Returns:
171 * 0 success
172 * >0 f/w reported error
173 * <0 driver reported error
175 * Side effects:
177 * Call context:
178 * process thread
179 ----------------------------------------------------------------*/
180 static int prism2sta_open(wlandevice_t *wlandev)
182 /* We don't currently have to do anything else.
183 * The setup of the MAC should be subsequently completed via
184 * the mlme commands.
185 * Higher layers know we're ready from dev->start==1 and
186 * dev->tbusy==0. Our rx path knows to pass up received/
187 * frames because of dev->flags&IFF_UP is true.
190 return 0;
193 /*----------------------------------------------------------------
194 * prism2sta_close
196 * WLAN device close method. Called from p80211netdev when kernel
197 * device close method is called in response to the
198 * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP
199 * from set to clear.
201 * Arguments:
202 * wlandev wlan device structure
204 * Returns:
205 * 0 success
206 * >0 f/w reported error
207 * <0 driver reported error
209 * Side effects:
211 * Call context:
212 * process thread
213 ----------------------------------------------------------------*/
214 static int prism2sta_close(wlandevice_t *wlandev)
216 /* We don't currently have to do anything else.
217 * Higher layers know we're not ready from dev->start==0 and
218 * dev->tbusy==1. Our rx path knows to not pass up received
219 * frames because of dev->flags&IFF_UP is false.
222 return 0;
225 /*----------------------------------------------------------------
226 * prism2sta_reset
228 * Not currently implented.
230 * Arguments:
231 * wlandev wlan device structure
232 * none
234 * Returns:
235 * nothing
237 * Side effects:
239 * Call context:
240 * process thread
241 ----------------------------------------------------------------*/
242 static void prism2sta_reset(wlandevice_t *wlandev)
246 /*----------------------------------------------------------------
247 * prism2sta_txframe
249 * Takes a frame from p80211 and queues it for transmission.
251 * Arguments:
252 * wlandev wlan device structure
253 * pb packet buffer struct. Contains an 802.11
254 * data frame.
255 * p80211_hdr points to the 802.11 header for the packet.
256 * Returns:
257 * 0 Success and more buffs available
258 * 1 Success but no more buffs
259 * 2 Allocation failure
260 * 4 Buffer full or queue busy
262 * Side effects:
264 * Call context:
265 * process thread
266 ----------------------------------------------------------------*/
267 static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
268 union p80211_hdr *p80211_hdr,
269 struct p80211_metawep *p80211_wep)
271 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
272 int result;
274 /* If necessary, set the 802.11 WEP bit */
275 if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) ==
276 HOSTWEP_PRIVACYINVOKED) {
277 p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
280 result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep);
282 return result;
285 /*----------------------------------------------------------------
286 * prism2sta_mlmerequest
288 * wlan command message handler. All we do here is pass the message
289 * over to the prism2sta_mgmt_handler.
291 * Arguments:
292 * wlandev wlan device structure
293 * msg wlan command message
294 * Returns:
295 * 0 success
296 * <0 successful acceptance of message, but we're
297 * waiting for an async process to finish before
298 * we're done with the msg. When the asynch
299 * process is done, we'll call the p80211
300 * function p80211req_confirm() .
301 * >0 An error occurred while we were handling
302 * the message.
304 * Side effects:
306 * Call context:
307 * process thread
308 ----------------------------------------------------------------*/
309 static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg)
311 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
313 int result = 0;
315 switch (msg->msgcode) {
316 case DIDmsg_dot11req_mibget:
317 pr_debug("Received mibget request\n");
318 result = prism2mgmt_mibset_mibget(wlandev, msg);
319 break;
320 case DIDmsg_dot11req_mibset:
321 pr_debug("Received mibset request\n");
322 result = prism2mgmt_mibset_mibget(wlandev, msg);
323 break;
324 case DIDmsg_dot11req_scan:
325 pr_debug("Received scan request\n");
326 result = prism2mgmt_scan(wlandev, msg);
327 break;
328 case DIDmsg_dot11req_scan_results:
329 pr_debug("Received scan_results request\n");
330 result = prism2mgmt_scan_results(wlandev, msg);
331 break;
332 case DIDmsg_dot11req_start:
333 pr_debug("Received mlme start request\n");
334 result = prism2mgmt_start(wlandev, msg);
335 break;
337 * Prism2 specific messages
339 case DIDmsg_p2req_readpda:
340 pr_debug("Received mlme readpda request\n");
341 result = prism2mgmt_readpda(wlandev, msg);
342 break;
343 case DIDmsg_p2req_ramdl_state:
344 pr_debug("Received mlme ramdl_state request\n");
345 result = prism2mgmt_ramdl_state(wlandev, msg);
346 break;
347 case DIDmsg_p2req_ramdl_write:
348 pr_debug("Received mlme ramdl_write request\n");
349 result = prism2mgmt_ramdl_write(wlandev, msg);
350 break;
351 case DIDmsg_p2req_flashdl_state:
352 pr_debug("Received mlme flashdl_state request\n");
353 result = prism2mgmt_flashdl_state(wlandev, msg);
354 break;
355 case DIDmsg_p2req_flashdl_write:
356 pr_debug("Received mlme flashdl_write request\n");
357 result = prism2mgmt_flashdl_write(wlandev, msg);
358 break;
360 * Linux specific messages
362 case DIDmsg_lnxreq_hostwep:
363 break; /* ignore me. */
364 case DIDmsg_lnxreq_ifstate:
366 struct p80211msg_lnxreq_ifstate *ifstatemsg;
367 pr_debug("Received mlme ifstate request\n");
368 ifstatemsg = (struct p80211msg_lnxreq_ifstate *) msg;
369 result =
370 prism2sta_ifstate(wlandev,
371 ifstatemsg->ifstate.data);
372 ifstatemsg->resultcode.status =
373 P80211ENUM_msgitem_status_data_ok;
374 ifstatemsg->resultcode.data = result;
375 result = 0;
377 break;
378 case DIDmsg_lnxreq_wlansniff:
379 pr_debug("Received mlme wlansniff request\n");
380 result = prism2mgmt_wlansniff(wlandev, msg);
381 break;
382 case DIDmsg_lnxreq_autojoin:
383 pr_debug("Received mlme autojoin request\n");
384 result = prism2mgmt_autojoin(wlandev, msg);
385 break;
386 case DIDmsg_lnxreq_commsquality:{
387 struct p80211msg_lnxreq_commsquality *qualmsg;
389 pr_debug("Received commsquality request\n");
391 qualmsg = (struct p80211msg_lnxreq_commsquality *) msg;
393 qualmsg->link.status =
394 P80211ENUM_msgitem_status_data_ok;
395 qualmsg->level.status =
396 P80211ENUM_msgitem_status_data_ok;
397 qualmsg->noise.status =
398 P80211ENUM_msgitem_status_data_ok;
400 qualmsg->link.data = le16_to_cpu(hw->qual.CQ_currBSS);
401 qualmsg->level.data = le16_to_cpu(hw->qual.ASL_currBSS);
402 qualmsg->noise.data = le16_to_cpu(hw->qual.ANL_currFC);
403 qualmsg->txrate.data = hw->txrate;
405 break;
407 default:
408 printk(KERN_WARNING "Unknown mgmt request message 0x%08x",
409 msg->msgcode);
410 break;
413 return result;
416 /*----------------------------------------------------------------
417 * prism2sta_ifstate
419 * Interface state. This is the primary WLAN interface enable/disable
420 * handler. Following the driver/load/deviceprobe sequence, this
421 * function must be called with a state of "enable" before any other
422 * commands will be accepted.
424 * Arguments:
425 * wlandev wlan device structure
426 * msgp ptr to msg buffer
428 * Returns:
429 * A p80211 message resultcode value.
431 * Side effects:
433 * Call context:
434 * process thread (usually)
435 * interrupt
436 ----------------------------------------------------------------*/
437 u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
439 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
440 u32 result;
442 result = P80211ENUM_resultcode_implementation_failure;
444 pr_debug("Current MSD state(%d), requesting(%d)\n",
445 wlandev->msdstate, ifstate);
446 switch (ifstate) {
447 case P80211ENUM_ifstate_fwload:
448 switch (wlandev->msdstate) {
449 case WLAN_MSD_HWPRESENT:
450 wlandev->msdstate = WLAN_MSD_FWLOAD_PENDING;
452 * Initialize the device+driver sufficiently
453 * for firmware loading.
455 result = hfa384x_drvr_start(hw);
456 if (result) {
457 netdev_err(wlandev->netdev,
458 "hfa384x_drvr_start() failed,result=%d\n", (int)result);
459 result =
460 P80211ENUM_resultcode_implementation_failure;
461 wlandev->msdstate = WLAN_MSD_HWPRESENT;
462 break;
464 wlandev->msdstate = WLAN_MSD_FWLOAD;
465 result = P80211ENUM_resultcode_success;
466 break;
467 case WLAN_MSD_FWLOAD:
468 hfa384x_cmd_initialize(hw);
469 result = P80211ENUM_resultcode_success;
470 break;
471 case WLAN_MSD_RUNNING:
472 printk(KERN_WARNING
473 "Cannot enter fwload state from enable state,"
474 "you must disable first.\n");
475 result = P80211ENUM_resultcode_invalid_parameters;
476 break;
477 case WLAN_MSD_HWFAIL:
478 default:
479 /* probe() had a problem or the msdstate contains
480 * an unrecognized value, there's nothing we can do.
482 result = P80211ENUM_resultcode_implementation_failure;
483 break;
485 break;
486 case P80211ENUM_ifstate_enable:
487 switch (wlandev->msdstate) {
488 case WLAN_MSD_HWPRESENT:
489 case WLAN_MSD_FWLOAD:
490 wlandev->msdstate = WLAN_MSD_RUNNING_PENDING;
491 /* Initialize the device+driver for full
492 * operation. Note that this might me an FWLOAD to
493 * to RUNNING transition so we must not do a chip
494 * or board level reset. Note that on failure,
495 * the MSD state is set to HWPRESENT because we
496 * can't make any assumptions about the state
497 * of the hardware or a previous firmware load.
499 result = hfa384x_drvr_start(hw);
500 if (result) {
501 netdev_err(wlandev->netdev,
502 "hfa384x_drvr_start() failed,result=%d\n", (int)result);
503 result =
504 P80211ENUM_resultcode_implementation_failure;
505 wlandev->msdstate = WLAN_MSD_HWPRESENT;
506 break;
509 result = prism2sta_getcardinfo(wlandev);
510 if (result) {
511 netdev_err(wlandev->netdev,
512 "prism2sta_getcardinfo() failed,result=%d\n", (int)result);
513 result =
514 P80211ENUM_resultcode_implementation_failure;
515 hfa384x_drvr_stop(hw);
516 wlandev->msdstate = WLAN_MSD_HWPRESENT;
517 break;
519 result = prism2sta_globalsetup(wlandev);
520 if (result) {
521 netdev_err(wlandev->netdev,
522 "prism2sta_globalsetup() failed,result=%d\n", (int)result);
523 result =
524 P80211ENUM_resultcode_implementation_failure;
525 hfa384x_drvr_stop(hw);
526 wlandev->msdstate = WLAN_MSD_HWPRESENT;
527 break;
529 wlandev->msdstate = WLAN_MSD_RUNNING;
530 hw->join_ap = 0;
531 hw->join_retries = 60;
532 result = P80211ENUM_resultcode_success;
533 break;
534 case WLAN_MSD_RUNNING:
535 /* Do nothing, we're already in this state. */
536 result = P80211ENUM_resultcode_success;
537 break;
538 case WLAN_MSD_HWFAIL:
539 default:
540 /* probe() had a problem or the msdstate contains
541 * an unrecognized value, there's nothing we can do.
543 result = P80211ENUM_resultcode_implementation_failure;
544 break;
546 break;
547 case P80211ENUM_ifstate_disable:
548 switch (wlandev->msdstate) {
549 case WLAN_MSD_HWPRESENT:
550 /* Do nothing, we're already in this state. */
551 result = P80211ENUM_resultcode_success;
552 break;
553 case WLAN_MSD_FWLOAD:
554 case WLAN_MSD_RUNNING:
555 wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING;
557 * TODO: Shut down the MAC completely. Here a chip
558 * or board level reset is probably called for.
559 * After a "disable" _all_ results are lost, even
560 * those from a fwload.
562 if (!wlandev->hwremoved)
563 netif_carrier_off(wlandev->netdev);
565 hfa384x_drvr_stop(hw);
567 wlandev->macmode = WLAN_MACMODE_NONE;
568 wlandev->msdstate = WLAN_MSD_HWPRESENT;
569 result = P80211ENUM_resultcode_success;
570 break;
571 case WLAN_MSD_HWFAIL:
572 default:
573 /* probe() had a problem or the msdstate contains
574 * an unrecognized value, there's nothing we can do.
576 result = P80211ENUM_resultcode_implementation_failure;
577 break;
579 break;
580 default:
581 result = P80211ENUM_resultcode_invalid_parameters;
582 break;
585 return result;
588 /*----------------------------------------------------------------
589 * prism2sta_getcardinfo
591 * Collect the NICID, firmware version and any other identifiers
592 * we'd like to have in host-side data structures.
594 * Arguments:
595 * wlandev wlan device structure
597 * Returns:
598 * 0 success
599 * >0 f/w reported error
600 * <0 driver reported error
602 * Side effects:
604 * Call context:
605 * Either.
606 ----------------------------------------------------------------*/
607 static int prism2sta_getcardinfo(wlandevice_t *wlandev)
609 int result = 0;
610 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
611 u16 temp;
612 u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN];
613 char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1];
615 /* Collect version and compatibility info */
616 /* Some are critical, some are not */
617 /* NIC identity */
618 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY,
619 &hw->ident_nic,
620 sizeof(hfa384x_compident_t));
621 if (result) {
622 netdev_err(wlandev->netdev, "Failed to retrieve NICIDENTITY\n");
623 goto failed;
626 /* get all the nic id fields in host byte order */
627 hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
628 hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
629 hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
630 hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
632 netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
633 hw->ident_nic.id, hw->ident_nic.major,
634 hw->ident_nic.minor, hw->ident_nic.variant);
636 /* Primary f/w identity */
637 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY,
638 &hw->ident_pri_fw,
639 sizeof(hfa384x_compident_t));
640 if (result) {
641 netdev_err(wlandev->netdev, "Failed to retrieve PRIIDENTITY\n");
642 goto failed;
645 /* get all the private fw id fields in host byte order */
646 hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
647 hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
648 hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
649 hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
651 netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
652 hw->ident_pri_fw.id, hw->ident_pri_fw.major,
653 hw->ident_pri_fw.minor, hw->ident_pri_fw.variant);
655 /* Station (Secondary?) f/w identity */
656 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY,
657 &hw->ident_sta_fw,
658 sizeof(hfa384x_compident_t));
659 if (result) {
660 netdev_err(wlandev->netdev, "Failed to retrieve STAIDENTITY\n");
661 goto failed;
664 if (hw->ident_nic.id < 0x8000) {
665 netdev_err(wlandev->netdev,
666 "FATAL: Card is not an Intersil Prism2/2.5/3\n");
667 result = -1;
668 goto failed;
671 /* get all the station fw id fields in host byte order */
672 hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
673 hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
674 hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
675 hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
677 /* strip out the 'special' variant bits */
678 hw->mm_mods = hw->ident_sta_fw.variant & (BIT(14) | BIT(15));
679 hw->ident_sta_fw.variant &= ~((u16) (BIT(14) | BIT(15)));
681 if (hw->ident_sta_fw.id == 0x1f) {
682 netdev_info(wlandev->netdev,
683 "ident: sta f/w: id=0x%02x %d.%d.%d\n",
684 hw->ident_sta_fw.id, hw->ident_sta_fw.major,
685 hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
686 } else {
687 netdev_info(wlandev->netdev,
688 "ident: ap f/w: id=0x%02x %d.%d.%d\n",
689 hw->ident_sta_fw.id, hw->ident_sta_fw.major,
690 hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
691 netdev_err(wlandev->netdev, "Unsupported Tertiary AP firmeare loaded!\n");
692 goto failed;
695 /* Compatibility range, Modem supplier */
696 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE,
697 &hw->cap_sup_mfi,
698 sizeof(hfa384x_caplevel_t));
699 if (result) {
700 netdev_err(wlandev->netdev, "Failed to retrieve MFISUPRANGE\n");
701 goto failed;
704 /* get all the Compatibility range, modem interface supplier
705 fields in byte order */
706 hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
707 hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
708 hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
709 hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
710 hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
712 netdev_info(wlandev->netdev,
713 "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
714 hw->cap_sup_mfi.role, hw->cap_sup_mfi.id,
715 hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom,
716 hw->cap_sup_mfi.top);
718 /* Compatibility range, Controller supplier */
719 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE,
720 &hw->cap_sup_cfi,
721 sizeof(hfa384x_caplevel_t));
722 if (result) {
723 netdev_err(wlandev->netdev, "Failed to retrieve CFISUPRANGE\n");
724 goto failed;
727 /* get all the Compatibility range, controller interface supplier
728 fields in byte order */
729 hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
730 hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
731 hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
732 hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
733 hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
735 netdev_info(wlandev->netdev,
736 "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
737 hw->cap_sup_cfi.role, hw->cap_sup_cfi.id,
738 hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom,
739 hw->cap_sup_cfi.top);
741 /* Compatibility range, Primary f/w supplier */
742 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE,
743 &hw->cap_sup_pri,
744 sizeof(hfa384x_caplevel_t));
745 if (result) {
746 netdev_err(wlandev->netdev, "Failed to retrieve PRISUPRANGE\n");
747 goto failed;
750 /* get all the Compatibility range, primary firmware supplier
751 fields in byte order */
752 hw->cap_sup_pri.role = le16_to_cpu(hw->cap_sup_pri.role);
753 hw->cap_sup_pri.id = le16_to_cpu(hw->cap_sup_pri.id);
754 hw->cap_sup_pri.variant = le16_to_cpu(hw->cap_sup_pri.variant);
755 hw->cap_sup_pri.bottom = le16_to_cpu(hw->cap_sup_pri.bottom);
756 hw->cap_sup_pri.top = le16_to_cpu(hw->cap_sup_pri.top);
758 netdev_info(wlandev->netdev,
759 "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
760 hw->cap_sup_pri.role, hw->cap_sup_pri.id,
761 hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom,
762 hw->cap_sup_pri.top);
764 /* Compatibility range, Station f/w supplier */
765 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE,
766 &hw->cap_sup_sta,
767 sizeof(hfa384x_caplevel_t));
768 if (result) {
769 netdev_err(wlandev->netdev, "Failed to retrieve STASUPRANGE\n");
770 goto failed;
773 /* get all the Compatibility range, station firmware supplier
774 fields in byte order */
775 hw->cap_sup_sta.role = le16_to_cpu(hw->cap_sup_sta.role);
776 hw->cap_sup_sta.id = le16_to_cpu(hw->cap_sup_sta.id);
777 hw->cap_sup_sta.variant = le16_to_cpu(hw->cap_sup_sta.variant);
778 hw->cap_sup_sta.bottom = le16_to_cpu(hw->cap_sup_sta.bottom);
779 hw->cap_sup_sta.top = le16_to_cpu(hw->cap_sup_sta.top);
781 if (hw->cap_sup_sta.id == 0x04) {
782 netdev_info(wlandev->netdev,
783 "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
784 hw->cap_sup_sta.role, hw->cap_sup_sta.id,
785 hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
786 hw->cap_sup_sta.top);
787 } else {
788 netdev_info(wlandev->netdev,
789 "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
790 hw->cap_sup_sta.role, hw->cap_sup_sta.id,
791 hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
792 hw->cap_sup_sta.top);
795 /* Compatibility range, primary f/w actor, CFI supplier */
796 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES,
797 &hw->cap_act_pri_cfi,
798 sizeof(hfa384x_caplevel_t));
799 if (result) {
800 netdev_err(wlandev->netdev, "Failed to retrieve PRI_CFIACTRANGES\n");
801 goto failed;
804 /* get all the Compatibility range, primary f/w actor, CFI supplier
805 fields in byte order */
806 hw->cap_act_pri_cfi.role = le16_to_cpu(hw->cap_act_pri_cfi.role);
807 hw->cap_act_pri_cfi.id = le16_to_cpu(hw->cap_act_pri_cfi.id);
808 hw->cap_act_pri_cfi.variant = le16_to_cpu(hw->cap_act_pri_cfi.variant);
809 hw->cap_act_pri_cfi.bottom = le16_to_cpu(hw->cap_act_pri_cfi.bottom);
810 hw->cap_act_pri_cfi.top = le16_to_cpu(hw->cap_act_pri_cfi.top);
812 netdev_info(wlandev->netdev,
813 "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
814 hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id,
815 hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom,
816 hw->cap_act_pri_cfi.top);
818 /* Compatibility range, sta f/w actor, CFI supplier */
819 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES,
820 &hw->cap_act_sta_cfi,
821 sizeof(hfa384x_caplevel_t));
822 if (result) {
823 netdev_err(wlandev->netdev, "Failed to retrieve STA_CFIACTRANGES\n");
824 goto failed;
827 /* get all the Compatibility range, station f/w actor, CFI supplier
828 fields in byte order */
829 hw->cap_act_sta_cfi.role = le16_to_cpu(hw->cap_act_sta_cfi.role);
830 hw->cap_act_sta_cfi.id = le16_to_cpu(hw->cap_act_sta_cfi.id);
831 hw->cap_act_sta_cfi.variant = le16_to_cpu(hw->cap_act_sta_cfi.variant);
832 hw->cap_act_sta_cfi.bottom = le16_to_cpu(hw->cap_act_sta_cfi.bottom);
833 hw->cap_act_sta_cfi.top = le16_to_cpu(hw->cap_act_sta_cfi.top);
835 netdev_info(wlandev->netdev,
836 "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
837 hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id,
838 hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom,
839 hw->cap_act_sta_cfi.top);
841 /* Compatibility range, sta f/w actor, MFI supplier */
842 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES,
843 &hw->cap_act_sta_mfi,
844 sizeof(hfa384x_caplevel_t));
845 if (result) {
846 netdev_err(wlandev->netdev, "Failed to retrieve STA_MFIACTRANGES\n");
847 goto failed;
850 /* get all the Compatibility range, station f/w actor, MFI supplier
851 fields in byte order */
852 hw->cap_act_sta_mfi.role = le16_to_cpu(hw->cap_act_sta_mfi.role);
853 hw->cap_act_sta_mfi.id = le16_to_cpu(hw->cap_act_sta_mfi.id);
854 hw->cap_act_sta_mfi.variant = le16_to_cpu(hw->cap_act_sta_mfi.variant);
855 hw->cap_act_sta_mfi.bottom = le16_to_cpu(hw->cap_act_sta_mfi.bottom);
856 hw->cap_act_sta_mfi.top = le16_to_cpu(hw->cap_act_sta_mfi.top);
858 netdev_info(wlandev->netdev,
859 "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
860 hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id,
861 hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom,
862 hw->cap_act_sta_mfi.top);
864 /* Serial Number */
865 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER,
866 snum, HFA384x_RID_NICSERIALNUMBER_LEN);
867 if (!result) {
868 wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN,
869 pstr, sizeof(pstr));
870 netdev_info(wlandev->netdev, "Prism2 card SN: %s\n", pstr);
871 } else {
872 netdev_err(wlandev->netdev, "Failed to retrieve Prism2 Card SN\n");
873 goto failed;
876 /* Collect the MAC address */
877 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR,
878 wlandev->netdev->dev_addr, ETH_ALEN);
879 if (result != 0) {
880 netdev_err(wlandev->netdev, "Failed to retrieve mac address\n");
881 goto failed;
884 /* short preamble is always implemented */
885 wlandev->nsdcaps |= P80211_NSDCAP_SHORT_PREAMBLE;
887 /* find out if hardware wep is implemented */
888 hfa384x_drvr_getconfig16(hw, HFA384x_RID_PRIVACYOPTIMP, &temp);
889 if (temp)
890 wlandev->nsdcaps |= P80211_NSDCAP_HARDWAREWEP;
892 /* get the dBm Scaling constant */
893 hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFDBMADJUST, &temp);
894 hw->dbmadjust = temp;
896 /* Only enable scan by default on newer firmware */
897 if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major,
898 hw->ident_sta_fw.minor,
899 hw->ident_sta_fw.variant) <
900 HFA384x_FIRMWARE_VERSION(1, 5, 5)) {
901 wlandev->nsdcaps |= P80211_NSDCAP_NOSCAN;
904 /* TODO: Set any internally managed config items */
906 goto done;
907 failed:
908 netdev_err(wlandev->netdev, "Failed, result=%d\n", result);
909 done:
910 return result;
913 /*----------------------------------------------------------------
914 * prism2sta_globalsetup
916 * Set any global RIDs that we want to set at device activation.
918 * Arguments:
919 * wlandev wlan device structure
921 * Returns:
922 * 0 success
923 * >0 f/w reported error
924 * <0 driver reported error
926 * Side effects:
928 * Call context:
929 * process thread
930 ----------------------------------------------------------------*/
931 static int prism2sta_globalsetup(wlandevice_t *wlandev)
933 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
935 /* Set the maximum frame size */
936 return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN,
937 WLAN_DATA_MAXLEN);
940 static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev)
942 int result = 0;
943 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
945 u16 promisc;
947 /* If we're not ready, what's the point? */
948 if (hw->state != HFA384x_STATE_RUNNING)
949 goto exit;
951 if ((dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
952 promisc = P80211ENUM_truth_true;
953 else
954 promisc = P80211ENUM_truth_false;
956 result =
957 hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE,
958 promisc);
959 exit:
960 return result;
963 /*----------------------------------------------------------------
964 * prism2sta_inf_handover
966 * Handles the receipt of a Handover info frame. Should only be present
967 * in APs only.
969 * Arguments:
970 * wlandev wlan device structure
971 * inf ptr to info frame (contents in hfa384x order)
973 * Returns:
974 * nothing
976 * Side effects:
978 * Call context:
979 * interrupt
980 ----------------------------------------------------------------*/
981 static void prism2sta_inf_handover(wlandevice_t *wlandev,
982 hfa384x_InfFrame_t *inf)
984 pr_debug("received infoframe:HANDOVER (unhandled)\n");
987 /*----------------------------------------------------------------
988 * prism2sta_inf_tallies
990 * Handles the receipt of a CommTallies info frame.
992 * Arguments:
993 * wlandev wlan device structure
994 * inf ptr to info frame (contents in hfa384x order)
996 * Returns:
997 * nothing
999 * Side effects:
1001 * Call context:
1002 * interrupt
1003 ----------------------------------------------------------------*/
1004 static void prism2sta_inf_tallies(wlandevice_t *wlandev,
1005 hfa384x_InfFrame_t *inf)
1007 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1008 u16 *src16;
1009 u32 *dst;
1010 u32 *src32;
1011 int i;
1012 int cnt;
1015 ** Determine if these are 16-bit or 32-bit tallies, based on the
1016 ** record length of the info record.
1019 cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(u32);
1020 if (inf->framelen > 22) {
1021 dst = (u32 *) &hw->tallies;
1022 src32 = (u32 *) &inf->info.commtallies32;
1023 for (i = 0; i < cnt; i++, dst++, src32++)
1024 *dst += le32_to_cpu(*src32);
1025 } else {
1026 dst = (u32 *) &hw->tallies;
1027 src16 = (u16 *) &inf->info.commtallies16;
1028 for (i = 0; i < cnt; i++, dst++, src16++)
1029 *dst += le16_to_cpu(*src16);
1033 /*----------------------------------------------------------------
1034 * prism2sta_inf_scanresults
1036 * Handles the receipt of a Scan Results info frame.
1038 * Arguments:
1039 * wlandev wlan device structure
1040 * inf ptr to info frame (contents in hfa384x order)
1042 * Returns:
1043 * nothing
1045 * Side effects:
1047 * Call context:
1048 * interrupt
1049 ----------------------------------------------------------------*/
1050 static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
1051 hfa384x_InfFrame_t *inf)
1054 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1055 int nbss;
1056 hfa384x_ScanResult_t *sr = &(inf->info.scanresult);
1057 int i;
1058 hfa384x_JoinRequest_data_t joinreq;
1059 int result;
1061 /* Get the number of results, first in bytes, then in results */
1062 nbss = (inf->framelen * sizeof(u16)) -
1063 sizeof(inf->infotype) - sizeof(inf->info.scanresult.scanreason);
1064 nbss /= sizeof(hfa384x_ScanResultSub_t);
1066 /* Print em */
1067 pr_debug("rx scanresults, reason=%d, nbss=%d:\n",
1068 inf->info.scanresult.scanreason, nbss);
1069 for (i = 0; i < nbss; i++) {
1070 pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n",
1071 sr->result[i].chid,
1072 sr->result[i].anl,
1073 sr->result[i].sl, sr->result[i].bcnint);
1074 pr_debug(" capinfo=0x%04x proberesp_rate=%d\n",
1075 sr->result[i].capinfo, sr->result[i].proberesp_rate);
1077 /* issue a join request */
1078 joinreq.channel = sr->result[0].chid;
1079 memcpy(joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN);
1080 result = hfa384x_drvr_setconfig(hw,
1081 HFA384x_RID_JOINREQUEST,
1082 &joinreq, HFA384x_RID_JOINREQUEST_LEN);
1083 if (result) {
1084 netdev_err(wlandev->netdev, "setconfig(joinreq) failed, result=%d\n",
1085 result);
1089 /*----------------------------------------------------------------
1090 * prism2sta_inf_hostscanresults
1092 * Handles the receipt of a Scan Results info frame.
1094 * Arguments:
1095 * wlandev wlan device structure
1096 * inf ptr to info frame (contents in hfa384x order)
1098 * Returns:
1099 * nothing
1101 * Side effects:
1103 * Call context:
1104 * interrupt
1105 ----------------------------------------------------------------*/
1106 static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
1107 hfa384x_InfFrame_t *inf)
1109 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1110 int nbss;
1112 nbss = (inf->framelen - 3) / 32;
1113 pr_debug("Received %d hostscan results\n", nbss);
1115 if (nbss > 32)
1116 nbss = 32;
1118 kfree(hw->scanresults);
1120 hw->scanresults = kmemdup(inf, sizeof(hfa384x_InfFrame_t), GFP_ATOMIC);
1122 if (nbss == 0)
1123 nbss = -1;
1125 /* Notify/wake the sleeping caller. */
1126 hw->scanflag = nbss;
1127 wake_up_interruptible(&hw->cmdq);
1130 /*----------------------------------------------------------------
1131 * prism2sta_inf_chinforesults
1133 * Handles the receipt of a Channel Info Results info frame.
1135 * Arguments:
1136 * wlandev wlan device structure
1137 * inf ptr to info frame (contents in hfa384x order)
1139 * Returns:
1140 * nothing
1142 * Side effects:
1144 * Call context:
1145 * interrupt
1146 ----------------------------------------------------------------*/
1147 static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
1148 hfa384x_InfFrame_t *inf)
1150 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1151 unsigned int i, n;
1153 hw->channel_info.results.scanchannels =
1154 le16_to_cpu(inf->info.chinforesult.scanchannels);
1156 for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) {
1157 hfa384x_ChInfoResultSub_t *result;
1158 hfa384x_ChInfoResultSub_t *chinforesult;
1159 int chan;
1161 if (!(hw->channel_info.results.scanchannels & (1 << i)))
1162 continue;
1164 result = &inf->info.chinforesult.result[n];
1165 chan = le16_to_cpu(result->chid) - 1;
1167 if (chan < 0 || chan >= HFA384x_CHINFORESULT_MAX)
1168 continue;
1170 chinforesult = &hw->channel_info.results.result[chan];
1171 chinforesult->chid = chan;
1172 chinforesult->anl = le16_to_cpu(result->anl);
1173 chinforesult->pnl = le16_to_cpu(result->pnl);
1174 chinforesult->active = le16_to_cpu(result->active);
1176 pr_debug("chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
1177 chan + 1,
1178 (chinforesult->active & HFA384x_CHINFORESULT_BSSACTIVE)
1179 ? "signal" : "noise",
1180 chinforesult->anl, chinforesult->pnl,
1181 (chinforesult->active & HFA384x_CHINFORESULT_PCFACTIVE)
1182 ? 1 : 0);
1183 n++;
1185 atomic_set(&hw->channel_info.done, 2);
1187 hw->channel_info.count = n;
1190 void prism2sta_processing_defer(struct work_struct *data)
1192 hfa384x_t *hw = container_of(data, struct hfa384x, link_bh);
1193 wlandevice_t *wlandev = hw->wlandev;
1194 hfa384x_bytestr32_t ssid;
1195 int result;
1197 /* First let's process the auth frames */
1199 struct sk_buff *skb;
1200 hfa384x_InfFrame_t *inf;
1202 while ((skb = skb_dequeue(&hw->authq))) {
1203 inf = (hfa384x_InfFrame_t *) skb->data;
1204 prism2sta_inf_authreq_defer(wlandev, inf);
1209 /* Now let's handle the linkstatus stuff */
1210 if (hw->link_status == hw->link_status_new)
1211 return;
1213 hw->link_status = hw->link_status_new;
1215 switch (hw->link_status) {
1216 case HFA384x_LINK_NOTCONNECTED:
1217 /* I'm currently assuming that this is the initial link
1218 * state. It should only be possible immediately
1219 * following an Enable command.
1220 * Response:
1221 * Block Transmits, Ignore receives of data frames
1223 netif_carrier_off(wlandev->netdev);
1225 netdev_info(wlandev->netdev, "linkstatus=NOTCONNECTED (unhandled)\n");
1226 break;
1228 case HFA384x_LINK_CONNECTED:
1229 /* This one indicates a successful scan/join/auth/assoc.
1230 * When we have the full MLME complement, this event will
1231 * signify successful completion of both mlme_authenticate
1232 * and mlme_associate. State management will get a little
1233 * ugly here.
1234 * Response:
1235 * Indicate authentication and/or association
1236 * Enable Transmits, Receives and pass up data frames
1239 netif_carrier_on(wlandev->netdev);
1241 /* If we are joining a specific AP, set our
1242 * state and reset retries
1244 if (hw->join_ap == 1)
1245 hw->join_ap = 2;
1246 hw->join_retries = 60;
1248 /* Don't call this in monitor mode */
1249 if (wlandev->netdev->type == ARPHRD_ETHER) {
1250 u16 portstatus;
1252 netdev_info(wlandev->netdev, "linkstatus=CONNECTED\n");
1254 /* For non-usb devices, we can use the sync versions */
1255 /* Collect the BSSID, and set state to allow tx */
1257 result = hfa384x_drvr_getconfig(hw,
1258 HFA384x_RID_CURRENTBSSID,
1259 wlandev->bssid,
1260 WLAN_BSSID_LEN);
1261 if (result) {
1262 pr_debug
1263 ("getconfig(0x%02x) failed, result = %d\n",
1264 HFA384x_RID_CURRENTBSSID, result);
1265 return;
1268 result = hfa384x_drvr_getconfig(hw,
1269 HFA384x_RID_CURRENTSSID,
1270 &ssid, sizeof(ssid));
1271 if (result) {
1272 pr_debug
1273 ("getconfig(0x%02x) failed, result = %d\n",
1274 HFA384x_RID_CURRENTSSID, result);
1275 return;
1277 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
1278 (p80211pstrd_t *) &
1279 wlandev->ssid);
1281 /* Collect the port status */
1282 result = hfa384x_drvr_getconfig16(hw,
1283 HFA384x_RID_PORTSTATUS,
1284 &portstatus);
1285 if (result) {
1286 pr_debug
1287 ("getconfig(0x%02x) failed, result = %d\n",
1288 HFA384x_RID_PORTSTATUS, result);
1289 return;
1291 wlandev->macmode =
1292 (portstatus == HFA384x_PSTATUS_CONN_IBSS) ?
1293 WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA;
1295 /* signal back up to cfg80211 layer */
1296 prism2_connect_result(wlandev, P80211ENUM_truth_false);
1298 /* Get the ball rolling on the comms quality stuff */
1299 prism2sta_commsqual_defer(&hw->commsqual_bh);
1301 break;
1303 case HFA384x_LINK_DISCONNECTED:
1304 /* This one indicates that our association is gone. We've
1305 * lost connection with the AP and/or been disassociated.
1306 * This indicates that the MAC has completely cleared it's
1307 * associated state. We * should send a deauth indication
1308 * (implying disassoc) up * to the MLME.
1309 * Response:
1310 * Indicate Deauthentication
1311 * Block Transmits, Ignore receives of data frames
1313 if (wlandev->netdev->type == ARPHRD_ETHER)
1314 netdev_info(wlandev->netdev,
1315 "linkstatus=DISCONNECTED (unhandled)\n");
1316 wlandev->macmode = WLAN_MACMODE_NONE;
1318 netif_carrier_off(wlandev->netdev);
1320 /* signal back up to cfg80211 layer */
1321 prism2_disconnected(wlandev);
1323 break;
1325 case HFA384x_LINK_AP_CHANGE:
1326 /* This one indicates that the MAC has decided to and
1327 * successfully completed a change to another AP. We
1328 * should probably implement a reassociation indication
1329 * in response to this one. I'm thinking that the the
1330 * p80211 layer needs to be notified in case of
1331 * buffering/queueing issues. User mode also needs to be
1332 * notified so that any BSS dependent elements can be
1333 * updated.
1334 * associated state. We * should send a deauth indication
1335 * (implying disassoc) up * to the MLME.
1336 * Response:
1337 * Indicate Reassociation
1338 * Enable Transmits, Receives and pass up data frames
1340 netdev_info(wlandev->netdev, "linkstatus=AP_CHANGE\n");
1342 result = hfa384x_drvr_getconfig(hw,
1343 HFA384x_RID_CURRENTBSSID,
1344 wlandev->bssid, WLAN_BSSID_LEN);
1345 if (result) {
1346 pr_debug("getconfig(0x%02x) failed, result = %d\n",
1347 HFA384x_RID_CURRENTBSSID, result);
1348 return;
1351 result = hfa384x_drvr_getconfig(hw,
1352 HFA384x_RID_CURRENTSSID,
1353 &ssid, sizeof(ssid));
1354 if (result) {
1355 pr_debug("getconfig(0x%02x) failed, result = %d\n",
1356 HFA384x_RID_CURRENTSSID, result);
1357 return;
1359 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
1360 (p80211pstrd_t *) &wlandev->ssid);
1362 hw->link_status = HFA384x_LINK_CONNECTED;
1363 netif_carrier_on(wlandev->netdev);
1365 /* signal back up to cfg80211 layer */
1366 prism2_roamed(wlandev);
1368 break;
1370 case HFA384x_LINK_AP_OUTOFRANGE:
1371 /* This one indicates that the MAC has decided that the
1372 * AP is out of range, but hasn't found a better candidate
1373 * so the MAC maintains its "associated" state in case
1374 * we get back in range. We should block transmits and
1375 * receives in this state. Do we need an indication here?
1376 * Probably not since a polling user-mode element would
1377 * get this status from from p2PortStatus(FD40). What about
1378 * p80211?
1379 * Response:
1380 * Block Transmits, Ignore receives of data frames
1382 netdev_info(wlandev->netdev, "linkstatus=AP_OUTOFRANGE (unhandled)\n");
1384 netif_carrier_off(wlandev->netdev);
1386 break;
1388 case HFA384x_LINK_AP_INRANGE:
1389 /* This one indicates that the MAC has decided that the
1390 * AP is back in range. We continue working with our
1391 * existing association.
1392 * Response:
1393 * Enable Transmits, Receives and pass up data frames
1395 netdev_info(wlandev->netdev, "linkstatus=AP_INRANGE\n");
1397 hw->link_status = HFA384x_LINK_CONNECTED;
1398 netif_carrier_on(wlandev->netdev);
1400 break;
1402 case HFA384x_LINK_ASSOCFAIL:
1403 /* This one is actually a peer to CONNECTED. We've
1404 * requested a join for a given SSID and optionally BSSID.
1405 * We can use this one to indicate authentication and
1406 * association failures. The trick is going to be
1407 * 1) identifying the failure, and 2) state management.
1408 * Response:
1409 * Disable Transmits, Ignore receives of data frames
1411 if (hw->join_ap && --hw->join_retries > 0) {
1412 hfa384x_JoinRequest_data_t joinreq;
1413 joinreq = hw->joinreq;
1414 /* Send the join request */
1415 hfa384x_drvr_setconfig(hw,
1416 HFA384x_RID_JOINREQUEST,
1417 &joinreq,
1418 HFA384x_RID_JOINREQUEST_LEN);
1419 netdev_info(wlandev->netdev,
1420 "linkstatus=ASSOCFAIL (re-submitting join)\n");
1421 } else {
1422 netdev_info(wlandev->netdev, "linkstatus=ASSOCFAIL (unhandled)\n");
1425 netif_carrier_off(wlandev->netdev);
1427 /* signal back up to cfg80211 layer */
1428 prism2_connect_result(wlandev, P80211ENUM_truth_true);
1430 break;
1432 default:
1433 /* This is bad, IO port problems? */
1434 printk(KERN_WARNING
1435 "unknown linkstatus=0x%02x\n", hw->link_status);
1436 return;
1439 wlandev->linkstatus = (hw->link_status == HFA384x_LINK_CONNECTED);
1442 /*----------------------------------------------------------------
1443 * prism2sta_inf_linkstatus
1445 * Handles the receipt of a Link Status info frame.
1447 * Arguments:
1448 * wlandev wlan device structure
1449 * inf ptr to info frame (contents in hfa384x order)
1451 * Returns:
1452 * nothing
1454 * Side effects:
1456 * Call context:
1457 * interrupt
1458 ----------------------------------------------------------------*/
1459 static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
1460 hfa384x_InfFrame_t *inf)
1462 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1464 hw->link_status_new = le16_to_cpu(inf->info.linkstatus.linkstatus);
1466 schedule_work(&hw->link_bh);
1469 /*----------------------------------------------------------------
1470 * prism2sta_inf_assocstatus
1472 * Handles the receipt of an Association Status info frame. Should
1473 * be present in APs only.
1475 * Arguments:
1476 * wlandev wlan device structure
1477 * inf ptr to info frame (contents in hfa384x order)
1479 * Returns:
1480 * nothing
1482 * Side effects:
1484 * Call context:
1485 * interrupt
1486 ----------------------------------------------------------------*/
1487 static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
1488 hfa384x_InfFrame_t *inf)
1490 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1491 hfa384x_AssocStatus_t rec;
1492 int i;
1494 memcpy(&rec, &inf->info.assocstatus, sizeof(rec));
1495 rec.assocstatus = le16_to_cpu(rec.assocstatus);
1496 rec.reason = le16_to_cpu(rec.reason);
1499 ** Find the address in the list of authenticated stations.
1500 ** If it wasn't found, then this address has not been previously
1501 ** authenticated and something weird has happened if this is
1502 ** anything other than an "authentication failed" message.
1503 ** If the address was found, then set the "associated" flag for
1504 ** that station, based on whether the station is associating or
1505 ** losing its association. Something weird has also happened
1506 ** if we find the address in the list of authenticated stations
1507 ** but we are getting an "authentication failed" message.
1510 for (i = 0; i < hw->authlist.cnt; i++)
1511 if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0)
1512 break;
1514 if (i >= hw->authlist.cnt) {
1515 if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL)
1516 printk(KERN_WARNING
1517 "assocstatus info frame received for non-authenticated station.\n");
1518 } else {
1519 hw->authlist.assoc[i] =
1520 (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC ||
1521 rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC);
1523 if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL)
1524 printk(KERN_WARNING
1525 "authfail assocstatus info frame received for authenticated station.\n");
1529 /*----------------------------------------------------------------
1530 * prism2sta_inf_authreq
1532 * Handles the receipt of an Authentication Request info frame. Should
1533 * be present in APs only.
1535 * Arguments:
1536 * wlandev wlan device structure
1537 * inf ptr to info frame (contents in hfa384x order)
1539 * Returns:
1540 * nothing
1542 * Side effects:
1544 * Call context:
1545 * interrupt
1547 ----------------------------------------------------------------*/
1548 static void prism2sta_inf_authreq(wlandevice_t *wlandev,
1549 hfa384x_InfFrame_t *inf)
1551 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1552 struct sk_buff *skb;
1554 skb = dev_alloc_skb(sizeof(*inf));
1555 if (skb) {
1556 skb_put(skb, sizeof(*inf));
1557 memcpy(skb->data, inf, sizeof(*inf));
1558 skb_queue_tail(&hw->authq, skb);
1559 schedule_work(&hw->link_bh);
1563 static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
1564 hfa384x_InfFrame_t *inf)
1566 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1567 hfa384x_authenticateStation_data_t rec;
1569 int i, added, result, cnt;
1570 u8 *addr;
1573 ** Build the AuthenticateStation record. Initialize it for denying
1574 ** authentication.
1577 memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN);
1578 rec.status = P80211ENUM_status_unspec_failure;
1581 ** Authenticate based on the access mode.
1584 switch (hw->accessmode) {
1585 case WLAN_ACCESS_NONE:
1588 ** Deny all new authentications. However, if a station
1589 ** is ALREADY authenticated, then accept it.
1592 for (i = 0; i < hw->authlist.cnt; i++)
1593 if (memcmp(rec.address, hw->authlist.addr[i],
1594 ETH_ALEN) == 0) {
1595 rec.status = P80211ENUM_status_successful;
1596 break;
1599 break;
1601 case WLAN_ACCESS_ALL:
1604 ** Allow all authentications.
1607 rec.status = P80211ENUM_status_successful;
1608 break;
1610 case WLAN_ACCESS_ALLOW:
1613 ** Only allow the authentication if the MAC address
1614 ** is in the list of allowed addresses.
1616 ** Since this is the interrupt handler, we may be here
1617 ** while the access list is in the middle of being
1618 ** updated. Choose the list which is currently okay.
1619 ** See "prism2mib_priv_accessallow()" for details.
1622 if (hw->allow.modify == 0) {
1623 cnt = hw->allow.cnt;
1624 addr = hw->allow.addr[0];
1625 } else {
1626 cnt = hw->allow.cnt1;
1627 addr = hw->allow.addr1[0];
1630 for (i = 0; i < cnt; i++, addr += ETH_ALEN)
1631 if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
1632 rec.status = P80211ENUM_status_successful;
1633 break;
1636 break;
1638 case WLAN_ACCESS_DENY:
1641 ** Allow the authentication UNLESS the MAC address is
1642 ** in the list of denied addresses.
1644 ** Since this is the interrupt handler, we may be here
1645 ** while the access list is in the middle of being
1646 ** updated. Choose the list which is currently okay.
1647 ** See "prism2mib_priv_accessdeny()" for details.
1650 if (hw->deny.modify == 0) {
1651 cnt = hw->deny.cnt;
1652 addr = hw->deny.addr[0];
1653 } else {
1654 cnt = hw->deny.cnt1;
1655 addr = hw->deny.addr1[0];
1658 rec.status = P80211ENUM_status_successful;
1660 for (i = 0; i < cnt; i++, addr += ETH_ALEN)
1661 if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
1662 rec.status = P80211ENUM_status_unspec_failure;
1663 break;
1666 break;
1670 ** If the authentication is okay, then add the MAC address to the
1671 ** list of authenticated stations. Don't add the address if it
1672 ** is already in the list. (802.11b does not seem to disallow
1673 ** a station from issuing an authentication request when the
1674 ** station is already authenticated. Does this sort of thing
1675 ** ever happen? We might as well do the check just in case.)
1678 added = 0;
1680 if (rec.status == P80211ENUM_status_successful) {
1681 for (i = 0; i < hw->authlist.cnt; i++)
1682 if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
1683 == 0)
1684 break;
1686 if (i >= hw->authlist.cnt) {
1687 if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
1688 rec.status = P80211ENUM_status_ap_full;
1689 } else {
1690 memcpy(hw->authlist.addr[hw->authlist.cnt],
1691 rec.address, ETH_ALEN);
1692 hw->authlist.cnt++;
1693 added = 1;
1699 ** Send back the results of the authentication. If this doesn't work,
1700 ** then make sure to remove the address from the authenticated list if
1701 ** it was added.
1704 rec.status = cpu_to_le16(rec.status);
1705 rec.algorithm = inf->info.authreq.algorithm;
1707 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA,
1708 &rec, sizeof(rec));
1709 if (result) {
1710 if (added)
1711 hw->authlist.cnt--;
1712 netdev_err(wlandev->netdev,
1713 "setconfig(authenticatestation) failed, result=%d\n",
1714 result);
1718 /*----------------------------------------------------------------
1719 * prism2sta_inf_psusercnt
1721 * Handles the receipt of a PowerSaveUserCount info frame. Should
1722 * be present in APs only.
1724 * Arguments:
1725 * wlandev wlan device structure
1726 * inf ptr to info frame (contents in hfa384x order)
1728 * Returns:
1729 * nothing
1731 * Side effects:
1733 * Call context:
1734 * interrupt
1735 ----------------------------------------------------------------*/
1736 static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
1737 hfa384x_InfFrame_t *inf)
1739 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1741 hw->psusercount = le16_to_cpu(inf->info.psusercnt.usercnt);
1744 /*----------------------------------------------------------------
1745 * prism2sta_ev_info
1747 * Handles the Info event.
1749 * Arguments:
1750 * wlandev wlan device structure
1751 * inf ptr to a generic info frame
1753 * Returns:
1754 * nothing
1756 * Side effects:
1758 * Call context:
1759 * interrupt
1760 ----------------------------------------------------------------*/
1761 void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
1763 inf->infotype = le16_to_cpu(inf->infotype);
1764 /* Dispatch */
1765 switch (inf->infotype) {
1766 case HFA384x_IT_HANDOVERADDR:
1767 prism2sta_inf_handover(wlandev, inf);
1768 break;
1769 case HFA384x_IT_COMMTALLIES:
1770 prism2sta_inf_tallies(wlandev, inf);
1771 break;
1772 case HFA384x_IT_HOSTSCANRESULTS:
1773 prism2sta_inf_hostscanresults(wlandev, inf);
1774 break;
1775 case HFA384x_IT_SCANRESULTS:
1776 prism2sta_inf_scanresults(wlandev, inf);
1777 break;
1778 case HFA384x_IT_CHINFORESULTS:
1779 prism2sta_inf_chinforesults(wlandev, inf);
1780 break;
1781 case HFA384x_IT_LINKSTATUS:
1782 prism2sta_inf_linkstatus(wlandev, inf);
1783 break;
1784 case HFA384x_IT_ASSOCSTATUS:
1785 prism2sta_inf_assocstatus(wlandev, inf);
1786 break;
1787 case HFA384x_IT_AUTHREQ:
1788 prism2sta_inf_authreq(wlandev, inf);
1789 break;
1790 case HFA384x_IT_PSUSERCNT:
1791 prism2sta_inf_psusercnt(wlandev, inf);
1792 break;
1793 case HFA384x_IT_KEYIDCHANGED:
1794 printk(KERN_WARNING "Unhandled IT_KEYIDCHANGED\n");
1795 break;
1796 case HFA384x_IT_ASSOCREQ:
1797 printk(KERN_WARNING "Unhandled IT_ASSOCREQ\n");
1798 break;
1799 case HFA384x_IT_MICFAILURE:
1800 printk(KERN_WARNING "Unhandled IT_MICFAILURE\n");
1801 break;
1802 default:
1803 printk(KERN_WARNING
1804 "Unknown info type=0x%02x\n", inf->infotype);
1805 break;
1809 /*----------------------------------------------------------------
1810 * prism2sta_ev_txexc
1812 * Handles the TxExc event. A Transmit Exception event indicates
1813 * that the MAC's TX process was unsuccessful - so the packet did
1814 * not get transmitted.
1816 * Arguments:
1817 * wlandev wlan device structure
1818 * status tx frame status word
1820 * Returns:
1821 * nothing
1823 * Side effects:
1825 * Call context:
1826 * interrupt
1827 ----------------------------------------------------------------*/
1828 void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status)
1830 pr_debug("TxExc status=0x%x.\n", status);
1833 /*----------------------------------------------------------------
1834 * prism2sta_ev_tx
1836 * Handles the Tx event.
1838 * Arguments:
1839 * wlandev wlan device structure
1840 * status tx frame status word
1841 * Returns:
1842 * nothing
1844 * Side effects:
1846 * Call context:
1847 * interrupt
1848 ----------------------------------------------------------------*/
1849 void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
1851 pr_debug("Tx Complete, status=0x%04x\n", status);
1852 /* update linux network stats */
1853 wlandev->linux_stats.tx_packets++;
1856 /*----------------------------------------------------------------
1857 * prism2sta_ev_rx
1859 * Handles the Rx event.
1861 * Arguments:
1862 * wlandev wlan device structure
1864 * Returns:
1865 * nothing
1867 * Side effects:
1869 * Call context:
1870 * interrupt
1871 ----------------------------------------------------------------*/
1872 void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
1874 p80211netdev_rx(wlandev, skb);
1877 /*----------------------------------------------------------------
1878 * prism2sta_ev_alloc
1880 * Handles the Alloc event.
1882 * Arguments:
1883 * wlandev wlan device structure
1885 * Returns:
1886 * nothing
1888 * Side effects:
1890 * Call context:
1891 * interrupt
1892 ----------------------------------------------------------------*/
1893 void prism2sta_ev_alloc(wlandevice_t *wlandev)
1895 netif_wake_queue(wlandev->netdev);
1898 /*----------------------------------------------------------------
1899 * create_wlan
1901 * Called at module init time. This creates the wlandevice_t structure
1902 * and initializes it with relevant bits.
1904 * Arguments:
1905 * none
1907 * Returns:
1908 * the created wlandevice_t structure.
1910 * Side effects:
1911 * also allocates the priv/hw structures.
1913 * Call context:
1914 * process thread
1916 ----------------------------------------------------------------*/
1917 static wlandevice_t *create_wlan(void)
1919 wlandevice_t *wlandev = NULL;
1920 hfa384x_t *hw = NULL;
1922 /* Alloc our structures */
1923 wlandev = kzalloc(sizeof(wlandevice_t), GFP_KERNEL);
1924 hw = kzalloc(sizeof(hfa384x_t), GFP_KERNEL);
1926 if (!wlandev || !hw) {
1927 pr_err("%s: Memory allocation failure.\n", dev_info);
1928 kfree(wlandev);
1929 kfree(hw);
1930 return NULL;
1933 /* Initialize the network device object. */
1934 wlandev->nsdname = dev_info;
1935 wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING;
1936 wlandev->priv = hw;
1937 wlandev->open = prism2sta_open;
1938 wlandev->close = prism2sta_close;
1939 wlandev->reset = prism2sta_reset;
1940 wlandev->txframe = prism2sta_txframe;
1941 wlandev->mlmerequest = prism2sta_mlmerequest;
1942 wlandev->set_multicast_list = prism2sta_setmulticast;
1943 wlandev->tx_timeout = hfa384x_tx_timeout;
1945 wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | P80211_NSDCAP_AUTOJOIN;
1947 /* Initialize the device private data structure. */
1948 hw->dot11_desired_bss_type = 1;
1950 return wlandev;
1953 void prism2sta_commsqual_defer(struct work_struct *data)
1955 hfa384x_t *hw = container_of(data, struct hfa384x, commsqual_bh);
1956 wlandevice_t *wlandev = hw->wlandev;
1957 hfa384x_bytestr32_t ssid;
1958 struct p80211msg_dot11req_mibget msg;
1959 p80211item_uint32_t *mibitem = (p80211item_uint32_t *)
1960 &msg.mibattribute.data;
1961 int result = 0;
1963 if (hw->wlandev->hwremoved)
1964 return;
1966 /* we don't care if we're in AP mode */
1967 if ((wlandev->macmode == WLAN_MACMODE_NONE) ||
1968 (wlandev->macmode == WLAN_MACMODE_ESS_AP)) {
1969 return;
1972 /* It only makes sense to poll these in non-IBSS */
1973 if (wlandev->macmode != WLAN_MACMODE_IBSS_STA) {
1974 result = hfa384x_drvr_getconfig(
1975 hw, HFA384x_RID_DBMCOMMSQUALITY,
1976 &hw->qual, HFA384x_RID_DBMCOMMSQUALITY_LEN);
1978 if (result) {
1979 netdev_err(wlandev->netdev, "error fetching commsqual\n");
1980 return;
1983 pr_debug("commsqual %d %d %d\n",
1984 le16_to_cpu(hw->qual.CQ_currBSS),
1985 le16_to_cpu(hw->qual.ASL_currBSS),
1986 le16_to_cpu(hw->qual.ANL_currFC));
1989 /* Get the signal rate */
1990 msg.msgcode = DIDmsg_dot11req_mibget;
1991 mibitem->did = DIDmib_p2_p2MAC_p2CurrentTxRate;
1992 result = p80211req_dorequest(wlandev, (u8 *) &msg);
1994 if (result) {
1995 pr_debug("get signal rate failed, result = %d\n",
1996 result);
1997 return;
2000 switch (mibitem->data) {
2001 case HFA384x_RATEBIT_1:
2002 hw->txrate = 10;
2003 break;
2004 case HFA384x_RATEBIT_2:
2005 hw->txrate = 20;
2006 break;
2007 case HFA384x_RATEBIT_5dot5:
2008 hw->txrate = 55;
2009 break;
2010 case HFA384x_RATEBIT_11:
2011 hw->txrate = 110;
2012 break;
2013 default:
2014 pr_debug("Bad ratebit (%d)\n", mibitem->data);
2017 /* Lastly, we need to make sure the BSSID didn't change on us */
2018 result = hfa384x_drvr_getconfig(hw,
2019 HFA384x_RID_CURRENTBSSID,
2020 wlandev->bssid, WLAN_BSSID_LEN);
2021 if (result) {
2022 pr_debug("getconfig(0x%02x) failed, result = %d\n",
2023 HFA384x_RID_CURRENTBSSID, result);
2024 return;
2027 result = hfa384x_drvr_getconfig(hw,
2028 HFA384x_RID_CURRENTSSID,
2029 &ssid, sizeof(ssid));
2030 if (result) {
2031 pr_debug("getconfig(0x%02x) failed, result = %d\n",
2032 HFA384x_RID_CURRENTSSID, result);
2033 return;
2035 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
2036 (p80211pstrd_t *) &wlandev->ssid);
2038 /* Reschedule timer */
2039 mod_timer(&hw->commsqual_timer, jiffies + HZ);
2042 void prism2sta_commsqual_timer(unsigned long data)
2044 hfa384x_t *hw = (hfa384x_t *) data;
2046 schedule_work(&hw->commsqual_bh);