Skip to content

Initial Changes for RDMA as a platform for MsQuic #5113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d0fca2a
initial commit
srsubra Feb 13, 2025
d15da6a
Merge branch 'srsubra/msquic_rdma' of https://github.com/microsoft/ms…
srsubra Feb 13, 2025
b28278e
Merge branch 'main' of https://github.com/microsoft/msquic into srsub…
srsubra Feb 14, 2025
c127c13
rdma init functions
srsubra Feb 21, 2025
5e31d8b
ring buffer changes
srsubra Mar 3, 2025
b8c0736
ring buffer changes
srsubra Mar 4, 2025
d28eea2
NDSPI api I/O APIs
srsubra Mar 5, 2025
5254354
overlapped file creation for connection
srsubra Mar 13, 2025
84cfbfd
initial RDMA socket connect and accept implementation
srsubra Mar 17, 2025
6b84dd2
callbacks for connect and accept
srsubra Mar 19, 2025
738c9d5
callbacks for connect and accept
srsubra Mar 19, 2025
9c2162d
rdma socket delete changes
srsubra Mar 19, 2025
a7f9430
memory window token exchange initial
srsubra Mar 21, 2025
53ea477
token exchange callback completion
srsubra Mar 25, 2025
e8896c3
offset buffer changes
srsubra Apr 18, 2025
cd971bd
hash table for offset maintenance
srsubra Apr 20, 2025
1eb1c26
send complete log changes
srsubra Apr 26, 2025
c41895b
prepare machine scipt changes
srsubra Apr 29, 2025
68c8569
Datapath Test Initial Integration
srsubra May 8, 2025
e33d96b
Init Datapath tests for rdma
srsubra May 22, 2025
2c60c9d
support connection establishment without memory windows
srsubra Jun 5, 2025
b81ba53
build private data within SocketCreateRdmaInternal only for client
srsubra Jun 5, 2025
24c0818
rdma listener changes
srsubra Jun 9, 2025
fcec3fc
fixing connection establishment issues
srsubra Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 207 additions & 0 deletions Rdma/Mana/mana_ndspi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
#pragma once

#ifndef _MANA_NDSPI_H_
#define _MANA_NDSPI_H_

typedef enum _ND2_MANA_REQUEST_TYPE {
Nd2ManaRequestTypeSend,
Nd2ManaRequestTypeBind,
Nd2ManaRequestTypeInvalidate,
Nd2ManaRequestTypeRead,
Nd2ManaRequestTypeWrite,
Nd2ManaRequestTypeRecv = 1 << 7,
Nd2ManaRequestTypeRecvWithInvalidate,
Nd2ManaRequestTypeRecvWithImmediate,
Nd2ManaRequestTypeRecvRdmaWithImmediate,
} ND2_MANA_REQUEST_TYPE;

typedef struct _ND2_MANA_RESULT {
HRESULT Status;
ULONG BytesTransferred;
VOID* QueuePairContext;
VOID* RequestContext;
ND2_MANA_REQUEST_TYPE RequestType;
union {
UINT32 ImmediateData;
UINT32 RKey;
};
} ND2_MANA_RESULT;

//
// Completion Queue
//
#undef INTERFACE
#define INTERFACE IND2ManaCompletionQueue

// {28925856-4FCC-4479-915C-034426A50B9E}
DEFINE_GUID(IID_IND2ManaCompletionQueue,
0x28925856, 0x4fcc, 0x4479, 0x91, 0x5c, 0x3, 0x44, 0x26, 0xa5, 0xb, 0x9e);

DECLARE_INTERFACE_(IND2ManaCompletionQueue, IND2CompletionQueue)
{
// *** IUnknown methods ***
IFACEMETHOD(QueryInterface)(
THIS_
REFIID riid,
__deref_out LPVOID* ppvObj
) PURE;

IFACEMETHOD_(ULONG, AddRef)(
THIS
) PURE;

IFACEMETHOD_(ULONG, Release)(
THIS
) PURE;

// *** IND2Overlapped methods ***
IFACEMETHOD(CancelOverlappedRequests)(
THIS
) PURE;

IFACEMETHOD(GetOverlappedResult)(
THIS_
__in OVERLAPPED* pOverlapped,
BOOL wait
) PURE;

// *** IND2CompletionQueue methods ***
IFACEMETHOD(GetNotifyAffinity)(
THIS_
__out USHORT* pGroup,
__out KAFFINITY* pAffinity
) PURE;

IFACEMETHOD(Resize)(
THIS_
ULONG queueDepth
) PURE;

IFACEMETHOD(Notify)(
THIS_
ULONG type,
__inout OVERLAPPED* pOverlapped
) PURE;

IFACEMETHOD_(ULONG, GetResults)(
THIS_
__out_ecount_part(nResults, return) ND2_RESULT results[],
ULONG nResults
) PURE;

// *** IND2ManaCompletionQueue methods ***
STDMETHOD_(ULONG, GetManaResults)(
THIS_
__out_ecount_part(nResults, return) ND2_MANA_RESULT results[],
ULONG nResults
) PURE;
};

