[ofw] [PATCH 6/12] nd2: implement MR overlap calls
Hefty, Sean
sean.hefty at intel.com
Tue Jul 27 00:57:49 PDT 2010
Track overlapped registration requests and cancel them independently from
the winverbs protection domain.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
trunk/ulp/netdirect2/user/nd_mw.cpp | 21 ++++++++++++++++++---
trunk/ulp/netdirect2/user/nd_mw.h | 1 +
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/trunk/ulp/netdirect2/user/nd_mw.cpp b/trunk/ulp/netdirect2/user/nd_mw.cpp
index 89ed1a7..f6a85bf 100644
--- a/trunk/ulp/netdirect2/user/nd_mw.cpp
+++ b/trunk/ulp/netdirect2/user/nd_mw.cpp
@@ -35,6 +35,7 @@ CNDMemoryRegion::CNDMemoryRegion(CNDAdapter *pAdapter)
pAdapter->AddRef();
m_pAdapter = pAdapter;
RtlZeroMemory(&m_Keys, sizeof(m_Keys));
+ m_pOverlapped = NULL;
}
CNDMemoryRegion::~CNDMemoryRegion()
@@ -70,13 +71,26 @@ Release(void)
STDMETHODIMP CNDMemoryRegion::
CancelOverlappedRequests(void)
{
- return ND_NOT_SUPPORTED;
+ if (m_pOverlapped != NULL) {
+ CancelIoEx(m_pAdapter->GetFileHandle(), m_pOverlapped);
+ }
+
+ return ND_SUCCESS;
}
STDMETHODIMP CNDMemoryRegion::
GetOverlappedResult(OVERLAPPED *pOverlapped, BOOL bWait)
{
- return ND_NOT_SUPPORTED;
+ DWORD bytes;
+ HRESULT hr;
+
+ hr = NDConvertWVStatus(m_pAdapter->m_pWvPd->
+ GetOverlappedResult(pOverlapped, &bytes, bWait));
+ if (hr != ND_PENDING) {
+ m_pOverlapped = NULL;
+ }
+
+ return hr;
}
DWORD ConvertAccessFlags(DWORD Flags)
@@ -98,6 +112,7 @@ Register(const VOID* pBuffer, SIZE_T cbBuffer, DWORD flags, OVERLAPPED* pOverlap
{
HRESULT hr;
+ m_pOverlapped = pOverlapped;
hr = m_pAdapter->m_pWvPd->RegisterMemory(pBuffer, cbBuffer, ConvertAccessFlags(flags),
pOverlapped, &m_Keys);
return NDConvertWVStatus(hr);
@@ -108,7 +123,7 @@ Deregister(OVERLAPPED* pOverlapped)
{
HRESULT hr;
- //??? if the lkey is not unique, we need to change this
+ m_pOverlapped = pOverlapped;
hr = m_pAdapter->m_pWvPd->DeregisterMemory(m_Keys.Lkey, pOverlapped);
return NDConvertWVStatus(hr);
}
diff --git a/trunk/ulp/netdirect2/user/nd_mw.h b/trunk/ulp/netdirect2/user/nd_mw.h
index f4b9fb3..eb0bbc9 100644
--- a/trunk/ulp/netdirect2/user/nd_mw.h
+++ b/trunk/ulp/netdirect2/user/nd_mw.h
@@ -83,6 +83,7 @@ public:
protected:
CNDAdapter *m_pAdapter;
+ OVERLAPPED *m_pOverlapped;
};
More information about the ofw
mailing list