SIO_QUERY_RSS_PROCESSOR_INFO Control Code

Description

The SIO_QUERY_RSS_PROCESSOR_INFO control code queries the association between a socket and an RSS processor core and NUMA node.

To perform this operation, call the WSAIoctl or WSPIoctl function with the following parameters.

int WSAIoctl(
  (socket) s,             // descriptor identifying a socket
  SIO_QUERY_RSS_PROCESSOR_INFO, // dwIoControlCode
  NULL,                         // lpvInBuffer
  0,                            // cbInBuffer
  (LPVOID) lpvOutBuffer,         // output buffer
  (DWORD) cbOutBuffer,       // size of output buffer
  (LPDWORD) lpcbBytesReturned,    // number of bytes returned
  (LPWSAOVERLAPPED) lpOverlapped,   // OVERLAPPED structure
  (LPWSAOVERLAPPED_COMPLETION_ROUTINE) lpCompletionRoutine,  // completion routine
);
int WSPIoctl(
  (socket) s,             // descriptor identifying a socket
  SIO_QUERY_RSS_PROCESSOR_INFO, // dwIoControlCode
  NULL,                         // lpvInBuffer
  0,                            // cbInBuffer
  (LPVOID) lpvOutBuffer,         // output buffer
  (DWORD) cbOutBuffer,       // size of output buffer
  (LPDWORD) lpcbBytesReturned,    // number of bytes returned
  (LPWSAOVERLAPPED) lpOverlapped,   // OVERLAPPED structure
  (LPWSAOVERLAPPED_COMPLETION_ROUTINE) lpCompletionRoutine,  // completion routine
  (LPWSATHREADID) lpThreadId,   // a WSATHREADID structure
  (LPINT) lpErrno   // a pointer to the error code.
);

Parameters

s

A descriptor identifying a socket.

dwIoControlCode

The control code for the operation. Use SIO_QUERY_RSS_PROCESSOR_INFO for this operation.

lpvInBuffer

A pointer to the input buffer. This parameter is unused for this operation.

cbInBuffer

The size, in bytes, of the input buffer. This parameter is unused for this operation.

lpvOutBuffer

A pointer to the output buffer. This parameter should point to a SOCKET_PROCESSOR_AFFINITY structure if the lpOverlapped and lpCompletionRoutine parameters are NULL.

cbOutBuffer

The size, in bytes, of the output buffer. This parameter must be at least the size of a SOCKET_PROCESSOR_AFFINITY structure.

lpcbBytesReturned

A pointer to a variable that receives the size, in bytes, of the data stored in the output buffer.

If the output buffer is too small, the call fails, WSAGetLastError returns WSAEINVAL, and the lpcbBytesReturned parameter points to a DWORD value of zero.

If lpOverlapped is NULL, the DWORD value pointed to by the lpcbBytesReturned parameter that is returned on a successful call cannot be zero.

If the lpOverlapped parameter is not NULL for overlapped sockets, operations that cannot be completed immediately will be initiated, and completion will be indicated at a later time. The DWORD value pointed to by the lpcbBytesReturned parameter that is returned may be zero since the size of the data stored can't be determined until the overlapped operation has completed. The final completion status can be retrieved when the appropriate completion method is signaled when the operation has completed.

lpvOverlapped

A pointer to a WSAOVERLAPPED structure.

If socket s was created without the overlapped attribute, the lpOverlapped parameter is ignored.

If s was opened with the overlapped attribute and the lpOverlapped parameter is not NULL, the operation is performed as an overlapped (asynchronous) operation. In this case, lpOverlapped parameter must point to a valid WSAOVERLAPPED structure.

For overlapped operations, the WSAIoctl or WSPIoctl function returns immediately, and the appropriate completion method is signaled when the operation has been completed. Otherwise, the function does not return until the operation has been completed or an error occurs.

lpCompletionRoutine

Type: _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE

A pointer to the completion routine called when the operation has been completed (ignored for non-overlapped sockets).

lpThreadId

A pointer to a WSATHREADID structure to be used by the provider in a subsequent call to WPUQueueApc. The provider should store the referenced WSATHREADID structure (not the pointer to same) until after the WPUQueueApc function returns.

Note This parameter applies only to the WSPIoctl function.

lpErrno

A pointer to the error code.

Note This parameter applies only to the WSPIoctl function.

Return value

If the operation completes successfully, the WSAIoctl or WSPIoctl function returns zero.

If the operation fails or is pending, the WSAIoctl or WSPIoctl function returns SOCKET_ERROR. To get extended error information, call WSAGetLastError.

Error code Meaning
ERROR_INSUFFICIENT_BUFFER The data area passed to a system call is too small. This error is returned if the buffer pointed to by the lpvOutBuffer parameter with a buffer size passed in the cbOutBuffer parameter is too small. The buffer size required will be returned in the lpcbBytesReturned parameter. This error is returned if the cbOutBuffer parameter is less than the size of a SOCKET_PROCESSOR_AFFINITY structure.
WSA_IO_PENDING An overlapped operation was successfully initiated and completion will be indicated at a later time.
WSA_OPERATION_ABORTED An overlapped operation was canceled due to the closure of the socket or the execution of the SIO_FLUSH IOCTL command.
WSAEFAULT The lpvInBuffer, lpvoutBuffer, lpcbBytesReturned, lpOverlapped or lpCompletionRoutine parameter is not totally contained in a valid part of the user address space.
WSAEINPROGRESS The function is invoked when a callback is in progress.
WSAEINTR A blocking operation was interrupted.
WSAEINVAL The dwIoControlCode parameter is not a valid command, or a specified input parameter is not acceptable, or the command is not applicable to the type of socket specified. This error is returned if the cbOutBuffer parameter is less than the size of a SOCKET_PROCESSOR_AFFINITY structure.
WSAENETDOWN The network subsystem has failed.
WSAENOPROTOOPT The socket option is not supported on the specified protocol.
WSAENOTCONN The socket s is not connected.
WSAENOTSOCK The descriptor s is not a socket.
WSAEOPNOTSUPP The specified IOCTL command is not supported. This error is returned if the SIO_QUERY_RSS_PROCESSOR_INFO IOCTL is not supported by the transport provider.

Remarks

The SIO_QUERY_RSS_PROCESSOR_INFO IOCTL is supported on Windows 8, and Windows Server 2012, and later versions of the operating system.

The SIO_QUERY_RSS_PROCESSOR_INFO IOCTL is used to determine the association between a socket and an RSS processor core and NUMA node. This IOCTL returns a SOCKET_PROCESSOR_AFFINITY structure that contains the PROCESSOR_NUMBER and the NUMA node ID. The returned PROCESSOR_NUMBER structure contains a group number and relative processor number within the group.

If the socket is a UDP socket, the socket must be connected for the SIO_QUERY_RSS_PROCESSOR_INFO IOCTL to work properly.

See also

PROCESSOR_NUMBER

socket

SOCKET_PROCESSOR_AFFINITY

WSAGetLastError

WSAGetOverlappedResult

WSAIoctl

WSAOVERLAPPED

WSASocketA

WSASocketW