From cbfd5da6e6171e0c2b4e1ad5206de2f8333fc762 Mon Sep 17 00:00:00 2001 From: shefty Date: Wed, 25 Feb 2009 19:30:29 +0000 Subject: [PATCH] winverbs branch: mass collection of various changes... Chnages to support ib-diags, perftest updates, and winverb fixes... Changes will be broken out when submitting into trunk. Signed-off-by: Sean Hefty git-svn-id: svn://openib.tc.cornell.edu/gen1@1990 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- branches/winverbs/core/al/al_query.c | 4 +- branches/winverbs/core/al/kernel/al_ioc_pnp.c | 3 +- branches/winverbs/core/complib/user/SOURCES | 6 +- .../core/complib/user/cl_nodenamemap.c | 5 +- .../winverbs/core/winmad/kernel/wm_driver.c | 4 - .../winverbs/core/winmad/kernel/wm_provider.c | 4 +- branches/winverbs/core/winmad/user/SOURCES | 7 +- .../winverbs/core/winmad/user/wm_provider.cpp | 6 +- .../winverbs/core/winverbs/user/wv_cq.cpp | 4 +- .../winverbs/core/winverbs/user/wv_device.cpp | 4 +- .../winverbs/core/winverbs/user/wv_ep.cpp | 8 +- .../winverbs/core/winverbs/user/wv_qp.cpp | 12 +- .../winverbs/core/winverbs/user/wv_srq.cpp | 4 +- branches/winverbs/docs/generate-patch.txt | 2 +- branches/winverbs/etc/user/event_channel.cpp | 7 +- branches/winverbs/etc/user/getopt.c | 4 - branches/winverbs/inc/iba/ib_types.h | 2 - .../inc/user/{rdma => }/event_channel.h | 2 - branches/winverbs/inc/user/linux/_string.h | 44 +++++++ branches/winverbs/inc/user/linux/arpa/inet.h | 43 +++++++ branches/winverbs/inc/user/linux/inttypes.h | 37 ++++++ branches/winverbs/inc/user/linux/netinet/in.h | 37 ++++++ branches/winverbs/inc/user/linux/unistd.h | 55 +++++++++ .../winverbs/tests/perftest/rdma_bw/SOURCES | 10 +- .../winverbs/tests/perftest/rdma_bw/rdma_bw.c | 27 ++-- .../winverbs/tests/perftest/rdma_lat/SOURCES | 8 +- .../tests/perftest/rdma_lat/rdma_lat.c | 44 +------ .../winverbs/tests/perftest/read_bw/SOURCES | 7 +- .../winverbs/tests/perftest/read_bw/read_bw.c | 21 +--- .../winverbs/tests/perftest/read_lat/SOURCES | 7 +- .../tests/perftest/read_lat/read_lat.c | 39 +----- .../winverbs/tests/perftest/send_bw/SOURCES | 7 +- .../winverbs/tests/perftest/send_bw/send_bw.c | 30 ++--- .../winverbs/tests/perftest/send_lat/SOURCES | 7 +- .../tests/perftest/send_lat/send_lat.c | 43 +------ .../winverbs/tests/perftest/write_bw/SOURCES | 7 +- .../tests/perftest/write_bw/write_bw.c | 115 +++++++++--------- .../winverbs/tests/perftest/write_lat/SOURCES | 7 +- .../tests/perftest/write_lat/write_lat.c | 42 +------ .../infiniband-diags/include/windows/config.h | 4 +- .../tools/infiniband-diags/src/saquery.c | 10 +- branches/winverbs/ulp/libibumad/src/umad.cpp | 6 +- branches/winverbs/ulp/librdmacm/src/cma.cpp | 9 +- 43 files changed, 384 insertions(+), 370 deletions(-) rename branches/winverbs/inc/user/{rdma => }/event_channel.h (96%) create mode 100644 branches/winverbs/inc/user/linux/_string.h create mode 100644 branches/winverbs/inc/user/linux/arpa/inet.h create mode 100644 branches/winverbs/inc/user/linux/inttypes.h create mode 100644 branches/winverbs/inc/user/linux/netinet/in.h create mode 100644 branches/winverbs/inc/user/linux/unistd.h diff --git a/branches/winverbs/core/al/al_query.c b/branches/winverbs/core/al/al_query.c index 5e36c4c7..d382e065 100644 --- a/branches/winverbs/core/al/al_query.c +++ b/branches/winverbs/core/al/al_query.c @@ -241,7 +241,7 @@ query_sa( sa_req.attr_id = IB_MAD_ATTR_PATH_RECORD; sa_req.attr_size = sizeof( ib_path_rec_t ); sa_req.comp_mask = (IB_PR_COMPMASK_DGID | - IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUM_PATH); + IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH); sa_req.p_attr = &rec.path; ib_gid_set_default( &rec.path.dgid, ((ib_guid_pair_t*) (p_query_req->p_query_input))->dest_guid ); @@ -255,7 +255,7 @@ query_sa( sa_req.attr_id = IB_MAD_ATTR_PATH_RECORD; sa_req.attr_size = sizeof( ib_path_rec_t ); sa_req.comp_mask = (IB_PR_COMPMASK_DGID | - IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUM_PATH); + IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH); sa_req.p_attr = &rec.path; cl_memcpy( &rec.path.dgid, &((ib_gid_pair_t*) (p_query_req->p_query_input))->dest_gid, sizeof( ib_gid_t ) ); diff --git a/branches/winverbs/core/al/kernel/al_ioc_pnp.c b/branches/winverbs/core/al/kernel/al_ioc_pnp.c index 61252349..9366a38a 100644 --- a/branches/winverbs/core/al/kernel/al_ioc_pnp.c +++ b/branches/winverbs/core/al/kernel/al_ioc_pnp.c @@ -1569,8 +1569,7 @@ __ioc_query_sa( info.method = IB_MAD_METHOD_GETTABLE; info.attr_id = IB_MAD_ATTR_PATH_RECORD; info.attr_size = sizeof(ib_path_rec_t); - info.comp_mask = IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUM_PATH; - info.comp_mask = IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUM_PATH | + info.comp_mask = IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH | IB_PR_COMPMASK_PKEY; info.p_attr = &u.path_rec; diff --git a/branches/winverbs/core/complib/user/SOURCES b/branches/winverbs/core/complib/user/SOURCES index e5a872c2..e82ab435 100644 --- a/branches/winverbs/core/complib/user/SOURCES +++ b/branches/winverbs/core/complib/user/SOURCES @@ -13,7 +13,7 @@ DLLDEF=$O\complib.def # WDK DLLDEF=$(OBJ_PATH)\$O\complib.def !endif -USE_MSVCRT=1 +USE_NTDLL=1 SOURCES=\ complib.rc \ @@ -39,10 +39,12 @@ SOURCES=\ ..\cl_threadpool.c \ ..\cl_vector.c \ -INCLUDES=..\..\..\inc;..\..\..\inc\user; +INCLUDES=..\..\..\inc;..\..\..\inc\user;..\..\..\inc\user\linux; USER_C_FLAGS=$(USER_C_FLAGS) -DEXPORT_CL_SYMBOLS TARGETLIBS=\ $(SDK_LIB_PATH)\advapi32.lib \ $(SDK_LIB_PATH)\kernel32.lib + +MSC_WARNING_LEVEL= /W4 diff --git a/branches/winverbs/core/complib/user/cl_nodenamemap.c b/branches/winverbs/core/complib/user/cl_nodenamemap.c index 1fdd5ea2..c3b6d65d 100644 --- a/branches/winverbs/core/complib/user/cl_nodenamemap.c +++ b/branches/winverbs/core/complib/user/cl_nodenamemap.c @@ -35,14 +35,11 @@ #include #include -#include +#include <_string.h> #include #include -#define strtoull _strtoui64 -#define strdup _strdup - static int map_name(void *cxt, uint64_t guid, char *p) { cl_qmap_t *map = cxt; diff --git a/branches/winverbs/core/winmad/kernel/wm_driver.c b/branches/winverbs/core/winmad/kernel/wm_driver.c index 91f6dbb3..52245ab4 100644 --- a/branches/winverbs/core/winmad/kernel/wm_driver.c +++ b/branches/winverbs/core/winmad/kernel/wm_driver.c @@ -413,7 +413,3 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) return STATUS_SUCCESS; } - - - - diff --git a/branches/winverbs/core/winmad/kernel/wm_provider.c b/branches/winverbs/core/winmad/kernel/wm_provider.c index 7efdba3d..2970c882 100644 --- a/branches/winverbs/core/winmad/kernel/wm_provider.c +++ b/branches/winverbs/core/winmad/kernel/wm_provider.c @@ -277,7 +277,7 @@ void WmProviderRead(WM_PROVIDER *pProvider, WDFREQUEST Request) len = outlen; status = WmCopyRead(pProvider, wmad, pProvider->MadHead, &len); - if (NT_SUCCESS(status)) { + if (status == STATUS_SUCCESS) { reg = (WM_REGISTRATION *) pProvider->MadHead->send_context1; reg->pDevice->IbInterface.put_mad(WmRemoveMad(pProvider)); } @@ -389,7 +389,7 @@ void WmReceiveHandler(ib_mad_svc_handle_t hService, void *Context, } status = WmCopyRead(prov, wmad, pMad, &len); - if (NT_SUCCESS(status)) { + if (status == STATUS_SUCCESS) { reg = (WM_REGISTRATION *) pMad->send_context1; reg->pDevice->IbInterface.put_mad(pMad); } else { diff --git a/branches/winverbs/core/winmad/user/SOURCES b/branches/winverbs/core/winmad/user/SOURCES index 7fed2a15..7d3d7c57 100644 --- a/branches/winverbs/core/winmad/user/SOURCES +++ b/branches/winverbs/core/winmad/user/SOURCES @@ -14,12 +14,9 @@ DLLDEF = $(OBJ_PATH)\$O\wm_exports.def !endif DLLENTRY = DllMain -USE_MSVCRT = 1 +USE_NTDLL = 1 -SOURCES = \ - winmad.rc \ - wm_main.cpp \ - wm_provider.cpp +SOURCES = winmad.rc wm_main.cpp wm_provider.cpp INCLUDES = ..;..\..\..\inc;..\..\..\inc\user; diff --git a/branches/winverbs/core/winmad/user/wm_provider.cpp b/branches/winverbs/core/winmad/user/wm_provider.cpp index e5f99ca2..fb5efead 100644 --- a/branches/winverbs/core/winmad/user/wm_provider.cpp +++ b/branches/winverbs/core/winmad/user/wm_provider.cpp @@ -112,8 +112,8 @@ STDMETHODIMP CWMProvider:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return ::GetOverlappedResult(m_hFile, pOverlapped, - pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP_(HANDLE) CWMProvider:: @@ -136,7 +136,7 @@ WmDeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, &m_OverlapWrite); - ret = GetOverlappedResult(&m_OverlapWrite, lpBytesReturned, TRUE); + ret = ::GetOverlappedResult(m_hFile, &m_OverlapWrite, lpBytesReturned, TRUE); LeaveCriticalSection(&m_CritSecWrite); } else { ret = DeviceIoControl(hDevice, dwIoControlCode, diff --git a/branches/winverbs/core/winverbs/user/wv_cq.cpp b/branches/winverbs/core/winverbs/user/wv_cq.cpp index 9ce1d9a3..3816efc3 100644 --- a/branches/winverbs/core/winverbs/user/wv_cq.cpp +++ b/branches/winverbs/core/winverbs/user/wv_cq.cpp @@ -148,8 +148,8 @@ STDMETHODIMP CWVCompletionQueue:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return ::GetOverlappedResult(m_hFile, pOverlapped, - pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP CWVCompletionQueue:: diff --git a/branches/winverbs/core/winverbs/user/wv_device.cpp b/branches/winverbs/core/winverbs/user/wv_device.cpp index 4034ef58..1038be8f 100644 --- a/branches/winverbs/core/winverbs/user/wv_device.cpp +++ b/branches/winverbs/core/winverbs/user/wv_device.cpp @@ -181,8 +181,8 @@ STDMETHODIMP CWVDevice:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return ::GetOverlappedResult(m_hFile, pOverlapped, - pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP CWVDevice:: diff --git a/branches/winverbs/core/winverbs/user/wv_ep.cpp b/branches/winverbs/core/winverbs/user/wv_ep.cpp index ddf64670..9c0513c6 100644 --- a/branches/winverbs/core/winverbs/user/wv_ep.cpp +++ b/branches/winverbs/core/winverbs/user/wv_ep.cpp @@ -125,8 +125,8 @@ STDMETHODIMP CWVConnectEndpoint:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return ::GetOverlappedResult(m_hFile, pOverlapped, - pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP CWVConnectEndpoint:: @@ -473,8 +473,8 @@ STDMETHODIMP CWVDatagramEndpoint:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return ::GetOverlappedResult(m_hFile, pOverlapped, - pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP CWVDatagramEndpoint:: diff --git a/branches/winverbs/core/winverbs/user/wv_qp.cpp b/branches/winverbs/core/winverbs/user/wv_qp.cpp index 5946ac82..e33841aa 100644 --- a/branches/winverbs/core/winverbs/user/wv_qp.cpp +++ b/branches/winverbs/core/winverbs/user/wv_qp.cpp @@ -349,8 +349,8 @@ STDMETHODIMP CWVQueuePair:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return ::GetOverlappedResult(m_hFile, pOverlapped, - pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP CWVQueuePair:: @@ -474,8 +474,8 @@ STDMETHODIMP CWVConnectQueuePair:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return CWVQueuePair:: - GetOverlappedResult(pOverlapped, pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP CWVConnectQueuePair:: @@ -666,8 +666,8 @@ STDMETHODIMP CWVDatagramQueuePair:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return CWVQueuePair:: - GetOverlappedResult(pOverlapped, pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP CWVDatagramQueuePair:: diff --git a/branches/winverbs/core/winverbs/user/wv_srq.cpp b/branches/winverbs/core/winverbs/user/wv_srq.cpp index 32d5ebe0..519a75e1 100644 --- a/branches/winverbs/core/winverbs/user/wv_srq.cpp +++ b/branches/winverbs/core/winverbs/user/wv_srq.cpp @@ -152,8 +152,8 @@ STDMETHODIMP CWVSharedReceiveQueue:: GetOverlappedResult(OVERLAPPED *pOverlapped, DWORD *pNumberOfBytesTransferred, BOOL bWait) { - return ::GetOverlappedResult(m_hFile, pOverlapped, - pNumberOfBytesTransferred, bWait); + ::GetOverlappedResult(m_hFile, pOverlapped, pNumberOfBytesTransferred, bWait); + return (HRESULT) pOverlapped->Internal; } STDMETHODIMP CWVSharedReceiveQueue:: diff --git a/branches/winverbs/docs/generate-patch.txt b/branches/winverbs/docs/generate-patch.txt index 65293024..3210baba 100644 --- a/branches/winverbs/docs/generate-patch.txt +++ b/branches/winverbs/docs/generate-patch.txt @@ -4,7 +4,7 @@ by comparing two branches using a 'diff' program (e.g. GnuWin32 'diff'), the following syntax will help produce patches that are more easily reviewable: -diff -up -r -X docs\dontdiff.txt -I \$Id: old_path new_path +diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old_path new_path For full diff syntax information, see the diff documentation, but as a summary: diff --git a/branches/winverbs/etc/user/event_channel.cpp b/branches/winverbs/etc/user/event_channel.cpp index 54a1bb26..ab69f2e3 100644 --- a/branches/winverbs/etc/user/event_channel.cpp +++ b/branches/winverbs/etc/user/event_channel.cpp @@ -27,7 +27,7 @@ * SOFTWARE. */ -#include +#include /* * Double the size of the event array. The events in the second half of the @@ -53,6 +53,7 @@ EVENT_CHANNEL *EventChannelCreate(DWORD Size) return NULL; } + RtlZeroMemory(channel, bytes); channel->EventArray = (HANDLE *) (channel + 1); channel->WaitLists = (EVENT_ENTRY **) (&channel->EventArray[Size * 2]); channel->Count = (DWORD *) (&channel->WaitLists[Size]); @@ -66,12 +67,8 @@ EVENT_CHANNEL *EventChannelCreate(DWORD Size) } InitializeCriticalSection(&channel->Lock); - RtlZeroMemory(channel->WaitLists, Size * sizeof(*channel->WaitLists)); - RtlZeroMemory(channel->Count, Size * sizeof(*channel->Count)); - channel->DoneList = NULL; channel->Count[0] = 1; channel->Size = Size; - channel->Offset = 0; return channel; diff --git a/branches/winverbs/etc/user/getopt.c b/branches/winverbs/etc/user/getopt.c index a8b75c2f..9e05699b 100644 --- a/branches/winverbs/etc/user/getopt.c +++ b/branches/winverbs/etc/user/getopt.c @@ -79,10 +79,6 @@ int getopt(int argc, char * const argv[], char const *opts) goto out; optarg = argv[++optind]; - while(optarg && *optarg && (*optarg == ' ' || *optarg == ' ')) { - optarg++; - } - if (!optarg || !(*optarg)) { return '?'; } diff --git a/branches/winverbs/inc/iba/ib_types.h b/branches/winverbs/inc/iba/ib_types.h index e1efacbc..2d86569b 100644 --- a/branches/winverbs/inc/iba/ib_types.h +++ b/branches/winverbs/inc/iba/ib_types.h @@ -2434,11 +2434,9 @@ typedef __declspec(align(8)) struct _ib_path_rec #define IB_PR_COMPMASK_HOPLIMIT (CL_HTON64(((uint64_t)1)<<9)) #define IB_PR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<10)) #define IB_PR_COMPMASK_REVERSIBLE (CL_HTON64(((uint64_t)1)<<11)) -#define IB_PR_COMPMASK_NUM_PATH (CL_HTON64(((uint64_t)1)<<12)) #define IB_PR_COMPMASK_NUMBPATH (CL_HTON64(((uint64_t)1)<<12)) #define IB_PR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<13)) #define IB_PR_COMPMASK_QOS_CLASS (CL_HTON64(((uint64_t)1)<<14)) -#define IB_PR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<14)) #define IB_PR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<15)) #define IB_PR_COMPMASK_MTUSELEC (CL_HTON64(((uint64_t)1)<<16)) #define IB_PR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<17)) diff --git a/branches/winverbs/inc/user/rdma/event_channel.h b/branches/winverbs/inc/user/event_channel.h similarity index 96% rename from branches/winverbs/inc/user/rdma/event_channel.h rename to branches/winverbs/inc/user/event_channel.h index 7d1b02aa..11463c83 100644 --- a/branches/winverbs/inc/user/rdma/event_channel.h +++ b/branches/winverbs/inc/user/event_channel.h @@ -38,7 +38,6 @@ extern "C" { #endif - typedef struct _EVENT_ENTRY { struct _EVENT_ENTRY *Next; @@ -73,7 +72,6 @@ void EventChannelReleaseEntry(EVENT_CHANNEL *pChannel, EVENT_ENTRY *pEntry); HRESULT EventChannelWait(EVENT_CHANNEL *pChannel, EVENT_ENTRY **ppEntry, DWORD Timeout); - #ifdef __cplusplus } #endif diff --git a/branches/winverbs/inc/user/linux/_string.h b/branches/winverbs/inc/user/linux/_string.h new file mode 100644 index 00000000..449dd899 --- /dev/null +++ b/branches/winverbs/inc/user/linux/_string.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2009 Intel Corp, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __STRING_H_ +#define __STRING_H_ + +#include + +#define strdup _strdup +#define strdupa _strdup +#define strncasecmp _strnicmp +#define strtoull _strtoui64 + +#endif /* __STRING_H_ */ diff --git a/branches/winverbs/inc/user/linux/arpa/inet.h b/branches/winverbs/inc/user/linux/arpa/inet.h new file mode 100644 index 00000000..2c7b53c3 --- /dev/null +++ b/branches/winverbs/inc/user/linux/arpa/inet.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2009 Intel Corp, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _INET_H_ +#define _INET_H_ + +#include + +#if WINVER < 0x600 +int inet_pton(int af, const char *src, void *dst); +#endif + +#endif /* _INET_H_ */ diff --git a/branches/winverbs/inc/user/linux/inttypes.h b/branches/winverbs/inc/user/linux/inttypes.h new file mode 100644 index 00000000..19776665 --- /dev/null +++ b/branches/winverbs/inc/user/linux/inttypes.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Intel Corp, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _INTTYPES_H_ +#define _INTTYPES_H_ + +#endif /* _INTTYPES_H_ */ diff --git a/branches/winverbs/inc/user/linux/netinet/in.h b/branches/winverbs/inc/user/linux/netinet/in.h new file mode 100644 index 00000000..4c84a6b7 --- /dev/null +++ b/branches/winverbs/inc/user/linux/netinet/in.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Intel Corp, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _IN_H_ +#define _IN_H_ + +#endif /* _IN_H_ */ diff --git a/branches/winverbs/inc/user/linux/unistd.h b/branches/winverbs/inc/user/linux/unistd.h new file mode 100644 index 00000000..6d17e37a --- /dev/null +++ b/branches/winverbs/inc/user/linux/unistd.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009 Intel Corp, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#include + +#define sleep(s) SleepEx(s * 1000, TRUE) + +static __inline int getdomainname(char *name, size_t len) +{ + return -1; +} + +static __inline char* getpass(char *message) +{ + static char password[128]; + + printf("%s", message); + scanf_s("%127s", password, 128); + return password; +} + +#endif /* _UNISTD_H_ */ diff --git a/branches/winverbs/tests/perftest/rdma_bw/SOURCES b/branches/winverbs/tests/perftest/rdma_bw/SOURCES index 6e4ffe1a..f0bbf0e4 100644 --- a/branches/winverbs/tests/perftest/rdma_bw/SOURCES +++ b/branches/winverbs/tests/perftest/rdma_bw/SOURCES @@ -10,11 +10,11 @@ USE_STL = 1 USE_NATIVE_EH = 1 USE_IOSTREAM = 1 -SOURCES = \ - rdma_bw.rc \ - rdma_bw.c +SOURCES = rdma_bw.rc rdma_bw.c ..\perftest.c -INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\ulp\librdmacm\include;..\..\..\inc;..\..\..\inc\user; +INCLUDES = ..;..\..\..\ulp\libibverbs\include;\ + ..\..\..\ulp\librdmacm\include;\ + ..\..\..\inc;..\..\..\inc\user; TARGETLIBS = \ $(SDK_LIB_PATH)\kernel32.lib \ @@ -24,7 +24,7 @@ TARGETLIBS = \ $(SDK_LIB_PATH)\ws2_32.lib \ !if $(FREEBUILD) $(TARGETPATH)\*\libibverbs.lib \ - $(TARGETPATH)\*\librdmacm.lib \ + $(TARGETPATH)\*\librdmacm.lib !else $(TARGETPATH)\*\libibverbsd.lib \ $(TARGETPATH)\*\librdmacmd.lib diff --git a/branches/winverbs/tests/perftest/rdma_bw/rdma_bw.c b/branches/winverbs/tests/perftest/rdma_bw/rdma_bw.c index f91b9920..32afba59 100644 --- a/branches/winverbs/tests/perftest/rdma_bw/rdma_bw.c +++ b/branches/winverbs/tests/perftest/rdma_bw/rdma_bw.c @@ -37,6 +37,7 @@ #include #include "..\..\..\etc\user\getopt.c" +#include "perftest.h" #include #include @@ -88,22 +89,6 @@ static void pp_send_start(struct pingpong_context *); static void pp_close_cma(struct pp_data ); static struct pingpong_context *pp_init_ctx(void *, struct pp_data *); -typedef UINT64 cycles_t; - -static __inline UINT64 get_cycles() -{ - LARGE_INTEGER counter; - QueryPerformanceCounter(&counter); - return counter.QuadPart; -} - -static __inline UINT64 get_freq() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return freq.QuadPart; -} - static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port) { struct ibv_port_attr attr; @@ -842,10 +827,10 @@ static void print_report(unsigned int iters, unsigned size, int duplex, mbytes = (double) tsize * (double) iters / (double) 0x100000; printf("Bandwidth average: %7.2f MB/sec\n", mbytes / sec); - printf("%Service Demand peak (#%d to #%d): %7.2f cycles/KB\n", + printf("Service Demand peak (#%d to #%d): %7.2f cycles/KB\n", opt_posted, opt_completed, (double) opt_delta * 1024. / (double) tsize); - printf("%Service Demand Avg : %7.2f cycles/KB\n", + printf("Service Demand Avg : %7.2f cycles/KB\n", (double) (tcompleted[iters - 1] - tposted[0]) * 1024. / (double) (tsize * iters)); } } @@ -1117,7 +1102,8 @@ int __cdecl main(int argc, char *argv[]) while (scnt < iters && scnt - ccnt < data.tx_depth) { struct ibv_send_wr *bad_wr; - tposted[scnt] = get_cycles(); + if (data.servername) + tposted[scnt] = get_cycles(); if (ibv_post_send(qp, &ctx->wr, &bad_wr)) { fprintf(stderr, "Couldn't post send: scnt=%d\n", scnt); @@ -1133,7 +1119,8 @@ int __cdecl main(int argc, char *argv[]) ne = ibv_poll_cq(ctx->scq, 1, &wc); } while (ne == 0); - tcompleted[ccnt] = get_cycles(); + if (data.servername) + tcompleted[ccnt] = get_cycles(); if (ne < 0) { fprintf(stderr, "poll CQ failed %d\n", ne); diff --git a/branches/winverbs/tests/perftest/rdma_lat/SOURCES b/branches/winverbs/tests/perftest/rdma_lat/SOURCES index 6933bdd4..c1e26ada 100644 --- a/branches/winverbs/tests/perftest/rdma_lat/SOURCES +++ b/branches/winverbs/tests/perftest/rdma_lat/SOURCES @@ -10,11 +10,11 @@ USE_STL = 1 USE_NATIVE_EH = 1 USE_IOSTREAM = 1 -SOURCES = \ - rdma_lat.rc \ - rdma_lat.c +SOURCES = rdma_lat.rc rdma_lat.c ..\perftest.c -INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\ulp\librdmacm\include;..\..\..\inc;..\..\..\inc\user; +INCLUDES = ..;..\..\..\ulp\libibverbs\include;\ + ..\..\..\ulp\librdmacm\include;\ + ..\..\..\inc;..\..\..\inc\user; TARGETLIBS = \ $(SDK_LIB_PATH)\kernel32.lib \ diff --git a/branches/winverbs/tests/perftest/rdma_lat/rdma_lat.c b/branches/winverbs/tests/perftest/rdma_lat/rdma_lat.c index 65b26c62..949ef0c5 100644 --- a/branches/winverbs/tests/perftest/rdma_lat/rdma_lat.c +++ b/branches/winverbs/tests/perftest/rdma_lat/rdma_lat.c @@ -38,6 +38,7 @@ #include #include "..\..\..\etc\user\getopt.c" +#include "perftest.h" #include #include @@ -101,22 +102,6 @@ static void pp_send_start(struct pingpong_context *); static void pp_close_cma(struct pp_data ); static struct pingpong_context *pp_init_ctx(void *, struct pp_data *); -typedef UINT64 cycles_t; - -static __inline UINT64 get_cycles() -{ - LARGE_INTEGER counter; - QueryPerformanceCounter(&counter); - return counter.QuadPart; -} - -static __inline UINT64 get_freq() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return freq.QuadPart; -} - static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port) { struct ibv_port_attr attr; @@ -884,30 +869,6 @@ static void usage(const char *argv0) printf(" -c, --cma Use the RDMA CMA to setup the RDMA connection\n"); } -/* - * When there is an - * odd number of samples, the median is the middle number. - * even number of samples, the median is the mean of the - * two middle numbers. - * - */ -static cycles_t get_median(int n, cycles_t delta[]) -{ - if ((n - 1) % 2) - return (delta[n / 2] + delta[n / 2 - 1]) / 2; - else - return delta[n / 2]; -} - -static int __cdecl cycles_compare(const void * aptr, const void * bptr) -{ - const cycles_t *a = aptr; - const cycles_t *b = bptr; - if (*a < *b) return -1; - if (*a > *b) return 1; - return 0; -} - static void print_report(struct report_options * options, unsigned int iters, cycles_t *tstamp) { @@ -1177,7 +1138,8 @@ int __cdecl main(int argc, char *argv[]) if (scnt < iters) { struct ibv_send_wr *bad_wr; - tstamp[scnt] = get_cycles(); + if (data.servername) + tstamp[scnt] = get_cycles(); *post_buf = (char)++scnt; if (ibv_post_send(qp, wr, &bad_wr)) { diff --git a/branches/winverbs/tests/perftest/read_bw/SOURCES b/branches/winverbs/tests/perftest/read_bw/SOURCES index 63e25c28..0c28233c 100644 --- a/branches/winverbs/tests/perftest/read_bw/SOURCES +++ b/branches/winverbs/tests/perftest/read_bw/SOURCES @@ -10,11 +10,10 @@ USE_STL = 1 USE_NATIVE_EH = 1 USE_IOSTREAM = 1 -SOURCES = \ - read_bw.rc \ - read_bw.c +SOURCES = read_bw.rc read_bw.c ..\perftest.c -INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user; +INCLUDES = ..;..\..\..\ulp\libibverbs\include;\ + ..\..\..\inc;..\..\..\inc\user; TARGETLIBS = \ $(SDK_LIB_PATH)\kernel32.lib \ diff --git a/branches/winverbs/tests/perftest/read_bw/read_bw.c b/branches/winverbs/tests/perftest/read_bw/read_bw.c index 49ca09ca..d3013abb 100644 --- a/branches/winverbs/tests/perftest/read_bw/read_bw.c +++ b/branches/winverbs/tests/perftest/read_bw/read_bw.c @@ -37,6 +37,7 @@ #include #include "..\..\..\etc\user\getopt.c" +#include "perftest.h" #include #define PINGPONG_READ_WRID 1 @@ -81,20 +82,6 @@ struct pingpong_dest { unsigned long long vaddr; }; -static __inline UINT64 get_cycles() -{ - LARGE_INTEGER counter; - QueryPerformanceCounter(&counter); - return counter.QuadPart; -} - -static __inline UINT64 get_freq() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return freq.QuadPart; -} - static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port) { struct ibv_port_attr attr; @@ -541,7 +528,8 @@ static int run_iter(struct pingpong_context *ctx, struct user_parameters *user_p while (scnt < user_param->iters || ccnt < user_param->iters) { while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth ) { struct ibv_send_wr *bad_wr; - tposted[scnt] = get_cycles(); + if (user_param->servername) + tposted[scnt] = get_cycles(); if (ibv_post_send(qp, &ctx->wr, &bad_wr)) { fprintf(stderr, "Couldn't post send: scnt=%d\n", scnt); @@ -571,7 +559,8 @@ static int run_iter(struct pingpong_context *ctx, struct user_parameters *user_p do { ne = ibv_poll_cq(ctx->cq, 1, &wc); if (ne) { - tcompleted[ccnt] = get_cycles(); + if (user_param->servername) + tcompleted[ccnt] = get_cycles(); if (wc.status != IBV_WC_SUCCESS) { fprintf(stderr, "Completion wth error at %s:\n", user_param->servername ? "client" : "server"); diff --git a/branches/winverbs/tests/perftest/read_lat/SOURCES b/branches/winverbs/tests/perftest/read_lat/SOURCES index f87fc2bf..2aebbe01 100644 --- a/branches/winverbs/tests/perftest/read_lat/SOURCES +++ b/branches/winverbs/tests/perftest/read_lat/SOURCES @@ -10,11 +10,10 @@ USE_STL = 1 USE_NATIVE_EH = 1 USE_IOSTREAM = 1 -SOURCES = \ - read_lat.rc \ - read_lat.c +SOURCES = read_lat.rc read_lat.c ..\perftest.c -INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user; +INCLUDES = ..;..\..\..\ulp\libibverbs\include;\ + ..\..\..\inc;..\..\..\inc\user; TARGETLIBS = \ $(SDK_LIB_PATH)\kernel32.lib \ diff --git a/branches/winverbs/tests/perftest/read_lat/read_lat.c b/branches/winverbs/tests/perftest/read_lat/read_lat.c index f99e13c5..e5062a47 100644 --- a/branches/winverbs/tests/perftest/read_lat/read_lat.c +++ b/branches/winverbs/tests/perftest/read_lat/read_lat.c @@ -38,6 +38,7 @@ #include #include "..\..\..\etc\user\getopt.c" +#include "perftest.h" #include #define PINGPONG_READ_WRID 1 @@ -90,20 +91,6 @@ struct pingpong_dest { }; struct pingpong_dest my_dest; -static __inline UINT64 get_cycles() -{ - LARGE_INTEGER counter; - QueryPerformanceCounter(&counter); - return counter.QuadPart; -} - -static __inline UINT64 get_freq() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return freq.QuadPart; -} - static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port) { struct ibv_port_attr attr; @@ -567,30 +554,6 @@ static void usage(const char *argv0) printf(" -e sleep on CQ events (default poll)\n"); } -/* - * When there is an - * odd number of samples, the median is the middle number. - * even number of samples, the median is the mean of the - * two middle numbers. - * - */ -static __inline cycles_t get_median(int n, cycles_t delta[]) -{ - if ((n - 1) % 2) - return (delta[n / 2] + delta[n / 2 - 1]) / 2; - else - return delta[n / 2]; -} - -static int __cdecl cycles_compare(const void * aptr, const void * bptr) -{ - const cycles_t *a = aptr; - const cycles_t *b = bptr; - if (*a < *b) return -1; - if (*a > *b) return 1; - return 0; -} - static void print_report(struct report_options * options, unsigned int iters, cycles_t *tstamp,int size) { diff --git a/branches/winverbs/tests/perftest/send_bw/SOURCES b/branches/winverbs/tests/perftest/send_bw/SOURCES index 9c6eb61b..907bcfb1 100644 --- a/branches/winverbs/tests/perftest/send_bw/SOURCES +++ b/branches/winverbs/tests/perftest/send_bw/SOURCES @@ -10,11 +10,10 @@ USE_STL = 1 USE_NATIVE_EH = 1 USE_IOSTREAM = 1 -SOURCES = \ - send_bw.rc \ - send_bw.c +SOURCES = send_bw.rc send_bw.c ..\perftest.c -INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user; +INCLUDES = ..;..\..\..\ulp\libibverbs\include;\ + ..\..\..\inc;..\..\..\inc\user; TARGETLIBS = \ $(SDK_LIB_PATH)\kernel32.lib \ diff --git a/branches/winverbs/tests/perftest/send_bw/send_bw.c b/branches/winverbs/tests/perftest/send_bw/send_bw.c index f068d387..d3fa8b5e 100644 --- a/branches/winverbs/tests/perftest/send_bw/send_bw.c +++ b/branches/winverbs/tests/perftest/send_bw/send_bw.c @@ -36,6 +36,7 @@ #include #include "..\..\..\etc\user\getopt.c" +#include "perftest.h" #include #define PINGPONG_SEND_WRID 1 @@ -96,20 +97,6 @@ struct pingpong_dest { unsigned long long vaddr; }; -static __inline UINT64 get_cycles() -{ - LARGE_INTEGER counter; - QueryPerformanceCounter(&counter); - return counter.QuadPart; -} - -static __inline UINT64 get_freq() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return freq.QuadPart; -} - static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port) { struct ibv_port_attr attr; @@ -717,7 +704,8 @@ static int run_iter_bi(struct pingpong_context *ctx, struct user_parameters *use while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth / 2) { struct ibv_send_wr *bad_wr; - tposted[scnt] = get_cycles(); + if (user_param->servername) + tposted[scnt] = get_cycles(); if (ibv_post_send(qp, &ctx->wr, &bad_wr)) { fprintf(stderr, "Couldn't post send: scnt=%d\n", scnt); @@ -757,7 +745,8 @@ static int run_iter_bi(struct pingpong_context *ctx, struct user_parameters *use } switch ((int) wc.wr_id) { case PINGPONG_SEND_WRID: - tcompleted[ccnt] = get_cycles(); + if (user_param->servername) + tcompleted[ccnt] = get_cycles(); ccnt += 1; break; case PINGPONG_RECV_WRID: @@ -841,7 +830,8 @@ static int run_iter_uni(struct pingpong_context *ctx, struct user_parameters *us do { ne = ibv_poll_cq(ctx->cq, 1, &wc); if (ne) { - tcompleted[ccnt] = get_cycles(); + if (user_param->servername) + tcompleted[ccnt] = get_cycles(); if (wc.status != IBV_WC_SUCCESS) { fprintf(stderr, "Completion wth error at %s:\n", user_param->servername ? "client" : "server"); @@ -871,7 +861,8 @@ static int run_iter_uni(struct pingpong_context *ctx, struct user_parameters *us while (scnt < user_param->iters || ccnt < user_param->iters) { while (scnt < user_param->iters && (scnt - ccnt) < user_param->tx_depth ) { struct ibv_send_wr *bad_wr; - tposted[scnt] = get_cycles(); + if (user_param->servername) + tposted[scnt] = get_cycles(); if (ibv_post_send(qp, &ctx->wr, &bad_wr)) { fprintf(stderr, "Couldn't post send: scnt=%d\n", scnt); @@ -903,7 +894,8 @@ static int run_iter_uni(struct pingpong_context *ctx, struct user_parameters *us if (ne <= 0) break; - tcompleted[ccnt] = get_cycles(); + if (user_param->servername) + tcompleted[ccnt] = get_cycles(); if (wc.status != IBV_WC_SUCCESS) { fprintf(stderr, "Completion wth error at %s:\n", user_param->servername ? "client" : "server"); diff --git a/branches/winverbs/tests/perftest/send_lat/SOURCES b/branches/winverbs/tests/perftest/send_lat/SOURCES index a3fc9857..e92f25b7 100644 --- a/branches/winverbs/tests/perftest/send_lat/SOURCES +++ b/branches/winverbs/tests/perftest/send_lat/SOURCES @@ -10,11 +10,10 @@ USE_STL = 1 USE_NATIVE_EH = 1 USE_IOSTREAM = 1 -SOURCES = \ - send_lat.rc \ - send_lat.c +SOURCES = send_lat.rc send_lat.c ..\perftest.c -INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user; +INCLUDES = ..;..\..\..\ulp\libibverbs\include;\ + ..\..\..\inc;..\..\..\inc\user; TARGETLIBS = \ $(SDK_LIB_PATH)\kernel32.lib \ diff --git a/branches/winverbs/tests/perftest/send_lat/send_lat.c b/branches/winverbs/tests/perftest/send_lat/send_lat.c index 81ededa1..05bd130b 100644 --- a/branches/winverbs/tests/perftest/send_lat/send_lat.c +++ b/branches/winverbs/tests/perftest/send_lat/send_lat.c @@ -38,6 +38,7 @@ #include #include "..\..\..\etc\user\getopt.c" +#include "perftest.h" #include #define PINGPONG_SEND_WRID 1 @@ -101,20 +102,6 @@ struct pingpong_dest { unsigned int rkey; }; -static __inline UINT64 get_cycles() -{ - LARGE_INTEGER counter; - QueryPerformanceCounter(&counter); - return counter.QuadPart; -} - -static __inline UINT64 get_freq() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return freq.QuadPart; -} - static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port) { struct ibv_port_attr attr; @@ -714,31 +701,6 @@ static void usage(const char *argv0) printf(" -g send messages to multicast group(only available in UD connection\n"); } -/* - * When there is an - * odd number of samples, the median is the middle number. - * even number of samples, the median is the mean of the - * two middle numbers. - * - */ -static __inline cycles_t get_median(int n, cycles_t delta[]) -{ - if ((n - 1) % 2) - return(delta[n / 2] + delta[n / 2 - 1]) / 2; - else - return delta[n / 2]; -} - -static int __cdecl cycles_compare(const void * aptr, const void * bptr) -{ - const cycles_t *a = aptr; - const cycles_t *b = bptr; - if (*a < *b) return -1; - if (*a > *b) return 1; - return 0; - -} - static void print_report(struct report_options * options, unsigned int iters, cycles_t *tstamp,int size) { @@ -911,7 +873,8 @@ static int run_iter(struct pingpong_context *ctx, struct user_parameters *user_p } /* client post first */ - tstamp[scnt] = get_cycles(); + if (user_param->servername) + tstamp[scnt] = get_cycles(); *post_buf = (char)++scnt; if (ibv_post_send(qp, wr, &bad_wr)) { fprintf(stderr, "Couldn't post send: scnt=%d\n", diff --git a/branches/winverbs/tests/perftest/write_bw/SOURCES b/branches/winverbs/tests/perftest/write_bw/SOURCES index c0e15cda..4e7a5a16 100644 --- a/branches/winverbs/tests/perftest/write_bw/SOURCES +++ b/branches/winverbs/tests/perftest/write_bw/SOURCES @@ -10,11 +10,10 @@ USE_STL = 1 USE_NATIVE_EH = 1 USE_IOSTREAM = 1 -SOURCES = \ - write_bw.rc \ - write_bw.c +SOURCES = write_bw.rc write_bw.c ..\perftest.c -INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user; +INCLUDES = ..;..\..\..\ulp\libibverbs\include;\ + ..\..\..\inc;..\..\..\inc\user; TARGETLIBS = \ $(SDK_LIB_PATH)\kernel32.lib \ diff --git a/branches/winverbs/tests/perftest/write_bw/write_bw.c b/branches/winverbs/tests/perftest/write_bw/write_bw.c index eb9a5a28..15fd27bd 100644 --- a/branches/winverbs/tests/perftest/write_bw/write_bw.c +++ b/branches/winverbs/tests/perftest/write_bw/write_bw.c @@ -37,6 +37,7 @@ #include #include "..\..\..\etc\user\getopt.c" +#include "perftest.h" #include #define PINGPONG_RDMA_WRID 3 @@ -90,20 +91,6 @@ struct pingpong_dest { unsigned long long vaddr; }; -static __inline UINT64 get_cycles() -{ - LARGE_INTEGER counter; - QueryPerformanceCounter(&counter); - return counter.QuadPart; -} - -static __inline UINT64 get_freq() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return freq.QuadPart; -} - static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port) { struct ibv_port_attr attr; @@ -606,8 +593,9 @@ static int run_iter(struct pingpong_context *ctx, struct user_parameters *user_p ctx->wr.wr.rdma.remote_addr = rem_dest[index]->vaddr; ctx->wr.wr.rdma.rkey = rem_dest[index]->rkey; qp = ctx->qp[index]; - ctx->wr.wr_id = index ; - tposted[totscnt] = get_cycles(); + ctx->wr.wr_id = index; + if (user_param->servername) + tposted[totscnt] = get_cycles(); if (ibv_post_send(qp, &ctx->wr, &bad_wr)) { fprintf(stderr, "Couldn't post warmup send: qp index = %d qp scnt=%d total scnt %d\n", index,ctx->scnt[index],totscnt); @@ -617,50 +605,59 @@ static int run_iter(struct pingpong_context *ctx, struct user_parameters *user_p ++totscnt; } } + /* main loop for posting */ - while (totscnt < (user_param->iters * user_param->numofqps) || totccnt < (user_param->iters * user_param->numofqps) ) { - /* main loop to run over all the qps and post each time n messages */ - for (index =0 ; index < user_param->numofqps ; index++) { - ctx->wr.wr.rdma.remote_addr = rem_dest[index]->vaddr; - ctx->wr.wr.rdma.rkey = rem_dest[index]->rkey; - qp = ctx->qp[index]; - ctx->wr.wr_id = index ; - while (ctx->scnt[index] < user_param->iters && (ctx->scnt[index] - ctx->ccnt[index]) < user_param->maxpostsofqpiniteration) { - tposted[totscnt] = get_cycles(); - if (ibv_post_send(qp, &ctx->wr, &bad_wr)) { - fprintf(stderr, "Couldn't post send: qp index = %d qp scnt=%d total scnt %d\n", - index,ctx->scnt[index],totscnt); - return 1; - } - ctx->scnt[index]= ctx->scnt[index]+1; - ++totscnt; - } - } - /* finished posting now polling */ - if (totccnt < (user_param->iters * user_param->numofqps) ) { - - int ne; - do { - ne = ibv_poll_cq(ctx->cq, 1, &wc); - } while (ne == 0); - tcompleted[totccnt] = get_cycles(); - if (ne < 0) { - fprintf(stderr, "poll CQ failed %d\n", ne); - return 1; - } - if (wc.status != IBV_WC_SUCCESS) { - fprintf(stderr, "Completion wth error at %s:\n", - user_param->servername ? "client" : "server"); - fprintf(stderr, "Failed status %d: wr_id %d\n", - wc.status, (int) wc.wr_id); - fprintf(stderr, "qp index %d ,qp scnt=%d, qp ccnt=%d total scnt %d total ccnt %d\n", - (int)wc.wr_id, ctx->scnt[(int)wc.wr_id], ctx->ccnt[(int)wc.wr_id], totscnt, totccnt); - return 1; - } - /*here the id is the index to the qp num */ - ctx->ccnt[(int)wc.wr_id] = ctx->ccnt[(int)wc.wr_id]+1; - totccnt += 1; - } + while (totscnt < (user_param->iters * user_param->numofqps) || + totccnt < (user_param->iters * user_param->numofqps) ) { + /* main loop to run over all the qps and post each time n messages */ + for (index =0 ; index < user_param->numofqps ; index++) { + ctx->wr.wr.rdma.remote_addr = rem_dest[index]->vaddr; + ctx->wr.wr.rdma.rkey = rem_dest[index]->rkey; + qp = ctx->qp[index]; + ctx->wr.wr_id = index; + + while (ctx->scnt[index] < user_param->iters && + (ctx->scnt[index] - ctx->ccnt[index]) < user_param->maxpostsofqpiniteration) { + if (user_param->servername) + tposted[totscnt] = get_cycles(); + if (ibv_post_send(qp, &ctx->wr, &bad_wr)) { + fprintf(stderr, "Couldn't post send: qp index = %d qp scnt=%d total scnt %d\n", + index,ctx->scnt[index],totscnt); + return 1; + } + ctx->scnt[index]= ctx->scnt[index]+1; + ++totscnt; + } + } + + /* finished posting now polling */ + if (totccnt < (user_param->iters * user_param->numofqps) ) { + int ne; + do { + ne = ibv_poll_cq(ctx->cq, 1, &wc); + } while (ne == 0); + + if (user_param->servername) + tcompleted[totccnt] = get_cycles(); + + if (ne < 0) { + fprintf(stderr, "poll CQ failed %d\n", ne); + return 1; + } + + if (wc.status != IBV_WC_SUCCESS) { + fprintf(stderr, "Completion wth error at %s:\n", + user_param->servername ? "client" : "server"); + fprintf(stderr, "Failed status %d: wr_id %d\n", + wc.status, (int) wc.wr_id); + fprintf(stderr, "qp index %d ,qp scnt=%d, qp ccnt=%d total scnt %d total ccnt %d\n", + (int)wc.wr_id, ctx->scnt[(int)wc.wr_id], ctx->ccnt[(int)wc.wr_id], totscnt, totccnt); + return 1; + } + /*here the id is the index to the qp num */ + ctx->ccnt[(int)wc.wr_id] = ctx->ccnt[(int)wc.wr_id]+1; + totccnt += 1; + } } return(0); } diff --git a/branches/winverbs/tests/perftest/write_lat/SOURCES b/branches/winverbs/tests/perftest/write_lat/SOURCES index 316a625a..f869ff1a 100644 --- a/branches/winverbs/tests/perftest/write_lat/SOURCES +++ b/branches/winverbs/tests/perftest/write_lat/SOURCES @@ -10,11 +10,10 @@ USE_STL = 1 USE_NATIVE_EH = 1 USE_IOSTREAM = 1 -SOURCES = \ - write_lat.rc \ - write_lat.c +SOURCES = write_lat.rc write_lat.c ..\perftest.c -INCLUDES = ..\..\..\ulp\libibverbs\include;..\..\..\inc;..\..\..\inc\user; +INCLUDES = ..;..\..\..\ulp\libibverbs\include;\ + ..\..\..\inc;..\..\..\inc\user; TARGETLIBS = \ $(SDK_LIB_PATH)\kernel32.lib \ diff --git a/branches/winverbs/tests/perftest/write_lat/write_lat.c b/branches/winverbs/tests/perftest/write_lat/write_lat.c index 95748aa6..81f5cfc4 100644 --- a/branches/winverbs/tests/perftest/write_lat/write_lat.c +++ b/branches/winverbs/tests/perftest/write_lat/write_lat.c @@ -38,6 +38,7 @@ #include #include "..\..\..\etc\user\getopt.c" +#include "perftest.h" #include #define PINGPONG_RDMA_WRID 3 @@ -87,20 +88,6 @@ struct pingpong_dest { unsigned long long vaddr; }; -static __inline UINT64 get_cycles() -{ - LARGE_INTEGER counter; - QueryPerformanceCounter(&counter); - return counter.QuadPart; -} - -static __inline UINT64 get_freq() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return freq.QuadPart; -} - static uint16_t pp_get_local_lid(struct pingpong_context *ctx, int port) { struct ibv_port_attr attr; @@ -583,30 +570,6 @@ static void usage(const char *argv0) printf(" -V display version number\n"); } -/* - * When there is an - * odd number of samples, the median is the middle number. - * even number of samples, the median is the mean of the - * two middle numbers. - * - */ -static __inline cycles_t get_median(int n, cycles_t delta[]) -{ - if ((n - 1) % 2) - return(delta[n / 2] + delta[n / 2 - 1]) / 2; - else - return delta[n / 2]; -} - -static int __cdecl cycles_compare(const void * aptr, const void * bptr) -{ - const cycles_t *a = aptr; - const cycles_t *b = bptr; - if (*a < *b) return -1; - if (*a > *b) return 1; - return 0; -} - static void print_report(struct report_options * options, unsigned int iters, cycles_t *tstamp,int size) { @@ -711,7 +674,8 @@ static int run_iter(struct pingpong_context *ctx, struct user_parameters *user_p if (scnt < user_param->iters) { struct ibv_send_wr *bad_wr; - tstamp[scnt] = get_cycles(); + if (user_param->servername) + tstamp[scnt] = get_cycles(); *post_buf = (char)++scnt; diff --git a/branches/winverbs/tools/infiniband-diags/include/windows/config.h b/branches/winverbs/tools/infiniband-diags/include/windows/config.h index cd70278d..e5d7c134 100644 --- a/branches/winverbs/tools/infiniband-diags/include/windows/config.h +++ b/branches/winverbs/tools/infiniband-diags/include/windows/config.h @@ -36,8 +36,6 @@ #include <../../../../ulp/libibverbs/include/infiniband/verbs.h> -#define strdup _strdup -#define strdupa _strdup -#define strncasecmp _strnicmp +#include <_string.h> #endif /* _CONFIG_H_ */ diff --git a/branches/winverbs/tools/infiniband-diags/src/saquery.c b/branches/winverbs/tools/infiniband-diags/src/saquery.c index 9d5f4758..53054c73 100644 --- a/branches/winverbs/tools/infiniband-diags/src/saquery.c +++ b/branches/winverbs/tools/infiniband-diags/src/saquery.c @@ -785,7 +785,8 @@ static int get_any_records(bind_handle_t h, uint16_t attr_id, uint32_t attr_mod, ib_net64_t comp_mask, void *attr, uint64_t sm_key) { - int ret = sa_query(h, IB_MAD_METHOD_GET_TABLE, attr_id, attr_mod, + int ret; + ret = sa_query(h, IB_MAD_METHOD_GET_TABLE, attr_id, attr_mod, cl_ntoh64(comp_mask), sm_key, attr); if (ret) { fprintf(stderr, "Query SA failed: %s\n", ib_get_err_str(ret)); @@ -806,7 +807,8 @@ static int get_and_dump_any_records(bind_handle_t h, uint16_t attr_id, void *attr, uint64_t sm_key, void (*dump_func) (void *)) { - int ret = get_any_records(h, attr_id, attr_mod, comp_mask, attr, + int ret; + ret = get_any_records(h, attr_id, attr_mod, comp_mask, attr, sm_key); if (ret) return ret; @@ -1750,8 +1752,10 @@ int main(int argc, char **argv) fprintf(stderr, "Unknown query type %d\n", ntohs(query_type)); status = IB_UNKNOWN_ERROR; - } else + } else { status = q->handler(q, h, ¶ms, argc, argv); + printf("returned: status %d\n", status); + } break; } diff --git a/branches/winverbs/ulp/libibumad/src/umad.cpp b/branches/winverbs/ulp/libibumad/src/umad.cpp index 45efdcb4..1471cfe3 100644 --- a/branches/winverbs/ulp/libibumad/src/umad.cpp +++ b/branches/winverbs/ulp/libibumad/src/umad.cpp @@ -596,10 +596,14 @@ int umad_recv(int portid, void *umad, int *length, int timeout_ms) if (mad->Length <= (UINT32) *length) { port->pending = FALSE; + hr = (HRESULT) mad->Id; + } else { + errno = ENOSPC; + hr = -ENOSPC; } *length = mad->Length; - return (int) mad->Id; + return hr; } __declspec(dllexport) diff --git a/branches/winverbs/ulp/librdmacm/src/cma.cpp b/branches/winverbs/ulp/librdmacm/src/cma.cpp index acab24af..712c6b80 100644 --- a/branches/winverbs/ulp/librdmacm/src/cma.cpp +++ b/branches/winverbs/ulp/librdmacm/src/cma.cpp @@ -835,6 +835,7 @@ static int ucma_process_conn_req(struct cma_event *event) event->event.event = RDMA_CM_EVENT_CONNECT_REQUEST; event->id_priv->state = cma_passive_connect; } else { +printf("ucma_process_conn_req - error: 0x%x\n", event->event.status); rdma_destroy_id(&event->id_priv->id); } @@ -870,6 +871,7 @@ static int ucma_process_conn_resp(struct cma_event *event) return WV_IO_PENDING; err: +printf("ucma_process_conn_resp - error: 0x%x\n", event->event.status); event->event.event = (event->event.status == WV_REJECTED) ? RDMA_CM_EVENT_REJECTED : RDMA_CM_EVENT_CONNECT_ERROR; @@ -896,6 +898,7 @@ static void ucma_process_establish(struct cma_event *event) id_priv->state = cma_connected; id_priv->id.ep.connect->NotifyDisconnect(&id_priv->event_entry.Overlap); } else { +printf("ucma_process_establish - error: 0x%x\n", event->event.status); event->event.event = RDMA_CM_EVENT_CONNECT_ERROR; event->id_priv->state = cma_disconnected; } @@ -968,10 +971,8 @@ int rdma_get_cm_event(struct rdma_event_channel *channel, id = &evt->id_priv->id; evt->event.id = id; evt->event.param.conn.private_data = evt->private_data; - if (id->ep.connect->GetOverlappedResult(&evt->id_priv->event_entry.Overlap, - &bytes, FALSE) == 0) { - evt->event.status = HRESULT_FROM_WIN32(GetLastError()); - } + evt->event.status = + id->ep.connect->GetOverlappedResult(&entry->Overlap, &bytes, FALSE); hr = ucma_process_event(evt); } while (FAILED(hr)); -- 2.41.0