[ofa-general] [PATCH 2 of 2] libibverbs: modify ibv_devinfo to look under pci device as well if it does not find board_id under the ib device

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Jun 19 06:44:27 PDT 2007


devinfo needs to look under the pci device directory for board_id if
it does not find it under the infiniband device directory.

Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>

--- a/src/userspace/libibverbs/examples/devinfo.c	2007-05-01 11:15:29.409126000 +0300
+++ b/src/userspace/libibverbs/examples/devinfo.c	2007-05-08 14:56:02.000000000 +0300
@@ -195,6 +195,14 @@ static int print_hca_cap(struct ibv_devi
 
 	if (ibv_read_sysfs_file(ib_dev->ibdev_path, "board_id", buf, sizeof buf) > 0)
 		printf("\tboard_id:\t\t\t%s\n", buf);
+	else {
+		char syspath[256];
+		strcpy((char *) syspath, ib_dev->ibdev_path);
+		strcat((char *) syspath, "/device");
+		if (ibv_read_sysfs_file((char *) syspath,
+		    "board_id", buf, sizeof buf) > 0)
+			printf("\tboard_id:\t\t\t%s\n", buf);
+	}
 
 	printf("\tphys_port_cnt:\t\t\t%d\n", device_attr.phys_port_cnt);
 



More information about the general mailing list