MiniportMessageInterrupt (NDIS 6.20) routine

NDIS calls the MiniportMessageInterrupt function when a NIC generates a message-based interrupt.

Syntax

MINIPORT_MESSAGE_INTERRUPT MiniportMessageInterrupt;

BOOLEAN MiniportMessageInterrupt(
  _In_   NDIS_HANDLE MiniportInterruptContext,
  _In_   ULONG MessageId,
  _Out_  PBOOLEAN QueueDefaultInterruptDpc,
  _Out_  PULONG TargetProcessors
)
{ ... }

Parameters

  • MiniportInterruptContext [in]
    A pointer to a block of interrupt context information. The miniport driver supplied this pointer in the MiniportInterruptContext parameter that the miniport driver passed to the NdisMRegisterInterruptEx function.

  • MessageId [in]
    A message signaled interrupt. MessageId is an index to the IO_INTERRUPT_MESSAGE_INFO_ENTRY structures inside a IO_INTERRUPT_MESSAGE_INFO structure. NDIS passes a pointer to the associated IO_INTERRUPT_MESSAGE_INFO structure at the MessageInfoTable member when the driver successfully registers for MSI with the NdisMRegisterInterruptEx function.

  • QueueDefaultInterruptDpc [out]
    A pointer to a Boolean variable that the miniport driver sets before it returns from this call. A miniport driver sets this value to TRUE to indicate that the driver requires a DPC on the default (current) CPU. If set to TRUE, NDIS ignores the value of the TargetProcessors parameter. If set to FALSE, NDIS uses the value of the TargetProcessors parameter to schedule DPCs.

  • TargetProcessors [out]
    A bitmap that indicates the target processors for which NDIS should schedule a DPC. Each bit in TargetProcessors identifies a CPU. If the caller sets bit 0, NDIS schedules a DPC for CPU 0. If the caller sets bit 1, NDIS schedules a DPC for CPU 1, and so on.

    This parameter is a ULONG bitmap that represents the first 32 processors in processor group 0.

    Note  NDIS 6.20 and later drivers should not use this parameter to schedule DPCs. Set this parameter to zero and use the NdisMQueueDpcEx function to schedule DPCs instead.

Return value

MiniportMessageInterrupt returns TRUE if the underlying NIC generated the interrupt; otherwise, it returns FALSE.

Remarks

Miniport drivers that use the NdisMRegisterInterruptEx function to register for message-signaled interrupts (MSI) support must provide a MinipotMessageInterrupt function.

A miniport driver should do as little work as possible in its MiniportMessageInterrupt function. For example, it should defer I/O operations for the interrupts that the NIC generates to the MiniportMessageInterruptDPC function.

When a NIC generates an MSI, NDIS calls the miniport driver's MiniportMessageInterrupt function.

MiniportMessageInterrupt saves required state information about the interrupt and defers as much of the I/O processing as possible to the MiniportMessageInterruptDPC function.

If the miniport driver requests deferred procedure calls (DPCs) for a specified message, the miniport driver should disable all additional interrupts for that message and re-enable the interrupts after all the DPCs are finished.

The miniport driver should set QueueDefaultInterruptDpc to TRUE to schedule a DPC for the default CPU only. The driver can do this, for example, if:

  • The NIC generated the interrupt to signal the completion of a send operation or any other request that does not run on other CPUs.

  • The NIC generated the interrupt to signal received data and the miniport driver cannot process received packets in separate DPCs.

  • The interrupt indicates received packets and the miniport driver can process received packets in separate DPCs, but receive-side scaling is not enabled for the miniport driver. For more information about receive-side scaling, see OID_GEN_RECEIVE_SCALE_CAPABILITIES and OID_GEN_RECEIVE_SCALE_PARAMETERS.

  • Receive-side scaling is enabled for the miniport driver, and the miniport driver can generate different messages on every receive queue.

If a miniport driver processes received packets in separate DPCs, the miniport driver sets the QueueDefaultInterruptDpc parameter to FALSE. The miniport driver can set the TargetProcessors bit for the CPU that is associated with each nonempty receive queue. NDIS will schedule a DPC on each of the indicated CPUs in processor group 0.

If MiniportMessageInterrupt shares resources for a specified message, such as NIC registers or state variables, with another MiniportXxx function that runs at a lower IRQL, that MiniportXxx function must call the NdisMSynchronizeWithInterruptEx function. This guarantees that the driver's MiniportSynchronizeMessageInterrupt function accesses the shared resources in a synchronized and multiprocessor-safe manner.

A miniport driver can call the NdisMDeregisterInterruptEx function from its MiniportInitializeEx or MiniportHaltEx functions to release resources that it allocated with NdisMRegisterInterruptEx. After NdisMDeregisterInterruptEx returns, NDIS does not call a miniport driver's MiniportMessageInterrupt or MiniportMessageInterruptDPC functions.

NDIS calls MiniportMessageInterrupt at the DIRQL of the MSI that the miniport driver registered in a previous call to NdisMRegisterInterruptEx. Therefore, MiniportMessageInterrupt must call the subset of the NDIS functions, such as the NdisRawXxx or NdisRead/WriteRegisterXxx functions, that are safe to call at any IRQL.

Requirements

Version

Supported in NDIS 6.0 and later.

Header

Ndis.h (include Ndis.h)

IRQL

See Remarks section.

See also

IO_INTERRUPT_MESSAGE_INFO

IO_INTERRUPT_MESSAGE_INFO_ENTRY

MiniportHaltEx

MiniportInitializeEx

MiniportMessageInterruptDPC

MiniportSynchronizeMessageInterrupt

NDIS_MINIPORT_INTERRUPT_CHARACTERISTICS

NdisMDeregisterInterruptEx

NdisMQueueDpcEx

NdisMRegisterInterruptEx

NdisMSynchronizeWithInterruptEx

OID_GEN_RECEIVE_SCALE_CAPABILITIES

OID_GEN_RECEIVE_SCALE_PARAMETERS

 

 

Send comments about this topic to Microsoft

Build date: 7/17/2013