/// <summary> /// Send data over RDMA /// </summary> /// <param name="data"></param> /// <returns></returns> public NtStatus SendData(byte[] data) { RdmaSegment sge = new RdmaSegment(); sge.Length = (uint)data.LongLength; sge.MemoryHandler = 0; // register memory rdmaAdapter.RegisterMemory(sge.Length, out sge.MemoryHandler); // Write data to memory RdmaEndpoint.WriteToMemory(sge.MemoryHandler, data); // send UInt64 resultId; NtStatus status = (NtStatus)rdmaEndpoint.Send(new RdmaSegment[] { sge }, out resultId); if (status != NtStatus.STATUS_SUCCESS) { return(status); } // send request has been submitted requestCount++; rdmaNotificationSemaphore.Release(); // get the notification SmbdRequestResult item = GetRequestResult(new TimeSpan(0, 0, 5), RequestType.Send); this.LogEvent(string.Format("Send data with result id: 0x{0:X}. And get notification with id: 0x{1:X}, status: {2}", resultId, item.ResultId, item.ResultInfo.Status )); // deregister memory rdmaAdapter.DeregisterMemory(sge.MemoryHandler); return((NtStatus)item.ResultInfo.Status); }
/// <summary> /// Send data over RDMA /// </summary> /// <param name="data"></param> /// <returns></returns> public NtStatus SendData(byte[] data) { RdmaSegment sge = new RdmaSegment(); sge.Length = (uint)data.LongLength; sge.MemoryHandler = 0; // register memory rdmaAdapter.RegisterMemory(sge.Length, out sge.MemoryHandler); // Write data to memory RdmaEndpoint.WriteToMemory(sge.MemoryHandler, data); // send UInt64 resultId; NtStatus status = (NtStatus)rdmaEndpoint.Send(new RdmaSegment[] { sge }, out resultId); if (status != NtStatus.STATUS_SUCCESS) { return status; } // send request has been submitted requestCount++; rdmaNotificationSemaphore.Release(); // get the notification SmbdRequestResult item = GetRequestResult(new TimeSpan(0, 0, 5), RequestType.Send); this.LogEvent(string.Format("Send data with result id: 0x{0:X}. And get notification with id: 0x{1:X}, status: {2}", resultId, item.ResultId, item.ResultInfo.Status )); // deregister memory rdmaAdapter.DeregisterMemory(sge.MemoryHandler); return (NtStatus)item.ResultInfo.Status; }