Index: src/topology-libpci.c =================================================================== --- src/topology-libpci.c (révision 4414) +++ src/topology-libpci.c (copie de travail) @@ -25,6 +25,7 @@ #include #include #include +#include #endif #define CONFIG_SPACE_CACHESIZE 256 @@ -123,6 +124,7 @@ hwloc_linux_net_class_fillinfos(struct hwloc_topology *topology __hwloc_attribute_unused, struct hwloc_obj *obj, const char *osdevpath) { FILE *fd; + struct stat st; char path[256]; snprintf(path, sizeof(path), "%s/address", osdevpath); fd = fopen(path, "r"); @@ -136,6 +138,25 @@ } fclose(fd); } + snprintf(path, sizeof(path), "%s/device/infiniband", osdevpath); + if (!stat(path, &st)) { + snprintf(path, sizeof(path), "%s/dev_id", osdevpath); + fd = fopen(path, "r"); + if (fd) { + char hexid[16]; + if (fgets(hexid, sizeof(hexid), fd)) { + char *eoid; + unsigned long port; + port = strtoul(hexid, &eoid, 0); + if (eoid != hexid) { + char portstr[16]; + snprintf(portstr, sizeof(portstr), "%ld", port+1); + hwloc_obj_add_info(obj, "Port", portstr); + } + } + fclose(fd); + } + } } static void hwloc_linux_lookup_net_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)