/*================================================================*/
/* System Includes */
-#define WLAN_DBVAR prism2_debug
-
#include <linux/if_arp.h>
#include <linux/module.h>
#include <asm/byteorder.h>
#include <linux/random.h>
#include <linux/usb.h>
+#include <linux/bitops.h>
#include "wlan_compat.h"
#include "prism2mgmt.h"
/* Converts 802.11 format rate specifications to prism2 */
-#define p80211rate_to_p2bit(n) ((((n)&~BIT7) == 2) ? BIT0 : \
- (((n)&~BIT7) == 4) ? BIT1 : \
- (((n)&~BIT7) == 11) ? BIT2 : \
- (((n)&~BIT7) == 22) ? BIT3 : 0)
+#define p80211rate_to_p2bit(n) ((((n)&~BIT(7)) == 2) ? BIT(0) : \
+ (((n)&~BIT(7)) == 4) ? BIT(1) : \
+ (((n)&~BIT(7)) == 11) ? BIT(2) : \
+ (((n)&~BIT(7)) == 22) ? BIT(3) : 0)
/*----------------------------------------------------------------
* prism2mgmt_scan
hfa384x_HostScanRequest_data_t scanreq;
- DBFENTER;
-
/* gatekeeper check */
if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major,
hw->ident_sta_fw.minor,
hw->ident_sta_fw.variant) <
HFA384x_FIRMWARE_VERSION(1,3,2)) {
- WLAN_LOG_ERROR("HostScan not supported with current firmware (<1.3.2).\n");
+ printk(KERN_ERR "HostScan not supported with current firmware (<1.3.2).\n");
result = 1;
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
goto exit;
result = hfa384x_drvr_getconfig16(hw,
HFA384x_RID_CNFROAMINGMODE, &roamingmode);
if ( result ) {
- WLAN_LOG_ERROR("getconfig(ROAMMODE) failed. result=%d\n",
+ printk(KERN_ERR "getconfig(ROAMMODE) failed. result=%d\n",
result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
HFA384x_RID_CNFROAMINGMODE,
HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM);
if ( result ) {
- WLAN_LOG_ERROR("setconfig(ROAMINGMODE) failed. result=%d\n",
+ printk(KERN_ERR "setconfig(ROAMINGMODE) failed. result=%d\n",
result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
}
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPASSIVESCANCTRL, word);
if ( result ) {
- WLAN_LOG_WARNING("Passive scan not supported with "
+ printk(KERN_WARNING "Passive scan not supported with "
"current firmware. (<1.5.1)\n");
}
}
for (i = 0; i < msg->channellist.data.len; i++) {
u8 channel = msg->channellist.data.data[i];
if (channel > 14) continue;
- /* channel 1 is BIT0 ... channel 14 is BIT13 */
+ /* channel 1 is BIT 0 ... channel 14 is BIT 13 */
word |= (1 << (channel-1));
}
scanreq.channelList = host2hfa384x_16(word);
/* Enable the MAC port if it's not already enabled */
result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_PORTSTATUS, &word);
if ( result ) {
- WLAN_LOG_ERROR("getconfig(PORTSTATUS) failed. "
+ printk(KERN_ERR "getconfig(PORTSTATUS) failed. "
"result=%d\n", result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
HFA384x_RID_CNFROAMINGMODE,
HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM);
if ( result ) {
- WLAN_LOG_ERROR("setconfig(ROAMINGMODE) failed. result=%d\n", result);
+ printk(KERN_ERR "setconfig(ROAMINGMODE) failed. result=%d\n", result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
goto exit;
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID,
wordbuf, HFA384x_RID_CNFOWNSSID_LEN);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set OwnSSID.\n");
+ printk(KERN_ERR "Failed to set OwnSSID.\n");
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
goto exit;
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFDESIREDSSID,
wordbuf, HFA384x_RID_CNFDESIREDSSID_LEN);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set DesiredSSID.\n");
+ printk(KERN_ERR "Failed to set DesiredSSID.\n");
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
goto exit;
HFA384x_RID_CNFPORTTYPE,
HFA384x_PORTTYPE_IBSS);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set CNFPORTTYPE.\n");
+ printk(KERN_ERR "Failed to set CNFPORTTYPE.\n");
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
goto exit;
HFA384x_RID_CREATEIBSS,
HFA384x_CREATEIBSS_JOINCREATEIBSS);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set CREATEIBSS.\n");
+ printk(KERN_ERR "Failed to set CREATEIBSS.\n");
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
goto exit;
}
result = hfa384x_drvr_enable(hw, 0);
if ( result ) {
- WLAN_LOG_ERROR("drvr_enable(0) failed. "
+ printk(KERN_ERR "drvr_enable(0) failed. "
"result=%d\n", result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
/* Issue the scan request */
hw->scanflag = 0;
- WLAN_HEX_DUMP(5,"hscanreq", &scanreq, sizeof(scanreq));
-
result = hfa384x_drvr_setconfig( hw,
HFA384x_RID_HOSTSCAN, &scanreq,
sizeof(hfa384x_HostScanRequest_data_t));
if ( result ) {
- WLAN_LOG_ERROR("setconfig(SCANREQUEST) failed. result=%d\n",
+ printk(KERN_ERR "setconfig(SCANREQUEST) failed. result=%d\n",
result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
if (istmpenable) {
result = hfa384x_drvr_disable(hw, 0);
if ( result ) {
- WLAN_LOG_ERROR("drvr_disable(0) failed. "
+ printk(KERN_ERR "drvr_disable(0) failed. "
"result=%d\n", result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFROAMINGMODE,
roamingmode);
if ( result ) {
- WLAN_LOG_ERROR("setconfig(ROAMMODE) failed. result=%d\n",
+ printk(KERN_ERR "setconfig(ROAMMODE) failed. result=%d\n",
result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
exit:
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
- DBFEXIT;
return result;
}
int count;
- DBFENTER;
-
req = (p80211msg_dot11req_scan_results_t *) msgp;
req->resultcode.status = P80211ENUM_msgitem_status_data_ok;
if (! hw->scanresults) {
- WLAN_LOG_ERROR("dot11req_scan_results can only be used after a successful dot11req_scan.\n");
+ printk(KERN_ERR "dot11req_scan_results can only be used after a successful dot11req_scan.\n");
result = 2;
req->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
goto exit;
if (count > 32) count = 32;
if (req->bssindex.data >= count) {
- WLAN_LOG_DEBUG(0, "requested index (%d) out of range (%d)\n",
+ pr_debug("requested index (%d) out of range (%d)\n",
req->bssindex.data, count);
result = 2;
req->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
req->resultcode.data = P80211ENUM_resultcode_success;
exit:
- DBFEXIT;
return result;
}
u8 bytebuf[80];
hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf;
u16 word;
- DBFENTER;
wlandev->macmode = WLAN_MACMODE_NONE;
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID,
bytebuf, HFA384x_RID_CNFOWNSSID_LEN);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set CnfOwnSSID\n");
+ printk(KERN_ERR "Failed to set CnfOwnSSID\n");
goto failed;
}
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFDESIREDSSID,
bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set CnfDesiredSSID\n");
+ printk(KERN_ERR "Failed to set CnfDesiredSSID\n");
goto failed;
}
word = msg->beaconperiod.data;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAPBCNint, word);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set beacon period=%d.\n", word);
+ printk(KERN_ERR "Failed to set beacon period=%d.\n", word);
goto failed;
}
word = msg->dschannel.data;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNCHANNEL, word);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set channel=%d.\n", word);
+ printk(KERN_ERR "Failed to set channel=%d.\n", word);
goto failed;
}
/* Basic rates */
}
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, word);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set basicrates=%d.\n", word);
+ printk(KERN_ERR "Failed to set basicrates=%d.\n", word);
goto failed;
}
}
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, word);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set supprates=%d.\n", word);
+ printk(KERN_ERR "Failed to set supprates=%d.\n", word);
goto failed;
}
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, word);
if ( result ) {
- WLAN_LOG_ERROR("Failed to set txrates=%d.\n", word);
+ printk(KERN_ERR "Failed to set txrates=%d.\n", word);
goto failed;
}
/* Enable the Port */
result = hfa384x_drvr_enable(hw, 0);
if ( result ) {
- WLAN_LOG_ERROR("Enable macport failed, result=%d.\n", result);
+ printk(KERN_ERR "Enable macport failed, result=%d.\n", result);
goto failed;
}
goto done;
failed:
- WLAN_LOG_DEBUG(1, "Failed to set a config option, result=%d\n", result);
+ pr_debug("Failed to set a config option, result=%d\n", result);
msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
done:
result = 0;
- DBFEXIT;
return result;
}
hfa384x_t *hw = wlandev->priv;
p80211msg_p2req_readpda_t *msg = msgp;
int result;
- DBFENTER;
/* We only support collecting the PDA when in the FWLOAD
* state.
*/
if (wlandev->msdstate != WLAN_MSD_FWLOAD) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"PDA may only be read "
"in the fwload state.\n");
msg->resultcode.data =
msg->pda.data,
HFA384x_PDA_LEN_MAX);
if (result) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"hfa384x_drvr_readpda() failed, "
"result=%d\n",
result);
P80211ENUM_resultcode_implementation_failure;
msg->resultcode.status =
P80211ENUM_msgitem_status_data_ok;
- DBFEXIT;
return 0;
}
msg->pda.status = P80211ENUM_msgitem_status_data_ok;
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
}
- DBFEXIT;
return 0;
}
{
hfa384x_t *hw = wlandev->priv;
p80211msg_p2req_ramdl_state_t *msg = msgp;
- DBFENTER;
if (wlandev->msdstate != WLAN_MSD_FWLOAD) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"ramdl_state(): may only be called "
"in the fwload state.\n");
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
- DBFEXIT;
return 0;
}
msg->resultcode.data = P80211ENUM_resultcode_success;
}
- DBFEXIT;
return 0;
}
u32 addr;
u32 len;
u8 *buf;
- DBFENTER;
if (wlandev->msdstate != WLAN_MSD_FWLOAD) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"ramdl_write(): may only be called "
"in the fwload state.\n");
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
- DBFEXIT;
return 0;
}
}
msg->resultcode.data = P80211ENUM_resultcode_success;
- DBFEXIT;
return 0;
}
int result = 0;
hfa384x_t *hw = wlandev->priv;
p80211msg_p2req_flashdl_state_t *msg = msgp;
- DBFENTER;
if (wlandev->msdstate != WLAN_MSD_FWLOAD) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"flashdl_state(): may only be called "
"in the fwload state.\n");
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
- DBFEXIT;
return 0;
}
wlandev->msdstate = WLAN_MSD_HWPRESENT;
result = prism2sta_ifstate(wlandev, P80211ENUM_ifstate_fwload);
if (result != P80211ENUM_resultcode_success) {
- WLAN_LOG_ERROR("prism2sta_ifstate(fwload) failed,"
+ printk(KERN_ERR "prism2sta_ifstate(fwload) failed,"
"P80211ENUM_resultcode=%d\n", result);
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
}
}
- DBFEXIT;
return 0;
}
u32 addr;
u32 len;
u8 *buf;
- DBFENTER;
if (wlandev->msdstate != WLAN_MSD_FWLOAD) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"flashdl_write(): may only be called "
"in the fwload state.\n");
msg->resultcode.data =
P80211ENUM_resultcode_implementation_failure;
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
- DBFEXIT;
return 0;
}
}
msg->resultcode.data = P80211ENUM_resultcode_success;
- DBFEXIT;
return 0;
}
p80211pstrd_t *pstr;
u8 bytebuf[256];
hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf;
- DBFENTER;
wlandev->macmode = WLAN_MACMODE_NONE;
result = hfa384x_drvr_setconfig(
hw, HFA384x_RID_CNFDESIREDSSID,
bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN);
-#if 0
- /* we can use the new-fangled auto-unknown mode if the firmware
- is 1.3.3 or newer */
- if (HFA384x_FIRMARE_VERSION(hw->ident_sta_fw.major,
- hw->ident_sta_fw.minor,
- hw->ident_sta_fw.variant) >=
- HFA384x_FIRMWARE_VERSION(1,3,3)) {
- /* Set up the IBSS options */
- reg = HFA384x_CREATEIBSS_JOINESS_JOINCREATEIBSS;
- hfa384x_drvr_setconfig16(hw, HFA384x_RID_CREATEIBSS, reg);
-
- /* Set the PortType */
- port_type = HFA384x_PORTTYPE_IBSS;
- } else {
- port_type = HFA384x_PORTTYPE_BSS;
- }
-#else
port_type = HFA384x_PORTTYPE_BSS;
-#endif
/* Set the PortType */
hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, port_type);
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
msg->resultcode.data = P80211ENUM_resultcode_success;
- DBFEXIT;
return result;
}
hfa384x_t *hw = wlandev->priv;
u16 word;
- DBFENTER;
-
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
switch (msg->enable.data)
{
/* Disable monitor mode */
result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_DISABLE);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to disable monitor mode, result=%d\n",
result);
goto failed;
/* Disable port 0 */
result = hfa384x_drvr_disable(hw, 0);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to disable port 0 after sniffing, result=%d\n",
result);
goto failed;
HFA384x_RID_CNFWEPFLAGS,
hw->presniff_wepflags);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to restore wepflags=0x%04x, result=%d\n",
hw->presniff_wepflags,
result);
result = hfa384x_drvr_setconfig16(hw,
HFA384x_RID_CNFPORTTYPE, word);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to restore porttype, result=%d\n",
result);
goto failed;
/* Enable the port */
result = hfa384x_drvr_enable(hw, 0);
if ( result ) {
- WLAN_LOG_DEBUG(1, "failed to enable port to presniff setting, result=%d\n", result);
+ pr_debug("failed to enable port to presniff setting, result=%d\n", result);
goto failed;
}
} else {
}
- WLAN_LOG_INFO("monitor mode disabled\n");
+ printk(KERN_INFO "monitor mode disabled\n");
msg->resultcode.data = P80211ENUM_resultcode_success;
result = 0;
goto exit;
HFA384x_RID_CNFPORTTYPE,
&(hw->presniff_port_type));
if ( result ) {
- WLAN_LOG_DEBUG(1,"failed to read porttype, result=%d\n", result);
+ pr_debug("failed to read porttype, result=%d\n", result);
goto failed;
}
/* Save the wepflags state */
HFA384x_RID_CNFWEPFLAGS,
&(hw->presniff_wepflags));
if ( result ) {
- WLAN_LOG_DEBUG(1,"failed to read wepflags, result=%d\n", result);
+ pr_debug("failed to read wepflags, result=%d\n", result);
goto failed;
}
hfa384x_drvr_stop(hw);
result = hfa384x_drvr_start(hw);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to restart the card for sniffing, result=%d\n",
result);
goto failed;
/* Disable the port */
result = hfa384x_drvr_disable(hw, 0);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to enable port for sniffing, result=%d\n",
result);
goto failed;
hw->sniff_channel=word;
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to set channel %d, result=%d\n",
word,
result);
result = hfa384x_drvr_setconfig16(hw,
HFA384x_RID_CNFPORTTYPE, word);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to set porttype %d, result=%d\n",
word,
result);
}
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to set wepflags=0x%04x, result=%d\n",
word,
result);
/* Enable the port */
result = hfa384x_drvr_enable(hw, 0);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to enable port for sniffing, result=%d\n",
result);
goto failed;
/* Enable monitor mode */
result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_ENABLE);
if ( result ) {
- WLAN_LOG_DEBUG(1,
+ pr_debug(
"failed to enable monitor mode, result=%d\n",
result);
goto failed;
}
if (wlandev->netdev->type == ARPHRD_ETHER) {
- WLAN_LOG_INFO("monitor mode enabled\n");
+ printk(KERN_INFO "monitor mode enabled\n");
}
/* Set the driver state */
msg->resultcode.data = P80211ENUM_resultcode_refused;
result = 0;
exit:
-
- DBFEXIT;
return result;
}