1aa0a1e58SJeff Roberson /*
2aa0a1e58SJeff Roberson * Copyright (c) 2004 Topspin Communications. All rights reserved.
3aa0a1e58SJeff Roberson *
4aa0a1e58SJeff Roberson * This software is available to you under a choice of one of two
5aa0a1e58SJeff Roberson * licenses. You may choose to be licensed under the terms of the GNU
6aa0a1e58SJeff Roberson * General Public License (GPL) Version 2, available from the file
7aa0a1e58SJeff Roberson * COPYING in the main directory of this source tree, or the
8aa0a1e58SJeff Roberson * OpenIB.org BSD license below:
9aa0a1e58SJeff Roberson *
10aa0a1e58SJeff Roberson * Redistribution and use in source and binary forms, with or
11aa0a1e58SJeff Roberson * without modification, are permitted provided that the following
12aa0a1e58SJeff Roberson * conditions are met:
13aa0a1e58SJeff Roberson *
14aa0a1e58SJeff Roberson * - Redistributions of source code must retain the above
15aa0a1e58SJeff Roberson * copyright notice, this list of conditions and the following
16aa0a1e58SJeff Roberson * disclaimer.
17aa0a1e58SJeff Roberson *
18aa0a1e58SJeff Roberson * - Redistributions in binary form must reproduce the above
19aa0a1e58SJeff Roberson * copyright notice, this list of conditions and the following
20aa0a1e58SJeff Roberson * disclaimer in the documentation and/or other materials
21aa0a1e58SJeff Roberson * provided with the distribution.
22aa0a1e58SJeff Roberson *
23aa0a1e58SJeff Roberson * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24aa0a1e58SJeff Roberson * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25aa0a1e58SJeff Roberson * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26aa0a1e58SJeff Roberson * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27aa0a1e58SJeff Roberson * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28aa0a1e58SJeff Roberson * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29aa0a1e58SJeff Roberson * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30aa0a1e58SJeff Roberson * SOFTWARE.
31aa0a1e58SJeff Roberson */
32aa0a1e58SJeff Roberson
33aa0a1e58SJeff Roberson #include <config.h>
34aa0a1e58SJeff Roberson
35aa0a1e58SJeff Roberson #include <stdio.h>
36aa0a1e58SJeff Roberson
37*d6b92ffaSHans Petter Selasky #include <infiniband/endian.h>
38*d6b92ffaSHans Petter Selasky
39aa0a1e58SJeff Roberson #include <infiniband/verbs.h>
40aa0a1e58SJeff Roberson
main(int argc,char * argv[])41aa0a1e58SJeff Roberson int main(int argc, char *argv[])
42aa0a1e58SJeff Roberson {
43aa0a1e58SJeff Roberson struct ibv_device **dev_list;
44aa0a1e58SJeff Roberson int num_devices, i;
45aa0a1e58SJeff Roberson
46aa0a1e58SJeff Roberson dev_list = ibv_get_device_list(&num_devices);
47aa0a1e58SJeff Roberson if (!dev_list) {
48aa0a1e58SJeff Roberson perror("Failed to get IB devices list");
49aa0a1e58SJeff Roberson return 1;
50aa0a1e58SJeff Roberson }
51aa0a1e58SJeff Roberson
52aa0a1e58SJeff Roberson printf(" %-16s\t node GUID\n", "device");
53aa0a1e58SJeff Roberson printf(" %-16s\t----------------\n", "------");
54aa0a1e58SJeff Roberson
55aa0a1e58SJeff Roberson for (i = 0; i < num_devices; ++i) {
56aa0a1e58SJeff Roberson printf(" %-16s\t%016llx\n",
57aa0a1e58SJeff Roberson ibv_get_device_name(dev_list[i]),
58*d6b92ffaSHans Petter Selasky (unsigned long long) be64toh(ibv_get_device_guid(dev_list[i])));
59aa0a1e58SJeff Roberson }
60aa0a1e58SJeff Roberson
61aa0a1e58SJeff Roberson ibv_free_device_list(dev_list);
62aa0a1e58SJeff Roberson
63aa0a1e58SJeff Roberson return 0;
64aa0a1e58SJeff Roberson }
65