1 $DragonFly: src/sys/dev/netif/nv/Attic/adapter.h.patch,v 1.1 2004/08/28 15:08:02 joerg Exp $
3 diff -u nvnet/adapter.h nv/adapter.h
4 --- nvnet/adapter.h 2003-05-06 21:39:38.000000000 +0200
5 +++ nv/adapter.h 2004-08-19 18:25:19.000000000 +0200
8 #define HDA_VERSION_STRING "HDR A: $Revision: #47 $"
10 -//////////////////////////////////////////////////////////////////
11 -// For the set and get configuration calls.
12 +/****************************************************************
13 + * For the set and get configuration calls.
15 typedef struct _ADAPTER_CONFIG
18 } ADAPTER_CONFIG, *PADAPTER_CONFIG;
19 -//////////////////////////////////////////////////////////////////
20 +/****************************************************************/
23 -//////////////////////////////////////////////////////////////////
24 -// For the ADAPTER_Write1 call.
25 +/****************************************************************
26 + * For the ADAPTER_Write1 call. */
27 /* This scatter gather list should be same as defined in ndis.h by MS.
28 For ULONG_PTR MS header file says that it will be of same size as
29 pointer. It has been defined to take care of casting between differenet
34 -// For the ADAPTER_Write call.
35 +/* For the ADAPTER_Write call. */
36 typedef struct _ADAPTER_WRITE_ELEMENT
40 } ADAPTER_WRITE_ELEMENT, *PADAPTER_WRITE_ELEMENT;
42 -// pvID is a value that will be passed back into OSAPI.pfnPacketWasSent
43 -// when the transmission completes. if pvID is NULL, the ADAPTER code
44 -// assumes the caller does not want the pfnPacketWasSent callback.
46 + * pvID is a value that will be passed back into OSAPI.pfnPacketWasSent
47 + * when the transmission completes. if pvID is NULL, the ADAPTER code
48 + * assumes the caller does not want the pfnPacketWasSent callback.
50 typedef struct _ADAPTER_WRITE_DATA
52 ULONG ulNumberOfElements;
54 UCHAR uc8021pPriority;
55 ADAPTER_WRITE_ELEMENT sElement[100];
56 } ADAPTER_WRITE_DATA, *PADAPTER_WRITE_DATA;
57 -//////////////////////////////////////////////////////////////////
58 +/****************************************************************/
62 -//////////////////////////////////////////////////////////////////
63 -// For the ADAPTER_Read call.
64 +/****************************************************************
65 + * For the ADAPTER_Read call.
67 typedef struct _ADAPTER_READ_ELEMENT
71 ADAPTER_READ_ELEMENT sElement[10];
72 } ADAPTER_READ_DATA, *PADAPTER_READ_DATA;
74 -// The ulFilterMatch flag can be a logical OR of the following
75 +/* The ulFilterMatch flag can be a logical OR of the following */
76 #define ADREADFL_UNICAST_MATCH 0x00000001
77 #define ADREADFL_MULTICAST_MATCH 0x00000002
78 #define ADREADFL_BROADCAST_MATCH 0x00000004
79 -//////////////////////////////////////////////////////////////////
80 +/****************************************************************/
84 -//////////////////////////////////////////////////////////////////
85 -// For the ADAPTER_GetStatistics call.
86 +/****************************************************************
87 + * For the ADAPTER_GetStatistics call.
89 #define MAX_TRANSMIT_COLISION_STATS 16
90 typedef struct _ADAPTER_STATS
94 ULONG ulFramingErrors;
95 ULONG ulOverFlowErrors;
96 - ULONG ulFrameErrorsPrivate; //Not for public.
97 - ULONG ulNullBufferReceivePrivate; //Not for public, These are the packets which we didn't indicate to OS
98 + ULONG ulFrameErrorsPrivate; /* Not for public. */
99 + ULONG ulNullBufferReceivePrivate; /* Not for public, These are the packets which we didn't indicate to OS */
101 - //interrupt related statistics
102 + /* interrupt related statistics */
104 ULONG ulRxInterruptUnsuccessful;
106 ULONG ulTxInterruptUnsuccessful;
107 ULONG ulPhyInterrupt;
108 } ADAPTER_STATS, *PADAPTER_STATS;
109 -//////////////////////////////////////////////////////////////////
110 +/****************************************************************/
114 -//////////////////////////////////////////////////////////////////
115 -// For the ADAPTER_GetPowerCapabilities call.
116 +/****************************************************************
117 + * For the ADAPTER_GetPowerCapabilities call.
119 typedef struct _ADAPTER_POWERCAPS
123 int iMaxWakeUpPatterns;
124 } ADAPTER_POWERCAPS, *PADAPTER_POWERCAPS;
126 -// For the ADAPTER_GetPowerState and ADAPTER_SetPowerState call.
127 +/* For the ADAPTER_GetPowerState and ADAPTER_SetPowerState call. */
128 typedef struct _ADAPTER_POWERSTATE
131 @@ -157,15 +162,19 @@
132 ULONG ulLinkChangeWakeUpFlags;
133 } ADAPTER_POWERSTATE, *PADAPTER_POWERSTATE;
135 -// Each of the flag fields in the POWERCAPS structure above can have
136 -// any of the following bitflags set giving the capabilites of the
137 -// adapter. In the case of the wake up fields, these flags mean that
138 -// wake up can happen from the specified power state.
140 -// For the POWERSTATE structure, the ulPowerFlags field should just
141 -// have one of these bits set to go to that particular power state.
142 -// The WakeUp fields can have one or more of these bits set to indicate
143 -// what states should be woken up from.
145 + * Each of the flag fields in the POWERCAPS structure above can have
146 + * any of the following bitflags set giving the capabilites of the
147 + * adapter. In the case of the wake up fields, these flags mean that
148 + * wake up can happen from the specified power state.
152 + * For the POWERSTATE structure, the ulPowerFlags field should just
153 + * have one of these bits set to go to that particular power state.
154 + * The WakeUp fields can have one or more of these bits set to indicate
155 + * what states should be woken up from.
157 #define POWER_STATE_D0 0x00000001
158 #define POWER_STATE_D1 0x00000002
159 #define POWER_STATE_D2 0x00000004
160 @@ -175,13 +184,14 @@
164 -//////////////////////////////////////////////////////////////////
165 +/****************************************************************/
169 -//////////////////////////////////////////////////////////////////
170 -// The ADAPTER_GetPacketFilterCaps call returns a ULONG that can
171 -// have the following capability bits set.
172 +/****************************************************************
173 + * The ADAPTER_GetPacketFilterCaps call returns a ULONG that can
174 + * have the following capability bits set.
176 #define ACCEPT_UNICAST_PACKETS 0x00000001
177 #define ACCEPT_MULTICAST_PACKETS 0x00000002
178 #define ACCEPT_BROADCAST_PACKETS 0x00000004
179 @@ -189,30 +199,33 @@
181 #define ETH_LENGTH_OF_ADDRESS 6
183 -// The ADAPTER_SetPacketFilter call uses this structure to know what
184 -// packet filter to set. The ulPacketFilter field can contain some
185 -// union of the bit flags above. The acMulticastMask array holds a
186 -// 48 bit MAC address mask with a 0 in every bit position that should
187 -// be ignored on compare and a 1 in every bit position that should
188 -// be taken into account when comparing to see if the destination
189 -// address of a packet should be accepted for multicast.
191 + * The ADAPTER_SetPacketFilter call uses this structure to know what
192 + * packet filter to set. The ulPacketFilter field can contain some
193 + * union of the bit flags above. The acMulticastMask array holds a
194 + * 48 bit MAC address mask with a 0 in every bit position that should
195 + * be ignored on compare and a 1 in every bit position that should
196 + * be taken into account when comparing to see if the destination
197 + * address of a packet should be accepted for multicast.
199 typedef struct _PACKET_FILTER
202 UCHAR acMulticastAddress[ETH_LENGTH_OF_ADDRESS];
203 UCHAR acMulticastMask[ETH_LENGTH_OF_ADDRESS];
204 } PACKET_FILTER, *PPACKET_FILTER;
205 -//////////////////////////////////////////////////////////////////
206 +/****************************************************************/
209 -//////////////////////////////////////////////////////////////////
210 -// A WAKE_UP_PATTERN is a 128-byte pattern that the adapter can
211 -// look for in incoming packets to decide when to wake up. Higher-
212 -// level protocols can use this to, for example, wake up the
213 -// adapter whenever it sees an IP packet that is addressed to it.
214 -// A pattern consists of 128 bits of byte masks that indicate
215 -// which bytes in the packet are relevant to the pattern, plus
216 -// values for each byte.
217 +/****************************************************************
218 + * A WAKE_UP_PATTERN is a 128-byte pattern that the adapter can
219 + * look for in incoming packets to decide when to wake up. Higher-
220 + * level protocols can use this to, for example, wake up the
221 + * adapter whenever it sees an IP packet that is addressed to it.
222 + * A pattern consists of 128 bits of byte masks that indicate
223 + * which bytes in the packet are relevant to the pattern, plus
224 + * values for each byte.
226 #define WAKE_UP_PATTERN_SIZE 128
228 typedef struct _WAKE_UP_PATTERN
240 typedef struct _ADAPTER_OFFLOAD {
243 @@ -238,11 +250,12 @@
244 #define ADAPTER_OFFLOAD_IEEE802_1P 0x00000002
245 #define ADAPTER_OFFLOAD_IEEE802_1PQ_PAD 0x00000004
247 -//////////////////////////////////////////////////////////////////
248 +/****************************************************************/
251 -//////////////////////////////////////////////////////////////////
252 -// The functional typedefs for the ADAPTER Api
253 +/****************************************************************
254 + * The functional typedefs for the ADAPTER Api
256 typedef int (* PFN_ADAPTER_CLOSE) (PVOID pvContext);
257 typedef int (* PFN_ADAPTER_INIT) (PVOID pvContext, USHORT usForcedSpeed, UCHAR ucForceDpx, UCHAR ucForceMode, UINT *puiLinkState);
258 typedef int (* PFN_ADAPTER_DEINIT) (PVOID pvContext, UCHAR ucIsPowerDown);
259 @@ -287,10 +300,10 @@
261 typedef struct _ADAPTER_API
263 - // The adapter context
264 + /* The adapter context */
267 - // The adapter interface
268 + /* The adapter interface */
269 PFN_ADAPTER_CLOSE pfnClose;
270 PFN_ADAPTER_INIT pfnInit;
271 PFN_ADAPTER_DEINIT pfnDeinit;
272 @@ -332,43 +345,45 @@
273 PFN_DEREGISTER_OFFLOAD pfnDeRegisterOffload;
274 PFN_RX_BUFF_READY pfnRxBuffReady;
275 } ADAPTER_API, *PADAPTER_API;
276 -//////////////////////////////////////////////////////////////////
277 +/****************************************************************/
279 #define MAX_PACKET_TO_ACCUMULATE 16
281 typedef struct _ADAPTER_OPEN_PARAMS
283 - PVOID pOSApi; //pointer to OSAPI structure passed from higher layer
284 - PVOID pvHardwareBaseAddress; //memory mapped address passed from higher layer
285 - ULONG ulPollInterval; //poll interval in micro seconds. Used in polling mode
286 - ULONG MaxDpcLoop; //Maximum number of times we loop to in function ADAPTER_HandleInterrupt
287 - ULONG MaxRxPkt; //Maximum number of packet we process each time in function UpdateReceiveDescRingData
288 - ULONG MaxTxPkt; //Maximum number of packet we process each time in function UpdateTransmitDescRingData
289 - ULONG MaxRxPktToAccumulate; //maximum number of rx packet we accumulate in UpdateReceiveDescRingData before
290 - //indicating packets to OS.
291 - ULONG SentPacketStatusSuccess; //Status returned from adapter layer to higher layer when packet was sent successfully
292 - ULONG SentPacketStatusFailure; ////Status returned from adapter layer to higher layer when packet send was unsuccessful
293 - ULONG SetForcedModeEveryNthRxPacket; //NOT USED: For experiment with descriptor based interrupt
294 - ULONG SetForcedModeEveryNthTxPacket; //NOT USED: For experiment with descriptor based interrupt
295 - ULONG RxForcedInterrupt; //NOT USED: For experiment with descriptor based interrupt
296 - ULONG TxForcedInterrupt; //NOT USED: For experiment with descriptor based interrupt
297 - ULONG DeviceId; //Of MAC
298 - ULONG PollIntervalInusForThroughputMode; //Of MAC
299 + PVOID pOSApi; /* pointer to OSAPI structure passed from higher layer */
300 + PVOID pvHardwareBaseAddress; /* memory mapped address passed from higher layer */
301 + ULONG ulPollInterval; /* poll interval in micro seconds. Used in polling mode */
302 + ULONG MaxDpcLoop; /* Maximum number of times we loop to in function ADAPTER_HandleInterrupt */
303 + ULONG MaxRxPkt; /* Maximum number of packet we process each time in function UpdateReceiveDescRingData */
304 + ULONG MaxTxPkt; /* Maximum number of packet we process each time in function UpdateTransmitDescRingData */
305 + ULONG MaxRxPktToAccumulate; /* maximum number of rx packet we accumulate in UpdateReceiveDescRingData before
306 + indicating packets to OS. */
307 + ULONG SentPacketStatusSuccess; /* Status returned from adapter layer to higher layer when packet was sent successfully */
308 + ULONG SentPacketStatusFailure; /* 1;2AStatus returned from adapter layer to higher layer when packet send was unsuccessful */
309 + ULONG SetForcedModeEveryNthRxPacket; /* NOT USED: For experiment with descriptor based interrupt */
310 + ULONG SetForcedModeEveryNthTxPacket; /* NOT USED: For experiment with descriptor based interrupt */
311 + ULONG RxForcedInterrupt; /* NOT USED: For experiment with descriptor based interrupt */
312 + ULONG TxForcedInterrupt; /* NOT USED: For experiment with descriptor based interrupt */
313 + ULONG DeviceId; /* Of MAC */
314 + ULONG PollIntervalInusForThroughputMode; /* Of MAC */
315 }ADAPTER_OPEN_PARAMS, *PADAPTER_OPEN_PARAMS;
317 -//////////////////////////////////////////////////////////////////
318 -// This is the one function in the adapter interface that is publicly
319 -// available. The rest of the interface is returned in the pAdapterApi.
320 -// The first argument needs to be cast to a OSAPI structure pointer.
321 -// The second argument should be cast to a ADPATER_API structure pointer.
322 +/****************************************************************
323 + * This is the one function in the adapter interface that is publicly
324 + * available. The rest of the interface is returned in the pAdapterApi.
325 + * The first argument needs to be cast to a OSAPI structure pointer.
326 + * The second argument should be cast to a ADPATER_API structure pointer.
328 int ADAPTER_Open (PADAPTER_OPEN_PARAMS pAdapterOpenParams, PVOID *pvpAdapterApi, ULONG *pulPhyAddr);
330 -//////////////////////////////////////////////////////////////////
331 +/****************************************************************/
335 -//////////////////////////////////////////////////////////////////
336 -// Here are the error codes the adapter function calls return.
337 +/****************************************************************
338 + * Here are the error codes the adapter function calls return.
340 #define ADAPTERERR_NONE 0x0000
341 #define ADAPTERERR_COULD_NOT_ALLOC_CONTEXT 0x0001
342 #define ADAPTERERR_COULD_NOT_CREATE_CONTEXT 0x0002
343 @@ -376,11 +391,11 @@
344 #define ADAPTERERR_TRANSMIT_QUEUE_FULL 0x0004
345 #define ADAPTERERR_COULD_NOT_INIT_PHY 0x0005
346 #define ADAPTERERR_PHYS_SIZE_SMALL 0x0006
347 -//////////////////////////////////////////////////////////////////
348 +/****************************************************************/
350 #define REDUCE_LENGTH_BY 48
351 #define EXTRA_WRITE_SLOT_TO_REDUCE_PER_SEND 3
352 -#define MAX_TX_DESCS 256 //32 //256 //512 //64 //256
353 +#define MAX_TX_DESCS 256 /* 32 256 512 64 256 */
355 typedef struct _TX_INFO_ADAP
357 @@ -394,11 +409,13 @@
358 int ADAPTER_WorkaroundTXHang(PVOID pvContext);
361 -//#define TRACK_INIT_TIME
362 +/* #define TRACK_INIT_TIME */
364 #ifdef TRACK_INIT_TIME
365 -//This routine is defined in entry.c adapter doesn't link int64.lib
366 -//We defined here so that its easy to use it in phy as well as mswin
368 + * This routine is defined in entry.c adapter doesn't link int64.lib
369 + * We defined here so that its easy to use it in phy as well as mswin
372 #define MAX_PRINT_INDEX 32
373 extern void PrintTime(ULONG ulIndex);
382 -#endif // _ADAPTER_H_
383 +#endif /* _ADAPTER_H_ */