From da18eb1b8b5d49470022651498e0cbaf0917512c Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 21 Jul 2014 19:52:29 +0000 Subject: [PATCH] common/verbs: fix usnic detection The logic was mishandling the case of a newer kernel and an older libusnic_verbs. Simplify usnic_transport() to return constants in the 2 known cases (not a usNIC device and the TRANSPORT_USNIC_UDP case), and call the magic probe in all other cases. Reviewed-by: Dave Goodell cmr=v1.8.2:reviewer=ompi-rm1.8 This commit was SVN r32260. --- .../common/verbs/common_verbs_find_ports.c | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/ompi/mca/common/verbs/common_verbs_find_ports.c b/ompi/mca/common/verbs/common_verbs_find_ports.c index 181cc96961..a08502d545 100644 --- a/ompi/mca/common/verbs/common_verbs_find_ports.c +++ b/ompi/mca/common/verbs/common_verbs_find_ports.c @@ -268,7 +268,7 @@ static int usnic_magic_probe(struct ibv_context *context) } /* - * usNIC devices will always return one of three + * usNIC devices will always return one of these * device->transport_type values: * * 1. TRANSPORT_IWARP: for older kernels (e.g., on systems such as @@ -288,7 +288,12 @@ static int usnic_magic_probe(struct ibv_context *context) * 3. TRANSPORT_USNIC_UDP: on systems with new kernels and new * libibverbs. In this case, the transport is guaranteed to be * usNIC/UDP. -*/ + * + * 4. TRANSPORT_UNKNOWN: on systems with a new kernel but an old + * libibverbs (i.e., kernel understands/returns TRANSPORT_USNIC* + * values, but libibverbs doesn't understant the TRANSPORT_USNIC* + * constants, and therefore returns TRANSPORT_UNKNOWN). + */ static int usnic_transport(struct ibv_device *device, struct ibv_context *context) { @@ -296,10 +301,6 @@ static int usnic_transport(struct ibv_device *device, return USNIC_UNKNOWN; } - if (IBV_TRANSPORT_IWARP == device->transport_type) { - return usnic_magic_probe(context); - } - #if HAVE_DECL_IBV_TRANSPORT_USNIC_UDP /* If we got the transport type of USNIC_UDP, then it's definitely the UDP transport. */ @@ -308,15 +309,9 @@ static int usnic_transport(struct ibv_device *device, } #endif -#if HAVE_DECL_IBV_TRANSPORT_USNIC - if (IBV_TRANSPORT_USNIC == device->transport_type) { - return usnic_magic_probe(context); - } -#endif - - /* Should never get here -- usnic devices should *always* return - one of the 3 above values */ - return USNIC_UNKNOWN; + /* All other cases require a secondary check to figure out whether + the transport is L2 or UDP */ + return usnic_magic_probe(context); } /***********************************************************************/