[TG3]: Add tagged status support.
[linux-2.6/verdex.git] / drivers / net / sk98lin / h / skaddr.h
blob3a2ea4a4b5390f421a5952823df58331368f7cd2
1 /******************************************************************************
3 * Name: skaddr.h
4 * Project: Gigabit Ethernet Adapters, ADDR-Modul
5 * Version: $Revision: 1.29 $
6 * Date: $Date: 2003/05/13 16:57:24 $
7 * Purpose: Header file for Address Management (MC, UC, Prom).
9 ******************************************************************************/
11 /******************************************************************************
13 * (C)Copyright 1998-2002 SysKonnect GmbH.
14 * (C)Copyright 2002-2003 Marvell.
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * The information in this file is provided "AS IS" without warranty.
23 ******************************************************************************/
25 /******************************************************************************
27 * Description:
29 * This module is intended to manage multicast addresses and promiscuous mode
30 * on GEnesis adapters.
32 * Include File Hierarchy:
34 * "skdrv1st.h"
35 * ...
36 * "sktypes.h"
37 * "skqueue.h"
38 * "skaddr.h"
39 * ...
40 * "skdrv2nd.h"
42 ******************************************************************************/
44 #ifndef __INC_SKADDR_H
45 #define __INC_SKADDR_H
47 #ifdef __cplusplus
48 extern "C" {
49 #endif /* cplusplus */
51 /* defines ********************************************************************/
53 #define SK_MAC_ADDR_LEN 6 /* Length of MAC address. */
54 #define SK_MAX_ADDRS 14 /* #Addrs for exact match. */
56 /* ----- Common return values ----- */
58 #define SK_ADDR_SUCCESS 0 /* Function returned successfully. */
59 #define SK_ADDR_ILLEGAL_PORT 100 /* Port number too high. */
60 #define SK_ADDR_TOO_EARLY 101 /* Function called too early. */
62 /* ----- Clear/Add flag bits ----- */
64 #define SK_ADDR_PERMANENT 1 /* RLMT Address */
66 /* ----- Additional Clear flag bits ----- */
68 #define SK_MC_SW_ONLY 2 /* Do not update HW when clearing. */
70 /* ----- Override flag bits ----- */
72 #define SK_ADDR_LOGICAL_ADDRESS 0
73 #define SK_ADDR_VIRTUAL_ADDRESS (SK_ADDR_LOGICAL_ADDRESS) /* old */
74 #define SK_ADDR_PHYSICAL_ADDRESS 1
75 #define SK_ADDR_CLEAR_LOGICAL 2
76 #define SK_ADDR_SET_LOGICAL 4
78 /* ----- Override return values ----- */
80 #define SK_ADDR_OVERRIDE_SUCCESS (SK_ADDR_SUCCESS)
81 #define SK_ADDR_DUPLICATE_ADDRESS 1
82 #define SK_ADDR_MULTICAST_ADDRESS 2
84 /* ----- Partitioning of excact match table ----- */
86 #define SK_ADDR_EXACT_MATCHES 16 /* #Exact match entries. */
88 #define SK_ADDR_FIRST_MATCH_RLMT 1
89 #define SK_ADDR_LAST_MATCH_RLMT 2
90 #define SK_ADDR_FIRST_MATCH_DRV 3
91 #define SK_ADDR_LAST_MATCH_DRV (SK_ADDR_EXACT_MATCHES - 1)
93 /* ----- SkAddrMcAdd/SkAddrMcUpdate return values ----- */
95 #define SK_MC_FILTERING_EXACT 0 /* Exact filtering. */
96 #define SK_MC_FILTERING_INEXACT 1 /* Inexact filtering. */
98 /* ----- Additional SkAddrMcAdd return values ----- */
100 #define SK_MC_ILLEGAL_ADDRESS 2 /* Illegal address. */
101 #define SK_MC_ILLEGAL_PORT 3 /* Illegal port (not the active one). */
102 #define SK_MC_RLMT_OVERFLOW 4 /* Too many RLMT mc addresses. */
104 /* Promiscuous mode bits ----- */
106 #define SK_PROM_MODE_NONE 0 /* Normal receive. */
107 #define SK_PROM_MODE_LLC 1 /* Receive all LLC frames. */
108 #define SK_PROM_MODE_ALL_MC 2 /* Receive all multicast frames. */
109 /* #define SK_PROM_MODE_NON_LLC 4 */ /* Receive all non-LLC frames. */
111 /* Macros */
113 #ifdef OLD_STUFF
114 #ifndef SK_ADDR_EQUAL
116 * "&" instead of "&&" allows better optimization on IA-64.
117 * The replacement is safe here, as all bytes exist.
119 #ifndef SK_ADDR_DWORD_COMPARE
120 #define SK_ADDR_EQUAL(A1,A2) ( \
121 (((SK_U8 *)(A1))[5] == ((SK_U8 *)(A2))[5]) & \
122 (((SK_U8 *)(A1))[4] == ((SK_U8 *)(A2))[4]) & \
123 (((SK_U8 *)(A1))[3] == ((SK_U8 *)(A2))[3]) & \
124 (((SK_U8 *)(A1))[2] == ((SK_U8 *)(A2))[2]) & \
125 (((SK_U8 *)(A1))[1] == ((SK_U8 *)(A2))[1]) & \
126 (((SK_U8 *)(A1))[0] == ((SK_U8 *)(A2))[0]))
127 #else /* SK_ADDR_DWORD_COMPARE */
128 #define SK_ADDR_EQUAL(A1,A2) ( \
129 (*(SK_U32 *)&(((SK_U8 *)(A1))[2]) == *(SK_U32 *)&(((SK_U8 *)(A2))[2])) & \
130 (*(SK_U32 *)&(((SK_U8 *)(A1))[0]) == *(SK_U32 *)&(((SK_U8 *)(A2))[0])))
131 #endif /* SK_ADDR_DWORD_COMPARE */
132 #endif /* SK_ADDR_EQUAL */
133 #endif /* 0 */
135 #ifndef SK_ADDR_EQUAL
136 #ifndef SK_ADDR_DWORD_COMPARE
137 #define SK_ADDR_EQUAL(A1,A2) ( \
138 (((SK_U8 SK_FAR *)(A1))[5] == ((SK_U8 SK_FAR *)(A2))[5]) & \
139 (((SK_U8 SK_FAR *)(A1))[4] == ((SK_U8 SK_FAR *)(A2))[4]) & \
140 (((SK_U8 SK_FAR *)(A1))[3] == ((SK_U8 SK_FAR *)(A2))[3]) & \
141 (((SK_U8 SK_FAR *)(A1))[2] == ((SK_U8 SK_FAR *)(A2))[2]) & \
142 (((SK_U8 SK_FAR *)(A1))[1] == ((SK_U8 SK_FAR *)(A2))[1]) & \
143 (((SK_U8 SK_FAR *)(A1))[0] == ((SK_U8 SK_FAR *)(A2))[0]))
144 #else /* SK_ADDR_DWORD_COMPARE */
145 #define SK_ADDR_EQUAL(A1,A2) ( \
146 (*(SK_U16 SK_FAR *)&(((SK_U8 SK_FAR *)(A1))[4]) == \
147 *(SK_U16 SK_FAR *)&(((SK_U8 SK_FAR *)(A2))[4])) && \
148 (*(SK_U32 SK_FAR *)&(((SK_U8 SK_FAR *)(A1))[0]) == \
149 *(SK_U32 SK_FAR *)&(((SK_U8 SK_FAR *)(A2))[0])))
150 #endif /* SK_ADDR_DWORD_COMPARE */
151 #endif /* SK_ADDR_EQUAL */
153 /* typedefs *******************************************************************/
155 typedef struct s_MacAddr {
156 SK_U8 a[SK_MAC_ADDR_LEN];
157 } SK_MAC_ADDR;
160 /* SK_FILTER is used to ensure alignment of the filter. */
161 typedef union s_InexactFilter {
162 SK_U8 Bytes[8];
163 SK_U64 Val; /* Dummy entry for alignment only. */
164 } SK_FILTER64;
167 typedef struct s_AddrNet SK_ADDR_NET;
170 typedef struct s_AddrPort {
172 /* ----- Public part (read-only) ----- */
174 SK_MAC_ADDR CurrentMacAddress; /* Current physical MAC Address. */
175 SK_MAC_ADDR PermanentMacAddress; /* Permanent physical MAC Address. */
176 int PromMode; /* Promiscuous Mode. */
178 /* ----- Private part ----- */
180 SK_MAC_ADDR PreviousMacAddress; /* Prev. phys. MAC Address. */
181 SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */
182 SK_U8 Align01;
184 SK_U32 FirstExactMatchRlmt;
185 SK_U32 NextExactMatchRlmt;
186 SK_U32 FirstExactMatchDrv;
187 SK_U32 NextExactMatchDrv;
188 SK_MAC_ADDR Exact[SK_ADDR_EXACT_MATCHES];
189 SK_FILTER64 InexactFilter; /* For 64-bit hash register. */
190 SK_FILTER64 InexactRlmtFilter; /* For 64-bit hash register. */
191 SK_FILTER64 InexactDrvFilter; /* For 64-bit hash register. */
192 } SK_ADDR_PORT;
195 struct s_AddrNet {
196 /* ----- Public part (read-only) ----- */
198 SK_MAC_ADDR CurrentMacAddress; /* Logical MAC Address. */
199 SK_MAC_ADDR PermanentMacAddress; /* Logical MAC Address. */
201 /* ----- Private part ----- */
203 SK_U32 ActivePort; /* View of module ADDR. */
204 SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */
205 SK_U8 Align01;
206 SK_U16 Align02;
210 typedef struct s_Addr {
212 /* ----- Public part (read-only) ----- */
214 SK_ADDR_NET Net[SK_MAX_NETS];
215 SK_ADDR_PORT Port[SK_MAX_MACS];
217 /* ----- Private part ----- */
218 } SK_ADDR;
220 /* function prototypes ********************************************************/
222 #ifndef SK_KR_PROTO
224 /* Functions provided by SkAddr */
226 /* ANSI/C++ compliant function prototypes */
228 extern int SkAddrInit(
229 SK_AC *pAC,
230 SK_IOC IoC,
231 int Level);
233 extern int SkAddrMcClear(
234 SK_AC *pAC,
235 SK_IOC IoC,
236 SK_U32 PortNumber,
237 int Flags);
239 extern int SkAddrXmacMcClear(
240 SK_AC *pAC,
241 SK_IOC IoC,
242 SK_U32 PortNumber,
243 int Flags);
245 extern int SkAddrGmacMcClear(
246 SK_AC *pAC,
247 SK_IOC IoC,
248 SK_U32 PortNumber,
249 int Flags);
251 extern int SkAddrMcAdd(
252 SK_AC *pAC,
253 SK_IOC IoC,
254 SK_U32 PortNumber,
255 SK_MAC_ADDR *pMc,
256 int Flags);
258 extern int SkAddrXmacMcAdd(
259 SK_AC *pAC,
260 SK_IOC IoC,
261 SK_U32 PortNumber,
262 SK_MAC_ADDR *pMc,
263 int Flags);
265 extern int SkAddrGmacMcAdd(
266 SK_AC *pAC,
267 SK_IOC IoC,
268 SK_U32 PortNumber,
269 SK_MAC_ADDR *pMc,
270 int Flags);
272 extern int SkAddrMcUpdate(
273 SK_AC *pAC,
274 SK_IOC IoC,
275 SK_U32 PortNumber);
277 extern int SkAddrXmacMcUpdate(
278 SK_AC *pAC,
279 SK_IOC IoC,
280 SK_U32 PortNumber);
282 extern int SkAddrGmacMcUpdate(
283 SK_AC *pAC,
284 SK_IOC IoC,
285 SK_U32 PortNumber);
287 extern int SkAddrOverride(
288 SK_AC *pAC,
289 SK_IOC IoC,
290 SK_U32 PortNumber,
291 SK_MAC_ADDR SK_FAR *pNewAddr,
292 int Flags);
294 extern int SkAddrPromiscuousChange(
295 SK_AC *pAC,
296 SK_IOC IoC,
297 SK_U32 PortNumber,
298 int NewPromMode);
300 extern int SkAddrXmacPromiscuousChange(
301 SK_AC *pAC,
302 SK_IOC IoC,
303 SK_U32 PortNumber,
304 int NewPromMode);
306 extern int SkAddrGmacPromiscuousChange(
307 SK_AC *pAC,
308 SK_IOC IoC,
309 SK_U32 PortNumber,
310 int NewPromMode);
312 #ifndef SK_SLIM
313 extern int SkAddrSwap(
314 SK_AC *pAC,
315 SK_IOC IoC,
316 SK_U32 FromPortNumber,
317 SK_U32 ToPortNumber);
318 #endif
320 #else /* defined(SK_KR_PROTO)) */
322 /* Non-ANSI/C++ compliant function prototypes */
324 #error KR-style prototypes are not yet provided.
326 #endif /* defined(SK_KR_PROTO)) */
329 #ifdef __cplusplus
331 #endif /* __cplusplus */
333 #endif /* __INC_SKADDR_H */