diff options
Diffstat (limited to 'drivers/staging/wlan-ng/prism2mgmt.c')
-rw-r--r-- | drivers/staging/wlan-ng/prism2mgmt.c | 1673 |
1 files changed, 40 insertions, 1633 deletions
diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c index c975025b6ae..f1727ba6ec6 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.c +++ b/drivers/staging/wlan-ng/prism2mgmt.c @@ -61,10 +61,6 @@ /* System Includes */ #define WLAN_DBVAR prism2_debug -#include "version.h" - - -#include <linux/version.h> #include <linux/if_arp.h> #include <linux/module.h> @@ -79,19 +75,7 @@ #include <asm/io.h> #include <asm/byteorder.h> #include <linux/random.h> - -#if (WLAN_HOSTIF == WLAN_USB) #include <linux/usb.h> -#endif - -#if (WLAN_HOSTIF == WLAN_PCMCIA) -#include <pcmcia/version.h> -#include <pcmcia/cs_types.h> -#include <pcmcia/cs.h> -#include <pcmcia/cistpl.h> -#include <pcmcia/ds.h> -#include <pcmcia/cisreg.h> -#endif #include "wlan_compat.h" @@ -109,89 +93,12 @@ #include "hfa384x.h" #include "prism2mgmt.h" -/*================================================================*/ -/* Local Constants */ - - -/*================================================================*/ -/* Local Macros */ - /* 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) -/*================================================================*/ -/* Local Types */ - - -/*================================================================*/ -/* Local Static Definitions */ - - -/*================================================================*/ -/* Local Function Declarations */ - - -/*================================================================*/ -/* Function Definitions */ - - -/*---------------------------------------------------------------- -* prism2mgmt_powermgmt -* -* Set the power management state of this station's MAC. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_powermgmt(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_dot11req_powermgmt_t *msg = msgp; - - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* - * Set CNFPMENABLED (on or off) - * Set CNFMULTICASTRX (if PM on, otherwise clear) - * Spout a notice stating that SleepDuration and - * HoldoverDuration and PMEPS also have an impact. - */ - /* Powermgmt is currently unsupported for STA */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } else { - - /*** ACCESS POINT ***/ - - /* Powermgmt is never supported for AP */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } - - DBFEXIT; - return result; -} - - /*---------------------------------------------------------------- * prism2mgmt_scan * @@ -221,7 +128,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) int result = 0; hfa384x_t *hw = wlandev->priv; p80211msg_dot11req_scan_t *msg = msgp; - UINT16 roamingmode, word; + u16 roamingmode, word; int i, timeout; int istmpenable = 0; @@ -229,13 +136,6 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) DBFENTER; - if (hw->ap) { - WLAN_LOG_ERROR("Prism2 in AP mode cannot perform scans.\n"); - result = 1; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - goto exit; - } - /* gatekeeper check */ if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, hw->ident_sta_fw.minor, @@ -296,7 +196,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) /* set up the channel list */ word = 0; for (i = 0; i < msg->channellist.data.len; i++) { - UINT8 channel = msg->channellist.data.data[i]; + u8 channel = msg->channellist.data.data[i]; if (channel > 14) continue; /* channel 1 is BIT0 ... channel 14 is BIT13 */ word |= (1 << (channel-1)); @@ -317,7 +217,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) goto exit; } if (word == HFA384x_PORTSTATUS_DISABLED) { - UINT16 wordbuf[17]; + u16 wordbuf[17]; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFROAMINGMODE, @@ -480,12 +380,6 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) req->resultcode.status = P80211ENUM_msgitem_status_data_ok; - if (hw->ap) { - result = 1; - req->resultcode.data = P80211ENUM_resultcode_not_supported; - goto exit; - } - if (! hw->scanresults) { WLAN_LOG_ERROR("dot11req_scan_results can only be used after a successful dot11req_scan.\n"); result = 2; @@ -612,567 +506,6 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) return result; } - -/*---------------------------------------------------------------- -* prism2mgmt_join -* -* Join a BSS whose BSS description was previously obtained with -* a scan. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_join(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_dot11req_join_t *msg = msgp; - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* TODO: Implement after scan */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } else { - - /*** ACCESS POINT ***/ - - /* Never supported by APs */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } - - DBFEXIT; - return result; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_p2_join -* -* Join a specific BSS -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_p2_join(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_join_t *msg = msgp; - UINT16 reg; - p80211pstrd_t *pstr; - UINT8 bytebuf[256]; - hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf; - hfa384x_JoinRequest_data_t joinreq; - DBFENTER; - - if (!hw->ap) { - - wlandev->macmode = WLAN_MACMODE_NONE; - - /*** STATION ***/ - /* Set the PortType */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_success; - - /* ess port */ - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, 1); - if ( result ) { - WLAN_LOG_ERROR("Failed to set Port Type\n"); - goto failed; - } - - /* Set the auth type */ - if ( msg->authtype.data == P80211ENUM_authalg_sharedkey ) { - reg = HFA384x_CNFAUTHENTICATION_SHAREDKEY; - } else { - reg = HFA384x_CNFAUTHENTICATION_OPENSYSTEM; - } - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAUTHENTICATION, reg); - if ( result ) { - WLAN_LOG_ERROR("Failed to set Authentication\n"); - goto failed; - } - - /* Turn off all roaming */ - hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFROAMINGMODE, 3); - if ( result ) { - WLAN_LOG_ERROR("Failed to Turn off Roaming\n"); - goto failed; - } - - /* Basic rates */ - reg = 0; - if ( msg->basicrate1.status == P80211ENUM_msgitem_status_data_ok ) { - reg = p80211rate_to_p2bit(msg->basicrate1.data); - } - if ( msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->basicrate2.data); - } - if ( msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->basicrate3.data); - } - if ( msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->basicrate4.data); - } - if ( msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->basicrate5.data); - } - if ( msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->basicrate6.data); - } - if ( msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->basicrate7.data); - } - if ( msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->basicrate8.data); - } - if( reg == 0) - reg = 0x03; - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, reg); - if ( result ) { - WLAN_LOG_ERROR("Failed to set basicrates=%d.\n", reg); - goto failed; - } - - /* Operational rates (supprates and txratecontrol) */ - reg = 0; - if ( msg->operationalrate1.status == P80211ENUM_msgitem_status_data_ok ) { - reg = p80211rate_to_p2bit(msg->operationalrate1.data); - } - if ( msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->operationalrate2.data); - } - if ( msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->operationalrate3.data); - } - if ( msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->operationalrate4.data); - } - if ( msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->operationalrate5.data); - } - if ( msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->operationalrate6.data); - } - if ( msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->operationalrate7.data); - } - if ( msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok ) { - reg |= p80211rate_to_p2bit(msg->operationalrate8.data); - } - if( reg == 0) - reg = 0x0f; - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, reg); - if ( result ) { - WLAN_LOG_ERROR("Failed to set supprates=%d.\n", reg); - goto failed; - } - - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, reg); - if ( result ) { - WLAN_LOG_ERROR("Failed to set txrates=%d.\n", reg); - goto failed; - } - - /* Set the ssid */ - memset(bytebuf, 0, 256); - pstr = (p80211pstrd_t*)&(msg->ssid.data); - prism2mgmt_pstr2bytestr(p2bytestr, pstr); - result = hfa384x_drvr_setconfig( - hw, HFA384x_RID_CNFDESIREDSSID, - bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); - if ( result ) { - WLAN_LOG_ERROR("Failed to set SSID\n"); - goto failed; - } - - /* Enable the Port */ - result = hfa384x_cmd_enable(hw, 0); - if ( result ) { - WLAN_LOG_ERROR("Enable macport failed, result=%d.\n", result); - goto failed; - } - - /* Fill in the join request */ - joinreq.channel = msg->channel.data; - memcpy( joinreq.bssid, ((unsigned char *) &msg->bssid.data) + 1, WLAN_BSSID_LEN); - hw->joinreq = joinreq; - hw->join_ap = 1; - - /* Send the join request */ - result = hfa384x_drvr_setconfig( hw, - HFA384x_RID_JOINREQUEST, - &joinreq, HFA384x_RID_JOINREQUEST_LEN); - if(result != 0) { - WLAN_LOG_ERROR("Join request failed, result=%d.\n", result); - goto failed; - } - - } else { - - /*** ACCESS POINT ***/ - - /* Never supported by APs */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } - - goto done; -failed: - WLAN_LOG_DEBUG(1, "Failed to set a config option, result=%d\n", result); - msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; - -done: - result = 0; - - DBFEXIT; - return result; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_authenticate -* -* Station should be begin an authentication exchange. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_authenticate(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_dot11req_authenticate_t *msg = msgp; - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* TODO: Decide how we're going to handle this one w/ Prism2 */ - /* It could be entertaining since Prism2 doesn't have */ - /* an explicit way to control this */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } else { - - /*** ACCESS POINT ***/ - - /* Never supported by APs */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } - - DBFEXIT; - return result; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_deauthenticate -* -* Send a deauthenticate notification. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_deauthenticate(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_dot11req_deauthenticate_t *msg = msgp; - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* TODO: Decide how we're going to handle this one w/ Prism2 */ - /* It could be entertaining since Prism2 doesn't have */ - /* an explicit way to control this */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } else { - - /*** ACCESS POINT ***/ - hfa384x_drvr_handover(hw, msg->peerstaaddress.data.data); - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_success; - } - - DBFEXIT; - return result; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_associate -* -* Associate with an ESS. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_associate(wlandevice_t *wlandev, void *msgp) -{ - hfa384x_t *hw = wlandev->priv; - int result = 0; - p80211msg_dot11req_associate_t *msg = msgp; - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - -#if 0 - /* Set the TxRates */ - reg = 0x000f; - hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, reg); -#endif - - /* Set the PortType */ - /* ess port */ - hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, 1); - - /* Enable the Port */ - hfa384x_drvr_enable(hw, 0); - - /* Set the resultcode */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_success; - - } else { - - /*** ACCESS POINT ***/ - - /* Never supported on AP */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } - - DBFEXIT; - return result; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_reassociate -* -* Renew association because of a BSS change. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_reassociate(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_dot11req_reassociate_t *msg = msgp; - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* TODO: Not supported yet...not sure how we're going to do it */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } else { - - /*** ACCESS POINT ***/ - - /* Never supported on AP */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } - - DBFEXIT; - return result; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_disassociate -* -* Send a disassociation notification. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_disassociate(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_dot11req_disassociate_t *msg = msgp; - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* TODO: Not supported yet...not sure how to do it */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - } else { - - /*** ACCESS POINT ***/ - hfa384x_drvr_handover(hw, msg->peerstaaddress.data.data); - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_success; - } - - DBFEXIT; - return result; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_reset -* -* Reset the MAC and MSD. The p80211 layer has it's own handling -* that should be done before and after this function. -* Procedure: -* - disable system interrupts ?? -* - disable MAC interrupts -* - restore system interrupts -* - issue the MAC initialize command -* - clear any MSD level state (including timers, queued events, -* etc.). Note that if we're removing timer'd/queue events, we may -* need to have remained in the system interrupt disabled state. -* We should be left in the same state that we're in following -* driver initialization. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer, MAY BE NULL! for a driver local -* call. -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread, commonly wlanctl, but might be rmmod/pci_close. -----------------------------------------------------------------*/ -int prism2mgmt_reset(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_dot11req_reset_t *msg = msgp; - DBFENTER; - - /* - * This is supported on both AP and STA and it's not allowed - * to fail. - */ - if ( msgp ) { - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_success; - WLAN_LOG_INFO("dot11req_reset: the macaddress and " - "setdefaultmib arguments are currently unsupported.\n"); - } - - /* - * If we got this far, the MSD must be in the MSDRUNNING state - * therefore, we must stop and then restart the hw/MAC combo. - */ - hfa384x_drvr_stop(hw); - result = hfa384x_drvr_start(hw); - if (result != 0) { - WLAN_LOG_ERROR("dot11req_reset: Initialize command failed," - " bad things will happen from here.\n"); - return 0; - } - - DBFEXIT; - return 0; -} - - /*---------------------------------------------------------------- * prism2mgmt_start * @@ -1199,10 +532,9 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) p80211msg_dot11req_start_t *msg = msgp; p80211pstrd_t *pstr; - UINT8 bytebuf[80]; + u8 bytebuf[80]; hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf; - hfa384x_PCFInfo_data_t *pcfinfo = (hfa384x_PCFInfo_data_t*)bytebuf; - UINT16 word; + u16 word; DBFENTER; wlandev->macmode = WLAN_MACMODE_NONE; @@ -1210,170 +542,45 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) /* Set the SSID */ memcpy(&wlandev->ssid, &msg->ssid.data, sizeof(msg->ssid.data)); - if (!hw->ap) { - /*** ADHOC IBSS ***/ - /* see if current f/w is less than 8c3 */ - if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, - hw->ident_sta_fw.minor, - hw->ident_sta_fw.variant) < - HFA384x_FIRMWARE_VERSION(0,8,3)) { - /* Ad-Hoc not quite supported on Prism2 */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - goto done; - } - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - - /*** STATION ***/ - /* Set the REQUIRED config items */ - /* SSID */ - pstr = (p80211pstrd_t*)&(msg->ssid.data); - prism2mgmt_pstr2bytestr(p2bytestr, pstr); - result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID, - bytebuf, HFA384x_RID_CNFOWNSSID_LEN); - if ( result ) { - WLAN_LOG_ERROR("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"); - goto failed; - } - - /* bsstype - we use the default in the ap firmware */ - /* IBSS port */ - hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, 0); - - /* beacon period */ - 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); - goto failed; - } - - /* dschannel */ - 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); - goto failed; - } - /* Basic rates */ - word = p80211rate_to_p2bit(msg->basicrate1.data); - if ( msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->basicrate2.data); - } - if ( msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->basicrate3.data); - } - if ( msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->basicrate4.data); - } - if ( msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->basicrate5.data); - } - if ( msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->basicrate6.data); - } - if ( msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->basicrate7.data); - } - if ( msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->basicrate8.data); - } - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, word); - if ( result ) { - WLAN_LOG_ERROR("Failed to set basicrates=%d.\n", word); - goto failed; - } - - /* Operational rates (supprates and txratecontrol) */ - word = p80211rate_to_p2bit(msg->operationalrate1.data); - if ( msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->operationalrate2.data); - } - if ( msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->operationalrate3.data); - } - if ( msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->operationalrate4.data); - } - if ( msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->operationalrate5.data); - } - if ( msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->operationalrate6.data); - } - if ( msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->operationalrate7.data); - } - if ( msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok ) { - word |= p80211rate_to_p2bit(msg->operationalrate8.data); - } - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, word); - if ( result ) { - WLAN_LOG_ERROR("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); - goto failed; - } - - /* Set the macmode so the frame setup code knows what to do */ - if ( msg->bsstype.data == P80211ENUM_bsstype_independent ) { - wlandev->macmode = WLAN_MACMODE_IBSS_STA; - /* lets extend the data length a bit */ - hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, 2304); - } - - /* Enable the Port */ - result = hfa384x_drvr_enable(hw, 0); - if ( result ) { - WLAN_LOG_ERROR("Enable macport failed, result=%d.\n", result); - goto failed; - } - - msg->resultcode.data = P80211ENUM_resultcode_success; - + /*** ADHOC IBSS ***/ + /* see if current f/w is less than 8c3 */ + if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, + hw->ident_sta_fw.minor, + hw->ident_sta_fw.variant) < + HFA384x_FIRMWARE_VERSION(0,8,3)) { + /* Ad-Hoc not quite supported on Prism2 */ + msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; + msg->resultcode.data = P80211ENUM_resultcode_not_supported; goto done; } - /*** ACCESS POINT ***/ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - /* Validate the command, if BSStype=infra is the tertiary loaded? */ - if ( msg->bsstype.data == P80211ENUM_bsstype_independent ) { - WLAN_LOG_ERROR("AP driver cannot create IBSS.\n"); - goto failed; - } else if ( hw->cap_sup_sta.id != 5) { - WLAN_LOG_ERROR("AP driver failed to detect AP firmware.\n"); - goto failed; - } - + /*** STATION ***/ /* Set the REQUIRED config items */ /* SSID */ pstr = (p80211pstrd_t*)&(msg->ssid.data); prism2mgmt_pstr2bytestr(p2bytestr, pstr); result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID, - bytebuf, HFA384x_RID_CNFOWNSSID_LEN); + bytebuf, HFA384x_RID_CNFOWNSSID_LEN); + if ( result ) { + WLAN_LOG_ERROR("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 SSID, result=0x%04x\n", result); + WLAN_LOG_ERROR("Failed to set CnfDesiredSSID\n"); goto failed; } /* bsstype - we use the default in the ap firmware */ + /* IBSS port */ + hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, 0); /* beacon period */ word = msg->beaconperiod.data; - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAPBCNINT, word); + result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAPBCNint, word); if ( result ) { WLAN_LOG_ERROR("Failed to set beacon period=%d.\n", word); goto failed; @@ -1443,98 +650,20 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) WLAN_LOG_ERROR("Failed to set supprates=%d.\n", word); goto failed; } - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL0, word); - if ( result ) { - WLAN_LOG_ERROR("Failed to set txrates=%d.\n", word); - goto failed; - } - - /* ibssatimwindow */ - if (msg->ibssatimwindow.status == P80211ENUM_msgitem_status_data_ok) { - WLAN_LOG_INFO("prism2mgmt_start: atimwindow not used in " - "Infrastructure mode, ignored.\n"); - } - - /* DTIM period */ - word = msg->dtimperiod.data; - result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNDTIMPER, word); - if ( result ) { - WLAN_LOG_ERROR("Failed to set dtim period=%d.\n", word); - goto failed; - } - - /* probedelay */ - if (msg->probedelay.status == P80211ENUM_msgitem_status_data_ok) { - WLAN_LOG_INFO("prism2mgmt_start: probedelay not " - "supported in prism2, ignored.\n"); - } - - /* cfpollable, cfpollreq, cfpperiod, cfpmaxduration */ - if (msg->cfpollable.data == P80211ENUM_truth_true && - msg->cfpollreq.data == P80211ENUM_truth_true ) { - WLAN_LOG_ERROR("cfpollable=cfpollreq=true is illegal.\n"); - result = -1; - goto failed; - } - - /* read the PCFInfo and update */ - result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFAPPCFINFO, - pcfinfo, HFA384x_RID_CNFAPPCFINFO_LEN); - if ( result ) { - WLAN_LOG_INFO("prism2mgmt_start: read(pcfinfo) failed, " - "assume it's " - "not supported, pcf settings ignored.\n"); - goto pcf_skip; - } - if ((msg->cfpollable.data == P80211ENUM_truth_false && - msg->cfpollreq.data == P80211ENUM_truth_false) ) { - pcfinfo->MediumOccupancyLimit = 0; - pcfinfo->CFPPeriod = 0; - pcfinfo->CFPMaxDuration = 0; - pcfinfo->CFPFlags &= host2hfa384x_16((UINT16)~BIT0); - - if ( msg->cfpperiod.status == P80211ENUM_msgitem_status_data_ok || - msg->cfpmaxduration.status == P80211ENUM_msgitem_status_data_ok ) { - WLAN_LOG_WARNING( - "Setting cfpperiod or cfpmaxduration when " - "cfpollable and cfreq are false is pointless.\n"); - } - } - if ((msg->cfpollable.data == P80211ENUM_truth_true || - msg->cfpollreq.data == P80211ENUM_truth_true) ) { - if ( msg->cfpollable.data == P80211ENUM_truth_true) { - pcfinfo->CFPFlags |= host2hfa384x_16((UINT16)BIT0); - } - - if ( msg->cfpperiod.status == P80211ENUM_msgitem_status_data_ok) { - pcfinfo->CFPPeriod = msg->cfpperiod.data; - pcfinfo->CFPPeriod = host2hfa384x_16(pcfinfo->CFPPeriod); - } - if ( msg->cfpmaxduration.status == P80211ENUM_msgitem_status_data_ok) { - pcfinfo->CFPMaxDuration = msg->cfpmaxduration.data; - pcfinfo->CFPMaxDuration = host2hfa384x_16(pcfinfo->CFPMaxDuration); - pcfinfo->MediumOccupancyLimit = pcfinfo->CFPMaxDuration; - } - } - result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFAPPCFINFO, - pcfinfo, HFA384x_RID_CNFAPPCFINFO_LEN); + result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, word); if ( result ) { - WLAN_LOG_ERROR("write(pcfinfo) failed.\n"); + WLAN_LOG_ERROR("Failed to set txrates=%d.\n", word); goto failed; } -pcf_skip: /* Set the macmode so the frame setup code knows what to do */ - if ( msg->bsstype.data == P80211ENUM_bsstype_infrastructure ) { - wlandev->macmode = WLAN_MACMODE_ESS_AP; + if ( msg->bsstype.data == P80211ENUM_bsstype_independent ) { + wlandev->macmode = WLAN_MACMODE_IBSS_STA; /* lets extend the data length a bit */ hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, 2304); } - /* Set the BSSID to the same as our MAC */ - memcpy( wlandev->bssid, wlandev->netdev->dev_addr, WLAN_BSSID_LEN); - /* Enable the Port */ result = hfa384x_drvr_enable(hw, 0); if ( result ) { @@ -1556,80 +685,6 @@ done: return result; } - -/*---------------------------------------------------------------- -* prism2mgmt_enable -* -* Start a BSS. Any station can do this for IBSS, only AP for ESS. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -* interrupt -----------------------------------------------------------------*/ -int prism2mgmt_enable(wlandevice_t *wlandev, void *msgp) -{ - int result = 0; - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_enable_t *msg = msgp; - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* Ad-Hoc not quite supported on Prism2 */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - goto done; - } - - /*** ACCESS POINT ***/ - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - - /* Is the tertiary loaded? */ - if ( hw->cap_sup_sta.id != 5) { - WLAN_LOG_ERROR("AP driver failed to detect AP firmware.\n"); - goto failed; - } - - /* Set the macmode so the frame setup code knows what to do */ - wlandev->macmode = WLAN_MACMODE_ESS_AP; - - /* Set the BSSID to the same as our MAC */ - memcpy( wlandev->bssid, wlandev->netdev->dev_addr, WLAN_BSSID_LEN); - - /* Enable the Port */ - result = hfa384x_drvr_enable(hw, 0); - if ( result ) { - WLAN_LOG_ERROR("Enable macport failed, result=%d.\n", result); - goto failed; - } - - msg->resultcode.data = P80211ENUM_resultcode_success; - - goto done; -failed: - msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; - -done: - result = 0; - - DBFEXIT; - return result; -} - - /*---------------------------------------------------------------- * prism2mgmt_readpda * @@ -1696,402 +751,6 @@ int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) } /*---------------------------------------------------------------- -* prism2mgmt_readcis -* -* Collect the CIS data and put it in the message. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_readcis(wlandevice_t *wlandev, void *msgp) -{ - int result; - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_readcis_t *msg = msgp; - - DBFENTER; - - memset(msg->cis.data, 0, sizeof(msg->cis.data)); - - result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CIS, - msg->cis.data, HFA384x_RID_CIS_LEN); - if ( result ) { - WLAN_LOG_INFO("prism2mgmt_readcis: read(cis) failed.\n"); - msg->cis.status = P80211ENUM_msgitem_status_no_value; - msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; - - } - else { - msg->cis.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_success; - } - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - - DBFEXIT; - return 0; -} - -/*---------------------------------------------------------------- -* prism2mgmt_auxport_state -* -* Enables/Disables the card's auxiliary port. Should be called -* before and after a sequence of auxport_read()/auxport_write() -* calls. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_auxport_state(wlandevice_t *wlandev, void *msgp) -{ - p80211msg_p2req_auxport_state_t *msg = msgp; - -#if (WLAN_HOSTIF != WLAN_USB) - hfa384x_t *hw = wlandev->priv; - DBFENTER; - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - if (msg->enable.data == P80211ENUM_truth_true) { - if ( hfa384x_cmd_aux_enable(hw, 0) ) { - msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; - } else { - msg->resultcode.data = P80211ENUM_resultcode_success; - } - } else { - hfa384x_cmd_aux_disable(hw); - msg->resultcode.data = P80211ENUM_resultcode_success; - } - -#else /* !USB */ - DBFENTER; - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - -#endif /* WLAN_HOSTIF != WLAN_USB */ - - DBFEXIT; - return 0; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_auxport_read -* -* Copies data from the card using the auxport. The auxport must -* have previously been enabled. Note: this is not the way to -* do downloads, see the [ram|flash]dl functions. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_auxport_read(wlandevice_t *wlandev, void *msgp) -{ -#if (WLAN_HOSTIF != WLAN_USB) - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_auxport_read_t *msg = msgp; - UINT32 addr; - UINT32 len; - UINT8* buf; - UINT32 maxlen = sizeof(msg->data.data); - DBFENTER; - - if ( hw->auxen ) { - addr = msg->addr.data; - len = msg->len.data; - buf = msg->data.data; - if ( len <= maxlen ) { /* max read/write size */ - hfa384x_copy_from_aux(hw, addr, HFA384x_AUX_CTL_EXTDS, buf, len); - msg->resultcode.data = P80211ENUM_resultcode_success; - } else { - WLAN_LOG_DEBUG(1,"Attempt to read > maxlen from auxport.\n"); - msg->resultcode.data = P80211ENUM_resultcode_refused; - } - - } else { - msg->resultcode.data = P80211ENUM_resultcode_refused; - } - msg->data.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - - DBFEXIT; - return 0; -#else - DBFENTER; - - WLAN_LOG_ERROR("prism2mgmt_auxport_read: Not supported on USB.\n"); - - DBFEXIT; - return 0; -#endif -} - - -/*---------------------------------------------------------------- -* prism2mgmt_auxport_write -* -* Copies data to the card using the auxport. The auxport must -* have previously been enabled. Note: this is not the way to -* do downloads, see the [ram|flash]dl functions. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_auxport_write(wlandevice_t *wlandev, void *msgp) -{ -#if (WLAN_HOSTIF != WLAN_USB) - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_auxport_write_t *msg = msgp; - UINT32 addr; - UINT32 len; - UINT8* buf; - UINT32 maxlen = sizeof(msg->data.data); - DBFENTER; - - if ( hw->auxen ) { - addr = msg->addr.data; - len = msg->len.data; - buf = msg->data.data; - if ( len <= maxlen ) { /* max read/write size */ - hfa384x_copy_to_aux(hw, addr, HFA384x_AUX_CTL_EXTDS, buf, len); - } else { - WLAN_LOG_DEBUG(1,"Attempt to write > maxlen from auxport.\n"); - msg->resultcode.data = P80211ENUM_resultcode_refused; - } - - } else { - msg->resultcode.data = P80211ENUM_resultcode_refused; - } - msg->data.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - - DBFEXIT; - return 0; -#else - DBFENTER; - WLAN_LOG_ERROR("prism2mgmt_auxport_read: Not supported on USB.\n"); - DBFEXIT; - return 0; -#endif -} - -/*---------------------------------------------------------------- -* prism2mgmt_low_level -* -* Puts the card into the desired test mode. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_low_level(wlandevice_t *wlandev, void *msgp) -{ - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_low_level_t *msg = msgp; - hfa384x_metacmd_t cmd; - DBFENTER; - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - - /* call some routine to execute the test command */ - cmd.cmd = (UINT16) msg->command.data; - cmd.parm0 = (UINT16) msg->param0.data; - cmd.parm1 = (UINT16) msg->param1.data; - cmd.parm2 = (UINT16) msg->param2.data; - - hfa384x_drvr_low_level(hw,&cmd); - - msg->resp0.data = (UINT32) cmd.result.resp0; - msg->resp1.data = (UINT32) cmd.result.resp1; - msg->resp2.data = (UINT32) cmd.result.resp2; - - msg->resultcode.data = P80211ENUM_resultcode_success; - - DBFEXIT; - return 0; -} - -/*---------------------------------------------------------------- -* prism2mgmt_test_command -* -* Puts the card into the desired test mode. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_test_command(wlandevice_t *wlandev, void *msgp) -{ - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_test_command_t *msg = msgp; - hfa384x_metacmd_t cmd; - - DBFENTER; - - cmd.cmd = ((UINT16) msg->testcode.data) << 8 | 0x38; - cmd.parm0 = (UINT16) msg->testparam.data; - cmd.parm1 = 0; - cmd.parm2 = 0; - - /* call some routine to execute the test command */ - - hfa384x_drvr_low_level(hw,&cmd); - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_success; - - msg->status.status = P80211ENUM_msgitem_status_data_ok; - msg->status.data = cmd.result.status; - msg->resp0.status = P80211ENUM_msgitem_status_data_ok; - msg->resp0.data = cmd.result.resp0; - msg->resp1.status = P80211ENUM_msgitem_status_data_ok; - msg->resp1.data = cmd.result.resp1; - msg->resp2.status = P80211ENUM_msgitem_status_data_ok; - msg->resp2.data = cmd.result.resp2; - - DBFEXIT; - return 0; -} - - -/*---------------------------------------------------------------- -* prism2mgmt_mmi_read -* -* Read from one of the MMI registers. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_mmi_read(wlandevice_t *wlandev, void *msgp) -{ - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_mmi_read_t *msg = msgp; - UINT32 resp = 0; - - DBFENTER; - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - - /* call some routine to execute the test command */ - - hfa384x_drvr_mmi_read(hw, msg->addr.data, &resp); - - /* I'm not sure if this is "architecturally" correct, but it - is expedient. */ - - msg->value.status = P80211ENUM_msgitem_status_data_ok; - msg->value.data = resp; - msg->resultcode.data = P80211ENUM_resultcode_success; - - DBFEXIT; - return 0; -} - -/*---------------------------------------------------------------- -* prism2mgmt_mmi_write -* -* Write a data value to one of the MMI registers. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_mmi_write(wlandevice_t *wlandev, void *msgp) -{ - hfa384x_t *hw = wlandev->priv; - p80211msg_p2req_mmi_write_t *msg = msgp; - DBFENTER; - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - - /* call some routine to execute the test command */ - - hfa384x_drvr_mmi_write(hw, msg->addr.data, msg->data.data); - - msg->resultcode.data = P80211ENUM_resultcode_success; - - DBFEXIT; - return 0; -} - -/*---------------------------------------------------------------- * prism2mgmt_ramdl_state * * Establishes the beginning/end of a card RAM download session. @@ -2179,9 +838,9 @@ int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp) { hfa384x_t *hw = wlandev->priv; p80211msg_p2req_ramdl_write_t *msg = msgp; - UINT32 addr; - UINT32 len; - UINT8 *buf; + u32 addr; + u32 len; + u8 *buf; DBFENTER; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { @@ -2319,9 +978,9 @@ int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp) { hfa384x_t *hw = wlandev->priv; p80211msg_p2req_flashdl_write_t *msg = msgp; - UINT32 addr; - UINT32 len; - UINT8 *buf; + u32 addr; + u32 len; + u8 *buf; DBFENTER; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { @@ -2361,247 +1020,6 @@ int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp) return 0; } - -/*---------------------------------------------------------------- -* prism2mgmt_dump_state -* -* Dumps the driver's and hardware's current state via the kernel -* log at KERN_NOTICE level. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_dump_state(wlandevice_t *wlandev, void *msgp) -{ - p80211msg_p2req_dump_state_t *msg = msgp; - int result = 0; - -#if (WLAN_HOSTIF != WLAN_USB) - hfa384x_t *hw = wlandev->priv; - UINT16 auxbuf[15]; - DBFENTER; - - WLAN_LOG_NOTICE("prism2 driver and hardware state:\n"); - if ( (result = hfa384x_cmd_aux_enable(hw, 0)) ) { - WLAN_LOG_ERROR("aux_enable failed, result=%d\n", result); - goto failed; - } - hfa384x_copy_from_aux(hw, - 0x01e2, - HFA384x_AUX_CTL_EXTDS, - auxbuf, - sizeof(auxbuf)); - hfa384x_cmd_aux_disable(hw); - WLAN_LOG_NOTICE(" cmac: FreeBlocks=%d\n", auxbuf[5]); - WLAN_LOG_NOTICE(" cmac: IntEn=0x%02x EvStat=0x%02x\n", - hfa384x_getreg(hw, HFA384x_INTEN), - hfa384x_getreg(hw, HFA384x_EVSTAT)); - - #ifdef USE_FID_STACK - WLAN_LOG_NOTICE(" drvr: txfid_top=%d stacksize=%d\n", - hw->txfid_top,HFA384x_DRVR_FIDSTACKLEN_MAX); - #else - WLAN_LOG_NOTICE(" drvr: txfid_head=%d txfid_tail=%d txfid_N=%d\n", - hw->txfid_head, hw->txfid_tail, hw->txfid_N); - #endif - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_success; - -#else /* (WLAN_HOSTIF == WLAN_USB) */ - - DBFENTER; - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - goto failed; - -#endif /* (WLAN_HOSTIF != WLAN_USB) */ - -failed: - DBFEXIT; - return result; -} - -/*---------------------------------------------------------------- -* prism2mgmt_channel_info -* -* Issues a ChannelInfoRequest. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_channel_info(wlandevice_t *wlandev, void *msgp) -{ - p80211msg_p2req_channel_info_t *msg=msgp; - hfa384x_t *hw = wlandev->priv; - int result, i, n=0; - UINT16 channel_mask=0; - hfa384x_ChannelInfoRequest_data_t chinforeq; - // unsigned long now; - - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* Not supported in STA f/w */ - P80211_SET_INT(msg->resultcode, P80211ENUM_resultcode_not_supported); - goto done; - } - - /*** ACCESS POINT ***/ - -#define CHINFO_TIMEOUT 2 - - P80211_SET_INT(msg->resultcode, P80211ENUM_resultcode_success); - - /* setting default value for channellist = all channels */ - if (!msg->channellist.data) { - P80211_SET_INT(msg->channellist, 0x00007FFE); - } - /* setting default value for channeldwelltime = 100 ms */ - if (!msg->channeldwelltime.data) { - P80211_SET_INT(msg->channeldwelltime, 100); - } - channel_mask = (UINT16) (msg->channellist.data >> 1); - for (i=0, n=0; i < 14; i++) { - if (channel_mask & (1<<i)) { - n++; - } - } - P80211_SET_INT(msg->numchinfo, n); - chinforeq.channelList = host2hfa384x_16(channel_mask); - chinforeq.channelDwellTime = host2hfa384x_16(msg->channeldwelltime.data); - - atomic_set(&hw->channel_info.done, 1); - - result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CHANNELINFOREQUEST, - &chinforeq, HFA384x_RID_CHANNELINFOREQUEST_LEN); - if ( result ) { - WLAN_LOG_ERROR("setconfig(CHANNELINFOREQUEST) failed. result=%d\n", - result); - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - goto done; - } - /* - now = jiffies; - while (atomic_read(&hw->channel_info.done) != 1) { - if ((jiffies - now) > CHINFO_TIMEOUT*HZ) { - WLAN_LOG_NOTICE("ChannelInfo results not received in %d seconds, aborting.\n", - CHINFO_TIMEOUT); - msg->resultcode.data = P80211ENUM_resultcode_timeout; - goto done; - } - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(HZ/4); - current->state = TASK_RUNNING; - } - */ - -done: - - DBFEXIT; - return 0; -} - -/*---------------------------------------------------------------- -* prism2mgmt_channel_info_results -* -* Returns required ChannelInfo result. -* -* Arguments: -* wlandev wlan device structure -* msgp ptr to msg buffer -* -* Returns: -* 0 success and done -* <0 success, but we're waiting for something to finish. -* >0 an error occurred while handling the message. -* Side effects: -* -* Call context: -* process thread (usually) -----------------------------------------------------------------*/ -int prism2mgmt_channel_info_results(wlandevice_t *wlandev, void *msgp) -{ - hfa384x_t *hw = wlandev->priv; - - p80211msg_p2req_channel_info_results_t *msg=msgp; - int result=0; - int channel; - - DBFENTER; - - if (!hw->ap) { - - /*** STATION ***/ - - /* Not supported in STA f/w */ - P80211_SET_INT(msg->resultcode, P80211ENUM_resultcode_not_supported); - goto done; - } - - /*** ACCESS POINT ***/ - - switch (atomic_read(&hw->channel_info.done)) { - case 0: msg->resultcode.status = P80211ENUM_msgitem_status_no_value; - goto done; - case 1: msg->resultcode.status = P80211ENUM_msgitem_status_incomplete_itemdata; - goto done; - } - - P80211_SET_INT(msg->resultcode, P80211ENUM_resultcode_success); - channel=msg->channel.data-1; - - if (channel < 0 || ! (hw->channel_info.results.scanchannels & 1<<channel) ) { - msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; - goto done; - } - WLAN_LOG_DEBUG(2, "chinfo_results: channel %d, avg/peak level=%d/%d dB, active=%d\n", - channel+1, - hw->channel_info.results.result[channel].anl, - hw->channel_info.results.result[channel].pnl, - hw->channel_info.results.result[channel].active - ); - P80211_SET_INT(msg->avgnoiselevel, hw->channel_info.results.result[channel].anl); - P80211_SET_INT(msg->peaknoiselevel, hw->channel_info.results.result[channel].pnl); - P80211_SET_INT(msg->bssactive, hw->channel_info.results.result[channel].active & - HFA384x_CHINFORESULT_BSSACTIVE - ? P80211ENUM_truth_true - : P80211ENUM_truth_false) ; - P80211_SET_INT(msg->pcfactive, hw->channel_info.results.result[channel].active & - HFA384x_CHINFORESULT_PCFACTIVE - ? P80211ENUM_truth_true - : P80211ENUM_truth_false) ; - -done: - DBFEXIT; - return result; -} - - /*---------------------------------------------------------------- * prism2mgmt_autojoin * @@ -2625,11 +1043,11 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) { hfa384x_t *hw = wlandev->priv; int result = 0; - UINT16 reg; - UINT16 port_type; + u16 reg; + u16 port_type; p80211msg_lnxreq_autojoin_t *msg = msgp; p80211pstrd_t *pstr; - UINT8 bytebuf[256]; + u8 bytebuf[256]; hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf; DBFENTER; @@ -2638,16 +1056,6 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) /* Set the SSID */ memcpy(&wlandev->ssid, &msg->ssid.data, sizeof(msg->ssid.data)); - if (hw->ap) { - - /*** ACCESS POINT ***/ - - /* Never supported on AP */ - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - goto done; - } - /* Disable the Port */ hfa384x_drvr_disable(hw, 0); @@ -2699,7 +1107,6 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; msg->resultcode.data = P80211ENUM_resultcode_success; -done: DBFEXIT; return result; } @@ -2730,7 +1137,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) p80211msg_lnxreq_wlansniff_t *msg = msgp; hfa384x_t *hw = wlandev->priv; - UINT16 word; + u16 word; DBFENTER; |