Staging: rspiusb: remove the driver
[safe/jmp/linux-2.6] / drivers / staging / rt3090 / ap_wds.h
1 /*
2  *************************************************************************
3  * Ralink Tech Inc.
4  * 5F., No.36, Taiyuan St., Jhubei City,
5  * Hsinchu County 302,
6  * Taiwan, R.O.C.
7  *
8  * (c) Copyright 2002-2007, Ralink Technology, Inc.
9  *
10  * This program is free software; you can redistribute it and/or modify  *
11  * it under the terms of the GNU General Public License as published by  *
12  * the Free Software Foundation; either version 2 of the License, or     *
13  * (at your option) any later version.                                   *
14  *                                                                       *
15  * This program is distributed in the hope that it will be useful,       *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
18  * GNU General Public License for more details.                          *
19  *                                                                       *
20  * You should have received a copy of the GNU General Public License     *
21  * along with this program; if not, write to the                         *
22  * Free Software Foundation, Inc.,                                       *
23  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
24  *                                                                       *
25  *************************************************************************
26
27     Module Name:
28     ap_cfg.h
29
30     Abstract:
31     Miniport generic portion header file
32
33     Revision History:
34     Who         When          What
35     --------    ----------    ----------------------------------------------
36     Fonchi    02-13-2007      created
37 */
38
39 #ifndef _AP_WDS_H_
40 #define _AP_WDS_H_
41
42 #define WDS_ENTRY_RETRY_INTERVAL        (100 * OS_HZ / 1000)
43
44
45 static inline BOOLEAN WDS_IF_UP_CHECK(
46         IN  PRTMP_ADAPTER   pAd,
47         IN  ULONG ifidx)
48 {
49         if ((pAd->flg_wds_init != TRUE) ||
50                 (ifidx >= MAX_WDS_ENTRY))
51                 return FALSE;
52
53 //      if (pAd->WdsTab.WdsEntry[ifidx].dev->flags & IFF_UP)
54 // Patch for wds ,when dirver call apmlmeperiod => APMlmeDynamicTxRateSwitching check if wds device ready
55 if ((pAd->WdsTab.WdsEntry[ifidx].dev != NULL) && (pAd->WdsTab.WdsEntry[ifidx].dev->flags & IFF_UP))
56                 return TRUE;
57
58         return FALSE;
59 }
60
61 LONG WdsEntryAlloc(
62         IN PRTMP_ADAPTER pAd,
63         IN PUCHAR pAddr);
64
65 VOID WdsEntryDel(
66         IN PRTMP_ADAPTER pAd,
67         IN PUCHAR pAddr);
68
69 MAC_TABLE_ENTRY *MacTableInsertWDSEntry(
70         IN  PRTMP_ADAPTER   pAd,
71         IN  PUCHAR pAddr,
72         UINT WdsTabIdx);
73
74 BOOLEAN MacTableDeleteWDSEntry(
75         IN PRTMP_ADAPTER pAd,
76         IN USHORT wcid,
77         IN PUCHAR pAddr);
78
79
80 BOOLEAN ApWdsAllowToSendPacket(
81         IN RTMP_ADAPTER *pAd,
82         IN PNDIS_PACKET pPacket,
83         OUT     UCHAR           *pWcid);
84
85 MAC_TABLE_ENTRY *WdsTableLookupByWcid(
86     IN  PRTMP_ADAPTER   pAd,
87         IN UCHAR wcid,
88         IN PUCHAR pAddr,
89         IN BOOLEAN bResetIdelCount);
90
91 MAC_TABLE_ENTRY *WdsTableLookup(
92     IN  PRTMP_ADAPTER   pAd,
93     IN  PUCHAR          pAddr,
94         IN BOOLEAN bResetIdelCount);
95
96 MAC_TABLE_ENTRY *FindWdsEntry(
97         IN PRTMP_ADAPTER        pAd,
98         IN UCHAR                        Wcid,
99         IN PUCHAR                       pAddr,
100         IN UINT32                       PhyMode);
101
102 VOID WdsTableMaintenance(
103     IN PRTMP_ADAPTER    pAd);
104
105 VOID RT28xx_WDS_Init(
106         IN PRTMP_ADAPTER pAd,
107         IN PNET_DEV net_dev);
108
109 VOID RT28xx_WDS_Close(
110         IN PRTMP_ADAPTER pAd);
111
112 VOID RT28xx_WDS_Remove(
113         IN PRTMP_ADAPTER pAd);
114
115 VOID WdsDown(
116         IN PRTMP_ADAPTER pAd);
117
118 VOID AsicUpdateWdsRxWCIDTable(
119         IN PRTMP_ADAPTER pAd);
120
121 VOID AsicUpdateWdsEncryption(
122         IN PRTMP_ADAPTER pAd,
123         IN UCHAR wcid);
124
125 VOID WdsPeerBeaconProc(
126         IN PRTMP_ADAPTER pAd,
127         IN PMAC_TABLE_ENTRY pEntry,
128         IN USHORT CapabilityInfo,
129         IN UCHAR MaxSupportedRateIn500Kbps,
130         IN UCHAR MaxSupportedRateLen,
131         IN BOOLEAN bWmmCapable,
132         IN ULONG ClientRalinkIe,
133         IN HT_CAPABILITY_IE *pHtCapability,
134         IN UCHAR HtCapabilityLen);
135
136 VOID APWdsInitialize(
137         IN PRTMP_ADAPTER pAd);
138
139 INT     Show_WdsTable_Proc(
140         IN      PRTMP_ADAPTER   pAd,
141         IN      PSTRING                 arg);
142
143 VOID rtmp_read_wds_from_file(
144                         IN  PRTMP_ADAPTER pAd,
145                         PSTRING tmpbuf,
146                         PSTRING buffer);
147
148 VOID WdsPrepareWepKeyFromMainBss(
149         IN  PRTMP_ADAPTER pAd);
150
151 INT WdsVirtualIFSendPackets(
152         IN PNDIS_PACKET pSkb,
153         IN PNET_DEV dev);
154
155 INT WdsVirtualIF_open(
156         IN PNET_DEV dev);
157
158 INT WdsVirtualIF_close(
159         IN PNET_DEV dev);
160
161 INT WdsVirtualIF_ioctl(
162         IN PNET_DEV net_dev,
163         IN OUT struct ifreq *rq,
164         IN INT cmd);
165
166 /*
167         ==========================================================================
168         Description:
169                 Check the WDS Entry is valid or not.
170         ==========================================================================
171  */
172 static inline BOOLEAN ValidWdsEntry(
173         IN PRTMP_ADAPTER pAd,
174         IN UCHAR WdsIndex)
175 {
176         BOOLEAN result;
177         PMAC_TABLE_ENTRY pMacEntry;
178
179         do
180         {
181                 if (WdsIndex >= MAX_WDS_ENTRY)
182                 {
183                         result = FALSE;
184                         break;
185                 }
186
187                 if (pAd->WdsTab.WdsEntry[WdsIndex].Valid != TRUE)
188                 {
189                         result = FALSE;
190                         break;
191                 }
192
193                 if ((pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID==0)
194                         || (pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID >= MAX_LEN_OF_MAC_TABLE))
195                 {
196                         result = FALSE;
197                         break;
198                 }
199
200                 pMacEntry = &pAd->MacTab.Content[pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID];
201                 if (pMacEntry->ValidAsWDS != TRUE)
202                 {
203                         result = FALSE;
204                         break;
205                 }
206
207                 result = TRUE;
208         } while(FALSE);
209
210         return result;
211 }
212 #endif // _AP_WDS_H_ //