The SGID index can change dynamically, so look up the correct index when creating an address vector. The index is passed into the UVP in the resv2 field of the grh.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1416 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
winverbs: change WV_GRH structure to simplify the interface
Separate out the bit fields in the WV_GRH structure to make using it easier to use. Change the structure name to avoid confusion with an actual IB GRH.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1409 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] This patch fixes the build error due to CSQ use for XP builds. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1408 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[WinOF] for XP32 builds, place holder files (until someone comes up with a better plan) utilized by makebin to cover the case of WSD not available for XP32. netipoib-xp32.inf intentionally contains 64 bit sections as to minimize differences between it and netipoib.inf file.
[IBAL] Limit time spent at DISPATCH_LEVEL when processing MADs.
In working with some switch SMs, I found that under stress the QP0 MAD processing could get delayed by eternal QP1 MAD processing (from hitting the SA for path queries). This caused the SMs to remove the node from the fabric (multicast group membership, etc) because it appeared unreachable.
This patch adds a DPC for QP0 and QP1 to the SMI, and limits the SMI to processing 16 MADs before re-queueing the DPC to the DPC queue.
Because QP0 processing is crucial to the fabric operating properly, the QP0 DPC is set to high importance so that it always gets queued to the front of the DPC queue, pre-empting any QP1 processing (among other things).
In any case, with this patch all my changes have now been mailed to the list.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1393 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
Warning C4826 warns you if you have signed pointer extension when a 32-bit pointer is extended to 64-bits. This patch turns the warning on by default (for any users of complib), and fixes all instances of problematic code. It also eradicates __ptr64 usage from the Qlogic VNIC driver.
Code affected:
- IBAL
- MTHCA
- MLX4
- QLGCVNIC
Note that I didn't change DAPL because it's licensed under the CPL and not BSD. So someone else will have to fix that. In fact, DAPL should probably just go back into the SourceForge project rather than being duplicated everywhere. Code in the WinOF SVN should be BSD only according to the contributor's agreement.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1392 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
The UAL_NDI_NOOP IOCTL handler was added to allow memory registration in user-mode to notify a client using an I/O completion port. This patch extends the functionality to allow the IOCTL to return either STATUS_SUCCESS or STATUS_TIMEOUT. The STATUS_TIMEOUT facility is used by the NetworkDirect provider when IBAT returns pending. It's crude, but gets the job done.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1391 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] Fix TO_LONG_PTR use in IOCTLs. Re-applied 1387 patch.
Some IOCTLs transfer API structures with embedded pointers. These embedded pointers use the TO_LONG_PTR macro to pad everything out so that __ptr64 isn't used. The idea here is fine, but the change to eliminate the __ptr64 was riddled with problems that weren't caught by the find/replace brute force code changes.
Oops, the mem_create in the IOCTL buffer was overwritten with the caller's structure, which may have uninitialized padding. This isn't subsequently cleared, effectively defeating the purpose of the memclr.
Ah, close but not quite - you have the assignment, but it only assigns the pointer part of the TO_LONG_PTR union. The padding is still a copy of the user's structure, potentially giving an invalid handle in the kernel. All uses of HDL_TO_PTR were eliminated as they didn't actually accomplish anything.
This patch fixes this, and always uses the 'padding' field of the TO_LONG_PTR union so that the value is always fully set.
There's also a bug fixed in UD work requests that get sent via IOCTL - the AV handle was never swizzled to its appropriate kernel handle.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1390 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] Remove TO_LONG_PTR from IOCTL structures. Re-applied 1386 patch with out SMI changes.
This patch removes all instances of TO_LONG_PTR from internal IOCTL structures. The only place TO_LONG_PTR should be used is in public structures that contain pointers and are exchanged between user-mode and kernel-mode. Actually, the code should ideally have proxy structures for such API structures into which API structure members
are copied member-wise, and whose size is fixed. Unused pointers should be stripped from the IOCTL proxy structures. But that's a change for some other time...
All fields in internal IOCTL structures that were formerly TO_LONG_PTR are not uint64_t, and all uses have appropriate casts.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1389 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
Some IOCTLs transfer API structures with embedded pointers. These embedded pointers use the TO_LONG_PTR macro to pad everything out so that __ptr64 isn't used. The idea here is fine, but the change to eliminate the __ptr64 was riddled with problems that weren't caught by the find/replace brute force code changes.
Oops, the mem_create in the IOCTL buffer was overwritten with the caller's structure, which may have uninitialized padding. This isn't subsequently cleared, effectively defeating the purpose of the memclr.
Ah, close but not quite - you have the assignment, but it only assigns the pointer part of the TO_LONG_PTR union. The padding is still a copy of the user's structure, potentially giving an invalid handle in the kernel. All uses of HDL_TO_PTR were eliminated as they didn't actually accomplish anything.
This patch fixes this, and always uses the 'padding' field of the TO_LONG_PTR union so that the value is always fully set.
There's also a bug fixed in UD work requests that get sent via IOCTL - the AV handle was never swizzled to its appropriate kernel handle.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1387 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
This patch removes all instances of TO_LONG_PTR from internal IOCTL structures. The only place TO_LONG_PTR should be used is in public structures that contain pointers and are exchanged between user-mode and kernel-mode. Actually, the code should ideally have proxy structures for such API structures into which API structure members
are copied member-wise, and whose size is fixed. Unused pointers should be stripped from the IOCTL proxy structures. But that's a change for some other time...
All fields in internal IOCTL structures that were formerly TO_LONG_PTR are not uint64_t, and all uses have appropriate casts.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1386 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] Remove PD context from IOCTLs.
IBAL's ib_query_qp and ib_query_mw IOCTLs return the PD context in the output IOCTL buffer. It is however never referenced.
This patch removes the fields (which had been changed to TO_LONG_PTR).
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1385 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
Part of cleaning up the __ptr64 stuff properly - rather than use the TO_LONG_PTR in the ci_umv_buf_t structure, use uint64_t.
The problem with using TO_LONG_PTR in structures that are exchanged between 32-bit clients and 64-bit drivers is that care must be taken to ensure that the upper 'padding' bytes are cleared properly.
Making the field a uint64_t makes it fool proof (though it does require casting, but at least the compiler will trap errors unlike for the padding.)
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1384 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[INC] Clean up TO_LONG_PTR use in ib_types.h. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1383 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[COMPLIB] This patch removes a useless comment. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1378 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[MTHCA] This patch cleans up the atomic_set function in the HCA drivers. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1377 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] Cleanup ND reject IOCTL handling.
This patch removes a local variable, and changes the reject reason from IB_REJ_INSUF_QP to IB_REJ_USER_DEFINED. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1376 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[OPENMS] This patch removes XXX_PTR64 and TO_ULONG_PTR from OpenSM. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1375 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
The al_cep_drep API currently takes the ib_cm_drep_t structure. This structure is passed in the IOCTL. It has en embedded pointer that isn't used since the private data is copied into the IOCTL structure.
This patch removes the ib_cm_drep_t structure from the IOCTL structure, and passes the private data buffer and length in explicitly.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1374 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[TOOLS] This patch cleans up the includes for the HCA co-installer and corrects the version information to correctly identify the DLL as such (rather than as an executable). Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1373 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
The listen error callback is the vestigial tail of IBAL... At some point in the distant past, it served a function, though a dubious one at best given the implementation of the listen error callbacks in client code that all effectively generate some output but really ignore the event.
This patch eliminates the listen error callback, its associated callback record, and all the no-op handlers in the various clients.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1363 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] Driver verifier caught this one. If an IRP is completed via IoCompletRequest the IRP dispatch routine needs to return the same status as the IRP's completion status. There's no reason to use the CL_COMPLETED value here anyway (and it should probably be eliminated to prevent exactly this type of issue.) Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1360 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
This patch fixes a bug in the ND proxy where an IOCTL handler would return STATUS_PENDING without marking the IRP pending. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1359 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
This patch adds a missing call to destroy a QP's associated CEP if a ND-related CM REQ times out or fails for any reason. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1358 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] This patch removes ATS queries from the ND proxy, with the anticipation that all address translation will be done by the caller (via the IBAT library). Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1357 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
In my previous patch "Fix race reading/setting connection ID" I incorrectly stated that the patch changed the semantics of creation/destruction of the CEPs by providing the destroy callback at CEP creation time. It didn't, but this patch does.
Note that it also backs out the "Cleanup CEPs after child objects have been destroyed" changes, as those actually introduced the following issue:
UM listen CEPs are not tracked in AL's handle table, but can queue MADs which take a reference on the AL instance. AL's destroying callback must cleanup the CEPs to free the MADs in order for the ref count to reach zero.
The root problem, and the iterations of the fix that are apparent in the patch sequence has to do with race conditions cleaning up QPs while CM messages are being received and processed. First there was the issue of the CID stored in the QP having two reserved states and races checking/assigning this value. This was fixed (successfully) by pushing checks into the CEP manager, protected by the CEP manager's spinlock. Next was the issue that a reference on the QP is taken when the CEP is bound to a QP, but if AL was destroyed the CEP cleanup in AL would blow away the CEPs before the QPs were done being destroyed. This would leak a reference count on the QP since the CEP was destroyed without a destroy callback. The change that added a cleanup callback to AL was the first (failed) attempt to fix this (for the reasons listed above). This patch is the successful attempt to fix this, as it sets the destroy callback at creation time. No matter what path destroys the CEP, if a destroy callback was taken (because some object has a reference for the CEP), the destroy callback will always be invoked.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1356 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] This patch fixes ND CM IOCTL handling to work properly at scale. There were several race conditions in the old code. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1355 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[SRP] added INX -> INF file version stamping.
INF file created in ..\..\..\bin\kernel\xxx\
.inf file version now matches .sys file version.
added makefile.inc
ib_srp.inf renamed to ib_srp.inx per MS/WDK convention.
[IPOIB] added INX -> INF file version stamping.
INF file created in ..\..\..\bin\kernel\xxx
.inf file version now matches .sys file version.
added makefile.inc
netipoib.inf renamed to netipoib.inx per MS/WDK convention.
[QLGCVNIC] added INX -> INF file stamping. INF file created in ..\..\..\bin\kernel\xxx
.inf file version now matches .sys file version.
added file makefile.inc
netvnic.inf renamed to netvnic.inx per MS/WDK convention.
[WSD] This patch removes the dependency of WSD on DAPL ATS, and reduces connection establishment SA queries from 2 (ATS query + PR query) to 1 (PR query). Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1332 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[CORE, TESTS] This patch adds a library and test utility that performs IP to IB address translation without going to the SA for DAPL ATS service records.
It's a sequence of operations between the IP helper library and IPoIB.
1. Get the local IPoIB port's IB address information (GID).
2. Lookup the destination MAC address via the IP Helper functions, send ARP if needed 3. Ask IPoIB for the destination IB address information given the destination Ethernet MAC.
As input, the IBAT library takes two IP addresses (v4 or v6). As output, it returns two GIDs (as IN6_ADDRs), as well as the pkey.
There's a test program, wherebu, that will exercise the IBAT library.
Note that there is special code for Windows Vista/Server 2008 to take advantage of newer functionality in the IP Helper library. Without this lookups get quite slow as you increase the number of nodes. On our 256 node cluster the Windows Server 2008 code path performed an order of magnitude better than the Windows Server 2003 code path.
There will be a follow up patch that moves WSD over to using this library.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1331 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] This patch fixes IBAL object destruction. It does the following:
1. Removes forcing synchronous destruction for user-mode exported objects. This isn't needed, and slows down cleanup of the object hierarchy.
2. Clears the user-mode exported handle from the handle table before invoking the 'destroying' callback of an object, so that all further reference on the object will fail. Currently, an IOCTL could take a reference on an object after the 'destroying' callback has returned.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1329 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] IBAL currently blows away all CEPs from its 'destroying' callback. This patch moves this so that any left over CEPs are cleaned up in the 'cleanup' callback, so that objects that 'own' a CEP have a chance to clean themselves up first. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1328 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] This patch renames 'que' to 'queue'. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1327 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] IBAL has two reserved CID values that it stores in the QPs - AL_INVALID_CID, meaning that there is no CEP associated with the QP but that one can be associated, and AL_RESERVED_CID, which means no CEP is associated, and none should be because the QP is being destroyed.
The code uses atomic operations to check for/set AL_INVALID_CID or AL_RESERVED_CID. Since there are two possible 'special' values, atomics can't be used reliably.
There has been a report of this related to SRP and BSODs.
Additionally, the code would provide the destroy callback when destroying the CEP. However, the CEP can be destroyed through different paths, and it's important to make sure the destroy callback is invoked always so that reference counts can be properly released.
This patch pushes all assignments and checks for special values into the CEP manager, protected by the CEP manager's lock that it holds when performing the CEP lookup. It also changes the semantics of creation/destruction of the CEPs to provide the destroy callback when the CEP is created or bound to an object (the binding path is for the passive side of a connection).
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1326 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] The current connection establishment code will return STATUS_HOST_UNREACHABLE when an SA operation times out. This patch returns STATUS_TIMEOUT if the SA query timed out, which tends to happen in larger clusters quite often. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1325 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] Use the CM protocol to exchange initiator depth and responder resources. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1324 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] The current ndi_dreq_cm function destroys the CEP after the QP is moved to the error state. The CEP should be destroyed first to send the DREQ before changing the QP state. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1323 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] The CEP manager currently keeps a separate field to store the initiator depth requested in a REQ. When the user sends the REP, the CEP stored the responder resources as the minimum of the requested depth or the CA's capabilities.
This change eliminates the separate field, and uses the responder resources to store the received REQ's initiator depth. This simplifies the code a bit.
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1322 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] Convert ib_api_status_t to NTSTATUS for al_cep_get_pdata to make the IRP handling simpler. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1320 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] Add code to allow user-mode code to register memory via the existing IBAL IOCTLs, and if that succeeds, issue a no-op IOCTL that completes the user's overlapped request to their IOCP (or whatever mechanism they are using - the I/O manager will take care of it). Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1319 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86
[IBAL] This patch changes when the private data is stored to when the CM MAD is received and processed. This makes the code more consistent and simpler. Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@1318 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86