ib_smc.h File Reference

Infiniband Subnet Management Client. More...

#include <gpxe/infiniband.h>

Go to the source code of this file.

Typedefs

typedef int(* ib_local_mad_t )(struct ib_device *ibdev, union ib_mad *mad)

Functions

 FILE_LICENCE (GPL2_OR_LATER)
int ib_smc_update (struct ib_device *ibdev, ib_local_mad_t local_mad)
 Get MAD parameters.


Detailed Description

Infiniband Subnet Management Client.

Definition in file ib_smc.h.


Typedef Documentation

typedef int( * ib_local_mad_t)(struct ib_device *ibdev, union ib_mad *mad)

Definition at line 14 of file ib_smc.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

int ib_smc_update ( struct ib_device ibdev,
ib_local_mad_t  local_mad 
)

Get MAD parameters.

Parameters:
ibdev Infiniband device
local_mad Method for issuing local MADs
Return values:
rc Return status code

Definition at line 132 of file ib_smc.c.

References DBGC, ib_gid::dwords, ib_device::gid, ib_port_info::gid_prefix, ib_guid_info::guid, ib_smp_data::guid_info, ib_gid::half, htonl, ib_smc_get_guid_info(), ib_smc_get_pkey_table(), ib_smc_get_port_info(), ib_port_info::lid, ib_device::lid, ib_device::link_speed_active, ib_port_info::link_speed_active__link_speed_enabled, ib_device::link_speed_enabled, ib_device::link_speed_supported, ib_port_info::link_speed_supported__port_state, ib_port_info::link_width_active, ib_device::link_width_active, ib_port_info::link_width_enabled, ib_device::link_width_enabled, ib_port_info::link_width_supported, ib_device::link_width_supported, ib_port_info::mastersm_lid, memcpy, ib_port_info::neighbour_mtu__mastersm_sl, ntohs, ib_pkey_table::pkey, ib_device::pkey, ib_smp_data::pkey_table, ib_smp_data::port_info, ib_device::port_state, ib_device::sm_lid, ib_device::sm_sl, ib_mad::smp, ib_mad_smp::smp_data, and ib_gid::u.

Referenced by arbel_event_port_state_change(), arbel_open(), arbel_probe(), hermon_event_port_state_change(), hermon_inform_sma(), hermon_open(), and hermon_probe().

00132                                                                         {
00133         union ib_mad mad;
00134         struct ib_port_info *port_info = &mad.smp.smp_data.port_info;
00135         struct ib_guid_info *guid_info = &mad.smp.smp_data.guid_info;
00136         struct ib_pkey_table *pkey_table = &mad.smp.smp_data.pkey_table;
00137         int rc;
00138 
00139         /* Port info gives us the link state, the first half of the
00140          * port GID and the SM LID.
00141          */
00142         if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
00143                 return rc;
00144         memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
00145                  sizeof ( ibdev->gid.u.half[0] ) );
00146         ibdev->lid = ntohs ( port_info->lid );
00147         ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
00148         ibdev->link_width_enabled = port_info->link_width_enabled;
00149         ibdev->link_width_supported = port_info->link_width_supported;
00150         ibdev->link_width_active = port_info->link_width_active;
00151         ibdev->link_speed_supported =
00152                 ( port_info->link_speed_supported__port_state >> 4 );
00153         ibdev->port_state =
00154                 ( port_info->link_speed_supported__port_state & 0xf );
00155         ibdev->link_speed_active =
00156                 ( port_info->link_speed_active__link_speed_enabled >> 4 );
00157         ibdev->link_speed_enabled =
00158                 ( port_info->link_speed_active__link_speed_enabled & 0xf );
00159         ibdev->sm_sl = ( port_info->neighbour_mtu__mastersm_sl & 0xf );
00160 
00161         /* GUID info gives us the second half of the port GID */
00162         if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
00163                 return rc;
00164         memcpy ( &ibdev->gid.u.half[1], guid_info->guid[0],
00165                  sizeof ( ibdev->gid.u.half[1] ) );
00166 
00167         /* Get partition key */
00168         if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
00169                 return rc;
00170         ibdev->pkey = ntohs ( pkey_table->pkey[0] );
00171 
00172         DBGC ( ibdev, "IBDEV %p port GID is %08x:%08x:%08x:%08x\n", ibdev,
00173                htonl ( ibdev->gid.u.dwords[0] ),
00174                htonl ( ibdev->gid.u.dwords[1] ),
00175                htonl ( ibdev->gid.u.dwords[2] ),
00176                htonl ( ibdev->gid.u.dwords[3] ) );
00177 
00178         return 0;
00179 }


Generated on Tue Apr 6 20:01:50 2010 for gPXE by  doxygen 1.5.7.1