Compartilhar via


Setting the NetDMA Interrupt CPU Affinities

Note  The NetDMA interface is not supported in Windows 8 and later.

If a computer supports MSI-X, the NetDMA interface, while in the context of the NetDmaRegisterProvider function, calls the NetDMA provider driver's ProviderSetDmaChannelCpuAffinity function to specify the CPU affinities of the interrupts that are associated with DMA channels. The NetDMA interface passes the ProviderSetDmaChannelCpuAffinity function an array of NET_DMA_CHANNEL_CPU_AFFINITY structures at the CpuAffinityArray parameter.

Because the actual number of DMA channels is not known before a NetDMA provider is started, the NetDMA interface specifies the CPU affinities for the maximum number of channels. The NetDMA provider supplies the maximum number of channels in the MaxDmaChannelCount member of the NET_DMA_PROVIDER_CHARACTERISTICS structure that the provider passes to the NetDmaRegisterProvider function. The NetDMA provider driver supplies the actual number of DMA channels in the DmaChannelCount member of the NET_DMA_PROVIDER_ATTRIBUTES structure that it passes to the NetDmaProviderStart function.

On computers that do not support MSI-X, the NetDMA interface can specify CPU affinities for the interrupt deferred procedure calls (DPCs), but not for the interrupts. For interrupt DPCs, the NetDMA interface specifies a list of possible CPUs for the interrupt DPC in the ProcessorAffinityMask member of the NET_DMA_CHANNEL_PARAMETERS structure. The NetDMA provider driver calls the KeSetTargetProcessorDpc routine to set the target CPU of the interrupt DPC to match one of the specified affinity mask bits.

On computers that support MSI-X, because the NetDMA interface specifies CPU affinities during NetDMA provider registration, the NetDMA provider driver can specify interrupt affinities while handling the IRP_MN_FILTER_RESOURCE_REQUIREMENTS IRP. After the AddDevice routine successfully returns, the Plug and Play (PnP) manager sends the IRP_MN_FILTER_RESOURCE_REQUIREMENTS IRP for the NetDMA provider. The NetDMA provider driver must attempt to allocate MSI-X interrupt resources according to affinity parameters that the NetDMA interface passed to ProviderSetDmaChannelCpuAffinity.

The NetDMA provider driver must be prepared to handle IRP_MN_FILTER_RESOURCE_REQUIREMENTS immediately after the AddDevice routine returns. IRP_MN_FILTER_RESOURCE_REQUIREMENTS provides a resource list as an IO_RESOURCE_REQUIREMENTS_LIST structure at Irp->IoStatus.Information. The resources in the list are described by IO_RESOURCE_DESCRIPTOR structures.

A NetDMA provider driver can modify the interrupt affinity policy for each resource of type CmResourceTypeInterrupt that describes an MSI-X message. If an affinity policy requests targeting for a specific set of processors, the NetDMA provider driver also sets a KAFFINITY mask at Interrupt.TargetedProcessors in the IO_RESOURCE_DESCRIPTOR structure.