/** * Node description * * @v ibdev Infiniband device * @v mi Management interface * @v mad Received MAD * @v av Source address vector */ static void ib_sma_node_desc ( struct ib_device *ibdev, struct ib_mad_interface *mi, union ib_mad *mad, struct ib_address_vector *av ) { struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc; union ib_guid *guid = &ibdev->node_guid; char hostname[ sizeof ( node_desc->node_string ) ]; int hostname_len; int rc; /* Fill in information */ memset ( node_desc, 0, sizeof ( *node_desc ) ); hostname_len = fetch_string_setting ( NULL, &hostname_setting, hostname, sizeof ( hostname ) ); snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ), "iPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)", hostname, ( ( hostname_len >= 0 ) ? " " : "" ), guid->bytes[0], guid->bytes[1], guid->bytes[2], guid->bytes[3], guid->bytes[4], guid->bytes[5], guid->bytes[6], guid->bytes[7], ibdev->dev->name ); /* Send GetResponse */ mad->hdr.method = IB_MGMT_METHOD_GET_RESP; if ( ( rc = ib_mi_send ( ibdev, mi, mad, av ) ) != 0 ) { DBGC ( mi, "SMA %p could not send NodeDesc GetResponse: %s\n", mi, strerror ( rc ) ); return; } }
/** * Fill in a string field within iBFT from configuration setting * * @v strings iBFT string block descriptor * @v string String field * @v setting Configuration setting * @ret rc Return status code */ static int ibft_set_string_option ( struct ibft_string_block *strings, struct ibft_string *string, struct setting *setting ) { int len; char *dest; int rc; len = fetch_setting_len ( NULL, setting ); if ( len < 0 ) { string->offset = 0; string->length = 0; return 0; } if ( ( rc = ibft_alloc_string ( strings, string, len ) ) != 0 ) return rc; dest = ( ( ( char * ) strings->table ) + string->offset ); fetch_string_setting ( NULL, setting, dest, ( len + 1 ) ); return 0; }