staging: wlan-ng: fix bad symbol declaration
[linux/fpc-iii.git] / drivers / staging / wlan-ng / prism2sta.c
blob3fd4538d94089829a040800aecef3d5c2b0f6ad2
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 static int prism2sta_open(wlandevice_t *wlandev);
124 static int prism2sta_close(wlandevice_t *wlandev);
125 static void prism2sta_reset(wlandevice_t *wlandev);
126 static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
127 union p80211_hdr *p80211_hdr,
128 struct p80211_metawep *p80211_wep);
129 static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg);
130 static int prism2sta_getcardinfo(wlandevice_t *wlandev);
131 static int prism2sta_globalsetup(wlandevice_t *wlandev);
132 static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev);
134 static void prism2sta_inf_handover(wlandevice_t *wlandev,
135 hfa384x_InfFrame_t *inf);
136 static void prism2sta_inf_tallies(wlandevice_t *wlandev,
137 hfa384x_InfFrame_t *inf);
138 static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
139 hfa384x_InfFrame_t *inf);
140 static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
141 hfa384x_InfFrame_t *inf);
142 static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
143 hfa384x_InfFrame_t *inf);
144 static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
145 hfa384x_InfFrame_t *inf);
146 static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
147 hfa384x_InfFrame_t *inf);
148 static void prism2sta_inf_authreq(wlandevice_t *wlandev,
149 hfa384x_InfFrame_t *inf);
150 static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
151 hfa384x_InfFrame_t *inf);
152 static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
153 hfa384x_InfFrame_t *inf);
155 /*----------------------------------------------------------------
156 * prism2sta_open
158 * WLAN device open method. Called from p80211netdev when kernel
159 * device open (start) method is called in response to the
160 * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP
161 * from clear to set.
163 * Arguments:
164 * wlandev wlan device structure
166 * Returns:
167 * 0 success
168 * >0 f/w reported error
169 * <0 driver reported error
171 * Side effects:
173 * Call context:
174 * process thread
175 ----------------------------------------------------------------*/
176 static int prism2sta_open(wlandevice_t *wlandev)
178 /* We don't currently have to do anything else.
179 * The setup of the MAC should be subsequently completed via
180 * the mlme commands.
181 * Higher layers know we're ready from dev->start==1 and
182 * dev->tbusy==0. Our rx path knows to pass up received/
183 * frames because of dev->flags&IFF_UP is true.
186 return 0;
189 /*----------------------------------------------------------------
190 * prism2sta_close
192 * WLAN device close method. Called from p80211netdev when kernel
193 * device close method is called in response to the
194 * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP
195 * from set to clear.
197 * Arguments:
198 * wlandev wlan device structure
200 * Returns:
201 * 0 success
202 * >0 f/w reported error
203 * <0 driver reported error
205 * Side effects:
207 * Call context:
208 * process thread
209 ----------------------------------------------------------------*/
210 static int prism2sta_close(wlandevice_t *wlandev)
212 /* We don't currently have to do anything else.
213 * Higher layers know we're not ready from dev->start==0 and
214 * dev->tbusy==1. Our rx path knows to not pass up received
215 * frames because of dev->flags&IFF_UP is false.
218 return 0;
221 /*----------------------------------------------------------------
222 * prism2sta_reset
224 * Not currently implented.
226 * Arguments:
227 * wlandev wlan device structure
228 * none
230 * Returns:
231 * nothing
233 * Side effects:
235 * Call context:
236 * process thread
237 ----------------------------------------------------------------*/
238 static void prism2sta_reset(wlandevice_t *wlandev)
242 /*----------------------------------------------------------------
243 * prism2sta_txframe
245 * Takes a frame from p80211 and queues it for transmission.
247 * Arguments:
248 * wlandev wlan device structure
249 * pb packet buffer struct. Contains an 802.11
250 * data frame.
251 * p80211_hdr points to the 802.11 header for the packet.
252 * Returns:
253 * 0 Success and more buffs available
254 * 1 Success but no more buffs
255 * 2 Allocation failure
256 * 4 Buffer full or queue busy
258 * Side effects:
260 * Call context:
261 * process thread
262 ----------------------------------------------------------------*/
263 static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
264 union p80211_hdr *p80211_hdr,
265 struct p80211_metawep *p80211_wep)
267 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
268 int result;
270 /* If necessary, set the 802.11 WEP bit */
271 if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) ==
272 HOSTWEP_PRIVACYINVOKED) {
273 p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
276 result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep);
278 return result;
281 /*----------------------------------------------------------------
282 * prism2sta_mlmerequest
284 * wlan command message handler. All we do here is pass the message
285 * over to the prism2sta_mgmt_handler.
287 * Arguments:
288 * wlandev wlan device structure
289 * msg wlan command message
290 * Returns:
291 * 0 success
292 * <0 successful acceptance of message, but we're
293 * waiting for an async process to finish before
294 * we're done with the msg. When the asynch
295 * process is done, we'll call the p80211
296 * function p80211req_confirm() .
297 * >0 An error occurred while we were handling
298 * the message.
300 * Side effects:
302 * Call context:
303 * process thread
304 ----------------------------------------------------------------*/
305 static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg)
307 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
309 int result = 0;
311 switch (msg->msgcode) {
312 case DIDmsg_dot11req_mibget:
313 pr_debug("Received mibget request\n");
314 result = prism2mgmt_mibset_mibget(wlandev, msg);
315 break;
316 case DIDmsg_dot11req_mibset:
317 pr_debug("Received mibset request\n");
318 result = prism2mgmt_mibset_mibget(wlandev, msg);
319 break;
320 case DIDmsg_dot11req_scan:
321 pr_debug("Received scan request\n");
322 result = prism2mgmt_scan(wlandev, msg);
323 break;
324 case DIDmsg_dot11req_scan_results:
325 pr_debug("Received scan_results request\n");
326 result = prism2mgmt_scan_results(wlandev, msg);
327 break;
328 case DIDmsg_dot11req_start:
329 pr_debug("Received mlme start request\n");
330 result = prism2mgmt_start(wlandev, msg);
331 break;
333 * Prism2 specific messages
335 case DIDmsg_p2req_readpda:
336 pr_debug("Received mlme readpda request\n");
337 result = prism2mgmt_readpda(wlandev, msg);
338 break;
339 case DIDmsg_p2req_ramdl_state:
340 pr_debug("Received mlme ramdl_state request\n");
341 result = prism2mgmt_ramdl_state(wlandev, msg);
342 break;
343 case DIDmsg_p2req_ramdl_write:
344 pr_debug("Received mlme ramdl_write request\n");
345 result = prism2mgmt_ramdl_write(wlandev, msg);
346 break;
347 case DIDmsg_p2req_flashdl_state:
348 pr_debug("Received mlme flashdl_state request\n");
349 result = prism2mgmt_flashdl_state(wlandev, msg);
350 break;
351 case DIDmsg_p2req_flashdl_write:
352 pr_debug("Received mlme flashdl_write request\n");
353 result = prism2mgmt_flashdl_write(wlandev, msg);
354 break;
356 * Linux specific messages
358 case DIDmsg_lnxreq_hostwep:
359 break; /* ignore me. */
360 case DIDmsg_lnxreq_ifstate:
362 struct p80211msg_lnxreq_ifstate *ifstatemsg;
363 pr_debug("Received mlme ifstate request\n");
364 ifstatemsg = (struct p80211msg_lnxreq_ifstate *) msg;
365 result =
366 prism2sta_ifstate(wlandev,
367 ifstatemsg->ifstate.data);
368 ifstatemsg->resultcode.status =
369 P80211ENUM_msgitem_status_data_ok;
370 ifstatemsg->resultcode.data = result;
371 result = 0;
373 break;
374 case DIDmsg_lnxreq_wlansniff:
375 pr_debug("Received mlme wlansniff request\n");
376 result = prism2mgmt_wlansniff(wlandev, msg);
377 break;
378 case DIDmsg_lnxreq_autojoin:
379 pr_debug("Received mlme autojoin request\n");
380 result = prism2mgmt_autojoin(wlandev, msg);
381 break;
382 case DIDmsg_lnxreq_commsquality:{
383 struct p80211msg_lnxreq_commsquality *qualmsg;
385 pr_debug("Received commsquality request\n");
387 qualmsg = (struct p80211msg_lnxreq_commsquality *) msg;
389 qualmsg->link.status =
390 P80211ENUM_msgitem_status_data_ok;
391 qualmsg->level.status =
392 P80211ENUM_msgitem_status_data_ok;
393 qualmsg->noise.status =
394 P80211ENUM_msgitem_status_data_ok;
396 qualmsg->link.data = le16_to_cpu(hw->qual.CQ_currBSS);
397 qualmsg->level.data = le16_to_cpu(hw->qual.ASL_currBSS);
398 qualmsg->noise.data = le16_to_cpu(hw->qual.ANL_currFC);
399 qualmsg->txrate.data = hw->txrate;
401 break;
403 default:
404 printk(KERN_WARNING "Unknown mgmt request message 0x%08x",
405 msg->msgcode);
406 break;
409 return result;
412 /*----------------------------------------------------------------
413 * prism2sta_ifstate
415 * Interface state. This is the primary WLAN interface enable/disable
416 * handler. Following the driver/load/deviceprobe sequence, this
417 * function must be called with a state of "enable" before any other
418 * commands will be accepted.
420 * Arguments:
421 * wlandev wlan device structure
422 * msgp ptr to msg buffer
424 * Returns:
425 * A p80211 message resultcode value.
427 * Side effects:
429 * Call context:
430 * process thread (usually)
431 * interrupt
432 ----------------------------------------------------------------*/
433 u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
435 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
436 u32 result;
438 result = P80211ENUM_resultcode_implementation_failure;
440 pr_debug("Current MSD state(%d), requesting(%d)\n",
441 wlandev->msdstate, ifstate);
442 switch (ifstate) {
443 case P80211ENUM_ifstate_fwload:
444 switch (wlandev->msdstate) {
445 case WLAN_MSD_HWPRESENT:
446 wlandev->msdstate = WLAN_MSD_FWLOAD_PENDING;
448 * Initialize the device+driver sufficiently
449 * for firmware loading.
451 result = hfa384x_drvr_start(hw);
452 if (result) {
453 netdev_err(wlandev->netdev,
454 "hfa384x_drvr_start() failed,result=%d\n", (int)result);
455 result =
456 P80211ENUM_resultcode_implementation_failure;
457 wlandev->msdstate = WLAN_MSD_HWPRESENT;
458 break;
460 wlandev->msdstate = WLAN_MSD_FWLOAD;
461 result = P80211ENUM_resultcode_success;
462 break;
463 case WLAN_MSD_FWLOAD:
464 hfa384x_cmd_initialize(hw);
465 result = P80211ENUM_resultcode_success;
466 break;
467 case WLAN_MSD_RUNNING:
468 printk(KERN_WARNING
469 "Cannot enter fwload state from enable state,"
470 "you must disable first.\n");
471 result = P80211ENUM_resultcode_invalid_parameters;
472 break;
473 case WLAN_MSD_HWFAIL:
474 default:
475 /* probe() had a problem or the msdstate contains
476 * an unrecognized value, there's nothing we can do.
478 result = P80211ENUM_resultcode_implementation_failure;
479 break;
481 break;
482 case P80211ENUM_ifstate_enable:
483 switch (wlandev->msdstate) {
484 case WLAN_MSD_HWPRESENT:
485 case WLAN_MSD_FWLOAD:
486 wlandev->msdstate = WLAN_MSD_RUNNING_PENDING;
487 /* Initialize the device+driver for full
488 * operation. Note that this might me an FWLOAD to
489 * to RUNNING transition so we must not do a chip
490 * or board level reset. Note that on failure,
491 * the MSD state is set to HWPRESENT because we
492 * can't make any assumptions about the state
493 * of the hardware or a previous firmware load.
495 result = hfa384x_drvr_start(hw);
496 if (result) {
497 netdev_err(wlandev->netdev,
498 "hfa384x_drvr_start() failed,result=%d\n", (int)result);
499 result =
500 P80211ENUM_resultcode_implementation_failure;
501 wlandev->msdstate = WLAN_MSD_HWPRESENT;
502 break;
505 result = prism2sta_getcardinfo(wlandev);
506 if (result) {
507 netdev_err(wlandev->netdev,
508 "prism2sta_getcardinfo() failed,result=%d\n", (int)result);
509 result =
510 P80211ENUM_resultcode_implementation_failure;
511 hfa384x_drvr_stop(hw);
512 wlandev->msdstate = WLAN_MSD_HWPRESENT;
513 break;
515 result = prism2sta_globalsetup(wlandev);
516 if (result) {
517 netdev_err(wlandev->netdev,
518 "prism2sta_globalsetup() failed,result=%d\n", (int)result);
519 result =
520 P80211ENUM_resultcode_implementation_failure;
521 hfa384x_drvr_stop(hw);
522 wlandev->msdstate = WLAN_MSD_HWPRESENT;
523 break;
525 wlandev->msdstate = WLAN_MSD_RUNNING;
526 hw->join_ap = 0;
527 hw->join_retries = 60;
528 result = P80211ENUM_resultcode_success;
529 break;
530 case WLAN_MSD_RUNNING:
531 /* Do nothing, we're already in this state. */
532 result = P80211ENUM_resultcode_success;
533 break;
534 case WLAN_MSD_HWFAIL:
535 default:
536 /* probe() had a problem or the msdstate contains
537 * an unrecognized value, there's nothing we can do.
539 result = P80211ENUM_resultcode_implementation_failure;
540 break;
542 break;
543 case P80211ENUM_ifstate_disable:
544 switch (wlandev->msdstate) {
545 case WLAN_MSD_HWPRESENT:
546 /* Do nothing, we're already in this state. */
547 result = P80211ENUM_resultcode_success;
548 break;
549 case WLAN_MSD_FWLOAD:
550 case WLAN_MSD_RUNNING:
551 wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING;
553 * TODO: Shut down the MAC completely. Here a chip
554 * or board level reset is probably called for.
555 * After a "disable" _all_ results are lost, even
556 * those from a fwload.
558 if (!wlandev->hwremoved)
559 netif_carrier_off(wlandev->netdev);
561 hfa384x_drvr_stop(hw);
563 wlandev->macmode = WLAN_MACMODE_NONE;
564 wlandev->msdstate = WLAN_MSD_HWPRESENT;
565 result = P80211ENUM_resultcode_success;
566 break;
567 case WLAN_MSD_HWFAIL:
568 default:
569 /* probe() had a problem or the msdstate contains
570 * an unrecognized value, there's nothing we can do.
572 result = P80211ENUM_resultcode_implementation_failure;
573 break;
575 break;
576 default:
577 result = P80211ENUM_resultcode_invalid_parameters;
578 break;
581 return result;
584 /*----------------------------------------------------------------
585 * prism2sta_getcardinfo
587 * Collect the NICID, firmware version and any other identifiers
588 * we'd like to have in host-side data structures.
590 * Arguments:
591 * wlandev wlan device structure
593 * Returns:
594 * 0 success
595 * >0 f/w reported error
596 * <0 driver reported error
598 * Side effects:
600 * Call context:
601 * Either.
602 ----------------------------------------------------------------*/
603 static int prism2sta_getcardinfo(wlandevice_t *wlandev)
605 int result = 0;
606 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
607 u16 temp;
608 u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN];
609 char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1];
611 /* Collect version and compatibility info */
612 /* Some are critical, some are not */
613 /* NIC identity */
614 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY,
615 &hw->ident_nic,
616 sizeof(hfa384x_compident_t));
617 if (result) {
618 netdev_err(wlandev->netdev, "Failed to retrieve NICIDENTITY\n");
619 goto failed;
622 /* get all the nic id fields in host byte order */
623 hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
624 hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
625 hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
626 hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
628 netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
629 hw->ident_nic.id, hw->ident_nic.major,
630 hw->ident_nic.minor, hw->ident_nic.variant);
632 /* Primary f/w identity */
633 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY,
634 &hw->ident_pri_fw,
635 sizeof(hfa384x_compident_t));
636 if (result) {
637 netdev_err(wlandev->netdev, "Failed to retrieve PRIIDENTITY\n");
638 goto failed;
641 /* get all the private fw id fields in host byte order */
642 hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
643 hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
644 hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
645 hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
647 netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
648 hw->ident_pri_fw.id, hw->ident_pri_fw.major,
649 hw->ident_pri_fw.minor, hw->ident_pri_fw.variant);
651 /* Station (Secondary?) f/w identity */
652 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY,
653 &hw->ident_sta_fw,
654 sizeof(hfa384x_compident_t));
655 if (result) {
656 netdev_err(wlandev->netdev, "Failed to retrieve STAIDENTITY\n");
657 goto failed;
660 if (hw->ident_nic.id < 0x8000) {
661 netdev_err(wlandev->netdev,
662 "FATAL: Card is not an Intersil Prism2/2.5/3\n");
663 result = -1;
664 goto failed;
667 /* get all the station fw id fields in host byte order */
668 hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
669 hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
670 hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
671 hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
673 /* strip out the 'special' variant bits */
674 hw->mm_mods = hw->ident_sta_fw.variant & (BIT(14) | BIT(15));
675 hw->ident_sta_fw.variant &= ~((u16) (BIT(14) | BIT(15)));
677 if (hw->ident_sta_fw.id == 0x1f) {
678 netdev_info(wlandev->netdev,
679 "ident: sta f/w: id=0x%02x %d.%d.%d\n",
680 hw->ident_sta_fw.id, hw->ident_sta_fw.major,
681 hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
682 } else {
683 netdev_info(wlandev->netdev,
684 "ident: ap f/w: id=0x%02x %d.%d.%d\n",
685 hw->ident_sta_fw.id, hw->ident_sta_fw.major,
686 hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
687 netdev_err(wlandev->netdev, "Unsupported Tertiary AP firmeare loaded!\n");
688 goto failed;
691 /* Compatibility range, Modem supplier */
692 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE,
693 &hw->cap_sup_mfi,
694 sizeof(hfa384x_caplevel_t));
695 if (result) {
696 netdev_err(wlandev->netdev, "Failed to retrieve MFISUPRANGE\n");
697 goto failed;
700 /* get all the Compatibility range, modem interface supplier
701 fields in byte order */
702 hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
703 hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
704 hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
705 hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
706 hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
708 netdev_info(wlandev->netdev,
709 "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
710 hw->cap_sup_mfi.role, hw->cap_sup_mfi.id,
711 hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom,
712 hw->cap_sup_mfi.top);
714 /* Compatibility range, Controller supplier */
715 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE,
716 &hw->cap_sup_cfi,
717 sizeof(hfa384x_caplevel_t));
718 if (result) {
719 netdev_err(wlandev->netdev, "Failed to retrieve CFISUPRANGE\n");
720 goto failed;
723 /* get all the Compatibility range, controller interface supplier
724 fields in byte order */
725 hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
726 hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
727 hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
728 hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
729 hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
731 netdev_info(wlandev->netdev,
732 "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
733 hw->cap_sup_cfi.role, hw->cap_sup_cfi.id,
734 hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom,
735 hw->cap_sup_cfi.top);
737 /* Compatibility range, Primary f/w supplier */
738 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE,
739 &hw->cap_sup_pri,
740 sizeof(hfa384x_caplevel_t));
741 if (result) {
742 netdev_err(wlandev->netdev, "Failed to retrieve PRISUPRANGE\n");
743 goto failed;
746 /* get all the Compatibility range, primary firmware supplier
747 fields in byte order */
748 hw->cap_sup_pri.role = le16_to_cpu(hw->cap_sup_pri.role);
749 hw->cap_sup_pri.id = le16_to_cpu(hw->cap_sup_pri.id);
750 hw->cap_sup_pri.variant = le16_to_cpu(hw->cap_sup_pri.variant);
751 hw->cap_sup_pri.bottom = le16_to_cpu(hw->cap_sup_pri.bottom);
752 hw->cap_sup_pri.top = le16_to_cpu(hw->cap_sup_pri.top);
754 netdev_info(wlandev->netdev,
755 "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
756 hw->cap_sup_pri.role, hw->cap_sup_pri.id,
757 hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom,
758 hw->cap_sup_pri.top);
760 /* Compatibility range, Station f/w supplier */
761 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE,
762 &hw->cap_sup_sta,
763 sizeof(hfa384x_caplevel_t));
764 if (result) {
765 netdev_err(wlandev->netdev, "Failed to retrieve STASUPRANGE\n");
766 goto failed;
769 /* get all the Compatibility range, station firmware supplier
770 fields in byte order */
771 hw->cap_sup_sta.role = le16_to_cpu(hw->cap_sup_sta.role);
772 hw->cap_sup_sta.id = le16_to_cpu(hw->cap_sup_sta.id);
773 hw->cap_sup_sta.variant = le16_to_cpu(hw->cap_sup_sta.variant);
774 hw->cap_sup_sta.bottom = le16_to_cpu(hw->cap_sup_sta.bottom);
775 hw->cap_sup_sta.top = le16_to_cpu(hw->cap_sup_sta.top);
777 if (hw->cap_sup_sta.id == 0x04) {
778 netdev_info(wlandev->netdev,
779 "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
780 hw->cap_sup_sta.role, hw->cap_sup_sta.id,
781 hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
782 hw->cap_sup_sta.top);
783 } else {
784 netdev_info(wlandev->netdev,
785 "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
786 hw->cap_sup_sta.role, hw->cap_sup_sta.id,
787 hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
788 hw->cap_sup_sta.top);
791 /* Compatibility range, primary f/w actor, CFI supplier */
792 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES,
793 &hw->cap_act_pri_cfi,
794 sizeof(hfa384x_caplevel_t));
795 if (result) {
796 netdev_err(wlandev->netdev, "Failed to retrieve PRI_CFIACTRANGES\n");
797 goto failed;
800 /* get all the Compatibility range, primary f/w actor, CFI supplier
801 fields in byte order */
802 hw->cap_act_pri_cfi.role = le16_to_cpu(hw->cap_act_pri_cfi.role);
803 hw->cap_act_pri_cfi.id = le16_to_cpu(hw->cap_act_pri_cfi.id);
804 hw->cap_act_pri_cfi.variant = le16_to_cpu(hw->cap_act_pri_cfi.variant);
805 hw->cap_act_pri_cfi.bottom = le16_to_cpu(hw->cap_act_pri_cfi.bottom);
806 hw->cap_act_pri_cfi.top = le16_to_cpu(hw->cap_act_pri_cfi.top);
808 netdev_info(wlandev->netdev,
809 "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
810 hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id,
811 hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom,
812 hw->cap_act_pri_cfi.top);
814 /* Compatibility range, sta f/w actor, CFI supplier */
815 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES,
816 &hw->cap_act_sta_cfi,
817 sizeof(hfa384x_caplevel_t));
818 if (result) {
819 netdev_err(wlandev->netdev, "Failed to retrieve STA_CFIACTRANGES\n");
820 goto failed;
823 /* get all the Compatibility range, station f/w actor, CFI supplier
824 fields in byte order */
825 hw->cap_act_sta_cfi.role = le16_to_cpu(hw->cap_act_sta_cfi.role);
826 hw->cap_act_sta_cfi.id = le16_to_cpu(hw->cap_act_sta_cfi.id);
827 hw->cap_act_sta_cfi.variant = le16_to_cpu(hw->cap_act_sta_cfi.variant);
828 hw->cap_act_sta_cfi.bottom = le16_to_cpu(hw->cap_act_sta_cfi.bottom);
829 hw->cap_act_sta_cfi.top = le16_to_cpu(hw->cap_act_sta_cfi.top);
831 netdev_info(wlandev->netdev,
832 "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
833 hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id,
834 hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom,
835 hw->cap_act_sta_cfi.top);
837 /* Compatibility range, sta f/w actor, MFI supplier */
838 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES,
839 &hw->cap_act_sta_mfi,
840 sizeof(hfa384x_caplevel_t));
841 if (result) {
842 netdev_err(wlandev->netdev, "Failed to retrieve STA_MFIACTRANGES\n");
843 goto failed;
846 /* get all the Compatibility range, station f/w actor, MFI supplier
847 fields in byte order */
848 hw->cap_act_sta_mfi.role = le16_to_cpu(hw->cap_act_sta_mfi.role);
849 hw->cap_act_sta_mfi.id = le16_to_cpu(hw->cap_act_sta_mfi.id);
850 hw->cap_act_sta_mfi.variant = le16_to_cpu(hw->cap_act_sta_mfi.variant);
851 hw->cap_act_sta_mfi.bottom = le16_to_cpu(hw->cap_act_sta_mfi.bottom);
852 hw->cap_act_sta_mfi.top = le16_to_cpu(hw->cap_act_sta_mfi.top);
854 netdev_info(wlandev->netdev,
855 "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
856 hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id,
857 hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom,
858 hw->cap_act_sta_mfi.top);
860 /* Serial Number */
861 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER,
862 snum, HFA384x_RID_NICSERIALNUMBER_LEN);
863 if (!result) {
864 wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN,
865 pstr, sizeof(pstr));
866 netdev_info(wlandev->netdev, "Prism2 card SN: %s\n", pstr);
867 } else {
868 netdev_err(wlandev->netdev, "Failed to retrieve Prism2 Card SN\n");
869 goto failed;
872 /* Collect the MAC address */
873 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR,
874 wlandev->netdev->dev_addr, ETH_ALEN);
875 if (result != 0) {
876 netdev_err(wlandev->netdev, "Failed to retrieve mac address\n");
877 goto failed;
880 /* short preamble is always implemented */
881 wlandev->nsdcaps |= P80211_NSDCAP_SHORT_PREAMBLE;
883 /* find out if hardware wep is implemented */
884 hfa384x_drvr_getconfig16(hw, HFA384x_RID_PRIVACYOPTIMP, &temp);
885 if (temp)
886 wlandev->nsdcaps |= P80211_NSDCAP_HARDWAREWEP;
888 /* get the dBm Scaling constant */
889 hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFDBMADJUST, &temp);
890 hw->dbmadjust = temp;
892 /* Only enable scan by default on newer firmware */
893 if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major,
894 hw->ident_sta_fw.minor,
895 hw->ident_sta_fw.variant) <
896 HFA384x_FIRMWARE_VERSION(1, 5, 5)) {
897 wlandev->nsdcaps |= P80211_NSDCAP_NOSCAN;
900 /* TODO: Set any internally managed config items */
902 goto done;
903 failed:
904 netdev_err(wlandev->netdev, "Failed, result=%d\n", result);
905 done:
906 return result;
909 /*----------------------------------------------------------------
910 * prism2sta_globalsetup
912 * Set any global RIDs that we want to set at device activation.
914 * Arguments:
915 * wlandev wlan device structure
917 * Returns:
918 * 0 success
919 * >0 f/w reported error
920 * <0 driver reported error
922 * Side effects:
924 * Call context:
925 * process thread
926 ----------------------------------------------------------------*/
927 static int prism2sta_globalsetup(wlandevice_t *wlandev)
929 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
931 /* Set the maximum frame size */
932 return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN,
933 WLAN_DATA_MAXLEN);
936 static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev)
938 int result = 0;
939 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
941 u16 promisc;
943 /* If we're not ready, what's the point? */
944 if (hw->state != HFA384x_STATE_RUNNING)
945 goto exit;
947 if ((dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
948 promisc = P80211ENUM_truth_true;
949 else
950 promisc = P80211ENUM_truth_false;
952 result =
953 hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE,
954 promisc);
955 exit:
956 return result;
959 /*----------------------------------------------------------------
960 * prism2sta_inf_handover
962 * Handles the receipt of a Handover info frame. Should only be present
963 * in APs only.
965 * Arguments:
966 * wlandev wlan device structure
967 * inf ptr to info frame (contents in hfa384x order)
969 * Returns:
970 * nothing
972 * Side effects:
974 * Call context:
975 * interrupt
976 ----------------------------------------------------------------*/
977 static void prism2sta_inf_handover(wlandevice_t *wlandev,
978 hfa384x_InfFrame_t *inf)
980 pr_debug("received infoframe:HANDOVER (unhandled)\n");
983 /*----------------------------------------------------------------
984 * prism2sta_inf_tallies
986 * Handles the receipt of a CommTallies info frame.
988 * Arguments:
989 * wlandev wlan device structure
990 * inf ptr to info frame (contents in hfa384x order)
992 * Returns:
993 * nothing
995 * Side effects:
997 * Call context:
998 * interrupt
999 ----------------------------------------------------------------*/
1000 static void prism2sta_inf_tallies(wlandevice_t *wlandev,
1001 hfa384x_InfFrame_t *inf)
1003 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1004 u16 *src16;
1005 u32 *dst;
1006 u32 *src32;
1007 int i;
1008 int cnt;
1011 ** Determine if these are 16-bit or 32-bit tallies, based on the
1012 ** record length of the info record.
1015 cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(u32);
1016 if (inf->framelen > 22) {
1017 dst = (u32 *) &hw->tallies;
1018 src32 = (u32 *) &inf->info.commtallies32;
1019 for (i = 0; i < cnt; i++, dst++, src32++)
1020 *dst += le32_to_cpu(*src32);
1021 } else {
1022 dst = (u32 *) &hw->tallies;
1023 src16 = (u16 *) &inf->info.commtallies16;
1024 for (i = 0; i < cnt; i++, dst++, src16++)
1025 *dst += le16_to_cpu(*src16);
1029 /*----------------------------------------------------------------
1030 * prism2sta_inf_scanresults
1032 * Handles the receipt of a Scan Results info frame.
1034 * Arguments:
1035 * wlandev wlan device structure
1036 * inf ptr to info frame (contents in hfa384x order)
1038 * Returns:
1039 * nothing
1041 * Side effects:
1043 * Call context:
1044 * interrupt
1045 ----------------------------------------------------------------*/
1046 static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
1047 hfa384x_InfFrame_t *inf)
1050 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1051 int nbss;
1052 hfa384x_ScanResult_t *sr = &(inf->info.scanresult);
1053 int i;
1054 hfa384x_JoinRequest_data_t joinreq;
1055 int result;
1057 /* Get the number of results, first in bytes, then in results */
1058 nbss = (inf->framelen * sizeof(u16)) -
1059 sizeof(inf->infotype) - sizeof(inf->info.scanresult.scanreason);
1060 nbss /= sizeof(hfa384x_ScanResultSub_t);
1062 /* Print em */
1063 pr_debug("rx scanresults, reason=%d, nbss=%d:\n",
1064 inf->info.scanresult.scanreason, nbss);
1065 for (i = 0; i < nbss; i++) {
1066 pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n",
1067 sr->result[i].chid,
1068 sr->result[i].anl,
1069 sr->result[i].sl, sr->result[i].bcnint);
1070 pr_debug(" capinfo=0x%04x proberesp_rate=%d\n",
1071 sr->result[i].capinfo, sr->result[i].proberesp_rate);
1073 /* issue a join request */
1074 joinreq.channel = sr->result[0].chid;
1075 memcpy(joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN);
1076 result = hfa384x_drvr_setconfig(hw,
1077 HFA384x_RID_JOINREQUEST,
1078 &joinreq, HFA384x_RID_JOINREQUEST_LEN);
1079 if (result) {
1080 netdev_err(wlandev->netdev, "setconfig(joinreq) failed, result=%d\n",
1081 result);
1085 /*----------------------------------------------------------------
1086 * prism2sta_inf_hostscanresults
1088 * Handles the receipt of a Scan Results info frame.
1090 * Arguments:
1091 * wlandev wlan device structure
1092 * inf ptr to info frame (contents in hfa384x order)
1094 * Returns:
1095 * nothing
1097 * Side effects:
1099 * Call context:
1100 * interrupt
1101 ----------------------------------------------------------------*/
1102 static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
1103 hfa384x_InfFrame_t *inf)
1105 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1106 int nbss;
1108 nbss = (inf->framelen - 3) / 32;
1109 pr_debug("Received %d hostscan results\n", nbss);
1111 if (nbss > 32)
1112 nbss = 32;
1114 kfree(hw->scanresults);
1116 hw->scanresults = kmemdup(inf, sizeof(hfa384x_InfFrame_t), GFP_ATOMIC);
1118 if (nbss == 0)
1119 nbss = -1;
1121 /* Notify/wake the sleeping caller. */
1122 hw->scanflag = nbss;
1123 wake_up_interruptible(&hw->cmdq);
1126 /*----------------------------------------------------------------
1127 * prism2sta_inf_chinforesults
1129 * Handles the receipt of a Channel Info Results info frame.
1131 * Arguments:
1132 * wlandev wlan device structure
1133 * inf ptr to info frame (contents in hfa384x order)
1135 * Returns:
1136 * nothing
1138 * Side effects:
1140 * Call context:
1141 * interrupt
1142 ----------------------------------------------------------------*/
1143 static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
1144 hfa384x_InfFrame_t *inf)
1146 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1147 unsigned int i, n;
1149 hw->channel_info.results.scanchannels =
1150 le16_to_cpu(inf->info.chinforesult.scanchannels);
1152 for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) {
1153 hfa384x_ChInfoResultSub_t *result;
1154 hfa384x_ChInfoResultSub_t *chinforesult;
1155 int chan;
1157 if (!(hw->channel_info.results.scanchannels & (1 << i)))
1158 continue;
1160 result = &inf->info.chinforesult.result[n];
1161 chan = le16_to_cpu(result->chid) - 1;
1163 if (chan < 0 || chan >= HFA384x_CHINFORESULT_MAX)
1164 continue;
1166 chinforesult = &hw->channel_info.results.result[chan];
1167 chinforesult->chid = chan;
1168 chinforesult->anl = le16_to_cpu(result->anl);
1169 chinforesult->pnl = le16_to_cpu(result->pnl);
1170 chinforesult->active = le16_to_cpu(result->active);
1172 pr_debug("chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
1173 chan + 1,
1174 (chinforesult->active & HFA384x_CHINFORESULT_BSSACTIVE)
1175 ? "signal" : "noise",
1176 chinforesult->anl, chinforesult->pnl,
1177 (chinforesult->active & HFA384x_CHINFORESULT_PCFACTIVE)
1178 ? 1 : 0);
1179 n++;
1181 atomic_set(&hw->channel_info.done, 2);
1183 hw->channel_info.count = n;
1186 void prism2sta_processing_defer(struct work_struct *data)
1188 hfa384x_t *hw = container_of(data, struct hfa384x, link_bh);
1189 wlandevice_t *wlandev = hw->wlandev;
1190 hfa384x_bytestr32_t ssid;
1191 int result;
1193 /* First let's process the auth frames */
1195 struct sk_buff *skb;
1196 hfa384x_InfFrame_t *inf;
1198 while ((skb = skb_dequeue(&hw->authq))) {
1199 inf = (hfa384x_InfFrame_t *) skb->data;
1200 prism2sta_inf_authreq_defer(wlandev, inf);
1205 /* Now let's handle the linkstatus stuff */
1206 if (hw->link_status == hw->link_status_new)
1207 return;
1209 hw->link_status = hw->link_status_new;
1211 switch (hw->link_status) {
1212 case HFA384x_LINK_NOTCONNECTED:
1213 /* I'm currently assuming that this is the initial link
1214 * state. It should only be possible immediately
1215 * following an Enable command.
1216 * Response:
1217 * Block Transmits, Ignore receives of data frames
1219 netif_carrier_off(wlandev->netdev);
1221 netdev_info(wlandev->netdev, "linkstatus=NOTCONNECTED (unhandled)\n");
1222 break;
1224 case HFA384x_LINK_CONNECTED:
1225 /* This one indicates a successful scan/join/auth/assoc.
1226 * When we have the full MLME complement, this event will
1227 * signify successful completion of both mlme_authenticate
1228 * and mlme_associate. State management will get a little
1229 * ugly here.
1230 * Response:
1231 * Indicate authentication and/or association
1232 * Enable Transmits, Receives and pass up data frames
1235 netif_carrier_on(wlandev->netdev);
1237 /* If we are joining a specific AP, set our
1238 * state and reset retries
1240 if (hw->join_ap == 1)
1241 hw->join_ap = 2;
1242 hw->join_retries = 60;
1244 /* Don't call this in monitor mode */
1245 if (wlandev->netdev->type == ARPHRD_ETHER) {
1246 u16 portstatus;
1248 netdev_info(wlandev->netdev, "linkstatus=CONNECTED\n");
1250 /* For non-usb devices, we can use the sync versions */
1251 /* Collect the BSSID, and set state to allow tx */
1253 result = hfa384x_drvr_getconfig(hw,
1254 HFA384x_RID_CURRENTBSSID,
1255 wlandev->bssid,
1256 WLAN_BSSID_LEN);
1257 if (result) {
1258 pr_debug
1259 ("getconfig(0x%02x) failed, result = %d\n",
1260 HFA384x_RID_CURRENTBSSID, result);
1261 return;
1264 result = hfa384x_drvr_getconfig(hw,
1265 HFA384x_RID_CURRENTSSID,
1266 &ssid, sizeof(ssid));
1267 if (result) {
1268 pr_debug
1269 ("getconfig(0x%02x) failed, result = %d\n",
1270 HFA384x_RID_CURRENTSSID, result);
1271 return;
1273 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
1274 (p80211pstrd_t *) &
1275 wlandev->ssid);
1277 /* Collect the port status */
1278 result = hfa384x_drvr_getconfig16(hw,
1279 HFA384x_RID_PORTSTATUS,
1280 &portstatus);
1281 if (result) {
1282 pr_debug
1283 ("getconfig(0x%02x) failed, result = %d\n",
1284 HFA384x_RID_PORTSTATUS, result);
1285 return;
1287 wlandev->macmode =
1288 (portstatus == HFA384x_PSTATUS_CONN_IBSS) ?
1289 WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA;
1291 /* signal back up to cfg80211 layer */
1292 prism2_connect_result(wlandev, P80211ENUM_truth_false);
1294 /* Get the ball rolling on the comms quality stuff */
1295 prism2sta_commsqual_defer(&hw->commsqual_bh);
1297 break;
1299 case HFA384x_LINK_DISCONNECTED:
1300 /* This one indicates that our association is gone. We've
1301 * lost connection with the AP and/or been disassociated.
1302 * This indicates that the MAC has completely cleared it's
1303 * associated state. We * should send a deauth indication
1304 * (implying disassoc) up * to the MLME.
1305 * Response:
1306 * Indicate Deauthentication
1307 * Block Transmits, Ignore receives of data frames
1309 if (wlandev->netdev->type == ARPHRD_ETHER)
1310 netdev_info(wlandev->netdev,
1311 "linkstatus=DISCONNECTED (unhandled)\n");
1312 wlandev->macmode = WLAN_MACMODE_NONE;
1314 netif_carrier_off(wlandev->netdev);
1316 /* signal back up to cfg80211 layer */
1317 prism2_disconnected(wlandev);
1319 break;
1321 case HFA384x_LINK_AP_CHANGE:
1322 /* This one indicates that the MAC has decided to and
1323 * successfully completed a change to another AP. We
1324 * should probably implement a reassociation indication
1325 * in response to this one. I'm thinking that the the
1326 * p80211 layer needs to be notified in case of
1327 * buffering/queueing issues. User mode also needs to be
1328 * notified so that any BSS dependent elements can be
1329 * updated.
1330 * associated state. We * should send a deauth indication
1331 * (implying disassoc) up * to the MLME.
1332 * Response:
1333 * Indicate Reassociation
1334 * Enable Transmits, Receives and pass up data frames
1336 netdev_info(wlandev->netdev, "linkstatus=AP_CHANGE\n");
1338 result = hfa384x_drvr_getconfig(hw,
1339 HFA384x_RID_CURRENTBSSID,
1340 wlandev->bssid, WLAN_BSSID_LEN);
1341 if (result) {
1342 pr_debug("getconfig(0x%02x) failed, result = %d\n",
1343 HFA384x_RID_CURRENTBSSID, result);
1344 return;
1347 result = hfa384x_drvr_getconfig(hw,
1348 HFA384x_RID_CURRENTSSID,
1349 &ssid, sizeof(ssid));
1350 if (result) {
1351 pr_debug("getconfig(0x%02x) failed, result = %d\n",
1352 HFA384x_RID_CURRENTSSID, result);
1353 return;
1355 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
1356 (p80211pstrd_t *) &wlandev->ssid);
1358 hw->link_status = HFA384x_LINK_CONNECTED;
1359 netif_carrier_on(wlandev->netdev);
1361 /* signal back up to cfg80211 layer */
1362 prism2_roamed(wlandev);
1364 break;
1366 case HFA384x_LINK_AP_OUTOFRANGE:
1367 /* This one indicates that the MAC has decided that the
1368 * AP is out of range, but hasn't found a better candidate
1369 * so the MAC maintains its "associated" state in case
1370 * we get back in range. We should block transmits and
1371 * receives in this state. Do we need an indication here?
1372 * Probably not since a polling user-mode element would
1373 * get this status from from p2PortStatus(FD40). What about
1374 * p80211?
1375 * Response:
1376 * Block Transmits, Ignore receives of data frames
1378 netdev_info(wlandev->netdev, "linkstatus=AP_OUTOFRANGE (unhandled)\n");
1380 netif_carrier_off(wlandev->netdev);
1382 break;
1384 case HFA384x_LINK_AP_INRANGE:
1385 /* This one indicates that the MAC has decided that the
1386 * AP is back in range. We continue working with our
1387 * existing association.
1388 * Response:
1389 * Enable Transmits, Receives and pass up data frames
1391 netdev_info(wlandev->netdev, "linkstatus=AP_INRANGE\n");
1393 hw->link_status = HFA384x_LINK_CONNECTED;
1394 netif_carrier_on(wlandev->netdev);
1396 break;
1398 case HFA384x_LINK_ASSOCFAIL:
1399 /* This one is actually a peer to CONNECTED. We've
1400 * requested a join for a given SSID and optionally BSSID.
1401 * We can use this one to indicate authentication and
1402 * association failures. The trick is going to be
1403 * 1) identifying the failure, and 2) state management.
1404 * Response:
1405 * Disable Transmits, Ignore receives of data frames
1407 if (hw->join_ap && --hw->join_retries > 0) {
1408 hfa384x_JoinRequest_data_t joinreq;
1409 joinreq = hw->joinreq;
1410 /* Send the join request */
1411 hfa384x_drvr_setconfig(hw,
1412 HFA384x_RID_JOINREQUEST,
1413 &joinreq,
1414 HFA384x_RID_JOINREQUEST_LEN);
1415 netdev_info(wlandev->netdev,
1416 "linkstatus=ASSOCFAIL (re-submitting join)\n");
1417 } else {
1418 netdev_info(wlandev->netdev, "linkstatus=ASSOCFAIL (unhandled)\n");
1421 netif_carrier_off(wlandev->netdev);
1423 /* signal back up to cfg80211 layer */
1424 prism2_connect_result(wlandev, P80211ENUM_truth_true);
1426 break;
1428 default:
1429 /* This is bad, IO port problems? */
1430 printk(KERN_WARNING
1431 "unknown linkstatus=0x%02x\n", hw->link_status);
1432 return;
1435 wlandev->linkstatus = (hw->link_status == HFA384x_LINK_CONNECTED);
1438 /*----------------------------------------------------------------
1439 * prism2sta_inf_linkstatus
1441 * Handles the receipt of a Link Status info frame.
1443 * Arguments:
1444 * wlandev wlan device structure
1445 * inf ptr to info frame (contents in hfa384x order)
1447 * Returns:
1448 * nothing
1450 * Side effects:
1452 * Call context:
1453 * interrupt
1454 ----------------------------------------------------------------*/
1455 static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
1456 hfa384x_InfFrame_t *inf)
1458 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1460 hw->link_status_new = le16_to_cpu(inf->info.linkstatus.linkstatus);
1462 schedule_work(&hw->link_bh);
1465 /*----------------------------------------------------------------
1466 * prism2sta_inf_assocstatus
1468 * Handles the receipt of an Association Status info frame. Should
1469 * be present in APs only.
1471 * Arguments:
1472 * wlandev wlan device structure
1473 * inf ptr to info frame (contents in hfa384x order)
1475 * Returns:
1476 * nothing
1478 * Side effects:
1480 * Call context:
1481 * interrupt
1482 ----------------------------------------------------------------*/
1483 static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
1484 hfa384x_InfFrame_t *inf)
1486 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1487 hfa384x_AssocStatus_t rec;
1488 int i;
1490 memcpy(&rec, &inf->info.assocstatus, sizeof(rec));
1491 rec.assocstatus = le16_to_cpu(rec.assocstatus);
1492 rec.reason = le16_to_cpu(rec.reason);
1495 ** Find the address in the list of authenticated stations.
1496 ** If it wasn't found, then this address has not been previously
1497 ** authenticated and something weird has happened if this is
1498 ** anything other than an "authentication failed" message.
1499 ** If the address was found, then set the "associated" flag for
1500 ** that station, based on whether the station is associating or
1501 ** losing its association. Something weird has also happened
1502 ** if we find the address in the list of authenticated stations
1503 ** but we are getting an "authentication failed" message.
1506 for (i = 0; i < hw->authlist.cnt; i++)
1507 if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0)
1508 break;
1510 if (i >= hw->authlist.cnt) {
1511 if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL)
1512 printk(KERN_WARNING
1513 "assocstatus info frame received for non-authenticated station.\n");
1514 } else {
1515 hw->authlist.assoc[i] =
1516 (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC ||
1517 rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC);
1519 if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL)
1520 printk(KERN_WARNING
1521 "authfail assocstatus info frame received for authenticated station.\n");
1525 /*----------------------------------------------------------------
1526 * prism2sta_inf_authreq
1528 * Handles the receipt of an Authentication Request info frame. Should
1529 * be present in APs only.
1531 * Arguments:
1532 * wlandev wlan device structure
1533 * inf ptr to info frame (contents in hfa384x order)
1535 * Returns:
1536 * nothing
1538 * Side effects:
1540 * Call context:
1541 * interrupt
1543 ----------------------------------------------------------------*/
1544 static void prism2sta_inf_authreq(wlandevice_t *wlandev,
1545 hfa384x_InfFrame_t *inf)
1547 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1548 struct sk_buff *skb;
1550 skb = dev_alloc_skb(sizeof(*inf));
1551 if (skb) {
1552 skb_put(skb, sizeof(*inf));
1553 memcpy(skb->data, inf, sizeof(*inf));
1554 skb_queue_tail(&hw->authq, skb);
1555 schedule_work(&hw->link_bh);
1559 static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
1560 hfa384x_InfFrame_t *inf)
1562 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1563 hfa384x_authenticateStation_data_t rec;
1565 int i, added, result, cnt;
1566 u8 *addr;
1569 ** Build the AuthenticateStation record. Initialize it for denying
1570 ** authentication.
1573 memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN);
1574 rec.status = P80211ENUM_status_unspec_failure;
1577 ** Authenticate based on the access mode.
1580 switch (hw->accessmode) {
1581 case WLAN_ACCESS_NONE:
1584 ** Deny all new authentications. However, if a station
1585 ** is ALREADY authenticated, then accept it.
1588 for (i = 0; i < hw->authlist.cnt; i++)
1589 if (memcmp(rec.address, hw->authlist.addr[i],
1590 ETH_ALEN) == 0) {
1591 rec.status = P80211ENUM_status_successful;
1592 break;
1595 break;
1597 case WLAN_ACCESS_ALL:
1600 ** Allow all authentications.
1603 rec.status = P80211ENUM_status_successful;
1604 break;
1606 case WLAN_ACCESS_ALLOW:
1609 ** Only allow the authentication if the MAC address
1610 ** is in the list of allowed addresses.
1612 ** Since this is the interrupt handler, we may be here
1613 ** while the access list is in the middle of being
1614 ** updated. Choose the list which is currently okay.
1615 ** See "prism2mib_priv_accessallow()" for details.
1618 if (hw->allow.modify == 0) {
1619 cnt = hw->allow.cnt;
1620 addr = hw->allow.addr[0];
1621 } else {
1622 cnt = hw->allow.cnt1;
1623 addr = hw->allow.addr1[0];
1626 for (i = 0; i < cnt; i++, addr += ETH_ALEN)
1627 if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
1628 rec.status = P80211ENUM_status_successful;
1629 break;
1632 break;
1634 case WLAN_ACCESS_DENY:
1637 ** Allow the authentication UNLESS the MAC address is
1638 ** in the list of denied addresses.
1640 ** Since this is the interrupt handler, we may be here
1641 ** while the access list is in the middle of being
1642 ** updated. Choose the list which is currently okay.
1643 ** See "prism2mib_priv_accessdeny()" for details.
1646 if (hw->deny.modify == 0) {
1647 cnt = hw->deny.cnt;
1648 addr = hw->deny.addr[0];
1649 } else {
1650 cnt = hw->deny.cnt1;
1651 addr = hw->deny.addr1[0];
1654 rec.status = P80211ENUM_status_successful;
1656 for (i = 0; i < cnt; i++, addr += ETH_ALEN)
1657 if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
1658 rec.status = P80211ENUM_status_unspec_failure;
1659 break;
1662 break;
1666 ** If the authentication is okay, then add the MAC address to the
1667 ** list of authenticated stations. Don't add the address if it
1668 ** is already in the list. (802.11b does not seem to disallow
1669 ** a station from issuing an authentication request when the
1670 ** station is already authenticated. Does this sort of thing
1671 ** ever happen? We might as well do the check just in case.)
1674 added = 0;
1676 if (rec.status == P80211ENUM_status_successful) {
1677 for (i = 0; i < hw->authlist.cnt; i++)
1678 if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
1679 == 0)
1680 break;
1682 if (i >= hw->authlist.cnt) {
1683 if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
1684 rec.status = P80211ENUM_status_ap_full;
1685 } else {
1686 memcpy(hw->authlist.addr[hw->authlist.cnt],
1687 rec.address, ETH_ALEN);
1688 hw->authlist.cnt++;
1689 added = 1;
1695 ** Send back the results of the authentication. If this doesn't work,
1696 ** then make sure to remove the address from the authenticated list if
1697 ** it was added.
1700 rec.status = cpu_to_le16(rec.status);
1701 rec.algorithm = inf->info.authreq.algorithm;
1703 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA,
1704 &rec, sizeof(rec));
1705 if (result) {
1706 if (added)
1707 hw->authlist.cnt--;
1708 netdev_err(wlandev->netdev,
1709 "setconfig(authenticatestation) failed, result=%d\n",
1710 result);
1714 /*----------------------------------------------------------------
1715 * prism2sta_inf_psusercnt
1717 * Handles the receipt of a PowerSaveUserCount info frame. Should
1718 * be present in APs only.
1720 * Arguments:
1721 * wlandev wlan device structure
1722 * inf ptr to info frame (contents in hfa384x order)
1724 * Returns:
1725 * nothing
1727 * Side effects:
1729 * Call context:
1730 * interrupt
1731 ----------------------------------------------------------------*/
1732 static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
1733 hfa384x_InfFrame_t *inf)
1735 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1737 hw->psusercount = le16_to_cpu(inf->info.psusercnt.usercnt);
1740 /*----------------------------------------------------------------
1741 * prism2sta_ev_info
1743 * Handles the Info event.
1745 * Arguments:
1746 * wlandev wlan device structure
1747 * inf ptr to a generic info frame
1749 * Returns:
1750 * nothing
1752 * Side effects:
1754 * Call context:
1755 * interrupt
1756 ----------------------------------------------------------------*/
1757 void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
1759 inf->infotype = le16_to_cpu(inf->infotype);
1760 /* Dispatch */
1761 switch (inf->infotype) {
1762 case HFA384x_IT_HANDOVERADDR:
1763 prism2sta_inf_handover(wlandev, inf);
1764 break;
1765 case HFA384x_IT_COMMTALLIES:
1766 prism2sta_inf_tallies(wlandev, inf);
1767 break;
1768 case HFA384x_IT_HOSTSCANRESULTS:
1769 prism2sta_inf_hostscanresults(wlandev, inf);
1770 break;
1771 case HFA384x_IT_SCANRESULTS:
1772 prism2sta_inf_scanresults(wlandev, inf);
1773 break;
1774 case HFA384x_IT_CHINFORESULTS:
1775 prism2sta_inf_chinforesults(wlandev, inf);
1776 break;
1777 case HFA384x_IT_LINKSTATUS:
1778 prism2sta_inf_linkstatus(wlandev, inf);
1779 break;
1780 case HFA384x_IT_ASSOCSTATUS:
1781 prism2sta_inf_assocstatus(wlandev, inf);
1782 break;
1783 case HFA384x_IT_AUTHREQ:
1784 prism2sta_inf_authreq(wlandev, inf);
1785 break;
1786 case HFA384x_IT_PSUSERCNT:
1787 prism2sta_inf_psusercnt(wlandev, inf);
1788 break;
1789 case HFA384x_IT_KEYIDCHANGED:
1790 printk(KERN_WARNING "Unhandled IT_KEYIDCHANGED\n");
1791 break;
1792 case HFA384x_IT_ASSOCREQ:
1793 printk(KERN_WARNING "Unhandled IT_ASSOCREQ\n");
1794 break;
1795 case HFA384x_IT_MICFAILURE:
1796 printk(KERN_WARNING "Unhandled IT_MICFAILURE\n");
1797 break;
1798 default:
1799 printk(KERN_WARNING
1800 "Unknown info type=0x%02x\n", inf->infotype);
1801 break;
1805 /*----------------------------------------------------------------
1806 * prism2sta_ev_txexc
1808 * Handles the TxExc event. A Transmit Exception event indicates
1809 * that the MAC's TX process was unsuccessful - so the packet did
1810 * not get transmitted.
1812 * Arguments:
1813 * wlandev wlan device structure
1814 * status tx frame status word
1816 * Returns:
1817 * nothing
1819 * Side effects:
1821 * Call context:
1822 * interrupt
1823 ----------------------------------------------------------------*/
1824 void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status)
1826 pr_debug("TxExc status=0x%x.\n", status);
1829 /*----------------------------------------------------------------
1830 * prism2sta_ev_tx
1832 * Handles the Tx event.
1834 * Arguments:
1835 * wlandev wlan device structure
1836 * status tx frame status word
1837 * Returns:
1838 * nothing
1840 * Side effects:
1842 * Call context:
1843 * interrupt
1844 ----------------------------------------------------------------*/
1845 void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
1847 pr_debug("Tx Complete, status=0x%04x\n", status);
1848 /* update linux network stats */
1849 wlandev->linux_stats.tx_packets++;
1852 /*----------------------------------------------------------------
1853 * prism2sta_ev_rx
1855 * Handles the Rx event.
1857 * Arguments:
1858 * wlandev wlan device structure
1860 * Returns:
1861 * nothing
1863 * Side effects:
1865 * Call context:
1866 * interrupt
1867 ----------------------------------------------------------------*/
1868 void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
1870 p80211netdev_rx(wlandev, skb);
1873 /*----------------------------------------------------------------
1874 * prism2sta_ev_alloc
1876 * Handles the Alloc event.
1878 * Arguments:
1879 * wlandev wlan device structure
1881 * Returns:
1882 * nothing
1884 * Side effects:
1886 * Call context:
1887 * interrupt
1888 ----------------------------------------------------------------*/
1889 void prism2sta_ev_alloc(wlandevice_t *wlandev)
1891 netif_wake_queue(wlandev->netdev);
1894 /*----------------------------------------------------------------
1895 * create_wlan
1897 * Called at module init time. This creates the wlandevice_t structure
1898 * and initializes it with relevant bits.
1900 * Arguments:
1901 * none
1903 * Returns:
1904 * the created wlandevice_t structure.
1906 * Side effects:
1907 * also allocates the priv/hw structures.
1909 * Call context:
1910 * process thread
1912 ----------------------------------------------------------------*/
1913 static wlandevice_t *create_wlan(void)
1915 wlandevice_t *wlandev = NULL;
1916 hfa384x_t *hw = NULL;
1918 /* Alloc our structures */
1919 wlandev = kzalloc(sizeof(wlandevice_t), GFP_KERNEL);
1920 hw = kzalloc(sizeof(hfa384x_t), GFP_KERNEL);
1922 if (!wlandev || !hw) {
1923 pr_err("%s: Memory allocation failure.\n", dev_info);
1924 kfree(wlandev);
1925 kfree(hw);
1926 return NULL;
1929 /* Initialize the network device object. */
1930 wlandev->nsdname = dev_info;
1931 wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING;
1932 wlandev->priv = hw;
1933 wlandev->open = prism2sta_open;
1934 wlandev->close = prism2sta_close;
1935 wlandev->reset = prism2sta_reset;
1936 wlandev->txframe = prism2sta_txframe;
1937 wlandev->mlmerequest = prism2sta_mlmerequest;
1938 wlandev->set_multicast_list = prism2sta_setmulticast;
1939 wlandev->tx_timeout = hfa384x_tx_timeout;
1941 wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | P80211_NSDCAP_AUTOJOIN;
1943 /* Initialize the device private data structure. */
1944 hw->dot11_desired_bss_type = 1;
1946 return wlandev;
1949 void prism2sta_commsqual_defer(struct work_struct *data)
1951 hfa384x_t *hw = container_of(data, struct hfa384x, commsqual_bh);
1952 wlandevice_t *wlandev = hw->wlandev;
1953 hfa384x_bytestr32_t ssid;
1954 struct p80211msg_dot11req_mibget msg;
1955 p80211item_uint32_t *mibitem = (p80211item_uint32_t *)
1956 &msg.mibattribute.data;
1957 int result = 0;
1959 if (hw->wlandev->hwremoved)
1960 return;
1962 /* we don't care if we're in AP mode */
1963 if ((wlandev->macmode == WLAN_MACMODE_NONE) ||
1964 (wlandev->macmode == WLAN_MACMODE_ESS_AP)) {
1965 return;
1968 /* It only makes sense to poll these in non-IBSS */
1969 if (wlandev->macmode != WLAN_MACMODE_IBSS_STA) {
1970 result = hfa384x_drvr_getconfig(
1971 hw, HFA384x_RID_DBMCOMMSQUALITY,
1972 &hw->qual, HFA384x_RID_DBMCOMMSQUALITY_LEN);
1974 if (result) {
1975 netdev_err(wlandev->netdev, "error fetching commsqual\n");
1976 return;
1979 pr_debug("commsqual %d %d %d\n",
1980 le16_to_cpu(hw->qual.CQ_currBSS),
1981 le16_to_cpu(hw->qual.ASL_currBSS),
1982 le16_to_cpu(hw->qual.ANL_currFC));
1985 /* Get the signal rate */
1986 msg.msgcode = DIDmsg_dot11req_mibget;
1987 mibitem->did = DIDmib_p2_p2MAC_p2CurrentTxRate;
1988 result = p80211req_dorequest(wlandev, (u8 *) &msg);
1990 if (result) {
1991 pr_debug("get signal rate failed, result = %d\n",
1992 result);
1993 return;
1996 switch (mibitem->data) {
1997 case HFA384x_RATEBIT_1:
1998 hw->txrate = 10;
1999 break;
2000 case HFA384x_RATEBIT_2:
2001 hw->txrate = 20;
2002 break;
2003 case HFA384x_RATEBIT_5dot5:
2004 hw->txrate = 55;
2005 break;
2006 case HFA384x_RATEBIT_11:
2007 hw->txrate = 110;
2008 break;
2009 default:
2010 pr_debug("Bad ratebit (%d)\n", mibitem->data);
2013 /* Lastly, we need to make sure the BSSID didn't change on us */
2014 result = hfa384x_drvr_getconfig(hw,
2015 HFA384x_RID_CURRENTBSSID,
2016 wlandev->bssid, WLAN_BSSID_LEN);
2017 if (result) {
2018 pr_debug("getconfig(0x%02x) failed, result = %d\n",
2019 HFA384x_RID_CURRENTBSSID, result);
2020 return;
2023 result = hfa384x_drvr_getconfig(hw,
2024 HFA384x_RID_CURRENTSSID,
2025 &ssid, sizeof(ssid));
2026 if (result) {
2027 pr_debug("getconfig(0x%02x) failed, result = %d\n",
2028 HFA384x_RID_CURRENTSSID, result);
2029 return;
2031 prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid,
2032 (p80211pstrd_t *) &wlandev->ssid);
2034 /* Reschedule timer */
2035 mod_timer(&hw->commsqual_timer, jiffies + HZ);
2038 void prism2sta_commsqual_timer(unsigned long data)
2040 hfa384x_t *hw = (hfa384x_t *) data;
2042 schedule_work(&hw->commsqual_bh);