60 #include <linux/if_arp.h>
61 #include <linux/module.h>
62 #include <linux/kernel.h>
63 #include <linux/wait.h>
64 #include <linux/sched.h>
65 #include <linux/types.h>
66 #include <linux/wireless.h>
67 #include <linux/netdevice.h>
70 #include <asm/byteorder.h>
71 #include <linux/random.h>
73 #include <linux/bitops.h>
87 #define p80211rate_to_p2bit(n) ((((n)&~BIT(7)) == 2) ? BIT(0) : \
88 (((n)&~BIT(7)) == 4) ? BIT(1) : \
89 (((n)&~BIT(7)) == 11) ? BIT(2) : \
90 (((n)&~BIT(7)) == 22) ? BIT(3) : 0)
119 hfa384x_t *
hw = wlandev->
priv;
129 hw->ident_sta_fw.minor,
130 hw->ident_sta_fw.variant) <
133 "HostScan not supported with current firmware (<1.3.2).\n");
139 memset(&scanreq, 0,
sizeof(scanreq));
142 result = hfa384x_drvr_getconfig16(hw,
154 result = hfa384x_drvr_setconfig16(hw,
167 hw->ident_sta_fw.minor,
168 hw->ident_sta_fw.variant) >
180 "current firmware. (<1.5.1)\n");
195 word |= (1 << (channel - 1));
207 "result=%d\n", result);
215 result = hfa384x_drvr_setconfig16(hw,
220 "setconfig(ROAMINGMODE) failed. result=%d\n",
250 result = hfa384x_drvr_setconfig16(hw,
260 result = hfa384x_drvr_setconfig16(hw,
272 "result=%d\n", result);
282 timeout = (timeout *
HZ) / 1000;
302 if (hw->scanflag == -1)
314 "result=%d\n", result);
365 hfa384x_t *
hw = wlandev->
priv;
374 if (!hw->scanresults) {
376 "dot11req_scan_results can only be used after a successful dot11req_scan.\n");
382 count = (hw->scanresults->framelen - 3) / 32;
387 pr_debug(
"requested index (%d) out of range (%d)\n",
394 item = &(hw->scanresults->info.hscanresult.result[req->
bssindex.
data]);
413 for (count = 0; count < 10; count++)
417 #define REQBASICRATE(N) \
418 if ((count >= N) && DOT11_RATE5_ISBASIC_GET(item->supprates[(N)-1])) { \
419 req->basicrate ## N .data = item->supprates[(N)-1]; \
420 req->basicrate ## N .status = \
421 P80211ENUM_msgitem_status_data_ok; \
433 #define REQSUPPRATE(N) \
435 req->supprate ## N .data = item->supprates[(N)-1]; \
436 req->supprate ## N .status = \
437 P80211ENUM_msgitem_status_data_ok; \
518 hfa384x_t *
hw = wlandev->
priv;
534 hw->ident_sta_fw.minor,
535 hw->ident_sta_fw.variant) <
665 pr_debug(
"Failed to set a config option, result=%d\n", result);
694 hfa384x_t *
hw = wlandev->
priv;
703 "PDA may only be read " "in the fwload state.\n");
716 "hfa384x_drvr_readpda() failed, "
717 "result=%d\n", result);
760 hfa384x_t *
hw = wlandev->
priv;
765 "ramdl_state(): may only be called "
766 "in the fwload state.\n");
816 hfa384x_t *
hw = wlandev->
priv;
824 "ramdl_write(): may only be called "
825 "in the fwload state.\n");
879 hfa384x_t *
hw = wlandev->
priv;
884 "flashdl_state(): may only be called "
885 "in the fwload state.\n");
919 "P80211ENUM_resultcode=%d\n", result);
949 hfa384x_t *
hw = wlandev->
priv;
957 "flashdl_write(): may only be called "
958 "in the fwload state.\n");
1010 hfa384x_t *
hw = wlandev->
priv;
1084 hfa384x_t *
hw = wlandev->
priv;
1100 pr_debug(
"failed to disable monitor mode, result=%d\n",
1108 (
"failed to disable port 0 after sniffing, result=%d\n",
1116 result = hfa384x_drvr_setconfig16(hw,
1118 hw->presniff_wepflags);
1121 (
"failed to restore wepflags=0x%04x, result=%d\n",
1122 hw->presniff_wepflags, result);
1127 if (hw->presniff_port_type != 0) {
1128 word = hw->presniff_port_type;
1129 result = hfa384x_drvr_setconfig16(hw,
1134 (
"failed to restore porttype, result=%d\n",
1143 (
"failed to enable port to presniff setting, result=%d\n",
1159 if (hw->port_enabled[0]) {
1162 result = hfa384x_drvr_getconfig16(hw,
1164 &(hw->presniff_port_type));
1167 (
"failed to read porttype, result=%d\n",
1172 result = hfa384x_drvr_getconfig16(hw,
1174 &(hw->presniff_wepflags));
1177 (
"failed to read wepflags, result=%d\n",
1185 (
"failed to restart the card for sniffing, result=%d\n",
1194 (
"failed to enable port for sniffing, result=%d\n",
1200 hw->presniff_port_type = 0;
1205 result = hfa384x_drvr_setconfig16(hw,
1208 hw->sniff_channel =
word;
1211 pr_debug(
"failed to set channel %d, result=%d\n",
1220 result = hfa384x_drvr_setconfig16(hw,
1225 (
"failed to set porttype %d, result=%d\n",
1237 hfa384x_drvr_setconfig16(hw,
1244 (
"failed to set wepflags=0x%04x, result=%d\n",
1263 hw->sniff_truncate = 0;
1270 (
"failed to enable port for sniffing, result=%d\n",
1277 pr_debug(
"failed to enable monitor mode, result=%d\n",