mirror of
https://github.com/ipxe/ipxe
synced 2025-12-20 03:55:46 +03:00
[infiniband] Split subnet management agent client out into ib_smc.c
Not all Infiniband cards have embedded subnet management agents. Split out the code that communicates with such an embedded SMA into a separate ib_smc.c file, and have drivers call ib_smc_update() explicitly when they suspect that the answers given by the embedded SMA may have changed.
This commit is contained in:
@@ -383,12 +383,13 @@ static int ipoib_get_path_record ( struct ipoib_device *ipoib,
|
||||
path_record->sa_hdr.comp_mask[1] =
|
||||
htonl ( IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID );
|
||||
memcpy ( &path_record->dgid, gid, sizeof ( path_record->dgid ) );
|
||||
memcpy ( &path_record->sgid, &ibdev->port_gid,
|
||||
memcpy ( &path_record->sgid, &ibdev->gid,
|
||||
sizeof ( path_record->sgid ) );
|
||||
|
||||
/* Construct address vector */
|
||||
memset ( &av, 0, sizeof ( av ) );
|
||||
av.lid = ibdev->sm_lid;
|
||||
av.sl = ibdev->sm_sl;
|
||||
av.qpn = IB_SA_QPN;
|
||||
av.qkey = IB_GLOBAL_QKEY;
|
||||
|
||||
@@ -443,12 +444,13 @@ static int ipoib_mc_member_record ( struct ipoib_device *ipoib,
|
||||
mc_member_record->scope__join_state = 1;
|
||||
memcpy ( &mc_member_record->mgid, gid,
|
||||
sizeof ( mc_member_record->mgid ) );
|
||||
memcpy ( &mc_member_record->port_gid, &ibdev->port_gid,
|
||||
memcpy ( &mc_member_record->port_gid, &ibdev->gid,
|
||||
sizeof ( mc_member_record->port_gid ) );
|
||||
|
||||
/* Construct address vector */
|
||||
memset ( &av, 0, sizeof ( av ) );
|
||||
av.lid = ibdev->sm_lid;
|
||||
av.sl = ibdev->sm_sl;
|
||||
av.qpn = IB_SA_QPN;
|
||||
av.qkey = IB_GLOBAL_QKEY;
|
||||
|
||||
@@ -491,7 +493,7 @@ static int ipoib_transmit ( struct net_device *netdev,
|
||||
/* Attempting transmission while link is down will put the
|
||||
* queue pair into an error state, so don't try it.
|
||||
*/
|
||||
if ( ! ibdev->link_up )
|
||||
if ( ! ib_link_ok ( ibdev ) )
|
||||
return -ENETUNREACH;
|
||||
|
||||
/* Construct address vector */
|
||||
@@ -691,13 +693,13 @@ ipoib_meta_complete_recv ( struct ib_device *ibdev __unused,
|
||||
}
|
||||
mad = iobuf->data;
|
||||
|
||||
if ( mad->mad_hdr.status != 0 ) {
|
||||
if ( mad->hdr.status != 0 ) {
|
||||
DBGC ( ipoib, "IPoIB %p metadata RX err status %04x\n",
|
||||
ipoib, ntohs ( mad->mad_hdr.status ) );
|
||||
ipoib, ntohs ( mad->hdr.status ) );
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch ( mad->mad_hdr.tid[0] ) {
|
||||
switch ( mad->hdr.tid[0] ) {
|
||||
case IPOIB_TID_GET_PATH_REC:
|
||||
ipoib_recv_path_record ( ipoib, &mad->path_record );
|
||||
break;
|
||||
@@ -928,7 +930,7 @@ static void ipoib_set_ib_params ( struct ipoib_device *ipoib ) {
|
||||
|
||||
/* Calculate GID portion of MAC address based on port GID */
|
||||
mac = ( ( struct ipoib_mac * ) netdev->ll_addr );
|
||||
memcpy ( &mac->gid, &ibdev->port_gid, sizeof ( mac->gid ) );
|
||||
memcpy ( &mac->gid, &ibdev->gid, sizeof ( mac->gid ) );
|
||||
|
||||
/* Calculate broadcast GID based on partition key */
|
||||
memcpy ( &ipoib->broadcast_gid, &ipv4_broadcast_gid,
|
||||
@@ -936,7 +938,7 @@ static void ipoib_set_ib_params ( struct ipoib_device *ipoib ) {
|
||||
ipoib->broadcast_gid.u.words[2] = htons ( ibdev->pkey );
|
||||
|
||||
/* Set net device link state to reflect Infiniband link state */
|
||||
if ( ibdev->link_up ) {
|
||||
if ( ib_link_ok ( ibdev ) ) {
|
||||
netdev_link_up ( netdev );
|
||||
} else {
|
||||
netdev_link_down ( netdev );
|
||||
|
||||
Reference in New Issue
Block a user