//
// QueuePair
//
#undef INTERFACE
#define INTERFACE IND2ManaQueuePair

// {8B1811D5-52DD-4084-8119-15C11AB32FB9}
DEFINE_GUID(IID_IND2ManaQueuePair,
0x8b1811d5, 0x52dd, 0x4084, 0x81, 0x19, 0x15, 0xc1, 0x1a, 0xb3, 0x2f, 0xb9);

DECLARE_INTERFACE_(IND2ManaQueuePair, IND2QueuePair)
{
// *** IUnknown methods ***
IFACEMETHOD(QueryInterface)(
THIS_
REFIID riid,
__deref_out LPVOID* ppvObj
) PURE;

IFACEMETHOD_(ULONG, AddRef)(
THIS
) PURE;

IFACEMETHOD_(ULONG, Release)(
THIS
) PURE;

// *** IND2QueuePair methods ***
IFACEMETHOD(Flush)(
THIS
) PURE;

IFACEMETHOD(Send)(
THIS_
__in_opt VOID* requestContext,
__in_ecount_opt(nSge) const ND2_SGE sge[],
ULONG nSge,
ULONG flags
) PURE;

IFACEMETHOD(Receive)(
THIS_
__in_opt VOID* requestContext,
__in_ecount_opt(nSge) const ND2_SGE sge[],
ULONG nSge
) PURE;

// RemoteToken available thorugh IND2Mw::GetRemoteToken.
IFACEMETHOD(Bind)(
THIS_
__in_opt VOID* requestContext,
__in IUnknown* pMemoryRegion,
__inout IUnknown* pMemoryWindow,
__in_bcount(cbBuffer) const VOID* pBuffer,
SIZE_T cbBuffer,
ULONG flags
) PURE;

IFACEMETHOD(Invalidate)(
THIS_
__in_opt VOID* requestContext,
__in IUnknown* pMemoryWindow,
ULONG flags
) PURE;

IFACEMETHOD(Read)(
THIS_
__in_opt VOID* requestContext,
__in_ecount_opt(nSge) const ND2_SGE sge[],
ULONG nSge,
UINT64 remoteAddress,
UINT32 remoteToken,
ULONG flags
) PURE;

IFACEMETHOD(Write)(
THIS_
__in_opt VOID* requestContext,
__in_ecount_opt(nSge) const ND2_SGE sge[],
ULONG nSge,
UINT64 remoteAddress,
UINT32 remoteToken,
ULONG flags
) PURE;

// *** IND2ManaQueuePair methods ***
STDMETHOD(SendWithImmediate)(
THIS_
__in_opt VOID* requestContext,
__in_ecount_opt(nSge) const ND2_SGE sge[],
ULONG nSge,
ULONG flags,
UINT32 immediateData
) PURE;

STDMETHOD(WriteWithImmediate)(
THIS_
__in_opt VOID* requestContext,
__in_ecount_opt(nSge) const ND2_SGE sge[],
ULONG nSge,
UINT64 remoteAddress,
UINT32 remoteToken,
ULONG flags,
UINT32 immediateData
) PURE;
};

#endif /* _MANA_NDSPI_H_ */
22 changes: 21 additions & 1 deletion scripts/prepare-machine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ param (
[switch]$DisableTest,

[Parameter(Mandatory = $false)]
[switch]$InstallCoreNetCiDeps
[switch]$InstallCoreNetCiDeps,

[Parameter(Mandatory = $false)]
[switch]$InstallNetworkDirect
)

# Admin is required because a lot of things are installed to the local machine
Expand Down Expand Up @@ -144,6 +147,11 @@ if ($ForBuild) {
$InstallNasm = $true
$InstallJom = $true
$InstallCoreNetCiDeps = $true; # For kernel signing certs

if (!$IsLinux && !$IsMacOS)
{
$InstallNetworkDirect = $true
}
}

