1#ifndef __WINBOND_MLME_H 2#define __WINBOND_MLME_H 3 4#include <linux/types.h> 5#include <linux/spinlock.h> 6 7#include "mac_structures.h" 8#include "mds_s.h" 9 10/* 11 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 12 * Mlme.h 13 * Define the related definitions of MLME module 14 * 15 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 16 */ 17 18#define AUTH_REJECT_REASON_CHALLENGE_FAIL 1 19 20/* the state of MLME module */ 21#define INACTIVE 0x0 22#define IDLE_SCAN 0x1 23 24/* the state of MLME/ESS module */ 25#define STATE_1 0x2 26#define AUTH_REQ 0x3 27#define AUTH_WEP 0x4 28#define STATE_2 0x5 29#define ASSOC_REQ 0x6 30#define STATE_3 0x7 31 32/* the state of MLME/IBSS module */ 33#define IBSS_JOIN_SYNC 0x8 34#define IBSS_AUTH_REQ 0x9 35#define IBSS_AUTH_CHANLGE 0xa 36#define IBSS_AUTH_WEP 0xb 37#define IBSS_AUTH_IND 0xc 38#define IBSS_STATE_2 0xd 39 40 41 42/* 43 * ========================================= 44 * depend on D5C(MAC timing control 03 register): 45 * MaxTxMSDULifeTime default 0x80000us 46 */ 47#define AUTH_FAIL_TIMEOUT 550 48#define ASSOC_FAIL_TIMEOUT 550 49#define REASSOC_FAIL_TIMEOUT 550 50 51/* MLME task global CONSTANTS, STRUCTURE, variables */ 52 53/* ========================================= 54 * enum_ResultCode -- 55 * Result code returned from MLME to SME. 56 * ========================================= 57 */ 58#define MLME_SUCCESS 0 /* follow spec. */ 59#define INVALID_PARAMETERS 1 /* Not following spec. */ 60#define NOT_SUPPPORTED 2 61#define TIMEOUT 3 62#define TOO_MANY_SIMULTANEOUS_REQUESTS 4 63#define REFUSED 5 64#define BSS_ALREADY_STARTED_OR_JOINED 6 65#define TRANSMIT_FRAME_FAIL 7 66#define NO_BSS_FOUND 8 67#define RETRY 9 68#define GIVE_UP 10 69 70 71#define OPEN_AUTH 0 72#define SHARE_AUTH 1 73#define ANY_AUTH 2 74#define WPA_AUTH 3 /* for WPA */ 75#define WPAPSK_AUTH 4 76#define WPANONE_AUTH 5 77#ifdef _WPA2_ 78#define WPA2_AUTH 6 /* for WPA2 */ 79#define WPA2PSK_AUTH 7 80#endif /* end def _WPA2_ */ 81 82/* 83 * ========================================= 84 * define the msg type of MLME module 85 * ========================================= 86 */ 87 88/* from SME */ 89#define MLMEMSG_AUTH_REQ 0x0b 90#define MLMEMSG_DEAUTH_REQ 0x0c 91#define MLMEMSG_ASSOC_REQ 0x0d 92#define MLMEMSG_REASSOC_REQ 0x0e 93#define MLMEMSG_DISASSOC_REQ 0x0f 94#define MLMEMSG_START_IBSS_REQ 0x10 95#define MLMEMSG_IBSS_NET_CFM 0x11 96 97/* from RX */ 98#define MLMEMSG_RCV_MLMEFRAME 0x20 99#define MLMEMSG_RCV_ASSOCRSP 0x22 100#define MLMEMSG_RCV_REASSOCRSP 0x24 101#define MLMEMSG_RCV_DISASSOC 0x2b 102#define MLMEMSG_RCV_AUTH 0x2c 103#define MLMEMSG_RCV_DEAUTH 0x2d 104 105 106/* from TX callback */ 107#define MLMEMSG_TX_CALLBACK 0x40 108#define MLMEMSG_ASSOCREQ_CALLBACK 0x41 109#define MLMEMSG_REASSOCREQ_CALLBACK 0x43 110#define MLMEMSG_DISASSOC_CALLBACK 0x4a 111#define MLMEMSG_AUTH_CALLBACK 0x4c 112#define MLMEMSG_DEAUTH_CALLBACK 0x4d 113 114#define MLMEMSG_TIMEOUT 0x50 115 116/* 117 * ============================================== 118 * Global data structures 119 * ============================================== 120 */ 121#define MAX_NUM_TX_MMPDU 2 122#define MAX_MMPDU_SIZE 1512 123#define MAX_NUM_RX_MMPDU 6 124 125 126/* 127 * ============================================== 128 * MACRO 129 * ============================================== 130 */ 131#define boMLME_InactiveState(_AA_) (_AA_->wState == INACTIVE) 132#define boMLME_IdleScanState(_BB_) (_BB_->wState == IDLE_SCAN) 133#define boMLME_FoundSTAinfo(_CC_) (_CC_->wState >= IDLE_SCAN) 134 135typedef struct _MLME_FRAME { 136 s8 *pMMPDU; 137 u16 len; 138 u8 DataType; 139 u8 IsInUsed; 140 141 spinlock_t MLMESpinLock; 142 143 u8 TxMMPDU[MAX_NUM_TX_MMPDU][MAX_MMPDU_SIZE]; 144 u8 TxMMPDUInUse[(MAX_NUM_TX_MMPDU + 3) & ~0x03]; 145 146 u16 wNumTxMMPDU; 147 u16 wNumTxMMPDUDiscarded; 148 149 u8 RxMMPDU[MAX_NUM_RX_MMPDU][MAX_MMPDU_SIZE]; 150 u8 SaveRxBufSlotInUse[(MAX_NUM_RX_MMPDU + 3) & ~0x03]; 151 152 u16 wNumRxMMPDU; 153 u16 wNumRxMMPDUDiscarded; 154 155 u16 wNumRxMMPDUInMLME; /* Number of the Rx MMPDU */ 156 u16 reserved_1; /* in MLME. */ 157 /* excluding the discarded */ 158} MLME_FRAME, *psMLME_FRAME; 159 160typedef struct _AUTHREQ { 161 162 u8 peerMACaddr[MAC_ADDR_LENGTH]; 163 u16 wAuthAlgorithm; 164} MLME_AUTHREQ_PARA, *psMLME_AUTHREQ_PARA; 165 166typedef struct _ASSOCREQ { 167 u8 PeerSTAAddr[MAC_ADDR_LENGTH]; 168 u16 CapabilityInfo; 169 u16 ListenInterval; 170} __attribute__ ((packed)) MLME_ASSOCREQ_PARA, *psMLME_ASSOCREQ_PARA; 171 172typedef struct _REASSOCREQ { 173 u8 NewAPAddr[MAC_ADDR_LENGTH]; 174 u16 CapabilityInfo; 175 u16 ListenInterval; 176} __attribute__ ((packed)) MLME_REASSOCREQ_PARA, *psMLME_REASSOCREQ_PARA; 177 178typedef struct _MLMECALLBACK { 179 u8 *psFramePtr; 180 u8 bResult; 181} MLME_TXCALLBACK, *psMLME_TXCALLBACK; 182 183typedef struct _RXDATA { 184 s32 FrameLength; 185 u8 __attribute__ ((packed)) *pbFramePtr; 186} __attribute__ ((packed)) RXDATA, *psRXDATA; 187 188#endif 189