Partager via


NdisMSetAttributesEx (Windows Embedded CE 6.0)

1/6/2010

This function informs the NDIS library about significant features of the caller's NIC or virtual NIC during initialization.

Syntax

VOID NdisMSetAttributesEx(
  NDIS_HANDLE MiniportAdapterHandle,
  NDIS_HANDLE MiniportAdapterContext,
  UINT CheckForHangTimeInSeconds,
  ULONG AttributeFlags,
  NDIS_INTERFACE_TYPE AdapterType
);

Parameters

  • MiniportAdapterContext
    [in] Handle to a resident context area allocated by MiniportInitialize.
  • CheckForHangTimeInSeconds
    [in] Specifies the interval, in seconds, at which NDIS should call the MiniportCheckForHang function, if any. Specifying 0 for this parameter indicates that NDIS should call MiniportCheckForHang at the NDIS default two-second interval, and that NDIS should call the MiniportReset function at the default four-second time-out interval for pending sends and requests.

    Specifying a value greater than 2 extends both the check-for-hang and time-out intervals. NDIS uses double the specified check-for-hang interval as its time-out interval for the caller.

  • AttributeFlags
    [in] Optional. Specifies a bitmask that can be set with one or more of the following flags.

    Value Description

    NDIS_ATTRIBUTE_BUS_MASTER

    Set if the caller's NIC is a bus master DMA device.

    NDIS_ATTRIBUTE_DESERIALIZE

    Set if the caller is a deserialized miniport driver.

    NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT

    Set if NDIS should not attempt to time-out pending send packets that it holds queued to the caller. Intermediate drivers should set this flag, but NIC drivers should not.

    NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT

    Set if NDIS should not attempt to time-out pending query and set requests that it holds queued to the caller. Intermediate drivers should set this flag, but NIC drivers should not.

    NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER

    Set if the caller is an intermediate driver.

    NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS

    Set if NDIS should not call a token ring NIC driver's MiniportReset function if token ring errors are indicated.

    NDIS_ATTRIBUTE_ALWAYS_GIVES_RX_PACKET_OWNERSHIP

    Set this to inform NDIS that NDIS_STATUS_RESOURCES are not indicated.

  • AdapterType
    [in] Specifies the I/O bus interface type of the caller's NIC, which usually is the type of I/O bus on which the NIC is connected, as one of the following.

    Value Description

    NdisInterfaceInternal

    Specifies a host-specific internal interface.

    NdisInterfaceIsa

    Specifies the ISA interface.

    NdisInterfacePci

    Specifies the Peripheral Component Interconnect (PCI) interface.

    NdisInterfacePCMcia

    Specifies the Personal Computer Memory Card International Association (PCMCIA) interface.

    This parameter is irrelevant for intermediate drivers, which should pass 0 for this parameter to this function.

Return Value

None.

Remarks

MiniportInitialize must call NdisMSetAttributesEx or NdisMSetAttributes before calling any other NdisMRegisterXXX or NdisXXXfunction that depends on the information supplied to this function.

Intermediate drivers must call NdisMSetAttributesEx rather than NdisMSetAttributes, and they must set the NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER in the AttributeFlags. Setting this flag causes NDIS to treat an intermediate driver as a full-duplex miniport, which prevents rare but intermittent deadlocks from occurring in the intermediate driver. Consequently, every intermediate driver must be capable of handling concurrent sends and indications.

NIC drivers can call either of these functions from MiniportInitialize, but NdisMSetAttributes does not allow its caller to adjust the interval at which an NIC driver's MiniportCheckForHang function and/or MiniportReset function are called.

The value of CheckForHangTimeInSeconds determines the NDIS library's time-out interval on sends and requests that it holds queued to the caller. By default, NDIS times out queued sends and requests at twice the check-for-hang interval. Unless the driver sets AttributeFlags with NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT and NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT when it calls NdisMSetAttributesEx, NDIS calls the MiniportReset function after these timeouts. Intermediate drivers should set these flags when calling this function because such a driver cannot determine or control when the underlying device driver processes sends and requests.

NIC drivers should not set the NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT and NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT flags. However, NIC drivers can adjust the time-out interval at which their MiniportReset functions are called by specifying an explicit CheckForHangTimeInSeconds. For example, an NIC driver that emulates Ethernet over a modem might not complete every packet within the default time-out interval of the NDIS library. When a packet appears to time out on such an NIC, NDIS assumes that the NIC is no longer operating correctly and calls the driver's MiniportReset function. In this case, calling NdisMSetAttributesEx with a CheckForHangTimeInSeconds set to something greater than two prevents unnecessary resets and extends the interval at which its MiniportCheckForHang function, if any, is called to test the operational state of the NIC.

In general, an NIC driver must call NdisMSetAttributesEx before it calls any NdisXXX function that claims hardware resources in the registry for its NIC, because NDIS must have the AttributeFlags value before such a call is made and because the driver usually needs the memory at MiniportAdapterContext to store information for these calls. This restriction implies that an NIC driver's MiniportInitialize function cannot call the following NdisXXX functions before it calls NdisMSetAttributesEx:

However, before calling NdisMSetAttributesEx, any driver's MiniportInitialize function can call the NDIS configuration functions to retrieve configuration information installed in the registry. MiniportInitialize can also call the bus-type-specific NdisReadXXX functions, such as NdisReadPciSlotInformation, as long as the installed registry entry for the driver's interface type matches the bus-type-specific NdisReadXXX MiniportInitialize calls.

The MiniportAdapterContext handle supplied to NdisMSetAttributesEx becomes an input parameter to all MiniportXXX functions that were registered, along with MiniportInitialize, in the call to NdisMRegisterMiniport or NdisIMRegisterLayeredMiniport. Usually, this handle is a pointer to resident memory allocated by MiniportInitialize, in which the driver maintains NIC-specific run-time state.

Requirements

Header ndis.h
Library ndis.dll
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

NDIS Library Functions
MiniportCheckForHang
MiniportInitialize
MiniportReset
NdisIMRegisterLayeredMiniport
NdisMAllocateSharedMemory
NdisMMapIoSpace
NdisMPciAssignResources
NdisMRegisterInterrupt
NdisMRegisterIoPortRange
NdisMRegisterMiniport
NdisMSetAttributes
NdisReadPciSlotInformation
NdisOpenConfiguration