Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1 | /* src/prism2/driver/prism2sta.c |
| 2 | * |
| 3 | * Implements the station functionality for prism2 |
| 4 | * |
| 5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. |
| 6 | * -------------------------------------------------------------------- |
| 7 | * |
| 8 | * linux-wlan |
| 9 | * |
| 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/ |
| 14 | * |
| 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. |
| 19 | * |
| 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. |
| 30 | * |
| 31 | * -------------------------------------------------------------------- |
| 32 | * |
| 33 | * Inquiries regarding the linux-wlan Open Source project can be |
| 34 | * made directly to: |
| 35 | * |
| 36 | * AbsoluteValue Systems Inc. |
| 37 | * info@linux-wlan.com |
| 38 | * http://www.linux-wlan.com |
| 39 | * |
| 40 | * -------------------------------------------------------------------- |
| 41 | * |
| 42 | * Portions of the development of this software were funded by |
| 43 | * Intersil Corporation as part of PRISM(R) chipset product development. |
| 44 | * |
| 45 | * -------------------------------------------------------------------- |
| 46 | * |
| 47 | * This file implements the module and linux pcmcia routines for the |
| 48 | * prism2 driver. |
| 49 | * |
| 50 | * -------------------------------------------------------------------- |
| 51 | */ |
| 52 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 53 | #include <linux/version.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 54 | #include <linux/module.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 55 | #include <linux/moduleparam.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 56 | #include <linux/kernel.h> |
| 57 | #include <linux/sched.h> |
| 58 | #include <linux/types.h> |
| 59 | #include <linux/init.h> |
| 60 | #include <linux/slab.h> |
| 61 | #include <linux/wireless.h> |
| 62 | #include <linux/netdevice.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 63 | #include <linux/workqueue.h> |
Moritz Muehlenhoff | ae26230 | 2009-01-21 22:00:45 +0100 | [diff] [blame] | 64 | #include <linux/byteorder/generic.h> |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 65 | #include <linux/ctype.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 66 | |
| 67 | #include <asm/io.h> |
| 68 | #include <linux/delay.h> |
| 69 | #include <asm/byteorder.h> |
| 70 | #include <linux/if_arp.h> |
Moritz Muehlenhoff | 28b17a4 | 2009-01-21 22:00:41 +0100 | [diff] [blame] | 71 | #include <linux/if_ether.h> |
Moritz Muehlenhoff | 7f6e0e4 | 2009-01-25 21:54:55 +0100 | [diff] [blame] | 72 | #include <linux/bitops.h> |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 73 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 74 | #include "p80211types.h" |
| 75 | #include "p80211hdr.h" |
| 76 | #include "p80211mgmt.h" |
| 77 | #include "p80211conv.h" |
| 78 | #include "p80211msg.h" |
| 79 | #include "p80211netdev.h" |
| 80 | #include "p80211req.h" |
| 81 | #include "p80211metadef.h" |
| 82 | #include "p80211metastruct.h" |
| 83 | #include "hfa384x.h" |
| 84 | #include "prism2mgmt.h" |
| 85 | |
Moritz Muehlenhoff | 1691055 | 2009-02-01 13:39:16 +0100 | [diff] [blame] | 86 | #define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a))) |
| 87 | |
| 88 | /* Create a string of printable chars from something that might not be */ |
| 89 | /* It's recommended that the str be 4*len + 1 bytes long */ |
| 90 | #define wlan_mkprintstr(buf, buflen, str, strlen) \ |
| 91 | { \ |
| 92 | int i = 0; \ |
| 93 | int j = 0; \ |
| 94 | memset(str, 0, (strlen)); \ |
| 95 | for (i = 0; i < (buflen); i++) { \ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 96 | if (isprint((buf)[i])) { \ |
Moritz Muehlenhoff | 1691055 | 2009-02-01 13:39:16 +0100 | [diff] [blame] | 97 | (str)[j] = (buf)[i]; \ |
| 98 | j++; \ |
| 99 | } else { \ |
| 100 | (str)[j] = '\\'; \ |
| 101 | (str)[j+1] = 'x'; \ |
| 102 | (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \ |
| 103 | (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \ |
| 104 | j += 4; \ |
| 105 | } \ |
| 106 | } \ |
| 107 | } |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 108 | |
Solomon Peachy | e02c69b | 2008-10-29 10:42:59 -0400 | [diff] [blame] | 109 | static char *dev_info = "prism2_usb"; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 110 | static wlandevice_t *create_wlan(void); |
| 111 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 112 | int prism2_reset_holdtime = 30; /* Reset hold time in ms */ |
| 113 | int prism2_reset_settletime = 100; /* Reset settle time in ms */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 114 | |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 115 | static int prism2_doreset; /* Do a reset at init? */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 116 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 117 | module_param(prism2_doreset, int, 0644); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 118 | MODULE_PARM_DESC(prism2_doreset, "Issue a reset on initialization"); |
| 119 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 120 | module_param(prism2_reset_holdtime, int, 0644); |
| 121 | MODULE_PARM_DESC(prism2_reset_holdtime, "reset hold time in ms"); |
| 122 | module_param(prism2_reset_settletime, int, 0644); |
| 123 | MODULE_PARM_DESC(prism2_reset_settletime, "reset settle time in ms"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 124 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 125 | MODULE_LICENSE("Dual MPL/GPL"); |
| 126 | |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 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 | p80211_hdr_t *p80211_hdr, |
| 132 | p80211_metawep_t *p80211_wep); |
| 133 | static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *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); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 137 | |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 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); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 158 | |
| 159 | /*---------------------------------------------------------------- |
| 160 | * prism2sta_open |
| 161 | * |
| 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. |
| 166 | * |
| 167 | * Arguments: |
| 168 | * wlandev wlan device structure |
| 169 | * |
| 170 | * Returns: |
| 171 | * 0 success |
| 172 | * >0 f/w reported error |
| 173 | * <0 driver reported error |
| 174 | * |
| 175 | * Side effects: |
| 176 | * |
| 177 | * Call context: |
| 178 | * process thread |
| 179 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 180 | static int prism2sta_open(wlandevice_t *wlandev) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 181 | { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 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. |
| 188 | */ |
| 189 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 190 | return 0; |
| 191 | } |
| 192 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 193 | /*---------------------------------------------------------------- |
| 194 | * prism2sta_close |
| 195 | * |
| 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. |
| 200 | * |
| 201 | * Arguments: |
| 202 | * wlandev wlan device structure |
| 203 | * |
| 204 | * Returns: |
| 205 | * 0 success |
| 206 | * >0 f/w reported error |
| 207 | * <0 driver reported error |
| 208 | * |
| 209 | * Side effects: |
| 210 | * |
| 211 | * Call context: |
| 212 | * process thread |
| 213 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 214 | static int prism2sta_close(wlandevice_t *wlandev) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 215 | { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 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. |
| 220 | */ |
| 221 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 222 | return 0; |
| 223 | } |
| 224 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 225 | /*---------------------------------------------------------------- |
| 226 | * prism2sta_reset |
| 227 | * |
| 228 | * Not currently implented. |
| 229 | * |
| 230 | * Arguments: |
| 231 | * wlandev wlan device structure |
| 232 | * none |
| 233 | * |
| 234 | * Returns: |
| 235 | * nothing |
| 236 | * |
| 237 | * Side effects: |
| 238 | * |
| 239 | * Call context: |
| 240 | * process thread |
| 241 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 242 | static void prism2sta_reset(wlandevice_t *wlandev) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 243 | { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 244 | return; |
| 245 | } |
| 246 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 247 | /*---------------------------------------------------------------- |
| 248 | * prism2sta_txframe |
| 249 | * |
| 250 | * Takes a frame from p80211 and queues it for transmission. |
| 251 | * |
| 252 | * Arguments: |
| 253 | * wlandev wlan device structure |
| 254 | * pb packet buffer struct. Contains an 802.11 |
| 255 | * data frame. |
| 256 | * p80211_hdr points to the 802.11 header for the packet. |
| 257 | * Returns: |
| 258 | * 0 Success and more buffs available |
| 259 | * 1 Success but no more buffs |
| 260 | * 2 Allocation failure |
| 261 | * 4 Buffer full or queue busy |
| 262 | * |
| 263 | * Side effects: |
| 264 | * |
| 265 | * Call context: |
| 266 | * process thread |
| 267 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 268 | static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, |
| 269 | p80211_hdr_t *p80211_hdr, |
| 270 | p80211_metawep_t *p80211_wep) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 271 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 272 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 273 | int result; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 274 | |
| 275 | /* If necessary, set the 802.11 WEP bit */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 276 | if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == |
| 277 | HOSTWEP_PRIVACYINVOKED) { |
Moritz Muehlenhoff | ae26230 | 2009-01-21 22:00:45 +0100 | [diff] [blame] | 278 | p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1)); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep); |
| 282 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 283 | return result; |
| 284 | } |
| 285 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 286 | /*---------------------------------------------------------------- |
| 287 | * prism2sta_mlmerequest |
| 288 | * |
| 289 | * wlan command message handler. All we do here is pass the message |
| 290 | * over to the prism2sta_mgmt_handler. |
| 291 | * |
| 292 | * Arguments: |
| 293 | * wlandev wlan device structure |
| 294 | * msg wlan command message |
| 295 | * Returns: |
| 296 | * 0 success |
| 297 | * <0 successful acceptance of message, but we're |
| 298 | * waiting for an async process to finish before |
| 299 | * we're done with the msg. When the asynch |
| 300 | * process is done, we'll call the p80211 |
| 301 | * function p80211req_confirm() . |
| 302 | * >0 An error occurred while we were handling |
| 303 | * the message. |
| 304 | * |
| 305 | * Side effects: |
| 306 | * |
| 307 | * Call context: |
| 308 | * process thread |
| 309 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 310 | static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 311 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 312 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 313 | |
| 314 | int result = 0; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 315 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 316 | switch (msg->msgcode) { |
| 317 | case DIDmsg_dot11req_mibget: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 318 | pr_debug("Received mibget request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 319 | result = prism2mgmt_mibset_mibget(wlandev, msg); |
| 320 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 321 | case DIDmsg_dot11req_mibset: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 322 | pr_debug("Received mibset request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 323 | result = prism2mgmt_mibset_mibget(wlandev, msg); |
| 324 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 325 | case DIDmsg_dot11req_scan: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 326 | pr_debug("Received scan request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 327 | result = prism2mgmt_scan(wlandev, msg); |
| 328 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 329 | case DIDmsg_dot11req_scan_results: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 330 | pr_debug("Received scan_results request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 331 | result = prism2mgmt_scan_results(wlandev, msg); |
| 332 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 333 | case DIDmsg_dot11req_start: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 334 | pr_debug("Received mlme start request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 335 | result = prism2mgmt_start(wlandev, msg); |
| 336 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 337 | /* |
| 338 | * Prism2 specific messages |
| 339 | */ |
| 340 | case DIDmsg_p2req_readpda: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 341 | pr_debug("Received mlme readpda request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 342 | result = prism2mgmt_readpda(wlandev, msg); |
| 343 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 344 | case DIDmsg_p2req_ramdl_state: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 345 | pr_debug("Received mlme ramdl_state request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 346 | result = prism2mgmt_ramdl_state(wlandev, msg); |
| 347 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 348 | case DIDmsg_p2req_ramdl_write: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 349 | pr_debug("Received mlme ramdl_write request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 350 | result = prism2mgmt_ramdl_write(wlandev, msg); |
| 351 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 352 | case DIDmsg_p2req_flashdl_state: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 353 | pr_debug("Received mlme flashdl_state request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 354 | result = prism2mgmt_flashdl_state(wlandev, msg); |
| 355 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 356 | case DIDmsg_p2req_flashdl_write: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 357 | pr_debug("Received mlme flashdl_write request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 358 | result = prism2mgmt_flashdl_write(wlandev, msg); |
| 359 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 360 | /* |
| 361 | * Linux specific messages |
| 362 | */ |
| 363 | case DIDmsg_lnxreq_hostwep: |
| 364 | break; /* ignore me. */ |
| 365 | case DIDmsg_lnxreq_ifstate: |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 366 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 367 | p80211msg_lnxreq_ifstate_t *ifstatemsg; |
| 368 | pr_debug("Received mlme ifstate request\n"); |
| 369 | ifstatemsg = (p80211msg_lnxreq_ifstate_t *) msg; |
| 370 | result = |
| 371 | prism2sta_ifstate(wlandev, |
| 372 | ifstatemsg->ifstate.data); |
| 373 | ifstatemsg->resultcode.status = |
| 374 | P80211ENUM_msgitem_status_data_ok; |
| 375 | ifstatemsg->resultcode.data = result; |
| 376 | result = 0; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 377 | } |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 378 | break; |
| 379 | case DIDmsg_lnxreq_wlansniff: |
| 380 | pr_debug("Received mlme wlansniff request\n"); |
| 381 | result = prism2mgmt_wlansniff(wlandev, msg); |
| 382 | break; |
| 383 | case DIDmsg_lnxreq_autojoin: |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 384 | pr_debug("Received mlme autojoin request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 385 | result = prism2mgmt_autojoin(wlandev, msg); |
| 386 | break; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 387 | case DIDmsg_lnxreq_commsquality:{ |
| 388 | p80211msg_lnxreq_commsquality_t *qualmsg; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 389 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 390 | pr_debug("Received commsquality request\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 391 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 392 | qualmsg = (p80211msg_lnxreq_commsquality_t *) msg; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 393 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 394 | qualmsg->link.status = |
| 395 | P80211ENUM_msgitem_status_data_ok; |
| 396 | qualmsg->level.status = |
| 397 | P80211ENUM_msgitem_status_data_ok; |
| 398 | qualmsg->noise.status = |
| 399 | P80211ENUM_msgitem_status_data_ok; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 400 | |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 401 | qualmsg->link.data = le16_to_cpu(hw->qual.CQ_currBSS); |
| 402 | qualmsg->level.data = le16_to_cpu(hw->qual.ASL_currBSS); |
| 403 | qualmsg->noise.data = le16_to_cpu(hw->qual.ANL_currFC); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 404 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 405 | break; |
| 406 | } |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 407 | default: |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 408 | printk(KERN_WARNING "Unknown mgmt request message 0x%08x", |
| 409 | msg->msgcode); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 410 | break; |
| 411 | } |
| 412 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 413 | return result; |
| 414 | } |
| 415 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 416 | /*---------------------------------------------------------------- |
| 417 | * prism2sta_ifstate |
| 418 | * |
| 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. |
| 423 | * |
| 424 | * Arguments: |
| 425 | * wlandev wlan device structure |
| 426 | * msgp ptr to msg buffer |
| 427 | * |
| 428 | * Returns: |
| 429 | * A p80211 message resultcode value. |
| 430 | * |
| 431 | * Side effects: |
| 432 | * |
| 433 | * Call context: |
| 434 | * process thread (usually) |
| 435 | * interrupt |
| 436 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 437 | u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 438 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 439 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 440 | u32 result; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 441 | |
| 442 | result = P80211ENUM_resultcode_implementation_failure; |
| 443 | |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 444 | pr_debug("Current MSD state(%d), requesting(%d)\n", |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 445 | wlandev->msdstate, ifstate); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 446 | switch (ifstate) { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 447 | case P80211ENUM_ifstate_fwload: |
| 448 | switch (wlandev->msdstate) { |
| 449 | case WLAN_MSD_HWPRESENT: |
| 450 | wlandev->msdstate = WLAN_MSD_FWLOAD_PENDING; |
| 451 | /* |
| 452 | * Initialize the device+driver sufficiently |
| 453 | * for firmware loading. |
| 454 | */ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 455 | result = hfa384x_drvr_start(hw); |
| 456 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 457 | printk(KERN_ERR |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 458 | "hfa384x_drvr_start() failed," |
| 459 | "result=%d\n", (int)result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 460 | result = |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 461 | P80211ENUM_resultcode_implementation_failure; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 462 | wlandev->msdstate = WLAN_MSD_HWPRESENT; |
| 463 | break; |
| 464 | } |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 465 | wlandev->msdstate = WLAN_MSD_FWLOAD; |
| 466 | result = P80211ENUM_resultcode_success; |
| 467 | break; |
| 468 | case WLAN_MSD_FWLOAD: |
| 469 | hfa384x_cmd_initialize(hw); |
| 470 | result = P80211ENUM_resultcode_success; |
| 471 | break; |
| 472 | case WLAN_MSD_RUNNING: |
Moritz Muehlenhoff | 9b9556e | 2009-01-25 21:55:01 +0100 | [diff] [blame] | 473 | printk(KERN_WARNING |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 474 | "Cannot enter fwload state from enable state," |
| 475 | "you must disable first.\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 476 | result = P80211ENUM_resultcode_invalid_parameters; |
| 477 | break; |
| 478 | case WLAN_MSD_HWFAIL: |
| 479 | default: |
| 480 | /* probe() had a problem or the msdstate contains |
| 481 | * an unrecognized value, there's nothing we can do. |
| 482 | */ |
| 483 | result = P80211ENUM_resultcode_implementation_failure; |
| 484 | break; |
| 485 | } |
| 486 | break; |
| 487 | case P80211ENUM_ifstate_enable: |
| 488 | switch (wlandev->msdstate) { |
| 489 | case WLAN_MSD_HWPRESENT: |
| 490 | case WLAN_MSD_FWLOAD: |
| 491 | wlandev->msdstate = WLAN_MSD_RUNNING_PENDING; |
| 492 | /* Initialize the device+driver for full |
| 493 | * operation. Note that this might me an FWLOAD to |
| 494 | * to RUNNING transition so we must not do a chip |
| 495 | * or board level reset. Note that on failure, |
| 496 | * the MSD state is set to HWPRESENT because we |
| 497 | * can't make any assumptions about the state |
| 498 | * of the hardware or a previous firmware load. |
| 499 | */ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 500 | result = hfa384x_drvr_start(hw); |
| 501 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 502 | printk(KERN_ERR |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 503 | "hfa384x_drvr_start() failed," |
| 504 | "result=%d\n", (int)result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 505 | result = |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 506 | P80211ENUM_resultcode_implementation_failure; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 507 | wlandev->msdstate = WLAN_MSD_HWPRESENT; |
| 508 | break; |
| 509 | } |
| 510 | |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 511 | result = prism2sta_getcardinfo(wlandev); |
| 512 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 513 | printk(KERN_ERR |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 514 | "prism2sta_getcardinfo() failed," |
| 515 | "result=%d\n", (int)result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 516 | result = |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 517 | P80211ENUM_resultcode_implementation_failure; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 518 | hfa384x_drvr_stop(hw); |
| 519 | wlandev->msdstate = WLAN_MSD_HWPRESENT; |
| 520 | break; |
| 521 | } |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 522 | result = prism2sta_globalsetup(wlandev); |
| 523 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 524 | printk(KERN_ERR |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 525 | "prism2sta_globalsetup() failed," |
| 526 | "result=%d\n", (int)result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 527 | result = |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 528 | P80211ENUM_resultcode_implementation_failure; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 529 | hfa384x_drvr_stop(hw); |
| 530 | wlandev->msdstate = WLAN_MSD_HWPRESENT; |
| 531 | break; |
| 532 | } |
| 533 | wlandev->msdstate = WLAN_MSD_RUNNING; |
| 534 | hw->join_ap = 0; |
| 535 | hw->join_retries = 60; |
| 536 | result = P80211ENUM_resultcode_success; |
| 537 | break; |
| 538 | case WLAN_MSD_RUNNING: |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 539 | /* Do nothing, we're already in this state. */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 540 | result = P80211ENUM_resultcode_success; |
| 541 | break; |
| 542 | case WLAN_MSD_HWFAIL: |
| 543 | default: |
| 544 | /* probe() had a problem or the msdstate contains |
| 545 | * an unrecognized value, there's nothing we can do. |
| 546 | */ |
| 547 | result = P80211ENUM_resultcode_implementation_failure; |
| 548 | break; |
| 549 | } |
| 550 | break; |
| 551 | case P80211ENUM_ifstate_disable: |
| 552 | switch (wlandev->msdstate) { |
| 553 | case WLAN_MSD_HWPRESENT: |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 554 | /* Do nothing, we're already in this state. */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 555 | result = P80211ENUM_resultcode_success; |
| 556 | break; |
| 557 | case WLAN_MSD_FWLOAD: |
| 558 | case WLAN_MSD_RUNNING: |
| 559 | wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING; |
| 560 | /* |
| 561 | * TODO: Shut down the MAC completely. Here a chip |
| 562 | * or board level reset is probably called for. |
| 563 | * After a "disable" _all_ results are lost, even |
| 564 | * those from a fwload. |
| 565 | */ |
| 566 | if (!wlandev->hwremoved) |
| 567 | netif_carrier_off(wlandev->netdev); |
| 568 | |
| 569 | hfa384x_drvr_stop(hw); |
| 570 | |
| 571 | wlandev->macmode = WLAN_MACMODE_NONE; |
| 572 | wlandev->msdstate = WLAN_MSD_HWPRESENT; |
| 573 | result = P80211ENUM_resultcode_success; |
| 574 | break; |
| 575 | case WLAN_MSD_HWFAIL: |
| 576 | default: |
| 577 | /* probe() had a problem or the msdstate contains |
| 578 | * an unrecognized value, there's nothing we can do. |
| 579 | */ |
| 580 | result = P80211ENUM_resultcode_implementation_failure; |
| 581 | break; |
| 582 | } |
| 583 | break; |
| 584 | default: |
| 585 | result = P80211ENUM_resultcode_invalid_parameters; |
| 586 | break; |
| 587 | } |
| 588 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 589 | return result; |
| 590 | } |
| 591 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 592 | /*---------------------------------------------------------------- |
| 593 | * prism2sta_getcardinfo |
| 594 | * |
| 595 | * Collect the NICID, firmware version and any other identifiers |
| 596 | * we'd like to have in host-side data structures. |
| 597 | * |
| 598 | * Arguments: |
| 599 | * wlandev wlan device structure |
| 600 | * |
| 601 | * Returns: |
| 602 | * 0 success |
| 603 | * >0 f/w reported error |
| 604 | * <0 driver reported error |
| 605 | * |
| 606 | * Side effects: |
| 607 | * |
| 608 | * Call context: |
| 609 | * Either. |
| 610 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 611 | static int prism2sta_getcardinfo(wlandevice_t *wlandev) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 612 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 613 | int result = 0; |
| 614 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 615 | u16 temp; |
| 616 | u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN]; |
| 617 | char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1]; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 618 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 619 | /* Collect version and compatibility info */ |
| 620 | /* Some are critical, some are not */ |
| 621 | /* NIC identity */ |
| 622 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 623 | &hw->ident_nic, |
| 624 | sizeof(hfa384x_compident_t)); |
| 625 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 626 | printk(KERN_ERR "Failed to retrieve NICIDENTITY\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 627 | goto failed; |
| 628 | } |
| 629 | |
| 630 | /* get all the nic id fields in host byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 631 | hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id); |
| 632 | hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant); |
| 633 | hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major); |
| 634 | hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 635 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 636 | printk(KERN_INFO "ident: nic h/w: id=0x%02x %d.%d.%d\n", |
| 637 | hw->ident_nic.id, hw->ident_nic.major, |
| 638 | hw->ident_nic.minor, hw->ident_nic.variant); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 639 | |
| 640 | /* Primary f/w identity */ |
| 641 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 642 | &hw->ident_pri_fw, |
| 643 | sizeof(hfa384x_compident_t)); |
| 644 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 645 | printk(KERN_ERR "Failed to retrieve PRIIDENTITY\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 646 | goto failed; |
| 647 | } |
| 648 | |
| 649 | /* get all the private fw id fields in host byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 650 | hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id); |
| 651 | hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant); |
| 652 | hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major); |
| 653 | hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 654 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 655 | printk(KERN_INFO "ident: pri f/w: id=0x%02x %d.%d.%d\n", |
| 656 | hw->ident_pri_fw.id, hw->ident_pri_fw.major, |
| 657 | hw->ident_pri_fw.minor, hw->ident_pri_fw.variant); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 658 | |
| 659 | /* Station (Secondary?) f/w identity */ |
| 660 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 661 | &hw->ident_sta_fw, |
| 662 | sizeof(hfa384x_compident_t)); |
| 663 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 664 | printk(KERN_ERR "Failed to retrieve STAIDENTITY\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 665 | goto failed; |
| 666 | } |
| 667 | |
| 668 | if (hw->ident_nic.id < 0x8000) { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 669 | printk(KERN_ERR |
| 670 | "FATAL: Card is not an Intersil Prism2/2.5/3\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 671 | result = -1; |
| 672 | goto failed; |
| 673 | } |
| 674 | |
| 675 | /* get all the station fw id fields in host byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 676 | hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id); |
| 677 | hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant); |
| 678 | hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major); |
| 679 | hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 680 | |
| 681 | /* strip out the 'special' variant bits */ |
Moritz Muehlenhoff | 7f6e0e4 | 2009-01-25 21:54:55 +0100 | [diff] [blame] | 682 | hw->mm_mods = hw->ident_sta_fw.variant & (BIT(14) | BIT(15)); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 683 | hw->ident_sta_fw.variant &= ~((u16) (BIT(14) | BIT(15))); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 684 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 685 | if (hw->ident_sta_fw.id == 0x1f) { |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 686 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 687 | "ident: sta f/w: id=0x%02x %d.%d.%d\n", |
| 688 | hw->ident_sta_fw.id, hw->ident_sta_fw.major, |
| 689 | hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 690 | } else { |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 691 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 692 | "ident: ap f/w: id=0x%02x %d.%d.%d\n", |
| 693 | hw->ident_sta_fw.id, hw->ident_sta_fw.major, |
| 694 | hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 695 | printk(KERN_ERR "Unsupported Tertiary AP firmeare loaded!\n"); |
Solomon Peachy | 5db8dcc | 2008-10-27 11:14:02 -0400 | [diff] [blame] | 696 | goto failed; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | /* Compatibility range, Modem supplier */ |
| 700 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 701 | &hw->cap_sup_mfi, |
| 702 | sizeof(hfa384x_caplevel_t)); |
| 703 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 704 | printk(KERN_ERR "Failed to retrieve MFISUPRANGE\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 705 | goto failed; |
| 706 | } |
| 707 | |
| 708 | /* get all the Compatibility range, modem interface supplier |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 709 | fields in byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 710 | hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role); |
| 711 | hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id); |
| 712 | hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant); |
| 713 | hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom); |
| 714 | hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 715 | |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 716 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 717 | "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", |
| 718 | hw->cap_sup_mfi.role, hw->cap_sup_mfi.id, |
| 719 | hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom, |
| 720 | hw->cap_sup_mfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 721 | |
| 722 | /* Compatibility range, Controller supplier */ |
| 723 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 724 | &hw->cap_sup_cfi, |
| 725 | sizeof(hfa384x_caplevel_t)); |
| 726 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 727 | printk(KERN_ERR "Failed to retrieve CFISUPRANGE\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 728 | goto failed; |
| 729 | } |
| 730 | |
| 731 | /* get all the Compatibility range, controller interface supplier |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 732 | fields in byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 733 | hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role); |
| 734 | hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id); |
| 735 | hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant); |
| 736 | hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom); |
| 737 | hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 738 | |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 739 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 740 | "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", |
| 741 | hw->cap_sup_cfi.role, hw->cap_sup_cfi.id, |
| 742 | hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom, |
| 743 | hw->cap_sup_cfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 744 | |
| 745 | /* Compatibility range, Primary f/w supplier */ |
| 746 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 747 | &hw->cap_sup_pri, |
| 748 | sizeof(hfa384x_caplevel_t)); |
| 749 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 750 | printk(KERN_ERR "Failed to retrieve PRISUPRANGE\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 751 | goto failed; |
| 752 | } |
| 753 | |
| 754 | /* get all the Compatibility range, primary firmware supplier |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 755 | fields in byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 756 | hw->cap_sup_pri.role = le16_to_cpu(hw->cap_sup_pri.role); |
| 757 | hw->cap_sup_pri.id = le16_to_cpu(hw->cap_sup_pri.id); |
| 758 | hw->cap_sup_pri.variant = le16_to_cpu(hw->cap_sup_pri.variant); |
| 759 | hw->cap_sup_pri.bottom = le16_to_cpu(hw->cap_sup_pri.bottom); |
| 760 | hw->cap_sup_pri.top = le16_to_cpu(hw->cap_sup_pri.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 761 | |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 762 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 763 | "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", |
| 764 | hw->cap_sup_pri.role, hw->cap_sup_pri.id, |
| 765 | hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom, |
| 766 | hw->cap_sup_pri.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 767 | |
| 768 | /* Compatibility range, Station f/w supplier */ |
| 769 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 770 | &hw->cap_sup_sta, |
| 771 | sizeof(hfa384x_caplevel_t)); |
| 772 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 773 | printk(KERN_ERR "Failed to retrieve STASUPRANGE\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 774 | goto failed; |
| 775 | } |
| 776 | |
| 777 | /* get all the Compatibility range, station firmware supplier |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 778 | fields in byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 779 | hw->cap_sup_sta.role = le16_to_cpu(hw->cap_sup_sta.role); |
| 780 | hw->cap_sup_sta.id = le16_to_cpu(hw->cap_sup_sta.id); |
| 781 | hw->cap_sup_sta.variant = le16_to_cpu(hw->cap_sup_sta.variant); |
| 782 | hw->cap_sup_sta.bottom = le16_to_cpu(hw->cap_sup_sta.bottom); |
| 783 | hw->cap_sup_sta.top = le16_to_cpu(hw->cap_sup_sta.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 784 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 785 | if (hw->cap_sup_sta.id == 0x04) { |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 786 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 787 | "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", |
| 788 | hw->cap_sup_sta.role, hw->cap_sup_sta.id, |
| 789 | hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom, |
| 790 | hw->cap_sup_sta.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 791 | } else { |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 792 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 793 | "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", |
| 794 | hw->cap_sup_sta.role, hw->cap_sup_sta.id, |
| 795 | hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom, |
| 796 | hw->cap_sup_sta.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 797 | } |
| 798 | |
| 799 | /* Compatibility range, primary f/w actor, CFI supplier */ |
| 800 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 801 | &hw->cap_act_pri_cfi, |
| 802 | sizeof(hfa384x_caplevel_t)); |
| 803 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 804 | printk(KERN_ERR "Failed to retrieve PRI_CFIACTRANGES\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 805 | goto failed; |
| 806 | } |
| 807 | |
| 808 | /* get all the Compatibility range, primary f/w actor, CFI supplier |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 809 | fields in byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 810 | hw->cap_act_pri_cfi.role = le16_to_cpu(hw->cap_act_pri_cfi.role); |
| 811 | hw->cap_act_pri_cfi.id = le16_to_cpu(hw->cap_act_pri_cfi.id); |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 812 | hw->cap_act_pri_cfi.variant = le16_to_cpu(hw->cap_act_pri_cfi.variant); |
| 813 | hw->cap_act_pri_cfi.bottom = le16_to_cpu(hw->cap_act_pri_cfi.bottom); |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 814 | hw->cap_act_pri_cfi.top = le16_to_cpu(hw->cap_act_pri_cfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 815 | |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 816 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 817 | "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", |
| 818 | hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id, |
| 819 | hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom, |
| 820 | hw->cap_act_pri_cfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 821 | |
| 822 | /* Compatibility range, sta f/w actor, CFI supplier */ |
| 823 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 824 | &hw->cap_act_sta_cfi, |
| 825 | sizeof(hfa384x_caplevel_t)); |
| 826 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 827 | printk(KERN_ERR "Failed to retrieve STA_CFIACTRANGES\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 828 | goto failed; |
| 829 | } |
| 830 | |
| 831 | /* get all the Compatibility range, station f/w actor, CFI supplier |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 832 | fields in byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 833 | hw->cap_act_sta_cfi.role = le16_to_cpu(hw->cap_act_sta_cfi.role); |
| 834 | hw->cap_act_sta_cfi.id = le16_to_cpu(hw->cap_act_sta_cfi.id); |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 835 | hw->cap_act_sta_cfi.variant = le16_to_cpu(hw->cap_act_sta_cfi.variant); |
| 836 | hw->cap_act_sta_cfi.bottom = le16_to_cpu(hw->cap_act_sta_cfi.bottom); |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 837 | hw->cap_act_sta_cfi.top = le16_to_cpu(hw->cap_act_sta_cfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 838 | |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 839 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 840 | "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", |
| 841 | hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id, |
| 842 | hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom, |
| 843 | hw->cap_act_sta_cfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 844 | |
| 845 | /* Compatibility range, sta f/w actor, MFI supplier */ |
| 846 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 847 | &hw->cap_act_sta_mfi, |
| 848 | sizeof(hfa384x_caplevel_t)); |
| 849 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 850 | printk(KERN_ERR "Failed to retrieve STA_MFIACTRANGES\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 851 | goto failed; |
| 852 | } |
| 853 | |
| 854 | /* get all the Compatibility range, station f/w actor, MFI supplier |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 855 | fields in byte order */ |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 856 | hw->cap_act_sta_mfi.role = le16_to_cpu(hw->cap_act_sta_mfi.role); |
| 857 | hw->cap_act_sta_mfi.id = le16_to_cpu(hw->cap_act_sta_mfi.id); |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 858 | hw->cap_act_sta_mfi.variant = le16_to_cpu(hw->cap_act_sta_mfi.variant); |
| 859 | hw->cap_act_sta_mfi.bottom = le16_to_cpu(hw->cap_act_sta_mfi.bottom); |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 860 | hw->cap_act_sta_mfi.top = le16_to_cpu(hw->cap_act_sta_mfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 861 | |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 862 | printk(KERN_INFO |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 863 | "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", |
| 864 | hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id, |
| 865 | hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom, |
| 866 | hw->cap_act_sta_mfi.top); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 867 | |
| 868 | /* Serial Number */ |
| 869 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 870 | snum, HFA384x_RID_NICSERIALNUMBER_LEN); |
| 871 | if (!result) { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 872 | wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN, |
| 873 | pstr, sizeof(pstr)); |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 874 | printk(KERN_INFO "Prism2 card SN: %s\n", pstr); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 875 | } else { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 876 | printk(KERN_ERR "Failed to retrieve Prism2 Card SN\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 877 | goto failed; |
| 878 | } |
| 879 | |
| 880 | /* Collect the MAC address */ |
| 881 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 882 | wlandev->netdev->dev_addr, ETH_ALEN); |
| 883 | if (result != 0) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 884 | printk(KERN_ERR "Failed to retrieve mac address\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 885 | goto failed; |
| 886 | } |
| 887 | |
| 888 | /* short preamble is always implemented */ |
| 889 | wlandev->nsdcaps |= P80211_NSDCAP_SHORT_PREAMBLE; |
| 890 | |
| 891 | /* find out if hardware wep is implemented */ |
| 892 | hfa384x_drvr_getconfig16(hw, HFA384x_RID_PRIVACYOPTIMP, &temp); |
| 893 | if (temp) |
| 894 | wlandev->nsdcaps |= P80211_NSDCAP_HARDWAREWEP; |
| 895 | |
| 896 | /* get the dBm Scaling constant */ |
| 897 | hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFDBMADJUST, &temp); |
| 898 | hw->dbmadjust = temp; |
| 899 | |
| 900 | /* Only enable scan by default on newer firmware */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 901 | if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, |
| 902 | hw->ident_sta_fw.minor, |
| 903 | hw->ident_sta_fw.variant) < |
| 904 | HFA384x_FIRMWARE_VERSION(1, 5, 5)) { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 905 | wlandev->nsdcaps |= P80211_NSDCAP_NOSCAN; |
| 906 | } |
| 907 | |
| 908 | /* TODO: Set any internally managed config items */ |
| 909 | |
| 910 | goto done; |
| 911 | failed: |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 912 | printk(KERN_ERR "Failed, result=%d\n", result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 913 | done: |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 914 | return result; |
| 915 | } |
| 916 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 917 | /*---------------------------------------------------------------- |
| 918 | * prism2sta_globalsetup |
| 919 | * |
| 920 | * Set any global RIDs that we want to set at device activation. |
| 921 | * |
| 922 | * Arguments: |
| 923 | * wlandev wlan device structure |
| 924 | * |
| 925 | * Returns: |
| 926 | * 0 success |
| 927 | * >0 f/w reported error |
| 928 | * <0 driver reported error |
| 929 | * |
| 930 | * Side effects: |
| 931 | * |
| 932 | * Call context: |
| 933 | * process thread |
| 934 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 935 | static int prism2sta_globalsetup(wlandevice_t *wlandev) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 936 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 937 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 938 | |
| 939 | /* Set the maximum frame size */ |
| 940 | return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 941 | WLAN_DATA_MAXLEN); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 942 | } |
| 943 | |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 944 | static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 945 | { |
| 946 | int result = 0; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 947 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 948 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 949 | u16 promisc; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 950 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 951 | /* If we're not ready, what's the point? */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 952 | if (hw->state != HFA384x_STATE_RUNNING) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 953 | goto exit; |
| 954 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 955 | if ((dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 956 | promisc = P80211ENUM_truth_true; |
| 957 | else |
| 958 | promisc = P80211ENUM_truth_false; |
| 959 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 960 | result = |
| 961 | hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE, |
| 962 | promisc); |
| 963 | exit: |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 964 | return result; |
| 965 | } |
| 966 | |
| 967 | /*---------------------------------------------------------------- |
| 968 | * prism2sta_inf_handover |
| 969 | * |
| 970 | * Handles the receipt of a Handover info frame. Should only be present |
| 971 | * in APs only. |
| 972 | * |
| 973 | * Arguments: |
| 974 | * wlandev wlan device structure |
| 975 | * inf ptr to info frame (contents in hfa384x order) |
| 976 | * |
| 977 | * Returns: |
| 978 | * nothing |
| 979 | * |
| 980 | * Side effects: |
| 981 | * |
| 982 | * Call context: |
| 983 | * interrupt |
| 984 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 985 | static void prism2sta_inf_handover(wlandevice_t *wlandev, |
| 986 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 987 | { |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 988 | pr_debug("received infoframe:HANDOVER (unhandled)\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 989 | return; |
| 990 | } |
| 991 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 992 | /*---------------------------------------------------------------- |
| 993 | * prism2sta_inf_tallies |
| 994 | * |
| 995 | * Handles the receipt of a CommTallies info frame. |
| 996 | * |
| 997 | * Arguments: |
| 998 | * wlandev wlan device structure |
| 999 | * inf ptr to info frame (contents in hfa384x order) |
| 1000 | * |
| 1001 | * Returns: |
| 1002 | * nothing |
| 1003 | * |
| 1004 | * Side effects: |
| 1005 | * |
| 1006 | * Call context: |
| 1007 | * interrupt |
| 1008 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1009 | static void prism2sta_inf_tallies(wlandevice_t *wlandev, |
| 1010 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1011 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1012 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 1013 | u16 *src16; |
| 1014 | u32 *dst; |
| 1015 | u32 *src32; |
| 1016 | int i; |
| 1017 | int cnt; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1018 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1019 | /* |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1020 | ** Determine if these are 16-bit or 32-bit tallies, based on the |
| 1021 | ** record length of the info record. |
| 1022 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1023 | |
Solomon Peachy | aaad430 | 2008-10-29 10:42:53 -0400 | [diff] [blame] | 1024 | cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(u32); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1025 | if (inf->framelen > 22) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1026 | dst = (u32 *) & hw->tallies; |
| 1027 | src32 = (u32 *) & inf->info.commtallies32; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1028 | for (i = 0; i < cnt; i++, dst++, src32++) |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1029 | *dst += le32_to_cpu(*src32); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1030 | } else { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1031 | dst = (u32 *) & hw->tallies; |
| 1032 | src16 = (u16 *) & inf->info.commtallies16; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1033 | for (i = 0; i < cnt; i++, dst++, src16++) |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1034 | *dst += le16_to_cpu(*src16); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1035 | } |
| 1036 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1037 | return; |
| 1038 | } |
| 1039 | |
| 1040 | /*---------------------------------------------------------------- |
| 1041 | * prism2sta_inf_scanresults |
| 1042 | * |
| 1043 | * Handles the receipt of a Scan Results info frame. |
| 1044 | * |
| 1045 | * Arguments: |
| 1046 | * wlandev wlan device structure |
| 1047 | * inf ptr to info frame (contents in hfa384x order) |
| 1048 | * |
| 1049 | * Returns: |
| 1050 | * nothing |
| 1051 | * |
| 1052 | * Side effects: |
| 1053 | * |
| 1054 | * Call context: |
| 1055 | * interrupt |
| 1056 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1057 | static void prism2sta_inf_scanresults(wlandevice_t *wlandev, |
| 1058 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1059 | { |
| 1060 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1061 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 1062 | int nbss; |
| 1063 | hfa384x_ScanResult_t *sr = &(inf->info.scanresult); |
| 1064 | int i; |
| 1065 | hfa384x_JoinRequest_data_t joinreq; |
| 1066 | int result; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1067 | |
| 1068 | /* Get the number of results, first in bytes, then in results */ |
Solomon Peachy | aaad430 | 2008-10-29 10:42:53 -0400 | [diff] [blame] | 1069 | nbss = (inf->framelen * sizeof(u16)) - |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1070 | sizeof(inf->infotype) - sizeof(inf->info.scanresult.scanreason); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1071 | nbss /= sizeof(hfa384x_ScanResultSub_t); |
| 1072 | |
| 1073 | /* Print em */ |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 1074 | pr_debug("rx scanresults, reason=%d, nbss=%d:\n", |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1075 | inf->info.scanresult.scanreason, nbss); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1076 | for (i = 0; i < nbss; i++) { |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 1077 | pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n", |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1078 | sr->result[i].chid, |
| 1079 | sr->result[i].anl, |
| 1080 | sr->result[i].sl, sr->result[i].bcnint); |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 1081 | pr_debug(" capinfo=0x%04x proberesp_rate=%d\n", |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1082 | sr->result[i].capinfo, sr->result[i].proberesp_rate); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1083 | } |
| 1084 | /* issue a join request */ |
| 1085 | joinreq.channel = sr->result[0].chid; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1086 | memcpy(joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN); |
| 1087 | result = hfa384x_drvr_setconfig(hw, |
| 1088 | HFA384x_RID_JOINREQUEST, |
| 1089 | &joinreq, HFA384x_RID_JOINREQUEST_LEN); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1090 | if (result) { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1091 | printk(KERN_ERR "setconfig(joinreq) failed, result=%d\n", |
| 1092 | result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1093 | } |
| 1094 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1095 | return; |
| 1096 | } |
| 1097 | |
| 1098 | /*---------------------------------------------------------------- |
| 1099 | * prism2sta_inf_hostscanresults |
| 1100 | * |
| 1101 | * Handles the receipt of a Scan Results info frame. |
| 1102 | * |
| 1103 | * Arguments: |
| 1104 | * wlandev wlan device structure |
| 1105 | * inf ptr to info frame (contents in hfa384x order) |
| 1106 | * |
| 1107 | * Returns: |
| 1108 | * nothing |
| 1109 | * |
| 1110 | * Side effects: |
| 1111 | * |
| 1112 | * Call context: |
| 1113 | * interrupt |
| 1114 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1115 | static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev, |
| 1116 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1117 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1118 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 1119 | int nbss; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1120 | |
| 1121 | nbss = (inf->framelen - 3) / 32; |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 1122 | pr_debug("Received %d hostscan results\n", nbss); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1123 | |
| 1124 | if (nbss > 32) |
| 1125 | nbss = 32; |
| 1126 | |
Moritz Muehlenhoff | 7c98f71 | 2009-02-09 19:33:42 +0100 | [diff] [blame] | 1127 | kfree(hw->scanresults); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1128 | |
| 1129 | hw->scanresults = kmalloc(sizeof(hfa384x_InfFrame_t), GFP_ATOMIC); |
| 1130 | memcpy(hw->scanresults, inf, sizeof(hfa384x_InfFrame_t)); |
| 1131 | |
| 1132 | if (nbss == 0) |
| 1133 | nbss = -1; |
| 1134 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1135 | /* Notify/wake the sleeping caller. */ |
| 1136 | hw->scanflag = nbss; |
| 1137 | wake_up_interruptible(&hw->cmdq); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1138 | }; |
| 1139 | |
| 1140 | /*---------------------------------------------------------------- |
| 1141 | * prism2sta_inf_chinforesults |
| 1142 | * |
| 1143 | * Handles the receipt of a Channel Info Results info frame. |
| 1144 | * |
| 1145 | * Arguments: |
| 1146 | * wlandev wlan device structure |
| 1147 | * inf ptr to info frame (contents in hfa384x order) |
| 1148 | * |
| 1149 | * Returns: |
| 1150 | * nothing |
| 1151 | * |
| 1152 | * Side effects: |
| 1153 | * |
| 1154 | * Call context: |
| 1155 | * interrupt |
| 1156 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1157 | static void prism2sta_inf_chinforesults(wlandevice_t *wlandev, |
| 1158 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1159 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1160 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 1161 | unsigned int i, n; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1162 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1163 | hw->channel_info.results.scanchannels = |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1164 | le16_to_cpu(inf->info.chinforesult.scanchannels); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1165 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1166 | for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) { |
| 1167 | if (hw->channel_info.results.scanchannels & (1 << i)) { |
| 1168 | int channel = |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1169 | le16_to_cpu(inf->info.chinforesult.result[n].chid) - |
| 1170 | 1; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1171 | hfa384x_ChInfoResultSub_t *chinforesult = |
| 1172 | &hw->channel_info.results.result[channel]; |
| 1173 | chinforesult->chid = channel; |
| 1174 | chinforesult->anl = |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1175 | le16_to_cpu(inf->info.chinforesult.result[n].anl); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1176 | chinforesult->pnl = |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1177 | le16_to_cpu(inf->info.chinforesult.result[n].pnl); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1178 | chinforesult->active = |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1179 | le16_to_cpu(inf->info.chinforesult.result[n]. |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1180 | active); |
| 1181 | pr_debug |
| 1182 | ("chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n", |
| 1183 | channel + 1, |
| 1184 | chinforesult-> |
| 1185 | active & HFA384x_CHINFORESULT_BSSACTIVE ? "signal" |
| 1186 | : "noise", chinforesult->anl, chinforesult->pnl, |
| 1187 | chinforesult-> |
| 1188 | active & HFA384x_CHINFORESULT_PCFACTIVE ? 1 : 0); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1189 | n++; |
| 1190 | } |
| 1191 | } |
| 1192 | atomic_set(&hw->channel_info.done, 2); |
| 1193 | |
| 1194 | hw->channel_info.count = n; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1195 | return; |
| 1196 | } |
| 1197 | |
| 1198 | void prism2sta_processing_defer(struct work_struct *data) |
| 1199 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1200 | hfa384x_t *hw = container_of(data, struct hfa384x, link_bh); |
| 1201 | wlandevice_t *wlandev = hw->wlandev; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1202 | hfa384x_bytestr32_t ssid; |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1203 | int result; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1204 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1205 | /* First let's process the auth frames */ |
| 1206 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1207 | struct sk_buff *skb; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1208 | hfa384x_InfFrame_t *inf; |
| 1209 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1210 | while ((skb = skb_dequeue(&hw->authq))) { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1211 | inf = (hfa384x_InfFrame_t *) skb->data; |
| 1212 | prism2sta_inf_authreq_defer(wlandev, inf); |
| 1213 | } |
| 1214 | |
| 1215 | } |
| 1216 | |
| 1217 | /* Now let's handle the linkstatus stuff */ |
| 1218 | if (hw->link_status == hw->link_status_new) |
| 1219 | goto failed; |
| 1220 | |
| 1221 | hw->link_status = hw->link_status_new; |
| 1222 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1223 | switch (hw->link_status) { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1224 | case HFA384x_LINK_NOTCONNECTED: |
| 1225 | /* I'm currently assuming that this is the initial link |
| 1226 | * state. It should only be possible immediately |
| 1227 | * following an Enable command. |
| 1228 | * Response: |
| 1229 | * Block Transmits, Ignore receives of data frames |
| 1230 | */ |
| 1231 | netif_carrier_off(wlandev->netdev); |
| 1232 | |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 1233 | printk(KERN_INFO "linkstatus=NOTCONNECTED (unhandled)\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1234 | break; |
| 1235 | |
| 1236 | case HFA384x_LINK_CONNECTED: |
| 1237 | /* This one indicates a successful scan/join/auth/assoc. |
| 1238 | * When we have the full MLME complement, this event will |
| 1239 | * signify successful completion of both mlme_authenticate |
| 1240 | * and mlme_associate. State management will get a little |
| 1241 | * ugly here. |
| 1242 | * Response: |
| 1243 | * Indicate authentication and/or association |
| 1244 | * Enable Transmits, Receives and pass up data frames |
| 1245 | */ |
| 1246 | |
| 1247 | netif_carrier_on(wlandev->netdev); |
| 1248 | |
| 1249 | /* If we are joining a specific AP, set our state and reset retries */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1250 | if (hw->join_ap == 1) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1251 | hw->join_ap = 2; |
| 1252 | hw->join_retries = 60; |
| 1253 | |
| 1254 | /* Don't call this in monitor mode */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1255 | if (wlandev->netdev->type == ARPHRD_ETHER) { |
| 1256 | u16 portstatus; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1257 | |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 1258 | printk(KERN_INFO "linkstatus=CONNECTED\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1259 | |
| 1260 | /* For non-usb devices, we can use the sync versions */ |
| 1261 | /* Collect the BSSID, and set state to allow tx */ |
| 1262 | |
| 1263 | result = hfa384x_drvr_getconfig(hw, |
| 1264 | HFA384x_RID_CURRENTBSSID, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1265 | wlandev->bssid, |
| 1266 | WLAN_BSSID_LEN); |
| 1267 | if (result) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1268 | pr_debug |
| 1269 | ("getconfig(0x%02x) failed, result = %d\n", |
| 1270 | HFA384x_RID_CURRENTBSSID, result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1271 | goto failed; |
| 1272 | } |
| 1273 | |
| 1274 | result = hfa384x_drvr_getconfig(hw, |
| 1275 | HFA384x_RID_CURRENTSSID, |
| 1276 | &ssid, sizeof(ssid)); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1277 | if (result) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1278 | pr_debug |
| 1279 | ("getconfig(0x%02x) failed, result = %d\n", |
| 1280 | HFA384x_RID_CURRENTSSID, result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1281 | goto failed; |
| 1282 | } |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1283 | prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) & ssid, |
| 1284 | (p80211pstrd_t *) & |
| 1285 | wlandev->ssid); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1286 | |
| 1287 | /* Collect the port status */ |
| 1288 | result = hfa384x_drvr_getconfig16(hw, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1289 | HFA384x_RID_PORTSTATUS, |
| 1290 | &portstatus); |
| 1291 | if (result) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1292 | pr_debug |
| 1293 | ("getconfig(0x%02x) failed, result = %d\n", |
| 1294 | HFA384x_RID_PORTSTATUS, result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1295 | goto failed; |
| 1296 | } |
| 1297 | wlandev->macmode = |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1298 | (portstatus == HFA384x_PSTATUS_CONN_IBSS) ? |
| 1299 | WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1300 | |
| 1301 | /* Get the ball rolling on the comms quality stuff */ |
| 1302 | prism2sta_commsqual_defer(&hw->commsqual_bh); |
| 1303 | } |
| 1304 | break; |
| 1305 | |
| 1306 | case HFA384x_LINK_DISCONNECTED: |
| 1307 | /* This one indicates that our association is gone. We've |
| 1308 | * lost connection with the AP and/or been disassociated. |
| 1309 | * This indicates that the MAC has completely cleared it's |
| 1310 | * associated state. We * should send a deauth indication |
| 1311 | * (implying disassoc) up * to the MLME. |
| 1312 | * Response: |
| 1313 | * Indicate Deauthentication |
| 1314 | * Block Transmits, Ignore receives of data frames |
| 1315 | */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1316 | if (hw->join_ap == 2) { |
| 1317 | hfa384x_JoinRequest_data_t joinreq; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1318 | joinreq = hw->joinreq; |
| 1319 | /* Send the join request */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1320 | hfa384x_drvr_setconfig(hw, |
| 1321 | HFA384x_RID_JOINREQUEST, |
| 1322 | &joinreq, |
| 1323 | HFA384x_RID_JOINREQUEST_LEN); |
| 1324 | printk(KERN_INFO |
| 1325 | "linkstatus=DISCONNECTED (re-submitting join)\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1326 | } else { |
| 1327 | if (wlandev->netdev->type == ARPHRD_ETHER) |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1328 | printk(KERN_INFO |
| 1329 | "linkstatus=DISCONNECTED (unhandled)\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1330 | } |
| 1331 | wlandev->macmode = WLAN_MACMODE_NONE; |
| 1332 | |
| 1333 | netif_carrier_off(wlandev->netdev); |
| 1334 | |
| 1335 | break; |
| 1336 | |
| 1337 | case HFA384x_LINK_AP_CHANGE: |
| 1338 | /* This one indicates that the MAC has decided to and |
| 1339 | * successfully completed a change to another AP. We |
| 1340 | * should probably implement a reassociation indication |
| 1341 | * in response to this one. I'm thinking that the the |
| 1342 | * p80211 layer needs to be notified in case of |
| 1343 | * buffering/queueing issues. User mode also needs to be |
| 1344 | * notified so that any BSS dependent elements can be |
| 1345 | * updated. |
| 1346 | * associated state. We * should send a deauth indication |
| 1347 | * (implying disassoc) up * to the MLME. |
| 1348 | * Response: |
| 1349 | * Indicate Reassociation |
| 1350 | * Enable Transmits, Receives and pass up data frames |
| 1351 | */ |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 1352 | printk(KERN_INFO "linkstatus=AP_CHANGE\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1353 | |
| 1354 | result = hfa384x_drvr_getconfig(hw, |
| 1355 | HFA384x_RID_CURRENTBSSID, |
| 1356 | wlandev->bssid, WLAN_BSSID_LEN); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1357 | if (result) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1358 | pr_debug("getconfig(0x%02x) failed, result = %d\n", |
| 1359 | HFA384x_RID_CURRENTBSSID, result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1360 | goto failed; |
| 1361 | } |
| 1362 | |
| 1363 | result = hfa384x_drvr_getconfig(hw, |
| 1364 | HFA384x_RID_CURRENTSSID, |
| 1365 | &ssid, sizeof(ssid)); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1366 | if (result) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1367 | pr_debug("getconfig(0x%02x) failed, result = %d\n", |
| 1368 | HFA384x_RID_CURRENTSSID, result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1369 | goto failed; |
| 1370 | } |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 1371 | prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) & ssid, |
| 1372 | (p80211pstrd_t *) & wlandev->ssid); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1373 | |
| 1374 | hw->link_status = HFA384x_LINK_CONNECTED; |
| 1375 | netif_carrier_on(wlandev->netdev); |
| 1376 | |
| 1377 | break; |
| 1378 | |
| 1379 | case HFA384x_LINK_AP_OUTOFRANGE: |
| 1380 | /* This one indicates that the MAC has decided that the |
| 1381 | * AP is out of range, but hasn't found a better candidate |
| 1382 | * so the MAC maintains its "associated" state in case |
| 1383 | * we get back in range. We should block transmits and |
| 1384 | * receives in this state. Do we need an indication here? |
| 1385 | * Probably not since a polling user-mode element would |
| 1386 | * get this status from from p2PortStatus(FD40). What about |
| 1387 | * p80211? |
| 1388 | * Response: |
| 1389 | * Block Transmits, Ignore receives of data frames |
| 1390 | */ |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 1391 | printk(KERN_INFO "linkstatus=AP_OUTOFRANGE (unhandled)\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1392 | |
| 1393 | netif_carrier_off(wlandev->netdev); |
| 1394 | |
| 1395 | break; |
| 1396 | |
| 1397 | case HFA384x_LINK_AP_INRANGE: |
| 1398 | /* This one indicates that the MAC has decided that the |
| 1399 | * AP is back in range. We continue working with our |
| 1400 | * existing association. |
| 1401 | * Response: |
| 1402 | * Enable Transmits, Receives and pass up data frames |
| 1403 | */ |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 1404 | printk(KERN_INFO "linkstatus=AP_INRANGE\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1405 | |
| 1406 | hw->link_status = HFA384x_LINK_CONNECTED; |
| 1407 | netif_carrier_on(wlandev->netdev); |
| 1408 | |
| 1409 | break; |
| 1410 | |
| 1411 | case HFA384x_LINK_ASSOCFAIL: |
| 1412 | /* This one is actually a peer to CONNECTED. We've |
| 1413 | * requested a join for a given SSID and optionally BSSID. |
| 1414 | * We can use this one to indicate authentication and |
| 1415 | * association failures. The trick is going to be |
| 1416 | * 1) identifying the failure, and 2) state management. |
| 1417 | * Response: |
| 1418 | * Disable Transmits, Ignore receives of data frames |
| 1419 | */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1420 | if (hw->join_ap && --hw->join_retries > 0) { |
| 1421 | hfa384x_JoinRequest_data_t joinreq; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1422 | joinreq = hw->joinreq; |
| 1423 | /* Send the join request */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1424 | hfa384x_drvr_setconfig(hw, |
| 1425 | HFA384x_RID_JOINREQUEST, |
| 1426 | &joinreq, |
| 1427 | HFA384x_RID_JOINREQUEST_LEN); |
| 1428 | printk(KERN_INFO |
| 1429 | "linkstatus=ASSOCFAIL (re-submitting join)\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1430 | } else { |
Moritz Muehlenhoff | 350f2f4b | 2009-01-25 21:54:57 +0100 | [diff] [blame] | 1431 | printk(KERN_INFO "linkstatus=ASSOCFAIL (unhandled)\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1432 | } |
| 1433 | |
| 1434 | netif_carrier_off(wlandev->netdev); |
| 1435 | |
| 1436 | break; |
| 1437 | |
| 1438 | default: |
| 1439 | /* This is bad, IO port problems? */ |
Moritz Muehlenhoff | 9b9556e | 2009-01-25 21:55:01 +0100 | [diff] [blame] | 1440 | printk(KERN_WARNING |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1441 | "unknown linkstatus=0x%02x\n", hw->link_status); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1442 | goto failed; |
| 1443 | break; |
| 1444 | } |
| 1445 | |
| 1446 | wlandev->linkstatus = (hw->link_status == HFA384x_LINK_CONNECTED); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1447 | p80211wext_event_associated(wlandev, wlandev->linkstatus); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1448 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1449 | failed: |
| 1450 | return; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1451 | } |
| 1452 | |
| 1453 | /*---------------------------------------------------------------- |
| 1454 | * prism2sta_inf_linkstatus |
| 1455 | * |
| 1456 | * Handles the receipt of a Link Status info frame. |
| 1457 | * |
| 1458 | * Arguments: |
| 1459 | * wlandev wlan device structure |
| 1460 | * inf ptr to info frame (contents in hfa384x order) |
| 1461 | * |
| 1462 | * Returns: |
| 1463 | * nothing |
| 1464 | * |
| 1465 | * Side effects: |
| 1466 | * |
| 1467 | * Call context: |
| 1468 | * interrupt |
| 1469 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1470 | static void prism2sta_inf_linkstatus(wlandevice_t *wlandev, |
| 1471 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1472 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1473 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1474 | |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1475 | hw->link_status_new = le16_to_cpu(inf->info.linkstatus.linkstatus); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1476 | |
| 1477 | schedule_work(&hw->link_bh); |
| 1478 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1479 | return; |
| 1480 | } |
| 1481 | |
| 1482 | /*---------------------------------------------------------------- |
| 1483 | * prism2sta_inf_assocstatus |
| 1484 | * |
| 1485 | * Handles the receipt of an Association Status info frame. Should |
| 1486 | * be present in APs only. |
| 1487 | * |
| 1488 | * Arguments: |
| 1489 | * wlandev wlan device structure |
| 1490 | * inf ptr to info frame (contents in hfa384x order) |
| 1491 | * |
| 1492 | * Returns: |
| 1493 | * nothing |
| 1494 | * |
| 1495 | * Side effects: |
| 1496 | * |
| 1497 | * Call context: |
| 1498 | * interrupt |
| 1499 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1500 | static void prism2sta_inf_assocstatus(wlandevice_t *wlandev, |
| 1501 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1502 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1503 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 1504 | hfa384x_AssocStatus_t rec; |
| 1505 | int i; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1506 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1507 | memcpy(&rec, &inf->info.assocstatus, sizeof(rec)); |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1508 | rec.assocstatus = le16_to_cpu(rec.assocstatus); |
| 1509 | rec.reason = le16_to_cpu(rec.reason); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1510 | |
| 1511 | /* |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1512 | ** Find the address in the list of authenticated stations. If it wasn't |
| 1513 | ** found, then this address has not been previously authenticated and |
| 1514 | ** something weird has happened if this is anything other than an |
| 1515 | ** "authentication failed" message. If the address was found, then |
| 1516 | ** set the "associated" flag for that station, based on whether the |
| 1517 | ** station is associating or losing its association. Something weird |
| 1518 | ** has also happened if we find the address in the list of authenticated |
| 1519 | ** stations but we are getting an "authentication failed" message. |
| 1520 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1521 | |
| 1522 | for (i = 0; i < hw->authlist.cnt; i++) |
Moritz Muehlenhoff | 28b17a4 | 2009-01-21 22:00:41 +0100 | [diff] [blame] | 1523 | if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1524 | break; |
| 1525 | |
| 1526 | if (i >= hw->authlist.cnt) { |
| 1527 | if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL) |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1528 | printk(KERN_WARNING |
| 1529 | "assocstatus info frame received for non-authenticated station.\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1530 | } else { |
| 1531 | hw->authlist.assoc[i] = |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1532 | (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC || |
| 1533 | rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1534 | |
| 1535 | if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL) |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1536 | printk(KERN_WARNING |
| 1537 | "authfail assocstatus info frame received for authenticated station.\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1538 | } |
| 1539 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1540 | return; |
| 1541 | } |
| 1542 | |
| 1543 | /*---------------------------------------------------------------- |
| 1544 | * prism2sta_inf_authreq |
| 1545 | * |
| 1546 | * Handles the receipt of an Authentication Request info frame. Should |
| 1547 | * be present in APs only. |
| 1548 | * |
| 1549 | * Arguments: |
| 1550 | * wlandev wlan device structure |
| 1551 | * inf ptr to info frame (contents in hfa384x order) |
| 1552 | * |
| 1553 | * Returns: |
| 1554 | * nothing |
| 1555 | * |
| 1556 | * Side effects: |
| 1557 | * |
| 1558 | * Call context: |
| 1559 | * interrupt |
| 1560 | * |
| 1561 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1562 | static void prism2sta_inf_authreq(wlandevice_t *wlandev, |
| 1563 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1564 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1565 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1566 | struct sk_buff *skb; |
| 1567 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1568 | skb = dev_alloc_skb(sizeof(*inf)); |
| 1569 | if (skb) { |
| 1570 | skb_put(skb, sizeof(*inf)); |
| 1571 | memcpy(skb->data, inf, sizeof(*inf)); |
| 1572 | skb_queue_tail(&hw->authq, skb); |
| 1573 | schedule_work(&hw->link_bh); |
| 1574 | } |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1575 | } |
| 1576 | |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1577 | static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev, |
| 1578 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1579 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1580 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
| 1581 | hfa384x_authenticateStation_data_t rec; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1582 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1583 | int i, added, result, cnt; |
| 1584 | u8 *addr; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1585 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1586 | /* |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1587 | ** Build the AuthenticateStation record. Initialize it for denying |
| 1588 | ** authentication. |
| 1589 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1590 | |
Moritz Muehlenhoff | 28b17a4 | 2009-01-21 22:00:41 +0100 | [diff] [blame] | 1591 | memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1592 | rec.status = P80211ENUM_status_unspec_failure; |
| 1593 | |
| 1594 | /* |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1595 | ** Authenticate based on the access mode. |
| 1596 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1597 | |
| 1598 | switch (hw->accessmode) { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1599 | case WLAN_ACCESS_NONE: |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1600 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1601 | /* |
| 1602 | ** Deny all new authentications. However, if a station |
| 1603 | ** is ALREADY authenticated, then accept it. |
| 1604 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1605 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1606 | for (i = 0; i < hw->authlist.cnt; i++) |
| 1607 | if (memcmp(rec.address, hw->authlist.addr[i], |
| 1608 | ETH_ALEN) == 0) { |
| 1609 | rec.status = P80211ENUM_status_successful; |
| 1610 | break; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1611 | } |
| 1612 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1613 | break; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1614 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1615 | case WLAN_ACCESS_ALL: |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1616 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1617 | /* |
| 1618 | ** Allow all authentications. |
| 1619 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1620 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1621 | rec.status = P80211ENUM_status_successful; |
| 1622 | break; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1623 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1624 | case WLAN_ACCESS_ALLOW: |
| 1625 | |
| 1626 | /* |
| 1627 | ** Only allow the authentication if the MAC address |
| 1628 | ** is in the list of allowed addresses. |
| 1629 | ** |
| 1630 | ** Since this is the interrupt handler, we may be here |
| 1631 | ** while the access list is in the middle of being |
| 1632 | ** updated. Choose the list which is currently okay. |
| 1633 | ** See "prism2mib_priv_accessallow()" for details. |
| 1634 | */ |
| 1635 | |
| 1636 | if (hw->allow.modify == 0) { |
| 1637 | cnt = hw->allow.cnt; |
| 1638 | addr = hw->allow.addr[0]; |
| 1639 | } else { |
| 1640 | cnt = hw->allow.cnt1; |
| 1641 | addr = hw->allow.addr1[0]; |
| 1642 | } |
| 1643 | |
| 1644 | for (i = 0; i < cnt; i++, addr += ETH_ALEN) |
| 1645 | if (memcmp(rec.address, addr, ETH_ALEN) == 0) { |
| 1646 | rec.status = P80211ENUM_status_successful; |
| 1647 | break; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1648 | } |
| 1649 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1650 | break; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1651 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1652 | case WLAN_ACCESS_DENY: |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1653 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1654 | /* |
| 1655 | ** Allow the authentication UNLESS the MAC address is |
| 1656 | ** in the list of denied addresses. |
| 1657 | ** |
| 1658 | ** Since this is the interrupt handler, we may be here |
| 1659 | ** while the access list is in the middle of being |
| 1660 | ** updated. Choose the list which is currently okay. |
| 1661 | ** See "prism2mib_priv_accessdeny()" for details. |
| 1662 | */ |
| 1663 | |
| 1664 | if (hw->deny.modify == 0) { |
| 1665 | cnt = hw->deny.cnt; |
| 1666 | addr = hw->deny.addr[0]; |
| 1667 | } else { |
| 1668 | cnt = hw->deny.cnt1; |
| 1669 | addr = hw->deny.addr1[0]; |
| 1670 | } |
| 1671 | |
| 1672 | rec.status = P80211ENUM_status_successful; |
| 1673 | |
| 1674 | for (i = 0; i < cnt; i++, addr += ETH_ALEN) |
| 1675 | if (memcmp(rec.address, addr, ETH_ALEN) == 0) { |
| 1676 | rec.status = P80211ENUM_status_unspec_failure; |
| 1677 | break; |
| 1678 | } |
| 1679 | |
| 1680 | break; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1681 | } |
| 1682 | |
| 1683 | /* |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1684 | ** If the authentication is okay, then add the MAC address to the list |
| 1685 | ** of authenticated stations. Don't add the address if it is already in |
| 1686 | ** the list. (802.11b does not seem to disallow a station from issuing |
| 1687 | ** an authentication request when the station is already authenticated. |
| 1688 | ** Does this sort of thing ever happen? We might as well do the check |
| 1689 | ** just in case.) |
| 1690 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1691 | |
| 1692 | added = 0; |
| 1693 | |
| 1694 | if (rec.status == P80211ENUM_status_successful) { |
| 1695 | for (i = 0; i < hw->authlist.cnt; i++) |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1696 | if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN) |
| 1697 | == 0) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1698 | break; |
| 1699 | |
| 1700 | if (i >= hw->authlist.cnt) { |
| 1701 | if (hw->authlist.cnt >= WLAN_AUTH_MAX) { |
| 1702 | rec.status = P80211ENUM_status_ap_full; |
| 1703 | } else { |
| 1704 | memcpy(hw->authlist.addr[hw->authlist.cnt], |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1705 | rec.address, ETH_ALEN); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1706 | hw->authlist.cnt++; |
| 1707 | added = 1; |
| 1708 | } |
| 1709 | } |
| 1710 | } |
| 1711 | |
| 1712 | /* |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1713 | ** Send back the results of the authentication. If this doesn't work, |
| 1714 | ** then make sure to remove the address from the authenticated list if |
| 1715 | ** it was added. |
| 1716 | */ |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1717 | |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1718 | rec.status = cpu_to_le16(rec.status); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1719 | rec.algorithm = inf->info.authreq.algorithm; |
| 1720 | |
| 1721 | result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA, |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1722 | &rec, sizeof(rec)); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1723 | if (result) { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1724 | if (added) |
| 1725 | hw->authlist.cnt--; |
| 1726 | printk(KERN_ERR |
| 1727 | "setconfig(authenticatestation) failed, result=%d\n", |
| 1728 | result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1729 | } |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1730 | return; |
| 1731 | } |
| 1732 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1733 | /*---------------------------------------------------------------- |
| 1734 | * prism2sta_inf_psusercnt |
| 1735 | * |
| 1736 | * Handles the receipt of a PowerSaveUserCount info frame. Should |
| 1737 | * be present in APs only. |
| 1738 | * |
| 1739 | * Arguments: |
| 1740 | * wlandev wlan device structure |
| 1741 | * inf ptr to info frame (contents in hfa384x order) |
| 1742 | * |
| 1743 | * Returns: |
| 1744 | * nothing |
| 1745 | * |
| 1746 | * Side effects: |
| 1747 | * |
| 1748 | * Call context: |
| 1749 | * interrupt |
| 1750 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1751 | static void prism2sta_inf_psusercnt(wlandevice_t *wlandev, |
| 1752 | hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1753 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1754 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1755 | |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1756 | hw->psusercount = le16_to_cpu(inf->info.psusercnt.usercnt); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1757 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1758 | return; |
| 1759 | } |
| 1760 | |
| 1761 | /*---------------------------------------------------------------- |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1762 | * prism2sta_ev_info |
| 1763 | * |
| 1764 | * Handles the Info event. |
| 1765 | * |
| 1766 | * Arguments: |
| 1767 | * wlandev wlan device structure |
| 1768 | * inf ptr to a generic info frame |
| 1769 | * |
| 1770 | * Returns: |
| 1771 | * nothing |
| 1772 | * |
| 1773 | * Side effects: |
| 1774 | * |
| 1775 | * Call context: |
| 1776 | * interrupt |
| 1777 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1778 | void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1779 | { |
Moritz Muehlenhoff | 18c7f79 | 2009-02-18 19:50:07 +0100 | [diff] [blame] | 1780 | inf->infotype = le16_to_cpu(inf->infotype); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1781 | /* Dispatch */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1782 | switch (inf->infotype) { |
| 1783 | case HFA384x_IT_HANDOVERADDR: |
| 1784 | prism2sta_inf_handover(wlandev, inf); |
| 1785 | break; |
| 1786 | case HFA384x_IT_COMMTALLIES: |
| 1787 | prism2sta_inf_tallies(wlandev, inf); |
| 1788 | break; |
| 1789 | case HFA384x_IT_HOSTSCANRESULTS: |
| 1790 | prism2sta_inf_hostscanresults(wlandev, inf); |
| 1791 | break; |
| 1792 | case HFA384x_IT_SCANRESULTS: |
| 1793 | prism2sta_inf_scanresults(wlandev, inf); |
| 1794 | break; |
| 1795 | case HFA384x_IT_CHINFORESULTS: |
| 1796 | prism2sta_inf_chinforesults(wlandev, inf); |
| 1797 | break; |
| 1798 | case HFA384x_IT_LINKSTATUS: |
| 1799 | prism2sta_inf_linkstatus(wlandev, inf); |
| 1800 | break; |
| 1801 | case HFA384x_IT_ASSOCSTATUS: |
| 1802 | prism2sta_inf_assocstatus(wlandev, inf); |
| 1803 | break; |
| 1804 | case HFA384x_IT_AUTHREQ: |
| 1805 | prism2sta_inf_authreq(wlandev, inf); |
| 1806 | break; |
| 1807 | case HFA384x_IT_PSUSERCNT: |
| 1808 | prism2sta_inf_psusercnt(wlandev, inf); |
| 1809 | break; |
| 1810 | case HFA384x_IT_KEYIDCHANGED: |
| 1811 | printk(KERN_WARNING "Unhandled IT_KEYIDCHANGED\n"); |
| 1812 | break; |
| 1813 | case HFA384x_IT_ASSOCREQ: |
| 1814 | printk(KERN_WARNING "Unhandled IT_ASSOCREQ\n"); |
| 1815 | break; |
| 1816 | case HFA384x_IT_MICFAILURE: |
| 1817 | printk(KERN_WARNING "Unhandled IT_MICFAILURE\n"); |
| 1818 | break; |
| 1819 | default: |
| 1820 | printk(KERN_WARNING |
| 1821 | "Unknown info type=0x%02x\n", inf->infotype); |
| 1822 | break; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1823 | } |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1824 | return; |
| 1825 | } |
| 1826 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1827 | /*---------------------------------------------------------------- |
| 1828 | * prism2sta_ev_txexc |
| 1829 | * |
| 1830 | * Handles the TxExc event. A Transmit Exception event indicates |
| 1831 | * that the MAC's TX process was unsuccessful - so the packet did |
| 1832 | * not get transmitted. |
| 1833 | * |
| 1834 | * Arguments: |
| 1835 | * wlandev wlan device structure |
| 1836 | * status tx frame status word |
| 1837 | * |
| 1838 | * Returns: |
| 1839 | * nothing |
| 1840 | * |
| 1841 | * Side effects: |
| 1842 | * |
| 1843 | * Call context: |
| 1844 | * interrupt |
| 1845 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1846 | void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1847 | { |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 1848 | pr_debug("TxExc status=0x%x.\n", status); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1849 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1850 | return; |
| 1851 | } |
| 1852 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1853 | /*---------------------------------------------------------------- |
| 1854 | * prism2sta_ev_tx |
| 1855 | * |
| 1856 | * Handles the Tx event. |
| 1857 | * |
| 1858 | * Arguments: |
| 1859 | * wlandev wlan device structure |
| 1860 | * status tx frame status word |
| 1861 | * Returns: |
| 1862 | * nothing |
| 1863 | * |
| 1864 | * Side effects: |
| 1865 | * |
| 1866 | * Call context: |
| 1867 | * interrupt |
| 1868 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1869 | void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1870 | { |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 1871 | pr_debug("Tx Complete, status=0x%04x\n", status); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1872 | /* update linux network stats */ |
| 1873 | wlandev->linux_stats.tx_packets++; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1874 | return; |
| 1875 | } |
| 1876 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1877 | /*---------------------------------------------------------------- |
| 1878 | * prism2sta_ev_rx |
| 1879 | * |
| 1880 | * Handles the Rx event. |
| 1881 | * |
| 1882 | * Arguments: |
| 1883 | * wlandev wlan device structure |
| 1884 | * |
| 1885 | * Returns: |
| 1886 | * nothing |
| 1887 | * |
| 1888 | * Side effects: |
| 1889 | * |
| 1890 | * Call context: |
| 1891 | * interrupt |
| 1892 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1893 | void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1894 | { |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1895 | p80211netdev_rx(wlandev, skb); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1896 | return; |
| 1897 | } |
| 1898 | |
| 1899 | /*---------------------------------------------------------------- |
| 1900 | * prism2sta_ev_alloc |
| 1901 | * |
| 1902 | * Handles the Alloc event. |
| 1903 | * |
| 1904 | * Arguments: |
| 1905 | * wlandev wlan device structure |
| 1906 | * |
| 1907 | * Returns: |
| 1908 | * nothing |
| 1909 | * |
| 1910 | * Side effects: |
| 1911 | * |
| 1912 | * Call context: |
| 1913 | * interrupt |
| 1914 | ----------------------------------------------------------------*/ |
Mithlesh Thukral | 297f06c | 2009-06-10 19:36:11 +0530 | [diff] [blame] | 1915 | void prism2sta_ev_alloc(wlandevice_t *wlandev) |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1916 | { |
Solomon Peachy | cbec30c | 2008-10-29 10:42:57 -0400 | [diff] [blame] | 1917 | netif_wake_queue(wlandev->netdev); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1918 | return; |
| 1919 | } |
| 1920 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1921 | /*---------------------------------------------------------------- |
| 1922 | * create_wlan |
| 1923 | * |
| 1924 | * Called at module init time. This creates the wlandevice_t structure |
| 1925 | * and initializes it with relevant bits. |
| 1926 | * |
| 1927 | * Arguments: |
| 1928 | * none |
| 1929 | * |
| 1930 | * Returns: |
| 1931 | * the created wlandevice_t structure. |
| 1932 | * |
| 1933 | * Side effects: |
| 1934 | * also allocates the priv/hw structures. |
| 1935 | * |
| 1936 | * Call context: |
| 1937 | * process thread |
| 1938 | * |
| 1939 | ----------------------------------------------------------------*/ |
| 1940 | static wlandevice_t *create_wlan(void) |
| 1941 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1942 | wlandevice_t *wlandev = NULL; |
| 1943 | hfa384x_t *hw = NULL; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1944 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1945 | /* Alloc our structures */ |
| 1946 | wlandev = kmalloc(sizeof(wlandevice_t), GFP_KERNEL); |
| 1947 | hw = kmalloc(sizeof(hfa384x_t), GFP_KERNEL); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1948 | |
| 1949 | if (!wlandev || !hw) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 1950 | printk(KERN_ERR "%s: Memory allocation failure.\n", dev_info); |
Moritz Muehlenhoff | 7c98f71 | 2009-02-09 19:33:42 +0100 | [diff] [blame] | 1951 | kfree(wlandev); |
| 1952 | kfree(hw); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1953 | return NULL; |
| 1954 | } |
| 1955 | |
| 1956 | /* Clear all the structs */ |
| 1957 | memset(wlandev, 0, sizeof(wlandevice_t)); |
| 1958 | memset(hw, 0, sizeof(hfa384x_t)); |
| 1959 | |
| 1960 | /* Initialize the network device object. */ |
| 1961 | wlandev->nsdname = dev_info; |
| 1962 | wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING; |
| 1963 | wlandev->priv = hw; |
| 1964 | wlandev->open = prism2sta_open; |
| 1965 | wlandev->close = prism2sta_close; |
| 1966 | wlandev->reset = prism2sta_reset; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1967 | wlandev->txframe = prism2sta_txframe; |
| 1968 | wlandev->mlmerequest = prism2sta_mlmerequest; |
| 1969 | wlandev->set_multicast_list = prism2sta_setmulticast; |
| 1970 | wlandev->tx_timeout = hfa384x_tx_timeout; |
| 1971 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1972 | wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | P80211_NSDCAP_AUTOJOIN; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1973 | |
| 1974 | /* Initialize the device private data stucture. */ |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1975 | hw->dot11_desired_bss_type = 1; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1976 | |
| 1977 | return wlandev; |
| 1978 | } |
| 1979 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1980 | void prism2sta_commsqual_defer(struct work_struct *data) |
| 1981 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 1982 | hfa384x_t *hw = container_of(data, struct hfa384x, commsqual_bh); |
| 1983 | wlandevice_t *wlandev = hw->wlandev; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1984 | hfa384x_bytestr32_t ssid; |
| 1985 | int result = 0; |
| 1986 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 1987 | if (hw->wlandev->hwremoved) |
| 1988 | goto done; |
| 1989 | |
| 1990 | /* we don't care if we're in AP mode */ |
| 1991 | if ((wlandev->macmode == WLAN_MACMODE_NONE) || |
| 1992 | (wlandev->macmode == WLAN_MACMODE_ESS_AP)) { |
| 1993 | goto done; |
| 1994 | } |
| 1995 | |
| 1996 | /* It only makes sense to poll these in non-IBSS */ |
| 1997 | if (wlandev->macmode != WLAN_MACMODE_IBSS_STA) { |
| 1998 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_DBMCOMMSQUALITY, |
| 1999 | &hw->qual, |
| 2000 | HFA384x_RID_DBMCOMMSQUALITY_LEN); |
| 2001 | |
| 2002 | if (result) { |
Moritz Muehlenhoff | edbd606 | 2009-01-25 21:55:00 +0100 | [diff] [blame] | 2003 | printk(KERN_ERR "error fetching commsqual\n"); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2004 | goto done; |
| 2005 | } |
| 2006 | |
Moritz Muehlenhoff | a7cf7ba | 2009-02-08 02:01:00 +0100 | [diff] [blame] | 2007 | pr_debug("commsqual %d %d %d\n", |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 2008 | le16_to_cpu(hw->qual.CQ_currBSS), |
| 2009 | le16_to_cpu(hw->qual.ASL_currBSS), |
| 2010 | le16_to_cpu(hw->qual.ANL_currFC)); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2011 | } |
| 2012 | |
| 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); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 2017 | if (result) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 2018 | pr_debug("getconfig(0x%02x) failed, result = %d\n", |
| 2019 | HFA384x_RID_CURRENTBSSID, result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2020 | goto done; |
| 2021 | } |
| 2022 | |
| 2023 | result = hfa384x_drvr_getconfig(hw, |
| 2024 | HFA384x_RID_CURRENTSSID, |
| 2025 | &ssid, sizeof(ssid)); |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 2026 | if (result) { |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 2027 | pr_debug("getconfig(0x%02x) failed, result = %d\n", |
| 2028 | HFA384x_RID_CURRENTSSID, result); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2029 | goto done; |
| 2030 | } |
Mithlesh Thukral | 75f49e0 | 2009-05-25 19:06:16 +0530 | [diff] [blame] | 2031 | prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) & ssid, |
| 2032 | (p80211pstrd_t *) & wlandev->ssid); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2033 | |
| 2034 | /* Reschedule timer */ |
| 2035 | mod_timer(&hw->commsqual_timer, jiffies + HZ); |
| 2036 | |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 2037 | done: |
Moritz Muehlenhoff | 8a251b5 | 2009-01-21 22:00:44 +0100 | [diff] [blame] | 2038 | ; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2039 | } |
| 2040 | |
| 2041 | void prism2sta_commsqual_timer(unsigned long data) |
| 2042 | { |
Moritz Muehlenhoff | f342288 | 2009-02-08 02:21:04 +0100 | [diff] [blame] | 2043 | hfa384x_t *hw = (hfa384x_t *) data; |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2044 | |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2045 | schedule_work(&hw->commsqual_bh); |
Greg Kroah-Hartman | 00b3ed1 | 2008-10-02 11:29:28 -0700 | [diff] [blame] | 2046 | } |