12#define NO_KERNEL_LIST_ENTRY_CHECKS
22#define NVNET_TAG 'ENVN'
24#if defined(SARCH_XBOX)
26#define NVNET_TRANSMIT_BLOCKS 8
27#define NVNET_TRANSMIT_DESCRIPTORS 32
28#define NVNET_TRANSMIT_BUFFERS 1
29#define NVNET_RECEIVE_DESCRIPTORS 16
31#define NVNET_TRANSMIT_BLOCKS 64
32#define NVNET_TRANSMIT_DESCRIPTORS 512
33#define NVNET_TRANSMIT_BUFFERS 16
34#define NVNET_RECEIVE_DESCRIPTORS 512
37#define NVNET_ALIGNMENT 64
39#define NVNET_RECEIVE_BUFFER_SIZE 2048
41#define NVNET_RECEIVE_PROCESSING_LIMIT 64
43#define NVNET_IM_THRESHOLD 4
44#define NVNET_IM_MAX_IDLE 40
46#if defined(SARCH_XBOX)
47#define NVNET_TRANSMIT_HANG_THRESHOLD 3
49#define NVNET_TRANSMIT_HANG_THRESHOLD 5
52#if defined(SARCH_XBOX)
53#define NVNET_FRAGMENTATION_THRESHOLD 8
55#define NVNET_FRAGMENTATION_THRESHOLD 32
58#define NVNET_MEDIA_DETECTION_INTERVAL 5000
60#define NVNET_MAXIMUM_FRAME_SIZE 1514
61#define NVNET_MAXIMUM_FRAME_SIZE_JUMBO 9014
62#define NVNET_MAXIMUM_VLAN_ID 0xFFF
64#define NVNET_MULTICAST_LIST_SIZE 32
66#define NVNET_MINIMUM_LSO_SEGMENT_COUNT 2
67#define NVNET_MAXIMUM_LSO_FRAME_SIZE 0xFC00
69#define NVNET_PACKET_FILTERS ( \
70 NDIS_PACKET_TYPE_DIRECTED | \
71 NDIS_PACKET_TYPE_MULTICAST | \
72 NDIS_PACKET_TYPE_BROADCAST | \
73 NDIS_PACKET_TYPE_PROMISCUOUS | \
74 NDIS_PACKET_TYPE_ALL_MULTICAST)
76#define PACKET_ENTRY(Packet) ((PLIST_ENTRY)(&(Packet)->MiniportReserved[0]))
212#define NV_TCB_LARGE_SEND 0x00000001
213#define NV_TCB_CHECKSUM_IP 0x00000002
214#define NV_TCB_CHECKSUM_TCP 0x00000004
215#define NV_TCB_CHECKSUM_UDP 0x00000008
216#define NV_TCB_COALESCE 0x00000010
286#define NV_ACTIVE 0x80000000
287#define NV_SEND_CHECKSUM 0x00000002
288#define NV_SEND_LARGE_SEND 0x00000004
289#define NV_SEND_ERRATA_PRESENT 0x00000008
291#define NV_MAC_IN_USE 0x00000010
292#define NV_GIGABIT_PHY 0x00000020
293#define NV_UNIT_SEMAPHORE_ACQUIRED 0x00000040
294#define NV_USE_SOFT_MAC_ADDRESS 0x00000100
295#define NV_FORCE_SPEED_AND_DUPLEX 0x00000200
296#define NV_FORCE_FULL_DUPLEX 0x00000400
297#define NV_USER_SPEED_100 0x00000800
298#define NV_PACKET_PRIORITY 0x00001000
299#define NV_VLAN_TAGGING 0x00002000
342 ULONG MulticastListSize;
387#define NvNetLogError(Adapter, ErrorCode) \
388 NdisWriteErrorLogEntry((Adapter)->AdapterHandle, ErrorCode, 1, __LINE__)
585#define NV_IMPLICIT_ENTRIES(Length) \
586 (((Length - (NV_MAXIMUM_SG_SIZE + 1)) >> NV_TX2_TSO_MAX_SHIFT) + 1)
596 PushEntryList(&Adapter->Send.BufferList, &Tcb->Buffer->Link);
601 ++Adapter->Send.TcbSlots;
603 Adapter->Send.TbdSlots += Tcb->Slots;
605 Adapter->Send.StuckCount = 0;
614 if (Tcb++ == Adapter->Send.TailTcb)
615 return Adapter->Send.HeadTcb;
626 if (Tbd.x32++ == Adapter->Send.TailTbd.x32)
627 return Adapter->Send.HeadTbd;
638 if (Tbd.x64++ == Adapter->Send.TailTbd.x64)
639 return Adapter->Send.HeadTbd;
666#define NvNetDisableInterrupts(Adapter) \
667 NV_WRITE(Adapter, NvRegIrqMask, 0);
669#define NvNetApplyInterruptMask(Adapter) \
670 NV_WRITE(Adapter, NvRegIrqMask, (Adapter)->InterruptMask);
#define ETH_LENGTH_OF_ADDRESS
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
#define NdisReadRegisterUlong(Register, Data)
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT SelectedMediumIndex
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT MediumArraySize
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
_In_ NDIS_HANDLE MiniportAdapterHandle
#define NdisWriteRegisterUlong(Register, Data)
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS OpenErrorStatus
#define _In_reads_bytes_(s)
#define _Out_writes_bytes_all_(s)
#define DECLSPEC_NOINLINE
enum _NDIS_DEVICE_POWER_STATE NDIS_DEVICE_POWER_STATE
enum _NDIS_MEDIUM * PNDIS_MEDIUM
#define NV_WAKEUPPATTERNS_V2
enum _NVNET_REGISTER NVNET_REGISTER
FORCEINLINE NVNET_TBD NV_NEXT_TBD_64(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_TBD Tbd)
ULONG() NVNET_PROCESS_TRANSMIT(_In_ PNVNET_ADAPTER Adapter, _Inout_ PLIST_ENTRY SendReadyList)
BOOLEAN MiiRead(_In_ PNVNET_ADAPTER Adapter, _In_ ULONG PhyAddress, _In_ ULONG RegAddress, _Out_ PULONG Data)
struct _NVNET_TCB NVNET_TCB
struct _NVNET_STATISTICS * PNVNET_STATISTICS
VOID NvNetStartTransmitter(_In_ PNVNET_ADAPTER Adapter)
#define NVNET_MULTICAST_LIST_SIZE
struct _NVNET_RECEIVE * PNVNET_RECEIVE
VOID NvNetFlushTransmitQueue(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_STATUS CompleteStatus)
VOID NvNetFreeAdapter(_In_ PNVNET_ADAPTER Adapter)
VOID SidebandUnitReleaseSemaphore(_In_ PNVNET_ADAPTER Adapter)
NDIS_STATUS NvNetRecognizeHardware(_Inout_ PNVNET_ADAPTER Adapter)
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptorsLegacy
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptors64
VOID NvNetSetPowerState(_In_ PNVNET_ADAPTER Adapter, _In_ NDIS_DEVICE_POWER_STATE NewPowerState, _In_ ULONG WakeFlags)
NVNET_TRANSMIT_PACKET NvNetTransmitPacket64
FORCEINLINE NVNET_TBD NV_NEXT_TBD_32(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_TBD Tbd)
ULONG() NVNET_PROCESS_RECEIVE(_In_ PNVNET_ADAPTER Adapter, _In_ ULONG TotalRxProcessed)
@ NV_OPTIMIZATION_MODE_CPU
@ NV_OPTIMIZATION_MODE_DYNAMIC
@ NV_OPTIMIZATION_MODE_THROUGHPUT
KSYNCHRONIZE_ROUTINE NvNetInitPhaseSynchronized
VOID NvNetStartReceiver(_In_ PNVNET_ADAPTER Adapter)
VOID NvNetSetupMacAddress(_In_ PNVNET_ADAPTER Adapter, _In_reads_bytes_(ETH_LENGTH_OF_ADDRESS) PUCHAR MacAddress)
VOID NvNetStopReceiver(_In_ PNVNET_ADAPTER Adapter)
struct _NVNET_SEND * PNVNET_SEND
@ NV_FLOW_CONTROL_DISABLE
VOID NvNetToggleClockPowerGating(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN Gate)
struct _NVNET_ADAPTER NVNET_ADAPTER
DECLSPEC_NOINLINE VOID NvNetPauseProcessing(_In_ PNVNET_ADAPTER Adapter)
NDIS_STATUS NvNetFindPhyDevice(_In_ PNVNET_ADAPTER Adapter)
struct _NVNET_WAKE_FRAME * PNVNET_WAKE_FRAME
VOID NvNetResetReceiverAndTransmitter(_In_ PNVNET_ADAPTER Adapter)
VOID NTAPI MiniportHandleInterrupt(_In_ NDIS_HANDLE MiniportAdapterContext)
VOID NvNetIdleTransmitter(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN ClearPhyControl)
struct _NVNET_TX_BUFFER * PNVNET_TX_BUFFER
FORCEINLINE VOID NV_RELEASE_TCB(_In_ PNVNET_ADAPTER Adapter, _In_ PNVNET_TCB Tcb)
BOOLEAN NvNetUpdateLinkSpeed(_In_ PNVNET_ADAPTER Adapter)
VOID NvNetBackoffSetSlotTime(_In_ PNVNET_ADAPTER Adapter)
NDIS_STATUS NvNetInitNIC(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN InitPhy)
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptors32
struct _NVNET_RBD NVNET_RBD
struct _NVNET_ADAPTER * PNVNET_ADAPTER
VOID NvNetStopAdapter(_In_ PNVNET_ADAPTER Adapter)
union _NVNET_OFFLOAD NVNET_OFFLOAD
enum _NVNET_OPTIMIZATION_MODE NVNET_OPTIMIZATION_MODE
struct _NVNET_STATISTICS NVNET_STATISTICS
NDIS_STATUS NvNetGetPermanentMacAddress(_Inout_ PNVNET_ADAPTER Adapter, _Out_writes_bytes_all_(ETH_LENGTH_OF_ADDRESS) PUCHAR MacAddress)
union _NVNET_TBD NVNET_TBD
NDIS_STATUS NTAPI MiniportInitialize(_Out_ PNDIS_STATUS OpenErrorStatus, _Out_ PUINT SelectedMediumIndex, _In_ PNDIS_MEDIUM MediumArray, _In_ UINT MediumArraySize, _In_ NDIS_HANDLE MiniportAdapterHandle, _In_ NDIS_HANDLE WrapperConfigurationContext)
struct _NVNET_SEND NVNET_SEND
VOID NvNetStartAdapter(_In_ PNVNET_ADAPTER Adapter)
enum _NVNET_FLOW_CONTROL_MODE NVNET_FLOW_CONTROL_MODE
NDIS_TIMER_FUNCTION NvNetMediaDetectionDpc
struct _NVNET_TX_BUFFER_DATA NVNET_TX_BUFFER_DATA
struct _NVNET_TX_BUFFER_DATA * PNVNET_TX_BUFFER_DATA
NDIS_STATUS NTAPI MiniportSend(_In_ NDIS_HANDLE MiniportAdapterContext, _In_ PNDIS_PACKET Packet, _In_ UINT Flags)
VOID() NVNET_TRANSMIT_PACKET(_In_ PNVNET_ADAPTER Adapter, _In_ PNVNET_TCB Tcb, _In_ PSCATTER_GATHER_LIST SgList)
union _NVNET_OFFLOAD * PNVNET_OFFLOAD
NVNET_TRANSMIT_PACKET * PNVNET_TRANSMIT_PACKET
VOID NvNetBackoffReseed(_In_ PNVNET_ADAPTER Adapter)
NDIS_STATUS NTAPI MiniportQueryInformation(_In_ NDIS_HANDLE MiniportAdapterContext, _In_ NDIS_OID Oid, _In_ PVOID InformationBuffer, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesWritten, _Out_ PULONG BytesNeeded)
NVNET_PROCESS_TRANSMIT * PNVNET_PROCESS_TRANSMIT
VOID NvNetBackoffReseedEx(_In_ PNVNET_ADAPTER Adapter)
struct _NVNET_TX_BUFFER NVNET_TX_BUFFER
struct _NVNET_RECEIVE NVNET_RECEIVE
struct _NVNET_RBD * PNVNET_RBD
NVNET_TRANSMIT_PACKET NvNetTransmitPacket32
struct _NVNET_WAKE_FRAME NVNET_WAKE_FRAME
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
FORCEINLINE ULONG NV_READ(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register)
NVNET_PROCESS_RECEIVE * PNVNET_PROCESS_RECEIVE
VOID NTAPI MiniportISR(_Out_ PBOOLEAN InterruptRecognized, _Out_ PBOOLEAN QueueMiniportHandleInterrupt, _In_ NDIS_HANDLE MiniportAdapterContext)
struct _NVNET_TCB * PNVNET_TCB
VOID NvNetStopTransmitter(_In_ PNVNET_ADAPTER Adapter)
VOID NvNetUpdatePauseFrame(_Inout_ PNVNET_ADAPTER Adapter, _In_ ULONG PauseFlags)
BOOLEAN MiiWrite(_In_ PNVNET_ADAPTER Adapter, _In_ ULONG PhyAddress, _In_ ULONG RegAddress, _In_ ULONG Data)
FORCEINLINE PNVNET_TCB NV_NEXT_TCB(_In_ PNVNET_ADAPTER Adapter, _In_ PNVNET_TCB Tcb)
NDIS_STATUS NvNetPhyInit(_In_ PNVNET_ADAPTER Adapter)
#define NVNET_TRANSMIT_BUFFERS
NDIS_STATUS NTAPI MiniportSetInformation(_In_ NDIS_HANDLE MiniportAdapterContext, _In_ NDIS_OID Oid, _In_ PVOID InformationBuffer, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesRead, _Out_ PULONG BytesNeeded)
_Interlocked_ volatile LONG ResetLock
UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS]
NDIS_PHYSICAL_ADDRESS IoAddress
PNVNET_TRANSMIT_PACKET TransmitPacket
NDIS_PHYSICAL_ADDRESS RbdPhys
NDIS_WORK_ITEM PowerWorkItem
ULONG OriginalMacAddress[2]
NVNET_TX_BUFFER_DATA SendBufferAllocationData[NVNET_TRANSMIT_BUFFERS]
NVNET_FLOW_CONTROL_MODE FlowControlMode
UCHAR MacAddress[ETH_LENGTH_OF_ADDRESS]
NDIS_MINIPORT_INTERRUPT Interrupt
NDIS_PHYSICAL_ADDRESS TbdPhys
PNVNET_WAKE_FRAME WakeFrames[NV_WAKEUPPATTERNS_V2]
NVNET_OPTIMIZATION_MODE OptimizationMode
NDIS_MINIPORT_TIMER MediaDetectionTimer
NDIS_PHYSICAL_ADDRESS RbdPhysOriginal
NDIS_PHYSICAL_ADDRESS ReceiveBufferPhys
struct _NVNET_ADAPTER::@1013 MulticastList[NVNET_MULTICAST_LIST_SIZE]
NDIS_HANDLE AdapterHandle
NDIS_PHYSICAL_ADDRESS TbdPhysOriginal
NDIS_WORK_ITEM ResetWorkItem
NVNET_STATISTICS Statistics
UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS]
_Field_range_(0, NVNET_MULTICAST_LIST_SIZE) ULONG MulticastListSize
NDIS_HANDLE WrapperConfigurationHandle
PNVNET_PROCESS_TRANSMIT ProcessTransmit
SINGLE_LIST_ENTRY BufferList
ULONG ReceiveIrqNoBuffers
ULONG64 TransmitExcessiveCollisions
ULONG64 TransmitZeroRetry
ULONG64 ReceiveAlignmentErrors
ULONG64 TransmitLateCollisions
ULONG64 TransmitLostCarrierSense
ULONG64 HwRxFrameAlignErr
ULONG64 ReceiveOverrunErrors
ULONG64 TransmitUnderrunErrors
NDIS_PHYSICAL_ADDRESS PhysicalAddress
NDIS_PHYSICAL_ADDRESS PhysicalAddress
union _NVNET_WAKE_FRAME::@1012 PatternMask
ULONG ReceiveTcpV6Checksum
ULONG ReceiveUdpV6Checksum
ULONG ReceiveTcpV6Options
WDF_EXTERN_C_START typedef _In_ WDFDEVICE _In_ WDFCONTEXT _In_ WDF_DMA_DIRECTION _In_ PSCATTER_GATHER_LIST SgList
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Must_inspect_result_ _In_ ULONG Flags
struct _SCATTER_GATHER_LIST * PSCATTER_GATHER_LIST
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)