void opal_common_verbs_register_fake_drivers(void) { /* No need to do this more than once */ static bool already_done = false; if (already_done) { return; } already_done = true; /* If there are any usnic devices, then register a fake driver */ DIR *class_dir; class_dir = opendir("/sys/class/infiniband"); if (NULL == class_dir) { return; } bool found = false; struct dirent *dent; while ((dent = readdir(class_dir)) != NULL) { if (strncmp(dent->d_name, "usnic_", 6) == 0) { found = true; break; } } closedir(class_dir); if (found) { ibv_register_driver("usnic_verbs", fake_driver_init); } }
static __attribute__((constructor)) void mthca_register_driver(void) { ibv_register_driver("mthca", mthca_driver_init); }
static __attribute__((constructor)) void mlx4_register_driver(void) { ibv_register_driver("mlx4", mlx4_driver_init); }