📄 prism2sta.c
字号:
WLAN_LOG_DEBUG(2,"Received powermgmt request\n"); result = prism2mgmt_powermgmt(wlandev, msg); break; case DIDmsg_dot11req_scan : WLAN_LOG_DEBUG(2,"Received scan request\n"); result = prism2mgmt_scan(wlandev, msg); break; case DIDmsg_dot11req_scan_results : WLAN_LOG_DEBUG(2,"Received scan_results request\n"); result = prism2mgmt_scan_results(wlandev, msg); break; case DIDmsg_dot11req_join : WLAN_LOG_DEBUG(2,"Received join request\n"); result = prism2mgmt_join(wlandev, msg); break; case DIDmsg_dot11req_authenticate : WLAN_LOG_DEBUG(2,"Received authenticate request\n"); result = prism2mgmt_authenticate(wlandev, msg); break; case DIDmsg_dot11req_deauthenticate : WLAN_LOG_DEBUG(2,"Received mlme deauthenticate request\n"); result = prism2mgmt_deauthenticate(wlandev, msg); break; case DIDmsg_dot11req_associate : WLAN_LOG_DEBUG(2,"Received mlme associate request\n"); result = prism2mgmt_associate(wlandev, msg); break; case DIDmsg_dot11req_reassociate : WLAN_LOG_DEBUG(2,"Received mlme reassociate request\n"); result = prism2mgmt_reassociate(wlandev, msg); break; case DIDmsg_dot11req_disassociate : WLAN_LOG_DEBUG(2,"Received mlme disassociate request\n"); result = prism2mgmt_disassociate(wlandev, msg); break; case DIDmsg_dot11req_reset : WLAN_LOG_DEBUG(2,"Received mlme reset request\n"); result = prism2mgmt_reset(wlandev, msg); break; case DIDmsg_dot11req_start : WLAN_LOG_DEBUG(2,"Received mlme start request\n"); result = prism2mgmt_start(wlandev, msg); break; /* * Prism2 specific messages */ case DIDmsg_p2req_join : WLAN_LOG_DEBUG(2,"Received p2 join request\n"); result = prism2mgmt_p2_join(wlandev, msg); break; case DIDmsg_p2req_readpda : WLAN_LOG_DEBUG(2,"Received mlme readpda request\n"); result = prism2mgmt_readpda(wlandev, msg); break; case DIDmsg_p2req_readcis : WLAN_LOG_DEBUG(2,"Received mlme readcis request\n"); result = prism2mgmt_readcis(wlandev, msg); break; case DIDmsg_p2req_auxport_state : WLAN_LOG_DEBUG(2,"Received mlme auxport_state request\n"); result = prism2mgmt_auxport_state(wlandev, msg); break; case DIDmsg_p2req_auxport_read : WLAN_LOG_DEBUG(2,"Received mlme auxport_read request\n"); result = prism2mgmt_auxport_read(wlandev, msg); break; case DIDmsg_p2req_auxport_write : WLAN_LOG_DEBUG(2,"Received mlme auxport_write request\n"); result = prism2mgmt_auxport_write(wlandev, msg); break; case DIDmsg_p2req_low_level : WLAN_LOG_DEBUG(2,"Received mlme low_level request\n"); result = prism2mgmt_low_level(wlandev, msg); break; case DIDmsg_p2req_test_command : WLAN_LOG_DEBUG(2,"Received mlme test_command request\n"); result = prism2mgmt_test_command(wlandev, msg); break; case DIDmsg_p2req_mmi_read : WLAN_LOG_DEBUG(2,"Received mlme mmi_read request\n"); result = prism2mgmt_mmi_read(wlandev, msg); break; case DIDmsg_p2req_mmi_write : WLAN_LOG_DEBUG(2,"Received mlme mmi_write request\n"); result = prism2mgmt_mmi_write(wlandev, msg); break; case DIDmsg_p2req_ramdl_state : WLAN_LOG_DEBUG(2,"Received mlme ramdl_state request\n"); result = prism2mgmt_ramdl_state(wlandev, msg); break; case DIDmsg_p2req_ramdl_write : WLAN_LOG_DEBUG(2,"Received mlme ramdl_write request\n"); result = prism2mgmt_ramdl_write(wlandev, msg); break; case DIDmsg_p2req_flashdl_state : WLAN_LOG_DEBUG(2,"Received mlme flashdl_state request\n"); result = prism2mgmt_flashdl_state(wlandev, msg); break; case DIDmsg_p2req_flashdl_write : WLAN_LOG_DEBUG(2,"Received mlme flashdl_write request\n"); result = prism2mgmt_flashdl_write(wlandev, msg); break; case DIDmsg_p2req_dump_state : WLAN_LOG_DEBUG(2,"Received mlme dump_state request\n"); result = prism2mgmt_dump_state(wlandev, msg); break; case DIDmsg_p2req_channel_info : WLAN_LOG_DEBUG(2,"Received mlme channel_info request\n"); result = prism2mgmt_channel_info(wlandev, msg); break; case DIDmsg_p2req_channel_info_results : WLAN_LOG_DEBUG(2,"Received mlme channel_info_results request\n"); result = prism2mgmt_channel_info_results(wlandev, msg); break; /* * Linux specific messages */ case DIDmsg_lnxreq_hostwep : break; // ignore me. case DIDmsg_lnxreq_ifstate : { p80211msg_lnxreq_ifstate_t *ifstatemsg; WLAN_LOG_DEBUG(2,"Received mlme ifstate request\n"); ifstatemsg = (p80211msg_lnxreq_ifstate_t*)msg; result = prism2sta_ifstate(wlandev, ifstatemsg->ifstate.data); ifstatemsg->resultcode.status = P80211ENUM_msgitem_status_data_ok; ifstatemsg->resultcode.data = result; result = 0; } break; case DIDmsg_lnxreq_wlansniff : WLAN_LOG_DEBUG(2,"Received mlme wlansniff request\n"); result = prism2mgmt_wlansniff(wlandev, msg); break; case DIDmsg_lnxreq_autojoin : WLAN_LOG_DEBUG(2,"Received mlme autojoin request\n"); result = prism2mgmt_autojoin(wlandev, msg); break; case DIDmsg_p2req_enable : WLAN_LOG_DEBUG(2,"Received mlme enable request\n"); result = prism2mgmt_enable(wlandev, msg); break; case DIDmsg_lnxreq_commsquality: { p80211msg_lnxreq_commsquality_t *qualmsg; WLAN_LOG_DEBUG(2,"Received commsquality request\n"); if (hw->ap) break; qualmsg = (p80211msg_lnxreq_commsquality_t*) msg; qualmsg->link.status = P80211ENUM_msgitem_status_data_ok; qualmsg->level.status = P80211ENUM_msgitem_status_data_ok; qualmsg->noise.status = P80211ENUM_msgitem_status_data_ok; qualmsg->link.data = hfa384x2host_16(hw->qual.CQ_currBSS); qualmsg->level.data = hfa384x2host_16(hw->qual.ASL_currBSS); qualmsg->noise.data = hfa384x2host_16(hw->qual.ANL_currFC); break; } default: WLAN_LOG_WARNING("Unknown mgmt request message 0x%08x", msg->msgcode); break; } DBFEXIT; return result;}/*----------------------------------------------------------------* prism2sta_ifstate** Interface state. This is the primary WLAN interface enable/disable* handler. Following the driver/load/deviceprobe sequence, this* function must be called with a state of "enable" before any other* commands will be accepted.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns: * A p80211 message resultcode value.** Side effects:** Call context:* process thread (usually)* interrupt----------------------------------------------------------------*/UINT32 prism2sta_ifstate(wlandevice_t *wlandev, UINT32 ifstate){ hfa384x_t *hw = (hfa384x_t *)wlandev->priv; UINT32 result; DBFENTER; result = P80211ENUM_resultcode_implementation_failure; WLAN_LOG_DEBUG(2, "Current MSD state(%d), requesting(%d)\n", wlandev->msdstate, ifstate); switch (ifstate) { case P80211ENUM_ifstate_fwload: switch (wlandev->msdstate) { case WLAN_MSD_HWPRESENT: wlandev->msdstate = WLAN_MSD_FWLOAD_PENDING; /* * Initialize the device+driver sufficiently * for firmware loading. */#if (WLAN_HOSTIF != WLAN_USB) result=hfa384x_cmd_initialize(hw);#else if ((result=hfa384x_drvr_start(hw))) { WLAN_LOG_ERROR( "hfa384x_drvr_start() failed," "result=%d\n", (int)result); result = P80211ENUM_resultcode_implementation_failure; wlandev->msdstate = WLAN_MSD_HWPRESENT; break; }#endif wlandev->msdstate = WLAN_MSD_FWLOAD; result = P80211ENUM_resultcode_success; break; case WLAN_MSD_FWLOAD: hfa384x_cmd_initialize(hw); result = P80211ENUM_resultcode_success; break; case WLAN_MSD_RUNNING: WLAN_LOG_WARNING( "Cannot enter fwload state from enable state," "you must disable first.\n"); result = P80211ENUM_resultcode_invalid_parameters; break; case WLAN_MSD_HWFAIL: default: /* probe() had a problem or the msdstate contains * an unrecognized value, there's nothing we can do. */ result = P80211ENUM_resultcode_implementation_failure; break; } break; case P80211ENUM_ifstate_enable: switch (wlandev->msdstate) { case WLAN_MSD_HWPRESENT: case WLAN_MSD_FWLOAD: wlandev->msdstate = WLAN_MSD_RUNNING_PENDING; /* Initialize the device+driver for full * operation. Note that this might me an FWLOAD to * to RUNNING transition so we must not do a chip * or board level reset. Note that on failure, * the MSD state is set to HWPRESENT because we * can't make any assumptions about the state * of the hardware or a previous firmware load. */ if ((result=hfa384x_drvr_start(hw))) { WLAN_LOG_ERROR( "hfa384x_drvr_start() failed," "result=%d\n", (int)result); result = P80211ENUM_resultcode_implementation_failure; wlandev->msdstate = WLAN_MSD_HWPRESENT; break; } if ((result=prism2sta_getcardinfo(wlandev))) { WLAN_LOG_ERROR( "prism2sta_getcardinfo() failed," "result=%d\n", (int)result); result = P80211ENUM_resultcode_implementation_failure; hfa384x_drvr_stop(hw); wlandev->msdstate = WLAN_MSD_HWPRESENT; break; } if ((result=prism2sta_globalsetup(wlandev))) { WLAN_LOG_ERROR( "prism2sta_globalsetup() failed," "result=%d\n", (int)result); result = P80211ENUM_resultcode_implementation_failure; hfa384x_drvr_stop(hw); wlandev->msdstate = WLAN_MSD_HWPRESENT; break; } wlandev->msdstate = WLAN_MSD_RUNNING; hw->join_ap = 0; hw->join_retries = 60; result = P80211ENUM_resultcode_success; break; case WLAN_MSD_RUNNING: /* Do nothing, we're already in this state.*/ result = P80211ENUM_resultcode_success; break; case WLAN_MSD_HWFAIL: default: /* probe() had a problem or the msdstate contains * an unrecognized value, there's nothing we can do. */ result = P80211ENUM_resultcode_implementation_failure; break; } break; case P80211ENUM_ifstate_disable: switch (wlandev->msdstate) { case WLAN_MSD_HWPRESENT: /* Do nothing, we're already in this state.*/ result = P80211ENUM_resultcode_success; break; case WLAN_MSD_FWLOAD: case WLAN_MSD_RUNNING: wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING; /* * TODO: Shut down the MAC completely. Here a chip * or board level reset is probably called for. * After a "disable" _all_ results are lost, even * those from a fwload. */ if (!wlandev->hwremoved) netif_carrier_off(wlandev->netdev); hfa384x_drvr_stop(hw); wlandev->macmode = WLAN_MACMODE_NONE; wlandev->msdstate = WLAN_MSD_HWPRESENT; result = P80211ENUM_resultcode_success; break; case WLAN_MSD_HWFAIL: default: /* probe() had a problem or the msdstate contains * an unrecognized value, there's nothing we can do. */ result = P80211ENUM_resultcode_implementation_failure; break; } break; default: result = P80211ENUM_resultcode_invalid_parameters; break; } DBFEXIT; return result;}/*----------------------------------------------------------------* prism2sta_getcardinfo** Collect the NICID, firmware version and any other identifiers* we'd like to have in host-side data structures.** Arguments:* wlandev wlan device structure** Returns: * 0 success* >0 f/w reported error* <0 driver reported error** Side effects:** Call context:* Either.----------------------------------------------------------------*/int prism2sta_getcardinfo(wlandevice_t *wlandev){ int result = 0; hfa384x_t *hw = (hfa384x_t *)wlandev->priv; UINT16 temp; UINT8 snum[HFA384x_RID_NICSERIALNUMBER_LEN]; char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1]; DBFENTER; /* Collect version and compatibility info */ /* Some are critical, some are not */ /* NIC identity */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY, &hw->ident_nic, sizeof(hfa384x_compident_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve NICIDENTITY\n"); goto failed; } /* get all the nic id fields in host byte order */ hw->ident_nic.id = hfa384x2host_16(hw->ident_nic.id); hw->ident_nic.variant = hfa384x2host_16(hw->ident_nic.variant); hw->ident_nic.major = hfa384x2host_16(hw->ident_nic.major); hw->ident_nic.minor = hfa384x2host_16(hw->ident_nic.minor); WLAN_LOG_INFO( "ident: nic h/w: id=0x%02x %d.%d.%d\n", hw->ident_nic.id, hw->ident_nic.major, hw->ident_nic.minor, hw->ident_nic.variant); /* Primary f/w identity */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY, &hw->ident_pri_fw, sizeof(hfa384x_compident_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve PRIIDENTITY\n"); goto failed; } /* get all the private fw id fields in host byte order */ hw->ident_pri_fw.id = hfa384x2host_16(hw->ident_pri_fw.id); hw->ident_pri_fw.variant = hfa384x2host_16(hw->ident_pri_fw.variant); hw->ident_pri_fw.major = hfa384x2host_16(hw->ident_pri_fw.major); hw->ident_pri_fw.minor = hfa384x2host_16(hw->ident_pri_fw.minor); WLAN_LOG_INFO( "ident: pri f/w: id=0x%02x %d.%d.%d\n", hw->ident_pri_fw.id, hw->ident_pri_fw.major, hw->ident_pri_fw.minor, hw->ident_pri_fw.variant); /* Station (Secondary?) f/w identity */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY, &hw->ident_sta_fw, sizeof(hfa384x_compident_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve STAIDENTITY\n"); goto failed; } if (hw->ident_nic.id < 0x8000) { WLAN_LOG_ERROR("FATAL: Card is not an Intersil Prism2/2.5/3\n"); result = -1; goto failed; } /* get all the station fw id fields in host byte order */ hw->ident_sta_fw.id = hfa384x2host_16(hw->ident_sta_fw.id); hw->ident_sta_fw.variant = hfa384x2host_16(hw->ident_sta_fw.variant); hw->ident_sta_fw.major = hfa384x2host_16(hw->ident_sta_fw.major); hw->ident_sta_fw.minor = hfa384x2host_16(hw->ident_sta_fw.minor); /* strip out the 'special' variant bits */ hw->mm_mods = hw->ident_sta_fw.variant & (BIT14 | BIT15); hw->ident_sta_fw.variant &= ~((UINT16)(BIT14 | BIT15)); if ( hw->ident_sta_fw.id == 0x1f ) { hw->ap = 0; WLAN_LOG_INFO( "ident: sta f/w: id=0x%02x %d.%d.%d\n", hw->ident_sta_fw.id, hw->ident_sta_fw.major, hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); } else { hw->ap = 1; WLAN_LOG_INFO( "ident: ap f/w: id=0x%02x %d.%d.%d\n", hw->ident_sta_fw.id, hw->ident_sta_fw.major, hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); } /* Compatibility range, Modem supplier */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE, &hw->cap_sup_mfi, sizeof(hfa384x_caplevel_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve MFISUPRANGE\n"); goto failed;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -