ReactOS 0.4.15-dev-7889-g76290a6
ndis56common.h
Go to the documentation of this file.
1/*
2 * This file contains general definitions for VirtIO network adapter driver,
3 * common for both NDIS5 and NDIS6
4 *
5 * Copyright (c) 2008-2017 Red Hat, Inc.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met :
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and / or other materials provided with the distribution.
15 * 3. Neither the names of the copyright holders nor the names of their contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30#ifndef PARANDIS_56_COMMON_H
31#define PARANDIS_56_COMMON_H
32
33//#define PARANDIS_TEST_TX_KICK_ALWAYS
34
35#if defined(OFFLOAD_UNIT_TEST)
36#include <windows.h>
37#include <stdio.h>
38
39#define ETH_LENGTH_OF_ADDRESS 6
40#define DoPrint(fmt, ...) printf(fmt##"\n", __VA_ARGS__)
41#define DPrintf(a,b) DoPrint b
42#define RtlOffsetToPointer(B,O) ((PCHAR)( ((PCHAR)(B)) + ((ULONG_PTR)(O)) ))
43
44#include "ethernetutils.h"
45#endif //+OFFLOAD_UNIT_TEST
46
47#if !defined(OFFLOAD_UNIT_TEST)
48
49#if !defined(RtlOffsetToPointer)
50#define RtlOffsetToPointer(Base,Offset) ((PCHAR)(((PCHAR)(Base))+((ULONG_PTR)(Offset))))
51#endif
52
53#if !defined(RtlPointerToOffset)
54#define RtlPointerToOffset(Base,Pointer) ((ULONG)(((PCHAR)(Pointer))-((PCHAR)(Base))))
55#endif
56
57
58#include <ndis.h>
59#include "osdep.h"
60#include "kdebugprint.h"
61#include "ethernetutils.h"
62#include "virtio_pci.h"
63#include "VirtIO.h"
64#include "virtio_ring.h"
65#include "IONetDescriptor.h"
66#include "DebugData.h"
67
68// those stuff defined in NDIS
69//NDIS_MINIPORT_MAJOR_VERSION
70//NDIS_MINIPORT_MINOR_VERSION
71// those stuff defined in build environment
72// PARANDIS_MAJOR_DRIVER_VERSION
73// PARANDIS_MINOR_DRIVER_VERSION
74
75#if !defined(NDIS_MINIPORT_MAJOR_VERSION) || !defined(NDIS_MINIPORT_MINOR_VERSION)
76#error "Something is wrong with NDIS environment"
77#endif
78
79//define to see when the status register is unreadable(see ParaNdis_ResetVirtIONetDevice)
80//#define VIRTIO_RESET_VERIFY
81
82//define to if hardware raise interrupt on error (see ParaNdis_DPCWorkBody)
83//#define VIRTIO_SIGNAL_ERROR
84
85// define if qemu supports logging to static IO port for synchronization
86// of driver output with qemu printouts; in this case define the port number
87// #define VIRTIO_DBG_USE_IOPORT 0x99
88
89// to be set to real limit later
90#define MAX_RX_LOOPS 1000
91
92// maximum number of virtio queues used by the driver
93#define MAX_NUM_OF_QUEUES 3
94
95/* The feature bitmap for virtio net */
96#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
97#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
98#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */
99#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
100#define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */
101#define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */
102#define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */
103#define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */
104#define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */
105#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
106#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
107#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
108#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can handle merged Rx buffers and requires bigger header for that. */
109#define VIRTIO_NET_F_STATUS 16
110#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */
111#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */
112#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */
113#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */
114
115#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
116
117#define VIRTIO_NET_INVALID_INTERRUPT_STATUS 0xFF
118
119#define PARANDIS_MULTICAST_LIST_SIZE 32
120#define PARANDIS_MEMORY_TAG '5muQ'
121#define PARANDIS_FORMAL_LINK_SPEED (pContext->ulFormalLinkSpeed)
122#define PARANDIS_MAXIMUM_TRANSMIT_SPEED PARANDIS_FORMAL_LINK_SPEED
123#define PARANDIS_MAXIMUM_RECEIVE_SPEED PARANDIS_FORMAL_LINK_SPEED
124#define PARANDIS_MIN_LSO_SEGMENTS 2
125// reported
126#define PARANDIS_MAX_LSO_SIZE 0xF800
127
128#define PARANDIS_UNLIMITED_PACKETS_TO_INDICATE (~0ul)
129
131
133{
135 isReceive = 0x10,
137 isUnknown = 0x40,
140 isDisable = 0x80
142
149
151
152
154{
155 srsDisabled = 0, // initial state
159
160typedef struct _tagBusResource {
167
169{
176
178{
179 osbT4IpChecksum = (1 << 0),
184 osbT4Lso = (1 << 5),
185 osbT4LsoIp = (1 << 6),
186 osbT4LsoTcp = (1 << 7),
189 osbT4RxIPChecksum = (1 << 10),
192 osbT6TcpChecksum = (1 << 13),
193 osbT6UdpChecksum = (1 << 14),
196 osbT6Lso = (1 << 17),
197 osbT6LsoIpExt = (1 << 18),
204
206{
232
233
235{
236 /* current value of enabled offload features */
238 /* load once, do not modify - bitmask of offload features, enabled in configuration */
243
245{
246 union
247 {
248 struct
249 {
258 };
260
261/*
262for simplicity, we use for NDIS5 the same statistics as native NDIS6 uses
263*/
264typedef struct _tagNdisStatistics
265{
285
289
291{
301
302//#define UNIFY_LOCKS
303
304typedef struct _tagOurCounters
305{
311
312typedef struct _tagMaxPacketSize
313{
319
321{
328
329typedef struct _tagMulticastData
330{
334
335typedef struct _tagIONetDescriptor {
343
344typedef void (*tReuseReceiveBufferProc)(void *pContext, pIONetDescriptor pDescriptor);
345
347{
353
358
360#ifdef PARANDIS_DEBUG_INTERRUPTS
362#endif
409 /* send part */
410#if !defined(UNIFY_LOCKS)
413#else
414 union
415 {
418 };
419#endif
421 struct
422 {
439 /* Net part - management of buffers and queues of QEMU */
444 /* list of Rx buffers available for data (under VIRTIO management) */
447 /* list of Rx buffers waiting for return (under NDIS management) */
449 /* list of Tx buffers in process (under VIRTIO management) */
451 /* list of Tx buffers ready for data (under MINIPORT management) */
453 /* current number of free Tx descriptors */
455 /* initial number of free Tx descriptor(from cfg) - max number of available Tx descriptors */
457 /* current number of free Tx buffers, which can be submitted */
459 /* maximal number of free Tx buffers, which can be used by SG */
461 /* minimal number of free Tx buffers */
463 /* current number of Tx packets (or lists) to return */
465 /* total of Rx buffer in turnaround */
472 // we keep these members common for XP and Vista
473 // for XP and non-MSI case of Vista they are set to zero
477
489
492{
496
498{
502
504
505/**********************************************************
506LAZY release procedure returns buffers to VirtIO
507only where there are no free buffers available
508
509NON-LAZY release releases transmit buffers from VirtIO
510library every time there is something to release
511***********************************************************/
512//#define LAZY_TX_RELEASE
513
514static inline bool VirtIODeviceGetHostFeature(PARANDIS_ADAPTER *pContext, unsigned uFeature)
515{
516 DPrintf(4, ("%s\n", __FUNCTION__));
517
518 return virtio_is_feature_enabled(pContext->ullHostFeatures, uFeature);
519}
520
521static inline void VirtIODeviceEnableGuestFeature(PARANDIS_ADAPTER *pContext, unsigned uFeature)
522{
523 DPrintf(4, ("%s\n", __FUNCTION__));
524
525 virtio_feature_enable(pContext->ullGuestFeatures, uFeature);
526}
527
529{
530#ifndef LAZY_TX_RELEASE
531 return pContext->nofFreeTxDescriptors < pContext->maxFreeTxDescriptors;
532#else
533 return pContext->nofFreeTxDescriptors == 0;
534#endif
535}
536
538{
539 return pContext->VlanId == 0 || pContext->VlanId == VlanID;
540}
541
543{
544 return pContext->ulPriorityVlanSetting & 2;
545}
546
548{
549 return pContext->ulPriorityVlanSetting & 1;
550}
551
553 PUCHAR pcMacAddress,
554 BOOLEAN bLocal);
555
557 PARANDIS_ADAPTER *pContext,
559
561 PARANDIS_ADAPTER *pContext);
562
564 PARANDIS_ADAPTER *pContext);
565
566
568 PARANDIS_ADAPTER *pContext);
569
571 PARANDIS_ADAPTER *pContext,
572 ULONG ulMaxPacketsToIndicate);
573
575 PARANDIS_ADAPTER *pContext,
578 PUINT pBytesRead,
579 PUINT pBytesNeeded);
580
582 PARANDIS_ADAPTER *pContext,
583 ULONG interruptSource);
584
586 PARANDIS_ADAPTER *pContext,
587 ULONG interruptSource);
588
589static __inline struct virtqueue *
591{
592 if (interruptSource & isTransmit)
593 return pContext->NetSendQueue;
594 if (interruptSource & isReceive)
595 return pContext->NetReceiveQueue;
596
597 return NULL;
598}
599
600static __inline BOOLEAN
602{
604}
605
607 PARANDIS_ADAPTER *pContext,
609 PVOID pInfo,
610 ULONG ulSize);
611
613 PARANDIS_ADAPTER *pContext,
614 BOOLEAN *pRunDpc);
615
617 PARANDIS_ADAPTER *pContext,
618 BOOLEAN *pRunDpc,
619 ULONG knownInterruptSources);
620
622 PARANDIS_ADAPTER *pContext);
623
625 PARANDIS_ADAPTER *pContext);
626
628 PARANDIS_ADAPTER *pContext,
629 BOOLEAN bForce);
630
632 PARANDIS_ADAPTER *pContext
633);
634
636 PARANDIS_ADAPTER *pContext
637);
638
640void ParaNdis_DebugCleanup(PDRIVER_OBJECT pDriverObject);
642
643
644//#define ENABLE_HISTORY_LOG
645#if !defined(ENABLE_HISTORY_LOG)
646
648 PARANDIS_ADAPTER *pContext,
650 PVOID pParam1,
651 ULONG lParam2,
652 ULONG lParam3,
653 ULONG lParam4)
654{
655
656}
657
658#else
659
661 PARANDIS_ADAPTER *pContext,
663 PVOID pParam1,
664 ULONG lParam2,
665 ULONG lParam3,
666 ULONG lParam4);
667
668#endif
669
671{
678 ULONG flags; //see tPacketOffloadRequest
680
682 PARANDIS_ADAPTER *pContext,
683 tTxOperationParameters *pParams);
684
685typedef struct _tagMapperResult
686{
691
692
694
696
698
700
701/*****************************************************
702Procedures to implement for NDIS specific implementation
703******************************************************/
704
706 PARANDIS_ADAPTER *pContext,
707 ULONG ulRequiredSize);
708
710 PARANDIS_ADAPTER *pContext);
711
713 PARANDIS_ADAPTER *pContext);
714
716 PARANDIS_ADAPTER *pContext);
717
719 PARANDIS_ADAPTER *pContext,
721 PULONG pLength,
722 BOOLEAN bPrepareOnly,
723 pIONetDescriptor pBufferDesc);
724
726 PARANDIS_ADAPTER *pContext,
727 tPacketIndicationType *pBatch,
728 ULONG nofPackets);
729
731 PARANDIS_ADAPTER *pContext,
733 PVOID Reference,
735 pIONetDescriptor pDesc,
736 tMapperResult *pMapperResult
737 );
738
741 PVOID dest,
742 ULONG maxSize,
743 PVOID refValue,
744 BOOLEAN bPreview);
745
747 PARANDIS_ADAPTER *pContext,
748 BOOLEAN IsDpc,
749 BOOLEAN IsInterrupt);
750
752 NDIS_HANDLE timer,
753 LONG millies);
754
756 PARANDIS_ADAPTER *pContext,
757 ULONG messageId,
758 tSynchronizedProcedure procedure,
759 PVOID parameter);
760
762 PARANDIS_ADAPTER *pContext);
763
765 PARANDIS_ADAPTER *pContext);
766
768 PARANDIS_ADAPTER *pContext,
769 IONetDescriptor *pDesc);
770
771
773 PARANDIS_ADAPTER *pContext,
774 tCompletePhysicalAddress *pAddresses);
775
776
778{
783
784
786 PARANDIS_ADAPTER *pContext,
787 tCompletePhysicalAddress *pAddresses);
788
790 PARANDIS_ADAPTER *pContext,
791 tCompletePhysicalAddress *pAddresses);
792
794 PARANDIS_ADAPTER *pContext,
795 pIONetDescriptor pBufferDesc);
796
798 PARANDIS_ADAPTER *pContext,
799 pIONetDescriptor pBufferDesc);
800
802 PARANDIS_ADAPTER *pContext,
804 BOOLEAN bForce);
805
807 PARANDIS_ADAPTER *pContext);
808
810 PARANDIS_ADAPTER *pContext);
811
813 PARANDIS_ADAPTER *pContext);
814
816 PARANDIS_ADAPTER *pContext,
817 NDIS_DEVICE_POWER_STATE newState);
818
819
820#endif //-OFFLOAD_UNIT_TEST
821
822typedef enum _tagppResult
823{
838
840{
841 struct {
842 /* 0 - not tested, 1 - not IP, 2 - IPV4, 3 - IPV6 */
844 /* 0 - not tested, 1 - n/a, 2 - CS, 3 - bad */
846 /* 0 - not tested, 1 - PCS, 2 - CS, 3 - bad */
848 /* 0 - not tested, 1 - other, 2 - known(contains basic TCP or UDP header), 3 - known incomplete */
850 /* 1 - contains complete payload */
859 };
862
864{
865 pcrIpChecksum = (1 << 0),
873 pcrLSO = (1 << 5),
874 pcrIsIP = (1 << 6),
882 pcrPriorityTag = (1 << 13),
883 pcrNoIndirect = (1 << 14)
885
886// sw offload
889
890void ParaNdis_PadPacketReceived(PVOID pDataBuffer, PULONG pLength);
891
892#endif
enum _etagHistoryLogOperation eHistoryLogOperation
unsigned char BOOLEAN
static BOOLEAN virtqueue_is_interrupt_enabled(struct virtqueue *vq)
Definition: VirtIO.h:110
#define VOID
Definition: acefi.h:82
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
UINT op
Definition: effect.c:236
ULONG_PTR KAFFINITY
Definition: compat.h:85
#define __FUNCTION__
Definition: types.h:116
#define DPrintf(Level, Fmt)
Definition: kdebugprint.h:61
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
BOOL bConnected
Definition: fdebug.c:27
PVOID dataBuffer
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
const GLuint * buffers
Definition: glext.h:5916
unsigned __int64 ULONG64
Definition: imports.h:198
static char * dest
Definition: rtl.c:135
_tagPacketOffloadRequest
Definition: ndis56common.h:864
@ pcrPriorityTag
Definition: ndis56common.h:882
@ pcrUdpV4Checksum
Definition: ndis56common.h:867
@ pcrLSO
Definition: ndis56common.h:873
@ pcrAnyChecksum
Definition: ndis56common.h:872
@ pcrFixPHChecksum
Definition: ndis56common.h:876
@ pcrTcpV4Checksum
Definition: ndis56common.h:866
@ pcrFixUdpV6Checksum
Definition: ndis56common.h:880
@ pcrIpChecksum
Definition: ndis56common.h:865
@ pcrTcpV6Checksum
Definition: ndis56common.h:868
@ pcrIsIP
Definition: ndis56common.h:874
@ pcrFixTcpV4Checksum
Definition: ndis56common.h:877
@ pcrUdpChecksum
Definition: ndis56common.h:871
@ pcrNoIndirect
Definition: ndis56common.h:883
@ pcrFixIPChecksum
Definition: ndis56common.h:875
@ pcrFixXxpChecksum
Definition: ndis56common.h:881
@ pcrTcpChecksum
Definition: ndis56common.h:870
@ pcrFixTcpV6Checksum
Definition: ndis56common.h:879
@ pcrUdpV6Checksum
Definition: ndis56common.h:869
@ pcrFixUdpV4Checksum
Definition: ndis56common.h:878
void ParaNdis_PadPacketReceived(PVOID pDataBuffer, PULONG pLength)
NDIS_STATUS ParaNdis_FinishInitialization(PARANDIS_ADAPTER *pContext)
struct _tagCompletePhysicalAddress tCompletePhysicalAddress
_tagOffloadSettingsBit
Definition: ndis56common.h:178
@ osbT4RxTCPChecksum
Definition: ndis56common.h:187
@ osbT4TcpChecksum
Definition: ndis56common.h:180
@ osbT4RxTCPOptionsChecksum
Definition: ndis56common.h:188
@ osbT4Lso
Definition: ndis56common.h:184
@ osbT6Lso
Definition: ndis56common.h:196
@ osbT6UdpChecksum
Definition: ndis56common.h:193
@ osbT4TcpOptionsChecksum
Definition: ndis56common.h:182
@ osbT6RxUDPChecksum
Definition: ndis56common.h:201
@ osbT4LsoIp
Definition: ndis56common.h:185
@ osbT4RxIPOptionsChecksum
Definition: ndis56common.h:190
@ osbT4UdpChecksum
Definition: ndis56common.h:181
@ osbT4IpOptionsChecksum
Definition: ndis56common.h:183
@ osbT4LsoTcp
Definition: ndis56common.h:186
@ osbT6RxTCPChecksum
Definition: ndis56common.h:199
@ osbT6TcpOptionsChecksum
Definition: ndis56common.h:194
@ osbT4RxIPChecksum
Definition: ndis56common.h:189
@ osbT6RxIpExtChecksum
Definition: ndis56common.h:202
@ osbT6LsoIpExt
Definition: ndis56common.h:197
@ osbT6IpExtChecksum
Definition: ndis56common.h:195
@ osbT4RxUDPChecksum
Definition: ndis56common.h:191
@ osbT4IpChecksum
Definition: ndis56common.h:179
@ osbT6TcpChecksum
Definition: ndis56common.h:192
@ osbT6LsoTcpOptions
Definition: ndis56common.h:198
@ osbT6RxTCPOptionsChecksum
Definition: ndis56common.h:200
struct _tagMulticastData tMulticastData
struct _tagIONetDescriptor IONetDescriptor
tTcpIpPacketParsingResult ParaNdis_CheckSumVerify(PVOID buffer, ULONG size, ULONG flags, LPCSTR caller)
Definition: sw-offload.c:565
struct _tagCopyPacketResult tCopyPacketResult
UINT ParaNdis_VirtIONetReleaseTransmitBuffers(PARANDIS_ADAPTER *pContext)
struct _tagNdisStatistics NDIS_STATISTICS_INFO
_tagSendReceiveState
Definition: ndis56common.h:154
@ srsEnabled
Definition: ndis56common.h:157
@ srsDisabled
Definition: ndis56common.h:155
@ srsPausing
Definition: ndis56common.h:156
BOOLEAN ParaNdis_CheckForHang(PARANDIS_ADAPTER *pContext)
VOID ParaNdis_FreePhysicalMemory(PARANDIS_ADAPTER *pContext, tCompletePhysicalAddress *pAddresses)
tTcpIpPacketParsingResult ParaNdis_ReviewIPPacket(PVOID buffer, ULONG size, LPCSTR caller)
Definition: sw-offload.c:614
void ParaNdis_DebugCleanup(PDRIVER_OBJECT pDriverObject)
static void VirtIODeviceEnableGuestFeature(PARANDIS_ADAPTER *pContext, unsigned uFeature)
Definition: ndis56common.h:521
NDIS_HANDLE ParaNdis_OpenNICConfiguration(PARANDIS_ADAPTER *pContext)
NDIS_STATUS ParaNdis_PowerOn(PARANDIS_ADAPTER *pContext)
VOID ParaNdis_VirtIOEnableIrqSynchronized(PARANDIS_ADAPTER *pContext, ULONG interruptSource)
VOID ParaNdis_PacketMapper(PARANDIS_ADAPTER *pContext, tPacketType packet, PVOID Reference, struct VirtIOBufferDescriptor *buffers, pIONetDescriptor pDesc, tMapperResult *pMapperResult)
tCopyPacketResult ParaNdis_PacketCopier(tPacketType packet, PVOID dest, ULONG maxSize, PVOID refValue, BOOLEAN bPreview)
PNDIS_PACKET tPacketHolderType
Definition: ndis56common.h:287
VOID ParaNdis_OnTransmitBufferReleased(PARANDIS_ADAPTER *pContext, IONetDescriptor *pDesc)
VOID(* tOnAdditionalPhysicalMemoryAllocated)(PARANDIS_ADAPTER *pContext, tCompletePhysicalAddress *pAddresses)
Definition: ndis56common.h:772
tChecksumCheckResult ParaNdis_CheckRxChecksum(PARANDIS_ADAPTER *pContext, ULONG virtioFlags, PVOID pRxPacket, ULONG len)
struct _tagPARANDIS_ADAPTER * PPARANDIS_ADAPTER
PVOID ParaNdis_AllocateMemory(PARANDIS_ADAPTER *pContext, ULONG ulRequiredSize)
VOID ParaNdis_CleanupContext(PARANDIS_ADAPTER *pContext)
BOOLEAN ParaNdis_SetTimer(NDIS_HANDLE timer, LONG millies)
struct _tagTxOperationParameters tTxOperationParameters
void(* tReuseReceiveBufferProc)(void *pContext, pIONetDescriptor pDescriptor)
Definition: ndis56common.h:344
VOID ParaNdis_Resume(PARANDIS_ADAPTER *pContext)
VOID ParaNdis_OnPnPEvent(PARANDIS_ADAPTER *pContext, NDIS_DEVICE_PNP_EVENT pEvent, PVOID pInfo, ULONG ulSize)
tCopyPacketResult ParaNdis_DoCopyPacketData(PARANDIS_ADAPTER *pContext, tTxOperationParameters *pParams)
VOID ParaNdis_IndicateReceivedBatch(PARANDIS_ADAPTER *pContext, tPacketIndicationType *pBatch, ULONG nofPackets)
union _tagTcpIpPacketParsingResult tTcpIpPacketParsingResult
BOOLEAN ParaNdis_InitialAllocatePhysicalMemory(PARANDIS_ADAPTER *pContext, tCompletePhysicalAddress *pAddresses)
void ParaNdis_ResetOffloadSettings(PARANDIS_ADAPTER *pContext, tOffloadSettingsFlags *pDest, PULONG from)
VOID ParaNdis_SetPowerState(PARANDIS_ADAPTER *pContext, NDIS_DEVICE_POWER_STATE newState)
tPacketIndicationType ParaNdis_IndicateReceivedPacket(PARANDIS_ADAPTER *pContext, PVOID dataBuffer, PULONG pLength, BOOLEAN bPrepareOnly, pIONetDescriptor pBufferDesc)
static BOOLEAN FORCEINLINE IsPrioritySupported(PARANDIS_ADAPTER *pContext)
Definition: ndis56common.h:547
tCopyPacketError
Definition: ndis56common.h:490
@ cpeInternalError
Definition: ndis56common.h:490
@ cpeNoIndirect
Definition: ndis56common.h:490
@ cpeOK
Definition: ndis56common.h:490
@ cpeNoBuffer
Definition: ndis56common.h:490
@ cpeTooLarge
Definition: ndis56common.h:490
static BOOLEAN FORCEINLINE IsVlanSupported(PARANDIS_ADAPTER *pContext)
Definition: ndis56common.h:542
_tagInterruptSource
Definition: ndis56common.h:133
@ isBothTransmitReceive
Definition: ndis56common.h:138
@ isTransmit
Definition: ndis56common.h:136
@ isAny
Definition: ndis56common.h:139
@ isUnknown
Definition: ndis56common.h:137
@ isDisable
Definition: ndis56common.h:140
@ isReceive
Definition: ndis56common.h:135
@ isControl
Definition: ndis56common.h:134
#define PARANDIS_MULTICAST_LIST_SIZE
Definition: ndis56common.h:119
void ParaNdis_DebugInitialize(PVOID DriverObject, PVOID RegistryPath)
struct _tagOurCounters tOurCounters
static __inline struct virtqueue * ParaNdis_GetQueueForInterrupt(PARANDIS_ADAPTER *pContext, ULONG interruptSource)
Definition: ndis56common.h:590
VOID ParaNdis_UpdateDeviceFilters(PARANDIS_ADAPTER *pContext)
enum _tagOffloadSettingsBit tOffloadSettingsBit
struct _tagMapperResult tMapperResult
struct _tagOffloadSettingsFlags tOffloadSettingsFlags
VOID ParaNdis_PowerOff(PARANDIS_ADAPTER *pContext)
void ParaNdis_DebugRegisterMiniport(PARANDIS_ADAPTER *pContext, BOOLEAN bRegister)
void ParaNdis_IndicateConnect(PARANDIS_ADAPTER *pContext, BOOLEAN bConnected, BOOLEAN bForce)
static BOOLEAN FORCEINLINE IsTimeToReleaseTx(PARANDIS_ADAPTER *pContext)
Definition: ndis56common.h:528
struct _tagNdisOffloadParams NDIS_OFFLOAD_PARAMETERS
BOOLEAN ParaNdis_ValidateMacAddress(PUCHAR pcMacAddress, BOOLEAN bLocal)
VOID ParaNdis_ReportLinkStatus(PARANDIS_ADAPTER *pContext, BOOLEAN bForce)
BOOLEAN ParaNdis_SynchronizeWithInterrupt(PARANDIS_ADAPTER *pContext, ULONG messageId, tSynchronizedProcedure procedure, PVOID parameter)
struct _tagMaxPacketSize tMaxPacketSize
VirtIOSystemOps ParaNdisSystemOps
enum _tagppResult ppResult
struct _tagPARANDIS_ADAPTER PARANDIS_ADAPTER
struct _tagSynchronizedContext tSynchronizedContext
_tagppResult
Definition: ndis56common.h:823
@ ppresIPTooShort
Definition: ndis56common.h:828
@ ppresCSBad
Definition: ndis56common.h:831
@ ppresIsTCP
Definition: ndis56common.h:835
@ ppresPCSOK
Definition: ndis56common.h:829
@ ppresNotTested
Definition: ndis56common.h:824
@ ppresIsUDP
Definition: ndis56common.h:836
@ ppresIPV4
Definition: ndis56common.h:826
@ ppresXxpKnown
Definition: ndis56common.h:833
@ ppresNotIP
Definition: ndis56common.h:825
@ ppresXxpOther
Definition: ndis56common.h:832
@ ppresCSOK
Definition: ndis56common.h:830
@ ppresXxpIncomplete
Definition: ndis56common.h:834
@ ppresIPV6
Definition: ndis56common.h:827
VOID ParaNdis_FinalizeCleanup(PARANDIS_ADAPTER *pContext)
NDIS_STATUS NTAPI ParaNdis_FinishSpecificInitialization(PARANDIS_ADAPTER *pContext)
BOOLEAN ParaNdis_OnQueuedInterrupt(PARANDIS_ADAPTER *pContext, BOOLEAN *pRunDpc, ULONG knownInterruptSources)
VOID ParaNdis_DeviceFiltersUpdateVlanId(PARANDIS_ADAPTER *pContext)
enum _tagSendReceiveState tSendReceiveState
struct _tagIONetDescriptor * pIONetDescriptor
void ParaNdis_RestoreDeviceConfigurationAfterReset(PARANDIS_ADAPTER *pContext)
VOID ParaNdis_VirtIODisableIrqSynchronized(PARANDIS_ADAPTER *pContext, ULONG interruptSource)
ULONG ParaNdis_DPCWorkBody(PARANDIS_ADAPTER *pContext, ULONG ulMaxPacketsToIndicate)
VOID(* ONPAUSECOMPLETEPROC)(VOID *)
Definition: ndis56common.h:150
static const ULONG PARANDIS_PACKET_FILTERS
Definition: ndis56common.h:143
VOID ParaNdis_OnShutdown(PARANDIS_ADAPTER *pContext)
PNDIS_PACKET tPacketType
Definition: ndis56common.h:286
struct _tagPhysicalAddressAllocationContext tPhysicalAddressAllocationContext
enum _tagInterruptSource tInterruptSource
void ParaNdis_CallOnBugCheck(PARANDIS_ADAPTER *pContext)
enum _tagPacketOffloadRequest tPacketOffloadRequest
struct _tagBusResource tBusResource
void ParaNdis_UnbindBufferFromPacket(PARANDIS_ADAPTER *pContext, pIONetDescriptor pBufferDesc)
NDIS_STATUS ParaNdis_SetMulticastList(PARANDIS_ADAPTER *pContext, PVOID Buffer, ULONG BufferSize, PUINT pBytesRead, PUINT pBytesNeeded)
struct _tagAdapterResources tAdapterResources
VOID ParaNdis_Suspend(PARANDIS_ADAPTER *pContext)
BOOLEAN ParaNdis_OnLegacyInterrupt(PARANDIS_ADAPTER *pContext, BOOLEAN *pRunDpc)
PNDIS_PACKET tPacketIndicationType
Definition: ndis56common.h:288
struct _tagOffloadSettings tOffloadSettings
struct _tagChecksumCheckResult tChecksumCheckResult
static __inline BOOLEAN ParaNDIS_IsQueueInterruptEnabled(struct virtqueue *_vq)
Definition: ndis56common.h:601
BOOLEAN ParaNdis_BindBufferToPacket(PARANDIS_ADAPTER *pContext, pIONetDescriptor pBufferDesc)
NDIS_STATUS ParaNdis_InitializeContext(PARANDIS_ADAPTER *pContext, PNDIS_RESOURCE_LIST ResourceList)
static bool VirtIODeviceGetHostFeature(PARANDIS_ADAPTER *pContext, unsigned uFeature)
Definition: ndis56common.h:514
static void FORCEINLINE ParaNdis_DebugHistory(PARANDIS_ADAPTER *pContext, eHistoryLogOperation op, PVOID pParam1, ULONG lParam2, ULONG lParam3, ULONG lParam4)
Definition: ndis56common.h:647
tCopyPacketResult ParaNdis_DoSubmitPacket(PARANDIS_ADAPTER *pContext, tTxOperationParameters *Params)
#define MAX_NUM_OF_QUEUES
Definition: ndis56common.h:93
static BOOLEAN FORCEINLINE IsValidVlanId(PARANDIS_ADAPTER *pContext, ULONG VlanID)
Definition: ndis56common.h:537
BOOLEAN(NTAPI * tSynchronizedProcedure)(tSynchronizedContext *context)
Definition: ndis56common.h:503
BOOLEAN ParaNdis_ProcessTx(PARANDIS_ADAPTER *pContext, BOOLEAN IsDpc, BOOLEAN IsInterrupt)
enum _NDIS_DEVICE_PNP_EVENT NDIS_DEVICE_PNP_EVENT
#define NDIS_PACKET_TYPE_PROMISCUOUS
Definition: ndis.h:668
unsigned int * PUINT
Definition: ndis.h:50
unsigned int UINT
Definition: ndis.h:50
#define NDIS_PACKET_TYPE_BROADCAST
Definition: ndis.h:666
#define NDIS_PACKET_TYPE_MULTICAST
Definition: ndis.h:664
#define NDIS_PACKET_TYPE_DIRECTED
Definition: ndis.h:663
#define NDIS_PACKET_TYPE_ALL_MULTICAST
Definition: ndis.h:665
enum _NDIS_DEVICE_POWER_STATE NDIS_DEVICE_POWER_STATE
int NDIS_STATUS
Definition: ntddndis.h:475
#define BOOLEAN
Definition: pedump.c:73
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
CardRegion * from
Definition: spigame.cpp:19
Definition: typedefs.h:120
tBusResource PciBars[PCI_TYPE0_ADDRESSES]
Definition: ndis56common.h:170
NDIS_PHYSICAL_ADDRESS BasePA
Definition: ndis56common.h:161
BOOLEAN bPortSpace
Definition: ndis56common.h:164
struct _tagChecksumCheckResult::@991::@993 flags
PHYSICAL_ADDRESS Physical
Definition: ndis56common.h:322
tCopyPacketError error
Definition: ndis56common.h:494
LIST_ENTRY listEntry
Definition: ndis56common.h:336
tCompletePhysicalAddress HeaderInfo
Definition: ndis56common.h:337
tPacketHolderType pHolder
Definition: ndis56common.h:339
tCompletePhysicalAddress DataInfo
Definition: ndis56common.h:338
USHORT usBuffersMapped
Definition: ndis56common.h:687
USHORT usBufferSpaceUsed
Definition: ndis56common.h:688
UCHAR MulticastList[ETH_LENGTH_OF_ADDRESS *PARANDIS_MULTICAST_LIST_SIZE]
Definition: ndis56common.h:332
ULONG64 ifHCOutMulticastPkts
Definition: ndis56common.h:278
ULONG64 ifHCInBroadcastPkts
Definition: ndis56common.h:271
ULONG64 ifHCOutMulticastOctets
Definition: ndis56common.h:279
ULONG64 ifHCOutBroadcastOctets
Definition: ndis56common.h:281
ULONG64 ifHCInMulticastOctets
Definition: ndis56common.h:270
ULONG64 ifHCInMulticastPkts
Definition: ndis56common.h:269
ULONG64 ifHCInUcastOctets
Definition: ndis56common.h:268
ULONG64 ifHCOutUcastOctets
Definition: ndis56common.h:277
ULONG64 ifHCOutBroadcastPkts
Definition: ndis56common.h:280
ULONG64 ifHCOutUcastPkts
Definition: ndis56common.h:276
ULONG64 ifHCInBroadcastOctets
Definition: ndis56common.h:272
tOffloadSettingsFlags flags
Definition: ndis56common.h:237
NDIS_OFFLOAD_PARAMETERS InitialOffloadParameters
Definition: ndis56common.h:471
NDIS_DEVICE_POWER_STATE powerState
Definition: ndis56common.h:389
tAdapterResources AdapterResources
Definition: ndis56common.h:351
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: ndis56common.h:478
ULONGLONG ullHostFeatures
Definition: ndis56common.h:356
ULONGLONG ulFormalLinkSpeed
Definition: ndis56common.h:396
NDIS_HANDLE MiniportHandle
Definition: ndis56common.h:349
tOurCounters Counters
Definition: ndis56common.h:432
UINT uNumberOfHandledRXPacketsInDPC
Definition: ndis56common.h:388
BOOLEAN bFastSuspendInProcess
Definition: ndis56common.h:384
tOurCounters Limits
Definition: ndis56common.h:433
NDIS_SPIN_LOCK ReceiveLock
Definition: ndis56common.h:412
ONPAUSECOMPLETEPROC ReceivePauseCompletionProc
Definition: ndis56common.h:437
tMulticastData MulticastData
Definition: ndis56common.h:387
NDIS_STATISTICS_INFO Statistics
Definition: ndis56common.h:420
BOOLEAN bIODeviceInitialized
Definition: ndis56common.h:355
BOOLEAN bDoInterruptRecovery
Definition: ndis56common.h:366
BOOLEAN bDoGuestChecksumOnReceive
Definition: ndis56common.h:373
tSendReceiveState SendState
Definition: ndis56common.h:434
struct virtqueue * NetSendQueue
Definition: ndis56common.h:443
NDIS_HANDLE WrapperConfigurationHandle
Definition: ndis56common.h:481
NDIS_DEVICE_PNP_EVENT PnpEvents[16]
Definition: ndis56common.h:469
struct VirtIOBufferDescriptor * sgTxGatherTable
Definition: ndis56common.h:467
NDIS_SPIN_LOCK SendLock
Definition: ndis56common.h:411
NDIS_HANDLE DriverHandle
Definition: ndis56common.h:348
LARGE_INTEGER LastInterruptTimeStamp
Definition: ndis56common.h:361
BOOLEAN bDoHwPacketFiltering
Definition: ndis56common.h:368
ULONGLONG ullGuestFeatures
Definition: ndis56common.h:357
ONPAUSECOMPLETEPROC SendPauseCompletionProc
Definition: ndis56common.h:436
LIST_ENTRY NetSendBuffersInUse
Definition: ndis56common.h:450
VirtIODevice IODevice
Definition: ndis56common.h:354
tReuseReceiveBufferProc ReuseBufferProc
Definition: ndis56common.h:438
LIST_ENTRY TxWaitingList
Definition: ndis56common.h:483
NDIS_TIMER DPCPostProcessTimer
Definition: ndis56common.h:486
tSendReceiveState ReceiveState
Definition: ndis56common.h:435
BOOLEAN bEnableInterruptChecking
Definition: ndis56common.h:365
NDIS_TIMER ConnectTimer
Definition: ndis56common.h:485
BOOLEAN bEnableInterruptHandlingDPC
Definition: ndis56common.h:364
tBusResource SharedMemoryRanges[MAX_NUM_OF_QUEUES]
Definition: ndis56common.h:352
struct _tagPARANDIS_ADAPTER::@994 extraStatistics
UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: ndis56common.h:402
NDIS_HANDLE BuffersPool
Definition: ndis56common.h:480
NDIS_HANDLE PacketPool
Definition: ndis56common.h:479
UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: ndis56common.h:401
LIST_ENTRY NetFreeSendBuffers
Definition: ndis56common.h:452
BOOLEAN bLinkDetectSupported
Definition: ndis56common.h:371
tCompletePhysicalAddress ControlData
Definition: ndis56common.h:441
LIST_ENTRY NetReceiveBuffers
Definition: ndis56common.h:445
tMaxPacketSize MaxPacketSize
Definition: ndis56common.h:398
struct virtqueue * NetControlQueue
Definition: ndis56common.h:440
LARGE_INTEGER LastTxCompletionTimeStamp
Definition: ndis56common.h:359
tOffloadSettings Offload
Definition: ndis56common.h:470
struct virtqueue * NetReceiveQueue
Definition: ndis56common.h:442
LIST_ENTRY NetReceiveBuffersWaiting
Definition: ndis56common.h:448
tOnAdditionalPhysicalMemoryAllocated Callback
Definition: ndis56common.h:781
tCompletePhysicalAddress address
Definition: ndis56common.h:779
PARANDIS_ADAPTER * pContext
Definition: ndis56common.h:499
Definition: http.c:7252
Definition: dhcpd.h:135
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define VIRTIO_PCI_ISR_CONFIG
Definition: virtio_pci.h:96
#define virtio_is_feature_enabled(FeaturesList, Feature)
Definition: virtio_pci.h:311
#define virtio_feature_enable(FeaturesList, Feature)
Definition: virtio_pci.h:312
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
#define FORCEINLINE
Definition: wdftypes.h:67
#define PCI_TYPE0_ADDRESSES
Definition: iotypes.h:3500
const char * LPCSTR
Definition: xmlstorage.h:183
unsigned char UCHAR
Definition: xmlstorage.h:181