diff options
Diffstat (limited to 'drivers/staging/wlan-ng/prism2mgmt.c')
-rw-r--r-- | drivers/staging/wlan-ng/prism2mgmt.c | 647 |
1 files changed, 0 insertions, 647 deletions
diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c index df5dc204893..1195bcb7cad 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.c +++ b/drivers/staging/wlan-ng/prism2mgmt.c @@ -508,301 +508,6 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) } /*---------------------------------------------------------------- -* 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; - u16 reg; - p80211pstrd_t *pstr; - u8 bytebuf[256]; - hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf; - hfa384x_JoinRequest_data_t joinreq; - DBFENTER; - - wlandev->macmode = WLAN_MACMODE_NONE; - - /* 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; - } - - 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_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 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; - - 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 * * Start a BSS. Any station can do this for IBSS, only AP for ESS. @@ -1047,322 +752,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; - - DBFENTER; - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - - 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) -{ - DBFENTER; - - WLAN_LOG_ERROR("prism2mgmt_auxport_read: Not supported on USB.\n"); - - DBFEXIT; - return 0; -} - - -/*---------------------------------------------------------------- -* 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) -{ - DBFENTER; - WLAN_LOG_ERROR("prism2mgmt_auxport_read: Not supported on USB.\n"); - DBFEXIT; - return 0; -} - -/*---------------------------------------------------------------- -* 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 = (u16) msg->command.data; - cmd.parm0 = (u16) msg->param0.data; - cmd.parm1 = (u16) msg->param1.data; - cmd.parm2 = (u16) msg->param2.data; - - hfa384x_drvr_low_level(hw,&cmd); - - msg->resp0.data = (u32) cmd.result.resp0; - msg->resp1.data = (u32) cmd.result.resp1; - msg->resp2.data = (u32) 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 = ((u16) msg->testcode.data) << 8 | 0x38; - cmd.parm0 = (u16) 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; - u32 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. @@ -1632,42 +1021,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; - - DBFENTER; - - msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; - msg->resultcode.data = P80211ENUM_resultcode_not_supported; - goto failed; - -failed: - DBFEXIT; - return result; -} - /*---------------------------------------------------------------- * prism2mgmt_autojoin * |