[ofw] [Patch 62/62] Reference implementation of NDv2
Fab Tillier
ftillier at microsoft.com
Wed Feb 20 21:17:42 PST 2013
MLX4ND: Fix asserts, leaked file handles, QP creation with SRQ.
Signed-off-by: Fab Tillier <ftillier at microsoft.com>
diff -dup3 -X excl.txt -I ^ \*$ -I ^ \* \$ -r \dev\openib\Mellanox\11011\hw\mlx4\user\nd\adapter.cpp .\hw\mlx4\user\nd\adapter.cpp
--- \dev\openib\Mellanox\11011\hw\mlx4\user\nd\adapter.cpp Thu Sep 20 16:51:16 2012
+++ .\hw\mlx4\user\nd\adapter.cpp Wed Oct 31 14:39:38 2012
@@ -685,7 +685,8 @@ namespace v1
Adapter::Adapter(Provider& provider, v2::Adapter& adapter)
: m_Provider(provider),
- m_Adapter(adapter)
+ m_Adapter(adapter),
+ m_hAsync(INVALID_HANDLE_VALUE)
{
provider.AddRef();
adapter.AddRef();
@@ -696,6 +697,10 @@ Adapter::Adapter(Provider& provider, v2:
Adapter::~Adapter(void)
{
+ if( m_hAsync != INVALID_HANDLE_VALUE )
+ {
+ CloseHandle( m_hAsync );
+ }
DeleteCriticalSection(&m_MrLock);
m_Adapter.Release();
m_Provider.Release();
diff -dup3 -X excl.txt -I ^ \*$ -I ^ \* \$ -r \dev\openib\Mellanox\11011\hw\mlx4\user\nd\main.h .\hw\mlx4\user\nd\main.h
--- \dev\openib\Mellanox\11011\hw\mlx4\user\nd\main.h Thu Sep 20 16:51:16 2012
+++ .\hw\mlx4\user\nd\main.h Tue Nov 06 16:08:53 2012
@@ -31,8 +31,17 @@
#if DBG
extern LONG g_nRef[ND_RESOURCE_TYPE_COUNT];
+
+#ifndef ASSERT
+#define ASSERT( expr ) ((!!(expr))? 0 : __debugbreak())
+#endif // ASSERT
+
#else
extern LONG g_nRef[1];
+
+#ifndef ASSERT
+#define ASSERT( expr )
+#endif // ASSERT
#endif
class ListEntry
diff -dup3 -X excl.txt -I ^ \*$ -I ^ \* \$ -r \dev\openib\Mellanox\11011\hw\mlx4\user\nd\precomp.h .\hw\mlx4\user\nd\precomp.h
--- \dev\openib\Mellanox\11011\hw\mlx4\user\nd\precomp.h Thu Sep 20 16:51:16 2012
+++ .\hw\mlx4\user\nd\precomp.h Tue Nov 06 16:10:59 2012
@@ -34,7 +34,6 @@
#include <tchar.h>
#include <limits.h>
#include <unknwn.h>
-#include <assert.h>
#include <winioctl.h>
#include <winternl.h>
#include <ws2tcpip.h>
@@ -53,9 +52,9 @@
#include "mx_abi.h"
#include "verbs.h"
+#include "main.h"
#include "unknown.h"
#include "overlapped.h"
-#include "main.h"
#include "factory.h"
#include "provider.h"
#include "adapter.h"
diff -dup3 -X excl.txt -I ^ \*$ -I ^ \* \$ -r \dev\openib\Mellanox\11011\hw\mlx4\user\nd\provider.cpp .\hw\mlx4\user\nd\provider.cpp
--- \dev\openib\Mellanox\11011\hw\mlx4\user\nd\provider.cpp Thu Sep 20 16:51:16 2012
+++ .\hw\mlx4\user\nd\provider.cpp Tue Nov 06 16:13:13 2012
@@ -145,7 +145,7 @@ void Provider::FreeHandle( UINT64 handle
in.Reserved = 0;
in.Handle = handle;
HRESULT hr = Ioctl(ctlCode, &in, sizeof(in));
- assert( SUCCEEDED(hr) );
+ ASSERT( SUCCEEDED(hr) );
UNREFERENCED_PARAMETER(hr);
}
diff -dup3 -X excl.txt -I ^ \*$ -I ^ \* \$ -r \dev\openib\Mellanox\11011\hw\mlx4\user\nd\qp.cpp .\hw\mlx4\user\nd\qp.cpp
--- \dev\openib\Mellanox\11011\hw\mlx4\user\nd\qp.cpp Thu Sep 20 16:51:16 2012
+++ .\hw\mlx4\user\nd\qp.cpp Tue Nov 06 16:00:03 2012
@@ -143,13 +143,17 @@ HRESULT Qp::Initialize(
createQp.ioctl.hdr.ReceiveCqHandle = m_ReceiveCq.GetHandle();
createQp.ioctl.hdr.InitiatorCqHandle = m_InitiatorCq.GetHandle();;
createQp.ioctl.hdr.PdHandle = m_Adapter.GetPdHandle();
+
+ DWORD ioctlCode;
if( m_pSrq != NULL )
{
+ ioctlCode = IOCTL_ND_QP_CREATE_WITH_SRQ;
attr.qp_create.h_srq = m_pSrq->GetUvpSrq();
createQp.ioctl.inSrq.SrqHandle = m_pSrq->GetHandle();
}
else
{
+ ioctlCode = IOCTL_ND_QP_CREATE;
attr.qp_create.h_srq = NULL;
createQp.ioctl.in.ReceiveQueueDepth = receiveQueueDepth;
createQp.ioctl.in.MaxReceiveRequestSge = maxReceiveRequestSge;
@@ -187,7 +191,7 @@ HRESULT Qp::Initialize(
ULONG cbOut = sizeof(createQp.ioctl) + sizeof(createQp.dev.resp);
HRESULT hr = m_Adapter.GetProvider().Ioctl(
- IOCTL_ND_QP_CREATE,
+ ioctlCode,
&createQp,
sizeof(createQp.ioctl) + sizeof(createQp.dev.req),
&createQp,
@@ -717,7 +721,7 @@ TranslateSge(
__out ND_RESULT* pResult
)
{
- assert(nSge <= Adapter::_MaxSge);
+ ASSERT(nSge <= Adapter::_MaxSge);
pResult->BytesTransferred = 0;
for( SIZE_T i = 0; i < nSge; i++ )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.62.patch
Type: application/octet-stream
Size: 4163 bytes
Desc: ndv2.62.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/748f7eb1/attachment.obj>
More information about the ofw
mailing list