Skip to content

Commit

Permalink
UsbDk: Make USB transfers execute at dispatch level
Browse files Browse the repository at this point in the history
Change ExecutionLevel for redirector data queue
to WdfExecutionLevelDispatch.

There is no real reason to force USB transfers exection
on PASSIVE_LEVEL and DISPATCH_LEVEL execution is definitely
faster.

Signed-off-by: Dmitry Fleytman <[email protected]>
  • Loading branch information
Dmitry Fleytman committed Dec 24, 2015
1 parent 3bca677 commit e46947d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion UsbDk/ControlDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CUsbDkControlDeviceQueue : public CWdfDefaultQueue
{
public:
CUsbDkControlDeviceQueue(WDF_IO_QUEUE_DISPATCH_TYPE DispatchType)
: CWdfDefaultQueue(DispatchType)
: CWdfDefaultQueue(DispatchType, WdfExecutionLevelPassive)
{}

private:
Expand Down
2 changes: 1 addition & 1 deletion UsbDk/HiderDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CUsbDkHiderDeviceQueue : public CWdfDefaultQueue
{
public:
CUsbDkHiderDeviceQueue(WDF_IO_QUEUE_DISPATCH_TYPE DispatchType)
: CWdfDefaultQueue(DispatchType)
: CWdfDefaultQueue(DispatchType, WdfExecutionLevelPassive)
{}

private:
Expand Down
4 changes: 2 additions & 2 deletions UsbDk/RedirectorStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CUsbDkRedirectorQueueData : public CWdfDefaultQueue
{
public:
CUsbDkRedirectorQueueData()
: CWdfDefaultQueue(WdfIoQueueDispatchParallel)
: CWdfDefaultQueue(WdfIoQueueDispatchParallel, WdfExecutionLevelDispatch)
{}

private:
Expand All @@ -47,7 +47,7 @@ class CUsbDkRedirectorQueueConfig : public CWdfSpecificQueue
{
public:
CUsbDkRedirectorQueueConfig()
: CWdfSpecificQueue(WdfIoQueueDispatchSequential)
: CWdfSpecificQueue(WdfIoQueueDispatchSequential, WdfExecutionLevelPassive)
{}

private:
Expand Down
2 changes: 1 addition & 1 deletion UsbDk/WdfDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ NTSTATUS CWdfQueue::Create(CWdfDevice &Device)
SetCallbacks(QueueConfig);

WDF_OBJECT_ATTRIBUTES_INIT(&Attributes);
Attributes.ExecutionLevel = WdfExecutionLevelPassive;
Attributes.ExecutionLevel = m_ExecutionLevel;

auto status = Device.AddQueue(QueueConfig, Attributes, m_Queue);
if (!NT_SUCCESS(status)) {
Expand Down
12 changes: 7 additions & 5 deletions UsbDk/WdfDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ class CWdfControlDevice : public CWdfDevice
class CWdfQueue
{
public:
CWdfQueue(WDF_IO_QUEUE_DISPATCH_TYPE DispatchType)
CWdfQueue(WDF_IO_QUEUE_DISPATCH_TYPE DispatchType, WDF_EXECUTION_LEVEL ExecutionLevel)
: m_DispatchType(DispatchType)
, m_ExecutionLevel(ExecutionLevel)
{}

virtual NTSTATUS Create(CWdfDevice &Device);
Expand All @@ -187,6 +188,7 @@ class CWdfQueue

WDFQUEUE m_Queue;
WDF_IO_QUEUE_DISPATCH_TYPE m_DispatchType;
WDF_EXECUTION_LEVEL m_ExecutionLevel;

CWdfQueue(const CWdfQueue&) = delete;
CWdfQueue& operator= (const CWdfQueue&) = delete;
Expand All @@ -195,8 +197,8 @@ class CWdfQueue
class CWdfDefaultQueue : public CWdfQueue
{
public:
CWdfDefaultQueue(WDF_IO_QUEUE_DISPATCH_TYPE DispatchType)
: CWdfQueue(DispatchType)
CWdfDefaultQueue(WDF_IO_QUEUE_DISPATCH_TYPE DispatchType, WDF_EXECUTION_LEVEL Executionlevel)
: CWdfQueue(DispatchType, Executionlevel)
{}

private:
Expand All @@ -209,8 +211,8 @@ class CWdfDefaultQueue : public CWdfQueue
class CWdfSpecificQueue : public CWdfQueue
{
public:
CWdfSpecificQueue(WDF_IO_QUEUE_DISPATCH_TYPE DispatchType)
: CWdfQueue(DispatchType)
CWdfSpecificQueue(WDF_IO_QUEUE_DISPATCH_TYPE DispatchType, WDF_EXECUTION_LEVEL Executionlevel)
: CWdfQueue(DispatchType, Executionlevel)
{}

private:
Expand Down

0 comments on commit e46947d

Please sign in to comment.