WSPDeregisterRdmaMemory function

WSPDeregisterRdmaMemory releases an RDMA buffer that was registered by a previous call to the WSPRegisterRdmaMemory function.


int WSPDeregisterRdmaMemory(
  _In_  SOCKET s,
  _In_  LPVOID lpRdmaBufferDescriptor,
  _In_  DWORD  dwDescriptorLength,
  _Out_ LPINT  lpErrno


  • s [in]
    Descriptor that identifies a connected socket.

  • lpRdmaBufferDescriptor [in]
    Pointer to a memory block that contains a descriptor. This descriptor identifies the RDMA buffer that was previously registered.

  • dwDescriptorLength [in]
    Size, in bytes, of the memory block at lpRdmaBufferDescriptor.

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

Return value

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

Return code Description

The specified pointer to the descriptor for the RDMA buffer does not represent a previously registered RDMA buffer, or the SAN service provider cannot release the RDMA buffer, because the RDMA buffer is currently being used in an RDMA data transfer operation.


The Windows Sockets switch calls the WSPDeregisterRdmaMemory function to release an RDMA buffer that it previously registered in a call to the WSPRegisterRdmaMemory function. In the call to the WSPDeregisterRdmaMemory function, the switch passes the same socket descriptor that it passed to the WSPRegisterRdmaMemory function.

A SAN service provider is not required to return a different RDMA buffer descriptor when the switch makes an additional call to WSPRegisterRdmaMemory to register that RDMA buffer for use by another socket. However, the SAN service provider should maintain an internal reference count of the number of registered instances of that RDMA buffer. Calls to the SAN service provider's WSPDeregisterRdmaMemory entry point decrement this internal reference count. Only the final WSPDeregisterRdmaMemory call, which decrements the internal reference count to zero, releases all resources that the SAN service provider consumed to register the RDMA buffer.


Target platform



Requires Windows Sockets version 2.2.


Ws2san.h (include Ws2san.h)

See also



Send comments about this topic to Microsoft