Commit afbd545d authored by Dragoslav Zaric's avatar Dragoslav Zaric Committed by Greg Kroah-Hartman

Staging: otus: 80211core/ccmd.c: Fix Coding Style

Signed-off-by: default avatarDragoslav Zaric <dragoslav.zaric.kd@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7690e63d
...@@ -27,20 +27,20 @@ ...@@ -27,20 +27,20 @@
#include "../hal/hpreg.h" #include "../hal/hpreg.h"
u16_t zfWlanReset(zdev_t* dev); u16_t zfWlanReset(zdev_t *dev);
u32_t zfUpdateRxRate(zdev_t* dev); u32_t zfUpdateRxRate(zdev_t *dev);
extern void zfiUsbRecv(zdev_t *dev, zbuf_t *buf); extern void zfiUsbRecv(zdev_t *dev, zbuf_t *buf);
extern void zfiUsbRegIn(zdev_t* dev, u32_t* rsp, u16_t rspLen); extern void zfiUsbRegIn(zdev_t *dev, u32_t *rsp, u16_t rspLen);
extern void zfiUsbOutComplete(zdev_t* dev, zbuf_t *buf, u8_t status, u8_t *hdr); extern void zfiUsbOutComplete(zdev_t *dev, zbuf_t *buf, u8_t status, u8_t *hdr);
extern void zfiUsbRegOutComplete(zdev_t* dev); extern void zfiUsbRegOutComplete(zdev_t *dev);
extern u16_t zfHpReinit(zdev_t* dev, u32_t frequency); extern u16_t zfHpReinit(zdev_t *dev, u32_t frequency);
/* Get size (byte) of driver core global data structure. */ /* Get size (byte) of driver core global data structure. */
/* This size will be used by driver wrapper to allocate */ /* This size will be used by driver wrapper to allocate */
/* a memory space for driver core to store global variables */ /* a memory space for driver core to store global variables */
u16_t zfiGlobalDataSize(zdev_t* dev) u16_t zfiGlobalDataSize(zdev_t *dev)
{ {
u32_t ret; u32_t ret;
ret = (sizeof(struct zsWlanDev)); ret = (sizeof(struct zsWlanDev));
...@@ -51,12 +51,13 @@ u16_t zfiGlobalDataSize(zdev_t* dev) ...@@ -51,12 +51,13 @@ u16_t zfiGlobalDataSize(zdev_t* dev)
/* Initialize WLAN hardware and software, resource will be allocated */ /* Initialize WLAN hardware and software, resource will be allocated */
/* for WLAN operation, must be called first before other function. */ /* for WLAN operation, must be called first before other function. */
extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) extern u16_t zfiWlanOpen(zdev_t *dev, struct zsCbFuncTbl *cbFuncTbl)
{ {
//u16_t ret; /* u16_t ret;
//u32_t i; u32_t i;
//u8_t* ch; u8_t* ch;
//u8_t bPassive; u8_t bPassive;
*/
u32_t devSize; u32_t devSize;
struct zfCbUsbFuncTbl cbUsbFuncTbl; struct zfCbUsbFuncTbl cbUsbFuncTbl;
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -65,7 +66,7 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -65,7 +66,7 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
devSize = sizeof(struct zsWlanDev); devSize = sizeof(struct zsWlanDev);
/* Zeroize zsWlanDev struct */ /* Zeroize zsWlanDev struct */
zfZeroMemory((u8_t*)wd, (u16_t)devSize); zfZeroMemory((u8_t *)wd, (u16_t)devSize);
#ifdef ZM_ENABLE_AGGREGATION #ifdef ZM_ENABLE_AGGREGATION
zfAggInit(dev); zfAggInit(dev);
...@@ -77,15 +78,11 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -77,15 +78,11 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
wd->commTally.RateCtrlBAFail = 0; wd->commTally.RateCtrlBAFail = 0;
wd->preambleTypeInUsed = ZM_PREAMBLE_TYPE_SHORT; wd->preambleTypeInUsed = ZM_PREAMBLE_TYPE_SHORT;
if (cbFuncTbl == NULL) if (cbFuncTbl == NULL) {
{
/* zfcbRecvEth() is mandatory */ /* zfcbRecvEth() is mandatory */
zm_assert(0); zm_assert(0);
} } else {
else if (cbFuncTbl->zfcbRecvEth == NULL) {
{
if (cbFuncTbl->zfcbRecvEth == NULL)
{
/* zfcbRecvEth() is mandatory */ /* zfcbRecvEth() is mandatory */
zm_assert(0); zm_assert(0);
} }
...@@ -100,18 +97,19 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -100,18 +97,19 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
wd->zfcbApMicFailureNotify = cbFuncTbl->zfcbApMicFailureNotify; wd->zfcbApMicFailureNotify = cbFuncTbl->zfcbApMicFailureNotify;
wd->zfcbIbssPartnerNotify = cbFuncTbl->zfcbIbssPartnerNotify; wd->zfcbIbssPartnerNotify = cbFuncTbl->zfcbIbssPartnerNotify;
wd->zfcbMacAddressNotify = cbFuncTbl->zfcbMacAddressNotify; wd->zfcbMacAddressNotify = cbFuncTbl->zfcbMacAddressNotify;
wd->zfcbSendCompleteIndication = cbFuncTbl->zfcbSendCompleteIndication; wd->zfcbSendCompleteIndication =
cbFuncTbl->zfcbSendCompleteIndication;
wd->zfcbRecvEth = cbFuncTbl->zfcbRecvEth; wd->zfcbRecvEth = cbFuncTbl->zfcbRecvEth;
wd->zfcbRestoreBufData = cbFuncTbl->zfcbRestoreBufData; wd->zfcbRestoreBufData = cbFuncTbl->zfcbRestoreBufData;
wd->zfcbRecv80211 = cbFuncTbl->zfcbRecv80211; wd->zfcbRecv80211 = cbFuncTbl->zfcbRecv80211;
#ifdef ZM_ENABLE_CENC #ifdef ZM_ENABLE_CENC
wd->zfcbCencAsocNotify = cbFuncTbl->zfcbCencAsocNotify; wd->zfcbCencAsocNotify = cbFuncTbl->zfcbCencAsocNotify;
#endif //ZM_ENABLE_CENC #endif /* ZM_ENABLE_CENC */
wd->zfcbClassifyTxPacket = cbFuncTbl->zfcbClassifyTxPacket; wd->zfcbClassifyTxPacket = cbFuncTbl->zfcbClassifyTxPacket;
wd->zfcbHwWatchDogNotify = cbFuncTbl->zfcbHwWatchDogNotify; wd->zfcbHwWatchDogNotify = cbFuncTbl->zfcbHwWatchDogNotify;
} }
//add by honda 0330 /* add by honda 0330 */
cbUsbFuncTbl.zfcbUsbRecv = zfiUsbRecv; cbUsbFuncTbl.zfcbUsbRecv = zfiUsbRecv;
cbUsbFuncTbl.zfcbUsbRegIn = zfiUsbRegIn; cbUsbFuncTbl.zfcbUsbRegIn = zfiUsbRegIn;
cbUsbFuncTbl.zfcbUsbOutComplete = zfiUsbOutComplete; cbUsbFuncTbl.zfcbUsbOutComplete = zfiUsbOutComplete;
...@@ -127,16 +125,16 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -127,16 +125,16 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
zfHpInit(dev, wd->frequency); zfHpInit(dev, wd->frequency);
/* init region code */ /* init region code */
//wd->regulationTable.regionCode = NULL1_WORLD; //Only 2.4g RegCode /* wd->regulationTable.regionCode = NULL1_WORLD; //Only 2.4g RegCode */
//zfHpGetRegulationTablefromRegionCode(dev, NULL1_WORLD); /* zfHpGetRegulationTablefromRegionCode(dev, NULL1_WORLD); */
//zfiWlanSetDot11DMode(dev , 1); // Enable 802.11d /* zfiWlanSetDot11DMode(dev , 1); //Enable 802.11d */
/* Get the first channel */ /* Get the first channel */
//wd->frequency = zfChGetFirstChannel(dev, &bPassive); /* wd->frequency = zfChGetFirstChannel(dev, &bPassive); */
#ifdef ZM_AP_DEBUG #ifdef ZM_AP_DEBUG
//wd->frequency = 2437; /* wd->frequency = 2437; */
#endif #endif
//STA mode /* STA mode */
wd->sta.mTxRate = 0x0; wd->sta.mTxRate = 0x0;
wd->sta.uTxRate = 0x3; wd->sta.uTxRate = 0x3;
wd->sta.mmTxRate = 0x0; wd->sta.mmTxRate = 0x0;
...@@ -149,18 +147,22 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -149,18 +147,22 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
wd->sta.htCtrlSTBC = 0; wd->sta.htCtrlSTBC = 0;
wd->sta.htCtrlSG = 0; wd->sta.htCtrlSG = 0;
wd->sta.defaultTA = 0; wd->sta.defaultTA = 0;
//wd->sta.activescanTickPerChannel = ZM_TIME_ACTIVE_SCAN/ZM_MS_PER_TICK; /*wd->sta.activescanTickPerChannel =
*ZM_TIME_ACTIVE_SCAN/ZM_MS_PER_TICK;
*/
{ {
u8_t Dur = ZM_TIME_ACTIVE_SCAN; u8_t Dur = ZM_TIME_ACTIVE_SCAN;
zfwGetActiveScanDur(dev, &Dur); zfwGetActiveScanDur(dev, &Dur);
wd->sta.activescanTickPerChannel = Dur/ZM_MS_PER_TICK; wd->sta.activescanTickPerChannel = Dur / ZM_MS_PER_TICK;
} }
wd->sta.passiveScanTickPerChannel = ZM_TIME_PASSIVE_SCAN/ZM_MS_PER_TICK; wd->sta.passiveScanTickPerChannel = ZM_TIME_PASSIVE_SCAN/ZM_MS_PER_TICK;
wd->sta.bAutoReconnect = TRUE; wd->sta.bAutoReconnect = TRUE;
wd->sta.dropUnencryptedPkts = FALSE; wd->sta.dropUnencryptedPkts = FALSE;
/* set default to bypass all multicast packet for linux, window XP would set 0 by wrapper initialization */ /* set default to bypass all multicast packet for linux,
* window XP would set 0 by wrapper initialization
*/
wd->sta.bAllMulticast = 1; wd->sta.bAllMulticast = 1;
/* Initial the RIFS Status / RIFS-like frame count / RIFS count */ /* Initial the RIFS Status / RIFS-like frame count / RIFS count */
...@@ -171,15 +173,15 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -171,15 +173,15 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
wd->sta.osRxFilter = 0; wd->sta.osRxFilter = 0;
wd->sta.bSafeMode = 0; wd->sta.bSafeMode = 0;
//Common /* Common */
zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_DISCONNECT); zfResetSupportRate(dev, ZM_DEFAULT_SUPPORT_RATE_DISCONNECT);
wd->beaconInterval = 100; wd->beaconInterval = 100;
wd->rtsThreshold = 2346; wd->rtsThreshold = 2346;
wd->fragThreshold = 32767; wd->fragThreshold = 32767;
wd->wlanMode = ZM_MODE_INFRASTRUCTURE; wd->wlanMode = ZM_MODE_INFRASTRUCTURE;
wd->txMCS = 0xff; //AUTO wd->txMCS = 0xff; /* AUTO */
wd->dtim = 1; wd->dtim = 1;
//wd->txMT = 1; //OFDM /* wd->txMT = 1; *//*OFDM */
wd->tick = 1; wd->tick = 1;
wd->maxTxPower2 = 0xff; wd->maxTxPower2 = 0xff;
wd->maxTxPower5 = 0xff; wd->maxTxPower5 = 0xff;
...@@ -187,8 +189,8 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -187,8 +189,8 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
wd->ws.adhocMode = ZM_ADHOCBAND_G; wd->ws.adhocMode = ZM_ADHOCBAND_G;
wd->ws.autoSetFrequency = 0xff; wd->ws.autoSetFrequency = 0xff;
//AP mode /* AP mode */
//wd->bgMode = wd->ws.bgMode; /* wd->bgMode = wd->ws.bgMode; */
wd->ap.ssidLen[0] = 6; wd->ap.ssidLen[0] = 6;
wd->ap.ssid[0][0] = 'Z'; wd->ap.ssid[0][0] = 'Z';
wd->ap.ssid[0][1] = 'D'; wd->ap.ssid[0][1] = 'D';
...@@ -197,40 +199,41 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -197,40 +199,41 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
wd->ap.ssid[0][4] = '2'; wd->ap.ssid[0][4] = '2';
wd->ap.ssid[0][5] = '1'; wd->ap.ssid[0][5] = '1';
// Init the country iso name as NA /* Init the country iso name as NA */
wd->ws.countryIsoName[0] = 0; wd->ws.countryIsoName[0] = 0;
wd->ws.countryIsoName[1] = 0; wd->ws.countryIsoName[1] = 0;
wd->ws.countryIsoName[2] = '\0'; wd->ws.countryIsoName[2] = '\0';
/* init fragmentation is disabled */ /* init fragmentation is disabled */
//zfiWlanSetFragThreshold(dev, 0); /* zfiWlanSetFragThreshold(dev, 0); */
/* airopeek : swSniffer 1=>on 0=>off */ /* airopeek : swSniffer 1=>on 0=>off */
wd->swSniffer = 0; wd->swSniffer = 0;
wd->XLinkMode = 0; wd->XLinkMode = 0;
// jhlee HT 0 /* jhlee HT 0 */
#if 1 #if 1
/* AP Mode*/ /* AP Mode*/
/* Init HT Capability Info */ /* Init HT Capability Info */
wd->ap.HTCap.Data.ElementID = ZM_WLAN_EID_HT_CAPABILITY; wd->ap.HTCap.Data.ElementID = ZM_WLAN_EID_HT_CAPABILITY;
wd->ap.HTCap.Data.Length = 26; wd->ap.HTCap.Data.Length = 26;
//wd->ap.HTCap.Data.SupChannelWidthSet = 0; /*wd->ap.HTCap.Data.SupChannelWidthSet = 0;
//wd->ap.HTCap.Data.MIMOPowerSave = 3; wd->ap.HTCap.Data.MIMOPowerSave = 3;
//wd->ap.HTCap.Data.ShortGIfor40MHz = 0; wd->ap.HTCap.Data.ShortGIfor40MHz = 0;
//wd->ap.HTCap.Data.ShortGIfor20MHz = 0; wd->ap.HTCap.Data.ShortGIfor20MHz = 0;
//wd->ap.HTCap.Data.DSSSandCCKin40MHz = 0; wd->ap.HTCap.Data.DSSSandCCKin40MHz = 0;
*/
wd->ap.HTCap.Data.AMPDUParam |= HTCAP_MaxRxAMPDU3; wd->ap.HTCap.Data.AMPDUParam |= HTCAP_MaxRxAMPDU3;
wd->ap.HTCap.Data.MCSSet[0] = 0xFF; // MCS 0 ~ 7 wd->ap.HTCap.Data.MCSSet[0] = 0xFF; /* MCS 0 ~ 7 */
wd->ap.HTCap.Data.MCSSet[1] = 0xFF; // MCS 8 ~ 15 wd->ap.HTCap.Data.MCSSet[1] = 0xFF; /* MCS 8 ~ 15 */
/* Init Extended HT Capability Info */ /* Init Extended HT Capability Info */
wd->ap.ExtHTCap.Data.ElementID = ZM_WLAN_EID_EXTENDED_HT_CAPABILITY; wd->ap.ExtHTCap.Data.ElementID = ZM_WLAN_EID_EXTENDED_HT_CAPABILITY;
wd->ap.ExtHTCap.Data.Length = 22; wd->ap.ExtHTCap.Data.Length = 22;
wd->ap.ExtHTCap.Data.ControlChannel = 6; wd->ap.ExtHTCap.Data.ControlChannel = 6;
//wd->ap.ExtHTCap.Data.ExtChannelOffset = 3; /* wd->ap.ExtHTCap.Data.ExtChannelOffset = 3; */
wd->ap.ExtHTCap.Data.ChannelInfo |= ExtHtCap_RecomTxWidthSet; wd->ap.ExtHTCap.Data.ChannelInfo |= ExtHtCap_RecomTxWidthSet;
//wd->ap.ExtHTCap.Data.RIFSMode = 1; /* wd->ap.ExtHTCap.Data.RIFSMode = 1; */
wd->ap.ExtHTCap.Data.OperatingInfo |= 1; wd->ap.ExtHTCap.Data.OperatingInfo |= 1;
/* STA Mode*/ /* STA Mode*/
...@@ -239,7 +242,7 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -239,7 +242,7 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
wd->sta.HTCap.Data.Length = 26; wd->sta.HTCap.Data.Length = 26;
/* Test with 5G-AP : 7603 */ /* Test with 5G-AP : 7603 */
//wd->sta.HTCap.Data.SupChannelWidthSet = 1; /* wd->sta.HTCap.Data.SupChannelWidthSet = 1; */
wd->sta.HTCap.Data.HtCapInfo |= HTCAP_SMEnabled; wd->sta.HTCap.Data.HtCapInfo |= HTCAP_SMEnabled;
wd->sta.HTCap.Data.HtCapInfo |= HTCAP_SupChannelWidthSet; wd->sta.HTCap.Data.HtCapInfo |= HTCAP_SupChannelWidthSet;
wd->sta.HTCap.Data.HtCapInfo |= HTCAP_ShortGIfor40MHz; wd->sta.HTCap.Data.HtCapInfo |= HTCAP_ShortGIfor40MHz;
...@@ -247,25 +250,26 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -247,25 +250,26 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
#ifndef ZM_DISABLE_AMSDU8K_SUPPORT #ifndef ZM_DISABLE_AMSDU8K_SUPPORT
wd->sta.HTCap.Data.HtCapInfo |= HTCAP_MaxAMSDULength; wd->sta.HTCap.Data.HtCapInfo |= HTCAP_MaxAMSDULength;
#endif #endif
//wd->sta.HTCap.Data.MIMOPowerSave = 0; /*wd->sta.HTCap.Data.MIMOPowerSave = 0;
//wd->sta.HTCap.Data.ShortGIfor40MHz = 0; wd->sta.HTCap.Data.ShortGIfor40MHz = 0;
//wd->sta.HTCap.Data.ShortGIfor20MHz = 0; wd->sta.HTCap.Data.ShortGIfor20MHz = 0;
//wd->sta.HTCap.Data.DSSSandCCKin40MHz = 0; wd->sta.HTCap.Data.DSSSandCCKin40MHz = 0;
*/
wd->sta.HTCap.Data.AMPDUParam |= HTCAP_MaxRxAMPDU3; wd->sta.HTCap.Data.AMPDUParam |= HTCAP_MaxRxAMPDU3;
wd->sta.HTCap.Data.MCSSet[0] = 0xFF; // MCS 0 ~ 7 wd->sta.HTCap.Data.MCSSet[0] = 0xFF; /* MCS 0 ~ 7 */
wd->sta.HTCap.Data.MCSSet[1] = 0xFF; // MCS 8 ~ 15 wd->sta.HTCap.Data.MCSSet[1] = 0xFF; /* MCS 8 ~ 15 */
wd->sta.HTCap.Data.PCO |= HTCAP_TransmissionTime3; wd->sta.HTCap.Data.PCO |= HTCAP_TransmissionTime3;
//wd->sta.HTCap.Data.TransmissionTime = 0; /* wd->sta.HTCap.Data.TransmissionTime = 0; */
/* Init Extended HT Capability Info */ /* Init Extended HT Capability Info */
wd->sta.ExtHTCap.Data.ElementID = ZM_WLAN_EID_EXTENDED_HT_CAPABILITY; wd->sta.ExtHTCap.Data.ElementID = ZM_WLAN_EID_EXTENDED_HT_CAPABILITY;
wd->sta.ExtHTCap.Data.Length = 22; wd->sta.ExtHTCap.Data.Length = 22;
wd->sta.ExtHTCap.Data.ControlChannel = 6; wd->sta.ExtHTCap.Data.ControlChannel = 6;
//wd->sta.ExtHTCap.Data.ExtChannelOffset |= 3; /* wd->sta.ExtHTCap.Data.ExtChannelOffset |= 3; */
wd->sta.ExtHTCap.Data.ChannelInfo |= ExtHtCap_ExtChannelOffsetBelow; wd->sta.ExtHTCap.Data.ChannelInfo |= ExtHtCap_ExtChannelOffsetBelow;
//wd->sta.ExtHTCap.Data.RecomTxWidthSet = 1; /* wd->sta.ExtHTCap.Data.RecomTxWidthSet = 1; */
//wd->sta.ExtHTCap.Data.RIFSMode = 1; /* wd->sta.ExtHTCap.Data.RIFSMode = 1; */
wd->sta.ExtHTCap.Data.OperatingInfo |= 1; wd->sta.ExtHTCap.Data.OperatingInfo |= 1;
#endif #endif
...@@ -290,24 +294,25 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -290,24 +294,25 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
{ {
u32_t key[4] = {0xffffffff, 0xff, 0, 0}; u32_t key[4] = {0xffffffff, 0xff, 0, 0};
u16_t addr[3] = {0x8000, 0x01ab, 0x0000}; u16_t addr[3] = {0x8000, 0x01ab, 0x0000};
//zfSetKey(dev, 0, 0, ZM_WEP64, addr, key); /*zfSetKey(dev, 0, 0, ZM_WEP64, addr, key);
//zfSetKey(dev, 0, 0, ZM_AES, addr, key); zfSetKey(dev, 0, 0, ZM_AES, addr, key);
//zfSetKey(dev, 64, 0, 1, wd->macAddr, key); zfSetKey(dev, 64, 0, 1, wd->macAddr, key);
*/
} }
#endif #endif
// WME settings /* WME settings */
wd->ws.staWmeEnabled = 1; // Enable WME by default wd->ws.staWmeEnabled = 1; /* Enable WME by default */
#define ZM_UAPSD_Q_SIZE 32 //2^N #define ZM_UAPSD_Q_SIZE 32 /* 2^N */
wd->ap.uapsdQ = zfQueueCreate(dev, ZM_UAPSD_Q_SIZE); wd->ap.uapsdQ = zfQueueCreate(dev, ZM_UAPSD_Q_SIZE);
zm_assert(wd->ap.uapsdQ != NULL); zm_assert(wd->ap.uapsdQ != NULL);
wd->sta.uapsdQ = zfQueueCreate(dev, ZM_UAPSD_Q_SIZE); wd->sta.uapsdQ = zfQueueCreate(dev, ZM_UAPSD_Q_SIZE);
zm_assert(wd->sta.uapsdQ != NULL); zm_assert(wd->sta.uapsdQ != NULL);
//zfHpInit(dev, wd->frequency); /* zfHpInit(dev, wd->frequency); */
/* MAC address */ /* MAC address */
//zfHpSetMacAddress(dev, wd->macAddr, 0); /* zfHpSetMacAddress(dev, wd->macAddr, 0); */
zfHpGetMacAddress(dev); zfHpGetMacAddress(dev);
zfCoreSetFrequency(dev, wd->frequency); zfCoreSetFrequency(dev, wd->frequency);
...@@ -316,13 +321,13 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -316,13 +321,13 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
zfwWriteReg(dev, ZM_REG_PCI_CONTROL, 6); zfwWriteReg(dev, ZM_REG_PCI_CONTROL, 6);
#endif /* #if ZM_PCI_LOOP_BACK == 1 */ #endif /* #if ZM_PCI_LOOP_BACK == 1 */
//zfiWlanSetDot11DMode(dev , 1); // Enable 802.11d /* zfiWlanSetDot11DMode(dev , 1); // Enable 802.11d */
//zfiWlanSetDot11HDFSMode(dev , 1); // Enable 802.11h DFS /* zfiWlanSetDot11HDFSMode(dev , 1); // Enable 802.11h DFS */
wd->sta.DFSEnable = 1; wd->sta.DFSEnable = 1;
wd->sta.capability[1] |= ZM_BIT_0; wd->sta.capability[1] |= ZM_BIT_0;
//zfiWlanSetFrequency(dev, 5260000, TRUE); /* zfiWlanSetFrequency(dev, 5260000, TRUE); */
//zfiWlanSetAniMode(dev , 1); // Enable ANI /* zfiWlanSetAniMode(dev , 1); // Enable ANI */
/* Trgger Rx DMA */ /* Trgger Rx DMA */
zfHpStartRecv(dev); zfHpStartRecv(dev);
...@@ -333,7 +338,7 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl) ...@@ -333,7 +338,7 @@ extern u16_t zfiWlanOpen(zdev_t* dev, struct zsCbFuncTbl* cbFuncTbl)
} }
/* WLAN hardware will be shutdown and all resource will be release */ /* WLAN hardware will be shutdown and all resource will be release */
u16_t zfiWlanClose(zdev_t* dev) u16_t zfiWlanClose(zdev_t *dev)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -341,7 +346,7 @@ u16_t zfiWlanClose(zdev_t* dev) ...@@ -341,7 +346,7 @@ u16_t zfiWlanClose(zdev_t* dev)
wd->state = ZM_WLAN_STATE_CLOSEDED; wd->state = ZM_WLAN_STATE_CLOSEDED;
//zfiWlanDisable(dev, 1); /* zfiWlanDisable(dev, 1); */
zfWlanReset(dev); zfWlanReset(dev);
zfHpStopRecv(dev); zfHpStopRecv(dev);
...@@ -359,7 +364,7 @@ u16_t zfiWlanClose(zdev_t* dev) ...@@ -359,7 +364,7 @@ u16_t zfiWlanClose(zdev_t* dev)
#ifdef ZM_ENABLE_AGGREGATION #ifdef ZM_ENABLE_AGGREGATION
/* add by honda */ /* add by honda */
zfAggRxFreeBuf(dev, 1); //1 for release structure memory zfAggRxFreeBuf(dev, 1); /* 1 for release structure memory */
/* end of add by honda */ /* end of add by honda */
#endif #endif
...@@ -368,7 +373,7 @@ u16_t zfiWlanClose(zdev_t* dev) ...@@ -368,7 +373,7 @@ u16_t zfiWlanClose(zdev_t* dev)
return 0; return 0;
} }
void zfGetWrapperSetting(zdev_t* dev) void zfGetWrapperSetting(zdev_t *dev)
{ {
u8_t bPassive; u8_t bPassive;
u16_t vapId = 0; u16_t vapId = 0;
...@@ -377,13 +382,11 @@ void zfGetWrapperSetting(zdev_t* dev) ...@@ -377,13 +382,11 @@ void zfGetWrapperSetting(zdev_t* dev)
zmw_declare_for_critical_section(); zmw_declare_for_critical_section();
#if 0 #if 0
if ( (wd->ws.countryIsoName[0] != 0) if ((wd->ws.countryIsoName[0] != 0)
|| (wd->ws.countryIsoName[1] != 0) || (wd->ws.countryIsoName[1] != 0)
|| (wd->ws.countryIsoName[2] != '\0') ) || (wd->ws.countryIsoName[2] != '\0')) {
{ zfHpGetRegulationTablefromRegionCode(dev,
zfHpGetRegulationTablefromRegionCode( zfHpGetRegionCodeFromIsoName(dev, wd->ws.countryIsoName));
dev,
zfHpGetRegionCodeFromIsoName(dev, wd->ws.countryIsoName) );
} }
#endif #endif
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
...@@ -391,27 +394,19 @@ void zfGetWrapperSetting(zdev_t* dev) ...@@ -391,27 +394,19 @@ void zfGetWrapperSetting(zdev_t* dev)
wd->wlanMode = wd->ws.wlanMode; wd->wlanMode = wd->ws.wlanMode;
/* set channel */ /* set channel */
if ( wd->ws.frequency ) if (wd->ws.frequency) {
{
wd->frequency = wd->ws.frequency; wd->frequency = wd->ws.frequency;
wd->ws.frequency = 0; wd->ws.frequency = 0;
} } else {
else
{
wd->frequency = zfChGetFirstChannel(dev, &bPassive); wd->frequency = zfChGetFirstChannel(dev, &bPassive);
if ( wd->wlanMode == ZM_MODE_IBSS ) if (wd->wlanMode == ZM_MODE_IBSS) {
{
if (wd->ws.adhocMode == ZM_ADHOCBAND_A) if (wd->ws.adhocMode == ZM_ADHOCBAND_A)
{
wd->frequency = ZM_CH_A_36; wd->frequency = ZM_CH_A_36;
}
else else
{
wd->frequency = ZM_CH_G_6; wd->frequency = ZM_CH_G_6;
} }
} }
}
#ifdef ZM_AP_DEBUG #ifdef ZM_AP_DEBUG
/* honda add for debug, 2437 channel 6, 2452 channel 9 */ /* honda add for debug, 2437 channel 6, 2452 channel 9 */
wd->frequency = 2437; wd->frequency = 2437;
...@@ -419,8 +414,7 @@ void zfGetWrapperSetting(zdev_t* dev) ...@@ -419,8 +414,7 @@ void zfGetWrapperSetting(zdev_t* dev)
#endif #endif
/* set preamble type */ /* set preamble type */
switch (wd->ws.preambleType) switch (wd->ws.preambleType) {
{
case ZM_PREAMBLE_TYPE_AUTO: case ZM_PREAMBLE_TYPE_AUTO:
case ZM_PREAMBLE_TYPE_SHORT: case ZM_PREAMBLE_TYPE_SHORT:
case ZM_PREAMBLE_TYPE_LONG: case ZM_PREAMBLE_TYPE_LONG:
...@@ -432,17 +426,13 @@ void zfGetWrapperSetting(zdev_t* dev) ...@@ -432,17 +426,13 @@ void zfGetWrapperSetting(zdev_t* dev)
} }
wd->ws.preambleType = 0; wd->ws.preambleType = 0;
if ( wd->wlanMode == ZM_MODE_AP ) if (wd->wlanMode == ZM_MODE_AP) {
{
vapId = zfwGetVapId(dev); vapId = zfwGetVapId(dev);
if (vapId == 0xffff) if (vapId == 0xffff) {
{
wd->ap.authAlgo[0] = wd->ws.authMode; wd->ap.authAlgo[0] = wd->ws.authMode;
wd->ap.encryMode[0] = wd->ws.encryMode; wd->ap.encryMode[0] = wd->ws.encryMode;
} } else {
else
{
wd->ap.authAlgo[vapId + 1] = wd->ws.authMode; wd->ap.authAlgo[vapId + 1] = wd->ws.authMode;
wd->ap.encryMode[vapId + 1] = wd->ws.encryMode; wd->ap.encryMode[vapId + 1] = wd->ws.encryMode;
} }
...@@ -450,112 +440,93 @@ void zfGetWrapperSetting(zdev_t* dev) ...@@ -450,112 +440,93 @@ void zfGetWrapperSetting(zdev_t* dev)
wd->ws.encryMode = ZM_NO_WEP; wd->ws.encryMode = ZM_NO_WEP;
/* Get beaconInterval from WrapperSetting */ /* Get beaconInterval from WrapperSetting */
if ((wd->ws.beaconInterval >= 20) && (wd->ws.beaconInterval <= 1000)) if ((wd->ws.beaconInterval >= 20) &&
{ (wd->ws.beaconInterval <= 1000))
wd->beaconInterval = wd->ws.beaconInterval; wd->beaconInterval = wd->ws.beaconInterval;
}
else else
{ wd->beaconInterval = 100; /* 100ms */
wd->beaconInterval = 100; //100ms
}
if (wd->ws.dtim > 0) if (wd->ws.dtim > 0)
{
wd->dtim = wd->ws.dtim; wd->dtim = wd->ws.dtim;
}
else else
{
wd->dtim = 1; wd->dtim = 1;
}
wd->ap.qosMode = wd->ws.apWmeEnabled & 0x1; wd->ap.qosMode = wd->ws.apWmeEnabled & 0x1;
wd->ap.uapsdEnabled = (wd->ws.apWmeEnabled & 0x2) >> 1; wd->ap.uapsdEnabled = (wd->ws.apWmeEnabled & 0x2) >> 1;
} } else {
else
{
wd->sta.authMode = wd->ws.authMode; wd->sta.authMode = wd->ws.authMode;
wd->sta.currentAuthMode = wd->ws.authMode; wd->sta.currentAuthMode = wd->ws.authMode;
wd->sta.wepStatus = wd->ws.wepStatus; wd->sta.wepStatus = wd->ws.wepStatus;
if ( wd->ws.beaconInterval ) if (wd->ws.beaconInterval)
{
wd->beaconInterval = wd->ws.beaconInterval; wd->beaconInterval = wd->ws.beaconInterval;
}
else else
{
wd->beaconInterval = 0x64; wd->beaconInterval = 0x64;
}
if ( wd->wlanMode == ZM_MODE_IBSS ) if (wd->wlanMode == ZM_MODE_IBSS) {
{
/* 1. Set default channel 6 (2437MHz) */ /* 1. Set default channel 6 (2437MHz) */
// wd->frequency = 2437; /* wd->frequency = 2437; */
/* 2. Otus support 802.11g Mode */ /* 2. Otus support 802.11g Mode */
if ((wd->ws.adhocMode == ZM_ADHOCBAND_G) || if ((wd->ws.adhocMode == ZM_ADHOCBAND_G) ||
(wd->ws.adhocMode == ZM_ADHOCBAND_BG) || (wd->ws.adhocMode == ZM_ADHOCBAND_BG) ||
(wd->ws.adhocMode == ZM_ADHOCBAND_ABG) ) { (wd->ws.adhocMode == ZM_ADHOCBAND_ABG))
wd->wfc.bIbssGMode = 1; wd->wfc.bIbssGMode = 1;
} else { else
wd->wfc.bIbssGMode = 0; wd->wfc.bIbssGMode = 0;
}
/* 3. set short preamble */ /* 3. set short preamble */
//wd->sta.preambleType = ZM_PREAMBLE_TYPE_SHORT ; /* wd->sta.preambleType = ZM_PREAMBLE_TYPE_SHORT; */
} }
/* set ATIM window */ /* set ATIM window */
if ( wd->ws.atimWindow ) if (wd->ws.atimWindow)
{
wd->sta.atimWindow = wd->ws.atimWindow; wd->sta.atimWindow = wd->ws.atimWindow;
} else {
else /* wd->sta.atimWindow = 0x0a; */
{
//wd->sta.atimWindow = 0x0a;
wd->sta.atimWindow = 0; wd->sta.atimWindow = 0;
} }
//wd->sta.connectingHiddenAP = 1;//wd->ws.connectingHiddenAP; /* wd->sta.connectingHiddenAP = 1;
wd->ws.connectingHiddenAP;
*/
wd->sta.dropUnencryptedPkts = wd->ws.dropUnencryptedPkts; wd->sta.dropUnencryptedPkts = wd->ws.dropUnencryptedPkts;
wd->sta.ibssJoinOnly = wd->ws.ibssJoinOnly; wd->sta.ibssJoinOnly = wd->ws.ibssJoinOnly;
if ( wd->ws.bDesiredBssid ) if (wd->ws.bDesiredBssid) {
{ zfMemoryCopy(wd->sta.desiredBssid,
zfMemoryCopy(wd->sta.desiredBssid, wd->ws.desiredBssid, 6); wd->ws.desiredBssid, 6);
wd->sta.bDesiredBssid = TRUE; wd->sta.bDesiredBssid = TRUE;
wd->ws.bDesiredBssid = FALSE; wd->ws.bDesiredBssid = FALSE;
} } else
else
{
wd->sta.bDesiredBssid = FALSE; wd->sta.bDesiredBssid = FALSE;
}
/* check ssid */ /* check ssid */
if ( wd->ws.ssidLen != 0 ) if (wd->ws.ssidLen != 0) {
{ if ((!zfMemoryIsEqual(wd->ws.ssid, wd->sta.ssid,
if ( (!zfMemoryIsEqual(wd->ws.ssid, wd->sta.ssid, wd->sta.ssidLen)) ||
wd->sta.ssidLen))|| (wd->ws.ssidLen != wd->sta.ssidLen) ||
(wd->ws.ssidLen != wd->sta.ssidLen)|| (wd->sta.authMode == ZM_AUTH_MODE_WPA) ||
(wd->sta.authMode == ZM_AUTH_MODE_WPA)||
(wd->sta.authMode == ZM_AUTH_MODE_WPAPSK) || (wd->sta.authMode == ZM_AUTH_MODE_WPAPSK) ||
(wd->ws.staWmeQosInfo!= 0) ) (wd->ws.staWmeQosInfo != 0)) {
{ /* if u-APSD test(set QosInfo), clear
/*if u-APSD test(set QosInfo), clear connectByReasso to do association (not reassociation)*/ connectByReasso to do association
(not reassociation)
*/
wd->sta.connectByReasso = FALSE; wd->sta.connectByReasso = FALSE;
wd->sta.failCntOfReasso = 0; wd->sta.failCntOfReasso = 0;
wd->sta.pmkidInfo.bssidCount = 0; wd->sta.pmkidInfo.bssidCount = 0;
wd->sta.ssidLen = wd->ws.ssidLen; wd->sta.ssidLen = wd->ws.ssidLen;
zfMemoryCopy(wd->sta.ssid, wd->ws.ssid, wd->sta.ssidLen); zfMemoryCopy(wd->sta.ssid, wd->ws.ssid,
wd->sta.ssidLen);
if ( wd->sta.ssidLen < 32 ) if (wd->sta.ssidLen < 32)
{
wd->sta.ssid[wd->sta.ssidLen] = 0; wd->sta.ssid[wd->sta.ssidLen] = 0;
} }
} } else {
} /* ANY BSS */
else
{ /* ANY BSS */
wd->sta.ssid[0] = 0; wd->sta.ssid[0] = 0;
wd->sta.ssidLen = 0; wd->sta.ssidLen = 0;
} }
...@@ -568,7 +539,7 @@ void zfGetWrapperSetting(zdev_t* dev) ...@@ -568,7 +539,7 @@ void zfGetWrapperSetting(zdev_t* dev)
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
} }
u16_t zfWlanEnable(zdev_t* dev) u16_t zfWlanEnable(zdev_t *dev)
{ {
u8_t bssid[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; u8_t bssid[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
u16_t i; u16_t i;
...@@ -577,20 +548,17 @@ u16_t zfWlanEnable(zdev_t* dev) ...@@ -577,20 +548,17 @@ u16_t zfWlanEnable(zdev_t* dev)
zmw_declare_for_critical_section(); zmw_declare_for_critical_section();
if ( wd->wlanMode == ZM_MODE_UNKNOWN ) if (wd->wlanMode == ZM_MODE_UNKNOWN) {
{
zm_debug_msg0("Unknown Mode...Skip..."); zm_debug_msg0("Unknown Mode...Skip...");
return 0; return 0;
} }
if (wd->wlanMode == ZM_MODE_AP) if (wd->wlanMode == ZM_MODE_AP) {
{
u16_t vapId; u16_t vapId;
vapId = zfwGetVapId(dev); vapId = zfwGetVapId(dev);
if (vapId == 0xffff) if (vapId == 0xffff) {
{
/* AP mode */ /* AP mode */
zfApInitStaTbl(dev); zfApInitStaTbl(dev);
...@@ -599,54 +567,41 @@ u16_t zfWlanEnable(zdev_t* dev) ...@@ -599,54 +567,41 @@ u16_t zfWlanEnable(zdev_t* dev)
wd->gRate = 0xff; wd->gRate = 0xff;
wd->bRateBasic = 0xf; wd->bRateBasic = 0xf;
wd->gRateBasic = 0x0; wd->gRateBasic = 0x0;
//wd->beaconInterval = 100; /* wd->beaconInterval = 100; */
wd->ap.apBitmap = 1; wd->ap.apBitmap = 1;
wd->ap.beaconCounter = 0; wd->ap.beaconCounter = 0;
//wd->ap.vapNumber = 1; //mark by ygwei for Vap /* wd->ap.vapNumber = 1; //mark by ygwei for Vap */
wd->ap.hideSsid[0] = 0; wd->ap.hideSsid[0] = 0;
wd->ap.staAgingTimeSec = 10*60; wd->ap.staAgingTimeSec = 10*60;
wd->ap.staProbingTimeSec = 60; wd->ap.staProbingTimeSec = 60;
for (i=0; i<ZM_MAX_AP_SUPPORT; i++) for (i = 0; i < ZM_MAX_AP_SUPPORT; i++)
{
wd->ap.bcmcHead[i] = wd->ap.bcmcTail[i] = 0; wd->ap.bcmcHead[i] = wd->ap.bcmcTail[i] = 0;
}
//wd->ap.uniHead = wd->ap.uniTail = 0; /* wd->ap.uniHead = wd->ap.uniTail = 0; */
/* load AP parameters */ /* load AP parameters */
wd->bRateBasic = wd->ws.bRateBasic; wd->bRateBasic = wd->ws.bRateBasic;
wd->gRateBasic = wd->ws.gRateBasic; wd->gRateBasic = wd->ws.gRateBasic;
wd->bgMode = wd->ws.bgMode; wd->bgMode = wd->ws.bgMode;
if ((wd->ws.ssidLen <= 32) && (wd->ws.ssidLen != 0)) if ((wd->ws.ssidLen <= 32) && (wd->ws.ssidLen != 0)) {
{
wd->ap.ssidLen[0] = wd->ws.ssidLen; wd->ap.ssidLen[0] = wd->ws.ssidLen;
for(i=0; i<wd->ws.ssidLen; i++) for (i = 0; i < wd->ws.ssidLen; i++)
{
wd->ap.ssid[0][i] = wd->ws.ssid[i]; wd->ap.ssid[0][i] = wd->ws.ssid[i];
} wd->ws.ssidLen = 0; /* Reset Wrapper Variable */
wd->ws.ssidLen = 0; // Reset Wrapper Variable
} }
if (wd->ap.encryMode[0] == 0) if (wd->ap.encryMode[0] == 0)
{
wd->ap.capab[0] = 0x001; wd->ap.capab[0] = 0x001;
}
else else
{
wd->ap.capab[0] = 0x011; wd->ap.capab[0] = 0x011;
}
/* set Short Slot Time bit if not 11b */ /* set Short Slot Time bit if not 11b */
if (wd->ap.wlanType[0] != ZM_WLAN_TYPE_PURE_B) if (wd->ap.wlanType[0] != ZM_WLAN_TYPE_PURE_B)
{
wd->ap.capab[0] |= 0x400; wd->ap.capab[0] |= 0x400;
}
// wd->ap.vapNumber = 1; // mark by ygwei for Vap Test /* wd->ap.vapNumber = 1; //mark by ygwei for Vap Test */
} } else {
else
{
#if 0 #if 0
/* VAP Test Code */ /* VAP Test Code */
wd->ap.apBitmap = 0x3; wd->ap.apBitmap = 0x3;
...@@ -663,30 +618,24 @@ u16_t zfWlanEnable(zdev_t* dev) ...@@ -663,30 +618,24 @@ u16_t zfWlanEnable(zdev_t* dev)
/* VAP Test Code */ /* VAP Test Code */
wd->ap.apBitmap = 0x1 | (0x01 << (vapId+1)); wd->ap.apBitmap = 0x1 | (0x01 << (vapId+1));
if ((wd->ws.ssidLen <= 32) && (wd->ws.ssidLen != 0)) if ((wd->ws.ssidLen <= 32) && (wd->ws.ssidLen != 0)) {
{
wd->ap.ssidLen[vapId+1] = wd->ws.ssidLen; wd->ap.ssidLen[vapId+1] = wd->ws.ssidLen;
for(i=0; i<wd->ws.ssidLen; i++) for (i = 0; i < wd->ws.ssidLen; i++)
{ wd->ap.ssid[vapId+1][i] =
wd->ap.ssid[vapId+1][i] = wd->ws.ssid[i]; wd->ws.ssid[i];
} wd->ws.ssidLen = 0; /* Reset Wrapper Variable */
wd->ws.ssidLen = 0; // Reset Wrapper Variable
} }
if (wd->ap.encryMode[vapId+1] == 0) if (wd->ap.encryMode[vapId+1] == 0)
{
wd->ap.capab[vapId+1] = 0x401; wd->ap.capab[vapId+1] = 0x401;
}
else else
{
wd->ap.capab[vapId+1] = 0x411; wd->ap.capab[vapId+1] = 0x411;
}
wd->ap.authAlgo[vapId+1] = wd->ws.authMode; wd->ap.authAlgo[vapId+1] = wd->ws.authMode;
wd->ap.encryMode[vapId+1] = wd->ws.encryMode; wd->ap.encryMode[vapId+1] = wd->ws.encryMode;
/* Need to be modified when VAP is used */ /* Need to be modified when VAP is used */
//wd->ap.vapNumber = 2; /* wd->ap.vapNumber = 2; */
#endif #endif
} }
...@@ -700,44 +649,36 @@ u16_t zfWlanEnable(zdev_t* dev) ...@@ -700,44 +649,36 @@ u16_t zfWlanEnable(zdev_t* dev)
zfApSetProtectionMode(dev, 0); zfApSetProtectionMode(dev, 0);
zfApSendBeacon(dev); zfApSendBeacon(dev);
} /*if (wd->wlanMode == ZM_MODE_AP) */ } else { /*if (wd->wlanMode == ZM_MODE_AP) */
else
{
zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL); zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_EXTERNAL); zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_EXTERNAL);
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
wd->sta.oppositeCount = 0; /* reset opposite count */ wd->sta.oppositeCount = 0; /* reset opposite count */
//wd->sta.bAutoReconnect = wd->sta.bAutoReconnectEnabled; /* wd->sta.bAutoReconnect = wd->sta.bAutoReconnectEnabled; */
//wd->sta.scanWithSSID = 0; /* wd->sta.scanWithSSID = 0; */
zfStaInitOppositeInfo(dev); zfStaInitOppositeInfo(dev);
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
zfStaResetStatus(dev, 0); zfStaResetStatus(dev, 0);
if ( (wd->sta.cmDisallowSsidLength != 0)&& if ((wd->sta.cmDisallowSsidLength != 0) &&
(wd->sta.ssidLen == wd->sta.cmDisallowSsidLength)&& (wd->sta.ssidLen == wd->sta.cmDisallowSsidLength) &&
(zfMemoryIsEqual(wd->sta.ssid, wd->sta.cmDisallowSsid, (zfMemoryIsEqual(wd->sta.ssid, wd->sta.cmDisallowSsid,
wd->sta.ssidLen)) && wd->sta.ssidLen)) &&
(wd->sta.wepStatus == ZM_ENCRYPTION_TKIP)) (wd->sta.wepStatus == ZM_ENCRYPTION_TKIP)) {/*countermeasures*/
{ /* countermeasures */
zm_debug_msg0("countermeasures disallow association"); zm_debug_msg0("countermeasures disallow association");
} else {
} switch (wd->wlanMode) {
else
{
switch( wd->wlanMode )
{
case ZM_MODE_IBSS: case ZM_MODE_IBSS:
/* some registers may be set here */ /* some registers may be set here */
if ( wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK ) if (wd->sta.authMode == ZM_AUTH_MODE_WPA2PSK)
{ zfHpSetApStaMode(dev,
zfHpSetApStaMode(dev, ZM_HAL_80211_MODE_IBSS_WPA2PSK); ZM_HAL_80211_MODE_IBSS_WPA2PSK);
}
else else
{ zfHpSetApStaMode(dev,
zfHpSetApStaMode(dev, ZM_HAL_80211_MODE_IBSS_GENERAL); ZM_HAL_80211_MODE_IBSS_GENERAL);
}
zm_msg0_mm(ZM_LV_0, "ZM_MODE_IBSS"); zm_msg0_mm(ZM_LV_0, "ZM_MODE_IBSS");
zfIbssConnectNetwork(dev); zfIbssConnectNetwork(dev);
...@@ -766,43 +707,38 @@ u16_t zfWlanEnable(zdev_t* dev) ...@@ -766,43 +707,38 @@ u16_t zfWlanEnable(zdev_t* dev)
} }
//if ( (wd->wlanMode != ZM_MODE_INFRASTRUCTURE)&& /* if ((wd->wlanMode != ZM_MODE_INFRASTRUCTURE) &&
// (wd->wlanMode != ZM_MODE_AP) ) (wd->wlanMode != ZM_MODE_AP))
if ( wd->wlanMode == ZM_MODE_PSEUDO ) */
{ if (wd->wlanMode == ZM_MODE_PSEUDO) {
/* Reset Wlan status */ /* Reset Wlan status */
zfWlanReset(dev); zfWlanReset(dev);
if (wd->zfcbConnectNotify != NULL) if (wd->zfcbConnectNotify != NULL)
{ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECT,
wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECT, wd->sta.bssid); wd->sta.bssid);
}
zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTED); zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTED);
} }
if(wd->wlanMode == ZM_MODE_AP) if (wd->wlanMode == ZM_MODE_AP) {
{
if (wd->zfcbConnectNotify != NULL) if (wd->zfcbConnectNotify != NULL)
{ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECT,
wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECT, wd->sta.bssid); wd->sta.bssid);
} /* zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTED); */
//zfChangeAdapterState(dev, ZM_STA_STATE_CONNECTED);
} }
// Assign default Tx Rate /* Assign default Tx Rate */
if ( wd->sta.EnableHT ) if (wd->sta.EnableHT) {
{
u32_t oneTxStreamCap; u32_t oneTxStreamCap;
oneTxStreamCap = (zfHpCapability(dev) & ZM_HP_CAP_11N_ONE_TX_STREAM); oneTxStreamCap = (zfHpCapability(dev) &
if(oneTxStreamCap) ZM_HP_CAP_11N_ONE_TX_STREAM);
if (oneTxStreamCap)
wd->CurrentTxRateKbps = 135000; wd->CurrentTxRateKbps = 135000;
else else
wd->CurrentTxRateKbps = 270000; wd->CurrentTxRateKbps = 270000;
wd->CurrentRxRateKbps = 270000; wd->CurrentRxRateKbps = 270000;
} } else {
else
{
wd->CurrentTxRateKbps = 54000; wd->CurrentTxRateKbps = 54000;
wd->CurrentRxRateKbps = 54000; wd->CurrentRxRateKbps = 54000;
} }
...@@ -813,7 +749,7 @@ u16_t zfWlanEnable(zdev_t* dev) ...@@ -813,7 +749,7 @@ u16_t zfWlanEnable(zdev_t* dev)
} }
/* Enable/disable Wlan operation */ /* Enable/disable Wlan operation */
u16_t zfiWlanEnable(zdev_t* dev) u16_t zfiWlanEnable(zdev_t *dev)
{ {
u16_t ret; u16_t ret;
...@@ -823,28 +759,27 @@ u16_t zfiWlanEnable(zdev_t* dev) ...@@ -823,28 +759,27 @@ u16_t zfiWlanEnable(zdev_t* dev)
zfGetWrapperSetting(dev); zfGetWrapperSetting(dev);
zfZeroMemory((u8_t*) &wd->trafTally, sizeof(struct zsTrafTally)); zfZeroMemory((u8_t *) &wd->trafTally, sizeof(struct zsTrafTally));
// Reset cmMicFailureCount to 0 for new association request /* Reset cmMicFailureCount to 0 for new association request */
if ( wd->sta.cmMicFailureCount == 1 ) if (wd->sta.cmMicFailureCount == 1) {
{
zfTimerCancel(dev, ZM_EVENT_CM_TIMER); zfTimerCancel(dev, ZM_EVENT_CM_TIMER);
wd->sta.cmMicFailureCount = 0; wd->sta.cmMicFailureCount = 0;
} }
zfFlushVtxq(dev); zfFlushVtxq(dev);
if ((wd->queueFlushed & 0x10) != 0) if ((wd->queueFlushed & 0x10) != 0)
{
zfHpUsbReset(dev); zfHpUsbReset(dev);
}
ret = zfWlanEnable(dev); ret = zfWlanEnable(dev);
return ret; return ret;
} }
/* Add a flag named ResetKeyCache to show if KeyCache should be cleared. /* Add a flag named ResetKeyCache to show if KeyCache should be cleared.
for hostapd in AP mode, if driver receives iwconfig ioctl for hostapd in AP mode, if driver receives iwconfig ioctl
after setting group key, it shouldn't clear KeyCache. */ after setting group key, it shouldn't clear KeyCache.
u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache) */
u16_t zfiWlanDisable(zdev_t *dev, u8_t ResetKeyCache)
{ {
u16_t i; u16_t i;
u8_t isConnected; u8_t isConnected;
...@@ -858,25 +793,22 @@ u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache) ...@@ -858,25 +793,22 @@ u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache)
zm_msg0_mm(ZM_LV_1, "Disable Wlan"); zm_msg0_mm(ZM_LV_1, "Disable Wlan");
if ( wd->wlanMode != ZM_MODE_AP ) if (wd->wlanMode != ZM_MODE_AP) {
{
isConnected = zfStaIsConnected(dev); isConnected = zfStaIsConnected(dev);
if ( (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)&& if ((wd->wlanMode == ZM_MODE_INFRASTRUCTURE) &&
(wd->sta.currentAuthMode != ZM_AUTH_MODE_WPA2) ) (wd->sta.currentAuthMode != ZM_AUTH_MODE_WPA2)) {
{
/* send deauthentication frame */ /* send deauthentication frame */
if (isConnected) if (isConnected) {
{ /* zfiWlanDeauth(dev, NULL, 0); */
//zfiWlanDeauth(dev, NULL, 0); zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH,
zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, wd->sta.bssid, 3, 0, 0); wd->sta.bssid, 3, 0, 0);
//zmw_debug_msg0("send a Deauth frame!"); /* zmw_debug_msg0("send a Deauth frame!"); */
} }
} }
// Remove all the connected peer stations /* Remove all the connected peer stations */
if ( wd->wlanMode == ZM_MODE_IBSS ) if (wd->wlanMode == ZM_MODE_IBSS) {
{
wd->sta.ibssBssIsCreator = 0; wd->sta.ibssBssIsCreator = 0;
zfTimerCancel(dev, ZM_EVENT_IBSS_MONITOR); zfTimerCancel(dev, ZM_EVENT_IBSS_MONITOR);
zfStaIbssMonitoring(dev, 1); zfStaIbssMonitoring(dev, 1);
...@@ -899,8 +831,8 @@ u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache) ...@@ -899,8 +831,8 @@ u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache)
/* reset leap enable variable */ /* reset leap enable variable */
wd->sta.leapEnabled = 0; wd->sta.leapEnabled = 0;
/* Disable the RIFS Status / RIFS-like frame count / RIFS count */ /* Disable the RIFS Status/RIFS-like frame count/RIFS count */
if( wd->sta.rifsState == ZM_RIFS_STATE_DETECTED ) if (wd->sta.rifsState == ZM_RIFS_STATE_DETECTED)
zfHpDisableRifs(dev); zfHpDisableRifs(dev);
wd->sta.rifsState = ZM_RIFS_STATE_DETECTING; wd->sta.rifsState = ZM_RIFS_STATE_DETECTING;
wd->sta.rifsLikeFrameCnt = 0; wd->sta.rifsLikeFrameCnt = 0;
...@@ -913,28 +845,20 @@ u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache) ...@@ -913,28 +845,20 @@ u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache)
if (ResetKeyCache) if (ResetKeyCache)
zfHpResetKeyCache(dev); zfHpResetKeyCache(dev);
if (isConnected) if (isConnected) {
{
if (wd->zfcbConnectNotify != NULL) if (wd->zfcbConnectNotify != NULL)
{ wd->zfcbConnectNotify(dev,
wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECTION_DISABLED, wd->sta.bssid); ZM_STATUS_MEDIA_CONNECTION_DISABLED,
} wd->sta.bssid);
} } else {
else
{
if (wd->zfcbConnectNotify != NULL) if (wd->zfcbConnectNotify != NULL)
{ wd->zfcbConnectNotify(dev,
wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_DISABLED, wd->sta.bssid); ZM_STATUS_MEDIA_DISABLED, wd->sta.bssid);
} }
} } else { /* if (wd->wlanMode == ZM_MODE_AP) */
} for (i = 0; i < ZM_MAX_STA_SUPPORT; i++) {
else //if (wd->wlanMode == ZM_MODE_AP)
{
for (i=0; i<ZM_MAX_STA_SUPPORT; i++)
{
/* send deauthentication frame */ /* send deauthentication frame */
if (wd->ap.staTable[i].valid == 1) if (wd->ap.staTable[i].valid == 1) {
{
/* Reason : Sending station is leaving */ /* Reason : Sending station is leaving */
zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH,
wd->ap.staTable[i].addr, 3, 0, 0); wd->ap.staTable[i].addr, 3, 0, 0);
...@@ -957,35 +881,40 @@ u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache) ...@@ -957,35 +881,40 @@ u16_t zfiWlanDisable(zdev_t* dev, u8_t ResetKeyCache)
/* Free buffer in defragment list*/ /* Free buffer in defragment list*/
zfAgingDefragList(dev, 1); zfAgingDefragList(dev, 1);
#ifdef ZM_ENABLE_AGGREGATION #ifdef ZM_ENABLE_AGGREGATION
/* add by honda */ /* add by honda */
zfAggRxFreeBuf(dev, 0); //1 for release structure memory zfAggRxFreeBuf(dev, 0); /* 1 for release structure memory */
/* end of add by honda */ /* end of add by honda */
#endif #endif
// Clear the information for the peer stations of IBSS or AP of Station mode /* Clear the information for the peer stations
zfZeroMemory((u8_t*)wd->sta.oppositeInfo, sizeof(struct zsOppositeInfo) * ZM_MAX_OPPOSITE_COUNT); of IBSS or AP of Station mode
*/
zfZeroMemory((u8_t *)wd->sta.oppositeInfo,
sizeof(struct zsOppositeInfo) * ZM_MAX_OPPOSITE_COUNT);
/* Turn off Software WEP/TKIP */ /* Turn off Software WEP/TKIP */
if (wd->sta.SWEncryptEnable != 0) if (wd->sta.SWEncryptEnable != 0) {
{
zm_debug_msg0("Disable software encryption"); zm_debug_msg0("Disable software encryption");
zfStaDisableSWEncryption(dev); zfStaDisableSWEncryption(dev);
} }
/* Improve WEP/TKIP performace with HT AP, detail information please look bug#32495 */ /* Improve WEP/TKIP performace with HT AP,
//zfHpSetTTSIFSTime(dev, 0x8); detail information please look bug#32495 */
/* zfHpSetTTSIFSTime(dev, 0x8); */
return 0; return 0;
} }
u16_t zfiWlanSuspend(zdev_t* dev) u16_t zfiWlanSuspend(zdev_t *dev)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section(); zmw_declare_for_critical_section();
// Change the HAL state to init so that any packet can't be transmitted between /* Change the HAL state to init so that any packet
// resume & HAL reinit. This would cause the chip hang issue in OTUS. can't be transmitted between resume & HAL reinit.
This would cause the chip hang issue in OTUS.
*/
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
wd->halState = ZM_HAL_STATE_INIT; wd->halState = ZM_HAL_STATE_INIT;
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
...@@ -993,7 +922,7 @@ u16_t zfiWlanSuspend(zdev_t* dev) ...@@ -993,7 +922,7 @@ u16_t zfiWlanSuspend(zdev_t* dev)
return 0; return 0;
} }
u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn) u16_t zfiWlanResume(zdev_t *dev, u8_t doReconn)
{ {
u16_t ret; u16_t ret;
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1002,7 +931,7 @@ u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn) ...@@ -1002,7 +931,7 @@ u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn)
/* Redownload firmware, Reinit MAC,PHY,RF */ /* Redownload firmware, Reinit MAC,PHY,RF */
zfHpReinit(dev, wd->frequency); zfHpReinit(dev, wd->frequency);
//Set channel according to AP's configuration /* Set channel according to AP's configuration */
zfCoreSetFrequencyExV2(dev, wd->frequency, wd->BandWidth40, zfCoreSetFrequencyExV2(dev, wd->frequency, wd->BandWidth40,
wd->ExtOffset, NULL, 1); wd->ExtOffset, NULL, 1);
...@@ -1013,29 +942,22 @@ u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn) ...@@ -1013,29 +942,22 @@ u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn)
zfFlushVtxq(dev); zfFlushVtxq(dev);
if ( wd->wlanMode != ZM_MODE_INFRASTRUCTURE && if (wd->wlanMode != ZM_MODE_INFRASTRUCTURE &&
wd->wlanMode != ZM_MODE_IBSS ) wd->wlanMode != ZM_MODE_IBSS)
{
return 1; return 1;
}
zm_msg0_mm(ZM_LV_1, "Resume Wlan"); zm_msg0_mm(ZM_LV_1, "Resume Wlan");
if ( (zfStaIsConnected(dev)) || (zfStaIsConnecting(dev)) ) if ((zfStaIsConnected(dev)) || (zfStaIsConnecting(dev))) {
{ if (doReconn == 1) {
if (doReconn == 1)
{
zm_msg0_mm(ZM_LV_1, "Re-connect..."); zm_msg0_mm(ZM_LV_1, "Re-connect...");
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
wd->sta.connectByReasso = FALSE; wd->sta.connectByReasso = FALSE;
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
zfWlanEnable(dev); zfWlanEnable(dev);
} } else if (doReconn == 0)
else if (doReconn == 0)
{
zfHpSetRollCallTable(dev); zfHpSetRollCallTable(dev);
} }
}
ret = 0; ret = 0;
...@@ -1057,7 +979,7 @@ u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn) ...@@ -1057,7 +979,7 @@ u16_t zfiWlanResume(zdev_t* dev, u8_t doReconn)
/* Stephen Chen Atheros Communications, INC. 2007.1 */ /* Stephen Chen Atheros Communications, INC. 2007.1 */
/* */ /* */
/************************************************************************/ /************************************************************************/
void zfiWlanFlushAllQueuedBuffers(zdev_t* dev) void zfiWlanFlushAllQueuedBuffers(zdev_t *dev)
{ {
/* Flush VTxQ and MmQ */ /* Flush VTxQ and MmQ */
zfFlushVtxq(dev); zfFlushVtxq(dev);
...@@ -1068,7 +990,7 @@ void zfiWlanFlushAllQueuedBuffers(zdev_t* dev) ...@@ -1068,7 +990,7 @@ void zfiWlanFlushAllQueuedBuffers(zdev_t* dev)
} }
/* Do WLAN site survey */ /* Do WLAN site survey */
u16_t zfiWlanScan(zdev_t* dev) u16_t zfiWlanScan(zdev_t *dev)
{ {
u16_t ret = 1; u16_t ret = 1;
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1079,26 +1001,22 @@ u16_t zfiWlanScan(zdev_t* dev) ...@@ -1079,26 +1001,22 @@ u16_t zfiWlanScan(zdev_t* dev)
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
if (wd->wlanMode == ZM_MODE_AP) if (wd->wlanMode == ZM_MODE_AP) {
{
wd->heartBeatNotification |= ZM_BSSID_LIST_SCAN; wd->heartBeatNotification |= ZM_BSSID_LIST_SCAN;
wd->sta.scanFrequency = 0; wd->sta.scanFrequency = 0;
//wd->sta.pUpdateBssList->bssCount = 0; /* wd->sta.pUpdateBssList->bssCount = 0; */
ret = 0; ret = 0;
} } else {
else #if 0
{ if (!zfStaBlockWlanScan(dev)) {
#if 0
if ( !zfStaBlockWlanScan(dev) )
{
zm_debug_msg0("scan request"); zm_debug_msg0("scan request");
//zfTimerSchedule(dev, ZM_EVENT_SCAN, ZM_TICK_ZERO); /*zfTimerSchedule(dev, ZM_EVENT_SCAN, ZM_TICK_ZERO);*/
ret = 0; ret = 0;
goto start_scan; goto start_scan;
} }
#else #else
goto start_scan; goto start_scan;
#endif #endif
} }
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
...@@ -1108,8 +1026,10 @@ u16_t zfiWlanScan(zdev_t* dev) ...@@ -1108,8 +1026,10 @@ u16_t zfiWlanScan(zdev_t* dev)
start_scan: start_scan:
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
if(wd->ledStruct.LEDCtrlFlagFromReg & ZM_LED_CTRL_FLAG_ALPHA) // flag for Alpha if (wd->ledStruct.LEDCtrlFlagFromReg & ZM_LED_CTRL_FLAG_ALPHA) {
/* flag for Alpha */
wd->ledStruct.LEDCtrlFlag |= ZM_LED_CTRL_FLAG_ALPHA; wd->ledStruct.LEDCtrlFlag |= ZM_LED_CTRL_FLAG_ALPHA;
}
ret = zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_EXTERNAL); ret = zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_EXTERNAL);
...@@ -1139,18 +1059,16 @@ u16_t zcRateToMCS[] = ...@@ -1139,18 +1059,16 @@ u16_t zcRateToMCS[] =
{0xff, 0, 1, 2, 3, 0xb, 0xf, 0xa, 0xe, 0x9, 0xd, 0x8, 0xc}; {0xff, 0, 1, 2, 3, 0xb, 0xf, 0xa, 0xe, 0x9, 0xd, 0x8, 0xc};
u16_t zcRateToMT[] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}; u16_t zcRateToMT[] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
u16_t zfiWlanSetTxRate(zdev_t* dev, u16_t rate) u16_t zfiWlanSetTxRate(zdev_t *dev, u16_t rate)
{ // jhlee HT 0 {
/* jhlee HT 0 */
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
if (rate <=12) if (rate <= 12) {
{
wd->txMCS = zcRateToMCS[rate]; wd->txMCS = zcRateToMCS[rate];
wd->txMT = zcRateToMT[rate]; wd->txMT = zcRateToMT[rate];
return ZM_SUCCESS; return ZM_SUCCESS;
} } else if ((rate <= 28) || (rate == 13 + 32)) {
else if ((rate<=28)||(rate==13+32))
{
wd->txMCS = rate - 12 - 1; wd->txMCS = rate - 12 - 1;
wd->txMT = 2; wd->txMT = 2;
return ZM_SUCCESS; return ZM_SUCCESS;
...@@ -1160,75 +1078,70 @@ u16_t zfiWlanSetTxRate(zdev_t* dev, u16_t rate) ...@@ -1160,75 +1078,70 @@ u16_t zfiWlanSetTxRate(zdev_t* dev, u16_t rate)
} }
const u32_t zcRateIdToKbps40M[] = const u32_t zcRateIdToKbps40M[] =
{ {
1000, 2000, 5500, 11000, /* 1M, 2M, 5M, 11M , 0 1 2 3*/ 1000, 2000, 5500, 11000, /* 1M, 2M, 5M, 11M , 0 1 2 3 */
6000, 9000, 12000, 18000, /* 6M 9M 12M 18M , 4 5 6 7*/ 6000, 9000, 12000, 18000, /* 6M 9M 12M 18M , 4 5 6 7 */
24000, 36000, 48000, 54000, /* 24M 36M 48M 54M , 8 9 10 11*/ 24000, 36000, 48000, 54000, /* 24M 36M 48M 54M , 8 9 10 11 */
13500, 27000, 40500, 54000, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15*/ 13500, 27000, 40500, 54000, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15 */
81000, 108000, 121500, 135000, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19*/ 81000, 108000, 121500, 135000, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19 */
27000, 54000, 81000, 108000, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23*/ 27000, 54000, 81000, 108000, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23 */
162000, 216000, 243000, 270000, /* MCS12 MCS13 MCS14 MCS15 , 24 25 26 27*/ 162000, 216000, 243000, 270000, /*MCS12 MCS13 MCS14 MCS15, 24 25 26 27*/
270000, 300000, 150000 /* MCS14SG, MCS15SG, MCS7SG , 28 29 30*/ 270000, 300000, 150000 /* MCS14SG, MCS15SG, MCS7SG , 28 29 30 */
}; };
const u32_t zcRateIdToKbps20M[] = const u32_t zcRateIdToKbps20M[] =
{ {
1000, 2000, 5500, 11000, /* 1M, 2M, 5M, 11M , 0 1 2 3*/ 1000, 2000, 5500, 11000, /* 1M, 2M, 5M, 11M , 0 1 2 3 */
6000, 9000, 12000, 18000, /* 6M 9M 12M 18M , 4 5 6 7*/ 6000, 9000, 12000, 18000, /* 6M 9M 12M 18M , 4 5 6 7 */
24000, 36000, 48000, 54000, /* 24M 36M 48M 54M , 8 9 10 11*/ 24000, 36000, 48000, 54000, /* 24M 36M 48M 54M , 8 9 10 11 */
6500, 13000, 19500, 26000, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15*/ 6500, 13000, 19500, 26000, /* MCS0 MCS1 MCS2 MCS3 , 12 13 14 15 */
39000, 52000, 58500, 65000, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19*/ 39000, 52000, 58500, 65000, /* MCS4 MCS5 MCS6 MCS7 , 16 17 18 19 */
13000, 26000, 39000, 52000, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23*/ 13000, 26000, 39000, 52000, /* MCS8 MCS9 MCS10 MCS11 , 20 21 22 23 */
78000, 104000, 117000, 130000, /* MCS12 MCS13 MCS14 MCS15 , 24 25 26 27*/ 78000, 104000, 117000, 130000, /* MCS12 MCS13 MCS14 MCS15, 24 25 26 27*/
130000, 144400, 72200 /* MCS14SG, MCS15SG, MSG7SG , 28 29 30*/ 130000, 144400, 72200 /* MCS14SG, MCS15SG, MSG7SG , 28 29 30 */
}; };
u32_t zfiWlanQueryTxRate(zdev_t* dev) u32_t zfiWlanQueryTxRate(zdev_t *dev)
{ {
u8_t rateId = 0xff; u8_t rateId = 0xff;
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section(); zmw_declare_for_critical_section();
/* If Tx rate had not been trained, return maximum Tx rate instead */ /* If Tx rate had not been trained, return maximum Tx rate instead */
if ((wd->wlanMode == ZM_MODE_INFRASTRUCTURE) && (zfStaIsConnected(dev))) if ((wd->wlanMode == ZM_MODE_INFRASTRUCTURE) &&
{ (zfStaIsConnected(dev))) {
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
//Not in fixed rate mode /* Not in fixed rate mode */
if (wd->txMCS == 0xff) if (wd->txMCS == 0xff) {
{ if ((wd->sta.oppositeInfo[0].rcCell.flag &
if ((wd->sta.oppositeInfo[0].rcCell.flag & ZM_RC_TRAINED_BIT) == 0) ZM_RC_TRAINED_BIT) == 0)
{ rateId = wd->sta.oppositeInfo[0].rcCell. \
rateId = wd->sta.oppositeInfo[0].rcCell.operationRateSet[wd->sta.oppositeInfo[0].rcCell.operationRateCount-1]; operationRateSet[wd->sta.oppositeInfo[0]. \
} rcCell.operationRateCount-1];
else else
{ rateId = wd->sta.oppositeInfo[0].rcCell. \
rateId = wd->sta.oppositeInfo[0].rcCell.operationRateSet[wd->sta.oppositeInfo[0].rcCell.currentRateIndex]; operationRateSet[wd->sta.oppositeInfo[0]. \
} rcCell.currentRateIndex];
} }
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
} }
if (rateId != 0xff)
{ if (rateId != 0xff) {
if (wd->sta.htCtrlBandwidth) if (wd->sta.htCtrlBandwidth)
{
return zcRateIdToKbps40M[rateId]; return zcRateIdToKbps40M[rateId];
}
else else
{
return zcRateIdToKbps20M[rateId]; return zcRateIdToKbps20M[rateId];
} } else
}
else
{
return wd->CurrentTxRateKbps; return wd->CurrentTxRateKbps;
}
} }
void zfWlanUpdateRxRate(zdev_t* dev, struct zsAdditionInfo* addInfo) void zfWlanUpdateRxRate(zdev_t *dev, struct zsAdditionInfo *addInfo)
{ {
u32_t rxRateKbps; u32_t rxRateKbps;
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
//zm_msg1_mm(ZM_LV_0, "addInfo->Tail.Data.RxMacStatus =", addInfo->Tail.Data.RxMacStatus & 0x03); /* zm_msg1_mm(ZM_LV_0, "addInfo->Tail.Data.RxMacStatus =",
* addInfo->Tail.Data.RxMacStatus & 0x03);
*/
/* b5~b4: MPDU indication. */ /* b5~b4: MPDU indication. */
/* 00: Single MPDU. */ /* 00: Single MPDU. */
...@@ -1238,39 +1151,40 @@ void zfWlanUpdateRxRate(zdev_t* dev, struct zsAdditionInfo* addInfo) ...@@ -1238,39 +1151,40 @@ void zfWlanUpdateRxRate(zdev_t* dev, struct zsAdditionInfo* addInfo)
/* Only First MPDU and Single MPDU have PLCP header */ /* Only First MPDU and Single MPDU have PLCP header */
/* First MPDU : (mpduInd & 0x30) == 0x00 */ /* First MPDU : (mpduInd & 0x30) == 0x00 */
/* Single MPDU : (mpduInd & 0x30) == 0x20 */ /* Single MPDU : (mpduInd & 0x30) == 0x20 */
if ((addInfo->Tail.Data.RxMacStatus & 0x10) == 0) if ((addInfo->Tail.Data.RxMacStatus & 0x10) == 0) {
{
/* Modulation type */ /* Modulation type */
wd->modulationType = addInfo->Tail.Data.RxMacStatus & 0x03; wd->modulationType = addInfo->Tail.Data.RxMacStatus & 0x03;
switch(wd->modulationType) switch (wd->modulationType) {
{ /* CCK mode */
case 0x0: wd->rateField = addInfo->PlcpHeader[0] & 0xff; //CCK mode case 0x0:
wd->rateField = addInfo->PlcpHeader[0] & 0xff;
wd->rxInfo = 0; wd->rxInfo = 0;
break; break;
case 0x1: wd->rateField = addInfo->PlcpHeader[0] & 0x0f; //Legacy-OFDM mode /* Legacy-OFDM mode */
case 0x1:
wd->rateField = addInfo->PlcpHeader[0] & 0x0f;
wd->rxInfo = 0; wd->rxInfo = 0;
break; break;
case 0x2: wd->rateField = addInfo->PlcpHeader[3]; //HT-OFDM mode /* HT-OFDM mode */
case 0x2:
wd->rateField = addInfo->PlcpHeader[3];
wd->rxInfo = addInfo->PlcpHeader[6]; wd->rxInfo = addInfo->PlcpHeader[6];
break; break;
default: break; default:
break;
} }
rxRateKbps = zfUpdateRxRate(dev); rxRateKbps = zfUpdateRxRate(dev);
if (wd->CurrentRxRateUpdated == 1) if (wd->CurrentRxRateUpdated == 1) {
{
if (rxRateKbps > wd->CurrentRxRateKbps) if (rxRateKbps > wd->CurrentRxRateKbps)
{
wd->CurrentRxRateKbps = rxRateKbps; wd->CurrentRxRateKbps = rxRateKbps;
} } else {
}
else
{
wd->CurrentRxRateKbps = rxRateKbps; wd->CurrentRxRateKbps = rxRateKbps;
wd->CurrentRxRateUpdated = 1; wd->CurrentRxRateUpdated = 1;
} }
} }
} }
#if 0 #if 0
u16_t zcIndextoRateBG[16] = {1000, 2000, 5500, 11000, 0, 0, 0, 0, 48000, u16_t zcIndextoRateBG[16] = {1000, 2000, 5500, 11000, 0, 0, 0, 0, 48000,
24000, 12000, 6000, 54000, 36000, 18000, 9000}; 24000, 12000, 6000, 54000, 36000, 18000, 9000};
...@@ -1280,12 +1194,12 @@ u32_t zcIndextoRateN20L[16] = {6500, 13000, 19500, 26000, 39000, 52000, 58500, ...@@ -1280,12 +1194,12 @@ u32_t zcIndextoRateN20L[16] = {6500, 13000, 19500, 26000, 39000, 52000, 58500,
u32_t zcIndextoRateN20S[16] = {7200, 14400, 21700, 28900, 43300, 57800, 65000, u32_t zcIndextoRateN20S[16] = {7200, 14400, 21700, 28900, 43300, 57800, 65000,
72200, 14400, 28900, 43300, 57800, 86700, 115600, 72200, 14400, 28900, 43300, 57800, 86700, 115600,
130000, 144400}; 130000, 144400};
u32_t zcIndextoRateN40L[16] = {13500, 27000, 40500, 54000, 81000, 108000, 121500, u32_t zcIndextoRateN40L[16] = {13500, 27000, 40500, 54000, 81000, 108000,
135000, 27000, 54000, 81000, 108000, 162000, 216000, 121500, 135000, 27000, 54000, 81000, 108000,
243000, 270000}; 162000, 216000, 243000, 270000};
u32_t zcIndextoRateN40S[16] = {15000, 30000, 45000, 60000, 90000, 120000, 135000, u32_t zcIndextoRateN40S[16] = {15000, 30000, 45000, 60000, 90000, 120000,
150000, 30000, 60000, 90000, 120000, 180000, 240000, 135000, 150000, 30000, 60000, 90000, 120000,
270000, 300000}; 180000, 240000, 270000, 300000};
#endif #endif
extern u16_t zcIndextoRateBG[16]; extern u16_t zcIndextoRateBG[16];
...@@ -1294,7 +1208,7 @@ extern u32_t zcIndextoRateN20S[16]; ...@@ -1294,7 +1208,7 @@ extern u32_t zcIndextoRateN20S[16];
extern u32_t zcIndextoRateN40L[16]; extern u32_t zcIndextoRateN40L[16];
extern u32_t zcIndextoRateN40S[16]; extern u32_t zcIndextoRateN40S[16];
u32_t zfiWlanQueryRxRate(zdev_t* dev) u32_t zfiWlanQueryRxRate(zdev_t *dev)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1302,62 +1216,55 @@ u32_t zfiWlanQueryRxRate(zdev_t* dev) ...@@ -1302,62 +1216,55 @@ u32_t zfiWlanQueryRxRate(zdev_t* dev)
return wd->CurrentRxRateKbps; return wd->CurrentRxRateKbps;
} }
u32_t zfUpdateRxRate(zdev_t* dev) u32_t zfUpdateRxRate(zdev_t *dev)
{ {
u8_t mcs, bandwidth; u8_t mcs, bandwidth;
u32_t rxRateKbps = 130000; u32_t rxRateKbps = 130000;
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
switch (wd->modulationType) switch (wd->modulationType) {
{ /* CCK mode */
case 0x0: //CCK mode case 0x0:
switch (wd->rateField) switch (wd->rateField) {
{ case 0x0a:
case 0x0a: rxRateKbps = 1000; rxRateKbps = 1000;
break; break;
case 0x14: rxRateKbps = 2000; case 0x14:
rxRateKbps = 2000;
case 0x37: rxRateKbps = 5500; case 0x37:
rxRateKbps = 5500;
break; break;
case 0x6e: rxRateKbps = 11000; case 0x6e:
rxRateKbps = 11000;
break; break;
default: default:
break; break;
} }
break; break;
case 0x1: //Legacy-OFDM mode /* Legacy-OFDM mode */
case 0x1:
if (wd->rateField <= 15) if (wd->rateField <= 15)
{
rxRateKbps = zcIndextoRateBG[wd->rateField]; rxRateKbps = zcIndextoRateBG[wd->rateField];
}
break; break;
case 0x2: //HT-OFDM mode /* HT-OFDM mode */
case 0x2:
mcs = wd->rateField & 0x7F; mcs = wd->rateField & 0x7F;
bandwidth = wd->rateField & 0x80; bandwidth = wd->rateField & 0x80;
if (mcs <= 15) if (mcs <= 15) {
{ if (bandwidth != 0) {
if (bandwidth != 0) if ((wd->rxInfo & 0x80) != 0) {
{
if((wd->rxInfo & 0x80) != 0)
{
/* Short GI 40 MHz MIMO Rate */ /* Short GI 40 MHz MIMO Rate */
rxRateKbps = zcIndextoRateN40S[mcs]; rxRateKbps = zcIndextoRateN40S[mcs];
} } else {
else
{
/* Long GI 40 MHz MIMO Rate */ /* Long GI 40 MHz MIMO Rate */
rxRateKbps = zcIndextoRateN40L[mcs]; rxRateKbps = zcIndextoRateN40L[mcs];
} }
} } else {
else if ((wd->rxInfo & 0x80) != 0) {
{
if((wd->rxInfo & 0x80) != 0)
{
/* Short GI 20 MHz MIMO Rate */ /* Short GI 20 MHz MIMO Rate */
rxRateKbps = zcIndextoRateN20S[mcs]; rxRateKbps = zcIndextoRateN20S[mcs];
} } else {
else
{
/* Long GI 20 MHz MIMO Rate */ /* Long GI 20 MHz MIMO Rate */
rxRateKbps = zcIndextoRateN20L[mcs]; rxRateKbps = zcIndextoRateN20L[mcs];
} }
...@@ -1367,20 +1274,22 @@ u32_t zfUpdateRxRate(zdev_t* dev) ...@@ -1367,20 +1274,22 @@ u32_t zfUpdateRxRate(zdev_t* dev)
default: default:
break; break;
} }
//zm_msg1_mm(ZM_LV_0, "wd->CurrentRxRateKbps=", wd->CurrentRxRateKbps); /* zm_msg1_mm(ZM_LV_0, "wd->CurrentRxRateKbps=",
wd->CurrentRxRateKbps);
*/
// ToDo: use bandwith field to define 40MB /* ToDo: use bandwith field to define 40MB */
return rxRateKbps; return rxRateKbps;
} }
/* Get WLAN stastics */ /* Get WLAN stastics */
u16_t zfiWlanGetStatistics(zdev_t* dev) u16_t zfiWlanGetStatistics(zdev_t *dev)
{ {
/* Return link statistics */ /* Return link statistics */
return 0; return 0;
} }
u16_t zfiWlanReset(zdev_t* dev) u16_t zfiWlanReset(zdev_t *dev)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1390,7 +1299,7 @@ u16_t zfiWlanReset(zdev_t* dev) ...@@ -1390,7 +1299,7 @@ u16_t zfiWlanReset(zdev_t* dev)
} }
/* Reset WLAN */ /* Reset WLAN */
u16_t zfWlanReset(zdev_t* dev) u16_t zfWlanReset(zdev_t *dev)
{ {
u8_t isConnected; u8_t isConnected;
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1401,17 +1310,16 @@ u16_t zfWlanReset(zdev_t* dev) ...@@ -1401,17 +1310,16 @@ u16_t zfWlanReset(zdev_t* dev)
isConnected = zfStaIsConnected(dev); isConnected = zfStaIsConnected(dev);
//if ( wd->wlanMode != ZM_MODE_AP ) /* if ( wd->wlanMode != ZM_MODE_AP ) */
{
if ( (wd->wlanMode == ZM_MODE_INFRASTRUCTURE)&&
(wd->sta.currentAuthMode != ZM_AUTH_MODE_WPA2) )
{ {
if ((wd->wlanMode == ZM_MODE_INFRASTRUCTURE) &&
(wd->sta.currentAuthMode != ZM_AUTH_MODE_WPA2)) {
/* send deauthentication frame */ /* send deauthentication frame */
if (isConnected) if (isConnected) {
{ /* zfiWlanDeauth(dev, NULL, 0); */
//zfiWlanDeauth(dev, NULL, 0); zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH,
zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, wd->sta.bssid, 3, 0, 0); wd->sta.bssid, 3, 0, 0);
//zmw_debug_msg0("send a Deauth frame!"); /* zmw_debug_msg0("send a Deauth frame!"); */
} }
} }
} }
...@@ -1419,20 +1327,15 @@ u16_t zfWlanReset(zdev_t* dev) ...@@ -1419,20 +1327,15 @@ u16_t zfWlanReset(zdev_t* dev)
zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT); zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT);
zfHpResetKeyCache(dev); zfHpResetKeyCache(dev);
if (isConnected) if (isConnected) {
{ /* zfiWlanDisable(dev); */
//zfiWlanDisable(dev);
if (wd->zfcbConnectNotify != NULL) if (wd->zfcbConnectNotify != NULL)
{ wd->zfcbConnectNotify(dev,
wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_CONNECTION_RESET, wd->sta.bssid); ZM_STATUS_MEDIA_CONNECTION_RESET, wd->sta.bssid);
} } else {
}
else
{
if (wd->zfcbConnectNotify != NULL) if (wd->zfcbConnectNotify != NULL)
{ wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_RESET,
wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_RESET, wd->sta.bssid); wd->sta.bssid);
}
} }
/* stop beacon */ /* stop beacon */
...@@ -1444,11 +1347,11 @@ u16_t zfWlanReset(zdev_t* dev) ...@@ -1444,11 +1347,11 @@ u16_t zfWlanReset(zdev_t* dev)
/* Flush VTxQ and MmQ */ /* Flush VTxQ and MmQ */
zfFlushVtxq(dev); zfFlushVtxq(dev);
#ifdef ZM_ENABLE_AGGREGATION #ifdef ZM_ENABLE_AGGREGATION
/* add by honda */ /* add by honda */
zfAggRxFreeBuf(dev, 0); //1 for release structure memory zfAggRxFreeBuf(dev, 0); /* 1 for release structure memory */
/* end of add by honda */ /* end of add by honda */
#endif #endif
zfStaRefreshBlockList(dev, 1); zfStaRefreshBlockList(dev, 1);
...@@ -1478,7 +1381,7 @@ u16_t zfWlanReset(zdev_t* dev) ...@@ -1478,7 +1381,7 @@ u16_t zfWlanReset(zdev_t* dev)
wd->sta.leapEnabled = 0; wd->sta.leapEnabled = 0;
/* Reset the RIFS Status / RIFS-like frame count / RIFS count */ /* Reset the RIFS Status / RIFS-like frame count / RIFS count */
if( wd->sta.rifsState == ZM_RIFS_STATE_DETECTED ) if (wd->sta.rifsState == ZM_RIFS_STATE_DETECTED)
zfHpDisableRifs(dev); zfHpDisableRifs(dev);
wd->sta.rifsState = ZM_RIFS_STATE_DETECTING; wd->sta.rifsState = ZM_RIFS_STATE_DETECTING;
wd->sta.rifsLikeFrameCnt = 0; wd->sta.rifsLikeFrameCnt = 0;
...@@ -1487,8 +1390,11 @@ u16_t zfWlanReset(zdev_t* dev) ...@@ -1487,8 +1390,11 @@ u16_t zfWlanReset(zdev_t* dev)
wd->sta.osRxFilter = 0; wd->sta.osRxFilter = 0;
wd->sta.bSafeMode = 0; wd->sta.bSafeMode = 0;
// Clear the information for the peer stations of IBSS or AP of Station mode /* Clear the information for the peer
zfZeroMemory((u8_t*)wd->sta.oppositeInfo, sizeof(struct zsOppositeInfo) * ZM_MAX_OPPOSITE_COUNT); stations of IBSS or AP of Station mode
*/
zfZeroMemory((u8_t *)wd->sta.oppositeInfo,
sizeof(struct zsOppositeInfo) * ZM_MAX_OPPOSITE_COUNT);
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
...@@ -1496,36 +1402,35 @@ u16_t zfWlanReset(zdev_t* dev) ...@@ -1496,36 +1402,35 @@ u16_t zfWlanReset(zdev_t* dev)
zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_EXTERNAL); zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_EXTERNAL);
/* Turn off Software WEP/TKIP */ /* Turn off Software WEP/TKIP */
if (wd->sta.SWEncryptEnable != 0) if (wd->sta.SWEncryptEnable != 0) {
{
zm_debug_msg0("Disable software encryption"); zm_debug_msg0("Disable software encryption");
zfStaDisableSWEncryption(dev); zfStaDisableSWEncryption(dev);
} }
/* Improve WEP/TKIP performace with HT AP, detail information please look bug#32495 */ /* Improve WEP/TKIP performace with HT AP,
//zfHpSetTTSIFSTime(dev, 0x8); detail information please look bug#32495
*/
/* zfHpSetTTSIFSTime(dev, 0x8); */
/* Keep Pseudo mode */ /* Keep Pseudo mode */
if ( wd->wlanMode != ZM_MODE_PSEUDO ) if (wd->wlanMode != ZM_MODE_PSEUDO)
{
wd->wlanMode = ZM_MODE_INFRASTRUCTURE; wd->wlanMode = ZM_MODE_INFRASTRUCTURE;
}
return 0; return 0;
} }
/* Deauthenticate a STA */ /* Deauthenticate a STA */
u16_t zfiWlanDeauth(zdev_t* dev, u16_t* macAddr, u16_t reason) u16_t zfiWlanDeauth(zdev_t *dev, u16_t *macAddr, u16_t reason)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
if ( wd->wlanMode == ZM_MODE_AP ) if (wd->wlanMode == ZM_MODE_AP) {
{ /* u16_t id; */
//u16_t id;
/* /*
* we will reset all key in zfHpResetKeyCache() when call * we will reset all key in zfHpResetKeyCache() when call
* zfiWlanDisable(), if we want to reset PairwiseKey for each sta, * zfiWlanDisable(), if we want to reset PairwiseKey for each
* need to use a nullAddr to let keyindex not match. * sta, need to use a nullAddr to let keyindex not match.
* otherwise hardware will still find PairwiseKey when AP change * otherwise hardware will still find PairwiseKey when AP change
* encryption mode from WPA to WEP * encryption mode from WPA to WEP
*/ */
...@@ -1548,12 +1453,11 @@ u16_t zfiWlanDeauth(zdev_t* dev, u16_t* macAddr, u16_t reason) ...@@ -1548,12 +1453,11 @@ u16_t zfiWlanDeauth(zdev_t* dev, u16_t* macAddr, u16_t reason)
} }
*/ */
zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, macAddr, reason, 0, 0); zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, macAddr,
} reason, 0, 0);
else } else
{ zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH,
zfSendMmFrame(dev, ZM_WLAN_FRAME_TYPE_DEAUTH, wd->sta.bssid, 3, 0, 0); wd->sta.bssid, 3, 0, 0);
}
/* Issue DEAUTH command to FW */ /* Issue DEAUTH command to FW */
return 0; return 0;
...@@ -1561,9 +1465,10 @@ u16_t zfiWlanDeauth(zdev_t* dev, u16_t* macAddr, u16_t reason) ...@@ -1561,9 +1465,10 @@ u16_t zfiWlanDeauth(zdev_t* dev, u16_t* macAddr, u16_t reason)
/* XP packet filter feature : */ /* XP packet filter feature : */
/* 1=>enable: All multicast address packets, not just the ones enumerated in the multicast address list. */ /* 1=>enable: All multicast address packets, not just the ones */
/* enumerated in the multicast address list. */
/* 0=>disable */ /* 0=>disable */
void zfiWlanSetAllMulticast(zdev_t* dev, u32_t setting) void zfiWlanSetAllMulticast(zdev_t *dev, u32_t setting)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
zm_msg1_mm(ZM_LV_0, "sta.bAllMulticast = ", setting); zm_msg1_mm(ZM_LV_0, "sta.bAllMulticast = ", setting);
...@@ -1572,7 +1477,7 @@ void zfiWlanSetAllMulticast(zdev_t* dev, u32_t setting) ...@@ -1572,7 +1477,7 @@ void zfiWlanSetAllMulticast(zdev_t* dev, u32_t setting)
/* HT configure API */ /* HT configure API */
void zfiWlanSetHTCtrl(zdev_t* dev, u32_t *setting, u32_t forceTxTPC) void zfiWlanSetHTCtrl(zdev_t *dev, u32_t *setting, u32_t forceTxTPC)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1589,7 +1494,7 @@ void zfiWlanSetHTCtrl(zdev_t* dev, u32_t *setting, u32_t forceTxTPC) ...@@ -1589,7 +1494,7 @@ void zfiWlanSetHTCtrl(zdev_t* dev, u32_t *setting, u32_t forceTxTPC)
} }
/* FB50 in OS XP, RD private test code */ /* FB50 in OS XP, RD private test code */
void zfiWlanQueryHTCtrl(zdev_t* dev, u32_t *setting, u32_t *forceTxTPC) void zfiWlanQueryHTCtrl(zdev_t *dev, u32_t *setting, u32_t *forceTxTPC)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1605,7 +1510,7 @@ void zfiWlanQueryHTCtrl(zdev_t* dev, u32_t *setting, u32_t *forceTxTPC) ...@@ -1605,7 +1510,7 @@ void zfiWlanQueryHTCtrl(zdev_t* dev, u32_t *setting, u32_t *forceTxTPC)
*forceTxTPC = wd->forceTxTPC; *forceTxTPC = wd->forceTxTPC;
} }
void zfiWlanDbg(zdev_t* dev, u8_t setting) void zfiWlanDbg(zdev_t *dev, u8_t setting)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1613,23 +1518,19 @@ void zfiWlanDbg(zdev_t* dev, u8_t setting) ...@@ -1613,23 +1518,19 @@ void zfiWlanDbg(zdev_t* dev, u8_t setting)
} }
/* FB50 in OS XP, RD private test code */ /* FB50 in OS XP, RD private test code */
void zfiWlanSetRxPacketDump(zdev_t* dev, u32_t setting) void zfiWlanSetRxPacketDump(zdev_t *dev, u32_t setting)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
if (setting) if (setting)
{
wd->rxPacketDump = 1; /* enable */ wd->rxPacketDump = 1; /* enable */
}
else else
{
wd->rxPacketDump = 0; /* disable */ wd->rxPacketDump = 0; /* disable */
}
} }
/* FB50 in OS XP, RD private test code */ /* FB50 in OS XP, RD private test code */
/* Tally */ /* Tally */
void zfiWlanResetTally(zdev_t* dev) void zfiWlanResetTally(zdev_t *dev)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1637,39 +1538,39 @@ void zfiWlanResetTally(zdev_t* dev) ...@@ -1637,39 +1538,39 @@ void zfiWlanResetTally(zdev_t* dev)
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
wd->commTally.txUnicastFrm = 0; //txUnicastFrames wd->commTally.txUnicastFrm = 0; /* txUnicastFrames */
wd->commTally.txMulticastFrm = 0; //txMulticastFrames wd->commTally.txMulticastFrm = 0; /* txMulticastFrames */
wd->commTally.txUnicastOctets = 0; //txUniOctets byte size wd->commTally.txUnicastOctets = 0; /* txUniOctets byte size */
wd->commTally.txMulticastOctets = 0; //txMultiOctets byte size wd->commTally.txMulticastOctets = 0; /* txMultiOctets byte size */
wd->commTally.txFrmUpperNDIS = 0; wd->commTally.txFrmUpperNDIS = 0;
wd->commTally.txFrmDrvMgt = 0; wd->commTally.txFrmDrvMgt = 0;
wd->commTally.RetryFailCnt = 0; wd->commTally.RetryFailCnt = 0;
wd->commTally.Hw_TotalTxFrm = 0; //Hardware total Tx Frame wd->commTally.Hw_TotalTxFrm = 0; /* Hardware total Tx Frame */
wd->commTally.Hw_RetryCnt = 0; //txMultipleRetriesFrames wd->commTally.Hw_RetryCnt = 0; /* txMultipleRetriesFrames */
wd->commTally.Hw_UnderrunCnt = 0;// wd->commTally.Hw_UnderrunCnt = 0;
wd->commTally.DriverRxFrmCnt = 0;// wd->commTally.DriverRxFrmCnt = 0;
wd->commTally.rxUnicastFrm = 0; //rxUnicastFrames wd->commTally.rxUnicastFrm = 0; /* rxUnicastFrames */
wd->commTally.rxMulticastFrm = 0; //rxMulticastFrames wd->commTally.rxMulticastFrm = 0; /* rxMulticastFrames */
wd->commTally.NotifyNDISRxFrmCnt = 0;// wd->commTally.NotifyNDISRxFrmCnt = 0;
wd->commTally.rxUnicastOctets = 0; //rxUniOctets byte size wd->commTally.rxUnicastOctets = 0; /* rxUniOctets byte size */
wd->commTally.rxMulticastOctets = 0; //rxMultiOctets byte size wd->commTally.rxMulticastOctets = 0; /* rxMultiOctets byte size */
wd->commTally.DriverDiscardedFrm = 0;// Discard by ValidateFrame wd->commTally.DriverDiscardedFrm = 0; /* Discard by ValidateFrame */
wd->commTally.LessThanDataMinLen = 0;// wd->commTally.LessThanDataMinLen = 0;
wd->commTally.GreaterThanMaxLen = 0;// wd->commTally.GreaterThanMaxLen = 0;
wd->commTally.DriverDiscardedFrmCauseByMulticastList = 0; wd->commTally.DriverDiscardedFrmCauseByMulticastList = 0;
wd->commTally.DriverDiscardedFrmCauseByFrmCtrl = 0; wd->commTally.DriverDiscardedFrmCauseByFrmCtrl = 0;
wd->commTally.rxNeedFrgFrm = 0; // need more frg frm wd->commTally.rxNeedFrgFrm = 0; /* need more frg frm */
wd->commTally.DriverRxMgtFrmCnt = 0; wd->commTally.DriverRxMgtFrmCnt = 0;
wd->commTally.rxBroadcastFrm = 0; //Receive broadcast frame count wd->commTally.rxBroadcastFrm = 0;/* Receive broadcast frame count */
wd->commTally.rxBroadcastOctets = 0; //Receive broadcast frame byte size wd->commTally.rxBroadcastOctets = 0;/*Receive broadcast framebyte size*/
wd->commTally.Hw_TotalRxFrm = 0;// wd->commTally.Hw_TotalRxFrm = 0;
wd->commTally.Hw_CRC16Cnt = 0; //rxPLCPCRCErrCnt wd->commTally.Hw_CRC16Cnt = 0; /* rxPLCPCRCErrCnt */
wd->commTally.Hw_CRC32Cnt = 0; //rxCRC32ErrCnt wd->commTally.Hw_CRC32Cnt = 0; /* rxCRC32ErrCnt */
wd->commTally.Hw_DecrypErr_UNI = 0;// wd->commTally.Hw_DecrypErr_UNI = 0;
wd->commTally.Hw_DecrypErr_Mul = 0;// wd->commTally.Hw_DecrypErr_Mul = 0;
wd->commTally.Hw_RxFIFOOverrun = 0;// wd->commTally.Hw_RxFIFOOverrun = 0;
wd->commTally.Hw_RxTimeOut = 0; wd->commTally.Hw_RxTimeOut = 0;
wd->commTally.LossAP = 0;// wd->commTally.LossAP = 0;
wd->commTally.Tx_MPDU = 0; wd->commTally.Tx_MPDU = 0;
wd->commTally.BA_Fail = 0; wd->commTally.BA_Fail = 0;
...@@ -1702,34 +1603,37 @@ void zfiWlanResetTally(zdev_t* dev) ...@@ -1702,34 +1603,37 @@ void zfiWlanResetTally(zdev_t* dev)
} }
/* FB50 in OS XP, RD private test code */ /* FB50 in OS XP, RD private test code */
void zfiWlanQueryTally(zdev_t* dev, struct zsCommTally *tally) void zfiWlanQueryTally(zdev_t *dev, struct zsCommTally *tally)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section(); zmw_declare_for_critical_section();
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
zfMemoryCopy((u8_t*)tally, (u8_t*)&wd->commTally, sizeof(struct zsCommTally)); zfMemoryCopy((u8_t *)tally, (u8_t *)&wd->commTally,
sizeof(struct zsCommTally));
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
} }
void zfiWlanQueryTrafTally(zdev_t* dev, struct zsTrafTally *tally)
void zfiWlanQueryTrafTally(zdev_t *dev, struct zsTrafTally *tally)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section(); zmw_declare_for_critical_section();
zmw_enter_critical_section(dev); zmw_enter_critical_section(dev);
zfMemoryCopy((u8_t*)tally, (u8_t*)&wd->trafTally, sizeof(struct zsTrafTally)); zfMemoryCopy((u8_t *)tally, (u8_t *)&wd->trafTally,
sizeof(struct zsTrafTally));
zmw_leave_critical_section(dev); zmw_leave_critical_section(dev);
} }
void zfiWlanQueryMonHalRxInfo(zdev_t* dev, struct zsMonHalRxInfo *monHalRxInfo) void zfiWlanQueryMonHalRxInfo(zdev_t *dev, struct zsMonHalRxInfo *monHalRxInfo)
{ {
zfHpQueryMonHalRxInfo(dev, (u8_t *)monHalRxInfo); zfHpQueryMonHalRxInfo(dev, (u8_t *)monHalRxInfo);
} }
/* parse the modeMDKEnable to DrvCore */ /* parse the modeMDKEnable to DrvCore */
void zfiDKEnable(zdev_t* dev, u32_t enable) void zfiDKEnable(zdev_t *dev, u32_t enable)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1738,7 +1642,7 @@ void zfiDKEnable(zdev_t* dev, u32_t enable) ...@@ -1738,7 +1642,7 @@ void zfiDKEnable(zdev_t* dev, u32_t enable)
} }
/* airoPeek */ /* airoPeek */
u32_t zfiWlanQueryPacketTypePromiscuous(zdev_t* dev) u32_t zfiWlanQueryPacketTypePromiscuous(zdev_t *dev)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
...@@ -1746,48 +1650,41 @@ u32_t zfiWlanQueryPacketTypePromiscuous(zdev_t* dev) ...@@ -1746,48 +1650,41 @@ u32_t zfiWlanQueryPacketTypePromiscuous(zdev_t* dev)
} }
/* airoPeek */ /* airoPeek */
void zfiWlanSetPacketTypePromiscuous(zdev_t* dev, u32_t setValue) void zfiWlanSetPacketTypePromiscuous(zdev_t *dev, u32_t setValue)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
wd->swSniffer = setValue; wd->swSniffer = setValue;
zm_msg1_mm(ZM_LV_0, "wd->swSniffer ", wd->swSniffer); zm_msg1_mm(ZM_LV_0, "wd->swSniffer ", wd->swSniffer);
if (setValue) if (setValue) {
{
/* write register for sniffer mode */ /* write register for sniffer mode */
zfHpSetSnifferMode(dev, 1); zfHpSetSnifferMode(dev, 1);
zm_msg0_mm(ZM_LV_1, "enalbe sniffer mode"); zm_msg0_mm(ZM_LV_1, "enalbe sniffer mode");
} } else {
else
{
zfHpSetSnifferMode(dev, 0); zfHpSetSnifferMode(dev, 0);
zm_msg0_mm(ZM_LV_0, "disalbe sniffer mode"); zm_msg0_mm(ZM_LV_0, "disalbe sniffer mode");
} }
} }
void zfiWlanSetXLinkMode(zdev_t* dev, u32_t setValue) void zfiWlanSetXLinkMode(zdev_t *dev, u32_t setValue)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
wd->XLinkMode = setValue; wd->XLinkMode = setValue;
if (setValue) if (setValue) {
{
/* write register for sniffer mode */ /* write register for sniffer mode */
zfHpSetSnifferMode(dev, 1); zfHpSetSnifferMode(dev, 1);
} } else
else
{
zfHpSetSnifferMode(dev, 0); zfHpSetSnifferMode(dev, 0);
}
} }
extern void zfStaChannelManagement(zdev_t* dev, u8_t scan); extern void zfStaChannelManagement(zdev_t *dev, u8_t scan);
void zfiSetChannelManagement(zdev_t* dev, u32_t setting)
void zfiSetChannelManagement(zdev_t *dev, u32_t setting)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
switch (setting) switch (setting) {
{
case 1: case 1:
wd->sta.EnableHT = 1; wd->sta.EnableHT = 1;
wd->BandWidth40 = 1; wd->BandWidth40 = 1;
...@@ -1807,53 +1704,60 @@ void zfiSetChannelManagement(zdev_t* dev, u32_t setting) ...@@ -1807,53 +1704,60 @@ void zfiSetChannelManagement(zdev_t* dev, u32_t setting)
wd->BandWidth40 = 0; wd->BandWidth40 = 0;
wd->ExtOffset = 0; wd->ExtOffset = 0;
break; break;
} }
zfCoreSetFrequencyEx(dev, wd->frequency, wd->BandWidth40, zfCoreSetFrequencyEx(dev, wd->frequency, wd->BandWidth40,
wd->ExtOffset, NULL); wd->ExtOffset, NULL);
} }
void zfiSetRifs(zdev_t* dev, u16_t setting) void zfiSetRifs(zdev_t *dev, u16_t setting)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
wd->sta.ie.HtInfo.ChannelInfo |= ExtHtCap_RIFSMode; wd->sta.ie.HtInfo.ChannelInfo |= ExtHtCap_RIFSMode;
wd->sta.EnableHT = 1; wd->sta.EnableHT = 1;
switch (setting)
{ switch (setting) {
case 0: case 0:
wd->sta.HT2040 = 0; wd->sta.HT2040 = 0;
// zfHpSetRifs(dev, 1, 0, (wd->sta.currentFrequency < 3000)? 1:0); /* zfHpSetRifs(dev, 1, 0,
* (wd->sta.currentFrequency < 3000)? 1:0);
*/
break; break;
case 1: case 1:
wd->sta.HT2040 = 1; wd->sta.HT2040 = 1;
// zfHpSetRifs(dev, 1, 1, (wd->sta.currentFrequency < 3000)? 1:0); /* zfHpSetRifs(dev, 1, 1,
* (wd->sta.currentFrequency < 3000)? 1:0);
*/
break; break;
default: default:
wd->sta.HT2040 = 0; wd->sta.HT2040 = 0;
// zfHpSetRifs(dev, 1, 0, (wd->sta.currentFrequency < 3000)? 1:0); /* zfHpSetRifs(dev, 1, 0,
* (wd->sta.currentFrequency < 3000)? 1:0);
*/
break; break;
} }
} }
void zfiCheckRifs(zdev_t* dev) void zfiCheckRifs(zdev_t *dev)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
if(wd->sta.ie.HtInfo.ChannelInfo & ExtHtCap_RIFSMode) if (wd->sta.ie.HtInfo.ChannelInfo & ExtHtCap_RIFSMode)
{ ;
// zfHpSetRifs(dev, wd->sta.EnableHT, wd->sta.HT2040, (wd->sta.currentFrequency < 3000)? 1:0); /* zfHpSetRifs(dev, wd->sta.EnableHT, wd->sta.HT2040,
} * (wd->sta.currentFrequency < 3000)? 1:0);
*/
} }
void zfiSetReorder(zdev_t* dev, u16_t value) void zfiSetReorder(zdev_t *dev, u16_t value)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
wd->reorder = value; wd->reorder = value;
} }
void zfiSetSeqDebug(zdev_t* dev, u16_t value) void zfiSetSeqDebug(zdev_t *dev, u16_t value)
{ {
zmw_get_wlan_dev(dev); zmw_get_wlan_dev(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment