diff options
| author | Yang You (UU) <[email protected]> | 2025-12-04 15:03:24 -0800 |
|---|---|---|
| committer | Yang You (UU) <[email protected]> | 2025-12-04 15:03:24 -0800 |
| commit | 977cb2461482a898f96ee08f9cb24eb7f421da03 (patch) | |
| tree | 071ef1691d00aaee8679603a1059d3eb71442b77 | |
| parent | 83019ae0c63454b2835f8fc245c7505351cee677 (diff) | |
intergrate the netvadapterlibrary with wificxsampledriver, cleanup the memory related header -KNEW.H
24 files changed, 355 insertions, 507 deletions
diff --git a/network/netadaptercx/netvadapterlibrary/code/adapter.h b/network/netadaptercx/netvadapterlibrary/Interface/netvadapter.h index 55c4948d..d8e4294f 100644 --- a/network/netadaptercx/netvadapterlibrary/code/adapter.h +++ b/network/netadaptercx/netvadapterlibrary/Interface/netvadapter.h @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved - #pragma once -#include <netadaptercx.h> - -#define MAX_RX_BUFFER_SIZE 65535 +#define MAX_MULTICAST_LIST_SIZE 32 +#define MAC_ADDR_LEN 6 #define MAX_RX_QUEUES 1 #define MAX_TX_QUEUES 1 #define MTU_SIZE 1500 -#define MAX_MULTICAST_LIST_SIZE 32 -#define MAC_ADDR_LEN 6 + #define NETV_NUMBER_OF_QUEUES 1 // supported filters @@ -20,6 +17,7 @@ NetPacketFilterFlagPromiscuous | \ NetPacketFilterFlagAllMulticast) + NTSTATUS ConfigureAndStartAdapter( _In_ NETADAPTER Adapter @@ -50,40 +48,29 @@ public: WDFDEVICE Device ) noexcept; - void - Destroy( - void - ); - - NTSTATUS - Initialize( - void - ); - - NTSTATUS - CreateRxQueue( - NETRXQUEUE_INIT * NetRxQueueInit - ); - - NTSTATUS - CreateTxQueue( - NETTXQUEUE_INIT * NetTxQueueInit - ); + // Public API + void Destroy(); + NTSTATUS Initialize(); + NTSTATUS CreateRxQueue(_Inout_ NETRXQUEUE_INIT* NetRxQueueInit); + NTSTATUS CreateTxQueue(_Inout_ NETTXQUEUE_INIT* NetTxQueueInit); + // Former INetvAdapter method (kept as regular method) NTSTATUS ConfigureDataCapabilities(); + // Existing public API void SetPdoWakeSignalCallback(_In_ EVT_PDO_WAKE_SIGNAL* evtPdoWakeSignal, _In_ void* context); - void ArmWakeFromS0(void); - void DisarmWakeFromS0(void); NETADAPTER m_handle = WDF_NO_HANDLE; WDFDEVICE m_device = WDF_NO_HANDLE; +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) + BOOLEAN PreallocatedRxBuffers; NETMEMORYCOLLECTION m_preallocatedRxBuffers = WDF_NO_HANDLE; +#endif //NETCX 2.6 only // configuration NET_ADAPTER_LINK_LAYER_ADDRESS PermanentAddress; @@ -91,7 +78,6 @@ public: ULONG MACLastByte; BOOLEAN S0Idle; BOOLEAN EnableUsoUro; - BOOLEAN PreallocatedRxBuffers; // Packet Filter and look ahead size. NET_PACKET_FILTER_FLAGS PacketFilter; @@ -127,6 +113,7 @@ private: void ) const; + virtual NTSTATUS NetvAdapterReadAddress(); }; @@ -136,6 +123,4 @@ typedef struct _GLOBAL_CONTEXT { } GLOBAL_CONTEXT; -extern GLOBAL_CONTEXT NetvGlobalContext; - - +extern GLOBAL_CONTEXT NetvGlobalContext;
\ No newline at end of file diff --git a/network/netadaptercx/netvadapterlibrary/code/adapter.cpp b/network/netadaptercx/netvadapterlibrary/code/adapter.cpp index 1e6777b8..a047f163 100644 --- a/network/netadaptercx/netvadapterlibrary/code/adapter.cpp +++ b/network/netadaptercx/netvadapterlibrary/code/adapter.cpp @@ -8,7 +8,7 @@ #else #include "net/umxfilter.h" // Copied from Km XFilter.h, NETCX please move this xfilter.h into shared location #endif -#include "adapter.h" +#include "netvadapter.h" #include "rxqueue.h" #include "txqueue.h" #include "configuration.h" @@ -431,6 +431,7 @@ NetvAdapterSetUsoUroOffloadCapabilities( _Use_decl_annotations_ NTSTATUS NetvAdapter::ConfigureDataCapabilities() { +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) if (PreallocatedRxBuffers) { WDF_OBJECT_ATTRIBUTES attributes; @@ -466,20 +467,21 @@ NTSTATUS NetvAdapter::ConfigureDataCapabilities() MAX_RX_BUFFER_SIZE )); } +#endif //NETCX 2.6 only NET_ADAPTER_TX_CAPABILITIES txCapabilities; NET_ADAPTER_TX_CAPABILITIES_INIT(&txCapabilities, MAX_TX_QUEUES); NET_ADAPTER_RX_CAPABILITIES rxCapabilities; NET_ADAPTER_RX_CAPABILITIES_INIT_SYSTEM_MANAGED(&rxCapabilities, MAX_RX_BUFFER_SIZE, MAX_RX_QUEUES); - +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) if (PreallocatedRxBuffers) { rxCapabilities.AllocationMode = NetRxFragmentBufferAllocationModeDriverV2; rxCapabilities.AttachmentMode = NetRxFragmentBufferAttachmentModeDriver; rxCapabilities.MemoryCollection = m_preallocatedRxBuffers; } - +#endif //NETCX 2.6 only NET_ADAPTER_LINK_LAYER_CAPABILITIES linkLayerCapabilities; NET_ADAPTER_LINK_LAYER_CAPABILITIES_INIT(&linkLayerCapabilities, MAX_LINK_SPEED, MAX_LINK_SPEED); diff --git a/network/netadaptercx/netvadapterlibrary/code/configuration.cpp b/network/netadaptercx/netvadapterlibrary/code/configuration.cpp index 52ae7886..360cc43d 100644 --- a/network/netadaptercx/netvadapterlibrary/code/configuration.cpp +++ b/network/netadaptercx/netvadapterlibrary/code/configuration.cpp @@ -1,7 +1,8 @@ #include "pch.hpp" +#include "netvadapter.h" + #include "trace.h" #include "configuration.tmh" -#include "adapter.h" typedef struct _NETVADAPTER_ADVANCED_PROPERTY { @@ -27,7 +28,9 @@ NETVADAPTER_ADVANCED_PROPERTY NetvSupportedProperties[] = { CONSTANT_UNICODE_STRING(L"LinkProcIndex"), NETV_OFFSET(LinkProcIndex), NETV_SIZE(LinkProcIndex), 1000, 0, 1023 }, { CONSTANT_UNICODE_STRING(L"S0Idle"), NETV_OFFSET(S0Idle), NETV_SIZE(S0Idle), 0, 0, 1 }, { CONSTANT_UNICODE_STRING(L"EnableUsoUro"), NETV_OFFSET(EnableUsoUro), NETV_SIZE(EnableUsoUro), 0, 0, 1 }, +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) { CONSTANT_UNICODE_STRING(L"PreallocatedRxBuffers"), NETV_OFFSET(PreallocatedRxBuffers), NETV_SIZE(PreallocatedRxBuffers), 0, 0, 1 }, +#endif //NETCX 2.6 only }; NTSTATUS diff --git a/network/netadaptercx/netvadapterlibrary/code/enl.cpp b/network/netadaptercx/netvadapterlibrary/code/enl.cpp index 4e19517f..30822900 100644 --- a/network/netadaptercx/netvadapterlibrary/code/enl.cpp +++ b/network/netadaptercx/netvadapterlibrary/code/enl.cpp @@ -1,7 +1,7 @@ +// Copyright (C) Microsoft Corporation. All rights reserved. #include "pch.hpp" #include <stdlib.h> -//#include <ntassert.h> -#include "adapter.h" +#include "netvadapter.h" #include "rxqueue.h" #include "txqueue.h" #include "trace.h" @@ -345,7 +345,7 @@ EnlpIterationRoutine( auto fragment = NetFragmentIteratorGetFragment(&rxFi); BYTE* fragmentBuffer = nullptr; - +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) if (rxq->RxQueue->m_adapter.PreallocatedRxBuffers) { MemoryBuffer* bufferToUse = GetMemoryFromHandle(rxq->RxQueue->m_adapter.m_preallocatedRxBuffers)->PopAvailableBuffer(); @@ -382,6 +382,7 @@ EnlpIterationRoutine( fragment->Scratch = 0; } else +#endif //NETCX 2.6 only { auto const rxVirtualAddress = NetExtensionGetFragmentVirtualAddress( @@ -659,7 +660,7 @@ EnlCreateLink( ) { LogInformation(FLAG_DRIVER, L"ProcessorIndex=%u", ProcessorIndex); - + auto enlLink = wil::make_unique_nothrow<ENLP_LINK>(); RETURN_NTSTATUS_IF( STATUS_INSUFFICIENT_RESOURCES, @@ -745,7 +746,7 @@ EnlDeactivateLinkPort( ULONG i; NT_FRE_ASSERT(EnlIsPortActive(EnlLink, PortIndex)); - KLockThisExclusive(EnlLink->Lock); + //KLockThisExclusive(EnlLink->Lock); NT_FRE_ASSERT(!EnlpIsThreadPaused(&EnlLink->EnlThread)); EnlpPauseThread(&EnlLink->EnlThread); diff --git a/network/netadaptercx/netvadapterlibrary/code/enl.h b/network/netadaptercx/netvadapterlibrary/code/enl.h index 6089107e..529c36ac 100644 --- a/network/netadaptercx/netvadapterlibrary/code/enl.h +++ b/network/netadaptercx/netvadapterlibrary/code/enl.h @@ -1,4 +1,4 @@ - +// Copyright (C) Microsoft Corporation. All rights reserved. // // Emulated Network Link (ENL) definitions // @@ -21,16 +21,13 @@ // NBL completions by queueing DPCs to the target processor. // -//#include <ntassert.h> + #ifndef _KERNEL_MODE #define ASSERT(x) NT_ASSERT(x) -#include "rtl/UmPool.h" + #endif #include "rtl/KWaitEvent.h" -#include "rtl/KLockHolder.h" #include "rtl/KSpinLock.h" -#include "rtl/KPushLock.h" -#include "rtl/KNew.h" #define ENL_MAX_PROC_COUNT 16 #define ENLP_PORT_COUNT 2 @@ -239,10 +236,8 @@ struct DECLSPEC_ALIGN(PAGE_SIZE) ENLP_PORT ENLP_QUEUE RxQueue[ENL_MAX_PROC_COUNT]; }; -struct ENLP_LINK : - public NONPAGED_OBJECT<'LLNE'> +struct ENLP_LINK { - KPushLock Lock{}; ULONG64 Ts{}; ULONG64 BusyTicks{}; ULONG64 EmptyTicks{}; diff --git a/network/netadaptercx/netvadapterlibrary/code/memory.cpp b/network/netadaptercx/netvadapterlibrary/code/memory.cpp index 6d23f3bc..0c010d59 100644 --- a/network/netadaptercx/netvadapterlibrary/code/memory.cpp +++ b/network/netadaptercx/netvadapterlibrary/code/memory.cpp @@ -5,6 +5,8 @@ #include "trace.h" #include "memory.tmh" +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) + NTSTATUS Memory::Initialize( NETMEMORYCOLLECTION MemoryCollection, @@ -75,3 +77,11 @@ Memory::ReturnBuffer( m_buffersReadyToUse[m_lastBufferToUse++] = Buffer; } +#endif //NETCX 2.6 only + +// for wil::make_unique_nothrow +void* +operator new(size_t s, std::nothrow_t const&) +{ + return operator new(s); +}
\ No newline at end of file diff --git a/network/netadaptercx/netvadapterlibrary/code/memory.h b/network/netadaptercx/netvadapterlibrary/code/memory.h index b7ed654d..a07af6b8 100644 --- a/network/netadaptercx/netvadapterlibrary/code/memory.h +++ b/network/netadaptercx/netvadapterlibrary/code/memory.h @@ -1,8 +1,11 @@ // Copyright (C) Microsoft Corporation. All rights reserved. #pragma once -#include "adapter.h" #include <KSpinLock.h> +#define MAX_RX_BUFFER_SIZE 65535 + +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) + static const size_t PREALLOCATED_BUFFERS_COUNT = 128; struct MemoryBuffer @@ -57,3 +60,4 @@ private: }; WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(Memory, GetMemoryFromHandle); +#endif //NETCX 2.6 only
\ No newline at end of file diff --git a/network/netadaptercx/netvadapterlibrary/code/rtl/KNew.h b/network/netadaptercx/netvadapterlibrary/code/rtl/KNew.h deleted file mode 100644 index 28c832bd..00000000 --- a/network/netadaptercx/netvadapterlibrary/code/rtl/KNew.h +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (C) Microsoft Corporation. All rights reserved. - -#pragma once - -#include <new.h> - -#if UMDF_DRIVER == 0 -#include <pooltypes.h> -#endif - -#include <KDebug.h> -#include <KMacros.h> - -// -// KALLOCATOR KALLOCATOR_NONPAGED -// ---------------------------------------+--------------------+--------------------+ -// The object must be allocated at IRQL: | = PASSIVE_LEVEL | = PASSIVE_LEVEL | -// ---------------------------------------+--------------------+--------------------+ -// The object must be freed at IRQL: | = PASSIVE_LEVEL | = PASSIVE_LEVEL | -// ---------------------------------------+--------------------+--------------------+ -// Constructor & destructor run at: | = PASSIVE_LEVEL | = PASSIVE_LEVEL | -// ---------------------------------------+--------------------+--------------------+ -// Member functions default to: | PAGED code segment | .text code segment | -// ---------------------------------------+--------------------+--------------------+ -// Compiler-generated code goes to: | PAGED code segment | .text code segment | -// ---------------------------------------+--------------------+--------------------+ -// The memory is allocated from pool: | paged or nonpaged | paged or nonpaged | -// ---------------------------------------+--------------------+--------------------+ -// - -PAGED void *operator new(size_t s, std::nothrow_t const &, ULONG tag); -PAGED void operator delete(void *p, ULONG tag); -PAGED void *operator new[](size_t s, std::nothrow_t const &, ULONG tag); -PAGED void operator delete[](void *p, ULONG tag); -PAGEDX void __cdecl operator delete[](void *p); -void __cdecl operator delete(void *p); - -template <ULONG TAG, ULONG ARENA = PagedPool> -struct KRTL_CLASS KALLOCATION_TAG -{ - static const ULONG AllocationTag = TAG; - static const ULONG AllocationArena = ARENA; -}; - -template <ULONG TAG, ULONG ARENA = NonPagedPoolNx> -struct KRTL_CLASS_DPC_ALLOC KALLOCATION_TAG_DPC_ALLOC -{ - static const ULONG AllocationTag = TAG; - static const ULONG AllocationArena = ARENA; -}; - -template <ULONG TAG, ULONG ARENA = PagedPool> -struct KRTL_CLASS KALLOCATOR : public KALLOCATION_TAG<TAG, ARENA> -{ - // Scalar new & delete - - PAGED void *operator new(size_t cb, std::nothrow_t const &) - { - PAGED_CODE(); - #pragma warning( suppress : 4996 28751 ) - return ExAllocatePoolWithTag(static_cast<POOL_TYPE>(ARENA), cb, TAG); - } - - PAGED void operator delete(void *p) - { - PAGED_CODE(); - - if (p != nullptr) - { - ExFreePoolWithTag(p, TAG); - } - } - - // Scalar new with bonus bytes - - PAGED void *operator new(size_t cb, std::nothrow_t const &, size_t extraBytes) - { - PAGED_CODE(); - - auto size = cb + extraBytes; - - // Overflow check - if (size < cb) - return nullptr; - - #pragma warning( suppress : 4996 28751 ) - return ExAllocatePoolWithTag(static_cast<POOL_TYPE>(ARENA), size, TAG); - } - - // Array new & delete - - PAGED void *operator new[](size_t cb, std::nothrow_t const &) - { - PAGED_CODE(); - #pragma warning( suppress : 4996 28751 ) - return ExAllocatePoolWithTag(static_cast<POOL_TYPE>(ARENA), cb, TAG); - } - - PAGED void operator delete[](void *p) - { - PAGED_CODE(); - - if (p != nullptr) - { - ExFreePoolWithTag(p, TAG); - } - } - - // Placement new & delete - - PAGED void *operator new(size_t n, void * p) - { - PAGED_CODE(); - UNREFERENCED_PARAMETER((n)); - return p; - } - - PAGED void operator delete(void *p1, void *p2) - { - PAGED_CODE(); - UNREFERENCED_PARAMETER((p1, p2)); - } -}; - -template <ULONG TAG, ULONG ARENA = NonPagedPoolNx> -struct KRTL_CLASS_DPC_ALLOC KALLOCATOR_NONPAGED : public KALLOCATION_TAG_DPC_ALLOC<TAG, ARENA> -{ - // Scalar new & delete - - NONPAGED void *operator new(size_t cb, std::nothrow_t const &) - { - #pragma warning( suppress : 4996 28751 ) - return ExAllocatePoolWithTag(static_cast<POOL_TYPE>(ARENA), cb, TAG); - } - - NONPAGED void operator delete(void *p) - { - if (p != nullptr) - { - ExFreePoolWithTag(p, TAG); - } - } - - // Scalar new with bonus bytes - - NONPAGED void *operator new(size_t cb, std::nothrow_t const &, size_t extraBytes) - { - auto size = cb + extraBytes; - - // Overflow check - if (size < cb) - return nullptr; - - #pragma warning( suppress : 4996 28751 ) - return ExAllocatePoolWithTag(static_cast<POOL_TYPE>(ARENA), size, TAG); - } - - // Array new & delete - - NONPAGED void *operator new[](size_t cb, std::nothrow_t const &) - { - #pragma warning( suppress : 4996 28751 ) - return ExAllocatePoolWithTag(static_cast<POOL_TYPE>(ARENA), cb, TAG); - } - - NONPAGED void operator delete[](void *p) - { - if (p != nullptr) - { - ExFreePoolWithTag(p, TAG); - } - } - - // Placement new & delete - - NONPAGED void *operator new(size_t n, void * p) - { - UNREFERENCED_PARAMETER((n)); - return p; - } - - NONPAGED void operator delete(void *p1, void *p2) - { - UNREFERENCED_PARAMETER((p1, p2)); - } -}; - -template <ULONG TAG> -struct KRTL_CLASS PAGED_OBJECT : - public KALLOCATOR<TAG, PagedPool>, - public NdisDebugBlock<TAG> -{ - -}; - -template <ULONG TAG> -struct KRTL_CLASS NONPAGED_OBJECT : - public KALLOCATOR<TAG, NonPagedPoolNx>, - public NdisDebugBlock<TAG> -{ - -}; - diff --git a/network/netadaptercx/netvadapterlibrary/code/rtl/UmPool.h b/network/netadaptercx/netvadapterlibrary/code/rtl/UmPool.h deleted file mode 100644 index 45491006..00000000 --- a/network/netadaptercx/netvadapterlibrary/code/rtl/UmPool.h +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) Microsoft Corporation. All rights reserved. - -#pragma once - -#if UMDF_DRIVER == 0 -#include "pooltypes.h" -#endif - -#ifndef _KERNEL_MODE - -#if (NTDDI_VERSION >= NTDDI_WIN10_VB) && !defined(KRTL_USE_LEGACY_POOL_API) - -typedef _Enum_is_bitflag_ enum _EX_POOL_PRIORITY { - LowPoolPriority, - LowPoolPrioritySpecialPoolOverrun = 8, - LowPoolPrioritySpecialPoolUnderrun = 9, - NormalPoolPriority = 16, - NormalPoolPrioritySpecialPoolOverrun = 24, - NormalPoolPrioritySpecialPoolUnderrun = 25, - HighPoolPriority = 32, - HighPoolPrioritySpecialPoolOverrun = 40, - HighPoolPrioritySpecialPoolUnderrun = 41 -} EX_POOL_PRIORITY; - -typedef enum POOL_EXTENDED_PARAMETER_TYPE { - PoolExtendedParameterInvalidType = 0, - PoolExtendedParameterPriority, - PoolExtendedParameterMax -} POOL_EXTENDED_PARAMETER_TYPE, *PPOOL_EXTENDED_PARAMETER_TYPE; - -#define POOL_EXTENDED_PARAMETER_TYPE_BITS 8 -#define POOL_EXTENDED_PARAMETER_REQUIRED_FIELD_BITS 1 -#define POOL_EXTENDED_PARAMETER_RESERVED_BITS (64 - POOL_EXTENDED_PARAMETER_TYPE_BITS - POOL_EXTENDED_PARAMETER_REQUIRED_FIELD_BITS) - -#pragma warning(push) -#pragma warning(disable: 4201) // nameless struct/union -typedef struct DECLSPEC_ALIGN(8) POOL_EXTENDED_PARAMETER { - struct { - ULONG64 Type : POOL_EXTENDED_PARAMETER_TYPE_BITS; - ULONG64 Optional : POOL_EXTENDED_PARAMETER_REQUIRED_FIELD_BITS; - ULONG64 Reserved : POOL_EXTENDED_PARAMETER_RESERVED_BITS; - } DUMMYSTRUCTNAME; - - union { - ULONG64 Reserved2; - PVOID Reserved3; - EX_POOL_PRIORITY Priority; - } DUMMYUNIONNAME; -} POOL_EXTENDED_PARAMETER, *PPOOL_EXTENDED_PARAMETER; -#pragma warning(pop) - -typedef ULONG64 POOL_FLAGS; - -_Check_return_ -_Ret_maybenull_ -_Post_writable_byte_size_(NumberOfBytes) -PVOID -ExAllocatePool2 ( - _In_ POOL_FLAGS Flags, - _In_ SIZE_T NumberOfBytes, - _In_ ULONG Tag - ); - -_Check_return_ -_Ret_maybenull_ -_Post_writable_byte_size_(NumberOfBytes) -PVOID -ExAllocatePool3 ( - _In_ POOL_FLAGS Flags, - _In_ SIZE_T NumberOfBytes, - _In_ ULONG Tag, - _In_reads_opt_(ExtendedParameterCount) PPOOL_EXTENDED_PARAMETER ExtendedParameters, - _In_ ULONG ExtendedParametersCount - ); - -#endif // (NTDDI_VERSION >= NTDDI_WIN10_VB) && !defined(KRTL_USE_LEGACY_POOL_API) - -PVOID -ExAllocatePoolWithTag( - POOL_TYPE PoolType, - SIZE_T NumberOfBytes, - ULONG Tag - ); - -VOID -ExFreePoolWithTag( - _Pre_notnull_ __drv_freesMem(Mem) PVOID P, - _In_ ULONG Tag - ); - -VOID -ExFreePool( - _Pre_notnull_ __drv_freesMem(Mem) PVOID P - ); - -#endif // _KERNEL_MODE - diff --git a/network/netadaptercx/netvadapterlibrary/code/rtl/pooltypes.h b/network/netadaptercx/netvadapterlibrary/code/rtl/pooltypes.h deleted file mode 100644 index 8bee9a72..00000000 --- a/network/netadaptercx/netvadapterlibrary/code/rtl/pooltypes.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) Microsoft Corporation. All rights reserved. - -#pragma once - -#ifndef _KERNEL_MODE - -#include <sal.h> - -// -// Pool Allocation routines (in pool.c) -// -typedef _Enum_is_bitflag_ enum _POOL_TYPE { - NonPagedPool, - NonPagedPoolExecute = NonPagedPool, - PagedPool, - NonPagedPoolMustSucceed = NonPagedPool + 2, - DontUseThisType, - NonPagedPoolCacheAligned = NonPagedPool + 4, - PagedPoolCacheAligned, - NonPagedPoolCacheAlignedMustS = NonPagedPool + 6, - MaxPoolType, - - // - // Define base types for NonPaged (versus Paged) pool, for use in cracking - // the underlying pool type. - // - - NonPagedPoolBase = 0, - NonPagedPoolBaseMustSucceed = NonPagedPoolBase + 2, - NonPagedPoolBaseCacheAligned = NonPagedPoolBase + 4, - NonPagedPoolBaseCacheAlignedMustS = NonPagedPoolBase + 6, - - // - // Note these per session types are carefully chosen so that the appropriate - // masking still applies as well as MaxPoolType above. - // - - NonPagedPoolSession = 32, - PagedPoolSession = NonPagedPoolSession + 1, - NonPagedPoolMustSucceedSession = PagedPoolSession + 1, - DontUseThisTypeSession = NonPagedPoolMustSucceedSession + 1, - NonPagedPoolCacheAlignedSession = DontUseThisTypeSession + 1, - PagedPoolCacheAlignedSession = NonPagedPoolCacheAlignedSession + 1, - NonPagedPoolCacheAlignedMustSSession = PagedPoolCacheAlignedSession + 1, - - NonPagedPoolNx = 512, - NonPagedPoolNxCacheAligned = NonPagedPoolNx + 4, - NonPagedPoolSessionNx = NonPagedPoolNx + 32, - -} POOL_TYPE; - -#endif // _KERNEL_MODE - diff --git a/network/netadaptercx/netvadapterlibrary/code/rxqueue.cpp b/network/netadaptercx/netvadapterlibrary/code/rxqueue.cpp index 61c12ca3..d0b87f9e 100644 --- a/network/netadaptercx/netvadapterlibrary/code/rxqueue.cpp +++ b/network/netadaptercx/netvadapterlibrary/code/rxqueue.cpp @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved #include "pch.hpp" -#include "adapter.h" +#include "netvadapter.h" #include "rxqueue.h" #include "memory.h" @@ -68,7 +68,7 @@ NetvRxQueue::NetvRxQueue( NetExtensionTypePacket); NetRxQueueGetExtension(m_handle, &extension, &RxXSumExtension); - +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) if (Adapter.PreallocatedRxBuffers) { NET_EXTENSION_QUERY_INIT( @@ -87,7 +87,7 @@ NetvRxQueue::NetvRxQueue( NetRxQueueGetExtension(m_handle, &extension, &NetMemoryReturnContextExtensionIn); } - +#endif //NETCX 2.6 only EnlQueueHandle = EnlCreateQueue(Handle, RX); } @@ -150,7 +150,7 @@ NetvRxQueue::Advance( break; } } - +#if ((NETADAPTER_VERSION_MAJOR == 2) && (NETADAPTER_VERSION_MINOR >= 6)) if (m_adapter.PreallocatedRxBuffers) { NET_RING* dataBufferRing = GetNetMemoryReturnRing(); @@ -166,7 +166,7 @@ NetvRxQueue::Advance( dataBufferRing->BeginIndex = NetRingIncrementIndex(dataBufferRing, dataBufferRing->BeginIndex); } } - +#endif //NETCX 2.6 only NetFragmentIteratorSet(&fi); NetPacketIteratorSet(&pi); EnlRingDoorBell(EnlQueueHandle, fr->EndIndex); diff --git a/network/netadaptercx/netvadapterlibrary/code/txqueue.cpp b/network/netadaptercx/netvadapterlibrary/code/txqueue.cpp index 56424523..b67692b5 100644 --- a/network/netadaptercx/netvadapterlibrary/code/txqueue.cpp +++ b/network/netadaptercx/netvadapterlibrary/code/txqueue.cpp @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved #include "pch.hpp" -#include "adapter.h" +#include "netvadapter.h" #include "txqueue.h" NetvTxQueue::NetvTxQueue( diff --git a/network/netadaptercx/netvadapterlibrary/km/netvadapterlibrarykm.vcxproj b/network/netadaptercx/netvadapterlibrary/km/netvadapterlibrarykm.vcxproj index 5e0be8e5..e1d68f5c 100644 --- a/network/netadaptercx/netvadapterlibrary/km/netvadapterlibrarykm.vcxproj +++ b/network/netadaptercx/netvadapterlibrary/km/netvadapterlibrarykm.vcxproj @@ -38,7 +38,7 @@ <KMDF_VERSION_MINOR>33</KMDF_VERSION_MINOR> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>6</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -51,7 +51,7 @@ <KMDF_VERSION_MINOR>33</KMDF_VERSION_MINOR> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>6</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -64,7 +64,7 @@ <KMDF_VERSION_MINOR>33</KMDF_VERSION_MINOR> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>6</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -77,7 +77,7 @@ <KMDF_VERSION_MINOR>33</KMDF_VERSION_MINOR> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>6</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -89,19 +89,19 @@ <PropertyGroup /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <IncludePath>$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> + <IncludePath>$(MSBuildProjectDirectory)\..\Interface;$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <IncludePath>$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> + <IncludePath>$(MSBuildProjectDirectory)\..\Interface;$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <IncludePath>$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> + <IncludePath>$(MSBuildProjectDirectory)\..\Interface;$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <IncludePath>$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> + <IncludePath>$(MSBuildProjectDirectory)\..\Interface;$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <DriverSign> @@ -159,7 +159,6 @@ <FilesToPackage Include="$(TargetPath)" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\code\adapter.h" /> <ClInclude Include="..\code\configuration.h" /> <ClInclude Include="..\code\enl.h" /> <ClInclude Include="..\code\enlthreads.h" /> @@ -169,6 +168,8 @@ <ClInclude Include="..\code\rxqueue.h" /> <ClInclude Include="..\code\trace.h" /> <ClInclude Include="..\code\txqueue.h" /> + <ClInclude Include="..\Interface\netvadapter.h" /> + <ClInclude Include="..\netvInterface.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\code\adapter.cpp" /> diff --git a/network/netadaptercx/netvadapterlibrary/um/netvadapterlibraryum.vcxproj b/network/netadaptercx/netvadapterlibrary/um/netvadapterlibraryum.vcxproj index 99a6e5e9..ce418965 100644 --- a/network/netadaptercx/netvadapterlibrary/um/netvadapterlibraryum.vcxproj +++ b/network/netadaptercx/netvadapterlibrary/um/netvadapterlibraryum.vcxproj @@ -36,10 +36,10 @@ <DriverType>KMDF</DriverType> <DriverTargetPlatform>Universal</DriverTargetPlatform> <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR> - <UMDF_VERSION_MINOR>33</UMDF_VERSION_MINOR> + <UMDF_VERSION_MINOR>35</UMDF_VERSION_MINOR> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>6</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -49,10 +49,10 @@ <DriverType>KMDF</DriverType> <DriverTargetPlatform>Universal</DriverTargetPlatform> <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR> - <UMDF_VERSION_MINOR>33</UMDF_VERSION_MINOR> + <UMDF_VERSION_MINOR>35</UMDF_VERSION_MINOR> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>6</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -62,10 +62,10 @@ <DriverType>KMDF</DriverType> <DriverTargetPlatform>Universal</DriverTargetPlatform> <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR> - <UMDF_VERSION_MINOR>33</UMDF_VERSION_MINOR> + <UMDF_VERSION_MINOR>35</UMDF_VERSION_MINOR> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>6</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -75,10 +75,10 @@ <DriverType>KMDF</DriverType> <DriverTargetPlatform>Universal</DriverTargetPlatform> <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR> - <UMDF_VERSION_MINOR>33</UMDF_VERSION_MINOR> + <UMDF_VERSION_MINOR>35</UMDF_VERSION_MINOR> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>6</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -90,19 +90,19 @@ <PropertyGroup /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <IncludePath>$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> + <IncludePath>$(MSBuildProjectDirectory)\..\Interface;$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <IncludePath>$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> + <IncludePath>$(MSBuildProjectDirectory)\..\Interface;$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <IncludePath>$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> + <IncludePath>$(MSBuildProjectDirectory)\..\Interface;$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <IncludePath>$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> + <IncludePath>$(MSBuildProjectDirectory)\..\Interface;$(MSBuildProjectDirectory)\..\code\rtl;$(IncludePath)</IncludePath> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <DriverSign> @@ -160,7 +160,6 @@ <FilesToPackage Include="$(TargetPath)" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\code\adapter.h" /> <ClInclude Include="..\code\configuration.h" /> <ClInclude Include="..\code\enl.h" /> <ClInclude Include="..\code\enlthreads.h" /> @@ -170,6 +169,7 @@ <ClInclude Include="..\code\rxqueue.h" /> <ClInclude Include="..\code\trace.h" /> <ClInclude Include="..\code\txqueue.h" /> + <ClInclude Include="..\Interface\netvadapter.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\code\adapter.cpp" /> diff --git a/network/wlan/WIFICX/drivercode/adapter.cpp b/network/wlan/WIFICX/drivercode/adapter.cpp index 958f69ea..b2f736b9 100644 --- a/network/wlan/WIFICX/drivercode/adapter.cpp +++ b/network/wlan/WIFICX/drivercode/adapter.cpp @@ -6,45 +6,93 @@ #include "adapter.h" #include "adapter.tmh" -_Use_decl_annotations_ -NTSTATUS WifiIhvInitAdapterContext(_In_ WDFDEVICE Device, _In_ NETADAPTER NetAdapter) +extern UCHAR NetvMacAddressBase[MAC_ADDR_LEN]; + +NetvAdapter* NetvAdapterGetContextFromWDFObject(NETADAPTER netAdapter) +{ + WifiNetvAdapter* wifiNetvAdapter = WifiNetvAdapterGetContext(netAdapter); + NetvAdapter* netvAdapter{ wifiNetvAdapter }; + return netvAdapter; +} + +WifiNetvAdapter::WifiNetvAdapter(NETADAPTER Handle, WDFDEVICE Device) : NetvAdapter(Handle, Device) +{ +} + +NTSTATUS WifiNetvAdapter::Initialize() +{ + if (WifiGetIhvDeviceContext(m_device)->netAdapters[WifiAdapterGetPortId(m_handle)] != WDF_NO_HANDLE) + { + return STATUS_SUCCESS; + } + return NetvAdapter::Initialize(); +} + +// the Xfilter.h should be included in the share(currently in km only) +#ifndef _KERNEL_MODE +// +// This macro is used to copy from one network address to +// another. +// +#define ETH_COPY_NETWORK_ADDRESS(_D, _S) \ +{ \ + *((ULONG UNALIGNED *)(_D)) = *((ULONG UNALIGNED *)(_S)); \ + *((USHORT UNALIGNED *)((UCHAR *)(_D)+4)) = *((USHORT UNALIGNED *)((UCHAR *)(_S)+4)); \ +} +// +// ZZZ This is a little-endian specific check. +// +#define ETH_IS_MULTICAST(Address) \ + (BOOLEAN)(((PUCHAR)(Address))[0] & ((UCHAR)0x01)) + +// +// Check whether an address is broadcast. +// +#define ETH_IS_BROADCAST(Address) \ + ((((PUCHAR)(Address))[0] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[1] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[2] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[3] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[4] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[5] == ((UCHAR)0xff))) + +#endif // _KERNEL_MODE + +NTSTATUS WifiNetvAdapter::NetvAdapterReadAddress() { - PWIFI_IHV_DEVICE_CONTEXT deviceContext = WifiGetIhvDeviceContext(Device); - PWIFI_IHV_NETADAPTER_CONTEXT netAdapterContext = WifiGetIhvNetAdapterContext(NetAdapter); + UCHAR MACLastByteFinial = (UCHAR)MACLastByte; + if (MACLastByteFinial == 0) + { + MACLastByteFinial++; + } - if (deviceContext->primaryStaAdapter == WDF_NO_HANDLE) + PermanentAddress.Length = MAC_ADDR_LEN; + + ETH_COPY_NETWORK_ADDRESS(PermanentAddress.Address, NetvMacAddressBase); + PermanentAddress.Address[MAC_ADDR_LEN - 1] = MACLastByteFinial; + if (ETH_IS_MULTICAST(PermanentAddress.Address) || ETH_IS_BROADCAST(PermanentAddress.Address)) { - deviceContext->primaryStaAdapter = NetAdapter; + WFCError("%!FUNC!: Failed with %!STATUS!", STATUS_INVALID_ADDRESS); + return STATUS_INVALID_ADDRESS; } - netAdapterContext->WifiDeviceContext = deviceContext; + RtlCopyMemory(&CurrentAddress, &PermanentAddress, sizeof(PermanentAddress)); + + EnlIndex = (MACLastByteFinial - 1) >> 1; + EnlPortIndex = (MACLastByteFinial - 1) & 1; + EnlIndexValid = TRUE; return STATUS_SUCCESS; } -_Use_decl_annotations_ -NTSTATUS WifiIhvAdapterStart(NETADAPTER netAdapter) +NTSTATUS WifiNetvAdapter::AdapterStart() { TraceEntry(); - static WDI_MAC_ADDRESS STAAddress = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05}; - NET_ADAPTER_LINK_LAYER_ADDRESS permanentLinkLayerAddress; - NET_ADAPTER_LINK_LAYER_ADDRESS_INIT(&permanentLinkLayerAddress, sizeof(WDI_MAC_ADDRESS), STAAddress.Address); - NetAdapterSetCurrentLinkLayerAddress(netAdapter, &permanentLinkLayerAddress); - NetAdapterSetPermanentLinkLayerAddress(netAdapter, &permanentLinkLayerAddress); - - // Sample Phase 1 has no datapath support, so setting those values to the default one. - NET_ADAPTER_TX_CAPABILITIES txCaps; - NET_ADAPTER_RX_CAPABILITIES rxCaps; - NET_ADAPTER_LINK_LAYER_CAPABILITIES linkLayerCaps; + NTSTATUS status = STATUS_SUCCESS; + + NET_ADAPTER_WAKE_MEDIA_CHANGE_CAPABILITIES wakeMediaChangeCapabilities; + NET_ADAPTER_WAKE_MEDIA_CHANGE_CAPABILITIES_INIT(&wakeMediaChangeCapabilities); - NET_ADAPTER_TX_CAPABILITIES_INIT(&txCaps, 1); - NET_ADAPTER_RX_CAPABILITIES_INIT_SYSTEM_MANAGED(&rxCaps, 1514, 1); - NET_ADAPTER_LINK_LAYER_CAPABILITIES_INIT(&linkLayerCaps, 0, 0); + wakeMediaChangeCapabilities.MediaConnect = TRUE; + wakeMediaChangeCapabilities.MediaDisconnect = TRUE; - NetAdapterSetLinkLayerMtuSize(netAdapter, 1500); - NetAdapterSetLinkLayerCapabilities(netAdapter, &linkLayerCaps); - NetAdapterSetDataPathCapabilities(netAdapter, &txCaps, &rxCaps); + NetAdapterWakeSetMediaChangeCapabilities(m_handle, &wakeMediaChangeCapabilities); WIFI_ADAPTER_WAKE_CAPABILITIES wakeCap{}; WIFI_ADAPTER_WAKE_CAPABILITIES_INIT(&wakeCap); @@ -52,12 +100,39 @@ NTSTATUS WifiIhvAdapterStart(NETADAPTER netAdapter) { wakeCap.ClientDriverDiagnostic = true; } - WifiAdapterSetWakeCapabilities(netAdapter, &wakeCap); + WifiAdapterSetWakeCapabilities(m_handle, &wakeCap); - NTSTATUS status = NetAdapterStart(netAdapter); - ASSERT(STATUS_SUCCESS == status); + status = NetvAdapter::ConfigureDataCapabilities(); + if (!NT_SUCCESS(status)) + { + WFCError("%!FUNC!: NetvAdapter::ConfigureDataCapabilities failed with %!STATUS!", status); + return status; + } + + status = NetAdapterStart(m_handle); + if (!NT_SUCCESS(status)) + { + WFCError("%!FUNC!: NetAdapterStart failed with %!STATUS!", status); + return status; + } + ASSERT(STATUS_SUCCESS == status); TraceExit(status); return status; } + +NTSTATUS WifiNetvAdapter::CreateRxQueue(NETRXQUEUE_INIT* NetRxQueueInit) +{ + return NetvAdapter::CreateRxQueue(NetRxQueueInit); +} + +NTSTATUS WifiNetvAdapter::CreateTxQueue(NETTXQUEUE_INIT* NetTxQueueInit) +{ + return NetvAdapter::CreateTxQueue(NetTxQueueInit); +} + +void WifiNetvAdapter::Destroy(void) +{ + return NetvAdapter::Destroy(); +}
\ No newline at end of file diff --git a/network/wlan/WIFICX/drivercode/adapter.h b/network/wlan/WIFICX/drivercode/adapter.h index eb39dee1..ecc597e8 100644 --- a/network/wlan/WIFICX/drivercode/adapter.h +++ b/network/wlan/WIFICX/drivercode/adapter.h @@ -2,6 +2,7 @@ #pragma once #include "device.h" +#include "netvadapter.h" // packet and header sizes #define WIFI_MAX_PACKET_SIZE (1514) @@ -9,9 +10,6 @@ // maximum link speed for send and recv in bps #define WIFI_MEDIA_MAX_SPEED 1'000'000'000 -NTSTATUS WifiIhvInitAdapterContext(_In_ WDFDEVICE Device, _In_ NETADAPTER NetAdapter); -NTSTATUS WifiIhvAdapterStart(_In_ NETADAPTER netAdapter); - // Context for each "Wdi Port"[NetAdapter] instance. // Each NetAdapter instance corresponds to an IP interface typedef struct _WIFI_IHV_NETADAPTER_CONTEXT @@ -21,3 +19,31 @@ typedef struct _WIFI_IHV_NETADAPTER_CONTEXT } WIFI_IHV_NETADAPTER_CONTEXT, * PWIFI_IHV_NETADAPTER_CONTEXT; WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(WIFI_IHV_NETADAPTER_CONTEXT, WifiGetIhvNetAdapterContext); + +class WifiNetvAdapter : public NetvAdapter +{ +public: + WifiNetvAdapter(NETADAPTER Handle, WDFDEVICE Device); + + NTSTATUS + Initialize(); + + NTSTATUS + AdapterStart(); + + NTSTATUS + CreateRxQueue(NETRXQUEUE_INIT* NetRxQueueInit); + + NTSTATUS + CreateTxQueue(NETTXQUEUE_INIT* NetTxQueueInit); + + void Destroy(void); + + bool CanReportWifiWakeSourceTypeClientDriverDiagnostic; + +private: + NTSTATUS + NetvAdapterReadAddress() override; +}; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(WifiNetvAdapter, WifiNetvAdapterGetContext);
\ No newline at end of file diff --git a/network/wlan/WIFICX/drivercode/device.cpp b/network/wlan/WIFICX/drivercode/device.cpp index 0fc17ea4..9404b161 100644 --- a/network/wlan/WIFICX/drivercode/device.cpp +++ b/network/wlan/WIFICX/drivercode/device.cpp @@ -33,33 +33,67 @@ NTSTATUS EvtDeviceReleaseHardware(WDFDEVICE device, WDFCMRESLIST resourcesTransl _Use_decl_annotations_ NTSTATUS EvtWifiDeviceCreateAdapter(WDFDEVICE Device, NETADAPTER_INIT* AdapterInit) { + if (WifiAdapterInitGetType(AdapterInit) != WIFI_ADAPTER_EXTENSIBLE_STATION) + { + WFCError("%!FUNC!: Unsupported adapter type = 0x%x != 0x%x", WifiAdapterInitGetType(AdapterInit), WIFI_ADAPTER_EXTENSIBLE_STATION); + return STATUS_NOT_SUPPORTED; + } - //NET_ADAPTER_DATAPATH_CALLBACKS datapathCallbacks; - //NET_ADAPTER_DATAPATH_CALLBACKS_INIT(&datapathCallbacks, EvtAdapterCreateTxQueue, EvtAdapterCreateRxQueue); + NET_ADAPTER_DATAPATH_CALLBACKS datapathCallbacks; + NET_ADAPTER_DATAPATH_CALLBACKS_INIT(&datapathCallbacks, EvtAdapterCreateTxQueue, EvtAdapterCreateRxQueue); - //NetAdapterInitSetDatapathCallbacks(AdapterInit, &datapathCallbacks); + NetAdapterInitSetDatapathCallbacks(AdapterInit, &datapathCallbacks); WDF_OBJECT_ATTRIBUTES adapterAttributes; WDF_OBJECT_ATTRIBUTES_INIT(&adapterAttributes); - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&adapterAttributes, WIFI_IHV_NETADAPTER_CONTEXT); + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&adapterAttributes, WifiNetvAdapter); adapterAttributes.EvtCleanupCallback = EvtAdapterCleanup; - NETADAPTER netAdapter{}; - WX_RETURN_NTSTATUS_IF_NOT_NT_SUCCESS_MSG( - NetAdapterCreate(AdapterInit, &adapterAttributes, &netAdapter), "Failed to create NetAdapter"); + NETADAPTER netAdapter; + NTSTATUS ntStatus = NetAdapterCreate(AdapterInit, &adapterAttributes, &netAdapter); + if (!NT_SUCCESS(ntStatus)) + { + WFCError("%!FUNC!: NetAdapterCreate failed, status=0x%x", ntStatus); + return ntStatus; + } - WX_RETURN_NTSTATUS_IF_NOT_NT_SUCCESS_MSG( - WifiAdapterInitialize(netAdapter), "Failed to initialize WifiAdapter"); + ntStatus = WifiAdapterInitialize(netAdapter); + ASSERT(NT_SUCCESS(ntStatus)); + if (!NT_SUCCESS(ntStatus)) + { + WFCError("%!FUNC!: WifiAdapterInitialize failed with %!STATUS!", ntStatus); + return ntStatus; + } + auto wifiNetvAdapter = new (reinterpret_cast<void*>(WifiNetvAdapterGetContext(netAdapter))) WifiNetvAdapter(netAdapter, Device); + ntStatus = wifiNetvAdapter->Initialize(); + if (!NT_SUCCESS(ntStatus)) + { + WFCError("%!FUNC!: WifiNetvAdapter::Initialize failed with %!STATUS!", ntStatus); + return ntStatus; + } - WX_RETURN_NTSTATUS_IF_NOT_NT_SUCCESS_MSG( - WifiIhvInitAdapterContext(Device, netAdapter), "Failed to initialize WifiAdapterContext"); - - WX_RETURN_NTSTATUS_IF_NOT_NT_SUCCESS_MSG( - WifiIhvAdapterStart(netAdapter), "Failed to start WifiIhvAdapter"); + ntStatus = wifiNetvAdapter->AdapterStart(); + ASSERT(NT_SUCCESS(ntStatus)); + if (!NT_SUCCESS(ntStatus)) + { + WFCError("%!FUNC!: WifiNetvAdapter::AdapterStart failed with %!STATUS!", ntStatus); + return ntStatus; + } - return STATUS_SUCCESS; + WFCInfo("%!FUNC!: Success!"); + return ntStatus; +} + +_Use_decl_annotations_ +void EvtAdapterCleanup(_In_ WDFOBJECT NetAdapter) +{ + TraceEntry(); + auto wifiNetvAdapter = WifiNetvAdapterGetContext(NetAdapter); + wifiNetvAdapter->Destroy(); + TraceExit(STATUS_SUCCESS); } + _Use_decl_annotations_ NTSTATUS EvtWifiDeviceCreateWifiDirectDevice(WDFDEVICE, WIFIDIRECT_DEVICE_INIT*) { @@ -69,10 +103,19 @@ NTSTATUS EvtWifiDeviceCreateWifiDirectDevice(WDFDEVICE, WIFIDIRECT_DEVICE_INIT*) return status; } + _Use_decl_annotations_ -void EvtAdapterCleanup(_In_ WDFOBJECT NetAdapter) +NTSTATUS +EvtAdapterCreateTxQueue(NETADAPTER Adapter, NETTXQUEUE_INIT* Init) { - UNREFERENCED_PARAMETER(NetAdapter); TraceEntry(); - TraceExit(STATUS_SUCCESS); -}
\ No newline at end of file + return WifiNetvAdapterGetContext(Adapter)->CreateTxQueue(Init); +} + +_Use_decl_annotations_ +NTSTATUS +EvtAdapterCreateRxQueue(NETADAPTER Adapter, NETRXQUEUE_INIT* Init) +{ + TraceEntry(); + return WifiNetvAdapterGetContext(Adapter)->CreateRxQueue(Init); +} diff --git a/network/wlan/WIFICX/drivercode/device.h b/network/wlan/WIFICX/drivercode/device.h index bf70ba7b..c0dfac3c 100644 --- a/network/wlan/WIFICX/drivercode/device.h +++ b/network/wlan/WIFICX/drivercode/device.h @@ -9,6 +9,9 @@ EVT_WIFI_DEVICE_CREATE_WIFIDIRECTDEVICE EvtWifiDeviceCreateWifiDirectDevice; EVT_WIFI_DEVICE_SEND_COMMAND EvtWifiDeviceSendCommand; EVT_WDF_OBJECT_CONTEXT_CLEANUP EvtAdapterCleanup; +EVT_NET_ADAPTER_CREATE_TXQUEUE EvtAdapterCreateTxQueue; +EVT_NET_ADAPTER_CREATE_RXQUEUE EvtAdapterCreateRxQueue; + typedef struct _WIFI_IHV_DEVICE_CONTEXT { // @@ -19,7 +22,7 @@ typedef struct _WIFI_IHV_DEVICE_CONTEXT void* WdfTriageInfoPtr; WDFDEVICE WdfDevice; TLV_CONTEXT TlvContext; - NETADAPTER primaryStaAdapter; + NETADAPTER netAdapters[5]{}; } WIFI_IHV_DEVICE_CONTEXT, * PWIFI_IHV_DEVICE_CONTEXT; WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(WIFI_IHV_DEVICE_CONTEXT, WifiGetIhvDeviceContext); diff --git a/network/wlan/WIFICX/drivercode/memorymanagement.cpp b/network/wlan/WIFICX/drivercode/memorymanagement.cpp index de231d8c..088bad88 100644 --- a/network/wlan/WIFICX/drivercode/memorymanagement.cpp +++ b/network/wlan/WIFICX/drivercode/memorymanagement.cpp @@ -114,12 +114,12 @@ _Ret_writes_bytes_maybenull_(_Size) void* PlacementNewHelper(size_t _Size, PCPLA return nullptr; } -void* __cdecl operator new(size_t Size) +void* __cdecl operator new(size_t Size) noexcept { return AllocateWdfMemoryBuffer(Size, _ReturnAddress()); } -__forceinline void* __cdecl operator new(size_t _Size, ULONG_PTR AllocationContext) throw() +__forceinline void* __cdecl operator new(size_t _Size, ULONG_PTR AllocationContext) noexcept // for WIFICX TLV { if (AllocationContext != 0) { @@ -128,22 +128,22 @@ __forceinline void* __cdecl operator new(size_t _Size, ULONG_PTR AllocationConte return AllocateWdfMemoryBuffer(_Size, _ReturnAddress()); } -void __cdecl operator delete(void* pData) +void __cdecl operator delete(void* pData) noexcept { FreeWdfMemoryBuffer(pData); } -void __cdecl operator delete[](void* pData) +void __cdecl operator delete[](void* pData) noexcept { FreeWdfMemoryBuffer(pData); } -void __cdecl operator delete(void* pData, ULONG_PTR) +void __cdecl operator delete(void* pData, ULONG_PTR) noexcept // For WIFICX TLV { FreeWdfMemoryBuffer(pData); } -void __cdecl operator delete[](void* pData, ULONG_PTR) +void __cdecl operator delete[](void* pData, ULONG_PTR) noexcept // For WIFICX TLV { FreeWdfMemoryBuffer(pData); -} +}
\ No newline at end of file diff --git a/network/wlan/WIFICX/drivercode/precomp.h b/network/wlan/WIFICX/drivercode/precomp.h index f6bc3aad..1b0f808e 100644 --- a/network/wlan/WIFICX/drivercode/precomp.h +++ b/network/wlan/WIFICX/drivercode/precomp.h @@ -26,3 +26,8 @@ // WPP Tracing Headers #include "trace.h" + +// Minimal placement-new to match operator new(size_t, void*) +// TLV generator/parser memory interface has the ULONG_PTR version +inline void* operator new(size_t, void* p) noexcept { return p; } +inline void operator delete(void*, void*) noexcept { /* no-op */ } diff --git a/network/wlan/WIFICX/drivercode/wifihal.cpp b/network/wlan/WIFICX/drivercode/wifihal.cpp index 1a5914a6..5283474c 100644 --- a/network/wlan/WIFICX/drivercode/wifihal.cpp +++ b/network/wlan/WIFICX/drivercode/wifihal.cpp @@ -57,13 +57,13 @@ NTSTATUS WifiHAL::WifiIhvIsDeviceReadyForRequest() { NTSTATUS status = ((m_Device != WDF_NO_HANDLE) // Make sure device is initialized (since this is hardware abstraction layer, IHV can replace with firmware state) - && (WifiGetIhvDeviceContext(m_Device)->primaryStaAdapter != WDF_NO_HANDLE) ? STATUS_SUCCESS : STATUS_DEVICE_NOT_READY);// In WIFICX, the logic sits on top of primary STA adapter, make sure it is initialized + && (WifiGetIhvDeviceContext(m_Device)->netAdapters[0] != WDF_NO_HANDLE) ? STATUS_SUCCESS : STATUS_DEVICE_NOT_READY);// In WIFICX, the logic sits on top of primary STA adapter, make sure it is initialized if(NT_SUCCESS(status) == FALSE) { WFCError( "Device not ready for request. Device=%p, primaryStaAdapter=%p", m_Device, - (m_Device != WDF_NO_HANDLE) ? WifiGetIhvDeviceContext(m_Device)->primaryStaAdapter : WDF_NO_HANDLE); + (m_Device != WDF_NO_HANDLE) ? WifiGetIhvDeviceContext(m_Device)->netAdapters[0] : WDF_NO_HANDLE); } return status; } diff --git a/network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj b/network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj index 16842485..0bd8b963 100644 --- a/network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj +++ b/network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj @@ -40,7 +40,7 @@ <KMDF_MINIMUM_VERSION_REQUIRED>33</KMDF_MINIMUM_VERSION_REQUIRED> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>4</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> <NETADAPTER_MINIMUM_VERSION_REQUIRED>4</NETADAPTER_MINIMUM_VERSION_REQUIRED> <WifiDriver>true</WifiDriver> <WIFI_VERSION_MAJOR>1</WIFI_VERSION_MAJOR> @@ -59,7 +59,7 @@ <KMDF_MINIMUM_VERSION_REQUIRED>33</KMDF_MINIMUM_VERSION_REQUIRED> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>4</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> <NETADAPTER_MINIMUM_VERSION_REQUIRED>4</NETADAPTER_MINIMUM_VERSION_REQUIRED> <WifiDriver>true</WifiDriver> <WIFI_VERSION_MAJOR>1</WIFI_VERSION_MAJOR> @@ -78,7 +78,7 @@ <KMDF_MINIMUM_VERSION_REQUIRED>33</KMDF_MINIMUM_VERSION_REQUIRED> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>4</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> <NETADAPTER_MINIMUM_VERSION_REQUIRED>4</NETADAPTER_MINIMUM_VERSION_REQUIRED> <WifiDriver>true</WifiDriver> <WIFI_VERSION_MAJOR>1</WIFI_VERSION_MAJOR> @@ -97,7 +97,7 @@ <KMDF_MINIMUM_VERSION_REQUIRED>33</KMDF_MINIMUM_VERSION_REQUIRED> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>4</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> <NETADAPTER_MINIMUM_VERSION_REQUIRED>4</NETADAPTER_MINIMUM_VERSION_REQUIRED> <WifiDriver>true</WifiDriver> <WIFI_VERSION_MAJOR>1</WIFI_VERSION_MAJOR> @@ -138,10 +138,11 @@ </DriverSign> <ClCompile> <WppEnabled>true</WppEnabled> - <AdditionalIncludeDirectories>$(DDK_INC_PATH)wlan\2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\netadaptercx\netvadapterlibrary\Interface;$(DDK_INC_PATH)wlan\2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <WppRecorderEnabled>true</WppRecorderEnabled> <WppScanConfigurationData>..\drivercode\trace.h</WppScanConfigurationData> <WppMinimalRebuildFromTracking>false</WppMinimalRebuildFromTracking> + <PreprocessorDefinitions>_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <Link> <AdditionalDependencies>$(DDK_LIB_PATH)wlan\2.0\WificxTLVGenParse.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -155,11 +156,12 @@ <FileDigestAlgorithm>sha256</FileDigestAlgorithm> </DriverSign> <ClCompile> - <AdditionalIncludeDirectories>$(DDK_INC_PATH)wlan\2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\netadaptercx\netvadapterlibrary\Interface;$(DDK_INC_PATH)wlan\2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <WppEnabled>true</WppEnabled> <WppRecorderEnabled>true</WppRecorderEnabled> <WppScanConfigurationData>..\drivercode\trace.h</WppScanConfigurationData> <WppMinimalRebuildFromTracking>false</WppMinimalRebuildFromTracking> + <PreprocessorDefinitions>_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <Link> <AdditionalDependencies>$(DDK_LIB_PATH)wlan\2.0\WificxTLVGenParse.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -173,11 +175,12 @@ <FileDigestAlgorithm>sha256</FileDigestAlgorithm> </DriverSign> <ClCompile> - <AdditionalIncludeDirectories>$(DDK_INC_PATH)wlan\2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\netadaptercx\netvadapterlibrary\Interface;$(DDK_INC_PATH)wlan\2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <WppEnabled>true</WppEnabled> <WppRecorderEnabled>true</WppRecorderEnabled> <WppScanConfigurationData>..\drivercode\trace.h</WppScanConfigurationData> <WppMinimalRebuildFromTracking>false</WppMinimalRebuildFromTracking> + <PreprocessorDefinitions>_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <Link> <AdditionalDependencies>$(DDK_LIB_PATH)wlan\2.0\WificxTLVGenParse.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -191,11 +194,12 @@ <FileDigestAlgorithm>sha256</FileDigestAlgorithm> </DriverSign> <ClCompile> - <AdditionalIncludeDirectories>$(DDK_INC_PATH)wlan\2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\netadaptercx\netvadapterlibrary\Interface;$(DDK_INC_PATH)wlan\2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <WppEnabled>true</WppEnabled> <WppRecorderEnabled>true</WppRecorderEnabled> <WppScanConfigurationData>..\drivercode\trace.h</WppScanConfigurationData> <WppMinimalRebuildFromTracking>false</WppMinimalRebuildFromTracking> + <PreprocessorDefinitions>_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <Link> <AdditionalDependencies>$(DDK_LIB_PATH)wlan\2.0\WificxTLVGenParse.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -232,6 +236,11 @@ <ClInclude Include="..\drivercode\wifihal.h" /> <ClInclude Include="..\drivercode\wifitransition.h" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\netadaptercx\netvadapterlibrary\km\netvadapterlibrarykm.vcxproj"> + <Project>{e2a65efd-25cc-4af0-b180-0cd56ee277a9}</Project> + </ProjectReference> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/network/wlan/WIFICX/um/wificxsampleclientum.vcxproj b/network/wlan/WIFICX/um/wificxsampleclientum.vcxproj index 85e826d5..a0917a35 100644 --- a/network/wlan/WIFICX/um/wificxsampleclientum.vcxproj +++ b/network/wlan/WIFICX/um/wificxsampleclientum.vcxproj @@ -59,7 +59,7 @@ <UMDF_MINIMUM_VERSION_REQUIRED>35</UMDF_MINIMUM_VERSION_REQUIRED> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>4</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> <WifiDriver>true</WifiDriver> <WIFI_VERSION_MAJOR>1</WIFI_VERSION_MAJOR> <WIFI_VERSION_MINOR>2</WIFI_VERSION_MINOR> @@ -72,7 +72,7 @@ <UMDF_MINIMUM_VERSION_REQUIRED>35</UMDF_MINIMUM_VERSION_REQUIRED> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>4</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> <WifiDriver>true</WifiDriver> <WIFI_VERSION_MAJOR>1</WIFI_VERSION_MAJOR> <WIFI_VERSION_MINOR>2</WIFI_VERSION_MINOR> @@ -85,7 +85,7 @@ <UMDF_MINIMUM_VERSION_REQUIRED>35</UMDF_MINIMUM_VERSION_REQUIRED> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>4</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> <WifiDriver>true</WifiDriver> <WIFI_VERSION_MAJOR>1</WIFI_VERSION_MAJOR> <WIFI_VERSION_MINOR>2</WIFI_VERSION_MINOR> @@ -98,7 +98,7 @@ <UMDF_MINIMUM_VERSION_REQUIRED>35</UMDF_MINIMUM_VERSION_REQUIRED> <NetAdapterDriver>true</NetAdapterDriver> <NETADAPTER_VERSION_MAJOR>2</NETADAPTER_VERSION_MAJOR> - <NETADAPTER_VERSION_MINOR>4</NETADAPTER_VERSION_MINOR> + <NETADAPTER_VERSION_MINOR>5</NETADAPTER_VERSION_MINOR> <WifiDriver>true</WifiDriver> <WIFI_VERSION_MAJOR>1</WIFI_VERSION_MAJOR> <WIFI_VERSION_MINOR>2</WIFI_VERSION_MINOR> @@ -132,7 +132,7 @@ <FileDigestAlgorithm>sha256</FileDigestAlgorithm> </DriverSign> <ClCompile> - <AdditionalIncludeDirectories>$(WDK_UM_INC_PATH)wlan\2.0;$(KIT_SHARED_INC_PATH_WDK);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\netadaptercx\netvadapterlibrary\Interface;$(WDK_UM_INC_PATH)wlan\2.0;$(KIT_SHARED_INC_PATH_WDK);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIFICX_TEMPORARY_REMOVED_FOR_USERMODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WppEnabled>true</WppEnabled> <WppScanConfigurationData>..\drivercode\trace.h</WppScanConfigurationData> @@ -149,7 +149,7 @@ <FileDigestAlgorithm>sha256</FileDigestAlgorithm> </DriverSign> <ClCompile> - <AdditionalIncludeDirectories>$(WDK_UM_INC_PATH)wlan\2.0;$(KIT_SHARED_INC_PATH_WDK);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\netadaptercx\netvadapterlibrary\Interface;$(WDK_UM_INC_PATH)wlan\2.0;$(KIT_SHARED_INC_PATH_WDK);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIFICX_TEMPORARY_REMOVED_FOR_USERMODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WppEnabled>true</WppEnabled> <WppScanConfigurationData>..\drivercode\trace.h</WppScanConfigurationData> @@ -166,7 +166,7 @@ <FileDigestAlgorithm>sha256</FileDigestAlgorithm> </DriverSign> <ClCompile> - <AdditionalIncludeDirectories>$(WDK_UM_INC_PATH)wlan\2.0;$(KIT_SHARED_INC_PATH_WDK);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\netadaptercx\netvadapterlibrary\Interface;$(WDK_UM_INC_PATH)wlan\2.0;$(KIT_SHARED_INC_PATH_WDK);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIFICX_TEMPORARY_REMOVED_FOR_USERMODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WppEnabled>true</WppEnabled> <WppScanConfigurationData>..\drivercode\trace.h</WppScanConfigurationData> @@ -183,7 +183,7 @@ <FileDigestAlgorithm>sha256</FileDigestAlgorithm> </DriverSign> <ClCompile> - <AdditionalIncludeDirectories>$(WDK_UM_INC_PATH)wlan\2.0;$(KIT_SHARED_INC_PATH_WDK);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\netadaptercx\netvadapterlibrary\Interface;$(WDK_UM_INC_PATH)wlan\2.0;$(KIT_SHARED_INC_PATH_WDK);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIFICX_TEMPORARY_REMOVED_FOR_USERMODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <WppEnabled>true</WppEnabled> <WppScanConfigurationData>..\drivercode\trace.h</WppScanConfigurationData> @@ -220,6 +220,11 @@ <ClCompile Include="..\drivercode\wifirequest.cpp" /> <ClCompile Include="..\drivercode\wifitransition.cpp" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\netadaptercx\netvadapterlibrary\um\netvadapterlibraryum.vcxproj"> + <Project>{612f33ad-430c-4fe7-8000-35e15a5eb757}</Project> + </ProjectReference> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/network/wlan/WIFICX/wificxsampleclient.sln b/network/wlan/WIFICX/wificxsampleclient.sln index 0975a4da..d484d08c 100644 --- a/network/wlan/WIFICX/wificxsampleclient.sln +++ b/network/wlan/WIFICX/wificxsampleclient.sln @@ -3,8 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 17.7.34221.43 MinimumVisualStudioVersion = 12.0 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wificxsampleclientkm", "km\wificxsampleclientkm.vcxproj", "{272D3E7B-C7BA-66D1-E05D-B9723A6F0777}" + ProjectSection(ProjectDependencies) = postProject + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9} = {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wificxsampleclientum", "um\wificxsampleclientum.vcxproj", "{C804D7D0-80D8-1409-44DA-91EF3260D07F}" + ProjectSection(ProjectDependencies) = postProject + {612F33AD-430C-4FE7-8000-35E15A5EB757} = {612F33AD-430C-4FE7-8000-35E15A5EB757} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netvadapterlibrarykm", "..\..\netadaptercx\netvadapterlibrary\km\netvadapterlibrarykm.vcxproj", "{E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netvadapterlibraryum", "..\..\netadaptercx\netvadapterlibrary\um\netvadapterlibraryum.vcxproj", "{612F33AD-430C-4FE7-8000-35E15A5EB757}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -38,6 +48,30 @@ Global {C804D7D0-80D8-1409-44DA-91EF3260D07F}.Release|x64.ActiveCfg = Release|x64 {C804D7D0-80D8-1409-44DA-91EF3260D07F}.Release|x64.Build.0 = Release|x64 {C804D7D0-80D8-1409-44DA-91EF3260D07F}.Release|x64.Deploy.0 = Release|x64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Debug|ARM64.Build.0 = Debug|ARM64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Debug|x64.ActiveCfg = Debug|x64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Debug|x64.Build.0 = Debug|x64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Debug|x64.Deploy.0 = Debug|x64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Release|ARM64.ActiveCfg = Release|ARM64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Release|ARM64.Build.0 = Release|ARM64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Release|ARM64.Deploy.0 = Release|ARM64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Release|x64.ActiveCfg = Release|x64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Release|x64.Build.0 = Release|x64 + {E2A65EFD-25CC-4AF0-B180-0CD56EE277A9}.Release|x64.Deploy.0 = Release|x64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Debug|ARM64.Build.0 = Debug|ARM64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Debug|x64.ActiveCfg = Debug|x64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Debug|x64.Build.0 = Debug|x64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Debug|x64.Deploy.0 = Debug|x64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Release|ARM64.ActiveCfg = Release|ARM64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Release|ARM64.Build.0 = Release|ARM64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Release|ARM64.Deploy.0 = Release|ARM64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Release|x64.ActiveCfg = Release|x64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Release|x64.Build.0 = Release|x64 + {612F33AD-430C-4FE7-8000-35E15A5EB757}.Release|x64.Deploy.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE |
