public void ConnectOverRDMA(string localIpAddress, string remoteIpAddress, int port, uint maxReceiveSize, out RdmaAdapterInfo adapterInfo)
        {
            NtStatus status;

            RdmaProviderInfo[] providers;
            status = (NtStatus)RdmaProvider.LoadRdmaProviders(out providers);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                throw new InvalidOperationException("Failed to load RDMA providers!");
            }

            RdmaAdapter adapter = null;

            foreach (var provider in providers)
            {
                if (provider.Provider == null)
                {
                    continue;
                }
                RdmaAdapter outputAdapter;
                status = (NtStatus)provider.Provider.OpenAdapter(localIpAddress, (short)AddressFamily.InterNetwork, out outputAdapter);
                if (status == NtStatus.STATUS_SUCCESS)
                {
                    adapter = outputAdapter;
                    break;
                }
            }

            if (adapter == null)
            {
                throw new InvalidOperationException("Failed to find the specified RDMA adapter!");
            }

            status = (NtStatus)adapter.Query(out adapterInfo);
            if (status != (int)NtStatus.STATUS_SUCCESS)
            {
                throw new InvalidOperationException("Failed to query RDMA provider info!");
            }


            status = smbdClient.ConnectToServerOverRdma(
                localIpAddress,
                remoteIpAddress,
                port,
                AddressFamily.InterNetwork,
                adapterInfo.MaxInboundRequests,
                adapterInfo.MaxOutboundRequests,
                adapterInfo.MaxInboundReadLimit,
                maxReceiveSize
                );

            if (status != NtStatus.STATUS_SUCCESS)
            {
                throw new InvalidOperationException("ConnectToServerOverRdma failed!");
            }

            decoder.TransportType = Smb2TransportType.Rdma;
        }
Пример #2
0
 public NtStatus ConnectToServerOverRDMA(
     string clientIp,
     string serverIp,
     int port,
     AddressFamily ipFamily,
     uint nInboundEntries,
     uint nOutboundEntries,
     uint inboundReadLimit,
     uint inboundDataSize
     )
 {
     this.decoder.TransportType = Smb2TransportType.Rdma;
     messageId = 0;
     return(smbdClient.ConnectToServerOverRdma(
                clientIp,
                serverIp,
                port,
                ipFamily,
                nInboundEntries,
                nOutboundEntries,
                inboundReadLimit,
                inboundDataSize
                ));
 }