$DragonFly: src/sys/dev/netif/nv/Attic/adapter.h.patch,v 1.1 2004/08/28 15:08:02 joerg Exp $ diff -u nvnet/adapter.h nv/adapter.h --- nvnet/adapter.h 2003-05-06 21:39:38.000000000 +0200 +++ nv/adapter.h 2004-08-19 18:25:19.000000000 +0200 @@ -14,17 +14,18 @@ #define HDA_VERSION_STRING "HDR A: $Revision: #47 $" -////////////////////////////////////////////////////////////////// -// For the set and get configuration calls. +/**************************************************************** + * For the set and get configuration calls. + */ typedef struct _ADAPTER_CONFIG { ULONG ulFlags; } ADAPTER_CONFIG, *PADAPTER_CONFIG; -////////////////////////////////////////////////////////////////// +/****************************************************************/ #if defined(_WIN32) -////////////////////////////////////////////////////////////////// -// For the ADAPTER_Write1 call. +/**************************************************************** + * For the ADAPTER_Write1 call. */ /* This scatter gather list should be same as defined in ndis.h by MS. For ULONG_PTR MS header file says that it will be of same size as pointer. It has been defined to take care of casting between differenet @@ -55,16 +56,18 @@ #endif -// For the ADAPTER_Write call. +/* For the ADAPTER_Write call. */ typedef struct _ADAPTER_WRITE_ELEMENT { PVOID pPhysical; ULONG ulLength; } ADAPTER_WRITE_ELEMENT, *PADAPTER_WRITE_ELEMENT; -// pvID is a value that will be passed back into OSAPI.pfnPacketWasSent -// when the transmission completes. if pvID is NULL, the ADAPTER code -// assumes the caller does not want the pfnPacketWasSent callback. +/* + * pvID is a value that will be passed back into OSAPI.pfnPacketWasSent + * when the transmission completes. if pvID is NULL, the ADAPTER code + * assumes the caller does not want the pfnPacketWasSent callback. + */ typedef struct _ADAPTER_WRITE_DATA { ULONG ulNumberOfElements; @@ -73,12 +76,12 @@ UCHAR uc8021pPriority; ADAPTER_WRITE_ELEMENT sElement[100]; } ADAPTER_WRITE_DATA, *PADAPTER_WRITE_DATA; -////////////////////////////////////////////////////////////////// +/****************************************************************/ - -////////////////////////////////////////////////////////////////// -// For the ADAPTER_Read call. +/**************************************************************** + * For the ADAPTER_Read call. + */ typedef struct _ADAPTER_READ_ELEMENT { PVOID pPhysical; @@ -94,16 +97,17 @@ ADAPTER_READ_ELEMENT sElement[10]; } ADAPTER_READ_DATA, *PADAPTER_READ_DATA; -// The ulFilterMatch flag can be a logical OR of the following +/* The ulFilterMatch flag can be a logical OR of the following */ #define ADREADFL_UNICAST_MATCH 0x00000001 #define ADREADFL_MULTICAST_MATCH 0x00000002 #define ADREADFL_BROADCAST_MATCH 0x00000004 -////////////////////////////////////////////////////////////////// +/****************************************************************/ -////////////////////////////////////////////////////////////////// -// For the ADAPTER_GetStatistics call. +/**************************************************************** + * For the ADAPTER_GetStatistics call. + */ #define MAX_TRANSMIT_COLISION_STATS 16 typedef struct _ADAPTER_STATS { @@ -123,22 +127,23 @@ ULONG ulCRCErrors; ULONG ulFramingErrors; ULONG ulOverFlowErrors; - ULONG ulFrameErrorsPrivate; //Not for public. - ULONG ulNullBufferReceivePrivate; //Not for public, These are the packets which we didn't indicate to OS + ULONG ulFrameErrorsPrivate; /* Not for public. */ + ULONG ulNullBufferReceivePrivate; /* Not for public, These are the packets which we didn't indicate to OS */ - //interrupt related statistics + /* interrupt related statistics */ ULONG ulRxInterrupt; ULONG ulRxInterruptUnsuccessful; ULONG ulTxInterrupt; ULONG ulTxInterruptUnsuccessful; ULONG ulPhyInterrupt; } ADAPTER_STATS, *PADAPTER_STATS; -////////////////////////////////////////////////////////////////// +/****************************************************************/ -////////////////////////////////////////////////////////////////// -// For the ADAPTER_GetPowerCapabilities call. +/**************************************************************** + * For the ADAPTER_GetPowerCapabilities call. + */ typedef struct _ADAPTER_POWERCAPS { ULONG ulPowerFlags; @@ -148,7 +153,7 @@ int iMaxWakeUpPatterns; } ADAPTER_POWERCAPS, *PADAPTER_POWERCAPS; -// For the ADAPTER_GetPowerState and ADAPTER_SetPowerState call. +/* For the ADAPTER_GetPowerState and ADAPTER_SetPowerState call. */ typedef struct _ADAPTER_POWERSTATE { ULONG ulPowerFlags; @@ -157,15 +162,19 @@ ULONG ulLinkChangeWakeUpFlags; } ADAPTER_POWERSTATE, *PADAPTER_POWERSTATE; -// Each of the flag fields in the POWERCAPS structure above can have -// any of the following bitflags set giving the capabilites of the -// adapter. In the case of the wake up fields, these flags mean that -// wake up can happen from the specified power state. - -// For the POWERSTATE structure, the ulPowerFlags field should just -// have one of these bits set to go to that particular power state. -// The WakeUp fields can have one or more of these bits set to indicate -// what states should be woken up from. +/* + * Each of the flag fields in the POWERCAPS structure above can have + * any of the following bitflags set giving the capabilites of the + * adapter. In the case of the wake up fields, these flags mean that + * wake up can happen from the specified power state. + */ + +/* + * For the POWERSTATE structure, the ulPowerFlags field should just + * have one of these bits set to go to that particular power state. + * The WakeUp fields can have one or more of these bits set to indicate + * what states should be woken up from. + */ #define POWER_STATE_D0 0x00000001 #define POWER_STATE_D1 0x00000002 #define POWER_STATE_D2 0x00000004 @@ -175,13 +184,14 @@ POWER_STATE_D1 | \ POWER_STATE_D2 | \ POWER_STATE_D3) -////////////////////////////////////////////////////////////////// +/****************************************************************/ -////////////////////////////////////////////////////////////////// -// The ADAPTER_GetPacketFilterCaps call returns a ULONG that can -// have the following capability bits set. +/**************************************************************** + * The ADAPTER_GetPacketFilterCaps call returns a ULONG that can + * have the following capability bits set. + */ #define ACCEPT_UNICAST_PACKETS 0x00000001 #define ACCEPT_MULTICAST_PACKETS 0x00000002 #define ACCEPT_BROADCAST_PACKETS 0x00000004 @@ -189,30 +199,33 @@ #define ETH_LENGTH_OF_ADDRESS 6 -// The ADAPTER_SetPacketFilter call uses this structure to know what -// packet filter to set. The ulPacketFilter field can contain some -// union of the bit flags above. The acMulticastMask array holds a -// 48 bit MAC address mask with a 0 in every bit position that should -// be ignored on compare and a 1 in every bit position that should -// be taken into account when comparing to see if the destination -// address of a packet should be accepted for multicast. +/* + * The ADAPTER_SetPacketFilter call uses this structure to know what + * packet filter to set. The ulPacketFilter field can contain some + * union of the bit flags above. The acMulticastMask array holds a + * 48 bit MAC address mask with a 0 in every bit position that should + * be ignored on compare and a 1 in every bit position that should + * be taken into account when comparing to see if the destination + * address of a packet should be accepted for multicast. + */ typedef struct _PACKET_FILTER { ULONG ulFilterFlags; UCHAR acMulticastAddress[ETH_LENGTH_OF_ADDRESS]; UCHAR acMulticastMask[ETH_LENGTH_OF_ADDRESS]; } PACKET_FILTER, *PPACKET_FILTER; -////////////////////////////////////////////////////////////////// +/****************************************************************/ -////////////////////////////////////////////////////////////////// -// A WAKE_UP_PATTERN is a 128-byte pattern that the adapter can -// look for in incoming packets to decide when to wake up. Higher- -// level protocols can use this to, for example, wake up the -// adapter whenever it sees an IP packet that is addressed to it. -// A pattern consists of 128 bits of byte masks that indicate -// which bytes in the packet are relevant to the pattern, plus -// values for each byte. +/**************************************************************** + * A WAKE_UP_PATTERN is a 128-byte pattern that the adapter can + * look for in incoming packets to decide when to wake up. Higher- + * level protocols can use this to, for example, wake up the + * adapter whenever it sees an IP packet that is addressed to it. + * A pattern consists of 128 bits of byte masks that indicate + * which bytes in the packet are relevant to the pattern, plus + * values for each byte. + */ #define WAKE_UP_PATTERN_SIZE 128 typedef struct _WAKE_UP_PATTERN @@ -223,10 +236,9 @@ -// -// -// Adapter offload -// +/* + * Adapter offload + */ typedef struct _ADAPTER_OFFLOAD { ULONG Type; @@ -238,11 +250,12 @@ #define ADAPTER_OFFLOAD_IEEE802_1P 0x00000002 #define ADAPTER_OFFLOAD_IEEE802_1PQ_PAD 0x00000004 -////////////////////////////////////////////////////////////////// +/****************************************************************/ -////////////////////////////////////////////////////////////////// -// The functional typedefs for the ADAPTER Api +/**************************************************************** + * The functional typedefs for the ADAPTER Api + */ typedef int (* PFN_ADAPTER_CLOSE) (PVOID pvContext); typedef int (* PFN_ADAPTER_INIT) (PVOID pvContext, USHORT usForcedSpeed, UCHAR ucForceDpx, UCHAR ucForceMode, UINT *puiLinkState); typedef int (* PFN_ADAPTER_DEINIT) (PVOID pvContext, UCHAR ucIsPowerDown); @@ -287,10 +300,10 @@ typedef struct _ADAPTER_API { - // The adapter context + /* The adapter context */ PVOID pADCX; - // The adapter interface + /* The adapter interface */ PFN_ADAPTER_CLOSE pfnClose; PFN_ADAPTER_INIT pfnInit; PFN_ADAPTER_DEINIT pfnDeinit; @@ -332,43 +345,45 @@ PFN_DEREGISTER_OFFLOAD pfnDeRegisterOffload; PFN_RX_BUFF_READY pfnRxBuffReady; } ADAPTER_API, *PADAPTER_API; -////////////////////////////////////////////////////////////////// +/****************************************************************/ #define MAX_PACKET_TO_ACCUMULATE 16 typedef struct _ADAPTER_OPEN_PARAMS { - PVOID pOSApi; //pointer to OSAPI structure passed from higher layer - PVOID pvHardwareBaseAddress; //memory mapped address passed from higher layer - ULONG ulPollInterval; //poll interval in micro seconds. Used in polling mode - ULONG MaxDpcLoop; //Maximum number of times we loop to in function ADAPTER_HandleInterrupt - ULONG MaxRxPkt; //Maximum number of packet we process each time in function UpdateReceiveDescRingData - ULONG MaxTxPkt; //Maximum number of packet we process each time in function UpdateTransmitDescRingData - ULONG MaxRxPktToAccumulate; //maximum number of rx packet we accumulate in UpdateReceiveDescRingData before - //indicating packets to OS. - ULONG SentPacketStatusSuccess; //Status returned from adapter layer to higher layer when packet was sent successfully - ULONG SentPacketStatusFailure; ////Status returned from adapter layer to higher layer when packet send was unsuccessful - ULONG SetForcedModeEveryNthRxPacket; //NOT USED: For experiment with descriptor based interrupt - ULONG SetForcedModeEveryNthTxPacket; //NOT USED: For experiment with descriptor based interrupt - ULONG RxForcedInterrupt; //NOT USED: For experiment with descriptor based interrupt - ULONG TxForcedInterrupt; //NOT USED: For experiment with descriptor based interrupt - ULONG DeviceId; //Of MAC - ULONG PollIntervalInusForThroughputMode; //Of MAC + PVOID pOSApi; /* pointer to OSAPI structure passed from higher layer */ + PVOID pvHardwareBaseAddress; /* memory mapped address passed from higher layer */ + ULONG ulPollInterval; /* poll interval in micro seconds. Used in polling mode */ + ULONG MaxDpcLoop; /* Maximum number of times we loop to in function ADAPTER_HandleInterrupt */ + ULONG MaxRxPkt; /* Maximum number of packet we process each time in function UpdateReceiveDescRingData */ + ULONG MaxTxPkt; /* Maximum number of packet we process each time in function UpdateTransmitDescRingData */ + ULONG MaxRxPktToAccumulate; /* maximum number of rx packet we accumulate in UpdateReceiveDescRingData before + indicating packets to OS. */ + ULONG SentPacketStatusSuccess; /* Status returned from adapter layer to higher layer when packet was sent successfully */ + ULONG SentPacketStatusFailure; /* 1;2AStatus returned from adapter layer to higher layer when packet send was unsuccessful */ + ULONG SetForcedModeEveryNthRxPacket; /* NOT USED: For experiment with descriptor based interrupt */ + ULONG SetForcedModeEveryNthTxPacket; /* NOT USED: For experiment with descriptor based interrupt */ + ULONG RxForcedInterrupt; /* NOT USED: For experiment with descriptor based interrupt */ + ULONG TxForcedInterrupt; /* NOT USED: For experiment with descriptor based interrupt */ + ULONG DeviceId; /* Of MAC */ + ULONG PollIntervalInusForThroughputMode; /* Of MAC */ }ADAPTER_OPEN_PARAMS, *PADAPTER_OPEN_PARAMS; -////////////////////////////////////////////////////////////////// -// This is the one function in the adapter interface that is publicly -// available. The rest of the interface is returned in the pAdapterApi. -// The first argument needs to be cast to a OSAPI structure pointer. -// The second argument should be cast to a ADPATER_API structure pointer. +/**************************************************************** + * This is the one function in the adapter interface that is publicly + * available. The rest of the interface is returned in the pAdapterApi. + * The first argument needs to be cast to a OSAPI structure pointer. + * The second argument should be cast to a ADPATER_API structure pointer. + */ int ADAPTER_Open (PADAPTER_OPEN_PARAMS pAdapterOpenParams, PVOID *pvpAdapterApi, ULONG *pulPhyAddr); -////////////////////////////////////////////////////////////////// +/****************************************************************/ -////////////////////////////////////////////////////////////////// -// Here are the error codes the adapter function calls return. +/**************************************************************** + * Here are the error codes the adapter function calls return. + */ #define ADAPTERERR_NONE 0x0000 #define ADAPTERERR_COULD_NOT_ALLOC_CONTEXT 0x0001 #define ADAPTERERR_COULD_NOT_CREATE_CONTEXT 0x0002 @@ -376,11 +391,11 @@ #define ADAPTERERR_TRANSMIT_QUEUE_FULL 0x0004 #define ADAPTERERR_COULD_NOT_INIT_PHY 0x0005 #define ADAPTERERR_PHYS_SIZE_SMALL 0x0006 -////////////////////////////////////////////////////////////////// +/****************************************************************/ #define REDUCE_LENGTH_BY 48 #define EXTRA_WRITE_SLOT_TO_REDUCE_PER_SEND 3 -#define MAX_TX_DESCS 256 //32 //256 //512 //64 //256 +#define MAX_TX_DESCS 256 /* 32 256 512 64 256 */ typedef struct _TX_INFO_ADAP { @@ -394,11 +409,13 @@ int ADAPTER_WorkaroundTXHang(PVOID pvContext); #endif -//#define TRACK_INIT_TIME +/* #define TRACK_INIT_TIME */ #ifdef TRACK_INIT_TIME -//This routine is defined in entry.c adapter doesn't link int64.lib -//We defined here so that its easy to use it in phy as well as mswin +/* + * This routine is defined in entry.c adapter doesn't link int64.lib + * We defined here so that its easy to use it in phy as well as mswin + */ #define MAX_PRINT_INDEX 32 extern void PrintTime(ULONG ulIndex); @@ -408,7 +425,7 @@ #endif #ifdef __cplusplus -} // extern "C" +} /* extern "C" */ #endif -#endif // _ADAPTER_H_ +#endif /* _ADAPTER_H_ */