Browse Source

[infiniband] Include hostname in node description, if available

tags/v1.0.0-rc1
Michael Brown 15 years ago
parent
commit
228ac9d018
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      src/net/infiniband/ib_sma.c

+ 7
- 1
src/net/infiniband/ib_sma.c View File

@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
25 25
 #include <stdio.h>
26 26
 #include <unistd.h>
27 27
 #include <byteswap.h>
28
+#include <gpxe/settings.h>
28 29
 #include <gpxe/infiniband.h>
29 30
 #include <gpxe/iobuf.h>
30 31
 #include <gpxe/ib_mi.h>
@@ -88,13 +89,18 @@ static void ib_sma_node_desc ( struct ib_device *ibdev,
88 89
 			       struct ib_address_vector *av ) {
89 90
 	struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc;
90 91
 	struct ib_gid_half guid;
92
+	char hostname[ sizeof ( node_desc->node_string ) ];
93
+	int hostname_len;
91 94
 	int rc;
92 95
 
93 96
 	/* Fill in information */
94 97
 	memset ( node_desc, 0, sizeof ( *node_desc ) );
95 98
 	ib_get_hca_info ( ibdev, &guid );
99
+	hostname_len = fetch_string_setting ( NULL, &hostname_setting,
100
+					      hostname, sizeof ( hostname ) );
96 101
 	snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ),
97
-		   "gPXE %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
102
+		   "gPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
103
+		   hostname, ( ( hostname_len >= 0 ) ? " " : "" ),
98 104
 		   guid.u.bytes[0], guid.u.bytes[1], guid.u.bytes[2],
99 105
 		   guid.u.bytes[3], guid.u.bytes[4], guid.u.bytes[5],
100 106
 		   guid.u.bytes[6], guid.u.bytes[7], ibdev->dev->name );

Loading…
Cancel
Save