Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dwc eqos perf counters #21

Merged
merged 2 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 284 additions & 17 deletions drivers/net/dwc_eqos/device.cpp

Large diffs are not rendered by default.

36 changes: 34 additions & 2 deletions drivers/net/dwc_eqos/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,52 @@ Device behavior. Includes adapter and interrupt since they are 1:1 with the devi
*/
#pragma once

struct DeviceContext;

// Referenced in driver.cpp DriverEntry.
// Called by WDF.
__declspec(code_seg("PAGE"))
EVT_WDF_DRIVER_DEVICE_ADD
DeviceAdd;

// Called by driver.cpp DriverEntry.
_IRQL_requires_max_(PASSIVE_LEVEL)
__declspec(code_seg("INIT"))
void
DevicePerfRegister(_In_ WDFDRIVER driver);

// Called by driver.cpp DriverUnload.
_IRQL_requires_max_(PASSIVE_LEVEL)
__declspec(code_seg("PAGE"))
void
DevicePerfUnregister();

// Called by rxqueue.cpp RxQueueSetNotificationEnabled.
_IRQL_requires_max_(PASSIVE_LEVEL)
void
DeviceSetNotificationRxQueue(
_In_ NETADAPTER adapter,
_Inout_ DeviceContext* context,
_In_opt_ NETPACKETQUEUE rxQueue);

// Called by txqueue.cpp TxQueueSetNotificationEnabled.
_IRQL_requires_max_(PASSIVE_LEVEL)
void
DeviceSetNotificationTxQueue(
_In_ NETADAPTER adapter,
_Inout_ DeviceContext* context,
_In_opt_ NETPACKETQUEUE txQueue);

// Called by rxqueue.cpp RxQueueAdvance.
_IRQL_requires_max_(DISPATCH_LEVEL)
void
DeviceAddStatisticsRxQueue(
_Inout_ DeviceContext* context,
UINT32 ownDescriptors,
UINT32 doneFragments);

// Called by txqueue.cpp TxQueueAdvance.
_IRQL_requires_max_(DISPATCH_LEVEL)
void
DeviceAddStatisticsTxQueue(
_Inout_ DeviceContext* context,
UINT32 ownDescriptors,
UINT32 doneFragments);
9 changes: 8 additions & 1 deletion drivers/net/dwc_eqos/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DriverUnload(_In_ WDFDRIVER driver)
// PASSIVE_LEVEL
PAGED_CODE();
UNREFERENCED_PARAMETER(driver);
DevicePerfUnregister();
TraceEntryExit(DriverUnload, LEVEL_INFO);
TraceLoggingUnregister(TraceProvider);
}
Expand All @@ -56,12 +57,18 @@ DriverEntry(
config.EvtDriverUnload = DriverUnload;
config.DriverPoolTag = 'dwcE';

WDFDRIVER driver;
status = WdfDriverCreate(
driverObject,
registryPath,
WDF_NO_OBJECT_ATTRIBUTES,
&config,
WDF_NO_HANDLE);
&driver);

if (NT_SUCCESS(status))
{
DevicePerfRegister(driver);
}

TraceExitWithStatus(DriverEntry, LEVEL_INFO, status);

Expand Down
30 changes: 30 additions & 0 deletions drivers/net/dwc_eqos/dwc_eqos.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <verrsrc.h>
#include <dwc_eqos_perf.rc>

#define VER_FILETYPE VFT_DRV
#define VER_FILESUBTYPE VFT2_DRV_SYSTEM
#define VER_FILEDESCRIPTION_STR "Synopsys DesignWare Ethernet Quality of Service (GMAC) driver for RK3588"
#define VER_INTERNALNAME_STR "dwc_eqos.sys"
#define VER_ORIGINALFILENAME_STR "dwc_eqos.sys"

#define VER_LEGALCOPYRIGHT_YEARS "2023"
#define VER_LEGALCOPYRIGHT_STR "Copyright (C) " VER_LEGALCOPYRIGHT_YEARS

#define VER_FILEVERSION 1,0,0,0
#define VER_PRODUCTVERSION_STR "1.0.0.0"
#define VER_PRODUCTVERSION 1,0,0,0
#define LVER_PRODUCTVERSION_STR L"1.0.0.0"

#define VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)
#ifdef DEBUG
#define VER_FILEFLAGS (VS_FF_DEBUG)
#else
#define VER_FILEFLAGS (0)
#endif

#define VER_FILEOS VOS_NT_WINDOWS32

#define VER_COMPANYNAME_STR "Open Source"
#define VER_PRODUCTNAME_STR "RK3588"

#include "common.ver"
33 changes: 32 additions & 1 deletion drivers/net/dwc_eqos/dwc_eqos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="device.h" />
<ClInclude Include="dwc_eqos_perf_data.h" />
<ClInclude Include="queue_common.h" />
<ClInclude Include="registers.h" />
<ClInclude Include="rxqueue.h" />
Expand Down Expand Up @@ -98,6 +99,17 @@
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)Ksecdd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Ctrpp>
<GenerateHeaderFileForCounter>false</GenerateHeaderFileForCounter>
<GenerateResourceSourceFile>true</GenerateResourceSourceFile>
<GeneratedCounterFilesPath>
</GeneratedCounterFilesPath>
<HeaderFileNameForProvider>$(IntDir)%(Filename).h</HeaderFileNameForProvider>
<ResourceFileName>$(IntDir)%(Filename).rc</ResourceFileName>
</Ctrpp>
<PostBuildEvent>
<Command>copy /y dwc_eqos_perf.man "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
Expand All @@ -111,11 +123,30 @@
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)Ksecdd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Ctrpp>
<GenerateHeaderFileForCounter>false</GenerateHeaderFileForCounter>
<GenerateResourceSourceFile>true</GenerateResourceSourceFile>
<GeneratedCounterFilesPath>
</GeneratedCounterFilesPath>
<HeaderFileNameForProvider>$(IntDir)%(Filename).h</HeaderFileNameForProvider>
<ResourceFileName>$(IntDir)%(Filename).rc</ResourceFileName>
</Ctrpp>
<PostBuildEvent>
<Command>copy /y dwc_eqos_perf.man "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<FilesToPackage Include="$(TargetPath)" />
</ItemGroup>
<ItemGroup>
<Ctrpp Include="dwc_eqos_perf.man">
<FileType>Manifest</FileType>
</Ctrpp>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="dwc_eqos.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
17 changes: 13 additions & 4 deletions drivers/net/dwc_eqos/dwc_eqos.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Driver Files">
<UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier>
<Extensions>inf;inv;inx;mof;mc;</Extensions>
Expand Down Expand Up @@ -45,6 +41,9 @@
<ClInclude Include="queue_common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="dwc_eqos_perf_data.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="device.cpp">
Expand All @@ -66,4 +65,14 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Ctrpp Include="dwc_eqos_perf.man">
<Filter>Driver Files</Filter>
</Ctrpp>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="dwc_eqos.rc">
<Filter>Driver Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
Loading