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