-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- UINT32 *uint32 = (UINT32*) data;
- UINT8 bytebuf[MIB_TMP_MAXLEN];
- UINT16 *wordbuf = (UINT16*) bytebuf;
- UINT32 flags;
-
- DBFENTER;
-
- result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
- if (result == 0) {
- /* [MSM] Removed, getconfig16 returns the value in host order.
- * prism2mgmt_prism2int2p80211int(wordbuf, &flags);
- */
- flags = *wordbuf;
- if (isget) {
- *uint32 = (flags & mib->parm2) ?
- P80211ENUM_truth_true : P80211ENUM_truth_false;
- } else {
- if ((*uint32) == P80211ENUM_truth_true)
- flags |= mib->parm2;
- else
- flags &= ~mib->parm2;
- /* [MSM] Removed, setconfig16 expects host order.
- * prism2mgmt_p80211int2prism2int(wordbuf, &flags);
- */
- *wordbuf = flags;
- result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
- }
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_appcfinfoflag
-*
-* Get/set a single flag in the APPCFINFO record.
-*
-* MIB record parameters:
-* parm1 Bit to get/set.
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_appcfinfoflag(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- UINT32 *uint32 = (UINT32*) data;
- UINT8 bytebuf[MIB_TMP_MAXLEN];
- UINT16 *wordbuf = (UINT16*) bytebuf;
- UINT16 word;
-
- DBFENTER;
-
- result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFAPPCFINFO,
- bytebuf, HFA384x_RID_CNFAPPCFINFO_LEN);
- if (result == 0) {
- if (isget) {
- *uint32 = (hfa384x2host_16(wordbuf[3]) & mib->parm1) ?
- P80211ENUM_truth_true : P80211ENUM_truth_false;
- } else {
- word = hfa384x2host_16(wordbuf[3]);
- word = ((*uint32) == P80211ENUM_truth_true) ?
- (word | mib->parm1) : (word & ~mib->parm1);
- wordbuf[3] = host2hfa384x_16(word);
- result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFAPPCFINFO,
- bytebuf, HFA384x_RID_CNFAPPCFINFO_LEN);
- }
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_regulatorydomains
-*
-* Get regulatory domain data.
-*
-* MIB record parameters:
-* parm1 Prism2 RID value.
-* parm2 Number of bytes of RID data.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_regulatorydomains(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- UINT32 cnt;
- p80211pstrd_t *pstr = (p80211pstrd_t*) data;
- UINT8 bytebuf[MIB_TMP_MAXLEN];
- UINT16 *wordbuf = (UINT16*) bytebuf;
-
- DBFENTER;
-
- result = 0;
-
- if (isget) {
- result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
- prism2mgmt_prism2int2p80211int(wordbuf, &cnt);
- pstr->len = (UINT8) cnt;
- memcpy(pstr->data, &wordbuf[1], pstr->len);
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_wepdefaultkey
-*
-* Get/set WEP default keys.
-*
-* MIB record parameters:
-* parm1 Prism2 RID value.
-* parm2 Number of bytes of RID data.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_wepdefaultkey(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- p80211pstrd_t *pstr = (p80211pstrd_t*) data;
- UINT8 bytebuf[MIB_TMP_MAXLEN];
- UINT16 len;
-
- DBFENTER;
-
- if (isget) {
- result = 0; /* Should never happen. */
- } else {
- len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN :
- HFA384x_RID_CNFWEPDEFAULTKEY_LEN;
- memset(bytebuf, 0, len);
- prism2mgmt_pstr2bytearea(bytebuf, pstr);
- result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len);
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_powermanagement
-*
-* Get/set 802.11 power management value. Note that this is defined differently
-* by 802.11 and Prism2:
-*
-* Meaning 802.11 Prism2
-* active 1 false
-* powersave 2 true
-*
-* MIB record parameters:
-* parm1 Prism2 RID value.
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_powermanagement(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- UINT32 *uint32 = (UINT32*) data;
- UINT32 value;
-
- DBFENTER;
-
- if (isget) {
- result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
- *uint32 = (value == 0) ? 1 : 2;
- } else {
- value = ((*uint32) == 1) ? 0 : 1;
- result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_preamble
-*
-* Get/set Prism2 short preamble
-*
-* MIB record parameters:
-* parm1 Prism2 RID value.
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_preamble(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- UINT32 *uint32 = (UINT32*) data;
- UINT8 bytebuf[MIB_TMP_MAXLEN];
- UINT16 *wordbuf = (UINT16*) bytebuf;
-
- DBFENTER;
-
- if (isget) {
- result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
- *uint32 = *wordbuf;
- } else {
- *wordbuf = *uint32;
- result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_privacyinvoked
-*
-* Get/set the dot11PrivacyInvoked value.
-*
-* MIB record parameters:
-* parm1 Prism2 RID value.
-* parm2 Bit value for PrivacyInvoked flag.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_privacyinvoked(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
-
- DBFENTER;
-
- if (wlandev->hostwep & HOSTWEP_DECRYPT) {
- if (wlandev->hostwep & HOSTWEP_DECRYPT)
- mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
- if (wlandev->hostwep & HOSTWEP_ENCRYPT)
- mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT;
- }
-
- result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_excludeunencrypted
-*
-* Get/set the dot11ExcludeUnencrypted value.
-*
-* MIB record parameters:
-* parm1 Prism2 RID value.
-* parm2 Bit value for ExcludeUnencrypted flag.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_excludeunencrypted(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
-
- DBFENTER;
-
- result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_fragmentationthreshold
-*
-* Get/set the fragmentation threshold.
-*
-* MIB record parameters:
-* parm1 Prism2 RID value.
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_fragmentationthreshold(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- UINT32 *uint32 = (UINT32*) data;
-
- DBFENTER;
-
- if (!isget)
- if ((*uint32) % 2) {
- WLAN_LOG_WARNING("Attempt to set odd number "
- "FragmentationThreshold\n");
- msg->resultcode.data = P80211ENUM_resultcode_not_supported;
- return(0);
- }
-
- result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data);
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_operationalrateset
-*
-* Get/set the operational rate set.
-*
-* MIB record parameters:
-* parm1 Prism2 RID value.
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_operationalrateset(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- p80211pstrd_t *pstr = (p80211pstrd_t *) data;
- UINT8 bytebuf[MIB_TMP_MAXLEN];
- UINT16 *wordbuf = (UINT16*) bytebuf;
-
- DBFENTER;
-
- if (isget) {
- result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
- prism2mgmt_get_oprateset(wordbuf, pstr);
- } else {
- prism2mgmt_set_oprateset(wordbuf, pstr);
- result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
- result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, *wordbuf);
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_groupaddress
-*
-* Get/set the dot11GroupAddressesTable.
-*
-* MIB record parameters:
-* parm1 Not used.
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_groupaddress(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- p80211pstrd_t *pstr = (p80211pstrd_t *) data;
- UINT8 bytebuf[MIB_TMP_MAXLEN];
- UINT16 len;
-
- DBFENTER;
-
- /* TODO: fix this. f/w doesn't support mcast filters */
-
- if (isget) {
- prism2mgmt_get_grpaddr(mib->did, pstr, hw);
- return(0);
- }
-
- result = prism2mgmt_set_grpaddr(mib->did, bytebuf, pstr, hw);
- if (result != 0) {
- msg->resultcode.data = P80211ENUM_resultcode_not_supported;
- return(result);
- }
-
- if (hw->dot11_grpcnt <= MAX_PRISM2_GRP_ADDR) {
- len = hw->dot11_grpcnt * WLAN_ADDR_LEN;
- memcpy(bytebuf, hw->dot11_grp_addr[0], len);
- result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR, bytebuf, len);
-
- /*
- ** Turn off promiscuous mode if count is equal to MAX. We may
- ** have been at a higher count in promiscuous mode and need to
- ** turn it off.
- */
-
- /* but only if we're not already in promisc mode. :) */
- if ((hw->dot11_grpcnt == MAX_PRISM2_GRP_ADDR) &&
- !( wlandev->netdev->flags & IFF_PROMISC)) {
- result = hfa384x_drvr_setconfig16(hw,
- HFA384x_RID_PROMISCMODE, 0);
- }
- } else {
-
- /*
- ** Clear group addresses in card and set to promiscuous mode.
- */
-
- memset(bytebuf, 0, sizeof(bytebuf));
- result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR,
- bytebuf, 0);
- if (result == 0) {
- result = hfa384x_drvr_setconfig16(hw,
- HFA384x_RID_PROMISCMODE, 1);
- }
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_fwid
-*
-* Get the firmware ID.
-*
-* MIB record parameters:
-* parm1 Not used.
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_fwid(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- p80211pstrd_t *pstr = (p80211pstrd_t *) data;
- hfa384x_FWID_t fwid;
-
- DBFENTER;
-
- if (isget) {
- result = hfa384x_drvr_getconfig(hw, HFA384x_RID_FWID,
- &fwid, HFA384x_RID_FWID_LEN);
- if (mib->did == DIDmib_p2_p2NIC_p2PrimaryFWID) {
- fwid.primary[HFA384x_FWID_LEN - 1] = '\0';
- pstr->len = strlen(fwid.primary);
- memcpy(pstr->data, fwid.primary, pstr->len);
- } else {
- fwid.secondary[HFA384x_FWID_LEN - 1] = '\0';
- pstr->len = strlen(fwid.secondary);
- memcpy(pstr->data, fwid.secondary, pstr->len);
- }
- } else
- result = 0; /* Should never happen. */
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_authalg
-*
-* Get values from the AuhtenticationAlgorithmsTable.
-*
-* MIB record parameters:
-* parm1 Table index (1-6).
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_authalg(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- UINT32 *uint32 = (UINT32*) data;
-
- DBFENTER;
-
- /* MSM: pkx supplied code that code queries RID FD4D....but the f/w's
- * results are bogus. Therefore, we have to simulate the appropriate
- * results here in the driver based on our knowledge of existing MAC
- * features. That's the whole point behind this ugly function.
- */
-
- if (isget) {
- msg->resultcode.data = P80211ENUM_resultcode_success;
- switch (mib->parm1) {
- case 1: /* Open System */
- *uint32 = P80211ENUM_authalg_opensystem;
- break;
- case 2: /* SharedKey */
- *uint32 = P80211ENUM_authalg_sharedkey;
- break;
- default:
- *uint32 = 0;
- msg->resultcode.data = P80211ENUM_resultcode_not_supported;
- break;
- }
- }
-
- DBFEXIT;
- return(0);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_authalgenable
-*
-* Get/set the enable values from the AuhtenticationAlgorithmsTable.
-*
-* MIB record parameters:
-* parm1 Table index (1-6).
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_authalgenable(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- int result;
- UINT32 *uint32 = (UINT32*) data;
-
- int index;
- UINT16 cnf_auth;
- UINT16 mask;
-
- DBFENTER;
-
- index = mib->parm1 - 1;
-
- result = hfa384x_drvr_getconfig16( hw,
- HFA384x_RID_CNFAUTHENTICATION, &cnf_auth);
- WLAN_LOG_DEBUG(2,"cnfAuthentication0=%d, index=%d\n", cnf_auth, index);
-
- if (isget) {
- if ( index == 0 || index == 1 ) {
- *uint32 = (cnf_auth & (1<<index)) ?
- P80211ENUM_truth_true: P80211ENUM_truth_false;
- } else {
- *uint32 = P80211ENUM_truth_false;
- msg->resultcode.data = P80211ENUM_resultcode_not_supported;
- }
- } else {
- if ( index == 0 || index == 1 ) {
- mask = 1 << index;
- if (*uint32==P80211ENUM_truth_true ) {
- cnf_auth |= mask;
- } else {
- cnf_auth &= ~mask;
- }
- result = hfa384x_drvr_setconfig16( hw,
- HFA384x_RID_CNFAUTHENTICATION, cnf_auth);
- WLAN_LOG_DEBUG(2,"cnfAuthentication:=%d\n", cnf_auth);
- if ( result ) {
- WLAN_LOG_DEBUG(1,"Unable to set p2cnfAuthentication to %d\n", cnf_auth);
- msg->resultcode.data = P80211ENUM_resultcode_implementation_failure;
- }
- } else {
- msg->resultcode.data = P80211ENUM_resultcode_not_supported;
- }
- }
-
- DBFEXIT;
- return(result);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_priv
-*
-* Get/set values in the "priv" data structure.
-*
-* MIB record parameters:
-* parm1 Not used.
-* parm2 Not used.
-* parm3 Not used.
-*
-* Arguments:
-* mib MIB record.
-* isget MIBGET/MIBSET flag.
-* wlandev wlan device structure.
-* priv "priv" structure.
-* hw "hw" structure.
-* msg Message structure.
-* data Data buffer.
-*
-* Returns:
-* 0 - Success.
-* ~0 - Error.
-*
-----------------------------------------------------------------*/
-
-static int prism2mib_priv(
-mibrec_t *mib,
-int isget,
-wlandevice_t *wlandev,
-hfa384x_t *hw,
-p80211msg_dot11req_mibset_t *msg,
-void *data)
-{
- UINT32 *uint32 = (UINT32*) data;
- p80211pstrd_t *pstr = (p80211pstrd_t*) data;
- p80211macarray_t *macarray = (p80211macarray_t *) data;
-
- int i, cnt, result, done;
-
- prism2sta_authlist_t old;
-
- /*
- ** "test" is a lot longer than necessary but who cares? ...as long as
- ** it is long enough!
- */
-
- UINT8 test[sizeof(wlandev->rx) + sizeof(hw->tallies)];
-
- DBFENTER;
-
- switch (mib->did) {
- case DIDmib_p2_p2Table_p2ReceivedFrameStatistics:
-
- /*
- ** Note: The values in this record are changed by the
- ** interrupt handler and therefore cannot be guaranteed
- ** to be stable while they are being copied. However,
- ** the interrupt handler will take priority over this
- ** code. Hence, if the same values are copied twice,
- ** then we are ensured that the values have not been
- ** changed. If they have, then just try again. Don't
- ** try more than 10 times...if we still haven't got it,
- ** then the values we do have are probably good enough.
- ** This scheme for copying values is used in order to
- ** prevent having to block the interrupt handler while
- ** we copy the values.
- */
-
- if (isget)
- for (i = 0; i < 10; i++) {
- memcpy(data, &wlandev->rx, sizeof(wlandev->rx));
- memcpy(test, &wlandev->rx, sizeof(wlandev->rx));
- if (memcmp(data, test, sizeof(wlandev->rx)) == 0) break;
- }
-
- break;
-
- case DIDmib_p2_p2Table_p2CommunicationTallies:
-
- /*
- ** Note: The values in this record are changed by the
- ** interrupt handler and therefore cannot be guaranteed
- ** to be stable while they are being copied. See the
- ** note above about copying values.
- */
-
- if (isget) {
- result = hfa384x_drvr_commtallies(hw);
-
- /* ?????? We need to wait a bit here for the */
- /* tallies to get updated. ?????? */
- /* MSM: TODO: The right way to do this is to
- * add a "commtallie" wait queue to the
- * priv structure that gets run every time
- * we receive a commtally info frame.
- * This process would sleep on that
- * queue and get awakened when the
- * the requested info frame arrives.
- * Don't have time to do and test this
- * right now.
- */
-
- /* Ugh, this is nasty. */
- for (i = 0; i < 10; i++) {
- memcpy(data,
- &hw->tallies,
- sizeof(hw->tallies));
- memcpy(test,
- &hw->tallies,
- sizeof(hw->tallies));
- if ( memcmp(data,
- test,
- sizeof(hw->tallies)) == 0)
- break;
- }
- }
-
- break;
-
- case DIDmib_p2_p2Table_p2Authenticated:
-
- if (isget) {
- prism2mib_priv_authlist(hw, &old);
-
- macarray->cnt = 0;
- for (i = 0; i < old.cnt; i++) {
- if (!old.assoc[i]) {
- memcpy(macarray->data[macarray->cnt], old.addr[i], WLAN_ADDR_LEN);
- macarray->cnt++;
- }
- }
- }
-
- break;
-
- case DIDmib_p2_p2Table_p2Associated:
-
- if (isget) {
- prism2mib_priv_authlist(hw, &old);
-
- macarray->cnt = 0;
- for (i = 0; i < old.cnt; i++) {
- if (old.assoc[i]) {
- memcpy(macarray->data[macarray->cnt], old.addr[i], WLAN_ADDR_LEN);
- macarray->cnt++;
- }
- }
- }
-
- break;
-
- case DIDmib_p2_p2Table_p2PowerSaveUserCount:
-
- if (isget)
- *uint32 = hw->psusercount;
-
- break;
-
- case DIDmib_p2_p2Table_p2Comment:
-
- if (isget) {
- pstr->len = strlen(hw->comment);
- memcpy(pstr->data, hw->comment, pstr->len);
- } else {
- cnt = pstr->len;
- if (cnt < 0) cnt = 0;
- if (cnt >= sizeof(hw->comment))
- cnt = sizeof(hw->comment)-1;
- memcpy(hw->comment, pstr->data, cnt);
- pstr->data[cnt] = '\0';
- }
-
- break;
-
- case DIDmib_p2_p2Table_p2AccessMode:
-
- if (isget)
- *uint32 = hw->accessmode;
- else
- prism2mib_priv_accessmode(hw, *uint32);
-
- break;
-
- case DIDmib_p2_p2Table_p2AccessAllow:
-
- if (isget) {
- macarray->cnt = hw->allow.cnt;
- memcpy(macarray->data, hw->allow.addr,
- macarray->cnt*WLAN_ADDR_LEN);
- } else {
- prism2mib_priv_accessallow(hw, macarray);
- }
-
- break;
-
- case DIDmib_p2_p2Table_p2AccessDeny:
-
- if (isget) {
- macarray->cnt = hw->deny.cnt;
- memcpy(macarray->data, hw->deny.addr,
- macarray->cnt*WLAN_ADDR_LEN);
- } else {
- prism2mib_priv_accessdeny(hw, macarray);
- }
-
- break;
-
- case DIDmib_p2_p2Table_p2ChannelInfoResults:
-
- if (isget) {
- done = atomic_read(&hw->channel_info.done);
- if (done == 0) {
- msg->resultcode.status = P80211ENUM_msgitem_status_no_value;
- break;
- }
- if (done == 1) {
- msg->resultcode.status = P80211ENUM_msgitem_status_incomplete_itemdata;
- break;
- }
-
- for (i = 0; i < 14; i++, uint32 += 5) {
- uint32[0] = i+1;
- uint32[1] = hw->channel_info.results.result[i].anl;
- uint32[2] = hw->channel_info.results.result[i].pnl;
- uint32[3] = (hw->channel_info.results.result[i].active & HFA384x_CHINFORESULT_BSSACTIVE) ? 1 : 0;
- uint32[4] = (hw->channel_info.results.result[i].active & HFA384x_CHINFORESULT_PCFACTIVE) ? 1 : 0;
- }
- }
-
- break;
-
- case DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType:
-
- if (isget)
- *uint32 = hw->dot11_desired_bss_type;
- else
- hw->dot11_desired_bss_type = *uint32;
-
- break;
-
- case DIDmib_lnx_lnxConfigTable_lnxRSNAIE: {
- hfa384x_WPAData_t wpa;
- if (isget) {
- hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFWPADATA,
- (UINT8 *) &wpa, sizeof(wpa));
- pstr->len = hfa384x2host_16(wpa.datalen);
- memcpy(pstr->data, wpa.data, pstr->len);
- } else {
- wpa.datalen = host2hfa384x_16(pstr->len);
- memcpy(wpa.data, pstr->data, pstr->len);
-
- result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFWPADATA,
- (UINT8 *) &wpa, sizeof(wpa));
- }
- break;
- }
- default:
- WLAN_LOG_ERROR("Unhandled DID 0x%08x\n", mib->did);
- }
-
- DBFEXIT;
- return(0);
-}
-
-/*----------------------------------------------------------------
-* prism2mib_priv_authlist
-*
-* Get a copy of the list of authenticated stations.
-*
-* Arguments:
-* priv "priv" structure.
-* list List of authenticated stations.
-*
-* Returns:
-* Nothing
-*
-----------------------------------------------------------------*/
-
-static void prism2mib_priv_authlist(
-hfa384x_t *hw,
-prism2sta_authlist_t *list)
-{
- prism2sta_authlist_t test;
- int i;
-
- DBFENTER;
-
- /*
- ** Note: The values in this record are changed by the interrupt
- ** handler and therefore cannot be guaranteed to be stable while
- ** they are being copied. However, the interrupt handler will
- ** take priority over this code. Hence, if the same values are
- ** copied twice, then we are ensured that the values have not
- ** been changed. If they have, then just try again. Don't try
- ** more than 10 times...the list of authenticated stations is
- ** unlikely to be changing frequently enough that we can't get
- ** a snapshot in 10 tries. Don't try more than this so that we
- ** don't risk locking-up for long periods of time. If we still
- ** haven't got the snapshot, then generate an error message and
- ** return an empty list (since this is the only valid list that
- ** we can guarentee). This scheme for copying values is used in
- ** order to prevent having to block the interrupt handler while
- ** we copy the values.
- */
-
- for (i = 0; i < 10; i++) {
- memcpy(list, &hw->authlist, sizeof(prism2sta_authlist_t));
- memcpy(&test, &hw->authlist, sizeof(prism2sta_authlist_t));
- if (memcmp(list, &test, sizeof(prism2sta_authlist_t)) == 0)
- break;
- }
-
- if (i >= 10) {
- list->cnt = 0;
- WLAN_LOG_ERROR("Could not obtain snapshot of authenticated stations.\n");
- }
-
- DBFEXIT;
- return;
-}
-
-/*----------------------------------------------------------------
-* prism2mib_priv_accessmode
-*
-* Set the Access Mode.
-*
-* Arguments:
-* priv "priv" structure.
-* hw "hw" structure.
-* mode New access mode.
-*
-* Returns:
-* Nothing
-*
-----------------------------------------------------------------*/
-
-static void prism2mib_priv_accessmode(
-hfa384x_t *hw,
-UINT32 mode)
-{
- prism2sta_authlist_t old;
- int i, j, deauth;
- UINT8 *addr;
-
- DBFENTER;
-
- /*
- ** If the mode is not changing or it is changing to "All", then it's
- ** okay to go ahead without a lot of messing around. Otherwise, the
- ** access mode is changing in a way that may leave some stations
- ** authenticated which should not be authenticated. It will be
- ** necessary to de-authenticate these stations.
- */
-
- if (mode == WLAN_ACCESS_ALL || mode == hw->accessmode) {
- hw->accessmode = mode;
- return;
- }
-
- /*
- ** Switch to the new access mode. Once this is done, then the interrupt
- ** handler (which uses this value) will be prevented from authenticating
- ** ADDITIONAL stations which should not be authenticated. Then get a
- ** copy of the current list of authenticated stations.
- */
-
- hw->accessmode = mode;
-
- prism2mib_priv_authlist(hw, &old);
-
- /*
- ** Now go through the list of previously authenticated stations (some
- ** of which might de-authenticate themselves while we are processing it
- ** but that is okay). Any station which no longer matches the access
- ** mode, must be de-authenticated.
- */