mirror of
https://github.com/ipxe/ipxe
synced 2025-12-19 19:49:45 +03:00
[infiniband] Expose supported and enabled link speeds and widths
This commit is contained in:
@@ -204,16 +204,17 @@ static union ib_mad * ib_sma_get_port_info ( struct ib_gma *gma,
|
||||
port_info->lid = ntohs ( ibdev->lid );
|
||||
port_info->mastersm_lid = ntohs ( ibdev->sm_lid );
|
||||
port_info->local_port_num = ibdev->port;
|
||||
port_info->link_width_enabled = ibdev->link_width;
|
||||
port_info->link_width_supported = ibdev->link_width;
|
||||
port_info->link_width_active = ibdev->link_width;
|
||||
port_info->link_width_enabled = ibdev->link_width_enabled;
|
||||
port_info->link_width_supported = ibdev->link_width_supported;
|
||||
port_info->link_width_active = ibdev->link_width_active;
|
||||
port_info->link_speed_supported__port_state =
|
||||
( ( ibdev->link_speed << 4 ) | ibdev->port_state );
|
||||
( ( ibdev->link_speed_supported << 4 ) | ibdev->port_state );
|
||||
port_info->port_phys_state__link_down_def_state =
|
||||
( ( IB_PORT_PHYS_STATE_POLLING << 4 ) |
|
||||
IB_PORT_PHYS_STATE_POLLING );
|
||||
port_info->link_speed_active__link_speed_enabled =
|
||||
( ( ibdev->link_speed << 4 ) | ibdev->link_speed );
|
||||
( ( ibdev->link_speed_active << 4 ) |
|
||||
ibdev->link_speed_enabled );
|
||||
port_info->neighbour_mtu__mastersm_sl =
|
||||
( ( IB_MTU_2048 << 4 ) | ibdev->sm_sl );
|
||||
port_info->vl_cap__init_type = ( IB_VL_0 << 4 );
|
||||
@@ -236,17 +237,27 @@ static union ib_mad * ib_sma_set_port_info ( struct ib_gma *gma,
|
||||
union ib_mad *mad ) {
|
||||
struct ib_device *ibdev = gma->ibdev;
|
||||
const struct ib_port_info *port_info = &mad->smp.smp_data.port_info;
|
||||
unsigned int link_width_enabled;
|
||||
unsigned int link_speed_enabled;
|
||||
int rc;
|
||||
|
||||
memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
|
||||
sizeof ( ibdev->gid.u.half[0] ) );
|
||||
ibdev->lid = ntohs ( port_info->lid );
|
||||
ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
|
||||
if ( ( link_width_enabled = port_info->link_width_enabled ) )
|
||||
ibdev->link_width_enabled = link_width_enabled;
|
||||
if ( ( link_speed_enabled =
|
||||
( port_info->link_speed_active__link_speed_enabled & 0xf ) ) )
|
||||
ibdev->link_speed_enabled = link_speed_enabled;
|
||||
ibdev->sm_sl = ( port_info->neighbour_mtu__mastersm_sl & 0xf );
|
||||
DBGC ( gma, "GMA %p set LID %04x SMLID %04x link width %02x speed "
|
||||
"%02x\n", gma, ibdev->lid, ibdev->sm_lid,
|
||||
ibdev->link_width_enabled, ibdev->link_speed_enabled );
|
||||
|
||||
if ( ( rc = ib_set_port_info ( ibdev, port_info ) ) != 0 ) {
|
||||
DBGC ( ibdev, "IBDEV %p could not set port information: %s\n",
|
||||
ibdev, strerror ( rc ) );
|
||||
DBGC ( gma, "GMA %p could not set port information: %s\n",
|
||||
gma, strerror ( rc ) );
|
||||
mad->hdr.status =
|
||||
htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
|
||||
}
|
||||
|
||||
@@ -131,7 +131,9 @@ static int ib_smc_get_pkey_table ( struct ib_device *ibdev,
|
||||
*/
|
||||
int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
|
||||
union ib_mad mad;
|
||||
union ib_smp_data *smp = &mad.smp.smp_data;
|
||||
struct ib_port_info *port_info = &mad.smp.smp_data.port_info;
|
||||
struct ib_guid_info *guid_info = &mad.smp.smp_data.guid_info;
|
||||
struct ib_pkey_table *pkey_table = &mad.smp.smp_data.pkey_table;
|
||||
int rc;
|
||||
|
||||
/* Port info gives us the link state, the first half of the
|
||||
@@ -139,24 +141,33 @@ int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
|
||||
*/
|
||||
if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
|
||||
return rc;
|
||||
ibdev->port_state =
|
||||
( smp->port_info.link_speed_supported__port_state & 0x0f );
|
||||
memcpy ( &ibdev->gid.u.half[0], smp->port_info.gid_prefix,
|
||||
memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
|
||||
sizeof ( ibdev->gid.u.half[0] ) );
|
||||
ibdev->lid = ntohs ( smp->port_info.lid );
|
||||
ibdev->sm_lid = ntohs ( smp->port_info.mastersm_lid );
|
||||
ibdev->sm_sl = ( smp->port_info.neighbour_mtu__mastersm_sl & 0xf );
|
||||
ibdev->lid = ntohs ( port_info->lid );
|
||||
ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
|
||||
ibdev->link_width_enabled = port_info->link_width_enabled;
|
||||
ibdev->link_width_supported = port_info->link_width_supported;
|
||||
ibdev->link_width_active = port_info->link_width_active;
|
||||
ibdev->link_speed_supported =
|
||||
( port_info->link_speed_supported__port_state >> 4 );
|
||||
ibdev->port_state =
|
||||
( port_info->link_speed_supported__port_state & 0xf );
|
||||
ibdev->link_speed_active =
|
||||
( port_info->link_speed_active__link_speed_enabled >> 4 );
|
||||
ibdev->link_speed_enabled =
|
||||
( port_info->link_speed_active__link_speed_enabled & 0xf );
|
||||
ibdev->sm_sl = ( port_info->neighbour_mtu__mastersm_sl & 0xf );
|
||||
|
||||
/* GUID info gives us the second half of the port GID */
|
||||
if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
|
||||
return rc;
|
||||
memcpy ( &ibdev->gid.u.half[1], smp->guid_info.guid[0],
|
||||
memcpy ( &ibdev->gid.u.half[1], guid_info->guid[0],
|
||||
sizeof ( ibdev->gid.u.half[1] ) );
|
||||
|
||||
/* Get partition key */
|
||||
if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
|
||||
return rc;
|
||||
ibdev->pkey = ntohs ( smp->pkey_table.pkey[0] );
|
||||
ibdev->pkey = ntohs ( pkey_table->pkey[0] );
|
||||
|
||||
DBGC ( ibdev, "IBDEV %p port GID is %08x:%08x:%08x:%08x\n", ibdev,
|
||||
htonl ( ibdev->gid.u.dwords[0] ),
|
||||
|
||||
Reference in New Issue
Block a user