次の方法で共有


WSPMemoryRegistrationCacheCallback function

WSPMemoryRegistrationCacheCallback releases the SAN service provider's ownership of an application's buffer and the lock between the buffer and physical memory, removes the buffer from the SAN service provider's cache, and removes the buffer registration from the SAN NIC.

Syntax

int WSPMemoryRegistrationCacheCallback(
  _In_  LPVOID lpvAddress,
  _In_  SIZE_T Size,
  _Out_ LPINT  lpErrno
);

Parameters

  • lpvAddress [in]
    Pointer to a memory block that contains the starting address of a memory buffer, of which the SAN service provider previously secured ownership. An application that is releasing this buffer triggers the Windows Sockets switch to pass the pointer to this buffer in the WSPMemoryRegistrationCacheCallback call.

  • Size [in]
    Size, in bytes, of the secured memory buffer at lpvAddress, which an application is currently releasing.

  • lpErrno [out]
    Pointer to a variable that receives the error code.

Return value

Returns zero if successful; otherwise, returns SOCKET_ERROR and, at lpErrno, one of the following error codes:

Return code Description
WSAEFAULT

SAN service provider previously cached the memory buffer, but is unable to either release the buffer from physical memory or remove the registration of the buffer with the SAN NIC.

WSAEINVAL

SAN service provider was previously unable to cache the memory buffer.

 

Remarks

ASAN service provider can cache memory buffer registrations without actually removing the buffer registration from the SAN NIC, to improve the performance of applications that reuse buffers for data transfers. If a SAN service provider caches memory buffer registrations, it must provide a WSPMemoryRegistrationCacheCallback function. For more information about caching buffers, see Caching Registered Memory.

A SAN service provider caches memory buffer registrations based on virtual addresses. When the SAN service provider caches a buffer's registration, the SAN service provider's proxy driver must secure possession of that registered buffer, so the operating system notifies the switch if the buffer is released. Before the virtual-to-physical mappings of the registered buffer subsequently change, the switch calls each SAN service provider's WSPMemoryRegistrationCacheCallback function. Each SAN service provider's proxy driver, in turn, must release ownership of the buffer. In addition, each SAN service provider must remove the buffer from the cache and must remove the buffer registration from the SAN NIC. For more information about how a proxy driver secures and releases buffers, see Securing and Releasing Ownership of Virtual Addresses.

Because an application can use the same buffer for data transfers over different sockets and at different times, a SAN service provider can register that buffer with multiple sockets. When the switch calls the SAN service provider's WSPMemoryRegistrationCacheCallback function, the SAN service provider must take this fact into account and remove the buffer registration from each SAN NIC associated with each socket.

Requirements

Target platform

Desktop

Version

Requires Windows Sockets version 2.2.

Header

Ws2san.h (include Ws2san.h)

See also

MmSecureVirtualMemory

MmUnsecureVirtualMemory

WSPDeregisterMemory

WSPDeregisterRdmaMemory

WSPRegisterMemory

WSPRegisterRdmaMemory

 

 

Send comments about this topic to Microsoft