[infiniband] Allow MAD handlers to indicate response via return value

Now that MAD handlers no longer return a status code, we can allow
them to return a pointer to a MAD structure if and only if they want
to send a response.  This provides a more natural and flexible
approach than using a "response method" field within the handler's
descriptor.
This commit is contained in:
Michael Brown
2009-07-10 22:31:40 +01:00
parent 94876f4bb6
commit 773028d34e
4 changed files with 104 additions and 71 deletions

View File

@@ -139,9 +139,10 @@ void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
*
* @v gma General management agent
* @v mad MAD
* @ret mad MAD response
*/
static void ib_handle_mc_member_join ( struct ib_gma *gma,
union ib_mad *mad ) {
static union ib_mad * ib_handle_mc_member_join ( struct ib_gma *gma,
union ib_mad *mad ) {
struct ib_device *ibdev = gma->ibdev;
struct ib_mc_member_record *mc_member_record =
&mad->sa.sa_data.mc_member_record;
@@ -154,7 +155,7 @@ static void ib_handle_mc_member_join ( struct ib_gma *gma,
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
DBGC ( gma, "GMA %p join failed with status %04x\n",
gma, ntohs ( mad->hdr.status ) );
return;
return NULL;
}
/* Extract MAD parameters */
@@ -169,7 +170,7 @@ static void ib_handle_mc_member_join ( struct ib_gma *gma,
ntohl ( gid->u.dwords[1] ),
ntohl ( gid->u.dwords[2] ),
ntohl ( gid->u.dwords[3] ) );
return;
return NULL;
}
DBGC ( gma, "GMA %p QPN %lx joined %08x:%08x:%08x:%08x qkey %lx\n",
gma, qp->qpn, ntohl ( gid->u.dwords[0] ),
@@ -180,8 +181,10 @@ static void ib_handle_mc_member_join ( struct ib_gma *gma,
if ( ( rc = ib_modify_qp ( ibdev, qp, IB_MODIFY_QKEY, qkey ) ) != 0 ) {
DBGC ( gma, "GMA %p QPN %lx could not modify qkey: %s\n",
gma, qp->qpn, strerror ( rc ) );
return;
return NULL;
}
return NULL;
}
/**
@@ -189,9 +192,10 @@ static void ib_handle_mc_member_join ( struct ib_gma *gma,
*
* @v gma General management agent
* @v mad MAD
* @v response MAD response
*/
static void ib_handle_mc_member_leave ( struct ib_gma *gma,
union ib_mad *mad ) {
static union ib_mad * ib_handle_mc_member_leave ( struct ib_gma *gma,
union ib_mad *mad ) {
struct ib_mc_member_record *mc_member_record =
&mad->sa.sa_data.mc_member_record;
struct ib_gid *gid;
@@ -200,7 +204,7 @@ static void ib_handle_mc_member_leave ( struct ib_gma *gma,
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
DBGC ( gma, "GMA %p leave failed with status %04x\n",
gma, ntohs ( mad->hdr.status ) );
return;
return NULL;
}
/* Extract MAD parameters */
@@ -208,6 +212,8 @@ static void ib_handle_mc_member_leave ( struct ib_gma *gma,
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[2] ), ntohl ( gid->u.dwords[3] ) );
return NULL;
}
/** Multicast membership record response handler */