mirror of https://github.com/ipxe/ipxe.git
[infiniband] Pass GMA as a parameter to GMA MAD handlers
parent
cb9ef4dee2
commit
8a852280eb
|
@ -17,9 +17,10 @@ struct ib_device;
|
||||||
struct ib_completion_queue;
|
struct ib_completion_queue;
|
||||||
struct ib_queue_pair;
|
struct ib_queue_pair;
|
||||||
union ib_mad;
|
union ib_mad;
|
||||||
|
struct ib_gma;
|
||||||
|
|
||||||
/** A MAD attribute handler */
|
/** A GMA attribute handler */
|
||||||
struct ib_mad_handler {
|
struct ib_gma_handler {
|
||||||
/** Management class */
|
/** Management class */
|
||||||
uint8_t mgmt_class;
|
uint8_t mgmt_class;
|
||||||
/** Class version */
|
/** Class version */
|
||||||
|
@ -32,7 +33,7 @@ struct ib_mad_handler {
|
||||||
uint16_t attr_id;
|
uint16_t attr_id;
|
||||||
/** Handle attribute
|
/** Handle attribute
|
||||||
*
|
*
|
||||||
* @v ibdev Infiniband device
|
* @v gma General management agent
|
||||||
* @v mad MAD
|
* @v mad MAD
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*
|
*
|
||||||
|
@ -40,14 +41,14 @@ struct ib_mad_handler {
|
||||||
* handler returns with a non-zero value in the MAD's @c
|
* handler returns with a non-zero value in the MAD's @c
|
||||||
* method field, it will be sent as a response.
|
* method field, it will be sent as a response.
|
||||||
*/
|
*/
|
||||||
int ( * handle ) ( struct ib_device *ibdev, union ib_mad *mad );
|
int ( * handle ) ( struct ib_gma *gma, union ib_mad *mad );
|
||||||
};
|
};
|
||||||
|
|
||||||
/** MAD attribute handlers */
|
/** GMA attribute handlers */
|
||||||
#define IB_MAD_HANDLERS __table ( struct ib_mad_handler, "ib_mad_handlers" )
|
#define IB_GMA_HANDLERS __table ( struct ib_gma_handler, "ib_gma_handlers" )
|
||||||
|
|
||||||
/** Declare a MAD attribute handler */
|
/** Declare a GMA attribute handler */
|
||||||
#define __ib_mad_handler __table_entry ( IB_MAD_HANDLERS, 01 )
|
#define __ib_gma_handler __table_entry ( IB_GMA_HANDLERS, 01 )
|
||||||
|
|
||||||
/** An Infiniband General Management Agent */
|
/** An Infiniband General Management Agent */
|
||||||
struct ib_gma {
|
struct ib_gma {
|
||||||
|
|
|
@ -75,26 +75,23 @@ struct ib_mad_request {
|
||||||
static unsigned int next_request_tid;
|
static unsigned int next_request_tid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identify attribute handler
|
* Call attribute handler
|
||||||
*
|
*
|
||||||
* @v mgmt_class Management class
|
* @v gma General management agent
|
||||||
* @v class_version Class version
|
* @v mad MAD
|
||||||
* @v method Method
|
* @ret rc Return status code
|
||||||
* @v attr_id Attribute ID (in network byte order)
|
|
||||||
* @ret handler Attribute handler (or NULL)
|
|
||||||
*/
|
*/
|
||||||
static int ib_handle_mad ( struct ib_device *ibdev,
|
static int ib_handle_mad ( struct ib_gma *gma, union ib_mad *mad ) {
|
||||||
union ib_mad *mad ) {
|
|
||||||
struct ib_mad_hdr *hdr = &mad->hdr;
|
struct ib_mad_hdr *hdr = &mad->hdr;
|
||||||
struct ib_mad_handler *handler;
|
struct ib_gma_handler *handler;
|
||||||
|
|
||||||
for_each_table_entry ( handler, IB_MAD_HANDLERS ) {
|
for_each_table_entry ( handler, IB_GMA_HANDLERS ) {
|
||||||
if ( ( handler->mgmt_class == hdr->mgmt_class ) &&
|
if ( ( handler->mgmt_class == hdr->mgmt_class ) &&
|
||||||
( handler->class_version == hdr->class_version ) &&
|
( handler->class_version == hdr->class_version ) &&
|
||||||
( handler->method == hdr->method ) &&
|
( handler->method == hdr->method ) &&
|
||||||
( handler->attr_id == hdr->attr_id ) ) {
|
( handler->attr_id == hdr->attr_id ) ) {
|
||||||
hdr->method = handler->resp_method;
|
hdr->method = handler->resp_method;
|
||||||
return handler->handle ( ibdev, mad );
|
return handler->handle ( gma, mad );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +160,7 @@ static void ib_gma_complete_recv ( struct ib_device *ibdev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle MAD, if possible */
|
/* Handle MAD, if possible */
|
||||||
if ( ( rc = ib_handle_mad ( ibdev, mad ) ) != 0 ) {
|
if ( ( rc = ib_handle_mad ( gma, mad ) ) != 0 ) {
|
||||||
DBGC ( gma, "GMA %p could not handle TID %08x%08x: %s\n",
|
DBGC ( gma, "GMA %p could not handle TID %08x%08x: %s\n",
|
||||||
gma, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ),
|
gma, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ),
|
||||||
strerror ( rc ) );
|
strerror ( rc ) );
|
||||||
|
|
|
@ -36,12 +36,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
/**
|
/**
|
||||||
* Transmit multicast group membership request
|
* Transmit multicast group membership request
|
||||||
*
|
*
|
||||||
* @v ibdev Infiniband device
|
* @v gma General management agent
|
||||||
* @v gid Multicast GID
|
* @v gid Multicast GID
|
||||||
* @v join Join (rather than leave) group
|
* @v join Join (rather than leave) group
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int ib_mc_member_request ( struct ib_device *ibdev, struct ib_gid *gid,
|
static int ib_mc_member_request ( struct ib_gma *gma, struct ib_gid *gid,
|
||||||
int join ) {
|
int join ) {
|
||||||
union ib_mad mad;
|
union ib_mad mad;
|
||||||
struct ib_mad_sa *sa = &mad.sa;
|
struct ib_mad_sa *sa = &mad.sa;
|
||||||
|
@ -61,14 +61,13 @@ static int ib_mc_member_request ( struct ib_device *ibdev, struct ib_gid *gid,
|
||||||
sa->sa_data.mc_member_record.scope__join_state = 1;
|
sa->sa_data.mc_member_record.scope__join_state = 1;
|
||||||
memcpy ( &sa->sa_data.mc_member_record.mgid, gid,
|
memcpy ( &sa->sa_data.mc_member_record.mgid, gid,
|
||||||
sizeof ( sa->sa_data.mc_member_record.mgid ) );
|
sizeof ( sa->sa_data.mc_member_record.mgid ) );
|
||||||
memcpy ( &sa->sa_data.mc_member_record.port_gid, &ibdev->gid,
|
memcpy ( &sa->sa_data.mc_member_record.port_gid, &gma->ibdev->gid,
|
||||||
sizeof ( sa->sa_data.mc_member_record.port_gid ) );
|
sizeof ( sa->sa_data.mc_member_record.port_gid ) );
|
||||||
|
|
||||||
/* Issue multicast membership record request */
|
/* Issue multicast membership record request */
|
||||||
if ( ( rc = ib_gma_request ( &ibdev->gma, &mad, NULL,
|
if ( ( rc = ib_gma_request ( gma, &mad, NULL, join ) ) != 0 ) {
|
||||||
join ) ) != 0 ) {
|
DBGC ( gma, "GMA %p could not join group: %s\n",
|
||||||
DBGC ( ibdev, "IBDEV %p could not join group: %s\n",
|
gma, strerror ( rc ) );
|
||||||
ibdev, strerror ( rc ) );
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,22 +84,23 @@ static int ib_mc_member_request ( struct ib_device *ibdev, struct ib_gid *gid,
|
||||||
*/
|
*/
|
||||||
int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||||
struct ib_gid *gid ) {
|
struct ib_gid *gid ) {
|
||||||
|
struct ib_gma *gma = &ibdev->gma;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
DBGC ( ibdev, "IBDEV %p QPN %lx joining %08x:%08x:%08x:%08x\n",
|
DBGC ( gma, "GMA %p QPN %lx joining %08x:%08x:%08x:%08x\n",
|
||||||
ibdev, qp->qpn, ntohl ( gid->u.dwords[0] ),
|
gma, qp->qpn, ntohl ( gid->u.dwords[0] ),
|
||||||
ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
|
ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
|
||||||
ntohl ( gid->u.dwords[3] ) );
|
ntohl ( gid->u.dwords[3] ) );
|
||||||
|
|
||||||
/* Attach queue pair to multicast GID */
|
/* Attach queue pair to multicast GID */
|
||||||
if ( ( rc = ib_mcast_attach ( ibdev, qp, gid ) ) != 0 ) {
|
if ( ( rc = ib_mcast_attach ( ibdev, qp, gid ) ) != 0 ) {
|
||||||
DBGC ( ibdev, "IBDEV %p could not attach: %s\n",
|
DBGC ( gma, "GMA %p could not attach: %s\n",
|
||||||
ibdev, strerror ( rc ) );
|
gma, strerror ( rc ) );
|
||||||
goto err_mcast_attach;
|
goto err_mcast_attach;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initiate multicast membership join */
|
/* Initiate multicast membership join */
|
||||||
if ( ( rc = ib_mc_member_request ( ibdev, gid, 1 ) ) != 0 )
|
if ( ( rc = ib_mc_member_request ( gma, gid, 1 ) ) != 0 )
|
||||||
goto err_mc_member_record;
|
goto err_mc_member_record;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -120,9 +120,10 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||||
*/
|
*/
|
||||||
void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||||
struct ib_gid *gid ) {
|
struct ib_gid *gid ) {
|
||||||
|
struct ib_gma *gma = &ibdev->gma;
|
||||||
|
|
||||||
DBGC ( ibdev, "IBDEV %p QPN %lx leaving %08x:%08x:%08x:%08x\n",
|
DBGC ( gma, "GMA %p QPN %lx leaving %08x:%08x:%08x:%08x\n",
|
||||||
ibdev, qp->qpn, ntohl ( gid->u.dwords[0] ),
|
gma, qp->qpn, ntohl ( gid->u.dwords[0] ),
|
||||||
ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
|
ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
|
||||||
ntohl ( gid->u.dwords[3] ) );
|
ntohl ( gid->u.dwords[3] ) );
|
||||||
|
|
||||||
|
@ -130,18 +131,19 @@ void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||||
ib_mcast_detach ( ibdev, qp, gid );
|
ib_mcast_detach ( ibdev, qp, gid );
|
||||||
|
|
||||||
/* Initiate multicast membership leave */
|
/* Initiate multicast membership leave */
|
||||||
ib_mc_member_request ( ibdev, gid, 0 );
|
ib_mc_member_request ( gma, gid, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle multicast membership record join response
|
* Handle multicast membership record join response
|
||||||
*
|
*
|
||||||
* @v ibdev Infiniband device
|
* @v gma General management agent
|
||||||
* @v mad MAD
|
* @v mad MAD
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int ib_handle_mc_member_join ( struct ib_device *ibdev,
|
static int ib_handle_mc_member_join ( struct ib_gma *gma,
|
||||||
union ib_mad *mad ) {
|
union ib_mad *mad ) {
|
||||||
|
struct ib_device *ibdev = gma->ibdev;
|
||||||
struct ib_mc_member_record *mc_member_record =
|
struct ib_mc_member_record *mc_member_record =
|
||||||
&mad->sa.sa_data.mc_member_record;
|
&mad->sa.sa_data.mc_member_record;
|
||||||
struct ib_queue_pair *qp;
|
struct ib_queue_pair *qp;
|
||||||
|
@ -151,8 +153,8 @@ static int ib_handle_mc_member_join ( struct ib_device *ibdev,
|
||||||
|
|
||||||
/* Ignore if not a success */
|
/* Ignore if not a success */
|
||||||
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
|
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
|
||||||
DBGC ( ibdev, "IBDEV %p join failed with status %04x\n",
|
DBGC ( gma, "GMA %p join failed with status %04x\n",
|
||||||
ibdev, ntohs ( mad->hdr.status ) );
|
gma, ntohs ( mad->hdr.status ) );
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,24 +165,22 @@ static int ib_handle_mc_member_join ( struct ib_device *ibdev,
|
||||||
/* Locate matching queue pair */
|
/* Locate matching queue pair */
|
||||||
qp = ib_find_qp_mgid ( ibdev, gid );
|
qp = ib_find_qp_mgid ( ibdev, gid );
|
||||||
if ( ! qp ) {
|
if ( ! qp ) {
|
||||||
DBGC ( ibdev, "IBDEV %p has no QP to join "
|
DBGC ( gma, "GMA %p has no QP to join %08x:%08x:%08x:%08x\n",
|
||||||
"%08x:%08x:%08x:%08x\n", ibdev,
|
gma, ntohl ( gid->u.dwords[0] ),
|
||||||
ntohl ( gid->u.dwords[0] ),
|
|
||||||
ntohl ( gid->u.dwords[1] ),
|
ntohl ( gid->u.dwords[1] ),
|
||||||
ntohl ( gid->u.dwords[2] ),
|
ntohl ( gid->u.dwords[2] ),
|
||||||
ntohl ( gid->u.dwords[3] ) );
|
ntohl ( gid->u.dwords[3] ) );
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
DBGC ( ibdev, "IBDEV %p QPN %lx joined %08x:%08x:%08x:%08x qkey "
|
DBGC ( gma, "GMA %p QPN %lx joined %08x:%08x:%08x:%08x qkey %lx\n",
|
||||||
"%lx\n", ibdev, qp->qpn,
|
gma, qp->qpn, ntohl ( gid->u.dwords[0] ),
|
||||||
ntohl ( gid->u.dwords[0] ), ntohl ( gid->u.dwords[1] ),
|
ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
|
||||||
ntohl ( gid->u.dwords[2] ), ntohl ( gid->u.dwords[3] ),
|
ntohl ( gid->u.dwords[3] ), qkey );
|
||||||
qkey );
|
|
||||||
|
|
||||||
/* Set queue key */
|
/* Set queue key */
|
||||||
if ( ( rc = ib_modify_qp ( ibdev, qp, IB_MODIFY_QKEY, qkey ) ) != 0 ) {
|
if ( ( rc = ib_modify_qp ( ibdev, qp, IB_MODIFY_QKEY, qkey ) ) != 0 ) {
|
||||||
DBGC ( ibdev, "IBDEV %p QPN %lx could not modify qkey: %s\n",
|
DBGC ( gma, "GMA %p QPN %lx could not modify qkey: %s\n",
|
||||||
ibdev, qp->qpn, strerror ( rc ) );
|
gma, qp->qpn, strerror ( rc ) );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,11 +190,11 @@ static int ib_handle_mc_member_join ( struct ib_device *ibdev,
|
||||||
/**
|
/**
|
||||||
* Handle multicast membership record leave response
|
* Handle multicast membership record leave response
|
||||||
*
|
*
|
||||||
* @v ibdev Infiniband device
|
* @v gma General management agent
|
||||||
* @v mad MAD
|
* @v mad MAD
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int ib_handle_mc_member_leave ( struct ib_device *ibdev,
|
static int ib_handle_mc_member_leave ( struct ib_gma *gma,
|
||||||
union ib_mad *mad ) {
|
union ib_mad *mad ) {
|
||||||
struct ib_mc_member_record *mc_member_record =
|
struct ib_mc_member_record *mc_member_record =
|
||||||
&mad->sa.sa_data.mc_member_record;
|
&mad->sa.sa_data.mc_member_record;
|
||||||
|
@ -202,14 +202,14 @@ static int ib_handle_mc_member_leave ( struct ib_device *ibdev,
|
||||||
|
|
||||||
/* Ignore if not a success */
|
/* Ignore if not a success */
|
||||||
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
|
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
|
||||||
DBGC ( ibdev, "IBDEV %p leave failed with status %04x\n",
|
DBGC ( gma, "GMA %p leave failed with status %04x\n",
|
||||||
ibdev, ntohs ( mad->hdr.status ) );
|
gma, ntohs ( mad->hdr.status ) );
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract MAD parameters */
|
/* Extract MAD parameters */
|
||||||
gid = &mc_member_record->mgid;
|
gid = &mc_member_record->mgid;
|
||||||
DBGC ( ibdev, "IBDEV %p left %08x:%08x:%08x:%08x\n", ibdev,
|
DBGC ( gma, "GMA %p left %08x:%08x:%08x:%08x\n", gma,
|
||||||
ntohl ( gid->u.dwords[0] ), ntohl ( gid->u.dwords[1] ),
|
ntohl ( gid->u.dwords[0] ), ntohl ( gid->u.dwords[1] ),
|
||||||
ntohl ( gid->u.dwords[2] ), ntohl ( gid->u.dwords[3] ) );
|
ntohl ( gid->u.dwords[2] ), ntohl ( gid->u.dwords[3] ) );
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ static int ib_handle_mc_member_leave ( struct ib_device *ibdev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Multicast membership record response handler */
|
/** Multicast membership record response handler */
|
||||||
struct ib_mad_handler ib_mc_member_record_handlers[] __ib_mad_handler = {
|
struct ib_gma_handler ib_mc_member_record_handlers[] __ib_gma_handler = {
|
||||||
{
|
{
|
||||||
.mgmt_class = IB_MGMT_CLASS_SUBN_ADM,
|
.mgmt_class = IB_MGMT_CLASS_SUBN_ADM,
|
||||||
.class_version = IB_SA_CLASS_VERSION,
|
.class_version = IB_SA_CLASS_VERSION,
|
||||||
|
|
|
@ -98,6 +98,7 @@ ib_find_path_cache_entry ( struct ib_device *ibdev, struct ib_gid *dgid ) {
|
||||||
*/
|
*/
|
||||||
int ib_resolve_path ( struct ib_device *ibdev,
|
int ib_resolve_path ( struct ib_device *ibdev,
|
||||||
struct ib_address_vector *av ) {
|
struct ib_address_vector *av ) {
|
||||||
|
struct ib_gma *gma = &ibdev->gma;
|
||||||
struct ib_gid *gid = &av->gid;
|
struct ib_gid *gid = &av->gid;
|
||||||
struct ib_cached_path_record *cached;
|
struct ib_cached_path_record *cached;
|
||||||
union ib_mad mad;
|
union ib_mad mad;
|
||||||
|
@ -107,8 +108,8 @@ int ib_resolve_path ( struct ib_device *ibdev,
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
if ( ! av->gid_present ) {
|
if ( ! av->gid_present ) {
|
||||||
DBGC ( ibdev, "IBDEV %p attempt to look up path record "
|
DBGC ( gma, "GMA %p attempt to look up path record "
|
||||||
"without GID\n", ibdev );
|
"without GID\n", gma );
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,13 +120,13 @@ int ib_resolve_path ( struct ib_device *ibdev,
|
||||||
av->lid = cached->dlid;
|
av->lid = cached->dlid;
|
||||||
av->rate = cached->rate;
|
av->rate = cached->rate;
|
||||||
av->sl = cached->sl;
|
av->sl = cached->sl;
|
||||||
DBGC2 ( ibdev, "IBDEV %p cache hit for %08x:%08x:%08x:%08x\n",
|
DBGC2 ( gma, "GMA %p cache hit for %08x:%08x:%08x:%08x\n",
|
||||||
ibdev, htonl ( gid->u.dwords[0] ),
|
gma, htonl ( gid->u.dwords[0] ),
|
||||||
htonl ( gid->u.dwords[1] ), htonl ( gid->u.dwords[2] ),
|
htonl ( gid->u.dwords[1] ), htonl ( gid->u.dwords[2] ),
|
||||||
htonl ( gid->u.dwords[3] ) );
|
htonl ( gid->u.dwords[3] ) );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
DBGC ( ibdev, "IBDEV %p cache miss for %08x:%08x:%08x:%08x%s\n", ibdev,
|
DBGC ( gma, "GMA %p cache miss for %08x:%08x:%08x:%08x%s\n", gma,
|
||||||
htonl ( gid->u.dwords[0] ), htonl ( gid->u.dwords[1] ),
|
htonl ( gid->u.dwords[0] ), htonl ( gid->u.dwords[1] ),
|
||||||
htonl ( gid->u.dwords[2] ), htonl ( gid->u.dwords[3] ),
|
htonl ( gid->u.dwords[2] ), htonl ( gid->u.dwords[3] ),
|
||||||
( cached ? " (in progress)" : "" ) );
|
( cached ? " (in progress)" : "" ) );
|
||||||
|
@ -154,9 +155,9 @@ int ib_resolve_path ( struct ib_device *ibdev,
|
||||||
sizeof ( sa->sa_data.path_record.sgid ) );
|
sizeof ( sa->sa_data.path_record.sgid ) );
|
||||||
|
|
||||||
/* Issue path record request */
|
/* Issue path record request */
|
||||||
if ( ( rc = ib_gma_request ( &ibdev->gma, &mad, NULL, 1 ) ) != 0 ) {
|
if ( ( rc = ib_gma_request ( gma, &mad, NULL, 1 ) ) != 0 ) {
|
||||||
DBGC ( ibdev, "IBDEV %p could not get path record: %s\n",
|
DBGC ( gma, "GMA %p could not get path record: %s\n",
|
||||||
ibdev, strerror ( rc ) );
|
gma, strerror ( rc ) );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,12 +168,13 @@ int ib_resolve_path ( struct ib_device *ibdev,
|
||||||
/**
|
/**
|
||||||
* Handle path record response
|
* Handle path record response
|
||||||
*
|
*
|
||||||
* @v ibdev Infiniband device
|
* @v gma General management agent
|
||||||
* @v mad MAD
|
* @v mad MAD
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int ib_handle_path_record ( struct ib_device *ibdev,
|
static int ib_handle_path_record ( struct ib_gma *gma,
|
||||||
union ib_mad *mad ) {
|
union ib_mad *mad ) {
|
||||||
|
struct ib_device *ibdev = gma->ibdev;
|
||||||
struct ib_path_record *path_record = &mad->sa.sa_data.path_record;
|
struct ib_path_record *path_record = &mad->sa.sa_data.path_record;
|
||||||
struct ib_gid *dgid = &path_record->dgid;
|
struct ib_gid *dgid = &path_record->dgid;
|
||||||
struct ib_cached_path_record *cached;
|
struct ib_cached_path_record *cached;
|
||||||
|
@ -182,8 +184,8 @@ static int ib_handle_path_record ( struct ib_device *ibdev,
|
||||||
|
|
||||||
/* Ignore if not a success */
|
/* Ignore if not a success */
|
||||||
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
|
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
|
||||||
DBGC ( ibdev, "IBDEV %p path record lookup failed with status "
|
DBGC ( gma, "GMA %p path record lookup failed with status "
|
||||||
"%04x\n", ibdev, ntohs ( mad->hdr.status ) );
|
"%04x\n", gma, ntohs ( mad->hdr.status ) );
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,15 +193,15 @@ static int ib_handle_path_record ( struct ib_device *ibdev,
|
||||||
dlid = ntohs ( path_record->dlid );
|
dlid = ntohs ( path_record->dlid );
|
||||||
sl = ( path_record->reserved__sl & 0x0f );
|
sl = ( path_record->reserved__sl & 0x0f );
|
||||||
rate = ( path_record->rate_selector__rate & 0x3f );
|
rate = ( path_record->rate_selector__rate & 0x3f );
|
||||||
DBGC ( ibdev, "IBDEV %p path to %08x:%08x:%08x:%08x is %04x sl %d "
|
DBGC ( gma, "GMA %p path to %08x:%08x:%08x:%08x is %04x sl %d "
|
||||||
"rate %d\n", ibdev, htonl ( dgid->u.dwords[0] ),
|
"rate %d\n", gma, htonl ( dgid->u.dwords[0] ),
|
||||||
htonl ( dgid->u.dwords[1] ), htonl ( dgid->u.dwords[2] ),
|
htonl ( dgid->u.dwords[1] ), htonl ( dgid->u.dwords[2] ),
|
||||||
htonl ( dgid->u.dwords[3] ), dlid, sl, rate );
|
htonl ( dgid->u.dwords[3] ), dlid, sl, rate );
|
||||||
|
|
||||||
/* Look for a matching cache entry to fill in */
|
/* Look for a matching cache entry to fill in */
|
||||||
if ( ( cached = ib_find_path_cache_entry ( ibdev, dgid ) ) != NULL ) {
|
if ( ( cached = ib_find_path_cache_entry ( ibdev, dgid ) ) != NULL ) {
|
||||||
DBGC ( ibdev, "IBDEV %p cache add for %08x:%08x:%08x:%08x\n",
|
DBGC ( gma, "GMA %p cache add for %08x:%08x:%08x:%08x\n",
|
||||||
ibdev, htonl ( dgid->u.dwords[0] ),
|
gma, htonl ( dgid->u.dwords[0] ),
|
||||||
htonl ( dgid->u.dwords[1] ),
|
htonl ( dgid->u.dwords[1] ),
|
||||||
htonl ( dgid->u.dwords[2] ),
|
htonl ( dgid->u.dwords[2] ),
|
||||||
htonl ( dgid->u.dwords[3] ) );
|
htonl ( dgid->u.dwords[3] ) );
|
||||||
|
@ -212,7 +214,7 @@ static int ib_handle_path_record ( struct ib_device *ibdev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Path record response handler */
|
/** Path record response handler */
|
||||||
struct ib_mad_handler ib_path_record_handler __ib_mad_handler = {
|
struct ib_gma_handler ib_path_record_handler __ib_gma_handler = {
|
||||||
.mgmt_class = IB_MGMT_CLASS_SUBN_ADM,
|
.mgmt_class = IB_MGMT_CLASS_SUBN_ADM,
|
||||||
.class_version = IB_SA_CLASS_VERSION,
|
.class_version = IB_SA_CLASS_VERSION,
|
||||||
.method = IB_MGMT_METHOD_GET_RESP,
|
.method = IB_MGMT_METHOD_GET_RESP,
|
||||||
|
|
Loading…
Reference in New Issue