2412 lines
72 KiB
C
2412 lines
72 KiB
C
/* prism2mgmt.c: Management request handler functions.
|
|
* --------------------------------------------------------------------
|
|
*
|
|
* Linux WLAN
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public
|
|
* License Version 1.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The initial developer of the original code is Mark S. Mathews
|
|
* <mark@absoval.com>. Portions created by Mark S. Mathews
|
|
* are Copyright (C) 1998 AbsoluteValue Software, Inc. All Rights Reserved.
|
|
*
|
|
* --------------------------------------------------------------------
|
|
*
|
|
* The initial author may be reached as mark@absoval.com, or
|
|
* C/O AbsoluteValue Software Inc., P.O. Box 941149,
|
|
* Maitland, FL, 32794-1149
|
|
*
|
|
* --------------------------------------------------------------------
|
|
*
|
|
* The functions in this file handle management requests sent from
|
|
* user mode.
|
|
*
|
|
* --------------------------------------------------------------------
|
|
*/
|
|
|
|
/*================================================================*/
|
|
/* System Includes */
|
|
|
|
#define __NO_VERSION__
|
|
|
|
#include <linux/config.h>
|
|
#define WLAN_DBVAR prism2_debug
|
|
#include <wlan/wlan_compat.h>
|
|
|
|
#include <linux/version.h>
|
|
#include <linux/module.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/types.h>
|
|
#include <linux/malloc.h>
|
|
#include <linux/netdevice.h>
|
|
#include <asm/io.h>
|
|
#include <asm/delay.h>
|
|
|
|
#include <pcmcia/config.h>
|
|
#include <pcmcia/k_compat.h>
|
|
#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>
|
|
#include <pcmcia/driver_ops.h>
|
|
|
|
/*================================================================*/
|
|
/* Project Includes */
|
|
|
|
#include <wlan/version.h>
|
|
#include <wlan/p80211types.h>
|
|
#include <wlan/p80211hdr.h>
|
|
#include <wlan/p80211mgmt.h>
|
|
#include <wlan/p80211conv.h>
|
|
#include <wlan/p80211msg.h>
|
|
#include <wlan/p80211netdev.h>
|
|
#include <wlan/p80211metadef.h>
|
|
#include <wlan/p80211metastruct.h>
|
|
#include <prism2/hfa384x.h>
|
|
#include <prism2/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_mibset_mibget
|
|
*
|
|
* Set the value of a mib item.
|
|
*
|
|
* 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
|
|
----------------------------------------------------------------*/
|
|
#define MIB_TMP_MAXLEN 100
|
|
int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
int isget;
|
|
|
|
/* Get the pieces out of the msg */
|
|
p80211msg_dot11req_mibset_t *msg = msgp;
|
|
p80211itemd_t *mibitem = (p80211itemd_t*)msg->mibattribute.data;
|
|
|
|
/* These two are pointers to the mib data, use whichever */
|
|
/* one is appropriate for the given mib item */
|
|
p80211pstrd_t *pstr = (p80211pstrd_t*)mibitem->data;
|
|
UINT32 *uint32 = (UINT32*)mibitem->data;
|
|
|
|
/* The following two are a temporary buffer to use in conversions */
|
|
UINT8 bytebuf[MIB_TMP_MAXLEN];
|
|
UINT16 *wordbuf = (UINT16*)bytebuf;
|
|
hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf;
|
|
|
|
DBFENTER;
|
|
|
|
memset( bytebuf, 0, MIB_TMP_MAXLEN );
|
|
|
|
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
|
|
/* Determine if message code is mibget; otherwise, it's mibset */
|
|
if ( msg->msgcode == DIDmsg_dot11req_mibget ) {
|
|
isget = 1;
|
|
} else {
|
|
isget = 0;
|
|
}
|
|
|
|
/* Ok, here's the list */
|
|
switch( mibitem->did )
|
|
{
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11StationID:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFOWNMACADDR,
|
|
bytebuf, HFA384x_RID_CNFOWNMACADDR_LEN);
|
|
prism2mgmt_bytearea2pstr(bytebuf, pstr,
|
|
HFA384x_RID_CNFOWNMACADDR_LEN);
|
|
} else {
|
|
prism2mgmt_pstr2bytearea(bytebuf, pstr);
|
|
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNMACADDR,
|
|
bytebuf, HFA384x_RID_CNFOWNMACADDR_LEN);
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11MediumOccupancyLimit:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig( hw, HFA384x_RID_PCFINFO,
|
|
bytebuf, HFA384x_RID_PCFINFO_LEN);
|
|
*uint32 =
|
|
hfa384x2host_32(((hfa384x_PCFInfo_data_t *)bytebuf)->MediumOccupancyLimit);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11CFPollable:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_CFPOLLABLE,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11CFPPeriod:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig( hw, HFA384x_RID_PCFINFO,
|
|
bytebuf, HFA384x_RID_PCFINFO_LEN);
|
|
*uint32 =
|
|
hfa384x2host_32(((hfa384x_PCFInfo_data_t *)bytebuf)->CFPPeriod);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11CFPMaxDuration:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig( hw, HFA384x_RID_PCFINFO,
|
|
bytebuf, HFA384x_RID_PCFINFO_LEN);
|
|
*uint32 =
|
|
hfa384x2host_32(((hfa384x_PCFInfo_data_t *)bytebuf)->CFPMaxDuration);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticationResponseTimeOut:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_CNFAUTHRSPTIMEOUT,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
prism2mgmt_p80211int2prism2int(wordbuf, uint32);
|
|
result = hfa384x_drvr_setconfig16( hw, HFA384x_RID_CNFAUTHRSPTIMEOUT,
|
|
wordbuf);
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11PrivacyOptionImplemented:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_PRIVACYOPTIMP,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11PowerManagementMode:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_CNFPMENABLED,
|
|
wordbuf);
|
|
/* Prism2 defines this item to be boolean; 802.11 defines
|
|
it to be 1=active, 2=powersave */
|
|
if ( (*wordbuf) == 0 ) {
|
|
*wordbuf = 1; /* if false, set to active */
|
|
} else {
|
|
*wordbuf = 2; /* if true, set to powersave */
|
|
}
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* Prism2 defines this item to be boolean; 802.11 defines
|
|
it to be 1=active, 2=powersave */
|
|
|
|
UINT32 mode;
|
|
|
|
if ( (*uint32) == 1 ) {
|
|
mode = (UINT32)0; /* if active, set to false */
|
|
} else {
|
|
mode = (UINT32)1; /* if powersave, set to true */
|
|
}
|
|
prism2mgmt_p80211int2prism2int(wordbuf, &mode);
|
|
result = hfa384x_drvr_setconfig16( hw, HFA384x_RID_CNFPMENABLED,
|
|
wordbuf);
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredSSID:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFDESIREDSSID,
|
|
bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN);
|
|
prism2mgmt_bytestr2pstr(p2bytestr, pstr);
|
|
} else {
|
|
prism2mgmt_pstr2bytestr(p2bytestr, pstr);
|
|
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFDESIREDSSID,
|
|
bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN);
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType:
|
|
if ( isget ) {
|
|
*uint32 = priv->DesiredBSSType;
|
|
} else {
|
|
priv->DesiredBSSType = *uint32;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11OperationalRateSet:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_TXRATECNTL,
|
|
wordbuf);
|
|
prism2mgmt_GetOperationalRateSet(wordbuf, pstr);
|
|
} else {
|
|
prism2mgmt_SetOperationalRateSet(wordbuf, pstr);
|
|
result = hfa384x_drvr_setconfig16( hw, HFA384x_RID_TXRATECNTL,
|
|
wordbuf);
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11BeaconPeriod:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_CURRENTBCNINT,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
prism2mgmt_p80211int2prism2int(wordbuf, uint32);
|
|
result = hfa384x_drvr_setconfig16( hw, HFA384x_RID_CURRENTBCNINT,
|
|
wordbuf);
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11DTIMPeriod:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_CNFOWNDTIMPER,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
prism2mgmt_p80211int2prism2int(wordbuf, uint32);
|
|
result = hfa384x_drvr_setconfig16( hw, HFA384x_RID_CNFOWNDTIMPER,
|
|
wordbuf);
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11AssociationResponseTimeOut:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_PROTOCOLRSPTIME,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11DisassociateReason:
|
|
if ( isget ) {
|
|
*uint32 = priv->DisassociateReason;
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11DisassociateStation:
|
|
/* Treat the private member "DisassociateStation" like a
|
|
Prism2 byte area data type */
|
|
if ( isget ) {
|
|
prism2mgmt_bytearea2pstr(priv->DisassociateStation,
|
|
pstr, WLAN_ADDR_LEN );
|
|
} else {
|
|
/* this is read only established by P802.11 */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11DeauthenticateReason:
|
|
if ( isget ) {
|
|
*uint32 = priv->DeauthenticateReason;
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11DeauthenticateStation:
|
|
/* Treat the private member "DeauthenticateStation" like a
|
|
Prism2 byte area data type */
|
|
if ( isget ) {
|
|
prism2mgmt_bytearea2pstr(priv->DeauthenticateStation,
|
|
pstr, WLAN_ADDR_LEN );
|
|
} else {
|
|
/* this is read only established by P802.11 */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticateFailStatus:
|
|
if ( isget ) {
|
|
*uint32 = priv->AuthenticateFailStatus;
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticateFailStation:
|
|
/* Treat the private member "AuthenticateFailStation" like a
|
|
Prism2 byte area data type */
|
|
if ( isget ) {
|
|
prism2mgmt_bytearea2pstr(priv->AuthenticateFailStation,
|
|
pstr, WLAN_ADDR_LEN );
|
|
} else {
|
|
/* this is read only established by P802.11 */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm1:
|
|
result = hfa384x_drvr_getconfig( hw,
|
|
HFA384x_RID_AUTHALGORITHMS,
|
|
bytebuf,
|
|
HFA384x_RID_AUTHALGORITHMS_LEN);
|
|
if ( isget ) {
|
|
*uint32 =
|
|
hfa384x2host_32(((hfa384x_AuthenticationAlgorithms_data_t *)bytebuf)->AuthenticationType);
|
|
} else {
|
|
((hfa384x_AuthenticationAlgorithms_data_t *)bytebuf)->
|
|
AuthenticationType = host2hfa384x_16((UINT16)(*uint32));
|
|
result = hfa384x_drvr_setconfig( hw,
|
|
HFA384x_RID_AUTHALGORITHMS,
|
|
bytebuf,
|
|
HFA384x_RID_AUTHALGORITHMS_LEN);
|
|
}
|
|
break;
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable1:
|
|
result = hfa384x_drvr_getconfig( hw,
|
|
HFA384x_RID_AUTHALGORITHMS,
|
|
bytebuf,
|
|
HFA384x_RID_AUTHALGORITHMS_LEN);
|
|
if ( isget ) {
|
|
*uint32 =
|
|
hfa384x2host_32(((hfa384x_AuthenticationAlgorithms_data_t *)bytebuf)->TypeEnabled);
|
|
} else {
|
|
((hfa384x_AuthenticationAlgorithms_data_t *)bytebuf)->
|
|
TypeEnabled = host2hfa384x_16((UINT16)(*uint32));
|
|
result = hfa384x_drvr_setconfig( hw,
|
|
HFA384x_RID_AUTHALGORITHMS,
|
|
bytebuf,
|
|
HFA384x_RID_AUTHALGORITHMS_LEN);
|
|
}
|
|
break;
|
|
|
|
/* The Prism2 hardware only supports one authentication
|
|
algorithm and its associated enable */
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm2:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable2:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm3:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable3:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm4:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable4:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm5:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable5:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm6:
|
|
case DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable6:
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11MACAddress:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFOWNMACADDR,
|
|
bytebuf, HFA384x_RID_CNFOWNMACADDR_LEN);
|
|
prism2mgmt_bytearea2pstr(bytebuf, pstr,
|
|
HFA384x_RID_CNFOWNMACADDR_LEN);
|
|
} else {
|
|
prism2mgmt_pstr2bytearea(bytebuf, pstr);
|
|
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNMACADDR,
|
|
bytebuf, HFA384x_RID_CNFOWNMACADDR_LEN);
|
|
}
|
|
break;
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_RTSTHRESH,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
prism2mgmt_p80211int2prism2int(wordbuf, uint32);
|
|
result = hfa384x_drvr_setconfig16( hw, HFA384x_RID_RTSTHRESH,
|
|
wordbuf);
|
|
}
|
|
break;
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_SHORTRETRYLIMIT,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_LONGRETRYLIMIT,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_FRAGTHRESH,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* only even numbers supported */
|
|
if ( !(*uint32 % 2) ) {
|
|
prism2mgmt_p80211int2prism2int(wordbuf, uint32);
|
|
result = hfa384x_drvr_setconfig16( hw,
|
|
HFA384x_RID_FRAGTHRESH, wordbuf);
|
|
} else {
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_not_supported;
|
|
}
|
|
}
|
|
break;
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_MAXTXLIFETIME,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11MaxReceiveLifetime:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_MAXRXLIFETIME,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31:
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32:
|
|
if ( isget ) {
|
|
prism2mgmt_GetGroupAddress(mibitem->did,
|
|
pstr, priv );
|
|
} else {
|
|
if ( (result = prism2mgmt_SetGroupAddress(mibitem->did, bytebuf,
|
|
pstr, priv)) == 0 ) {
|
|
if ( (priv->grpcnt) <= MAX_PRISM2_GRP_ADDR ) {
|
|
memcpy( bytebuf,
|
|
priv->GroupAddresses[0],
|
|
((priv->grpcnt) * WLAN_ADDR_LEN));
|
|
result = hfa384x_drvr_setconfig( hw,
|
|
HFA384x_RID_GROUPADDR,
|
|
bytebuf,
|
|
((priv->grpcnt) * WLAN_ADDR_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. */
|
|
if ( (priv->grpcnt) == MAX_PRISM2_GRP_ADDR ) {
|
|
*wordbuf = 0;
|
|
result = hfa384x_drvr_setconfig16( hw,
|
|
HFA384x_RID_PROMISCMODE,
|
|
wordbuf);
|
|
}
|
|
} 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 )
|
|
{
|
|
*wordbuf = 1;
|
|
result = hfa384x_drvr_setconfig16( hw,
|
|
HFA384x_RID_PROMISCMODE,
|
|
wordbuf);
|
|
}
|
|
}
|
|
|
|
} else {
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
}
|
|
}
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyOperationTable_dot11PHYType:
|
|
/* This is an enumerated type. The Prism2 enumerated values
|
|
are a 1-to-1 match against the wlan enumerated values for this item */
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_PHYTYPE,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyOperationTable_dot11CurrentRegDomain:
|
|
/* TODO: wlan has this set up as an enumerated type. However,
|
|
it can have multiple values, i.e. a list of domains. Need
|
|
to add support. For now, it's not supported */
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyOperationTable_dot11TempType:
|
|
/* This is an enumerated type. The Prism2 enumerated values
|
|
are a 1-to-1 match against the wlan enumerated values for this item */
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_TEMPTYPE,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityPresent:
|
|
/*TODO: we need to locate RID and place it here */
|
|
/* This is an enumerated type. The Prism2 enumerated values
|
|
are a 1-to-1 match against the wlan enumerated values for this item */
|
|
if ( isget ) {
|
|
/*
|
|
result = hfa384x_drvr_getconfig16( hw, PLACE_RID_HERE,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
*/
|
|
} else {
|
|
/* Need to determine if this is read only or if we do something
|
|
here; it depends on the RID */
|
|
}
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityEnabled:
|
|
/*TODO: we need to locate RID and place it here */
|
|
/* This is an enumerated type. The Prism2 enumerated values
|
|
are a 1-to-1 match against the wlan enumerated values for this item */
|
|
if ( isget ) {
|
|
/*
|
|
result = hfa384x_drvr_getconfig16( hw, PLACE_RID_HERE,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
*/
|
|
} else {
|
|
/* Need to determine if this is read only or if we do something
|
|
here; it depends on the RID */
|
|
}
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel:
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_CURRENTCHANNEL,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentCCAMode:
|
|
/* This is an enumerated type. The Prism2 enumerated values
|
|
are a 1-to-1 match against the wlan enumerated values for this item */
|
|
if ( isget ) {
|
|
result = hfa384x_drvr_getconfig16( hw, HFA384x_RID_CCAMODE,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
} else {
|
|
/* this is read only established by the MAC */
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_cant_set_readonly_mib;
|
|
}
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyDSSSTable_dot11ShortPreambleOptionImplemented:
|
|
/* TODO: Find out the firmware version number(s) for identifying
|
|
whether the firmware is capable of short preamble. TRUE or FALSE
|
|
will be returned based on the version of the firmware. For now,
|
|
set resultcode.data to "not supported" */
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11PhyDSSSTable_dot11PBCCOptionImplemented:
|
|
/* TODO: Need to locate RID and place it here */
|
|
if ( isget ) {
|
|
/*
|
|
result = hfa384x_drvr_getconfig16( hw, PLACE_RID_HERE,
|
|
wordbuf);
|
|
prism2mgmt_prism2int2p80211int(wordbuf, uint32);
|
|
*/
|
|
} else {
|
|
/* Need to determine if this is read only or if we do something
|
|
here; it depends on the RID */
|
|
}
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportIndex:
|
|
/* TODO: add support for this data item. For now, set
|
|
resultcode.data to "not supported" */
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportValue:
|
|
/* TODO: need to investigate why wlan has this as enumerated and
|
|
Prism2 has this as btye str. For now, not supported */
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxIndex:
|
|
/* TODO: add support for this data item. For now, set
|
|
resultcode.data to "not supported" */
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxValue:
|
|
/* TODO: add support for this data item. For now, set
|
|
resultcode.data to "not supported" */
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxIndex:
|
|
/* TODO: add support for this data item. For now, set
|
|
resultcode.data to "not supported" */
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
case DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxValue:
|
|
/* TODO: add support for this data item. For now, set
|
|
resultcode.data to "not supported" */
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
/* These items are not supported at this time */
|
|
case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKeyIndex:
|
|
case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKeyValue:
|
|
case DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingIndex:
|
|
case DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingAddress:
|
|
case DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingWEPOn:
|
|
case DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingValue:
|
|
case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked:
|
|
case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID:
|
|
case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPKeyMappingLength:
|
|
case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted:
|
|
case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPICVErrorCount:
|
|
case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPExcludedCount:
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11ManufacturerID:
|
|
case DIDmib_dot11mac_dot11OperationTable_dot11ProductID:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFragmentCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11MulticastTransmittedFrameCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11FailedCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11RetryCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11MultipleRetryCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11FrameDuplicateCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11RTSSuccessCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11RTSFailureCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11ACKFailureCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11ReceivedFragmentCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11MulticastReceivedFrameCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11FCSErrorCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFrameCount:
|
|
case DIDmib_dot11mac_dot11CountersTable_dot11WEPUndecryptableCount:
|
|
case DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentTxAntenna:
|
|
case DIDmib_dot11phy_dot11PhyAntennaTable_dot11DiversitySupport:
|
|
case DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentRxAntenna:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11NumberSupportedPowerLevels:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel1:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel2:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel3:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel4:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel5:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel6:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel7:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8:
|
|
case DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel:
|
|
case DIDmib_dot11phy_dot11PhyFHSSTable_dot11HopTime:
|
|
case DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentChannelNumber:
|
|
case DIDmib_dot11phy_dot11PhyFHSSTable_dot11MaxDwellTime:
|
|
case DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentDwellTime:
|
|
case DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentSet:
|
|
case DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentPattern:
|
|
case DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentIndex:
|
|
case DIDmib_dot11phy_dot11PhyDSSSTable_dot11CCAModeSupported:
|
|
case DIDmib_dot11phy_dot11PhyDSSSTable_dot11EDThreshold:
|
|
case DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMax:
|
|
case DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMax:
|
|
case DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMin:
|
|
case DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMin:
|
|
case DIDmib_dot11phy_dot11AntennasListTable_dot11AntennaListIndex:
|
|
case DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedTxAntenna:
|
|
case DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedRxAntenna:
|
|
case DIDmib_dot11phy_dot11AntennasListTable_dot11DiversitySelectionRx:
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
break;
|
|
default:
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
}
|
|
|
|
if ( msg->resultcode.data == P80211ENUM_resultcode_success )
|
|
{
|
|
if ( result == 0 ) {
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_success;
|
|
if ( isget ) {
|
|
/* set the status for the mibattribute and for the mib item
|
|
within the data portion of the mibattribute */
|
|
msg->mibattribute.status = P80211ENUM_msgitem_status_data_ok;
|
|
((p80211itemd_t *)(msg->mibattribute.data))->status =
|
|
P80211ENUM_msgitem_status_data_ok;
|
|
}
|
|
} else {
|
|
msg->resultcode.data =
|
|
P80211ENUM_resultcode_implementation_failure;
|
|
}
|
|
}
|
|
|
|
DBFEXIT;
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* 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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_powermgmt_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* TODO: remove the following line, it's just to get rid of warnings for now */
|
|
msg->resultcode.data = hw->bap;
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
|
|
DBFEXIT;
|
|
return result;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_scan
|
|
*
|
|
* Initiate a scan for BSSs.
|
|
*
|
|
* 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_scan(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_scan_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* TODO: remove the following line, it's just to get rid of warnings for now */
|
|
msg->resultcode.data = hw->bap;
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
|
|
DBFEXIT;
|
|
return result;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_scan_results
|
|
*
|
|
* Retrieve the BSS description for one of the BSSs identified in
|
|
* 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_scan_results(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_scan_results_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* TODO: remove the following line, it's just to get rid of warnings for now */
|
|
msg->resultcode.data = hw->bap;
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
|
|
DBFEXIT;
|
|
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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_join_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* TODO: remove the following line, it's just to get rid of warnings for now */
|
|
msg->resultcode.data = hw->bap;
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
|
|
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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_authenticate_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* TODO: remove the following line, it's just to get rid of warnings for now */
|
|
msg->resultcode.data = hw->bap;
|
|
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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_deauthenticate_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* TODO: remove the following line, it's just to get rid of warnings for now */
|
|
msg->resultcode.data = hw->bap;
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
|
|
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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
UINT16 reg;
|
|
UINT16 port_type;
|
|
p80211msg_dot11req_associate_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* Set the PortType */
|
|
port_type = 1;
|
|
hfa384x_drvr_setconfig16(hw, 0xfc00, &port_type); /* ESS port */
|
|
|
|
/* Enable the interrupts */
|
|
reg = HFA384x_INTEN_INFDROP_SET(1) |
|
|
HFA384x_INTEN_INFO_SET(1) |
|
|
HFA384x_INTEN_ALLOC_SET(1) |
|
|
HFA384x_INTEN_TXEXC_SET(1) |
|
|
HFA384x_INTEN_TX_SET(1) |
|
|
HFA384x_INTEN_RX_SET(1);
|
|
outw( 0xffff, HFA384x_EVSTAT(priv->hw->iobase));
|
|
outw( reg, HFA384x_INTEN(hw->iobase));
|
|
|
|
/* Enable the Port */
|
|
hfa384x_cmd_enable(hw, 0);
|
|
|
|
/* Set the resultcode */
|
|
msg->resultcode.status = 0;
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
|
|
|
|
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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_reassociate_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* TODO: remove the following line, it's just to get rid of warnings for now */
|
|
msg->resultcode.data = hw->bap;
|
|
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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_disassociate_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* TODO: remove the following line, it's just to get rid of warnings for now */
|
|
msg->resultcode.data = hw->bap;
|
|
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
|
|
|
DBFEXIT;
|
|
return result;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_start
|
|
*
|
|
* 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_start(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_dot11req_start_t *msg = msgp;
|
|
p80211pstrd_t *pstr;
|
|
UINT8 bytebuf[80];
|
|
hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf;
|
|
hfa384x_PCFInfo_data_t *pcfinfo = (hfa384x_PCFInfo_data_t*)bytebuf;
|
|
UINT16 word;
|
|
DBFENTER;
|
|
|
|
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 &&
|
|
priv->cap_sup_sta.id != 4) ||
|
|
(msg->bsstype.data == P80211ENUM_bsstype_infrastructure &&
|
|
priv->cap_sup_sta.id != 5) ) {
|
|
msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
|
|
return 0;
|
|
}
|
|
|
|
/* 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_DEBUG0(1, "Unable to set SSID\n");
|
|
goto failed;
|
|
}
|
|
|
|
/* bsstype */
|
|
if ( msg->bsstype.data == P80211ENUM_bsstype_independent ) {
|
|
word = HFA384x_PORTTYPE_IBSS;
|
|
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, &word);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG1(1, "Unable to set port type=%d.\n", word);
|
|
goto failed;
|
|
}
|
|
}
|
|
|
|
/* beacon period */
|
|
word = msg->beaconperiod.data;
|
|
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAPBCNINT, &word);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG1(1, "Unable 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_DEBUG1(1, "Unable 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_DEBUG1(1, "Unable to set basicrates=%d.\n", word);
|
|
goto failed;
|
|
}
|
|
|
|
/* Operational rates (supprates and txratecontrol) */
|
|
word = 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);
|
|
}
|
|
if ( msg->bsstype.data == P80211ENUM_bsstype_infrastructure ) {
|
|
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, &word);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG1(1, "Unable to set supprates=%d.\n", word);
|
|
goto failed;
|
|
}
|
|
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL0, &word);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG1(1, "Unable to set txrates=%d.\n", word);
|
|
goto failed;
|
|
}
|
|
} else { /* assume ibss */
|
|
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, &word);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG1(1, "Unable to set txrates=%d.\n", word);
|
|
goto failed;
|
|
}
|
|
}
|
|
|
|
/* ibssatimwindow */
|
|
if (msg->bsstype.data != P80211ENUM_bsstype_independent ) {
|
|
WLAN_LOG_INFO0("Setting atimwindow for non-ibss is pointless.\n");
|
|
} else {
|
|
word = msg->ibssatimwindow.data;
|
|
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNATIMWIN, &word);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG1(1, "Unable to set atimwindow=%d.\n", word);
|
|
goto failed;
|
|
}
|
|
}
|
|
|
|
/* The settings below this if statement only apply to infrastructure */
|
|
/* if we're not infrastructure, skip over them */
|
|
if (msg->bsstype.data != P80211ENUM_bsstype_infrastructure ) {
|
|
goto ibss_skip;
|
|
}
|
|
|
|
/* DTIM period */
|
|
word = msg->dtimperiod.data;
|
|
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNDTIMPER, &word);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG1(1, "Unable to set dtim period=%d.\n", word);
|
|
goto failed;
|
|
}
|
|
|
|
/* probedelay */
|
|
WLAN_LOG_INFO0("No setting for probedelay in prism2, skipped.\n");
|
|
|
|
/* cfpollable, cfpollreq, cfpperiod, cfpmaxduration */
|
|
if (msg->cfpollable.data == P80211ENUM_truth_true &&
|
|
msg->cfpollreq.data == P80211ENUM_truth_true ) {
|
|
WLAN_LOG_ERROR0("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_DEBUG0(1, "Unable to read pcfinfo, not supported so skip it.\n");
|
|
goto ibss_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 = 0;
|
|
|
|
if ( msg->cfpperiod.data == P80211ENUM_msgitem_status_data_ok ||
|
|
msg->cfpmaxduration.data == P80211ENUM_msgitem_status_data_ok ) {
|
|
WLAN_LOG_WARNING0(
|
|
"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);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG0(1, "Unable to write pcfinfo, not supported so skip it.\n");
|
|
/* goto failed; */
|
|
}
|
|
|
|
ibss_skip:
|
|
|
|
/* Enable the interrupts */
|
|
word = HFA384x_INTEN_INFDROP_SET(1) |
|
|
HFA384x_INTEN_INFO_SET(1) |
|
|
HFA384x_INTEN_ALLOC_SET(1) |
|
|
HFA384x_INTEN_TXEXC_SET(1) |
|
|
HFA384x_INTEN_TX_SET(1) |
|
|
HFA384x_INTEN_RX_SET(1);
|
|
outw( 0xffff, HFA384x_EVSTAT(priv->hw->iobase));
|
|
outw( word, HFA384x_INTEN(hw->iobase));
|
|
|
|
/* 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;
|
|
word=2304; /* lets extend the data length a bit */
|
|
hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, &word);
|
|
}
|
|
|
|
/* Set the BSSID to the same as our MAC */
|
|
memcpy( wlandev->bssid, wlandev->netdev->dev_addr, WLAN_BSSID_LEN);
|
|
|
|
/* Enable the Port */
|
|
result = hfa384x_cmd_enable(hw, 0);
|
|
if ( result ) {
|
|
WLAN_LOG_DEBUG1(1, "Enable macport failed, result=%d.\n", result);
|
|
goto failed;
|
|
}
|
|
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
goto done;
|
|
failed:
|
|
WLAN_LOG_DEBUG1(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_readpda
|
|
*
|
|
* Collect the PDA 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_readpda(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
p80211msg_p2req_readpda_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
/* This driver really shouldn't be active if we weren't able */
|
|
/* to read a PDA from a card. Therefore, we assume the pda */
|
|
/* in priv->pda is good. */
|
|
memcpy( msg->pda.data, priv->pda, HFA384x_PDA_LEN_MAX);
|
|
msg->pda.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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
p80211msg_p2req_auxport_state_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
|
|
if (msg->enable.data == P80211ENUM_truth_true) {
|
|
if ( hfa384x_cmd_aux_enable(hw) ) {
|
|
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;
|
|
}
|
|
|
|
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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
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, buf, len);
|
|
} else {
|
|
WLAN_LOG_DEBUG0(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;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* 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)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
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, buf, len);
|
|
} else {
|
|
WLAN_LOG_DEBUG0(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;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_ramdl_state
|
|
*
|
|
* Establishes the beginning/end of a card RAM download session.
|
|
*
|
|
* It is expected that the ramdl_write() function will be called
|
|
* one or more times between the 'enable' and 'disable' calls to
|
|
* this function.
|
|
*
|
|
* Note: This function should not be called when a mac comm port
|
|
* is active.
|
|
*
|
|
* 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_ramdl_state(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
p80211msg_p2req_ramdl_state_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
|
|
if ( msg->enable.data == P80211ENUM_truth_true ) {
|
|
if ( hfa384x_drvr_ramdl_enable(hw, msg->exeaddr.data) ) {
|
|
msg->resultcode.data = P80211ENUM_resultcode_implementation_failure;
|
|
} else {
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
}
|
|
} else {
|
|
hfa384x_drvr_ramdl_disable(hw);
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
|
|
/*TODO: Reset everything....the MAC just restarted */
|
|
udelay(1000);
|
|
prism2sta_initmac(wlandev);
|
|
}
|
|
|
|
DBFEXIT;
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_ramdl_write
|
|
*
|
|
* Writes a buffer to the card RAM using the download state. This
|
|
* is for writing code to card RAM. To just read or write raw data
|
|
* use the aux 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_ramdl_write(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
p80211msg_p2req_ramdl_write_t *msg = msgp;
|
|
UINT32 addr;
|
|
UINT32 len;
|
|
UINT8 *buf;
|
|
DBFENTER;
|
|
|
|
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
|
|
/* first validate the length */
|
|
if ( msg->len.data > sizeof(msg->data.data) ) {
|
|
msg->resultcode.status = P80211ENUM_resultcode_invalid_parameters;
|
|
return 0;
|
|
}
|
|
/* call the hfa384x function to do the write */
|
|
addr = msg->addr.data;
|
|
len = msg->len.data;
|
|
buf = msg->data.data;
|
|
if ( hfa384x_drvr_ramdl_write(hw, addr, buf, len) ) {
|
|
msg->resultcode.data = P80211ENUM_resultcode_refused;
|
|
|
|
}
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
|
|
DBFEXIT;
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_flashdl_state
|
|
*
|
|
* Establishes the beginning/end of a card Flash download session.
|
|
*
|
|
* It is expected that the flashdl_write() function will be called
|
|
* one or more times between the 'enable' and 'disable' calls to
|
|
* this function.
|
|
*
|
|
* Note: This function should not be called when a mac comm port
|
|
* is active.
|
|
*
|
|
* 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_flashdl_state(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
p80211msg_p2req_flashdl_state_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
|
|
if ( msg->enable.data == P80211ENUM_truth_true ) {
|
|
if ( hfa384x_drvr_flashdl_enable(hw) ) {
|
|
msg->resultcode.data = P80211ENUM_resultcode_implementation_failure;
|
|
} else {
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
}
|
|
} else {
|
|
hfa384x_drvr_flashdl_disable(hw);
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
|
|
/*TODO: Reset everything....the MAC just restarted */
|
|
udelay(1000);
|
|
prism2sta_initmac(wlandev);
|
|
}
|
|
|
|
DBFEXIT;
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_flashdl_write
|
|
*
|
|
*
|
|
*
|
|
* 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_flashdl_write(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
p80211msg_p2req_flashdl_write_t *msg = msgp;
|
|
UINT32 addr;
|
|
UINT32 len;
|
|
UINT8 *buf;
|
|
DBFENTER;
|
|
|
|
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
|
|
/* first validate the length */
|
|
if ( msg->len.data > sizeof(msg->data.data) ) {
|
|
msg->resultcode.status = P80211ENUM_resultcode_invalid_parameters;
|
|
return 0;
|
|
}
|
|
/* call the hfa384x function to do the write */
|
|
addr = msg->addr.data;
|
|
len = msg->len.data;
|
|
buf = msg->data.data;
|
|
if ( hfa384x_drvr_flashdl_write(hw, addr, buf, len) ) {
|
|
msg->resultcode.data = P80211ENUM_resultcode_refused;
|
|
|
|
}
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
|
|
DBFEXIT;
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_wlansniff
|
|
*
|
|
* Start or stop sniffing.
|
|
*
|
|
* 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_wlansniff(wlandevice_t *wlandev, void *msgp)
|
|
{
|
|
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
|
hfa384x_t *hw = priv->hw;
|
|
int result = 0;
|
|
p80211msg_lnxreq_wlansniff_t *msg = msgp;
|
|
DBFENTER;
|
|
|
|
switch (msg->enable.data)
|
|
{
|
|
case P80211ENUM_truth_false:
|
|
WLAN_LOG_NOTICE0("wlansniff: Don't know how to disable monitor mode");
|
|
/* Set the priv structure to discard monitor frames */
|
|
hfa384x_cmd_monitor(hw, HFA384x_MONITOR_DISABLE);
|
|
priv->sniffing = 0;
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
msg->resultcode.status = 0; /* TODO: Establish data_set constant */
|
|
break;
|
|
case P80211ENUM_truth_true:
|
|
/* Set the priv structure to expect monitor frames */
|
|
priv->sniffing = 1;
|
|
/* Issue the HFA384x monitor command */
|
|
hfa384x_cmd_monitor(hw, HFA384x_MONITOR_ENABLE);
|
|
msg->resultcode.data = P80211ENUM_resultcode_success;
|
|
msg->resultcode.status = 0; /* TODO: Establish data_set constant */
|
|
break;
|
|
default:
|
|
msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
|
|
msg->resultcode.status = 0; /* TODO: Establish data_set constant */
|
|
result = 0;
|
|
}
|
|
|
|
DBFEXIT;
|
|
return result;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_pstr2bytestr
|
|
*
|
|
* Convert the pstr data in the WLAN message structure into an hfa384x
|
|
* byte string format.
|
|
*
|
|
* Arguments:
|
|
* bytestr hfa384x byte string data type
|
|
* pstr wlan message data
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
|
|
void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
|
|
{
|
|
bytestr->len = host2hfa384x_16((UINT16)(pstr->len));
|
|
memcpy(bytestr->data, pstr->data, pstr->len);
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_pstr2bytearea
|
|
*
|
|
* Convert the pstr data in the WLAN message structure into an hfa384x
|
|
* byte area format.
|
|
*
|
|
* Arguments:
|
|
* bytearea hfa384x byte area data type
|
|
* pstr wlan message data
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
|
|
void prism2mgmt_pstr2bytearea(UINT8 *bytearea, p80211pstrd_t *pstr)
|
|
{
|
|
memcpy(bytearea, pstr->data, pstr->len);
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_bytestr2pstr
|
|
*
|
|
* Convert the data in an hfa384x byte string format into a
|
|
* pstr in the WLAN message.
|
|
*
|
|
* Arguments:
|
|
* bytestr hfa384x byte string data type
|
|
* msg wlan message
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
|
|
void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
|
|
{
|
|
pstr->len = (UINT8)(hfa384x2host_16(UINT16)(bytestr->len));
|
|
memcpy(pstr->data, bytestr->data, pstr->len);
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_bytearea2pstr
|
|
*
|
|
* Convert the data in an hfa384x byte area format into a pstr
|
|
* in the WLAN message.
|
|
*
|
|
* Arguments:
|
|
* bytearea hfa384x byte area data type
|
|
* msg wlan message
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
|
|
void prism2mgmt_bytearea2pstr(UINT8 *bytearea, p80211pstrd_t *pstr, int len)
|
|
{
|
|
pstr->len = (UINT8)len;
|
|
memcpy(pstr->data, bytearea, len);
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_prism2int2p80211int
|
|
*
|
|
* Convert an hfa384x integer into a wlan integer
|
|
*
|
|
* Arguments:
|
|
* prism2enum pointer to hfa384x integer
|
|
* wlanenum pointer to p80211 integer
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
|
|
void prism2mgmt_prism2int2p80211int(UINT16 *prism2int, UINT32 *wlanint)
|
|
{
|
|
*wlanint = (UINT32)(*prism2int);
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_p80211int2prism2int
|
|
*
|
|
* Convert a wlan integer into an hfa384x integer
|
|
*
|
|
* Arguments:
|
|
* prism2enum pointer to hfa384x integer
|
|
* wlanenum pointer to p80211 integer
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
|
|
void prism2mgmt_p80211int2prism2int(UINT16 *prism2int, UINT32 *wlanint)
|
|
{
|
|
*prism2int = (UINT16)(*wlanint);
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_prism2enum2p80211enum
|
|
*
|
|
* Convert the hfa384x enumerated int into a p80211 enumerated int
|
|
*
|
|
* Arguments:
|
|
* prism2enum pointer to hfa384x integer
|
|
* wlanenum pointer to p80211 integer
|
|
* rid hfa384x record id
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
void prism2mgmt_prism2enum2p80211enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid)
|
|
{
|
|
/* At the moment, the need for this functionality hasn't
|
|
presented itself. All the wlan enumerated values are
|
|
a 1-to-1 match against the Prism2 enumerated values*/
|
|
return;
|
|
}
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_p80211enum2prism2enum
|
|
*
|
|
* Convert the p80211 enumerated int into an hfa384x enumerated int
|
|
*
|
|
* Arguments:
|
|
* prism2enum pointer to hfa384x integer
|
|
* wlanenum pointer to p80211 integer
|
|
* rid hfa384x record id
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
void prism2mgmt_p80211enum2prism2enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid)
|
|
{
|
|
/* At the moment, the need for this functionality hasn't
|
|
presented itself. All the wlan enumerated values are
|
|
a 1-to-1 match against the Prism2 enumerated values*/
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_GetOperationalRateSet
|
|
*
|
|
* Convert the hfa384x bit area into a wlan octet string.
|
|
*
|
|
* Arguments:
|
|
* rate Prism2 bit area
|
|
* pstr wlan octet string
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
void prism2mgmt_GetOperationalRateSet(UINT16 *rate, p80211pstrd_t *pstr)
|
|
{
|
|
UINT8 len;
|
|
UINT8 *datarate;
|
|
|
|
len = 0;
|
|
datarate = pstr->data;
|
|
|
|
/* 1 Mbps */
|
|
if ( BIT0 & (*rate) ) {
|
|
len += (UINT8)1;
|
|
*datarate = (UINT8)2;
|
|
datarate++;
|
|
}
|
|
|
|
/* 2 Mbps */
|
|
if ( BIT1 & (*rate) ) {
|
|
len += (UINT8)1;
|
|
*datarate = (UINT8)4;
|
|
datarate++;
|
|
}
|
|
|
|
/* 5.5 Mbps */
|
|
if ( BIT2 & (*rate) ) {
|
|
len += (UINT8)1;
|
|
*datarate = (UINT8)11;
|
|
datarate++;
|
|
}
|
|
|
|
/* 11 Mbps */
|
|
if ( BIT3 & (*rate) ) {
|
|
len += (UINT8)1;
|
|
*datarate = (UINT8)22;
|
|
datarate++;
|
|
}
|
|
|
|
pstr->len = len;
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_SetOperationalRateSet
|
|
*
|
|
* Convert the wlan octet string into an hfa384x bit area.
|
|
*
|
|
* Arguments:
|
|
* rate Prism2 bit area
|
|
* pstr wlan octet string
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
void prism2mgmt_SetOperationalRateSet(UINT16 *rate, p80211pstrd_t *pstr)
|
|
{
|
|
UINT8 *datarate;
|
|
int i;
|
|
|
|
*rate = 0;
|
|
|
|
datarate = pstr->data;
|
|
|
|
for ( i=0; i < pstr->len; i++, datarate++ ) {
|
|
switch (*datarate) {
|
|
case 2: /* 1 Mbps */
|
|
*rate |= BIT0;
|
|
break;
|
|
case 4: /* 2 Mbps */
|
|
*rate |= BIT1;
|
|
break;
|
|
case 11: /* 5.5 Mbps */
|
|
*rate |= BIT2;
|
|
break;
|
|
case 22: /* 11 Mbps */
|
|
*rate |= BIT3;
|
|
break;
|
|
default:
|
|
WLAN_LOG_DEBUG1(1, "Unrecoginzed Rate of %d\n",
|
|
*datarate);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_GetGroupAddress
|
|
*
|
|
* Retrieves a particular group address from the list of
|
|
* group addresses.
|
|
*
|
|
* Arguments:
|
|
* did mibitem did
|
|
* pstr wlan octet string
|
|
* priv prism2 driver private data structure
|
|
*
|
|
* Returns:
|
|
* Nothing
|
|
*
|
|
----------------------------------------------------------------*/
|
|
void prism2mgmt_GetGroupAddress(UINT32 did, p80211pstrd_t *pstr,
|
|
prism2sta_priv_t *priv )
|
|
{
|
|
int index;
|
|
|
|
index = GetGroupAddressIndex(did);
|
|
|
|
if ( index >= 0 ) {
|
|
pstr->len = WLAN_ADDR_LEN;
|
|
memcpy(pstr->data, priv->GroupAddresses[index],
|
|
WLAN_ADDR_LEN);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_SetGroupAddress
|
|
*
|
|
* Convert the wlan octet string into an hfa384x bit area.
|
|
*
|
|
* Arguments:
|
|
* did mibitem did
|
|
* buf
|
|
* groups
|
|
*
|
|
* Returns:
|
|
* 0 Success
|
|
* !0 Error
|
|
*
|
|
----------------------------------------------------------------*/
|
|
int prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *prism2buf,
|
|
p80211pstrd_t *pstr, prism2sta_priv_t *priv )
|
|
{
|
|
UINT8 no_addr[WLAN_ADDR_LEN];
|
|
int index;
|
|
int result;
|
|
|
|
memset(no_addr, 0, WLAN_ADDR_LEN);
|
|
result = 0;
|
|
|
|
/* here we're "adding" an address to the group
|
|
address list. Check to make sure we aren't
|
|
trying to add more than the maximum allowed
|
|
number of group addresses in the list */
|
|
if ( memcmp(no_addr, pstr->data, WLAN_ADDR_LEN) != 0) {
|
|
if ( priv->grpcnt < MAX_GRP_ADDR ) {
|
|
memcpy( priv->GroupAddresses[priv->grpcnt],
|
|
pstr->data, WLAN_ADDR_LEN);
|
|
priv->grpcnt += 1;
|
|
} else {
|
|
result = -1;
|
|
}
|
|
} else {
|
|
/* here we're "deleting" an address from the
|
|
group address list. Check to make sure we're
|
|
not trying to delete from an empty list */
|
|
if ( priv->grpcnt > 0 ) {
|
|
index = GetGroupAddressIndex(did);
|
|
|
|
if ( index >= 0 ) {
|
|
/* check to make sure there is an address
|
|
to delete at the requested group address */
|
|
if ( memcmp(priv->GroupAddresses[index],
|
|
no_addr,
|
|
WLAN_ADDR_LEN) != 0) {
|
|
|
|
priv->grpcnt -= 1;
|
|
/* shift all the addresses following
|
|
the one to delete */
|
|
memcpy( priv->GroupAddresses[index],
|
|
priv->GroupAddresses[index + 1],
|
|
((priv->grpcnt)-index) * WLAN_ADDR_LEN);
|
|
/* erase the last address that now appears
|
|
twice */
|
|
memcpy( priv->GroupAddresses[priv->grpcnt],
|
|
no_addr,
|
|
WLAN_ADDR_LEN);
|
|
}
|
|
}
|
|
} else {
|
|
result = -1;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------
|
|
* prism2mgmt_GetGroupAddressIndex
|
|
*
|
|
* Gets the index in the group address list based on the did.
|
|
*
|
|
* Arguments:
|
|
* did mibitem did
|
|
*
|
|
* Returns:
|
|
* >= 0 If valid did
|
|
* < 0 If not valid did
|
|
*
|
|
----------------------------------------------------------------*/
|
|
int GetGroupAddressIndex( UINT32 did )
|
|
{
|
|
int index;
|
|
|
|
index = -1;
|
|
|
|
switch (did) {
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1:
|
|
index = 0;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2:
|
|
index = 1;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3:
|
|
index = 2;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4:
|
|
index = 3;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5:
|
|
index = 4;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6:
|
|
index = 5;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7:
|
|
index = 6;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8:
|
|
index = 7;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9:
|
|
index = 8;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10:
|
|
index = 9;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11:
|
|
index = 10;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12:
|
|
index = 11;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13:
|
|
index = 12;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14:
|
|
index = 13;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15:
|
|
index = 14;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16:
|
|
index = 15;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17:
|
|
index = 16;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18:
|
|
index = 17;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19:
|
|
index = 18;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20:
|
|
index = 19;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21:
|
|
index = 20;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22:
|
|
index = 21;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23:
|
|
index = 22;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24:
|
|
index = 23;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25:
|
|
index = 24;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26:
|
|
index = 25;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27:
|
|
index = 26;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28:
|
|
index = 27;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29:
|
|
index = 28;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30:
|
|
index = 29;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31:
|
|
index = 30;
|
|
break;
|
|
case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32:
|
|
index = 31;
|
|
break;
|
|
}
|
|
|
|
return index;
|
|
}
|