if ($ForTest) {
Expand All @@ -164,6 +172,11 @@ if ($ForTest) {
$InstallDuoNic = $true;
}

if (!$IsLinux && !$IsMacOS)
{
$InstallNetworkDirect = $true
}

#$InstallCodeCoverage = $true # Ideally we'd enable this by default, but it
# hangs sometimes, so we only want to install
# for jobs that absoultely need it.
Expand Down Expand Up @@ -472,6 +485,12 @@ function Install-Clog2Text {
Install-DotnetTool -ToolName "Microsoft.Logging.CLOG2Text.Lttng" -Version "0.0.1" -NuGetPath $NuGetPath
}

function Install-NetworkDirect {
Write-Host "Install NetworkDirect"
Install-Package NetworkDirect -ProviderName NuGet -Destination $RootDir\Rdma -ExcludeVersion -Force
}


# We remove OpenSSL path for kernel builds because it's not needed.
if ($ForKernel) {
git rm $RootDir/submodules/openssl
Expand Down Expand Up @@ -515,6 +534,7 @@ if ($InstallJOM) { Install-JOM }
if ($InstallPerl) { Install-Perl }
if ($InstallCodeCoverage) { Install-OpenCppCoverage }
if ($InstallTestCertificates) { Install-TestCertificates }
if ($InstallNetworkDirect) { Install-NetworkDirect }

if ($IsLinux) {
if ($InstallClog2Text) {
Expand Down
1 change: 1 addition & 0 deletions src/core/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ QuicLibraryLazyInitialize(
sizeof(QUIC_RX_PACKET),
&DatapathCallbacks,
NULL, // TcpCallbacks
NULL, // RdmaCallbacks
&MsQuicLib.WorkerPool,
MsQuicLib.ExecutionConfig,
&MsQuicLib.Datapath);
Expand Down
49 changes: 49 additions & 0 deletions src/generated/linux/datapath_rdma_ringbuffer.c.clog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#ifndef CLOG_DO_NOT_INCLUDE_HEADER
#include <clog.h>
#endif
#undef TRACEPOINT_PROVIDER
#define TRACEPOINT_PROVIDER CLOG_DATAPATH_RDMA_RINGBUFFER_C
#undef TRACEPOINT_PROBE_DYNAMIC_LINKAGE
#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "datapath_rdma_ringbuffer.c.clog.h.lttng.h"
#if !defined(DEF_CLOG_DATAPATH_RDMA_RINGBUFFER_C) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define DEF_CLOG_DATAPATH_RDMA_RINGBUFFER_C
#include <lttng/tracepoint.h>
#define __int64 __int64_t
#include "datapath_rdma_ringbuffer.c.clog.h.lttng.h"
#endif
#include <lttng/tracepoint-event.h>
#ifndef _clog_MACRO_QuicTraceEvent
#define _clog_MACRO_QuicTraceEvent 1
#define QuicTraceEvent(a, ...) _clog_CAT(_clog_ARGN_SELECTOR(__VA_ARGS__), _clog_CAT(_,a(#a, __VA_ARGS__)))
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*----------------------------------------------------------
// Decoder Ring for AllocFailure
// Allocation of '%s' failed. (%llu bytes)
// QuicTraceEvent(
AllocFailure,
"Allocation of '%s' failed. (%llu bytes)",
"SendCompletionTable",
0);
// arg2 = arg2 = "SendCompletionTable" = arg2
// arg3 = arg3 = 0 = arg3
----------------------------------------------------------*/
#ifndef _clog_4_ARGS_TRACE_AllocFailure
#define _clog_4_ARGS_TRACE_AllocFailure(uniqueId, encoded_arg_string, arg2, arg3)\
tracepoint(CLOG_DATAPATH_RDMA_RINGBUFFER_C, AllocFailure , arg2, arg3);\

#endif




#ifdef __cplusplus
}
#endif
#ifdef CLOG_INLINE_IMPLEMENTATION
#include "quic.clog_datapath_rdma_ringbuffer.c.clog.h.c"
#endif
23 changes: 23 additions & 0 deletions src/generated/linux/datapath_rdma_ringbuffer.c.clog.h.lttng.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@



/*----------------------------------------------------------
// Decoder Ring for AllocFailure
// Allocation of '%s' failed. (%llu bytes)
// QuicTraceEvent(
AllocFailure,
"Allocation of '%s' failed. (%llu bytes)",
"SendCompletionTable",
0);
// arg2 = arg2 = "SendCompletionTable" = arg2
// arg3 = arg3 = 0 = arg3
----------------------------------------------------------*/
TRACEPOINT_EVENT(CLOG_DATAPATH_RDMA_RINGBUFFER_C, AllocFailure,
TP_ARGS(
const char *, arg2,
unsigned long long, arg3),
TP_FIELDS(
ctf_string(arg2, arg2)
ctf_integer(uint64_t, arg3, arg3)
)
)
Loading